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 FinanceYearReportSmallForm : LYFZ.Software.UI.StatisticalInquiry.FinanceYearReportSmallForm { LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder(); public FinanceYearReportSmallForm() { this.Load += FinanceYearReportSmallForm_Load; this.Shown += FinanceYearReportSmallForm_Shown; this.numYear.ValueChanged += numYear_ValueChanged; this.cmbtreevPaymentMethod.ComboBoxTree_NodeMouseClick += cmbtreevPaymentMethod_ComboBoxTree_NodeMouseClick; this.cmbtreevQueryItem.ComboBoxTree_NodeMouseClick += cmbtreevQueryItem_ComboBoxTree_NodeMouseClick; this.cmbtreevSecondOption.ComboBoxTree_NodeMouseClick += cmbtreevSecondOption_ComboBoxTree_NodeMouseClick; this.cmbtreevStoreName.ComboBoxTree_NodeMouseClick += cmbtreevStoreName_ComboBoxTree_NodeMouseClick; this.cmbtreevOrderType.ComboBoxTree_NodeMouseClick += cmbtreevOrderType_ComboBoxTree_NodeMouseClick; this.btnExport.Click += btnExport_Click; this.btnPrint.Click += btnPrint_Click; this.btnClose.Click += btnClose_Click; this.dgvData.MouseDoubleClick += dgvData_MouseDoubleClick; this.Resize += FinanceYearReportSmallForm_Resize; } /// /// 是否有财务支出权限 /// 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 FinanceYearReportSmallForm_Load(object sender, EventArgs e) { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindGroupStoreName(this.cmbtreevStoreName, StrGroupKeyCode: "st0240", StrKeyCode: "st027"); LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindFinanceOrderType(this.cmbtreevOrderType); string StrColumns = "月份, 总收入, 总支出, 总净收, 优惠金额, 订单定金, 订单补款, 后期收入, 其它收入, 会员充值, 服务卡充值, 摄友会收款, 总业绩, 前期业绩, 后期业绩"; this.dgvData.DataColumns(StrColumns); this.dgvData.FillLastColumn(true); } /// /// 窗体加载事件 /// /// /// void FinanceYearReportSmallForm_Shown(object sender, EventArgs e) { //this.cmbtreevSecondOption.Visible = 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.Value = SDateTime.Now.Year; } /// /// 年变更事件 /// /// /// void numYear_ValueChanged(object sender, EventArgs e) { this.dgvData.Rows.Clear(); string StrDateTimeStart = this.numYear.Value + "-01-01"; string StrDateTimeEnd = Convert.ToDateTime(StrDateTimeStart).AddYears(1).AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss.fff"); string StrDateYear = this.numYear.Value.ToString().Trim(); string StrItemQueryText = this.cmbtreevQueryItem.Text.Trim(); string StrSecondOption = this.cmbtreevSecondOption.Text.Trim(); string StrPaymentMethod = this.cmbtreevPaymentMethod.Text.Trim(); string StrOrderType = this.cmbtreevOrderType.Text.Trim(); LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker) { LYFZ.BLL.GetFinancialReportModel frmodel = orbll.Funt_GetFinanceYearReport(StrItemQueryText: StrItemQueryText, StrSecondOption: StrSecondOption, StrPaymentMethod: StrPaymentMethod, StrDateYear: StrDateYear, IsFinancialOutlay: this.IsFinancialOutlay, IsOrderStatistic: true, StrStoreWhere: this.StrStoreWhere); LYFZ.BLL.GetFinancialReportModel frmodel2 = orbll.Funt_GetFinanceDayReport(StrItemQueryText: StrItemQueryText, StrSecondOption: StrSecondOption, StrPaymentMethod: StrPaymentMethod, StrOrderType: StrOrderType, StrDateTimeStart: StrDateTimeStart, StrDateTimeEnd: StrDateTimeEnd, IsFinancialOutlay: this.IsFinancialOutlay, IsGetArrearsOrDeposits: false, StrStoreWhere: this.StrStoreWhere); DataTable dt = frmodel2.dtFinance_Statistic; DataTable dt2 = frmodel.dtFinance_DataList; string StrOrderCountStatistic = frmodel.StrFinance_OrderCountStatistic; this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate() { this.lblCount.Text = StrOrderCountStatistic; 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.txtTotalOutlay.Text = dt.Rows[i]["支出"].ToString().Trim(); this.txtVoucher.Text = dt.Rows[i]["代金券"].ToString().Trim(); } } if (dt2 != null) { for (int i = 0; i < dt2.Rows.Count; i++) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewCell cell = null; for (int j = 0; j < dt2.Columns.Count; j++) { cell = new DataGridViewTextBoxCell(); cell.Value = dt2.Rows[i][j].ToString().Trim(); dgvr.Cells.Add(cell); } this.dgvData.Rows.Add(dgvr); } } })); }); } /// /// 付款方式 /// /// /// void cmbtreevPaymentMethod_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("全部"); } this.cmbtreevSecondOption_ComboBoxTree_NodeMouseClick(this, null); } /// /// 第二选项选择事件 /// /// /// void cmbtreevSecondOption_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { string StrDateTimeStart = this.numYear.Value + "-01-01"; string StrDateTimeEnd = Convert.ToDateTime(StrDateTimeStart).AddYears(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss.fff"); string StrItemQueryText = this.cmbtreevQueryItem.Text.Trim(); string StrSecondOption = this.cmbtreevSecondOption.Text.Trim(); string StrPaymentMethod = this.cmbtreevPaymentMethod.Text.Trim(); string StrOrderType = this.cmbtreevOrderType.Text.Trim(); LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker) { LYFZ.BLL.GetFinancialReportModel frmodel2 = orbll.Funt_GetFinanceDayReport(StrItemQueryText: StrItemQueryText, StrSecondOption: StrSecondOption, StrPaymentMethod: StrPaymentMethod, StrOrderType: StrOrderType, StrDateTimeStart: StrDateTimeStart, StrDateTimeEnd: StrDateTimeEnd, IsFinancialOutlay: IsFinancialOutlay, IsGetArrearsOrDeposits: false, StrStoreWhere: this.StrStoreWhere); DataTable dt = frmodel2.dtFinance_Statistic; 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.txtTotalOutlay.Text = dt.Rows[i]["支出"].ToString().Trim(); this.txtVoucher.Text = dt.Rows[i]["代金券"].ToString().Trim(); } } })); }); } /// /// 选择分店 /// /// /// void cmbtreevStoreName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { this.PublicFunctionRights(); this.numYear_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.btnExport.Enabled = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupStoreRights(this.cmbtreevStoreName, "YearFinanceCompetence", CustomAttributes.OperatingAuthority.DataExport); this.btnPrint.Enabled = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupStoreRights(this.cmbtreevStoreName, "YearFinanceCompetence", 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("财务支出")); } } /// /// 导出 /// /// /// void btnExport_Click(object sender, EventArgs e) { this.dgvData.ExportDataTable(StrFileName: "年财务详情"); } /// /// 打印 /// /// /// void btnPrint_Click(object sender, EventArgs e) { try { string StrDateWeek = this.numYear.Value.ToString().Trim() + "年"; object StrText = "总收入:" + this.txtTotalIncome.Text.Trim() + " 营业收入:" + this.txtOperatingIncome.Text.Trim() + " 总支出:" + this.txtTotalOutlay.Text.Trim(); StrText += "\r\n净收入:" + this.txtNetIncome.Text.Trim() + " 前期业绩:" + this.txtOrderEarly.Text.Trim() + " 后期业绩:" + this.txtOrderLate.Text.Trim(); StrText += "\r\n" + this.lblCount.Text.Trim(); Hashtable htData = new Hashtable(); htData["dgvData"] = this.dgvData; htData["StrText"] = StrText; htData["StrDateWeek"] = StrDateWeek; 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 dgvData_MouseDoubleClick(object sender, MouseEventArgs e) { try { if (e.Location.Y > this.dgvData.ColumnHeadersHeight) { if (this.dgvData.SelectedRows.Count == 0) { MessageBoxCustom.Show("请选择你要查看的月份!"); return; } LYFZ.Software.MainBusiness.StatisticalInquiry.FinanceMonthReportSmallForm frm = new FinanceMonthReportSmallForm(); frm.StrDateTime = this.dgvData.CurrentRow.Cells["月份"].Value.ToString(); frm.DataTimeStoreName = this.cmbtreevStoreName.Text.Trim(); frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual; frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y); frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height); frm.ShowDialog(); } } catch (Exception ex) { MessageBoxCustom.Show(ex.Message); } } /// /// 窗体大小 发生变化 /// /// /// void FinanceYearReportSmallForm_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 + 25; } } }