12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181 |
- 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()
- {
- }
- /// <summary>
- /// 加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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 获取绑定数据(收入,营业收入,支出,财务支出,订单,补款,选片二销,其它收入,会员充值,服务卡充值,全部押金)
- /// <summary>
- /// 获取订单收款/其它二销/礼服租售记录
- /// </summary>
- 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
- }
- /// <summary>
- /// 获取其它收入
- /// </summary>
- 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
- }
- /// <summary>
- /// 获取会员充值
- /// </summary>
- 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
- }
- /// <summary>
- /// 获取服务卡消费充值
- /// </summary>
- 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
- }
- /// <summary>
- /// 获取现金支出
- /// </summary>
- 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
- }
- /// <summary>
- /// 财务支出
- /// </summary>
- 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
- /// <summary>
- /// 所以查询事件绑定
- /// </summary>
- 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();
- }
- /// <summary>
- /// 获取订单前期
- /// </summary>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 获取订单后期
- /// </summary>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 获取收款记录金额
- /// </summary>
- /// <param name="Symbol"></param>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 获取其它收入金额
- /// </summary>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 获取会员充值金额
- /// </summary>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 获取服务卡消费充值金额
- /// </summary>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 现金支出金额
- /// </summary>
- /// <param name="Time"></param>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 财务支出金额
- /// </summary>
- /// <param name="Time"></param>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 文本框合计获取值
- /// </summary>
- 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();
- }
- /// <summary>
- /// 项目查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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); }
- }
- /// <summary>
- /// 项目名称
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void CtvTsorder_Name_ComboBoxTreeViewEx_TextChanged(object sender, TreeViewEventArgs e)
- { this.BindSelect(); }
- /// <summary>
- /// 选择支付方式
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void cmbPay_PaymentMethod_ComboBoxTreeViewEx_TextChanged(object sender, TreeViewEventArgs e)
- { this.BindSelect(); }
- /// <summary>
- /// 打印
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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); }
- }
- /// <summary>
- /// 财务审核
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
- 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); }
- }
- /// <summary>
- /// 导出
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnExPort_Click(object sender, EventArgs e)
- { this.dgv.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 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); }
- }
- }
- }
|