| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435 |
- 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";
- }
- }
|