using LYFZ.ComponentLibrary; using LYFZ.Software.MainBusiness.DoorCityProcess; using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace LYFZ.Software.MainBusiness.StatisticalInquiry { public partial class FinanceDayReportSmallForm : LYFZ.Software.UI.StatisticalInquiry.FinanceDayReportSmallForm { // 是否只显示未审核通过的数据; private bool OnlyShowUnAudited = false; LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder(); LYFZ.BLL.BLL_ErpPayment ptbll = new BLL.BLL_ErpPayment(); LYFZ.BLL.BLL_ErpDressRefundRecord drrbll = new BLL.BLL_ErpDressRefundRecord(); LYFZ.BLL.BLL_ErpMemberCardPayment mcptbll = new BLL.BLL_ErpMemberCardPayment(); LYFZ.BLL.BLL_ErpMemberCardTakeCash mctkcbll = new BLL.BLL_ErpMemberCardTakeCash(); LYFZ.BLL.BLL_ErpOtherIncomeAndExpenses oiebll = new BLL.BLL_ErpOtherIncomeAndExpenses(); LYFZ.BLL.BLL_ErpDressDepositReceivables ddrbll = new BLL.BLL_ErpDressDepositReceivables(); LYFZ.BLL.BLL_ErpMemberCardRechargeRecord mcrrbll = new BLL.BLL_ErpMemberCardRechargeRecord(); LYFZ.BLL.BLL_ErpMemberCardBackCashTakeCash bctcbll = new BLL.BLL_ErpMemberCardBackCashTakeCash(); LYFZ.BLL.BLL_ErpMemberCardPhotographerMain mcpmbll = new BLL.BLL_ErpMemberCardPhotographerMain(); ToolTip totip = new ToolTip(); public FinanceDayReportSmallForm() { this.Load += FinanceDayReportSmallForm_Load; this.Shown += FinanceDayReportSmallForm_Shown; this.cmbtreevQueryItem.ComboBoxTree_NodeMouseClick += cmbtreevQueryItem_ComboBoxTree_NodeMouseClick; this.cmbtreevSecondOption.ComboBoxTree_NodeMouseClick += cmbtreevSecondOption_ComboBoxTree_NodeMouseClick; this.cmbtreevPaymentMethod.ComboBoxTree_NodeMouseClick += cmbtreevPaymentMethod_ComboBoxTree_NodeMouseClick; this.cmbtreevStoreName.ComboBoxTree_NodeMouseClick += cmbtreevStoreName_ComboBoxTree_NodeMouseClick; this.cmbtreevOrderType.ComboBoxTree_NodeMouseClick += cmbtreevOrderType_ComboBoxTree_NodeMouseClick; this.numYear.ValueChanged += numYear_ValueChanged; this.numMonth.ValueChanged += numMonth_ValueChanged; this.numDay.ValueChanged += numDay_ValueChanged; this.numYear.KeyDown += numYear_KeyDown; this.numMonth.KeyDown += numMonth_KeyDown; this.numDay.KeyDown += numDay_KeyDown; this.btnAudit.Click += btnAudit_Click; this.btnExport.Click += btnExport_Click; this.btnPrint.Click += btnPrint_Click; this.btnClose.Click += btnClose_Click; this.Resize += FinanceDayReportSmallForm_Resize; this.lblCount.MouseDown += lblCount_MouseDown; this.lblFinancialSMS.MouseDown += lblFinancialSMS_MouseDown; this.lblPaymentMethodStatistics.MouseDown += lblPaymentMethodStatistics_MouseDown; this.lblTotalIncome.MouseClick += lblTotalIncome_MouseClick; this.lblOperatingIncome.MouseClick += lblOperatingIncome_MouseClick; this.lblTotalPerformance.MouseClick += lblTotalPerformance_MouseClick; //this.dgvData.RowsAdded += dgvData_RowsAdded; this.dgvData.CellMouseDoubleClick += dgvData_CellMouseDoubleClick; DataTable tb_User = LYFZ.Software.MainBusiness.DoorCityProcess.PublicGetVersionDataTable.GetUserTable(); LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee( this.comboxEmployeeList, tb_User: tb_User, IsHaveAllTreeNode: true ); this.comboxEmployeeList.ComboBoxTree_NodeMouseClick += comboxEmployeeList_ComboBoxTree_NodeMouseClick; this.btn_ArrearsOfDay.Click += btn_ArrearsOfDay_Click; this.cmbtreevOrderClass.ComboBoxTree_NodeMouseClick += cmbtreevOrderType_ComboBoxTree_NodeMouseClick; // 是否只显示未审核通过的数据; this.ckb_UnAudited.Click += Ckb_UnAudited_Click; } private void Ckb_UnAudited_Click( object sender, EventArgs e ) { this.OnlyShowUnAudited = ckb_UnAudited.Checked; this.cmbtreevSecondOption_ComboBoxTree_NodeMouseClick( this, null ); } /// /// 绑定订单类别数据 /// void BindOrderClassData() { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory( "BFAGAHBFDGCABAJIH", this.cmbtreevOrderClass, true ); } void btn_ArrearsOfDay_Click( object sender, EventArgs e ) { FrmArrearsOfDayReport dayReportDialog = new FrmArrearsOfDayReport(); List numberList = new List(); //for(int i=0;i < this.dgvData.Rows.Count;i++) //{ // numberList.Add(this.dgvData.Rows[i].Cells["项目名称"].Value.ToString()); //} //numberList dayReportDialog.BindDataRow(); dayReportDialog.ShowDialog(); } /// /// 当前日期,用于月报跳转过来的 /// public string DateTimeDay = ""; /// /// 日期段(开始日期) /// public string DateTimeStart = ""; /// /// 日期段(结束日期) /// public string DateTimeEnd = ""; /// /// 需要的分店编号(用于月报跳转过来) /// public string DataTimeStoreName = ""; /// /// 是否首次运行 /// private bool IsFirst = true; /// /// 是否有财务支出权限 /// private bool IsFinancialOutlay = false; /// /// 分店编号 /// private string _StrStoreWhere; /// /// 分店编号 /// public string StrStoreWhere { get { this.Invoke( new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl( delegate () { _StrStoreWhere = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupQueryWhere( this.cmbtreevStoreName, "分店编号", ConnectWord: "" ); } ) ); return _StrStoreWhere; } set { _StrStoreWhere = value; } } /// /// 窗体加载事件 /// /// /// void FinanceDayReportSmallForm_Load( object sender, EventArgs e ) { string StrColumns = "编号,Pay_Type,项目名称,开单人,客户姓名,金额,优惠金额,项目类别,收入/支出,日期,支付方式,收银,财务审核,项目备注"; this.dgvData.DataColumns( StrColumns, "编号,Pay_Type" ); this.dgvData.Columns["项目名称"].Width = 150; this.dgvData.Columns["日期"].Width = 110; this.dgvData.Columns["客户姓名"].Width = 150; this.dgvData.Columns["支付方式"].Width = 150; this.dgvData.Columns["财务审核"].Width = 120; } /// /// 窗体加载事件 /// /// /// void FinanceDayReportSmallForm_Shown( object sender, EventArgs e ) { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindGroupStoreName( this.cmbtreevStoreName, StrGroupKeyCode: "st0240", StrKeyCode: "st025", StrDefaultStoreText: DataTimeStoreName ); LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindFinanceOrderType( this.cmbtreevOrderType ); //this.cmbtreevSecondOption.Visible = false; this.FinanceDayReportSmallForm_Resize( this, null ); this.lblTotalIncome.ForeColor = Color.DarkCyan; this.totip.SetToolTip( this.lblTotalIncome, "点我查看总收入详情" ); this.lblOperatingIncome.ForeColor = Color.DarkCyan; this.totip.SetToolTip( this.lblOperatingIncome, "点我查看营业收入详情" ); this.lblTotalPerformance.ForeColor = Color.DarkCyan; this.totip.SetToolTip( this.lblTotalPerformance, "点我查看总业绩详情" ); if ( !string.IsNullOrEmpty( this.DateTimeDay ) ) { this.numYear.Value = Convert.ToDateTime( DateTimeDay ).Year; this.numMonth.Value = Convert.ToDateTime( DateTimeDay ).Month; this.numDay.Value = Convert.ToDateTime( DateTimeDay ).Day; this.panelDay.Visible = true; this.panelParagraph.Visible = false; } else { if ( !string.IsNullOrEmpty( this.DateTimeStart ) && !string.IsNullOrEmpty( this.DateTimeEnd ) ) { this.Text = "月报详情"; this.UcNavigationTool.LabTitle = "月报详情"; this.lblDateTime.Text = this.DateTimeStart + "—" + this.DateTimeEnd; this.panelParagraph.Visible = true; this.panelDay.Visible = false; // 只有在月报详情才显示; this.ckb_UnAudited.Visible = true; } else { this.numYear.Value = SDateTime.Now.Year; this.numMonth.Value = SDateTime.Now.Month; this.numDay.Value = SDateTime.Now.Day; this.panelDay.Visible = true; this.panelParagraph.Visible = false; } } this.numDay.Maximum = System.Threading.Thread.CurrentThread.CurrentUICulture.Calendar.GetDaysInMonth( Convert.ToInt32( this.numYear.Value ), Convert.ToInt32( this.numMonth.Value ) ); this.IsFirst = false; LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView( this.cmbtreevSecondOption, "全部,收入,支出,押金,退押金,报损" ); this.cmbtreevSecondOption.TextFindTag( "全部" ); LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_PaymentMethod( this.cmbtreevPaymentMethod, IsShowAll: true, IsFirstNodeNull: true, IsFirstNodeName: "全部" ); this.cmbtreevPaymentMethod.TextFindTag( "全部" ); this.PublicFunctionRights(); this.numYear_ValueChanged( this, null ); BindOrderClassData(); } void comboxEmployeeList_ComboBoxTree_NodeMouseClick( object sender, TreeNodeMouseClickEventArgs e ) { this.cmbtreevSecondOption_ComboBoxTree_NodeMouseClick( this, null ); } /// /// 项目查询选择事件 /// /// /// void cmbtreevQueryItem_ComboBoxTree_NodeMouseClick( object sender, TreeNodeMouseClickEventArgs e ) { this.cmbtreevSecondOption.Nodes.Clear(); this.cmbtreevSecondOption.Visible = false; if ( this.cmbtreevQueryItem.Text == "全部" ) { this.cmbtreevSecondOption.Visible = true; LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView( this.cmbtreevSecondOption, "全部,收入,支出,押金,退押金,报损" ); } else if ( this.cmbtreevQueryItem.Text == "订单前期收入" ) { this.cmbtreevSecondOption.Visible = true; LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView( this.cmbtreevSecondOption, "全部,预约收款,预约补款,全款" ); } else if ( this.cmbtreevQueryItem.Text == "订单后期收入" || this.cmbtreevQueryItem.Text == "散客消费收入" ) { this.cmbtreevSecondOption.Visible = true; LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory( "BEBACDAJDFDDEACGJ", this.cmbtreevSecondOption, IsFirstNodeNull: true, IsFirstNodeName: "全部" ); } else if ( this.cmbtreevQueryItem.Text == "其它收入" ) { } else if ( this.cmbtreevQueryItem.Text == "会员充值" ) { } else if ( this.cmbtreevQueryItem.Text == "服务卡消费" ) { } else if ( this.cmbtreevQueryItem.Text == "摄友会收款" ) { this.cmbtreevSecondOption.Visible = true; LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView( this.cmbtreevSecondOption, "全部,摄友会升级,摄友会返还款" ); } else if ( this.cmbtreevQueryItem.Text == "礼服租售收入" ) { this.cmbtreevSecondOption.Visible = true; LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView( this.cmbtreevSecondOption, "全部,礼服出租,礼服出售,礼服押金,退押金,报损" ); } else if ( this.cmbtreevQueryItem.Text == "会员返现" ) { } else if ( this.cmbtreevQueryItem.Text == "店面支出" ) { this.cmbtreevSecondOption.Visible = true; LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory( "BEBACIAFBEDIGJJFE", this.cmbtreevSecondOption, IsFirstNodeNull: true, IsFirstNodeName: "全部" ); } else if ( this.cmbtreevQueryItem.Text == "财务支出" ) { this.cmbtreevSecondOption.Visible = true; LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory( "BFAGBGBAEJBACEEHJ", this.cmbtreevSecondOption, IsFirstNodeNull: true, IsFirstNodeName: "全部" ); } //else if (this.cmbtreevQueryItem.Text == "押金") //{ } if ( this.cmbtreevSecondOption.Visible ) { this.cmbtreevSecondOption.TextFindTag( "全部" ); } if ( !this.cmbtreevSecondOption.Visible ) { this.panelQueryItem.Width = 240; } else { this.panelQueryItem.Width = 370; } this.cmbtreevSecondOption_ComboBoxTree_NodeMouseClick( this, null ); } /// /// 第二选项选择事件 /// /// /// void cmbtreevSecondOption_ComboBoxTree_NodeMouseClick( object sender, TreeNodeMouseClickEventArgs e ) { this.dgvData.Rows.Clear(); this.FinanceDayReportSmallForm_Load( this, null ); this.IsCurrentShowTotalIncome = false; this.IsCurrentShowOperatingIncome = false; this.lblTotalIncome.ForeColor = Color.DarkCyan; this.lblOperatingIncome.ForeColor = Color.DarkCyan; string StrItemQueryText = this.cmbtreevQueryItem.Text.Trim(); string StrSecondOption = this.cmbtreevSecondOption.Text.Trim(); string StrPaymentMethod = this.cmbtreevPaymentMethod.Text.Trim(); string StrOrderType = this.cmbtreevOrderType.Text.Trim(); string StrOrderClass = this.cmbtreevOrderClass.Text.Trim(); string strCashier = this.comboxEmployeeList.Text.Trim(); if ( strCashier.Equals( "全部" ) ) { strCashier = ""; } if ( this.panelDay.Visible ) { this.DateTimeStart = this.numYear.Value + "-" + this.numMonth.Value + "-" + this.numDay.Value; this.DateTimeEnd = this.DateTimeStart; } LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod( delegate ( object obj, BackgroundWorker backgroundWorker ) { this.dgvData.VirtualMode = false; this.dgvData.Rows.Clear(); LYFZ.BLL.GetFinancialReportModel frmodel = orbll.Funt_GetFinanceDayReport( StrItemQueryText: StrItemQueryText, StrSecondOption: StrSecondOption, StrPaymentMethod: StrPaymentMethod, StrOrderType: StrOrderType, StrDateTimeStart: this.DateTimeStart, StrDateTimeEnd: this.DateTimeEnd, IsFinancialOutlay: this.IsFinancialOutlay, IsGetArrearsOrDeposits: true, StrStoreWhere: this.StrStoreWhere, strCashier: strCashier, StrOrderClass: StrOrderClass ); DataTable dt = frmodel.dtFinance_Statistic; DataTable dt2 = frmodel.dtFinance_DataList; this.Invoke( new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl( delegate () { if ( dt != null ) { for ( int i = 0; i < dt.Rows.Count; i++ ) { this.txtTotalIncome.Text = dt.Rows[i]["总收入"].ToString().Trim(); this.txtOperatingIncome.Text = dt.Rows[i]["营业收入"].ToString().Trim(); this.txtNetIncome.Text = dt.Rows[i]["净收入"].ToString().Trim(); this.txtOrderEarly.Text = dt.Rows[i]["订单前期"].ToString().Trim(); this.txtOrderLate.Text = dt.Rows[i]["订单后期"].ToString().Trim(); this.txtTotalArrears.Text = dt.Rows[i]["总欠款"].ToString().Trim(); this.txtTotalDeposit.Text = dt.Rows[i]["总押金"].ToString().Trim(); this.txtTotalOutlay.Text = dt.Rows[i]["支出"].ToString().Trim(); this.txtVoucher.Text = dt.Rows[i]["代金券"].ToString().Trim(); this.txtTotalPerformance.Text = dt.Rows[i]["总业绩"].ToString().Trim(); } this.txtTotalDeposit_OK.Text = frmodel.DecTotalDeposits_OK.ToString("n2"); } if ( dt2 != null ) { for ( int i = 0; i < dt2.Rows.Count; i++ ) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewCell cell = null; switch ( dt2.Rows[i]["Pay_Type"].ToString().Trim() ) { case "0": case "1": case "2": dgvr.DefaultCellStyle.ForeColor = Color.Red; break; case "-1": if ( dt2.Rows[i]["项目名称"].ToString().Trim() == "储值取现" ) { dgvr.DefaultCellStyle.ForeColor = Color.Red; } else { switch ( dt2.Rows[i]["项目类别"].ToString().Trim() ) { case "其它收入": case "店面支出": case "财务支出": case "会员充值": case "服务消费": case "会员返现": case "礼服退押金": case "礼服押金": case "摄友会返还款": case "摄友会升级": dgvr.DefaultCellStyle.ForeColor = Color.Red; break; } } break; } // 是否审核过; bool IsAudited = false; // 是否包含有审核数据; bool IsContainAudited = false; for ( int j = 0; j < dt2.Columns.Count; j++ ) { if ( dt2.Columns[j].ColumnName.Trim() == "审核" ) { IsContainAudited = true; if ( !string.IsNullOrEmpty( dt2.Rows[i][j].ToString().Trim() ) && dt2.Rows[i][j].ToString().Trim().IndexOf( "已审核/" ) != -1 ) { IsAudited = true; // 已审核; dgvr.DefaultCellStyle.ForeColor = Color.Blue; } else if ( !string.IsNullOrEmpty( dt2.Rows[i][j].ToString().Trim() ) ) { dgvr.DefaultCellStyle.ForeColor = Color.Red; } } cell = new DataGridViewTextBoxCell(); cell.Value = dt2.Rows[i][j].ToString().Trim(); dgvr.Cells.Add( cell ); } if ( (i % 2) > 0 ) { dgvr.DefaultCellStyle.BackColor = this.dgvData.DataGridViewRowsBackColor_Double(); } else { dgvr.DefaultCellStyle.BackColor = this.dgvData.DataGridViewRowsBackColor_Single(); } // 只显示未审核的数据; if ( OnlyShowUnAudited == true && IsContainAudited && IsAudited ) continue; this.dgvData.Rows.Add( dgvr ); } } } ) ); } ); if ( this.dgvData.Columns.Contains( "项目备注" ) ) { this.dgvData.Columns["项目备注"].Width = 250; } } /// /// 付款方式选择事件 /// /// /// void cmbtreevPaymentMethod_ComboBoxTree_NodeMouseClick( object sender, TreeNodeMouseClickEventArgs e ) { this.cmbtreevSecondOption_ComboBoxTree_NodeMouseClick( this, null ); } /// /// 选择分店 /// /// /// void cmbtreevStoreName_ComboBoxTree_NodeMouseClick( object sender, TreeNodeMouseClickEventArgs e ) { if ( string.IsNullOrEmpty( this.cmbtreevStoreName.Tag.ToString().Trim() ) ) { this.cmbtreevOrderType.SetTextAndTag_ValueNull(); this.panelOrderType.Visible = false; } else { this.panelOrderType.Visible = true; } this.PublicFunctionRights(); this.numDay_ValueChanged( this, null ); } /// /// 选择订单类型 /// /// /// void cmbtreevOrderType_ComboBoxTree_NodeMouseClick( object sender, TreeNodeMouseClickEventArgs e ) { this.cmbtreevSecondOption_ComboBoxTree_NodeMouseClick( this, null ); } /// /// 选择分店获取权限 /// void PublicFunctionRights() { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView( this.cmbtreevQueryItem, "全部,订单前期收入,订单后期收入,散客消费收入,其它收入,礼服租售收入,会员充值,服务卡消费,摄友会收款,会员返现,店面支出,财务支出" );//,押金 this.cmbtreevQueryItem.TextFindTag( "全部" ); this.numDay.Enabled = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupStoreRights( this.cmbtreevStoreName, "DayFinanceCompetence", CustomAttributes.OperatingAuthority.FinancialDayReport_CurrentDay ); this.numMonth.Enabled = this.numDay.Enabled; this.numYear.Enabled = this.numDay.Enabled; this.btnAudit.Enabled = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupStoreRights( this.cmbtreevStoreName, "DayFinanceCompetence", CustomAttributes.OperatingAuthority.FinancialAudit ); this.btnExport.Enabled = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupStoreRights( this.cmbtreevStoreName, "DayFinanceCompetence", CustomAttributes.OperatingAuthority.DataExport ); this.btnPrint.Enabled = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupStoreRights( this.cmbtreevStoreName, "DayFinanceCompetence", CustomAttributes.OperatingAuthority.Print ); this.IsFinancialOutlay = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupStoreRights( this.cmbtreevStoreName, "DayFinanceCompetence", CustomAttributes.OperatingAuthority.FinancialExpenses ); if ( !this.IsFinancialOutlay ) { this.cmbtreevQueryItem.Nodes.Remove( this.cmbtreevQueryItem.GetNodeItem_TextToTag( "财务支出" ) ); } this.panelNetIncome.Visible = this.IsFinancialOutlay; } /// /// 年 /// /// /// void numYear_ValueChanged( object sender, EventArgs e ) { if ( !this.IsFirst ) { this.numDay_ValueChanged( this, null ); } } /// /// 月 /// /// /// void numMonth_ValueChanged( object sender, EventArgs e ) { if ( !this.IsFirst ) { this.numDay.Maximum = System.Threading.Thread.CurrentThread.CurrentUICulture.Calendar.GetDaysInMonth( Convert.ToInt32( this.numYear.Value ), Convert.ToInt32( this.numMonth.Value ) ); this.numDay_ValueChanged( this, null ); } } bool IsRun = false; /// /// 日 /// /// /// void numDay_ValueChanged( object sender, EventArgs e ) { if ( !this.IsFirst && !this.IsRun ) { IsRun = true; this.IsCurrentShowTotalIncome = false; this.IsCurrentShowOperatingIncome = false; this.IsCurrentShowTotalPerformance = false; this.lblTotalIncome.ForeColor = Color.DarkCyan; this.lblOperatingIncome.ForeColor = Color.DarkCyan; this.lblTotalPerformance.ForeColor = Color.DarkCyan; if ( this.panelDay.Visible ) { this.DateTimeStart = this.numYear.Value + "-" + this.numMonth.Value + "-" + this.numDay.Value; this.DateTimeEnd = this.DateTimeStart; } System.Threading.Thread t = new System.Threading.Thread( new System.Threading.ThreadStart( delegate () { LYFZ.BLL.GetFinancialReportModel frmodel = orbll.Funt_GetFinanceDayReport_SMSStatistics( StrDateTimeStart: this.DateTimeStart, StrDateTimeEnd: this.DateTimeEnd, IsFinancialOutlay: IsFinancialOutlay, IsShowZeroText: true, StrStoreWhere: this.StrStoreWhere ); this.Invoke( new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl( delegate () { this.lblCount.Text = frmodel.StrFinance_OrderCountStatistic; this.lblFinancialSMS.Text = frmodel.StrFinance_SMSStatistics; this.lblPaymentMethodStatistics.Text = frmodel.StrFinance_PaymentStatistic; this.labSettlement.Text = frmodel.StrFinance_SettlementStatistic; } ) ); } ) ); t.Start(); this.IsRun = false; this.cmbtreevSecondOption_ComboBoxTree_NodeMouseClick( this, null ); //string smsContent = orbll.Funt_GetDayFinanceSMS(orbll.Funt_GetFinanceDayReport_SMSStatistics(this.DateTimeStart, this.DateTimeEnd, IsFinancialOutlay: true, IsShowZeroText: true, StrStoreWhere: this.StrStoreWhere), null); } } /// /// 年回车 /// /// /// void numYear_KeyDown( object sender, KeyEventArgs e ) { if ( e.KeyCode == Keys.Enter ) { this.numDay_ValueChanged( this, null ); } } /// /// 月回车 /// /// /// void numMonth_KeyDown( object sender, KeyEventArgs e ) { if ( e.KeyCode == Keys.Enter ) { this.numDay_ValueChanged( this, null ); } } /// /// 日回车 /// /// /// void numDay_KeyDown( object sender, KeyEventArgs e ) { if ( e.KeyCode == Keys.Enter ) { this.numDay_ValueChanged( this, null ); } } /// /// 当前是否显示总收入 /// bool IsCurrentShowTotalIncome = false; /// /// 当前是否显示营业收入 /// bool IsCurrentShowOperatingIncome = false; /// /// 当前是否显示总业绩 /// bool IsCurrentShowTotalPerformance = false; /// /// 点击总收入 /// /// /// void lblTotalIncome_MouseClick( object sender, MouseEventArgs e ) { if ( !this.IsCurrentShowTotalIncome ) { this.IsCurrentShowTotalIncome = true; this.IsCurrentShowOperatingIncome = false; this.IsCurrentShowTotalPerformance = false; this.lblTotalPerformance.ForeColor = Color.DarkCyan; this.lblOperatingIncome.ForeColor = Color.DarkCyan; this.lblTotalIncome.ForeColor = Color.Red; this.totip.SetToolTip( this.lblTotalIncome, "点我查看项目详情" ); this.TotalIncomeOrOperatingIncome_Click( LYFZ.BLL.BLL_ErpOrder.FinancialTotalIncomeSqlWhere ); } else { this.IsCurrentShowTotalIncome = false; this.lblTotalIncome.ForeColor = Color.DarkCyan; this.lblOperatingIncome.ForeColor = Color.DarkCyan; this.lblTotalPerformance.ForeColor = Color.DarkCyan; this.totip.SetToolTip( this.lblTotalIncome, "点我查看总收入详情" ); this.cmbtreevSecondOption_ComboBoxTree_NodeMouseClick( this, null ); } } /// /// 点击营业收入 /// /// /// void lblOperatingIncome_MouseClick( object sender, MouseEventArgs e ) { if ( !this.IsCurrentShowOperatingIncome ) { this.IsCurrentShowOperatingIncome = true; this.IsCurrentShowTotalIncome = false; this.IsCurrentShowTotalPerformance = false; this.lblTotalIncome.ForeColor = Color.DarkCyan; this.lblTotalPerformance.ForeColor = Color.DarkCyan; this.lblOperatingIncome.ForeColor = Color.Red; this.totip.SetToolTip( this.lblOperatingIncome, "点我查看项目详情" ); string StrSQL = "项目类别 != '摄友会返还款' and 项目类别 != '服务消费' and 项目类别 != '其它收入' and 项目类别 != '会员充值' and 项目类别 != '会员返现' and 项目类别 != '财务支出' and 项目类别 != '店面支出' and 项目类别 != '礼服押金' and 项目类别 != '礼服退押金' and 付款方式 != '代金券'"; this.TotalIncomeOrOperatingIncome_Click( StrSQL ); } else { this.IsCurrentShowOperatingIncome = false; this.lblTotalIncome.ForeColor = Color.DarkCyan; this.lblOperatingIncome.ForeColor = Color.DarkCyan; this.lblTotalPerformance.ForeColor = Color.DarkCyan; this.totip.SetToolTip( this.lblOperatingIncome, "点我查看营业收入详情" ); this.cmbtreevSecondOption_ComboBoxTree_NodeMouseClick( this, null ); } } /// /// 点击总业绩 /// /// /// void lblTotalPerformance_MouseClick( object sender, MouseEventArgs e ) { if ( !this.IsCurrentShowTotalPerformance ) { this.IsCurrentShowTotalPerformance = true; this.IsCurrentShowOperatingIncome = false; this.IsCurrentShowTotalIncome = false; this.lblTotalIncome.ForeColor = Color.DarkCyan; this.lblOperatingIncome.ForeColor = Color.DarkCyan; this.lblTotalPerformance.ForeColor = Color.Red; this.totip.SetToolTip( this.lblTotalPerformance, "点我查看项目详情" ); string StrWhere = ""; if ( this.panelDay.Visible ) { string StrTime = this.numYear.Value + "-" + this.numMonth.Value + "-" + this.numDay.Value; StrWhere += PublicCodeClasses.GetDateTime( "日期", StrTime, StrTime, ConnectWord: "" ); } else { StrWhere += PublicCodeClasses.GetDateTime( "日期", this.DateTimeStart, this.DateTimeEnd, ConnectWord: "" ); } StrWhere += " And " + StrStoreWhere; DataTable tbl = orbll.GetView_Custom( "BView_FinanceReportDay_TotalPerformanceDetail", StrWhere: StrWhere, ShowColumnName: "项目名称,开单人,客户姓名,金额,日期,项目类别", filedOrder: "日期 Asc" ).Tables[0]; this.dgvData.DataSource( tbl, strHideField: "" ); this.dgvData.Columns["日期"].Width = 110; } else { this.IsCurrentShowTotalPerformance = false; this.lblTotalIncome.ForeColor = Color.DarkCyan; this.lblOperatingIncome.ForeColor = Color.DarkCyan; this.lblTotalPerformance.ForeColor = Color.DarkCyan; this.totip.SetToolTip( this.lblTotalPerformance, "点我查看总业绩详情" ); this.cmbtreevSecondOption_ComboBoxTree_NodeMouseClick( this, null ); } } /// /// 点击总收入或营业收入的查询事件 /// /// void TotalIncomeOrOperatingIncome_Click( string StrWhere ) { string StrTableName = ""; string StrColumns = "ID,Pay_Type,项目名称,接单人,客户姓名,金额,优惠金额,项目类别,收支,日期,付款方式,收银,审核,备注"; StrTableName = "BView_FinanceReportDay_AllItems"; if ( this.panelDay.Visible ) { string StrTime = this.numYear.Value + "-" + this.numMonth.Value + "-" + this.numDay.Value; StrWhere += PublicCodeClasses.GetDateTime( "convert(datetime,日期)", StrTime, StrTime ); } else { StrWhere += PublicCodeClasses.GetDateTime( "convert(datetime,日期)", this.DateTimeStart, this.DateTimeEnd ); } StrWhere += " And " + StrStoreWhere; this.FinanceDayReportSmallForm_Load( this, null ); LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod( delegate ( object obj, BackgroundWorker backgroundWorker ) { string ExecuteSql = orbll.GetView_CustomReturnExecuteSql( StrTableName, StrWhere: StrWhere, ShowColumnName: StrColumns, filedOrder: "日期" ); DataSet dtSet = orbll.GetView_Custom( ExecuteSql ); DataTable tbl = dtSet.Tables["ds"]; //DataRow[] dtRow = tbl.Select(""); try { this.Invoke( new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl( delegate () { //this.dgvData.DataSource(dtRow, IsClearRows: true); this.dgvData.DataSource( tbl, "ID,Pay_Type", IsClearRows: true ); } ) ); } catch { } } ); } /// /// 订单数右键复制 /// /// /// void lblCount_MouseDown( object sender, MouseEventArgs e ) { if ( e.Button == System.Windows.Forms.MouseButtons.Right ) { ContextMenuStripEx conMenu = new ContextMenuStripEx(); conMenu.ItemClicked += conMenu_ItemClicked; ToolStripMenuItem item = new ToolStripMenuItem(); item.Text = "复制订单数"; item.Tag = this.lblCount.Text.Trim(); conMenu.Items.Add( item ); // conMenu.Show(); conMenu.Show( MousePosition.X, MousePosition.Y );//弹出操作菜单 } } /// /// 财务统计右键复制 /// /// /// void lblFinancialSMS_MouseDown( object sender, MouseEventArgs e ) { if ( e.Button == System.Windows.Forms.MouseButtons.Right ) { ContextMenuStripEx conMenu = new ContextMenuStripEx(); conMenu.ItemClicked += conMenu_ItemClicked; ToolStripMenuItem item = new ToolStripMenuItem(); item.Text = "复制财务统计"; item.Tag = this.lblFinancialSMS.Text.Trim(); conMenu.Items.Add( item ); // conMenu.Show(); conMenu.Show( MousePosition.X, MousePosition.Y );//弹出操作菜单 } } /// /// 支付方式右键复制 /// /// /// void lblPaymentMethodStatistics_MouseDown( object sender, MouseEventArgs e ) { if ( e.Button == System.Windows.Forms.MouseButtons.Right ) { ContextMenuStripEx conMenu = new ContextMenuStripEx(); conMenu.ItemClicked += conMenu_ItemClicked; ToolStripMenuItem item = new ToolStripMenuItem(); item.Text = "复制进帐方式"; item.Tag = this.lblPaymentMethodStatistics.Text.Trim(); conMenu.Items.Add( item ); // conMenu.Show(); conMenu.Show( MousePosition.X, MousePosition.Y );//弹出操作菜单 } } /// /// 右键复制菜单 /// /// /// void conMenu_ItemClicked( object sender, ToolStripItemClickedEventArgs e ) { ToolStripItem item = e.ClickedItem; if ( !string.IsNullOrEmpty( item.Text.Trim() ) && item.Tag != null ) { Clipboard.SetDataObject( item.Tag ); } } /// /// 审核 /// /// /// void btnAudit_Click( object sender, EventArgs e ) { try { if ( this.dgvData.SelectedRows.Count == 0 ) { MessageBoxCustom.Show( "请选择你要审核的数据!" ); return; } if ( this.dgvData.SelectedRows.Count > 10 ) { MessageBoxCustom.Show( "最多只能选择10条审核!" ); return; } string StrAuditText = ""; LYFZ.Software.MainBusiness.StatisticalInquiry.FinanceDayAuditTipsSetSmallForm frm = new FinanceDayAuditTipsSetSmallForm(); DialogResult MesResult = frm.ShowDialog(); if ( MesResult == System.Windows.Forms.DialogResult.Cancel ) { return; } else if ( MesResult == System.Windows.Forms.DialogResult.Yes ) { StrAuditText = "已审核"; } else if ( MesResult == System.Windows.Forms.DialogResult.No ) { StrAuditText = "审核不通过"; } #region 审核 if ( !string.IsNullOrEmpty( StrAuditText ) ) { DateTime StrTime = DateTime.Now; string StrUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name; List clist = new List(); for ( int i = 0; i < dgvData.SelectedRows.Count; i++ ) { string ItemCategory = this.dgvData.SelectedRows[i].Cells["项目类别"].Value.ToString().Trim(); string ID = this.dgvData.SelectedRows[i].Cells["编号"].Value.ToString().Trim(); switch ( this.dgvData.SelectedRows[i].Cells["Pay_Type"].Value.ToString().Trim() ) { case "0": case "1": case "2": LYFZ.Model.Model_ErpPayment model3 = ptbll.GetModel( Convert.ToInt32( ID ) ); model3.Pay_FinancialAudit = StrAuditText; model3.Pay_FinancialAuditdPeople = StrUserID; clist.Add( ptbll.GetUpdateCommandInfo( model3 ) ); break; case "-1": if ( this.dgvData.SelectedRows[i].Cells["项目名称"].Value.ToString().Trim() == "储值取现" || this.dgvData.SelectedRows[i].Cells["项目名称"].Value.ToString().Trim() == "充值定金退款" ) { LYFZ.Model.Model_ErpMemberCardTakeCash model4 = mctkcbll.GetModel( Convert.ToInt32( ID ) ); model4.Mctkc_AuditStatus = StrAuditText; model4.Mctkc_AuditDateTime = StrTime; model4.Mctkc_AuditName = StrUserID; model4.Mctkc_UpdateDateTime = StrTime; model4.Mctkc_UpdateName = StrUserID; clist.Add( mctkcbll.GetUpdateCommandInfo( model4 ) ); } else { switch ( ItemCategory ) { case "其它收入": case "店面支出": case "财务支出": LYFZ.Model.Model_ErpOtherIncomeAndExpenses model = oiebll.GetModel( Convert.ToInt32( ID ) ); model.Oiae_FinancialAuditState = StrAuditText; model.Oiae_FinancialAuditPeople = StrUserID; clist.Add( oiebll.GetUpdateCommandInfo( model ) ); break; case "会员充值": LYFZ.Model.Model_ErpMemberCardRechargeRecord model1 = mcrrbll.GetModel( Convert.ToInt32( ID ) ); model1.Mcrr_FinancialAudit = StrAuditText; model1.Mcrr_FinancialAuditName = StrUserID; clist.Add( mcrrbll.GetUpdateCommandInfo( model1 ) ); break; case "服务消费": LYFZ.Model.Model_ErpMemberCardPayment model2 = mcptbll.GetModel( Convert.ToInt32( ID ) ); model2.Mcpt_FinancialAudit = StrAuditText; model2.Mcpt_FinancialAuditName = StrUserID; model2.Mcpt_FinancialAuditDateTime = StrTime; clist.Add( mcptbll.GetUpdateCommandInfo( model2 ) ); break; case "会员返现": LYFZ.Model.Model_ErpMemberCardBackCashTakeCash model5 = bctcbll.GetModel( Convert.ToInt32( ID ) ); model5.Mctc_CashAmountAudit = StrAuditText; model5.Mctc_CashAmountAuditName = StrUserID; model5.Mctc_CashAmountAuditDateTime = StrTime; clist.Add( bctcbll.GetUpdateCommandInfo( model5 ) ); break; case "礼服退押金": LYFZ.Model.Model_ErpDressRefundRecord model6 = drrbll.GetModel( Convert.ToInt32( ID ) ); model6.DRR_RefundAmountAudit = StrAuditText; model6.DRR_RefundAmountAuditName = StrUserID; model6.DRR_RefundAmountAuditDateTime = StrTime; clist.Add( drrbll.GetUpdateCommandInfo( model6 ) ); break; case "礼服押金": LYFZ.Model.Model_ErpDressDepositReceivables model7 = ddrbll.GetModel( Convert.ToInt32( ID ) ); model7.DDR_DepositAmountAudit = StrAuditText; model7.DDR_DepositAmountAuditName = StrUserID; model7.DDR_DepositAmountAuditDateTime = StrTime; clist.Add( ddrbll.GetUpdateCommandInfo( model7 ) ); break; case "摄友会返还款": LYFZ.Model.Model_ErpMemberCardPhotographerMain model8 = mcpmbll.GetModel( Convert.ToInt32( ID ) ); model8.Mcpm_OKBackAoumntAudit = StrAuditText; model8.Mcpm_OKBackAoumntAuditName = StrUserID; model8.Mcpm_OKBackAoumntAuditDateTime = StrTime; clist.Add( mcpmbll.GetUpdateCommandInfo( model8 ) ); break; case "摄友会升级": LYFZ.Model.Model_ErpMemberCardPhotographerMain model9 = mcpmbll.GetModel( Convert.ToInt32( ID ) ); model9.Mcpm_UpgradeAoumntAudit = StrAuditText; model9.Mcpm_UpgradeAoumntAuditName = StrUserID; model9.Mcpm_UpgradeAoumntAuditDateTime = StrTime; clist.Add( mcpmbll.GetUpdateCommandInfo( model9 ) ); break; } } break; } } if ( clist.Count > 0 ) { if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran( clist ) <= 0 ) { MessageBoxCustom.Show( "审核失败!" ); return; } MessageBoxCustom.Show( "审核成功" ); //for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ ) for ( int i = this.dgvData.SelectedRows.Count - 1; i > -1; i-- ) { string ItemCategory = this.dgvData.SelectedRows[i].Cells["项目类别"].Value.ToString().Trim(); string ID = this.dgvData.SelectedRows[i].Cells["编号"].Value.ToString().Trim(); switch ( this.dgvData.SelectedRows[i].Cells["Pay_Type"].Value.ToString().Trim() ) { case "0": case "1": case "2": this.dgvData.SelectedRows[i].Cells["财务审核"].Value = StrAuditText + "/" + StrUserName; break; case "-1": switch ( ItemCategory ) { case "其它收入": case "店面支出": case "财务支出": case "会员充值": case "服务消费": case "会员返现": case "礼服退押金": case "礼服押金": case "摄友会返还款": case "摄友会升级": this.dgvData.SelectedRows[i].Cells["财务审核"].Value = StrAuditText + "/" + StrUserName; break; } break; } if ( StrAuditText == "已审核" ) { this.dgvData.SelectedRows[i].DefaultCellStyle.ForeColor = Color.Blue; if ( OnlyShowUnAudited == true ) { // 删除这行; this.dgvData.Rows.RemoveAt( this.dgvData.SelectedRows[i].Index ); } } else { this.dgvData.SelectedRows[i].DefaultCellStyle.ForeColor = Color.Red; } } } else { MessageBoxCustom.Show( "选中的数据中没有可审核的数据!" ); } } #endregion } catch ( Exception ex ) { MessageBoxCustom.Show( ex.Message ); } } /// /// 导出 /// /// /// void btnExport_Click( object sender, EventArgs e ) { //LYFZ.BLL.BLL_SMSTemplates sssbll = new BLL.BLL_SMSTemplates(); //LYFZ.Model.Model_SMSTemplates modelaa = new Model.Model_SMSTemplates(); //DateTime strtime = Convert.ToDateTime(this.numYear.Value + "-" + this.numMonth.Value + "-" + this.numDay.Value); //sssbll.GenerateFinancialSMS(storeID: LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID(), date: strtime, tModel: null); this.dgvData.ExportDataTable( StrFileName: this.Text.Trim() ); } /// /// 打印 /// /// /// void btnPrint_Click( object sender, EventArgs e ) { try { string StrPrintType = ""; string StrTilte = ""; if ( IsCurrentShowTotalIncome ) { StrTilte = "(总收入)"; } else if ( IsCurrentShowOperatingIncome ) { StrTilte = "(营业收入)"; } if ( IsCurrentShowTotalPerformance ) { StrTilte = "(总业绩)"; StrPrintType = "总业绩"; } string StrDateWeek = ""; if ( this.panelDay.Visible ) { string time = Convert.ToDateTime( this.numYear.Value + "-" + this.numMonth.Value + "-" + this.numDay.Value ).ToString( "yyyy-MM-dd" ); StrDateWeek = time + "(" + LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.CaculateWeekDay( Convert.ToDateTime( time ).DayOfWeek.ToString() ) + ")"; } else { StrDateWeek = this.DateTimeStart.Replace( "-", "." ) + "-" + this.DateTimeEnd.Replace( "-", "." ); } string StrItemText = "项目统计:总业绩:" + this.txtTotalPerformance.Text.Trim() + " 总收入:" + this.txtTotalIncome.Text.Trim() + " 营业收入:" + this.txtOperatingIncome.Text.Trim() + " 支出:" + this.txtTotalOutlay.Text.Trim(); if ( IsFinancialOutlay ) { StrItemText += " 净收入:" + this.txtNetIncome.Text.Trim(); } StrItemText += " 订单前期:" + this.txtOrderEarly.Text.Trim() + " 订单后期:" + this.txtOrderLate.Text.Trim() + " 总押金:" + this.txtTotalDeposit.Text.Trim() + " 总欠款:" + this.txtTotalArrears.Text.Trim() + " 代金券:" + this.txtVoucher.Text.Trim(); object StrText = StrItemText + "\r\n" + this.lblFinancialSMS.Text.Trim() + "\r\n" + this.lblPaymentMethodStatistics.Text.Trim() + "\r\n" + this.labSettlement.Text.Trim() + "\r\n" + this.lblCount.Text.Trim(); Hashtable htData = new Hashtable(); htData["dgvData"] = this.dgvData; htData["StrText"] = StrText; htData["StrDateWeek"] = StrDateWeek; htData["IsPrintType"] = StrPrintType; htData["StrTilte"] = StrTilte; LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat( EnumPublic.PrintTypeEnum.财务报表日, htData ); } catch ( Exception ex ) { MessageBoxCustom.Show( ex.Message ); } } /// /// 关闭 /// /// /// void btnClose_Click( object sender, EventArgs e ) { this.Close(); } /// /// 窗体大小发生变化 /// /// /// void FinanceDayReportSmallForm_Resize( object sender, EventArgs e ) { int LocationY = 0; if ( this.panelOrderType.Visible ) { LocationY = this.panelOrderType.Location.Y; } else { LocationY = this.panelStoreName.Location.Y; } switch ( LocationY ) { case 0: this.flowLayoutPanel1.Height = 28; break; case 27: this.flowLayoutPanel1.Height = 55; break; case 54: this.flowLayoutPanel1.Height = 82; break; case 81: this.flowLayoutPanel1.Height = 109; break; } this.panelEx2.Height = this.flowLayoutPanel1.Height + 89; } /// /// 列表添加行时发生事件 /// /// /// void dgvData_RowsAdded( object sender, DataGridViewRowsAddedEventArgs e ) { if ( this.dgvData.Rows[e.RowIndex].Cells["日期"].Value.ToString().Trim() != "" ) { this.dgvData.Rows[e.RowIndex].Cells["日期"].Value = LYFZ.Command.Command_Validate.DateTimeToString( this.dgvData.Rows[e.RowIndex].Cells["日期"].Value, "yyyy-MM-dd HH:mm" ); } } /// /// 双击查看详情 /// /// /// void dgvData_CellMouseDoubleClick( object sender, DataGridViewCellMouseEventArgs e ) { if ( e.RowIndex >= 0 && e.ColumnIndex >= 0 ) { try { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.FinanceDayRowsDoubleClick( this.dgvData.Rows[e.RowIndex].Cells["编号"].Value.ToString().Trim(), this.dgvData.Rows[e.RowIndex].Cells["Pay_Type"].Value.ToString().Trim() ); } catch { MessageBoxCustom.Show( "此项目不支持查看详情" ); } } } } }