| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654 |
- 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.SaleFundMgt.FundUI.UIFrm
- {
- public partial class FrmFundTransfer : FrmFundBase
- {
- public FrmFundTransfer()
- {
- InitializeComponent();
- }
- private DataSet dsBuyerCode = new DataSet();
- private DataSet dsSecCode = new DataSet();
- private DataSet dsPact = new DataSet();
- private void InitDataSource()
- {
- dsBuyerCode = base.GetDataSetByColumnName(this.GetCustFundDataStruct(),
- new Hashtable(), base.GetFundColumnNameAndCaption());
- this.ultraGrid1.DataSource = dsBuyerCode;
- dsSecCode = base.GetDataSetByColumnName(this.GetSecFundDataStruct(),
- new Hashtable(), base.GetFundColumnNameAndCaption());
- this.ultraGrid2.DataSource = dsSecCode;
-
- dsPact = base.GetDataSetByColumnName(this.GetPactFundDataStruct(),
- new Hashtable(), base.GetFundColumnNameAndCaption());
- this.ultraGrid3.DataSource = dsPact;
- }
- private void ClearDs()
- {
- this.dsSecCode.Clear();
- this.dsPact.Clear();
- }
- private void SetGridValue()
- {
-
- }
- private void InitGrid()
- {
- try
- {
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["BUTTON"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Button;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["BUTTON"].ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.OnMouseEnter;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["BUTTON"].Width = 40;
-
-
- this.ultraGrid2.DisplayLayout.Bands[0].Columns["BUTTON"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Button;
- this.ultraGrid2.DisplayLayout.Bands[0].Columns["BUTTON"].ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.OnMouseEnter;
- this.ultraGrid2.DisplayLayout.Bands[0].Columns["RBUTTON"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Button;
- this.ultraGrid2.DisplayLayout.Bands[0].Columns["RBUTTON"].ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.OnMouseEnter;
- this.ultraGrid2.DisplayLayout.Bands[0].Columns["BUTTON"].Width = 40;
- this.ultraGrid2.DisplayLayout.Bands[0].Columns["RBUTTON"].Width = 40;
- this.ultraGrid3.DisplayLayout.Bands[0].Columns["BUTTON"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Button;
- this.ultraGrid3.DisplayLayout.Bands[0].Columns["BUTTON"].ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.OnMouseEnter;
- this.ultraGrid3.DisplayLayout.Bands[0].Columns["BUTTON"].Width = 40;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["RMONEY"].Width = 70;
- this.ultraGrid2.DisplayLayout.Bands[0].Columns["RMONEY"].Width = 70;
- this.ultraGrid2.DisplayLayout.Bands[0].Columns["LMONEY"].Width = 70;
- this.ultraGrid3.DisplayLayout.Bands[0].Columns["LMONEY"].Width = 70;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["RMONEY"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["RMONEY"].CellAppearance.BackColor = base.GetEditColor();
- this.ultraGrid2.DisplayLayout.Bands[0].Columns["RMONEY"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
- this.ultraGrid2.DisplayLayout.Bands[0].Columns["RMONEY"].CellAppearance.BackColor = base.GetEditColor();
- this.ultraGrid2.DisplayLayout.Bands[0].Columns["LMONEY"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
- this.ultraGrid2.DisplayLayout.Bands[0].Columns["LMONEY"].CellAppearance.BackColor = base.GetEditColor();
- this.ultraGrid3.DisplayLayout.Bands[0].Columns["LMONEY"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
- this.ultraGrid3.DisplayLayout.Bands[0].Columns["LMONEY"].CellAppearance.BackColor = base.GetEditColor();
-
- }
- catch
- { }
- }
- protected override List<string> GetNumberColumn()
- {
- return new List<string>(new string[] { "RMONEY", "LMONEY" });
- }
- private void FrmFundTransfer_Load(object sender, EventArgs e)
- {
- InitDataSource();
-
- HIddenColumn();
- base.SetGridStyle(ref this.ultraGrid1, ref this.ultraGrid3, ref this.ultraGrid2);
- InitGrid();
- }
- private void HIddenColumn()
- {
- try
- {
- this.ultraGrid1.DisplayLayout.Bands[0].Columns[base._columnBalanceSubject].Hidden = true;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns[base._columnBuyercode].Hidden = true;
- this.ultraGrid2.DisplayLayout.Bands[0].Columns[base._columnBalanceSubject].Hidden = true;
- this.ultraGrid2.DisplayLayout.Bands[0].Columns[base._columnBuyercode].Hidden = true;
- this.ultraGrid3.DisplayLayout.Bands[0].Columns[base._columnBalanceSubject].Hidden = true;
- this.ultraGrid3.DisplayLayout.Bands[0].Columns[base._columnBuyercode].Hidden = true;
- this.ultraGrid3.DisplayLayout.Bands[0].Columns[base._columnSecondaccount].Hidden = true;
- }
- catch
- { }
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- if (ToolbarKey == "Query")
- {
- this.Query();
- }
- if (ToolbarKey == "Exit")
- {
- this.Close();
- }
- if (ToolbarKey == "Close")
- {
- this.Close();
- }
- }
- private string _buyercode = "";
- private void Query()
- {
- if (this._buyercode.Length == 0)
- {
- Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("请选择客户名称");
- return;
- }
- ClearDs();
- // 获取结算单位
- string balanceSubject = base.GetSaleOrgDesc();
- string buyercode = _buyercode;
- DataSet ds = base.GetInstanceCustAccount().GetCustAccountByBalanceSubjectAndBuyercode(balanceSubject, buyercode);
- Core.StlMes.Client.Sale.Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsBuyerCode, ds);
- InitText();
-
-
- }
- private void InitText()
- {
- try
- {
- foreach (DataRow dr in this.dsBuyerCode.Tables[0].Rows)
- {
- dr["BUTTON"] = ">>>";
- }
- }
- catch
- { }
- try
- {
- foreach (DataRow dr in this.dsSecCode.Tables[0].Rows)
- {
- dr["BUTTON"] = "<<<";
- dr["RBUTTON"] = ">>>";
- }
- }
- catch
- { }
- try
- {
- foreach (DataRow dr in this.dsPact.Tables[0].Rows)
- {
- dr["BUTTON"] = "<<<";
- }
- }
- catch
- { }
- }
- private void QuerySecAccount()
- {
- try
- {
- DataSet ds = null;
- Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
- string buyercode = "";
- string balancesubject = "";
- 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)
- {
- balancesubject = ugr.Cells[base._columnBalanceSubject].Value.ToString();
- buyercode = ugr.Cells[base._columnBuyercode].Value.ToString();
- }
- ds = base.GetInstanceSecondLevelAccount().GetSecondLevelAccountByBalanceAndBuyercode(balancesubject, buyercode);
- Core.StlMes.Client.Sale.Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsSecCode, ds);
- InitText();
- // Util.UltraGridUtil.SetStaticsInfoSum(ref this.ultraGrid2, this.TotalColumn(), true);
- // HiddenGrid2();
- }
- catch
- {
- }
-
- }
- private void QueryPactAccount()
- {
- try
- {
- DataSet ds = null;
- Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
- string buyercode = "";
- string balancesubject = "";
- string secondAccount = "";
- if (this.ultraGrid2.Rows.Count == 0)
- {
- return;
- }
- if (this.ultraGrid2.Rows.Count == 1)
- {
- ugr = this.ultraGrid2.Rows[0];
- }
- else
- {
- ugr = this.ultraGrid2.ActiveRow;
- }
- if (ugr != null)
- {
- balancesubject = ugr.Cells[base._columnBalanceSubject].Value.ToString();
- buyercode = ugr.Cells[base._columnBuyercode].Value.ToString();
- secondAccount = ugr.Cells[base._columnSecondaccount].Value.ToString();
- }
- ds = base.GetInstancePactAccount().GetFundPactAccountByBalanceAndBuyercodeAndSecondAccount(balancesubject, buyercode, secondAccount);
- Core.StlMes.Client.Sale.Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsPact, ds);
- InitText();
-
- }
- catch
- {
- }
- }
-
- /// <summary>
- /// 从合同账户调拨资金到二级账户
- /// </summary>
- private void TransferMoneyPactToSecond()
- {
- try
- {
- string errMsg = "";
- Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
- if (this.ultraGrid3.Rows.Count == 0)
- return;
- if (this.ultraGrid3.Rows.Count == 1)
- ugr = this.ultraGrid3.Rows[0];
- else
- ugr = this.ultraGrid3.ActiveRow;
- if (ugr == null)
- return;
- double money = Core.StlMes.Client.Sale.Util.ConverObject.ConvertToDouble(ugr.Cells["LMONEY"].Value);
- Model.SEL_FUND_TRANS_PACT sceact = GetTransPactAccount(money);
- if (sceact == null)
- return;
- base.GetInstanceTransfer().TransferMoneyPactToSecondAccount(sceact, out errMsg);
- if (errMsg.Length == 0)
- {
- MessageBox.Show(base._successMsg);
- }
- else
- {
- MessageBox.Show(errMsg);
- }
- }
- catch
- {
- }
- }
- private void TransferMoneySecondToPact()
- {
- try
- {
- string errMsg = "";
- Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
- if (this.ultraGrid2.Rows.Count == 0)
- return;
- if (this.ultraGrid2.Rows.Count == 1)
- ugr = this.ultraGrid2.Rows[0];
- else
- ugr = this.ultraGrid2.ActiveRow;
- if (ugr == null)
- return;
- double money = Core.StlMes.Client.Sale.Util.ConverObject.ConvertToDouble(ugr.Cells["RMONEY"].Value);
- Model.SEL_FUND_TRANS_PACT sceact = GetTransPactAccount(money);
- if (sceact == null)
- return;
- base.GetInstanceTransfer().TransferMoneySecondAccountToPact(sceact, out errMsg);
- if (errMsg.Length == 0)
- {
- Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips(base._successMsg);
- }
- else
- {
- Core.StlMes.Client.Sale.Util.MessageUtil.ShowError(errMsg);
- }
- }
- catch
- {
- }
- }
- private void TransferMoneyCustToSecond()
- {
- 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)
- return;
- double money = Core.StlMes.Client.Sale.Util.ConverObject.ConvertToDouble( ugr.Cells["RMONEY"].Value);
- string errMsg = "";
- Model.SEL_FUND_TRANS_SECONDACCOUNT sceact = GetTransSecAccount(money);
- if (sceact == null)
- return;
- base.GetInstanceTransfer().TransferMoneyCustToSecondAccount(sceact, out errMsg);
- if (errMsg.Length == 0)
- {
- MessageBox.Show(base._successMsg);
- }
- else
- {
- MessageBox.Show(errMsg);
- }
- }
- catch
- {
- }
- }
- private void TransferMoneySecondToCust()
- {
- try
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
- if (this.ultraGrid2.Rows.Count == 0)
- return;
- if (this.ultraGrid2.Rows.Count == 1)
- ugr = this.ultraGrid2.Rows[0];
- else
- ugr = this.ultraGrid2.ActiveRow;
- if (ugr == null)
- return;
- double money = Core.StlMes.Client.Sale.Util.ConverObject.ConvertToDouble(ugr.Cells["LMONEY"].Value);
- string errMsg = "";
- Model.SEL_FUND_TRANS_SECONDACCOUNT sceact = GetTransSecAccount(money);
- if (sceact == null)
- return;
- base.GetInstanceTransfer().TransferMoneySecondAccountToCust(sceact, out errMsg);
- if (errMsg.Length == 0)
- {
- MessageBox.Show(base._successMsg);
- }
- else
- {
- MessageBox.Show(errMsg);
- }
- }
- catch
- {
- }
- }
- private Model.SEL_FUND_TRANS_PACT GetTransPactAccount(double money)
- {
- Model.SEL_FUND_TRANS_SECONDACCOUNT secact = GetTransSecAccount(money);
- Model.SEL_FUND_TRANS_PACT pact = new Model.SEL_FUND_TRANS_PACT();
- if (secact == null)
- return null;
- if (this.ultraGrid3.Rows.Count == 0)
- return null;
- if (this.ultraGrid2.ActiveRow == null)
- return null;
- if (this.ultraGrid3.ActiveRow == null)
- return null;
- string pactno = this.ultraGrid3.ActiveRow.Cells[base._columnPactno].Value.ToString();
-
-
- if (money <= 0)
- return null;
- pact.FUND_TRANS_SECONDACCOUNT = secact;
- pact.PACTNO = pactno;
- pact.TRANS_MONEY = money;
- return pact;
- }
- private Model.SEL_FUND_TRANS_SECONDACCOUNT GetTransSecAccount(double money)
- {
- Model.SEL_FUND_TRANS_CUST cust = GetTransCustAccount(money);
- if (cust == null)
- return null;
- if (this.ultraGrid1.Rows.Count == 0)
- return null;
- if (this.ultraGrid2.ActiveRow == null)
- return null;
- string secondLevelAccount = this.ultraGrid2.ActiveRow.Cells[base._columnSecondaccount].Value.ToString();
-
- if (money <= 0)
- return null;
- Model.SEL_FUND_TRANS_SECONDACCOUNT sec = new Model.SEL_FUND_TRANS_SECONDACCOUNT();
- sec.FUND_TRANS_CUST = cust;
- sec.SECONDACCOUNT = secondLevelAccount;
- sec.TRANS_MONEY = money;
- return sec;
- }
- private Model.SEL_FUND_TRANS_CUST GetTransCustAccount(double money)
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow ugrLeft = null;
- Infragistics.Win.UltraWinGrid.UltraGridRow ugrRight = null;
- string balancesubject = "";
- string buyercode = "";
- string secondLevelAccount = "";
- if (this.ultraGrid1.ActiveRow == null)
- return null;
- if (this.ultraGrid1.ActiveRow == null)
- return null;
- ugrLeft = this.ultraGrid1.ActiveRow;
- ugrRight = this.ultraGrid2.ActiveRow;
- // money = Convert.ToDouble(this.ultraNumericEditor1.Value);
-
- if (money <= 0)
- return null;
- balancesubject = ugrLeft.Cells[base._columnBalanceSubject].Value.ToString();
- buyercode = ugrLeft.Cells[base._columnBuyercode].Value.ToString();
- secondLevelAccount = ugrRight.Cells[base._columnSecondaccount].Value.ToString();
- Model.SEL_FUND_TRANS_CUST cust = new Model.SEL_FUND_TRANS_CUST();
- cust.BALANCESUBJECT = balancesubject;
- cust.BUYERCODE = buyercode;
- cust.TRANS_MONEY = money;
- cust.TRANS_PERSON = base.GetUserName();
- cust.TRANS_TIME = Util.DateTimeUtil.GetSystemDate();
- return cust;
- }
- protected override Hashtable GetDataSetColumnCaption()
- {
- Hashtable hs = new Hashtable();
- hs.Add("RMONEY", "金额");
- hs.Add("LMONEY", "金额");
- hs.Add("BUTTON", "");
- hs.Add("RBUTTON", "");
-
- return hs;
- }
- protected override Hashtable ColumnNameAndWidht()
- {
- Hashtable hs = new Hashtable();
- hs.Add("RMONEY", "80");
- hs.Add("LMONEY", "80");
-
- return hs;
- }
- protected override Hashtable GetGridColumnLength()
- {
- Hashtable hs = new Hashtable();
- hs.Add("BUYERCODE",100);
- hs.Add("TOTALMONEY", 80);
- hs.Add("LEAVEMONEY", 80);
- hs.Add("SECONDACCOUNT", 100);
- hs.Add("PACTNO", 100);
- return hs;
- }
-
- private string[] GetCustFundDataStruct()
- {
- return new string[]
- {
- "BALANCESUBJECT",
- "BUYERCODE",
- "TOTALMONEY",
- "LEAVEMONEY",
- "RMONEY",
- "BUTTON"
- };
- }
- private string[] GetSecFundDataStruct()
- {
- return new string[]
- {
- "BALANCESUBJECT",
- "BUYERCODE",
- "BUTTON",
- "LMONEY",
- "SECONDACCOUNT",
- "TOTALMONEY",
- "LEAVEMONEY",
- "RMONEY",
- "RBUTTON"
- };
- }
- private string[] GetPactFundDataStruct()
- {
- return new string[]
- {
- "BALANCESUBJECT",
- "BUYERCODE",
- "SECONDACCOUNT",
- "BUTTON",
- "LMONEY",
- "PACTNO",
- "TOTALMONEY",
- "LEAVEMONEY"
- };
- }
- 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;
- }
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- QuerySecAccount();
- }
- private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
- {
- QueryPactAccount();
- }
- private void ultraGrid1_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
- {
- if (e.Cell.Column.Key == "BUTTON")
- {
- this.TransferMoneyCustToSecond();
- this.Query();
- }
- }
- private void ultraGrid2_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
- {
- if (e.Cell.Column.Key == "BUTTON")
- {
- this.TransferMoneySecondToCust();
- this.Query();
- }
- if (e.Cell.Column.Key == "RBUTTON")
- {
- this.TransferMoneySecondToPact();
- this.QuerySecAccount();
- }
- }
- private void ultraGrid3_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
- {
- if (e.Cell.Column.Key == "BUTTON")
- {
- this.TransferMoneyPactToSecond();
- this.QuerySecAccount();
- }
- }
- }
- }
|