using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Infragistics.Win.UltraWinGrid; namespace Core.StlMes.Client.Sale.SaleFundMgt.FundUI.UIFrm { public partial class FrmFundInOutQuery : FrmFundBase { public FrmFundInOutQuery() { InitializeComponent(); } private DataSet dsMain = new DataSet(); private DataSet dsDetail = new DataSet(); private string _buyercode = ""; private string _buyercodeNotChooseInfo = "未选择客户名称"; FundBLL.ValueList.PubValueList PubValueList = null; private Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Fund.FundBll fundBll = null; private string _busiseq = ""; private System.Collections.Hashtable _hsDept = null; private void FrmFundInOutQuery_Load(object sender, EventArgs e) { this.checkBox1.Checked = true; this.dateTimePicker2.Value = System.DateTime.Now.AddDays(-System.DateTime.Now.Day+1); fundBll = new Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Fund.FundBll(this.ob); PubValueList = new Core.StlMes.Client.Sale.SaleFundMgt.FundBLL.ValueList.PubValueList(this.ob); dsDetail = base.GetDataSetByColumnName(GetTbColumn_SEL_FUND_CUST_FUNDINOUT(), new System.Collections.Hashtable(), base.GetFundColumnNameAndCaption()); this.ultraGrid1.DataSource = dsDetail; Init(); base.SetGridStyle(ref this.ultraGrid1); _hsDept = this.GetDeptIdAndSaleArea(); this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.BUSISEQ].Width = 110; } private void SetForeColor() { try { foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugrs in this.ultraGrid1.Rows) { if (ugrs.Cells[this.ISVALID].Value.ToString() == "0") ugrs.Appearance.ForeColor = Color.Red; } } catch { } } private void Init() { try { this.ultraGrid1.DisplayLayout.Bands[0].Columns["BUYERCODE"].ValueList = PubValueList.GetCustomerInfo(); this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.PREBUYERCODE].ValueList = PubValueList.GetCustomerInfo(); this.ultraGrid1.DisplayLayout.Bands[0].Columns["ISVALID"].ValueList = GetIsValid(); this.ultraGrid1.DisplayLayout.Bands[0].Columns["MONEY_DELIVER"].ValueList = GetMoneyDel(); } catch { } //this.ultraGrid1.DisplayLayout.Bands[0].Columns["BUYERCODE"].MergedCellStyle = Infragistics.Win.UltraWinGrid.MergedCellStyle.Always; //this.ultraGrid1.DisplayLayout.Bands[0].Columns["SECONDACCOUNT"].MergedCellStyle = Infragistics.Win.UltraWinGrid.MergedCellStyle.Always; //this.ultraGrid1.DisplayLayout.Bands[0].Columns["BALANCESUBJECT"].MergedCellStyle = Infragistics.Win.UltraWinGrid.MergedCellStyle.Always; } public override void ToolBar_Click(object sender, string ToolbarKey) { if (ToolbarKey == "Query") { this.Query(); } if (ToolbarKey == "Close") { this.Close(); } if (ToolbarKey == "Export") { Core.StlMes.Client.Sale.Util.UtilUltraGrid.ExportGridDataToExcel("回款记录", this.ultraGrid1); } if (ToolbarKey == "Affrim") { this.Affrim(); } if (ToolbarKey == "UnAffrim") { this.UnAffrim(); } } private void UnAffrim() { try { Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null; if (this.ultraGrid1.Rows.Count == 0) return; if (this.ultraGrid1.Rows.Count == 1) ugr = this.ultraGrid1.Rows[0]; else ugr = this.ultraGrid1.ActiveRow; if (ugr == null) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError(" 请选择需要撤销审核的行 "); return; } if (ugr.Cells[this.ISVALID].Value.ToString() == "0") { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError(" 未审核状态,不需要撤销 "); return; } string busiseq = ugr.Cells[BUSISEQ].Value.ToString(); string balnacesub = ugr.Cells[BALANCESUBJECT].Value.ToString(); string buyercode = ugr.Cells[BUYERCODE].Value.ToString(); string fundtype = ugr.Cells[FUNDTYPE].Value.ToString(); string billno = ""; double money = -Core.StlMes.Client.Sale.Util.ConverObject.ConvertToDouble(ugr.Cells[INOUTMONEY].Value); string import = base.GetUserName(); string importtime = ""; string inouttime = ""; string remark = ""; string orderno = ""; double leavemny = 0; string seccount = ugr.Cells[SECONDACCOUNT].Value.ToString(); string err = ""; _busiseq = busiseq; base.GetIInstanceCustInout().UnAffrimFundRecord(busiseq, balnacesub, buyercode, fundtype, billno, money, import, importtime, inouttime, remark,orderno, leavemny, seccount, out err); if (err.Length == 0) { this.Query(); // this.QueryInOutDetail(); Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips(base._MessageSuccess); } else { // Core.StlMes.Client.Sale.Util.MessageUtil.ShowError(err); } } catch { } } private void Affrim() { try { Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null; if (this.ultraGrid1.Rows.Count == 0) return; if (this.ultraGrid1.Rows.Count == 1) ugr = this.ultraGrid1.Rows[0]; else ugr = this.ultraGrid1.ActiveRow; if (ugr == null) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError(" 请选择需要确认的行 "); return; } if (ugr.Cells[this.ISVALID].Value.ToString() == "1") { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError(" 已经确认,不能重复确认 "); return; } string busiseq = ugr.Cells[BUSISEQ].Value.ToString(); string balnacesub = ugr.Cells[BALANCESUBJECT].Value.ToString(); string buyercode = ugr.Cells[BUYERCODE].Value.ToString(); string fundtype = ugr.Cells[FUNDTYPE].Value.ToString(); string billno = ""; double money = Core.StlMes.Client.Sale.Util.ConverObject.ConvertToDouble(ugr.Cells[INOUTMONEY].Value); string import = base.GetUserName(); string importtime = ""; string inouttime = ""; string remark = ""; string orderno = ""; double leavemny = 0; string seccount = ugr.Cells[SECONDACCOUNT].Value.ToString(); string err = ""; _busiseq = busiseq; base.GetIInstanceCustInout().AffrimFundRecord(busiseq, balnacesub, buyercode, fundtype, billno, money, import, importtime, inouttime, remark, orderno, leavemny, seccount, out err); if (err.Length == 0) { this.Query(); // this.QueryInOutDetail(); Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips(base._MessageSuccess); } else { // Core.StlMes.Client.Sale.Util.MessageUtil.ShowError(err); } } catch { } } private void Query() { string balanceSubject = base.GetSaleOrgDesc(); string buyercode = this._buyercode; Boolean isOpenFilter = true; string begintime = this.dateTimePicker2.Value.ToString(base._dateTimeFormatYyyyMmdd); string endtime = this.dateTimePicker3.Value.ToString(base._dateTimeFormatYyyyMmdd); if (!this.checkBox1.Checked) { begintime = System.DateTime.Now.AddYears(-100).ToString(base._dateTimeFormatYyyyMmdd); endtime = System.DateTime.Now.AddYears(2).ToString(base._dateTimeFormatYyyyMmdd); } DataSet ds = null; if (buyercode.Length > 0) { ds = base.GetIInstanceCustInout().GetSelFundCustFundInOutByBalanceAndBuyercodeAndTime (balanceSubject, buyercode, begintime, endtime); } else { ds = base.GetIInstanceCustInout().GetSelFundCustFundInOutByBalanceAndTime(balanceSubject, begintime, endtime); } System.Collections.ArrayList list = new System.Collections.ArrayList(); string deptName = ""; try { list = (System.Collections.ArrayList)_hsDept[CoreFS.SA06.CoreUserInfo.UserInfo.GetDeptid()]; } catch { } if ( list != null && list.Count > 0) { if (this.CustomInfo == "1") { object[] obj = list.ToArray(); string[] s = new string[obj.Length]; for (int i = 0; i < s.Length; i++) { s[i] = obj[i].ToString(); } if (isOpenFilter) { ds = Core.StlMes.Client.Sale.Util.UtilDataSet.GetDataSetWithRowFilter(ds, "SECONDACCOUNT", s); } } } DataSet dsgm = new DataSet(); try { if (dsgm.Tables[0].Rows.Count > 0) { dsgm.Tables[0].TableName = ds.Tables[0].TableName; ds.Merge(dsgm); } } catch { } Core.StlMes.Client.Sale.Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsDetail, ds); try { foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugrs in this.ultraGrid1.Rows) { if (ugrs.Cells[this.BUSISEQ].Value.ToString() == this._busiseq) ugrs.Activated = true; break; } } catch { } SetForeColor(); } private Infragistics.Win.ValueList GetIsValid() { Infragistics.Win.ValueList lit = new Infragistics.Win.ValueList(); lit.ValueListItems.Add("0", "无效"); lit.ValueListItems.Add("1", "有效"); return lit; } private Infragistics.Win.ValueList GetMoneyDel() { Infragistics.Win.ValueList lit = new Infragistics.Win.ValueList(); lit.ValueListItems.Add("0", "无"); lit.ValueListItems.Add("1", "制造"); lit.ValueListItems.Add("2", "集团"); return lit; } private System.Collections.Hashtable GetDeptIdAndSaleArea() { System.Collections.Hashtable hs = new System.Collections.Hashtable(); try { string sql = " select * from slm_base_sale_area_typ where validflag = '1' "; DataSet ds = base.ExecuteReader(sql); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { return hs; } System.Collections.ArrayList list = null; foreach (DataRow dr in ds.Tables[0].Rows) { list = new System.Collections.ArrayList(); if (hs.ContainsKey(dr["DEPARTID"].ToString())) { list = (System.Collections.ArrayList)hs[dr["DEPARTID"].ToString()]; list.Add(dr["SALE_AREA_DESC"].ToString()); hs.Remove(dr["DEPARTID"].ToString()); hs.Add(dr["DEPARTID"].ToString(), list); } else { list.Add(dr["SALE_AREA_DESC"].ToString()); hs.Add(dr["DEPARTID"].ToString(), list); } } } catch { } return hs; } public string[] GetTbColumn_SEL_FUND_CUST_FUNDINOUT() { return new string[] { "BUSISEQ", "BALANCESUBJECT", "SECONDACCOUNT", "BUYERCODE", "INOUTMONEY", "INOUTTIME", "FUNDTYPE", "BILLNO", "ISVALID", "MONEY_DELIVER", "PREBUYERCODE", "REMARK", "ORDERNO", "IMPORTOR", "IMPORTTIME", "AFFRIMPER", "AFFRIMDATE" }; } private void button1_Click(object sender, EventArgs e) { UIDlgBox.DlgCustChoose custChoose = new Core.StlMes.Client.Sale.SaleFundMgt.FundUI.UIDlgBox.DlgCustChoose(this.ob); custChoose.CustUse = "100202"; custChoose.SaleOrg = base.GetSaleOrg(); custChoose.ShowDialog(); if (custChoose.DialogResult == DialogResult.OK) { this.textBox1.Text = custChoose.customerName; _buyercode = custChoose.customerNo; this.Query(); } } private string BALANCESUBJECT = "BALANCESUBJECT"; private string BILLNO = "BILLNO"; private string BUSISEQ = "BUSISEQ"; private string BUYERCODE = "BUYERCODE"; private string FUNDTYPE = "FUNDTYPE"; private string IMPORTOR = "IMPORTOR"; private string IMPORTTIME = "IMPORTTIME"; private string INOUTMONEY = "INOUTMONEY"; private string INOUTTIME = "INOUTTIME"; private string ISVALID = "ISVALID"; private string LEAVEMONEY = "LEAVEMONEY"; private string REMARK = "REMARK"; private string TOTALMONEY = "TOTALMONEY"; private string UPDATETIME = "UPDATETIME"; private string MONEY_DELIVER = "MONEY_DELIVER"; private string PREBUYERCODE = "PREBUYERCODE"; private string SECONDACCOUNT = "SECONDACCOUNT"; } }