using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Threading; using System.Collections; using System.Reflection; using CoreFS.CA06; namespace Core.StlMes.Client.Sale.UI.Balance.BalanceAccount { public partial class FrmInvoiceMonthMgt : Core.StlMes.Client.Sale.Common.FrmStyleBase.FrmUIBase { public FrmInvoiceMonthMgt() { InitializeComponent(); } DataSet dsInfo = null; private void FrmInvoiceMonthMgt_Load(object sender, EventArgs e) { this.dateTimePicker2.Format = DateTimePickerFormat.Custom; this.dateTimePicker2.CustomFormat = "yyyyMM"; this.dateTimePicker2.Value = System.DateTime.Now.AddMonths(-1); dsInfo = base.GetDataSetByColumnName(GetDataStruct(), null, GetColumnCaption()); this.ultraGrid1.DataSource = dsInfo; SetDataSet(); InitGrid(); } private void UpdateSlmBalanceInfo(string month,string saleOrg) { string sqlBa = @" update slm_balanceinfo set INVOICE_MONTH = '{0}',INVOICE_STS = '{1}' where balancestatus = '3' and trim(realinvoiceno) is not null and realinvoiceno_date > to_date('{0}', 'yyyymm') and realinvoiceno_date <= last_day(to_date('{0}', 'yyyymm')) + 1 and forecorpcode = '{2}' "; string sqlBt = @" update SLM_BALANCE_TRANSMONEY set INVOICE_MONTH = '{0}',INVOICE_STS = '{1}' where STATUS_CD = '3' and trim(REALINVOICENO) is not null and REALINVOICE_DATE > to_date('{0}', 'yyyymm') and REALINVOICE_DATE <= last_day(to_date('{0}', 'yyyymm')) + 1 and forecorpname = '{2}' "; sqlBa = string.Format(sqlBa, month, "1", saleOrg); sqlBt = string.Format(sqlBt, month, "1", saleOrg); ArrayList array = new ArrayList(); array.Add(sqlBa); array.Add(sqlBt); base.ExecuteNoReader(array); Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功"); } private void UpdateSelFundCustFundInout(string month, string saleOrg) { string sqlBa = @" update sel_fund_cust_fundinout set INVOICE_MONTH = '{0}',INVOICE_STS = '{1}' where 1= 1 and ISVALID = '1' and INOUTTIME > to_date('{0}', 'yyyymm') and INOUTTIME <= last_day(to_date('{0}', 'yyyymm')) + 1 and BALANCESUBJECT = '{2}' "; sqlBa = string.Format(sqlBa,month,"1",saleOrg); base.ExecuteNoReader(sqlBa); Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功"); } private void InitGrid() { this.ultraGrid1.DisplayLayout.Bands[0].Columns["BUTTON"].ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always; this.ultraGrid1.DisplayLayout.Bands[0].Columns["BUTTON"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Button; } private string[] GetDataStruct() { return new string[] { "INFO","SARE_ORG","BUTTON"}; } private void SetDataSet() { DataRow dr = null; dr = dsInfo.Tables[0].NewRow(); dr["INFO"] = "客户回款结转"; dr["SARE_ORG"] = base.GetSaleOrgDesc(); dr["BUTTON"] = "结转"; dsInfo.Tables[0].Rows.Add(dr); dr = dsInfo.Tables[0].NewRow(); dr["INFO"] = "客户发票结转"; dr["SARE_ORG"] = base.GetSaleOrgDesc(); dr["BUTTON"] = "结转"; dsInfo.Tables[0].Rows.Add(dr); //dr = dsInfo.Tables[0].NewRow(); //dr["INFO"] = "客户应收应付结转"; //dr["SARE_ORG"] = base.GetSaleOrgDesc(); //dr["BUTTON"] = "结转"; //dsInfo.Tables[0].Rows.Add(dr); } private Hashtable GetColumnCaption() { Hashtable hs = new Hashtable(); hs.Add("INFO","结转内容"); hs.Add("BUTTON", "操作"); hs.Add("SARE_ORG", "销售组织"); return hs; } private void ultraGrid1_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (this.dateTimePicker2.Value > System.DateTime.Now.AddDays(-System.DateTime.Now.Day ) ) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("当月不能结转"); return; } if (e.Cell.Row.Cells["INFO"].Value.ToString() == "客户发票结转") { UpdateSlmBalanceInfo(this.dateTimePicker2.Value.ToString("yyyyMM"), e.Cell.Row.Cells["SARE_ORG"].Value.ToString() ); } else if (e.Cell.Row.Cells["INFO"].Value.ToString() == "客户回款结转") { UpdateSelFundCustFundInout(this.dateTimePicker2.Value.ToString("yyyyMM"), e.Cell.Row.Cells["SARE_ORG"].Value.ToString() ); } else if (e.Cell.Row.Cells["INFO"].Value.ToString() == "客户应收应付结转") { } } } }