123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614 |
- 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 FrmYearFinance : LYFZ.Software.UI.StatisticalInquiry.FrmYearFinance
- {
- private delegate void UpdateControl();
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_AllViewSet avsbll = new BLL.BLL_AllViewSet();
- LYFZ.BLL.BLL_ErpWagesSet wsbll = new BLL.BLL_ErpWagesSet();
- public FrmYearFinance()
- {
- }
- /// <summary>
- /// 加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void FrmYearFinance_Shown(object sender, EventArgs e)
- {
- try
- {
- //获取支付方式
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEBACCAFCCEAGAIHH", this.cmbPay_PaymentMethod, IsFirstNodeNull: true);
- // 导出
- this.btnExPort.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.YearFinanceCompetence, CustomAttributes.OperatingAuthority.DataExport);
- // 打印
- this.btnPrint.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.YearFinanceCompetence, CustomAttributes.OperatingAuthority.Print);
- // 财务支出
- if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DayFinanceCompetence, CustomAttributes.OperatingAuthority.FinancialExpenses))
- { this.cmbProjectSearch.Items.RemoveAt(8); }
- this.numYear.Value = SDateTime.Now.Year;
- this.cmbProjectSearch.SelectedIndex = 0;
- }
- catch (Exception ex)
- { MessageBoxCustom.Show(ex.Message); }
- }
- /// <summary>
- /// 获取每月绑定报表
- /// </summary>
- public void Bind()
- {
- this.dgvMonth.Rows.Clear();
- string time = this.numYear.Value.ToString();
- #region 获取月报表
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- DataTable dt = avsbll.Vw_YearReport("convert(varchar,Pay_CreateDatetimes,120) like '%" + time + "%'").Tables[0];
- if (dt.Rows.Count > 0)
- {
- this.Invoke(new UpdateControl(delegate()
- {
- #region
- for (int t = 0; t < dt.Rows.Count; t++)
- {
- //订单收入
- decimal DayOrdersIncome = dt.Rows[t]["DayOrdersIncome"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayOrdersIncome"]);
- //补款收入
- decimal DayReplenishmentIncome = dt.Rows[t]["DayReplenishmentIncome"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayReplenishmentIncome"]);
- //后期收入
- decimal DayLateStageIncome = dt.Rows[t]["DayLateStageIncome"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayLateStageIncome"]);
- //其它收入
- decimal DayOtherIncome = dt.Rows[t]["DayOtherIncome"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayOtherIncome"]);
- //会员充值
- decimal DayMemberIncome = dt.Rows[t]["DayMemberIncome"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayMemberIncome"]);
- //服务卡充值
- decimal DayMemberCardPaymentIncome = dt.Rows[t]["DayMemberCardPaymentIncome"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayMemberCardPaymentIncome"]);
- //前期业绩
- decimal DayEarlyPerformance = dt.Rows[t]["DayEarlyPerformance"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayEarlyPerformance"]);
- //后期业绩(加挑商品+其它消费)
- //加挑商品
- decimal DayPluslatepickPerformance = dt.Rows[t]["DayPluslatepickPerformance"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayPluslatepickPerformance"]);
- decimal DayOtherPerformance = dt.Rows[t]["DayOtherPerformance"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayOtherPerformance"]);
- //总店面支出
- decimal DayExpenditure = dt.Rows[t]["DayExpenditure"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayExpenditure"]);
- //总支出
- decimal DayExpenditure2 = dt.Rows[t]["DayExpenditure2"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayExpenditure2"]);
- #region 获取月报表
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewCell cell = null;
- //日期
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[t]["Pay_CreateDatetimes"].ToString();
- dgvr.Cells.Add(cell);
- //总收入
- cell = new DataGridViewTextBoxCell();
- cell.Value = (DayOrdersIncome + DayReplenishmentIncome + DayLateStageIncome + DayOtherIncome + DayMemberIncome + DayMemberCardPaymentIncome);
- dgvr.Cells.Add(cell);
- //订单收入
- cell = new DataGridViewTextBoxCell();
- cell.Value = DayOrdersIncome;
- dgvr.Cells.Add(cell);
- //补款收入
- cell = new DataGridViewTextBoxCell();
- cell.Value = DayReplenishmentIncome;
- dgvr.Cells.Add(cell);
- //日后期收入
- cell = new DataGridViewTextBoxCell();
- cell.Value = DayLateStageIncome;
- dgvr.Cells.Add(cell);
- //其它收入
- cell = new DataGridViewTextBoxCell();
- cell.Value = DayOtherIncome;
- dgvr.Cells.Add(cell);
- //会员充值
- cell = new DataGridViewTextBoxCell();
- cell.Value = DayMemberIncome;
- dgvr.Cells.Add(cell);
- //服务卡充值
- cell = new DataGridViewTextBoxCell();
- cell.Value = DayMemberCardPaymentIncome;
- dgvr.Cells.Add(cell);
- //前期业绩
- cell = new DataGridViewTextBoxCell();
- cell.Value = DayEarlyPerformance;
- dgvr.Cells.Add(cell);
- //日后期业绩
- cell = new DataGridViewTextBoxCell();
- cell.Value = (DayPluslatepickPerformance + DayOtherPerformance);
- dgvr.Cells.Add(cell);
- //总业绩
- cell = new DataGridViewTextBoxCell();
- cell.Value = (DayEarlyPerformance + DayPluslatepickPerformance + DayOtherPerformance);
- dgvr.Cells.Add(cell);
- //总支出
- cell = new DataGridViewTextBoxCell();
- cell.Value = (DayExpenditure + DayExpenditure2);
- dgvr.Cells.Add(cell);
- this.dgvMonth.Rows.Add(dgvr);
- #endregion
- }
- dgvMonth.ClearSelection();
- #endregion
- }));
- }
- });
- #endregion
- }
- /// <summary>
- /// 获取订单前期
- /// </summary>
- /// <param name="time"></param>
- /// <returns></returns>
- decimal OrderEarly()
- {
- decimal sum = 0;
- DataTable dt = wsbll.GetTwoPieSum(" convert(varchar,Pay_CreateDatetime,120) like '%" + this.numYear.Value + "%' 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;
- }
- /// <summary>
- /// 获取订单后期
- /// </summary>
- /// <param name="time"></param>
- /// <returns></returns>
- decimal OrderLate()
- {
- decimal sum = 0;
- DataTable dt = wsbll.GetTwoPieSum("convert(varchar,Pay_CreateDatetime,120) like '%" + this.numYear.Value + "%' 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;
- }
- /// <summary>
- /// 获取收款记录金额
- /// </summary>
- /// <param name="time"></param>
- /// <param name="Symbol"></param>
- /// <returns></returns>
- decimal TotalRevenueSun(string Symbol)
- {
- decimal sum = 0;
- StringBuilder str = new StringBuilder();
- str.Append("" + Symbol + " convert(varchar,Pay_CreateDatetime,120) like '%" + this.numYear.Value + "%' ");
- if (!string.IsNullOrEmpty(this.cmbPay_PaymentMethod.Text) && this.cmbPay_PaymentMethod.Tag != null)
- { str.Append(" and Pay_PaymentMethod='" + this.cmbPay_PaymentMethod.Tag.ToString() + "'"); }
- if (this.cmbProjectSearch.Text != "全部")
- {
- if (this.cmbProjectSearch.Text == "订单前期收入")
- {
- if (string.IsNullOrEmpty(this.CtvTsorder_Name.Text) || this.CtvTsorder_Name.Text == "全部")
- { str.Append(" and Pay_Category!='后期收款'"); }
- else
- { str.Append(" and Pay_Category='" + this.CtvTsorder_Name.Text.ToString() + "'"); }
- }
- else if (this.cmbProjectSearch.Text == "订单后期收入")
- {
- if (string.IsNullOrEmpty(this.CtvTsorder_Name.Text) || this.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='" + this.CtvTsorder_Name.Tag.ToString() + "'"); }
- }
- else if (this.cmbProjectSearch.Text == "其它消费收入")
- {
- if (string.IsNullOrEmpty(this.CtvTsorder_Name.Text) || this.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='" + this.CtvTsorder_Name.Tag.ToString() + "'"); }
- }
- else if (this.cmbProjectSearch.Text == "礼服租售收入")
- {
- if (string.IsNullOrEmpty(this.CtvTsorder_Name.Text) || this.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='" + this.CtvTsorder_Name.Text.ToString() + "'"); }
- }
- }
- DataTable dt = wsbll.GetTwoPieSum(str.ToString()).Tables[0];
- if (!string.IsNullOrEmpty(dt.Rows[0]["Pay_AmountOf"].ToString()))
- { sum = Convert.ToDecimal(dt.Rows[0]["Pay_AmountOf"]); }
- return sum;
- }
- /// <summary>
- /// 获取其它收入金额
- /// </summary>
- /// <param name="Time"></param>
- /// <returns></returns>
- decimal OtherIncomeSum()
- {
- decimal sum = 0;
- StringBuilder str = new StringBuilder();
- str.Append("Oiae_Type='收入' and convert(varchar,Oiae_IEDatetime,120) like '%" + this.numYear.Value + "%'");
- if (!string.IsNullOrEmpty(this.cmbPay_PaymentMethod.Text) && this.cmbPay_PaymentMethod.Tag != null)
- { str.Append(" and Oiae_PaymentMethod='" + this.cmbPay_PaymentMethod.Tag.ToString() + "'"); }
- DataTable dt = wsbll.GetOtherIncomeSum(str.ToString()).Tables[0];
- if (!string.IsNullOrEmpty(dt.Rows[0]["Oiae_Money"].ToString()))
- { sum = Convert.ToDecimal(dt.Rows[0]["Oiae_Money"]); }
- return sum;
- }
- /// <summary>
- /// 获取会员充值金额
- /// </summary>
- /// <param name="Time"></param>
- /// <returns></returns>
- decimal MembersRechargeSum()
- {
- decimal sum = 0;
- StringBuilder str = new StringBuilder();
- str.Append(" convert(varchar,Mcrr_CreateDatetime,120) like '%" + this.numYear.Value + "%' ");
- if (!string.IsNullOrEmpty(this.cmbPay_PaymentMethod.Text) && this.cmbPay_PaymentMethod.Tag != null)
- { str.Append(" and Mcrr_PaymentMethod='" + this.cmbPay_PaymentMethod.Tag.ToString() + "'"); }
- DataTable dt = wsbll.GetMembersRechargeSum(str.ToString()).Tables[0];
- if (!string.IsNullOrEmpty(dt.Rows[0]["Mcrr_RechargeAmount"].ToString()))
- { sum = Convert.ToDecimal(dt.Rows[0]["Mcrr_RechargeAmount"]); }
- return sum;
- }
- /// <summary>
- /// 获取服务卡消费充值金额
- /// </summary>
- /// <param name="Time"></param>
- /// <returns></returns>
- decimal MemberCardPayment()
- {
- LYFZ.BLL.BLL_AllViewSet AllViewSetBll = new BLL.BLL_AllViewSet();
- decimal sum = 0;
- StringBuilder str = new StringBuilder();
- str.Append(" and convert(varchar,创建日期,120) like '%" + this.numYear.Value + "%' ");
- if (!string.IsNullOrEmpty(this.cmbPay_PaymentMethod.Text) && this.cmbPay_PaymentMethod.Tag != null)
- { str.Append(" and 付款方式编号='" + this.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;
- }
- /// <summary>
- /// 现金支出金额
- /// </summary>
- /// <param name="Time"></param>
- /// <returns></returns>
- decimal ExpenditureSum()
- {
- decimal sum = 0;
- StringBuilder str = new StringBuilder();
- str.Append(" Oiae_Type='支出' and convert(varchar,Oiae_IEDatetime,120) like '%" + this.numYear.Value + "%' ");
- if (!string.IsNullOrEmpty(this.cmbPay_PaymentMethod.Text) && this.cmbPay_PaymentMethod.Tag != null)
- { str.Append("and Oiae_PaymentMethod='" + this.cmbPay_PaymentMethod.Tag.ToString() + "'"); }
- if (this.cmbProjectSearch.Text != "全部" && this.cmbProjectSearch.Text == "店面支出")
- {
- if (!string.IsNullOrEmpty(this.CtvTsorder_Name.Text) && this.CtvTsorder_Name.Text != "全部")
- { str.Append("and Oiae_ProjectName='" + this.CtvTsorder_Name.Text.ToString() + "'"); }
- }
- DataTable dt = wsbll.GetOtherIncomeSum(str.ToString()).Tables[0];
- if (!string.IsNullOrEmpty(dt.Rows[0]["Oiae_Money"].ToString()))
- { sum = Convert.ToDecimal(dt.Rows[0]["Oiae_Money"]); }
- return sum;
- }
- /// <summary>
- /// 财务支出金额
- /// </summary>
- /// <param name="Time"></param>
- /// <returns></returns>
- decimal FinancialExpensesSum()
- {
- decimal sum = 0;
- StringBuilder str = new StringBuilder();
- str.Append(" Oiae_Type='财务支出' and convert(varchar,Oiae_IEDatetime,120) like '%" + this.numYear.Value + "%' ");
- if (!string.IsNullOrEmpty(this.cmbPay_PaymentMethod.Text) && this.cmbPay_PaymentMethod.Tag != null)
- { str.Append("and Oiae_PaymentMethod='" + this.cmbPay_PaymentMethod.Tag.ToString() + "'"); }
- if (this.cmbProjectSearch.Text != "全部" && this.cmbProjectSearch.Text == "财务支出")
- {
- if (!string.IsNullOrEmpty(this.CtvTsorder_Name.Text) && this.CtvTsorder_Name.Text != "全部")
- { str.Append("and Oiae_ProjectName='" + this.CtvTsorder_Name.Text.ToString() + "'"); }
- }
- DataTable dt = wsbll.GetOtherIncomeSum(str.ToString()).Tables[0];
- if (!string.IsNullOrEmpty(dt.Rows[0]["Oiae_Money"].ToString()))
- { sum = Convert.ToDecimal(dt.Rows[0]["Oiae_Money"]); }
- return sum;
- }
- /// <summary>
- /// 文本框合计获取值
- /// </summary>
- public void BindTotal()
- {
- string time = this.numYear.Value.ToString();
- if (this.cmbProjectSearch.Text == "全部")
- {
- //收入
- this.txtTotalRevenue.Text = (this.TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ") + this.OtherIncomeSum()).ToString();
- //营业收入
- this.txtOperatingIncome.Text = (this.TotalRevenueSun("") + this.MembersRechargeSum() + this.MemberCardPayment()).ToString();
- //总支出
- this.txtTotalExpenditure.Text = (this.ExpenditureSum() + this.FinancialExpensesSum()).ToString();
- //净收入
- this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
- }
- else if (this.cmbProjectSearch.Text == "订单前期收入")
- {
- //收入
- this.txtTotalRevenue.Text = this.TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ").ToString();
- //营业收入
- this.txtOperatingIncome.Text = this.TotalRevenueSun("").ToString();
- //总支出
- this.txtTotalExpenditure.Text = "0";
- //净收入
- this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
- }
- else if (this.cmbProjectSearch.Text == "订单后期收入")
- {
- //收入
- this.txtTotalRevenue.Text = this.TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ").ToString();
- //营业收入
- this.txtOperatingIncome.Text = this.TotalRevenueSun("").ToString();
- //总支出
- this.txtTotalExpenditure.Text = "0";
- //净收入
- this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
- }
- else if (this.cmbProjectSearch.Text == "其它消费收入")
- {
- //收入
- this.txtTotalRevenue.Text = this.TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ").ToString();
- //营业收入
- this.txtOperatingIncome.Text = this.TotalRevenueSun("").ToString();
- //总支出
- this.txtTotalExpenditure.Text = "0";
- //净收入
- this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
- }
- else if (this.cmbProjectSearch.Text == "其它收入")
- {
- //收入
- this.txtTotalRevenue.Text = this.OtherIncomeSum().ToString();
- //营业收入
- this.txtOperatingIncome.Text = "0";
- //总支出
- this.txtTotalExpenditure.Text = "0";
- //净收入
- this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
- }
- else if (this.cmbProjectSearch.Text == "会员充值收入")
- {
- //收入
- this.txtTotalRevenue.Text = "0";// Convert.ToDecimal(Convert.ToDecimal(MembersRechargeSum(time))).ToString();
- //营业收入
- this.txtOperatingIncome.Text = this.MembersRechargeSum().ToString();
- //总支出
- this.txtTotalExpenditure.Text = "0";
- //净收入
- this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
- }
- else if (this.cmbProjectSearch.Text == "服务卡消费收入")
- {
- //收入
- this.txtTotalRevenue.Text = "0";// Convert.ToDecimal(Convert.ToDecimal(MemberCardPayment(time))).ToString();
- //营业收入
- this.txtOperatingIncome.Text = this.MemberCardPayment().ToString();
- //总支出
- this.txtTotalExpenditure.Text = "0";
- //净收入
- this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
- }
- else if (this.cmbProjectSearch.Text == "礼服租售收入")
- {
- //收入
- this.txtTotalRevenue.Text = this.TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ").ToString();
- //营业收入
- this.txtOperatingIncome.Text = this.TotalRevenueSun("").ToString();
- //总支出
- this.txtTotalExpenditure.Text = "0";
- //净收入
- this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
- }
- else if (this.cmbProjectSearch.Text == "店面支出")
- {
- //收入
- this.txtTotalRevenue.Text = "0";
- //营业收入
- this.txtOperatingIncome.Text = "0";
- //总支出
- this.txtTotalExpenditure.Text = this.ExpenditureSum().ToString();
- //净收入
- this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
- }
- else if (this.cmbProjectSearch.Text == "财务支出")
- {
- //收入
- this.txtTotalRevenue.Text = "0";
- //营业收入
- this.txtOperatingIncome.Text = "0";
- //总支出
- this.txtTotalExpenditure.Text = this.FinancialExpensesSum().ToString();
- //净收入
- this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
- }
- else if (this.cmbProjectSearch.Text == "押金")
- {
- //收入
- this.txtTotalRevenue.Text = "0";
- //营业收入
- this.txtOperatingIncome.Text = "0";
- //总支出
- this.txtTotalExpenditure.Text = "0";
- //净收入
- this.txtNetIncome.Text = "0";
- }
- //订单前期
- this.txtPreliminaryResults.Text = this.OrderEarly().ToString();
- //订单后期
- this.txtLateResults.Text = this.OrderLate().ToString();
- }
- /// <summary>
- /// 项目查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void cmbProjectSearch_SelectedValueChanged(object sender, EventArgs e)
- {
- try
- {
- this.CtvTsorder_Name.Text = "";
- if (this.cmbProjectSearch.Text == "全部")
- { this.CtvTsorder_Name.Visible = false; }
- else if (this.cmbProjectSearch.Text == "订单前期收入")
- {
- this.CtvTsorder_Name.Visible = true;
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView(this.CtvTsorder_Name, "全部,预约收款,预约补款,全款");
- }
- else if (this.cmbProjectSearch.Text == "订单后期收入" || this.cmbProjectSearch.Text == "其它消费收入")
- {
- this.CtvTsorder_Name.Visible = true;
- 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'");
- }
- else if (this.cmbProjectSearch.Text == "其它收入")
- { this.CtvTsorder_Name.Visible = false; }
- else if (this.cmbProjectSearch.Text == "会员充值收入")
- { this.CtvTsorder_Name.Visible = false; }
- else if (this.cmbProjectSearch.Text == "服务卡消费收入")
- { this.CtvTsorder_Name.Visible = false; }
- else if (this.cmbProjectSearch.Text == "礼服租售收入")
- {
- this.CtvTsorder_Name.Visible = true;
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView(this.CtvTsorder_Name, "全部,礼服出租,礼服出售");
- }
- else if (this.cmbProjectSearch.Text == "店面支出")
- {
- this.CtvTsorder_Name.Visible = true;
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEBACIAFBEDIGJJFE", this.CtvTsorder_Name, IsFirstNodeNull: true, IsFirstNodeName: "全部");
- }
- else if (this.cmbProjectSearch.Text == "财务支出")
- {
- this.CtvTsorder_Name.Visible = true;
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BFAGBGBAEJBACEEHJ", this.CtvTsorder_Name, IsFirstNodeNull: true, IsFirstNodeName: "全部");
- }
- else if (this.cmbProjectSearch.Text == "押金")
- { this.CtvTsorder_Name.Visible = false; }
- //获取文本框金额
- this.BindTotal();
- }
- catch (Exception ex)
- { MessageBoxCustom.Show(ex.Message); }
- }
- /// <summary>
- /// 项目名称
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void CtvTsorder_Name_ComboBoxTreeViewEx_TextChanged(object sender, TreeViewEventArgs e)
- { this.BindTotal(); }
- /// <summary>
- /// 选择支付方式
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void cmbPay_PaymentMethod_ComboBoxTreeViewEx_TextChanged(object sender, TreeViewEventArgs e)
- { this.BindTotal(); }
- /// <summary>
- /// 查询年
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void numYear_ValueChanged(object sender, EventArgs e)
- {
- try
- { //获取订单数
- string strStartTime = this.numYear.Value + "-01-01";
- string strEndTime = Convert.ToDateTime(strStartTime).AddYears(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss.fff");
- string ExecuteSql = orbll.GetView_CustomReturnExecuteSql("tb_ErpOrder", StrWhere: PublicCodeClasses.GetDateTime("Ord_CreateDateTime", strStartTime, strEndTime, DateAddDays: 0, ConnectWord: ""), ShowColumnName: "Ord_Type,Ord_Class");
- DataSet dtSet = orbll.GetView_Custom(ExecuteSql);
- DataTable tbl1 = dtSet.Tables["ds"];
- DataRow[] dtRow = tbl1.Select("Ord_Type = '0'");
- DataRow[] dtRow1 = tbl1.Select("Ord_Type = '1'");
- DataRow[] dtRow2 = tbl1.Select("Ord_Type = '2'");
- DataRow[] dtRow3 = tbl1.Select("Ord_Type = '3'");
- DataRow[] dtRow4 = tbl1.Select("Ord_Type = '4'");
- DataRow[] dtRow5 = tbl1.Select("Ord_Class = '0'");
- this.lblCount.Text = "订单数: 婚纱:" + dtRow.Length + " 儿童:" + dtRow1.Length + " 写真:" + dtRow2.Length + " 服务:" + dtRow3.Length + " 婚庆:" + dtRow4.Length + " 其中意向:" + dtRow5.Length;
- this.BindTotal();
- this.Bind();
- }
- catch (Exception ex)
- { MessageBoxCustom.Show(ex.Message); }
- }
- /// <summary>
- /// 导出
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnExPort_Click(object sender, EventArgs e)
- { this.dgvMonth.ExportDataTable(); }
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnClose_Click(object sender, EventArgs e)
- { this.Close(); }
- /// <summary>
- /// 查询明细
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void dgvMonth_DoubleClick(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvMonth.SelectedRows.Count == 0)
- { MessageBoxCustom.Show("请选择你要查看的日期!"); return; }
- LYFZ.Software.MainBusiness.StatisticalInquiry.FrmMonthFinance frm = new FrmMonthFinance();
- frm.DateTimeDay = this.dgvMonth.CurrentRow.Cells["DayNumber"].Value.ToString();
- 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); }
- }
- /// <summary>
- /// 打印
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnPrint_Click(object sender, EventArgs e)
- {
- try
- {
- string StrDateWeek = this.numYear.Value.ToString().Trim() + "年";
- object StrText = "总收入:" + this.txtTotalRevenue.Text.Trim() + " 营业收入:" + this.txtOperatingIncome.Text.Trim() + " 总支出:" + this.txtTotalExpenditure.Text.Trim();
- StrText += "\r\n净收入:" + this.txtNetIncome.Text.Trim() + " 前期业绩:" + this.txtPreliminaryResults.Text.Trim() + " 后期业绩:" + this.txtLateResults.Text.Trim();
- StrText += "\r\n" + this.lblCount.Text.Trim();
- Hashtable htData = new Hashtable();
- htData["dgvData"] = this.dgvMonth;
- htData["StrText"] = StrText;
- htData["StrDateWeek"] = StrDateWeek;
- LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(EnumPublic.PrintTypeEnum.财务报表年, htData);
- }
- catch (Exception ex)
- { MessageBoxCustom.Show(ex.Message); }
- }
- }
- }
|