1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.FinancialManagement
- {
- public class frmEditStatisticsProgram : LYFZ.Software.UI.FinancialManagement.frmEditStatisticsProgram
- {
- public frmEditStatisticsProgram() {
- this.btnClose.Click += btnClose_Click;
- this.btnSave.Click += btnSave_Click;
- this.Shown += frmEditStatisticsProgram_Shown;
- this.treecustomersource.AfterCheck += treecustomersource_AfterCheck;
- this.treeOrdercategory.AfterCheck += treecustomersource_AfterCheck;
- this.treePaymentMethod.AfterCheck += treecustomersource_AfterCheck;
- //
- this.grbAdditionalConditions.Hide();
- this.treecustomersource.NodeMouseClick += treecustomersource_NodeMouseClick;
- this.treeOrdercategory.NodeMouseClick += treecustomersource_NodeMouseClick;
- this.treePaymentMethod.NodeMouseClick += treecustomersource_NodeMouseClick;
- this.cmbItemCategory.SelectedIndexChanged += cmbItemCategory_SelectedIndexChanged;
- this.cmbProjectTitle.ComboBoxTreeViewEx_TextChanged += cmbProjectTitle_ComboBoxTreeViewEx_TextChanged;
- // SetGrbAdditionalConditions(false);
- }
- void cmbProjectTitle_ComboBoxTreeViewEx_TextChanged(object sender, TreeViewEventArgs e)
- {
- if (this.cmbItemCategory.SelectedIndex != 0)
- {
- LYFZ.Model.WageStatisticsQueryItem sItem = (LYFZ.Model.WageStatisticsQueryItem)Enum.Parse(typeof(LYFZ.Model.WageStatisticsQueryItem), this.cmbItemCategory.SelectedItem.ToString());
- if (sItem == Model.WageStatisticsQueryItem.订单后期)
- {
- if (e.Node.Name.ToUpper() == BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.选片二销).ToUpper())
- {
- ShowOrHideProcessAdditionalConditions(true);
- ShowOrHideSelectionFilmsAmount(true);
- SetGrbAdditionalConditions(true);
- }
- else {
- ShowOrHideProcessAdditionalConditions(false);
- ShowOrHideSelectionFilmsAmount(false);
- this.plProcessAdditionalConditions.Visible = true;
- SetGrbAdditionalConditions(true);
- this.plProcessAdditionalConditions.Visible = false;
- }
- }
- }
- }
- BLL.BLL_WageQueryConfig wqcBll = new BLL.BLL_WageQueryConfig();
- LYFZ.Model.Model_WageQueryConfig wqcModel = null;
- /// <summary>
- /// 当前统计配置对象
- /// </summary>
- public LYFZ.Model.Model_WageQueryConfig WqcModel
- {
- get { return wqcModel; }
- set { wqcModel = value; }
- }
- LYFZ.Model.AdditionalConditions aCModel = null;
- /// <summary>
- /// 保存
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSave_Click(object sender, EventArgs e)
- {
- try
- {
- if (string.IsNullOrEmpty(this.txtProgramName.Text.Trim()))
- {
- MessageBoxCustom.Show("请输入统计名称");
- return;
- }
- string programName = this.txtProgramName.Text.Trim();
- if (wqcModel == null || wqcModel.ID <= 0)
- {
- if (wqcBll.Exists("WQC_QueryName", programName))
- {
- MessageBoxCustom.Show("你输入的统计名称已经存在,请更换名称");
- return;
- }
- }
- if (this.cmbItemCategory.SelectedIndex == 0)
- {
- MessageBoxCustom.Show("请选择要统计的项目"); return;
- }
- if (this.cmbProjectTitle.TreeView.SelectedNode == null)
- {
- MessageBoxCustom.Show("请选择项目内容"); return;
- }
- if (this.cmbCommissionScheme.Enabled && this.cmbCommissionScheme.TreeView.SelectedNode == null)
- {
- MessageBoxCustom.Show("请选择提成方案"); return;
- }
- // MessageBoxCustom.Show(programName+"\r\n"+this.cmbItemCategory.SelectedItem.ToString()+"\r\n"+this.cmbProjectTitle.TreeView.SelectedNode.Text+"\r\n"+this.cmbCommissionScheme.TreeView.SelectedNode.Text);
- LYFZ.Model.WageStatisticsQueryItem sItem = (LYFZ.Model.WageStatisticsQueryItem)Enum.Parse(typeof(LYFZ.Model.WageStatisticsQueryItem), this.cmbItemCategory.SelectedItem.ToString());
- if (wqcModel == null)
- {
- wqcModel = new Model.Model_WageQueryConfig();
- }
- if (wqcModel.ID <= 0)
- {
- wqcModel.WQC_CreateDateTime = SDateTime.NowToLong;
- wqcModel.WQC_CreateName = CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- wqcModel.WQC_Remarks = "";
- }
- wqcModel.WQC_UpdateDateTime = SDateTime.NowToLong;
- wqcModel.WQC_UpdateName = CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- wqcModel.WQC_QueryName = programName;
- wqcModel.WQC_StatisticalItems = (int)sItem;
- wqcModel.WQC_ProjectContent = this.cmbProjectTitle.TreeView.SelectedNode.Name;
- wqcModel.WQC_Type = 0;
- if (this.cmbCommissionScheme.TreeView.SelectedNode != null)
- {
- wqcModel.WQC_CommissionProgram = this.cmbCommissionScheme.TreeView.SelectedNode.Name;
- }
- wqcModel.WQC_QueryCondition = "";
- if (aCModel == null)
- {
- aCModel = new Model.AdditionalConditions();
- }
- switch (sItem)
- {
- case Model.WageStatisticsQueryItem.订单前期:
- case Model.WageStatisticsQueryItem.订单后期:
- case Model.WageStatisticsQueryItem.服务前期:
- case Model.WageStatisticsQueryItem.服务后期:
-
- aCModel.IsProcessStatus = this.chkProcessStatus.Checked;
- if (this.chkProcessStatus.Checked)
- {
- aCModel.ProcessStatusValue = this.cmbProcessStatus.Text.Trim();
- }
- aCModel.IsSetsAmount = this.chkorderamount.Checked;
- if (this.chkorderamount.Checked)
- {
- aCModel.SetsAmountStar = Convert.ToInt32(this.nudorderamountStar.Value);
- aCModel.SetsAmountEnd = Convert.ToInt32(this.nudorderamountEnd.Value);
- if (aCModel.SetsAmountStar > aCModel.SetsAmountEnd)
- {
- aCModel.IsSetsAmount = false;
- MessageBoxCustom.Show("套系金额的开始值不能大于结束值");
- return;
- }
- }
- aCModel.IsSelectionFilmsAmount = this.chkSelectionFilmsAmount.Checked;
- if (this.chkSelectionFilmsAmount.Checked)
- {
- aCModel.SelectionFilmsAmountStar = Convert.ToInt32(this.nudSelectionFilmsAmountStar.Value);
- aCModel.SelectionFilmsAmountEnd = Convert.ToInt32(this.nudSelectionFilmsAmountEnd.Value);
- if (aCModel.SelectionFilmsAmountStar > aCModel.SelectionFilmsAmountEnd)
- {
- aCModel.IsSelectionFilmsAmount = false;
- MessageBoxCustom.Show("选片金额的开始值不能大于结束值");
- return;
- }
- }
- aCModel.IsSatisfactionScore = this.chkSatisfactionScore.Checked;
- if (this.chkSatisfactionScore.Checked)
- {
- aCModel.SatisfactionScoreStar = Convert.ToInt32(this.nudSatisfactionScoreStar.Value);
- aCModel.SatisfactionScoreEnd = Convert.ToInt32(this.nudSatisfactionScoreEnd.Value);
- if (aCModel.SatisfactionScoreStar > aCModel.SatisfactionScoreEnd)
- {
- aCModel.IsSatisfactionScore = false;
- MessageBoxCustom.Show("满意分值的开始值不能大于结束值");
- return;
- }
- }
- aCModel.IsCustomerSource = this.chkcustomersource.Checked;
- if (this.chkcustomersource.Checked)
- {
- SetListValue(aCModel.CustomerSourceList, this.treecustomersource);
- }
- aCModel.IsOrderCategory = this.chkOrdercategory.Checked;
- if (this.chkOrdercategory.Checked)
- {
- SetListValue(aCModel.OrderCategoryList, this.treeOrdercategory);
- }
- aCModel.IsPaymentMethod = this.chkPaymentMethod.Checked;
- if (this.chkPaymentMethod.Checked)
- {
- SetListValue(aCModel.PaymentMethodList, this.treePaymentMethod);
- }
- wqcModel.WQC_QueryCondition = aCModel.ToString();
- break;
- case Model.WageStatisticsQueryItem.计件提成:
- wqcModel.WQC_QueryCondition = "";
- wqcModel.WQC_CommissionProgram = "按工作内容计件提成";
- wqcModel.WQC_Type = 1;
- break;
- case Model.WageStatisticsQueryItem.散客消费:
- case Model.WageStatisticsQueryItem.礼服租售:
- case Model.WageStatisticsQueryItem.会员充值:
- case Model.WageStatisticsQueryItem.服务卡充值:
- if (sItem == Model.WageStatisticsQueryItem.礼服租售
- ||sItem== Model.WageStatisticsQueryItem.散客消费)
- {
- aCModel.IsSetsAmount = this.chkLifuJinE.Checked;
- if (this.chkLifuJinE.Checked)
- {
- aCModel.SetsAmountStar = Convert.ToInt32(this.nuLiFuStar.Value);
- aCModel.SetsAmountEnd = Convert.ToInt32(this.nuLiFuEnd.Value);
- if (aCModel.SetsAmountStar > aCModel.SetsAmountEnd)
- {
- aCModel.IsSetsAmount = false;
- MessageBoxCustom.Show("订单金额的开始值不能大于结束值");
- return;
- }
- }
- }
- aCModel.IsPaymentMethod = this.chkPaymentMethod.Checked;
- if (this.chkPaymentMethod.Checked || aCModel.IsSetsAmount)
- {
- SetListValue(aCModel.PaymentMethodList, this.treePaymentMethod);
- wqcModel.WQC_QueryCondition = aCModel.ToString();
- }
- else
- {
- wqcModel.WQC_QueryCondition = "";
- }
- break;
- }
- bool ret = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- if (wqcModel.ID > 0)
- {
- ret = wqcBll.Update(wqcModel);
- }
- else
- {
- ret = wqcBll.Add(wqcModel);
- }
- });
-
- if (ret)
- {
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- else
- {
- MessageBoxCustom.Show("保存失败,请重试!");
- }
- }
- catch(Exception ex) {
- MessageBoxCustom.Show("保存出错:"+ex.Message);
- }
- }
- void SetListValue(List<string> list, TreeView tView)
- {
- list.Clear();
- foreach (TreeNode node in tView.Nodes)
- {
- if (node.Checked)
- {
- list.Add(node.Name);
- }
- if (node.Nodes.Count > 0)
- {
- this.SetSubListValue(list,node);
- }
- }
- }
- void SetSubListValue(List<string> list, TreeNode _node)
- {
- foreach (TreeNode node in _node.Nodes)
- {
- if (node.Checked)
- {
- list.Add(node.Name);
- }
- if (node.Nodes.Count > 0)
- {
- this.SetSubListValue(list, node);
- }
- }
- }
- /// <summary>
- /// 设置订单类别的位置
- /// </summary>
- void SetOrdercategoryPosition()
- {
- this.chkOrdercategory.Location = this.chkPaymentMethod.Location;
- this.treeOrdercategory.Location = this.treePaymentMethod.Location;
- this.chkPaymentMethod.Hide();
- this.treePaymentMethod.Hide();
- this.chkOrdercategory.Show();
- this.treeOrdercategory.Show();
- }
- void cmbItemCategory_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.cmbItemCategory.SelectedIndex == 0)
- {
- ClearAdditionalConditions();
- this.lbqItemMsg.Text = "请选择统计项目";
- }
- else
- {
- this.plLifuJinE.Hide();
- LYFZ.Model.WageStatisticsQueryItem sItem = (LYFZ.Model.WageStatisticsQueryItem)Enum.Parse(typeof(LYFZ.Model.WageStatisticsQueryItem), this.cmbItemCategory.SelectedItem.ToString());
- SetSelectItme(this.cmbProjectTitle, "");
- SetSelectItme(this.cmbCommissionScheme, "");
- this.lbqItemMsg.Text = GetWageStatisticsQueryItemPropertyAttribute(sItem);
-
- switch (sItem)
- {
- case Model.WageStatisticsQueryItem.订单前期:
- BindComboxTreeView(this.cmbProjectTitle.TreeView, Enum.GetNames(typeof(LYFZ.Model.ReceiptsType)));
- SetSelectItme(this.cmbProjectTitle, LYFZ.Model.ReceiptsType.实收.ToString());
-
- switch (LYFZSS.SystemSpecterPossessed.ISystemSpecterPossessed.GetMySystemSpecter)
- {
- case LYFZSS.SystemSpecterType.SST_E:
- ShowOrHideProcessAdditionalConditions(true);
- ShowOrHideSelectionFilmsAmount(false);
- SetGrbAdditionalConditions(true);
- break;
- case LYFZSS.SystemSpecterType.SST_D:
-
- ShowOrHideProcessAdditionalConditions(false);
- ShowOrHideSelectionFilmsAmount(false);
- this.plProcessAdditionalConditions.Visible = true;
- SetGrbAdditionalConditions(true);
- this.plProcessAdditionalConditions.Visible = false;
- SetOrdercategoryPosition();
- break;
- case LYFZSS.SystemSpecterType.SST_C:
- ShowOrHideProcessAdditionalConditions(false);
- ShowOrHideSelectionFilmsAmount(false);
- SetGrbAdditionalConditions(false);
- break;
- }
-
-
- break;
- case Model.WageStatisticsQueryItem.订单后期:
- BindTreeView_SystemCategory(BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.二销类别).ToUpper(), this.cmbProjectTitle.TreeView, ExclusionsList: BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.证件照).ToUpper());
-
- switch (LYFZSS.SystemSpecterPossessed.ISystemSpecterPossessed.GetMySystemSpecter)
- {
- case LYFZSS.SystemSpecterType.SST_E:
- ShowOrHideProcessAdditionalConditions(true);
- ShowOrHideSelectionFilmsAmount(true);
- SetGrbAdditionalConditions(true);
- break;
- case LYFZSS.SystemSpecterType.SST_D:
- ShowOrHideProcessAdditionalConditions(false);
- ShowOrHideSelectionFilmsAmount(false);
- this.plProcessAdditionalConditions.Visible = true;
- SetGrbAdditionalConditions(true);
- this.plProcessAdditionalConditions.Visible = false;
- SetOrdercategoryPosition();
- break;
- case LYFZSS.SystemSpecterType.SST_C:
- ShowOrHideProcessAdditionalConditions(false);
- ShowOrHideSelectionFilmsAmount(false);
- SetGrbAdditionalConditions(false);
- break;
- }
- break;
- case Model.WageStatisticsQueryItem.服务前期:
- BindComboxTreeView(this.cmbProjectTitle.TreeView, Enum.GetNames(typeof(LYFZ.Model.EarlyServiceType)));
- // SetSelectItme(this.cmbProjectTitle, LYFZ.Model.EarlyServiceType.摄影前期.ToString());
-
- switch (LYFZSS.SystemSpecterPossessed.ISystemSpecterPossessed.GetMySystemSpecter)
- {
- case LYFZSS.SystemSpecterType.SST_E:
- ShowOrHideProcessAdditionalConditions(true);
- ShowOrHideSelectionFilmsAmount(false);
- SetGrbAdditionalConditions(true);
- break;
- case LYFZSS.SystemSpecterType.SST_D:
- ShowOrHideProcessAdditionalConditions(false);
- ShowOrHideSelectionFilmsAmount(false);
- this.plProcessAdditionalConditions.Visible = true;
- SetGrbAdditionalConditions(true);
- this.plProcessAdditionalConditions.Visible = false;
- SetOrdercategoryPosition();
- break;
- case LYFZSS.SystemSpecterType.SST_C:
- ShowOrHideProcessAdditionalConditions(false);
- ShowOrHideSelectionFilmsAmount(false);
- SetGrbAdditionalConditions(false);
- break;
- }
- break;
- case Model.WageStatisticsQueryItem.服务后期:
- BindComboxTreeView(this.cmbProjectTitle.TreeView, Enum.GetNames(typeof(LYFZ.Model.LateServicesType)));
- switch (LYFZSS.SystemSpecterPossessed.ISystemSpecterPossessed.GetMySystemSpecter)
- {
- case LYFZSS.SystemSpecterType.SST_E:
- ShowOrHideProcessAdditionalConditions(true);
- ShowOrHideSelectionFilmsAmount(true);
- SetGrbAdditionalConditions(true);
- break;
- case LYFZSS.SystemSpecterType.SST_D:
- ShowOrHideProcessAdditionalConditions(false);
- ShowOrHideSelectionFilmsAmount(false);
- this.plProcessAdditionalConditions.Visible = true;
- SetGrbAdditionalConditions(true);
- this.plProcessAdditionalConditions.Visible = false;
- SetOrdercategoryPosition();
- break;
- case LYFZSS.SystemSpecterType.SST_C:
- ShowOrHideProcessAdditionalConditions(false);
- ShowOrHideSelectionFilmsAmount(false);
- SetGrbAdditionalConditions(false);
- break;
- }
- break;
- case Model.WageStatisticsQueryItem.散客消费:
- BindTreeView_SystemCategory(BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.二销类别).ToUpper(), this.cmbProjectTitle.TreeView, ExclusionsList: BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.选片二销).ToUpper());
-
- switch (LYFZSS.SystemSpecterPossessed.ISystemSpecterPossessed.GetMySystemSpecter)
- {
- case LYFZSS.SystemSpecterType.SST_E:
- this.plLifuJinE.Show();
- ShowOrHideProcessAdditionalConditions(false);
- ShowOrHideSelectionFilmsAmount(false);
- this.plProcessAdditionalConditions.Visible = true;
- SetGrbAdditionalConditions(true);
- this.plProcessAdditionalConditions.Visible = false;
- break;
- case LYFZSS.SystemSpecterType.SST_D:
- case LYFZSS.SystemSpecterType.SST_C:
- ShowOrHideProcessAdditionalConditions(false);
- ShowOrHideSelectionFilmsAmount(false);
- SetGrbAdditionalConditions(false);
- break;
- }
- break;
- case Model.WageStatisticsQueryItem.计件提成:
- BindComboxTreeView(this.cmbProjectTitle.TreeView, Enum.GetNames(typeof(LYFZ.Model.PieceCommissionType)));
- SetSelectItme(this.cmbProjectTitle, LYFZ.Model.PieceCommissionType.工作内容.ToString(), true);
- ShowOrHideSelectionFilmsAmount(false);
- SetGrbAdditionalConditions(false);
- SetSelectItme(this.cmbCommissionScheme, "",true);
- // LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEBBBABBEBAIHGDCB", this.cmbProjectTitle, IsFirstNodeNull: true, tbl: AllSystemCategory);
- break;
- case Model.WageStatisticsQueryItem.礼服租售:
- BindComboxTreeView(this.cmbProjectTitle.TreeView, Enum.GetNames(typeof(LYFZ.Model.DressRentalType)));
- switch (LYFZSS.SystemSpecterPossessed.ISystemSpecterPossessed.GetMySystemSpecter)
- {
- case LYFZSS.SystemSpecterType.SST_E:
- this.plLifuJinE.Show();
- ShowOrHideProcessAdditionalConditions(false);
- ShowOrHideSelectionFilmsAmount(false);
- this.plProcessAdditionalConditions.Visible = true;
- SetGrbAdditionalConditions(true);
- this.plProcessAdditionalConditions.Visible = false;
- break;
- case LYFZSS.SystemSpecterType.SST_D:
- case LYFZSS.SystemSpecterType.SST_C:
- ShowOrHideProcessAdditionalConditions(false);
- ShowOrHideSelectionFilmsAmount(false);
- SetGrbAdditionalConditions(false);
- break;
- }
- break;
- case Model.WageStatisticsQueryItem.会员充值:
- BindComboxTreeView(this.cmbProjectTitle.TreeView, Enum.GetNames(typeof(LYFZ.Model.RechargeType)));
- SetSelectItme(this.cmbProjectTitle, LYFZ.Model.RechargeType.充值金额.ToString(),true);
- switch (LYFZSS.SystemSpecterPossessed.ISystemSpecterPossessed.GetMySystemSpecter)
- {
- case LYFZSS.SystemSpecterType.SST_E:
- ShowOrHideProcessAdditionalConditions(false);
- ShowOrHideSelectionFilmsAmount(false);
- this.plProcessAdditionalConditions.Visible = true;
- SetGrbAdditionalConditions(true);
- this.plProcessAdditionalConditions.Visible = false;
- break;
- case LYFZSS.SystemSpecterType.SST_D:
- case LYFZSS.SystemSpecterType.SST_C:
- ShowOrHideProcessAdditionalConditions(false);
- ShowOrHideSelectionFilmsAmount(false);
- SetGrbAdditionalConditions(false);
- break;
- }
- break;
- case Model.WageStatisticsQueryItem.服务卡充值:
- BindComboxTreeView(this.cmbProjectTitle.TreeView, Enum.GetNames(typeof(LYFZ.Model.RechargeType)));
- SetSelectItme(this.cmbProjectTitle, LYFZ.Model.RechargeType.充值金额.ToString(), true);
- switch (LYFZSS.SystemSpecterPossessed.ISystemSpecterPossessed.GetMySystemSpecter)
- {
- case LYFZSS.SystemSpecterType.SST_E:
- ShowOrHideProcessAdditionalConditions(false);
- ShowOrHideSelectionFilmsAmount(false);
- this.plProcessAdditionalConditions.Visible = true;
- SetGrbAdditionalConditions(true);
- this.plProcessAdditionalConditions.Visible = false;
- break;
- case LYFZSS.SystemSpecterType.SST_D:
- case LYFZSS.SystemSpecterType.SST_C:
- ShowOrHideProcessAdditionalConditions(false);
- ShowOrHideSelectionFilmsAmount(false);
- SetGrbAdditionalConditions(false);
- break;
- }
- break;
- }
- }
- }
- /// <summary>
- /// 获取统计项目的说明属性信息
- /// </summary>
- /// <param name="sEvent"></param>
- /// <returns></returns>
- string GetWageStatisticsQueryItemPropertyAttribute(Model.WageStatisticsQueryItem qItem)
- {
- string ret = LYFZ.WinAPI.CustomPublicMethod.ConvertEnumToDescription(qItem);
- if (string.IsNullOrEmpty(ret))
- {
- ret = qItem.ToString();
- }
- return ret;
- }
- void SetGrbAdditionalConditions(bool isDisabled)
- {
- // bool isShow = this.plProcessAdditionalConditions.Visible;
- // this.plProcessAdditionalConditions.Visible = true;
-
- this.grbAdditionalConditions.Enabled = isDisabled;
- if (!isDisabled)
- {
- ClearAdditionalConditions();
- this.Height = 720 - 470;
- this.grbAdditionalConditions.Hide();
- }
- else {
- this.Height = 720;
- this.grbAdditionalConditions.Show();
- }
- // this.plProcessAdditionalConditions.Visible = isShow;
- }
- /// <summary>
- /// 显示隐藏流程附加条件
- /// </summary>
- /// <param name="bl"></param>
- void ShowOrHideProcessAdditionalConditions(bool bl)
- {
- this.plProcessAdditionalConditions.Visible = bl;
- this.chkcustomersource.Visible = bl;
- this.treecustomersource.Visible = bl;
- this.chkOrdercategory.Visible = bl;
- this.treeOrdercategory.Visible = bl;
- }
- /// <summary>
- /// 显示隐藏选片金额
- /// </summary>
- /// <param name="bl"></param>
- void ShowOrHideSelectionFilmsAmount(bool bl)
- {
- this.chkSelectionFilmsAmount.Visible = bl;
- this.nudSelectionFilmsAmountStar.Visible = bl;
- this.nudSelectionFilmsAmountEnd.Visible = bl;
- this.lbSelectionFilmsAmount.Visible = bl;
- }
- /// <summary>
- /// 设置选择项
- /// </summary>
- /// <param name="cmbProject"></param>
- /// <param name="selectValue">要选中的值</param>
- /// <param name="isDisabled">是否禁用</param>
- public static void SetSelectItme(ComponentLibrary.ComboBoxTreeViewEx cmbProject,string selectValue,bool isDisabled=false)
- {
- if (string.IsNullOrEmpty(selectValue))
- {
- cmbProject.TreeView.SelectedNode = null;
- cmbProject.Text = "";
- }
- else
- {
- foreach (TreeNode node in cmbProject.TreeView.Nodes)
- {
- if (node.Name.ToLower() == selectValue.ToLower())
- {
- cmbProject.TreeView.SelectedNode = node;
- cmbProject.Text = node.Text;
- break;
- }
- else if (node.Nodes.Count > 0)
- {
- SelectSubItem(cmbProject, node, selectValue);
- }
- }
- }
- if (isDisabled)
- {
- cmbProject.Enabled = false;
- }
- else {
- cmbProject.Enabled = true;
- }
- }
- public static void SelectSubItem(ComponentLibrary.ComboBoxTreeViewEx cmbProject, TreeNode node, string selectValue)
- {
- foreach (TreeNode subNode in node.Nodes)
- {
- if (subNode.Name.ToLower() == selectValue.ToLower())
- {
- cmbProject.TreeView.SelectedNode = subNode;
- cmbProject.SelectedText = subNode.Text;
- break;
- }
- else if (subNode.Nodes.Count > 0)
- {
- SelectSubItem(cmbProject, subNode, selectValue);
- }
- }
- }
- void BindComboxTreeView(TreeView tvw, string[] bindDatas, bool isExpandAll=true)
- {
-
- tvw.Nodes.Clear();
- foreach (string data in bindDatas)
- {
- TreeNode node = new TreeNode();
- node.Name = data;
- node.Text = data;
- node.Tag = data;
- tvw.Nodes.Add(node);
- }
- if (isExpandAll)
- {
- tvw.ExpandAll();
- }
- }
- /// <summary>
- /// 清除附加条件
- /// </summary>
- void ClearAdditionalConditions()
- {
- this.chkProcessStatus.Checked = false;
- this.chkcustomersource.Checked = false;
- this.chkorderamount.Checked = false;
- this.chkOrdercategory.Checked = false;
- this.chkSatisfactionScore.Checked = false;
- this.chkSelectionFilmsAmount.Checked = false;
- this.cmbProcessStatus.SelectedItem = null;
- this.nudorderamountStar.Value = 0;
- this.nudorderamountEnd.Value = 0;
- this.nudSatisfactionScoreEnd.Value = 0;
- this.nudSatisfactionScoreStar.Value = 0;
- this.nudSelectionFilmsAmountStar.Value = 0;
- this.nudSelectionFilmsAmountEnd.Value = 0;
- foreach (TreeNode node in this.treecustomersource.Nodes)
- {
- node.Checked = false;
- }
- foreach (TreeNode node in this.treeOrdercategory.Nodes)
- {
- node.Checked = false;
- }
- foreach (TreeNode node in this.treePaymentMethod.Nodes)
- {
- node.Checked = false;
- }
- }
- void treecustomersource_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
- {
- foreach (TreeNode node in e.Node.Nodes)
- {
- node.Checked = e.Node.Checked;
- treecustomersource_NodeMouseClick(nudorderamountEnd,new TreeNodeMouseClickEventArgs(node,e.Button,e.Clicks,e.X,e.Y));
- }
- }
- void treecustomersource_AfterCheck(object sender, TreeViewEventArgs e)
- {
-
- if (!e.Node.Checked)
- {
- if (e.Node.Parent != null)
- {
- if (e.Node.Parent.Checked)
- {
- e.Node.Parent.Checked = false;
- }
- }
- }
- else {
- if (e.Node.Parent != null)
- {
- if (!e.Node.Parent.Checked)
- {
- bool ischecked = true;
- foreach (TreeNode node in e.Node.Parent.Nodes)
- {
- if (!node.Checked) {
- ischecked = false;
- }
- }
- e.Node.Parent.Checked = ischecked;
- }
- }
- }
- }
- public static LYFZ.BLL.BLL_ErpSystemCategory SCBll = new BLL.BLL_ErpSystemCategory();
- // private static DataTable _AllSystemCategory = null;
- /// <summary>
- /// 所有系统类别
- /// </summary>
- public static DataTable AllSystemCategory
- {
- get {
- return LYFZ.BLL.WageStatisticsProcess.AllSystemCategory;
- }
- }
- /// <summary>
- /// 重新加载所有系统类别
- /// </summary>
- public static void LoadAllSystemCategory()
- {
- LYFZ.BLL.WageStatisticsProcess.LoadAllSystemCategory();
- }
- void frmEditStatisticsProgram_Shown(object sender, EventArgs e)
- {
- this.Height = 660 - 410;
- //绑定统计项目
- BindItemCategory();
- BindTreeView_SystemCategory(BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.提成点方案).ToUpper(), this.cmbCommissionScheme.TreeView);
- //客户来源
- BindTreeView_SystemCategory(BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.客户来源).ToUpper(), this.treecustomersource);
- //套系类别
- BindTreeView_SystemCategory(BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.订单类别).ToUpper(), this.treeOrdercategory);
- //支付方式
- BindTreeView_SystemCategory(BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.支付方式).ToUpper(), this.treePaymentMethod,ExclusionsList:BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.代金券).Trim().ToUpper());
- if (wqcModel != null && wqcModel.ID > 0)
- {
- this.txtProgramName.Enabled = false;
- aCModel = new Model.AdditionalConditions(wqcModel.WQC_QueryCondition);
- SetEditStatisticsProgram(aCModel);
- }
- else {
- this.txtProgramName.Enabled = true;
- }
- }
- void SetEditStatisticsProgram(Model.AdditionalConditions acModel)
- {
- this.txtProgramName.Text = WqcModel.WQC_QueryName;
- LYFZ.Model.WageStatisticsQueryItem StatisticalItems = (LYFZ.Model.WageStatisticsQueryItem)WqcModel.WQC_StatisticalItems;
- this.cmbItemCategory.SelectedItem = StatisticalItems.ToString();
- switch (StatisticalItems)
- {
- case Model.WageStatisticsQueryItem.订单前期:
- case Model.WageStatisticsQueryItem.订单后期:
- case Model.WageStatisticsQueryItem.服务前期:
- case Model.WageStatisticsQueryItem.服务后期:
- case Model.WageStatisticsQueryItem.散客消费:
- case Model.WageStatisticsQueryItem.礼服租售:
- SetSelectItme(this.cmbProjectTitle, WqcModel.WQC_ProjectContent, false);
- break;
- case Model.WageStatisticsQueryItem.计件提成:
- case Model.WageStatisticsQueryItem.会员充值:
- case Model.WageStatisticsQueryItem.服务卡充值:
- SetSelectItme(this.cmbProjectTitle, WqcModel.WQC_ProjectContent, true);
- break;
- }
- if (StatisticalItems == Model.WageStatisticsQueryItem.计件提成)
- {
- SetSelectItme(this.cmbCommissionScheme, "", true);
- }
- else {
- SetSelectItme(this.cmbCommissionScheme, WqcModel.WQC_CommissionProgram);
- }
- if (StatisticalItems == Model.WageStatisticsQueryItem.订单后期)
- {
- if (WqcModel.WQC_ProjectContent.ToUpper() == BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.选片二销).ToUpper())
- {
- SetGrbAdditionalConditions(true);
- }
- else
- {
- SetGrbAdditionalConditions(false);
- }
- }
- if (acModel.IsProcessStatus)
- {
- this.chkProcessStatus.Checked = acModel.IsProcessStatus;
- this.cmbProcessStatus.SelectedItem = acModel.ProcessStatusValue;
- }
- if (acModel.IsSetsAmount)
- {
- if (StatisticalItems == Model.WageStatisticsQueryItem.礼服租售
- ||StatisticalItems== Model.WageStatisticsQueryItem.散客消费)
- {
- this.chkLifuJinE.Checked = acModel.IsSetsAmount;
- this.nuLiFuStar.Value = acModel.SetsAmountStar;
- this.nuLiFuEnd.Value = acModel.SetsAmountEnd;
- }
- else
- {
- this.chkorderamount.Checked = acModel.IsSetsAmount;
- this.nudorderamountStar.Value = acModel.SetsAmountStar;
- this.nudorderamountEnd.Value = acModel.SetsAmountEnd;
- }
- }
- if (acModel.IsSelectionFilmsAmount)
- {
- this.chkSelectionFilmsAmount.Checked = acModel.IsSelectionFilmsAmount;
- this.nudSelectionFilmsAmountStar.Value = acModel.SelectionFilmsAmountStar;
- this.nudSelectionFilmsAmountEnd.Value = acModel.SelectionFilmsAmountEnd;
- }
- if (acModel.IsSatisfactionScore)
- {
- this.chkSatisfactionScore.Checked = acModel.IsSatisfactionScore;
- this.nudSatisfactionScoreStar.Value = acModel.SatisfactionScoreStar;
- this.nudSatisfactionScoreEnd.Value = acModel.SatisfactionScoreEnd;
- }
- if (acModel.IsCustomerSource)
- {
- this.chkcustomersource.Checked = acModel.IsCustomerSource;
- CheckedTreeView(this.treecustomersource, acModel.CustomerSourceList);
- }
- if (acModel.IsOrderCategory)
- {
- this.chkOrdercategory.Checked = acModel.IsOrderCategory;
- CheckedTreeView(this.treeOrdercategory, acModel.OrderCategoryList);
- }
- if (acModel.IsPaymentMethod)
- {
- this.chkPaymentMethod.Checked = acModel.IsPaymentMethod;
- CheckedTreeView(this.treePaymentMethod, acModel.PaymentMethodList);
- }
- }
- void CheckedTreeView(TreeView tview, List<string> vlueList)
- {
- foreach (TreeNode node in tview.Nodes)
- {
- if (vlueList.Contains(node.Name))
- {
- node.Checked = true;
- }
- if (node.Nodes.Count > 0)
- {
- this.CheckedSubValue(vlueList, node);
- }
- }
- }
- void CheckedSubValue(List<string> vlueList, TreeNode _node)
- {
- foreach (TreeNode node in _node.Nodes)
- {
- if (vlueList.Contains(node.Name))
- {
- node.Checked = true;
- }
- if (node.Nodes.Count > 0)
- {
- this.CheckedSubValue(vlueList, node);
- }
- }
- }
- /// <summary>
- /// 绑定类别
- /// </summary>
- /// <param name="ExclusionsList">要排除的内容</param>
- public static void BindTreeView_SystemCategory(string classCode, TreeView tvw, bool isExpandAll = true, string ExclusionsList = "", bool IsFirstNodeNull = false, BLL.SysTemCategoryCodeType codeType = BLL.SysTemCategoryCodeType.未知类别)
- {
- tvw.Nodes.Clear();
- DataRow[] pRow = AllSystemCategory.Select("Sc_ClassCode = '" + classCode + "' ");
- if (pRow.Length > 0)
- {
- tvw.Tag = pRow[0];
- BindTreeView_SubNode(Convert.ToInt32(pRow[0]["id"].ToString()), tvw.Nodes, ExclusionsList, IsFirstNodeNull, codeType);
- if (isExpandAll)
- {
- tvw.ExpandAll();
- }
- }
- }
- /// <summary>
- /// 移除无效套系 (即没有设置任何套系名称的套系)
- /// </summary>
- /// <param name="tvw"></param>
- public static void RemoveInvalidTaoXi(TreeView tvw)
- {
- List<TreeNode> removeList = new List<TreeNode>();
- foreach (TreeNode node in tvw.Nodes)
- {
- if (node != null)
- {
- if (node.Name.ToLower() != "IsFirstNodeNull".ToLower())
- {
- if (node.Nodes.Count > 0)
- {
- RemoveInvalidTaoXi(node);
- if (node.Nodes.Count <= 0)
- {
- removeList.Add(node);
- }
- }
- else
- {
- removeList.Add(node);
- }
- }
- }
- }
- foreach (TreeNode node in removeList)
- {
- tvw.Nodes.Remove(node);
- }
- }
- static void RemoveInvalidTaoXi(TreeNode node)
- {
- List<TreeNode> removeList = new List<TreeNode>();
- foreach (TreeNode subnode in node.Nodes)
- {
- if (subnode.Nodes.Count > 0)
- {
- RemoveInvalidTaoXi(subnode);
- if (subnode.Nodes.Count <= 0)
- {
- removeList.Add(subnode);
- }
- }
- else
- {
- if (!subnode.Name.ToLower().Contains("AddErpPackages_PakData_".ToLower()))
- {
- removeList.Add(subnode);
- }
- }
- }
- foreach (TreeNode subNode in removeList)
- {
- node.Nodes.Remove(subNode);
- }
-
- }
- /// <summary>
- /// 绑定套系名和礼包
- /// </summary>
- /// <param name="classCode"></param>
- /// <param name="nodes"></param>
- static void BindTreeView_SubNodeToTaoXiMingORLiBao(string classCode, TreeNodeCollection nodes)
- {
- DataRow[] pRows = LYFZ.BLL.BLL_ErpPackages.AllPackagesName.Select(String.Format("Pak_PackagesClass='{0}' and Pak_IsDisable =0 ", classCode));
- foreach (DataRow row in pRows)
- {
- TreeNode node = new TreeNode();
- node.Name = String.Format("AddErpPackages_PakData_{0}", row["Pak_PackagesID"].ToString());
- node.Text = row["Pak_Name"].ToString();
- node.Tag = new {
- PackagesClass= row["Pak_PackagesClass"].ToString(),
- PackagesID = row["Pak_PackagesID"].ToString(),
- Pak_Name = row["Pak_Name"].ToString(),
- };
- nodes.Add(node);
- }
- }
-
- /// <summary>
- /// 绑定类别
- /// </summary>
- /// <param name="classCodeList">多个类别编码用“|”分开</param>
- /// <param name="tvw"></param>
- /// <param name="isExpandAll"></param>
- /// <param name="ExclusionsList">要排除的内容</param>
- public static void BindTreeView_SystemCategory(string[] classCodeList, TreeView tvw, bool isExpandAll = true, string ExclusionsList = "")
- {
- tvw.Nodes.Clear();
- string[] codeList = classCodeList;
- foreach (string key in codeList)
- {
- DataRow[] pRow = AllSystemCategory.Select("Sc_ClassCode = '" + key + "'");
- tvw.Tag = pRow[0];
- TreeNode node = new TreeNode();
- node.Name = pRow[0]["Sc_ClassCode"].ToString();
- node.Text = pRow[0]["Sc_ClassName"].ToString();
- node.Tag = pRow[0]["id"].ToString();
- tvw.Nodes.Add(node);
- BindTreeView_SubNode(Convert.ToInt32(pRow[0]["id"].ToString()), node.Nodes, ExclusionsList);
- }
- if (isExpandAll)
- {
- tvw.ExpandAll();
- }
- }
- public static void BindTreeView_SubNode(int pid, TreeNodeCollection nodes, string ExclusionsList = "",bool IsFirstNodeNull=false, BLL.SysTemCategoryCodeType codeType = BLL.SysTemCategoryCodeType.未知类别)
- {
- DataRow[] pRows = AllSystemCategory.Select("Sc_ClassParentID =" + pid.ToString() + " and Sc_IsDisable = 0 ");
- if (IsFirstNodeNull)
- {
- TreeNode node = new TreeNode();
- node.Name = "IsFirstNodeNull";
- node.Text = " ";
- node.Tag = "-1";
- nodes.Add(node);
- }
- if (pRows.Length > 0)
- {
- foreach (DataRow row in pRows)
- {
- if (!ExclusionsList.ToLower().Contains(row["Sc_ClassCode"].ToString().ToLower())
- || (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.IncludeVouchers && row["Sc_ClassCode"].ToString().ToLower() == BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.代金券).Trim().ToLower()))
- {
- TreeNode node = new TreeNode();
- node.Name = row["Sc_ClassCode"].ToString();
- node.Text = row["Sc_ClassName"].ToString();
- node.Tag = row["id"].ToString();
- nodes.Add(node);
- BindTreeView_SubNode(Convert.ToInt32(node.Tag), node.Nodes, ExclusionsList, false, codeType: codeType);
- }
- }
- }
- else {
- DataRow[] codeRows = AllSystemCategory.Select("id =" + pid.ToString() + "");
- if (codeRows.Length > 0)
- {
- string classCode = codeRows[0]["Sc_ClassCode"].ToString();
- switch (codeType)
- {
- case BLL.SysTemCategoryCodeType.套系名称:
- case BLL.SysTemCategoryCodeType.订单礼包:
- BindTreeView_SubNodeToTaoXiMingORLiBao(classCode, nodes);
- break;
- }
- }
- }
-
- }
- /// <summary>
- /// 绑定统计项目
- /// </summary>
- void BindItemCategory()
- {
- this.cmbItemCategory.Items.Clear();
- this.cmbItemCategory.Items.Add("---请选择项目---");
- string[] WageStatisticsQueryItems= Enum.GetNames(typeof(LYFZ.Model.WageStatisticsQueryItem));
- foreach (string qItem in WageStatisticsQueryItems)
- {
- this.cmbItemCategory.Items.Add(qItem);
- }
- this.cmbItemCategory.SelectedIndex = 0;
- }
- void btnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- }
- }
- }
|