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.MonthFinance { public partial class FrmMonthFinanceSeeDetails : LYFZ.Software.UI.StatisticalInquiry.MonthFinance.FrmMonthFinanceSeeDetails { private delegate void UpdateControl(); LYFZ.BLL.BLL_ErpPayment ptbll = new BLL.BLL_ErpPayment(); LYFZ.BLL.BLL_ErpWagesSet WagesSetBll = new BLL.BLL_ErpWagesSet(); LYFZ.BLL.BLL_AllViewSet AllViewSetBll = new BLL.BLL_AllViewSet(); LYFZ.BLL.BLL_ErpMemberCardPayment mcptbll = new BLL.BLL_ErpMemberCardPayment(); LYFZ.BLL.BLL_ErpTwoSalesOrder TwoSalesOrderbll = new BLL.BLL_ErpTwoSalesOrder(); LYFZ.BLL.BLL_ErpDressSaleRentalOrder dsrobll = new BLL.BLL_ErpDressSaleRentalOrder(); LYFZ.BLL.BLL_ErpOtherIncomeAndExpenses oiebll = new BLL.BLL_ErpOtherIncomeAndExpenses(); LYFZ.BLL.BLL_ErpMemberCardRechargeRecord mcrrbll = new BLL.BLL_ErpMemberCardRechargeRecord(); public string StrDateStart; public string StrDateEnd; public FrmMonthFinanceSeeDetails() { } /// /// 加载 /// /// /// protected override void FrmMonthFinanceSeeDetails_Shown(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(this.StrDateStart) && !string.IsNullOrEmpty(this.StrDateEnd)) { this.lblDate.Text = this.StrDateStart + " — " + this.StrDateEnd; //获取支付方式 LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEBACCAFCCEAGAIHH", this.CtvTsorder_Name, IsFirstNodeNull: true); this.cmbProjectSearch.SelectedIndex = 0; this.btnFinancialAudit.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DayFinanceCompetence, CustomAttributes.OperatingAuthority.FinancialAudit); this.btnExPort.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DayFinanceCompetence, CustomAttributes.OperatingAuthority.DataExport); this.btnPrint.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DayFinanceCompetence, CustomAttributes.OperatingAuthority.Print); // btnFinancialExpenses.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DayFinanceCompetence, CustomAttributes.OperatingAuthority.FinancialExpenses); } } catch (Exception ex) { MessageBoxCustom.Show(ex.Message); } } #region 获取绑定数据(收入,营业收入,支出,财务支出,订单,补款,选片二销,其它收入,会员充值,服务卡充值,全部押金) /// /// 获取订单收款/其它二销/礼服租售记录 /// public void BindOrdersReceivables() { StringBuilder str = new StringBuilder(); str.Append(PublicCodeClasses.GetDateTime("convert(datetime,Pay_CreateDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0, ConnectWord: "")); if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null) { str.Append(" and Pay_PaymentMethod='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); } #region 项目查询 if (cmbProjectSearch.Text != "全部") { if (cmbProjectSearch.Text == "订单前期收入") { if (string.IsNullOrEmpty(CtvTsorder_Name.Text) || CtvTsorder_Name.Text == "全部") { str.Append(" and Pay_Category!='后期收款'"); } else { str.Append(" and Pay_Category='" + CtvTsorder_Name.Text.ToString() + "'"); } } else if (cmbProjectSearch.Text == "订单后期收入") { if (string.IsNullOrEmpty(CtvTsorder_Name.Text) || CtvTsorder_Name.Text == "全部") { str.Append(" and Pay_Category='后期收款' and Pay_Type=0"); } else { str.Append("and Pay_Category='后期收款' and Pay_Type=0 and Pay_TwoPinsCategory='" + CtvTsorder_Name.Tag.ToString() + "'"); } } else if (cmbProjectSearch.Text == "其它消费收入") { if (string.IsNullOrEmpty(CtvTsorder_Name.Text) || CtvTsorder_Name.Text == "全部") { str.Append(" and Pay_Category='后期收款' and Pay_Type=1"); } else { str.Append("and Pay_Category='后期收款' and Pay_Type=1 and Pay_TwoPinsCategory='" + CtvTsorder_Name.Tag.ToString() + "'"); } } else if (cmbProjectSearch.Text == "礼服租售收入") { if (string.IsNullOrEmpty(CtvTsorder_Name.Text) || CtvTsorder_Name.Text == "全部") { str.Append(" and Pay_Category='后期收款' and Pay_Type=2"); } else { str.Append("and Pay_Category='后期收款' and Pay_Type=2 and Pay_ReceivableProject='" + CtvTsorder_Name.Text.ToString() + "'"); } } } #endregion #region 获取订单收款记录 LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker) { DataTable dt = AllViewSetBll.Vw_OrdersWagePaymentRecords(str.ToString()).Tables[0]; if (dt.Rows.Count > 0) { this.Invoke(new UpdateControl(delegate() { for (int t = 0; t < dt.Rows.Count; t++) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewCell cell = null; //编号 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["ID"].ToString(); dgvr.Cells.Add(cell); //项目名称 cell = new DataGridViewTextBoxCell(); if (dt.Rows[t]["Pay_Type"].ToString() == "0") { if (!string.IsNullOrEmpty(dt.Rows[t]["Ord_SinceOrderNumber"].ToString())) { cell.Value = dt.Rows[t]["Ord_SinceOrderNumber"].ToString().Trim(); } else { cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim(); } } else if (dt.Rows[t]["Pay_Type"].ToString() == "1") { cell.Value = dt.Rows[t]["Tsorder_Name"].ToString().Trim(); } else if (dt.Rows[t]["Pay_Type"].ToString() == "2") { cell.Value = dt.Rows[t]["Pay_ReceivableProject"].ToString().Trim(); } dgvr.Cells.Add(cell); //开单人 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Pay_UserName"].ToString(); dgvr.Cells.Add(cell); //客户 cell = new DataGridViewTextBoxCell(); if (dt.Rows[t]["Pay_Type"].ToString() == "0") { cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim(); } else if (dt.Rows[t]["Pay_Type"].ToString() == "1") { cell.Value = dt.Rows[t]["Tsorder_CustomerName"].ToString().Trim(); } else if (dt.Rows[t]["Pay_Type"].ToString() == "2") { cell.Value = dt.Rows[t]["Cus_Name"].ToString().Trim(); } dgvr.Cells.Add(cell); //金额 cell = new DataGridViewTextBoxCell(); cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString(); dgvr.Cells.Add(cell); //项目类别 cell = new DataGridViewTextBoxCell(); if (dt.Rows[t]["Pay_Category"].ToString() != "后期收款") { cell.Value = dt.Rows[t]["Pay_Category"].ToString(); } else { if (!string.IsNullOrEmpty(dt.Rows[t]["Cus_Name"].ToString())) { cell.Value = dt.Rows[t]["Pay_ReceivableProject"].ToString(); } else { cell.Value = dt.Rows[t]["Pay_TwoPinsCategoryName"].ToString(); } } dgvr.Cells.Add(cell); //收入/支出 cell = new DataGridViewTextBoxCell(); cell.Value = "收入"; dgvr.Cells.Add(cell); //日期 cell = new DataGridViewTextBoxCell(); cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt.Rows[t]["Pay_CreateDatetime"], "yyyy-MM-dd HH:mm"); dgvr.Cells.Add(cell); //支付方式 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim(); dgvr.Cells.Add(cell); //收银 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Pay_ThePayeeName"].ToString().Trim(); dgvr.Cells.Add(cell); //财务审核 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Pay_FinancialAudit"].ToString().Trim() == "" ? "未审核/" : dt.Rows[t]["Pay_FinancialAudit"].ToString().Trim() + "/" + dt.Rows[t]["Pay_FinancialAuditdPeopleName"].ToString().Trim(); dgvr.Cells.Add(cell); if (dt.Rows[t]["Pay_FinancialAudit"].ToString().Trim() == "" || dt.Rows[t]["Pay_FinancialAudit"].ToString().Trim() == "审核不通过") { dgvr.DefaultCellStyle.ForeColor = Color.Red; } else { dgvr.DefaultCellStyle.ForeColor = Color.Blue; } this.dgv.Rows.Add(dgvr); } dgv.ClearSelection(); })); } }); #endregion } /// /// 获取其它收入 /// public void BindOtherIncome() { LYFZ.BLL.BLL_ErpOtherIncomeAndExpenses bll = new BLL.BLL_ErpOtherIncomeAndExpenses(); StringBuilder str = new StringBuilder(); str.Append("Oiae_Type='收入' " + PublicCodeClasses.GetDateTime("convert(datetime,Oiae_IEDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0)); if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null) { str.Append(" and Oiae_PaymentMethod='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); } #region 获取其它收入 LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker) { DataTable dt = bll.View_ErpOtherIncomeAndExpenses(str.ToString()).Tables[0]; if (dt.Rows.Count > 0) { this.Invoke(new UpdateControl(delegate() { for (int t = 0; t < dt.Rows.Count; t++) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewCell cell = null; //编号 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["ID"].ToString(); dgvr.Cells.Add(cell); //项目名称 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Oiae_ProjectName"].ToString().Trim(); dgvr.Cells.Add(cell); //开单人 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Oiae_PersonHandlingName"].ToString().Trim(); dgvr.Cells.Add(cell); //客户/备注 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Oiae_ThePayer"].ToString().Trim(); dgvr.Cells.Add(cell); //金额 cell = new DataGridViewTextBoxCell(); cell.Value = Convert.ToDecimal(dt.Rows[t]["Oiae_Money"]).ToString(); dgvr.Cells.Add(cell); //项目类别 cell = new DataGridViewTextBoxCell(); cell.Value = "其它收入"; dgvr.Cells.Add(cell); //收入/支出 cell = new DataGridViewTextBoxCell(); cell.Value = "收入"; dgvr.Cells.Add(cell); //日期 cell = new DataGridViewTextBoxCell(); cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt.Rows[t]["Oiae_IEDatetime"], "yyyy-MM-dd HH:mm"); dgvr.Cells.Add(cell); //支付方式 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Oiae_PaymentMethodName"].ToString().Trim(); ; dgvr.Cells.Add(cell); //收银 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Oiae_PersonHandlingName"].ToString().Trim(); dgvr.Cells.Add(cell); //财务审核 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() + "/" + dt.Rows[t]["Oiae_FinancialAuditPeopleName"].ToString().Trim(); dgvr.Cells.Add(cell); if (dt.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() == "未审核" || dt.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() == "审核不通过") { dgvr.DefaultCellStyle.ForeColor = Color.Red; } else { dgvr.DefaultCellStyle.ForeColor = Color.Blue; } this.dgv.Rows.Add(dgvr); } dgv.ClearSelection(); })); } }); #endregion } /// /// 获取会员充值 /// public void GetMemberCardRechargeRecord() { LYFZ.BLL.BLL_ErpUser Userbll = new BLL.BLL_ErpUser(); LYFZ.BLL.BLL_ErpMemberCardRechargeRecord CardRechargeRecordBll = new BLL.BLL_ErpMemberCardRechargeRecord(); StringBuilder str = new StringBuilder(); str.Append(PublicCodeClasses.GetDateTime("convert(datetime,Mcrr_CreateDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0)); if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null) { str.Append(" and Mcrr_PaymentMethod='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); } #region 获取会员充值 LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker) { DataTable dt = CardRechargeRecordBll.GetView_MemberCardRechargeRecord(str.ToString()).Tables[0]; if (dt.Rows.Count > 0) { this.Invoke(new UpdateControl(delegate() { for (int t = 0; t < dt.Rows.Count; t++) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewCell cell = null; //编号 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["ID"].ToString(); dgvr.Cells.Add(cell); //项目名称 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Mcrr_RechargeName"].ToString().Trim(); dgvr.Cells.Add(cell); //开单人 cell = new DataGridViewTextBoxCell(); cell.Value = Userbll.GetUserName(dt.Rows[t]["Mcrr_OrderPerson"].ToString().Trim()); dgvr.Cells.Add(cell); //客户/备注 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Cus_Name"].ToString().Trim(); dgvr.Cells.Add(cell); //金额 cell = new DataGridViewTextBoxCell(); cell.Value = Convert.ToDecimal(dt.Rows[t]["Mcrr_RechargeAmount"]).ToString(); dgvr.Cells.Add(cell); //项目类别 cell = new DataGridViewTextBoxCell(); cell.Value = "会员充值"; dgvr.Cells.Add(cell); //收入/支出 cell = new DataGridViewTextBoxCell(); cell.Value = "收入"; dgvr.Cells.Add(cell); //日期 cell = new DataGridViewTextBoxCell(); cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt.Rows[t]["Mcrr_CreateDatetime"], "yyyy-MM-dd HH:mm"); dgvr.Cells.Add(cell); //支付方式 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Mcrr_PaymentMethodName"].ToString().Trim(); ; dgvr.Cells.Add(cell); //收银 cell = new DataGridViewTextBoxCell(); cell.Value = Userbll.GetUserName(dt.Rows[t]["Mcrr_CreateName"].ToString().Trim()); dgvr.Cells.Add(cell); //财务审核 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Mcrr_FinancialAudit"].ToString().Trim() == "" ? "未审核/" : dt.Rows[t]["Mcrr_FinancialAudit"].ToString().Trim() + "/" + Userbll.GetUserName(dt.Rows[t]["Mcrr_FinancialAuditName"].ToString().Trim()); dgvr.Cells.Add(cell); if (dt.Rows[t]["Mcrr_FinancialAudit"].ToString().Trim() == "" || dt.Rows[t]["Mcrr_FinancialAudit"].ToString().Trim() == "审核不通过") { dgvr.DefaultCellStyle.ForeColor = Color.Red; } else { dgvr.DefaultCellStyle.ForeColor = Color.Blue; } this.dgv.Rows.Add(dgvr); } dgv.ClearSelection(); })); } }); #endregion } /// /// 获取服务卡消费充值 /// public void GetMemberCardPayment() { LYFZ.BLL.BLL_ErpUser Userbll = new BLL.BLL_ErpUser(); StringBuilder str = new StringBuilder(); str.Append(PublicCodeClasses.GetDateTime("convert(datetime,创建日期)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0)); if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null) { str.Append(" and 付款方式编号='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); } #region 获取服务卡消费充值 LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker) { DataTable dt = AllViewSetBll.Vw_ErpMemberCardPayment(str.ToString()).Tables[0]; if (dt.Rows.Count > 0) { this.Invoke(new UpdateControl(delegate() { for (int t = 0; t < dt.Rows.Count; t++) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewCell cell = null; //编号 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["ID"].ToString(); dgvr.Cells.Add(cell); //项目名称 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["服务套系类别名称"].ToString().Trim(); dgvr.Cells.Add(cell); //开单人 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["接单人名称"].ToString().Trim(); dgvr.Cells.Add(cell); //客户/备注 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["客户姓名"].ToString().Trim(); dgvr.Cells.Add(cell); //金额 cell = new DataGridViewTextBoxCell(); cell.Value = Convert.ToDecimal(dt.Rows[t]["收款金额"]).ToString(); dgvr.Cells.Add(cell); //项目类别 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["收款类型"].ToString(); dgvr.Cells.Add(cell); //收入/支出 cell = new DataGridViewTextBoxCell(); cell.Value = "收入"; dgvr.Cells.Add(cell); //日期 cell = new DataGridViewTextBoxCell(); cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt.Rows[t]["创建日期"], "yyyy-MM-dd HH:mm"); dgvr.Cells.Add(cell); //支付方式 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["支付方式名称"].ToString().Trim(); ; dgvr.Cells.Add(cell); //收银 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["创建人名称"].ToString().Trim(); dgvr.Cells.Add(cell); //财务审核 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["财务审核状态"].ToString().Trim() == "" ? "未审核/" : dt.Rows[t]["财务审核状态"].ToString().Trim() + "/" + Userbll.GetUserName(dt.Rows[t]["账务审核人"].ToString().Trim()); dgvr.Cells.Add(cell); if (dt.Rows[t]["财务审核状态"].ToString().Trim() == "" || dt.Rows[t]["财务审核状态"].ToString().Trim() == "审核不通过") { dgvr.DefaultCellStyle.ForeColor = Color.Red; } else { dgvr.DefaultCellStyle.ForeColor = Color.Blue; } this.dgv.Rows.Add(dgvr); } dgv.ClearSelection(); })); } }); #endregion } /// /// 获取现金支出 /// public void BindCashExpenses() { LYFZ.BLL.BLL_ErpOtherIncomeAndExpenses bll = new BLL.BLL_ErpOtherIncomeAndExpenses(); StringBuilder str = new StringBuilder(); str.Append(" Oiae_Type='支出' " + PublicCodeClasses.GetDateTime("convert(datetime,Oiae_IEDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0)); if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null) { if (cmbPay_PaymentMethod.Text != "现金") { return; } } if (cmbProjectSearch.Text != "全部" && cmbProjectSearch.Text == "店面支出") { if (!string.IsNullOrEmpty(CtvTsorder_Name.Text) && CtvTsorder_Name.Text != "全部") { str.Append("and Oiae_ProjectName='" + CtvTsorder_Name.Text.ToString() + "'"); } } #region 获取现金支出 LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker) { DataTable dt = bll.View_ErpOtherIncomeAndExpenses(str.ToString()).Tables[0]; if (dt.Rows.Count > 0) { this.Invoke(new UpdateControl(delegate() { for (int t = 0; t < dt.Rows.Count; t++) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewCell cell = null; //编号 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["ID"].ToString(); dgvr.Cells.Add(cell); //项目名称 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Oiae_ProjectName"].ToString().Trim(); dgvr.Cells.Add(cell); //开单人 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Oiae_PersonHandlingName"].ToString().Trim(); dgvr.Cells.Add(cell); //客户/备注 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["User_Name"].ToString().Trim() + "/" + dt.Rows[t]["Oiae_Remark"].ToString(); ; dgvr.Cells.Add(cell); //金额 cell = new DataGridViewTextBoxCell(); cell.Value = Convert.ToDecimal(dt.Rows[t]["Oiae_Money"]).ToString(); dgvr.Cells.Add(cell); //项目类别 cell = new DataGridViewTextBoxCell(); cell.Value = "固定费用"; dgvr.Cells.Add(cell); //收入/支出 cell = new DataGridViewTextBoxCell(); cell.Value = "店面支出"; dgvr.Cells.Add(cell); //日期 cell = new DataGridViewTextBoxCell(); cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt.Rows[t]["Oiae_IEDatetime"], "yyyy-MM-dd HH:mm"); dgvr.Cells.Add(cell); //支付方式 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Oiae_PaymentMethodName"].ToString().Trim(); dgvr.Cells.Add(cell); //收银 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Oiae_PersonHandlingName"].ToString().Trim(); dgvr.Cells.Add(cell); //财务审核 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() + "/" + dt.Rows[t]["Oiae_FinancialAuditPeopleName"].ToString().Trim(); dgvr.Cells.Add(cell); if (dt.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() == "未审核" || dt.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() == "审核不通过") { dgvr.DefaultCellStyle.ForeColor = Color.Red; } else { dgvr.DefaultCellStyle.ForeColor = Color.Blue; } this.dgv.Rows.Add(dgvr); } dgv.ClearSelection(); })); } }); #endregion } /// /// 财务支出 /// public void BindFinancialExpenses() { LYFZ.BLL.BLL_ErpOtherIncomeAndExpenses bll = new BLL.BLL_ErpOtherIncomeAndExpenses(); StringBuilder str = new StringBuilder(); str.Append(" Oiae_Type='财务支出' " + PublicCodeClasses.GetDateTime("convert(datetime,Oiae_IEDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0)); if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null) { if (cmbPay_PaymentMethod.Text != "现金") { return; } } if (cmbProjectSearch.Text != "全部" && cmbProjectSearch.Text == "财务支出") { if (!string.IsNullOrEmpty(CtvTsorder_Name.Text) && CtvTsorder_Name.Text != "全部") { str.Append("and Oiae_ProjectName='" + CtvTsorder_Name.Text.ToString() + "'"); } } #region 获取财务支出 LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker) { DataTable dt = bll.View_ErpOtherIncomeAndExpenses(str.ToString()).Tables[0]; if (dt.Rows.Count > 0) { this.Invoke(new UpdateControl(delegate() { for (int t = 0; t < dt.Rows.Count; t++) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewCell cell = null; //编号 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["ID"].ToString(); dgvr.Cells.Add(cell); //项目名称 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Oiae_ProjectName"].ToString().Trim(); dgvr.Cells.Add(cell); //开单人 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Oiae_PersonHandlingName"].ToString().Trim(); dgvr.Cells.Add(cell); //客户/备注 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["User_Name"].ToString().Trim() + "/" + dt.Rows[t]["Oiae_Remark"].ToString(); ; dgvr.Cells.Add(cell); //金额 cell = new DataGridViewTextBoxCell(); cell.Value = Convert.ToDecimal(dt.Rows[t]["Oiae_Money"]).ToString(); dgvr.Cells.Add(cell); //项目类别 cell = new DataGridViewTextBoxCell(); cell.Value = "固定费用"; dgvr.Cells.Add(cell); //收入/支出 cell = new DataGridViewTextBoxCell(); cell.Value = "财务支出"; dgvr.Cells.Add(cell); //日期 cell = new DataGridViewTextBoxCell(); cell.Value =LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[t]["Oiae_IEDatetime"],"yyyy-MM-dd HH:mm"); dgvr.Cells.Add(cell); //支付方式 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Oiae_PaymentMethodName"].ToString().Trim(); dgvr.Cells.Add(cell); //收银 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Oiae_PersonHandlingName"].ToString().Trim(); dgvr.Cells.Add(cell); //财务审核 cell = new DataGridViewTextBoxCell(); cell.Value = dt.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() + "/" + dt.Rows[t]["Oiae_FinancialAuditPeopleName"].ToString().Trim(); dgvr.Cells.Add(cell); if (dt.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() == "未审核" || dt.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() == "审核不通过") { dgvr.DefaultCellStyle.ForeColor = Color.Red; } else { dgvr.DefaultCellStyle.ForeColor = Color.Blue; } this.dgv.Rows.Add(dgvr); } dgv.ClearSelection(); })); } }); #endregion } #endregion /// /// 所以查询事件绑定 /// public void BindSelect() { this.dgv.Rows.Clear(); if (this.cmbProjectSearch.Text == "全部") { // 获取订单收款/其它二销/礼服租售记录 this.BindOrdersReceivables(); // 获取其它收入 this.BindOtherIncome(); // 获取会员充值 this.GetMemberCardRechargeRecord(); // 获取现金支出 this.BindCashExpenses(); //获取财务支出 this.BindFinancialExpenses(); // 服务卡消费收入 this.GetMemberCardPayment(); } else if (this.cmbProjectSearch.Text == "订单前期收入" || this.cmbProjectSearch.Text == "订单后期收入" || this.cmbProjectSearch.Text == "其它消费收入" || this.cmbProjectSearch.Text == "礼服租售收入") { this.BindOrdersReceivables(); } else if (this.cmbProjectSearch.Text == "其它收入") { this.BindOtherIncome(); } else if (this.cmbProjectSearch.Text == "会员充值收入") { this.GetMemberCardRechargeRecord(); } else if (this.cmbProjectSearch.Text == "服务卡消费收入") { this.GetMemberCardPayment(); } else if (this.cmbProjectSearch.Text == "店面支出") { this.BindCashExpenses(); } else if (this.cmbProjectSearch.Text == "财务支出") { this.BindFinancialExpenses(); } //获取文本框金额 this.BindTotal(); } /// /// 获取订单前期 /// /// decimal OrderEarly() { decimal sum = 0; DataTable dt = WagesSetBll.GetTwoPieSum(PublicCodeClasses.GetDateTime("convert(datetime,Pay_CreateDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0, ConnectWord: "") + " and Pay_Category!='后期收款' and (Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID')").Tables[0]; if (!string.IsNullOrEmpty(dt.Rows[0]["Pay_AmountOf"].ToString())) { sum = Convert.ToDecimal(dt.Rows[0]["Pay_AmountOf"]); } return sum; } /// /// 获取订单后期 /// /// decimal OrderLate() { decimal sum = 0; DataTable dt = WagesSetBll.GetTwoPieSum(PublicCodeClasses.GetDateTime("convert(datetime,Pay_CreateDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0, ConnectWord: "") + " and Pay_Category='后期收款' and (Pay_Type=0) and (Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID')").Tables[0]; if (!string.IsNullOrEmpty(dt.Rows[0]["Pay_AmountOf"].ToString())) { sum = Convert.ToDecimal(dt.Rows[0]["Pay_AmountOf"]); } return sum; } /// /// 获取收款记录金额 /// /// /// decimal TotalRevenueSun(string Symbol) { decimal sum = 0; StringBuilder str = new StringBuilder(); str.Append("" + Symbol + PublicCodeClasses.GetDateTime("convert(datetime,Pay_CreateDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0, ConnectWord: "")); if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null) { str.Append(" and Pay_PaymentMethod='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); } #region 项目查询 if (cmbProjectSearch.Text != "全部") { //订单前期 if (cmbProjectSearch.Text == "订单前期收入") { if (string.IsNullOrEmpty(CtvTsorder_Name.Text) || CtvTsorder_Name.Text == "全部") { str.Append(" and Pay_Category!='后期收款'"); } else { str.Append(" and Pay_Category='" + CtvTsorder_Name.Text.ToString() + "'"); } } //订单后期收入 if (cmbProjectSearch.Text == "订单后期收入") { if (string.IsNullOrEmpty(CtvTsorder_Name.Text) || CtvTsorder_Name.Text == "全部") { str.Append(" and Pay_Category='后期收款' and Pay_Type=0"); } else { str.Append("and Pay_Category='后期收款' and Pay_Type=0 and Pay_TwoPinsCategory='" + CtvTsorder_Name.Tag.ToString() + "'"); } } //其它消费收入 if (cmbProjectSearch.Text == "其它消费收入") { if (string.IsNullOrEmpty(CtvTsorder_Name.Text) || CtvTsorder_Name.Text == "全部") { str.Append(" and Pay_Category='后期收款' and Pay_Type=1"); } else { str.Append("and Pay_Category='后期收款' and Pay_Type=1 and Pay_TwoPinsCategory='" + CtvTsorder_Name.Tag.ToString() + "'"); } } //礼服租售收入 if (cmbProjectSearch.Text == "礼服租售收入") { if (string.IsNullOrEmpty(CtvTsorder_Name.Text) || CtvTsorder_Name.Text == "全部") { str.Append(" and Pay_Category='后期收款' and Pay_Type=2"); } else { str.Append("and Pay_Category='后期收款' and Pay_Type=2 and Pay_ReceivableProject='" + CtvTsorder_Name.Text.ToString() + "'"); } } } #endregion DataTable dt = WagesSetBll.GetTwoPieSum(str.ToString()).Tables[0]; if (!string.IsNullOrEmpty(dt.Rows[0]["Pay_AmountOf"].ToString())) { sum = Convert.ToDecimal(dt.Rows[0]["Pay_AmountOf"]); } return sum; } /// /// 获取其它收入金额 /// /// decimal OtherIncomeSum() { decimal sum = 0; StringBuilder str = new StringBuilder(); str.Append("Oiae_Type='收入' " + PublicCodeClasses.GetDateTime("convert(datetime,Oiae_IEDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0)); if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null) { str.Append(" and Oiae_PaymentMethod='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); } DataTable dt = WagesSetBll.GetOtherIncomeSum(str.ToString()).Tables[0]; if (!string.IsNullOrEmpty(dt.Rows[0]["Oiae_Money"].ToString())) { sum = Convert.ToDecimal(dt.Rows[0]["Oiae_Money"]); } return sum; } /// /// 获取会员充值金额 /// /// decimal MembersRechargeSum() { decimal sum = 0; StringBuilder str = new StringBuilder(); str.Append(PublicCodeClasses.GetDateTime("convert(datetime,Mcrr_CreateDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0, ConnectWord: "")); if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null) { str.Append(" and Mcrr_PaymentMethod='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); } DataTable dt = WagesSetBll.GetMembersRechargeSum(str.ToString()).Tables[0]; if (!string.IsNullOrEmpty(dt.Rows[0]["Mcrr_RechargeAmount"].ToString())) { sum = Convert.ToDecimal(dt.Rows[0]["Mcrr_RechargeAmount"]); } return sum; } /// /// 获取服务卡消费充值金额 /// /// decimal MemberCardPayment() { decimal sum = 0; StringBuilder str = new StringBuilder(); str.Append(PublicCodeClasses.GetDateTime("convert(datetime,创建日期)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0)); if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null) { str.Append(" and 付款方式编号='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); } DataTable dt = AllViewSetBll.GetMemberCardPaymentSum(str.ToString()).Tables[0]; if (!string.IsNullOrEmpty(dt.Rows[0]["收款金额"].ToString())) { sum = Convert.ToDecimal(dt.Rows[0]["收款金额"]); } return sum; } /// /// 现金支出金额 /// /// /// decimal ExpenditureSum() { decimal sum = 0; StringBuilder str = new StringBuilder(); str.Append(" Oiae_Type='支出' " + PublicCodeClasses.GetDateTime("convert(datetime,Oiae_IEDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0)); if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null) { str.Append("and Oiae_PaymentMethod='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); } if (cmbProjectSearch.Text != "全部" && cmbProjectSearch.Text == "店面支出") { if (!string.IsNullOrEmpty(CtvTsorder_Name.Text) && CtvTsorder_Name.Text != "全部") { str.Append("and Oiae_ProjectName='" + CtvTsorder_Name.Text.ToString() + "'"); } } DataTable dt = WagesSetBll.GetOtherIncomeSum(str.ToString()).Tables[0]; if (!string.IsNullOrEmpty(dt.Rows[0]["Oiae_Money"].ToString())) { sum = Convert.ToDecimal(dt.Rows[0]["Oiae_Money"]); } return sum; } /// /// 财务支出金额 /// /// /// decimal FinancialExpensesSum() { decimal sum = 0; StringBuilder str = new StringBuilder(); str.Append(" Oiae_Type='财务支出' " + PublicCodeClasses.GetDateTime("convert(datetime,Oiae_IEDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0)); if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null) { str.Append("and Oiae_PaymentMethod='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); } if (cmbProjectSearch.Text != "全部" && cmbProjectSearch.Text == "财务支出") { if (!string.IsNullOrEmpty(CtvTsorder_Name.Text) && CtvTsorder_Name.Text != "全部") { str.Append("and Oiae_ProjectName='" + CtvTsorder_Name.Text.ToString() + "'"); } } DataTable dt = WagesSetBll.GetOtherIncomeSum(str.ToString()).Tables[0]; if (!string.IsNullOrEmpty(dt.Rows[0]["Oiae_Money"].ToString())) { sum = Convert.ToDecimal(dt.Rows[0]["Oiae_Money"]); } return sum; } /// /// 文本框合计获取值 /// public void BindTotal() { if (cmbProjectSearch.Text == "全部") { //收入 txtTotalRevenue.Text = (TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ") + OtherIncomeSum()).ToString(); //营业收入 txtOperatingIncome.Text = (TotalRevenueSun("") + MembersRechargeSum() + MemberCardPayment()).ToString(); //总支出 txtTotalExpenditure.Text = (ExpenditureSum() + FinancialExpensesSum()).ToString(); //净收入 txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString(); } else if (cmbProjectSearch.Text == "订单前期收入") { //收入 txtTotalRevenue.Text = TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ").ToString(); //营业收入 txtOperatingIncome.Text = TotalRevenueSun("").ToString(); //总支出 txtTotalExpenditure.Text = "0"; //净收入 txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString(); } else if (cmbProjectSearch.Text == "订单后期收入") { //收入 txtTotalRevenue.Text = TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ").ToString(); //营业收入 txtOperatingIncome.Text = TotalRevenueSun("").ToString(); //总支出 txtTotalExpenditure.Text = "0"; //净收入 txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString(); } else if (cmbProjectSearch.Text == "其它消费收入") { //收入 txtTotalRevenue.Text = TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ").ToString(); //营业收入 txtOperatingIncome.Text = TotalRevenueSun("").ToString(); //总支出 txtTotalExpenditure.Text = "0"; //净收入 txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString(); } else if (cmbProjectSearch.Text == "其它收入") { //收入 txtTotalRevenue.Text = OtherIncomeSum().ToString(); //营业收入 txtOperatingIncome.Text = "0"; //总支出 txtTotalExpenditure.Text = "0"; //净收入 txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString(); } else if (cmbProjectSearch.Text == "会员充值收入") { //收入 txtTotalRevenue.Text = "0";// Convert.ToDecimal(Convert.ToDecimal(MembersRechargeSum(time))).ToString(); //营业收入 txtOperatingIncome.Text = MembersRechargeSum().ToString(); //总支出 txtTotalExpenditure.Text = "0"; //净收入 txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString(); } else if (cmbProjectSearch.Text == "服务卡消费收入") { //收入 txtTotalRevenue.Text = "0";//Convert.ToDecimal(Convert.ToDecimal(MemberCardPayment(time))).ToString(); //营业收入 txtOperatingIncome.Text = MemberCardPayment().ToString(); //总支出 txtTotalExpenditure.Text = "0"; //净收入 txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString(); } else if (cmbProjectSearch.Text == "礼服租售收入") { //收入 txtTotalRevenue.Text = TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ").ToString(); //营业收入 txtOperatingIncome.Text = TotalRevenueSun("").ToString(); //总支出 txtTotalExpenditure.Text = "0"; //净收入 txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString(); } else if (cmbProjectSearch.Text == "店面支出") { //收入 txtTotalRevenue.Text = "0"; //营业收入 txtOperatingIncome.Text = "0"; //总支出 txtTotalExpenditure.Text = ExpenditureSum().ToString(); //净收入 txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString(); } else if (cmbProjectSearch.Text == "财务支出") { //收入 txtTotalRevenue.Text = "0"; //营业收入 txtOperatingIncome.Text = "0"; //总支出 txtTotalExpenditure.Text = FinancialExpensesSum().ToString(); //净收入 txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString(); } else if (cmbProjectSearch.Text == "押金") { //收入 txtTotalRevenue.Text = "0"; //营业收入 txtOperatingIncome.Text = "0"; //总支出 txtTotalExpenditure.Text = "0"; //净收入 txtNetIncome.Text = "0"; } //订单前期 txtPreliminaryResults.Text = OrderEarly().ToString(); //订单后期 txtLateResults.Text = OrderLate().ToString(); } /// /// 项目查询 /// /// /// protected override void cmbProjectSearch_SelectedValueChanged(object sender, EventArgs e) { try { this.CtvTsorder_Name.Visible = true; this.CtvTsorder_Name.Text = ""; this.dgv.Rows.Clear(); if (this.cmbProjectSearch.Text == "全部") { this.CtvTsorder_Name.Visible = false; // 获取订单收款/其它二销/礼服租售记录 this.BindOrdersReceivables(); // 获取其它收入 this.BindOtherIncome(); // 获取会员充值 this.GetMemberCardRechargeRecord(); // 获取现金支出 this.BindCashExpenses(); //获取财务支出 this.BindFinancialExpenses(); // 服务卡消费收入 this.GetMemberCardPayment(); } else if (this.cmbProjectSearch.Text == "订单前期收入") { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView(this.CtvTsorder_Name, "预约收款,预约补款,全款", IsFirstNodeNull: true, IsFirstNodeName: "全部"); // 获取订单收款/其它二销/礼服租售记录 this.BindOrdersReceivables(); } else if (this.cmbProjectSearch.Text == "订单后期收入" || this.cmbProjectSearch.Text == "其它消费收入") { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEBACDAJDFDDEACGJ", this.CtvTsorder_Name, IsFirstNodeNull: true, IsFirstNodeName: "全部", StrWhere: "Sc_ClassCode!='BEBCADBFBCDFBGJHC' and Sc_ClassCode!='BEBCADBFBDDEGGABF' and Sc_ClassCode!='BEBCBFBICGDHCGBEJ' and Sc_ClassCode!='BEBCABBAAICBDHDHI' and Sc_ClassCode!='BEBCABBAAICJAAGDG' and Sc_ClassCode!='BEBCBFBICFCECBHFF'"); // 获取订单收款/其它二销/礼服租售记录 this.BindOrdersReceivables(); } else if (this.cmbProjectSearch.Text == "其它收入") { this.CtvTsorder_Name.Visible = false; // 获取其它收入 this.BindOtherIncome(); } else if (this.cmbProjectSearch.Text == "会员充值收入") { this.CtvTsorder_Name.Visible = false; // 获取会员充值 this.GetMemberCardRechargeRecord(); } else if (this.cmbProjectSearch.Text == "服务卡消费收入") { this.CtvTsorder_Name.Visible = false; // 服务卡消费收入 this.GetMemberCardPayment(); } else if (this.cmbProjectSearch.Text == "礼服租售收入") { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView(this.CtvTsorder_Name, "礼服出租,礼服出售", IsFirstNodeNull: true, IsFirstNodeName: "全部"); // 获取订单收款/其它二销/礼服租售记录 BindOrdersReceivables(); } else if (this.cmbProjectSearch.Text == "店面支出") { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEBACIAFBEDIGJJFE", this.CtvTsorder_Name, IsFirstNodeNull: true, IsFirstNodeName: "全部"); // 获取现金支出 this.BindCashExpenses(); } else if (this.cmbProjectSearch.Text == "财务支出") { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BFAGBGBAEJBACEEHJ", this.CtvTsorder_Name, IsFirstNodeNull: true, IsFirstNodeName: "全部"); // 获取现金支出 this.BindFinancialExpenses(); } //获取文本框金额 this.BindTotal(); } catch (Exception ex) { MessageBoxCustom.Show(ex.Message); } } /// /// 项目名称 /// /// /// protected override void CtvTsorder_Name_ComboBoxTreeViewEx_TextChanged(object sender, TreeViewEventArgs e) { this.BindSelect(); } /// /// 选择支付方式 /// /// /// protected override void cmbPay_PaymentMethod_ComboBoxTreeViewEx_TextChanged(object sender, TreeViewEventArgs e) { this.BindSelect(); } /// /// 打印 /// /// /// protected override void btnPrint_Click(object sender, EventArgs e) { try { string StrDateWeek = this.StrDateStart + " — " + this.StrDateEnd; //string StrDateWeek = this.StrDateStart + " — " + this.StrDateEnd + "(" + LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.CaculateWeekDay(Convert.ToDateTime(time).DayOfWeek.ToString()) + ")"; object StrText = null; Hashtable htData = new Hashtable(); htData["dgvData"] = this.dgv; htData["StrText"] = StrText; htData["StrDateWeek"] = StrDateWeek; LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(EnumPublic.PrintTypeEnum.财务报表日, htData); } catch (Exception ex) { MessageBoxCustom.Show(ex.Message); } } /// /// 财务审核 /// /// /// protected override void btnFinancialAudit_Click(object sender, EventArgs e) { try { if (this.dgv.SelectedRows.Count == 0) { MessageBoxCustom.Show("请选择你要审核的数据!"); return; } if (cmbProjectSearch.Text == "押金") { MessageBoxCustom.Show("此订单无需审核!"); return; } if (this.dgv.SelectedRows.Count > 10) { MessageBoxCustom.Show("最多只能选择10条审核!"); return; } string strValue = ""; if (MessageBoxCustom.Show("此单审核是否通过?", "审核提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { strValue = "已审核"; } else { strValue = "审核不通过"; } List clist = new List(); for (int i = 0; i < this.dgv.SelectedRows.Count; i++) { string ItemCategory = this.dgv.SelectedRows[i].Cells["ItemCategory"].Value.ToString(); string ID = this.dgv.SelectedRows[i].Cells["ID"].Value.ToString(); if (ItemCategory == "固定费用" || ItemCategory == "其它收入") { LYFZ.Model.Model_ErpOtherIncomeAndExpenses mode = oiebll.GetModel(Convert.ToInt32(ID)); mode.Oiae_FinancialAuditPeople = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; mode.Oiae_FinancialAuditState = strValue; clist.Add(oiebll.GetUpdateCommandInfo(mode)); } else if (ItemCategory == "会员充值") { LYFZ.Model.Model_ErpMemberCardRechargeRecord mode = mcrrbll.GetModel(Convert.ToInt32(ID)); mode.Mcrr_FinancialAuditName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; mode.Mcrr_FinancialAudit = strValue; clist.Add(mcrrbll.GetUpdateCommandInfo(mode)); } else if (ItemCategory == "服务消费") { LYFZ.Model.Model_ErpMemberCardPayment mode = mcptbll.GetModel(Convert.ToInt32(ID)); mode.Mcpt_FinancialAuditName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; mode.Mcpt_FinancialAudit = strValue; mode.Mcpt_FinancialAuditDateTime = DateTime.Now; clist.Add(mcptbll.GetUpdateCommandInfo(mode)); } else if (ItemCategory != "固定费用" && ItemCategory != "其它收入" && ItemCategory != "会员充值" && ItemCategory != "服务消费") { LYFZ.Model.Model_ErpPayment model = ptbll.GetModel(Convert.ToInt32(ID)); model.Pay_FinancialAudit = strValue; model.Pay_FinancialAuditdPeople = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; clist.Add(ptbll.GetUpdateCommandInfo(model)); } } if (clist.Count > 0) { if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0) { MessageBoxCustom.Show("审核完成!"); this.BindSelect(); } else { MessageBoxCustom.Show("审核失败!"); } } } catch (Exception ex) { MessageBoxCustom.Show(ex.Message); } } /// /// 导出 /// /// /// protected override void btnExPort_Click(object sender, EventArgs e) { this.dgv.ExportDataTable(); } /// /// 关闭 /// /// /// protected override void btnClose_Click(object sender, EventArgs e) { this.Close(); } /// /// 财务支出 /// /// /// protected override void btnFinancialExpenses_Click(object sender, EventArgs e) { try { this.txtTotalRevenue.Text = "0"; this.txtOperatingIncome.Text = "0"; this.txtNetIncome.Text = "0"; this.dgv.Rows.Clear(); //获取财务支出 this.BindFinancialExpenses(); // 获取现金支出 this.BindCashExpenses(); //总支出 DataTable dt = WagesSetBll.GetOtherIncomeSum(" Oiae_Type!='收入' " + PublicCodeClasses.GetDateTime("convert(datetime,Oiae_IEDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0)).Tables[0]; if (string.IsNullOrEmpty(dt.Rows[0]["Oiae_Money"].ToString())) { this.txtTotalExpenditure.Text = "0"; } else { this.txtTotalExpenditure.Text = dt.Rows[0]["Oiae_Money"].ToString(); } } catch (Exception ex) { MessageBoxCustom.Show(ex.Message); } } } }