FrmBalanceInvoceMgtOrg.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using System.Threading;
  9. using System.Collections;
  10. using System.Reflection;
  11. using CoreFS.CA06;
  12. namespace Core.StlMes.Client.Sale.UI.Balance.BalanceAccount
  13. {
  14. public partial class FrmBalanceInvoceMgtOrg : Core.StlMes.Client.Sale.Common.FrmStyleBase.FrmUIBase
  15. {
  16. public FrmBalanceInvoceMgtOrg()
  17. {
  18. InitializeComponent();
  19. }
  20. private DataSet dsInvoice = new DataSet();
  21. private DataSet dsInvoiceDetail = null;
  22. private DataSet dsInvoiceSeq = new DataSet();
  23. private DataSet dsInvoiceList = new DataSet();
  24. private void initDataSource()
  25. {
  26. dsInvoice = base.GetDataSetByColumnName(this.GetGrid1DataStruct(),
  27. null, GetColumnAndCaption());
  28. this.ultraGrid1.DataSource = dsInvoice;
  29. dsInvoiceSeq = base.GetDataSetByColumnName(this.GetGrid2DataStruct(),
  30. null, GetColumnAndCaption());
  31. this.ultraGrid2.DataSource = dsInvoiceSeq;
  32. dsInvoiceList = base.GetDataSetByColumnName(this.GetGrid3DataStruct(),
  33. null, GetColumnAndCaption());
  34. this.ultraGrid3.DataSource = dsInvoiceList;
  35. }
  36. private void HiddenColumn()
  37. {
  38. try
  39. {
  40. this.ultraGrid2.DisplayLayout.Bands[0].Columns[this.INVOICENO].Hidden = true;
  41. this.ultraGrid2.DisplayLayout.Bands[0].Columns[this.INVOICENO_SEQ].Hidden = true;
  42. this.ultraGrid1.DisplayLayout.Bands[0].Columns["REALINVOICENO"].Hidden = true;
  43. }
  44. catch
  45. { }
  46. }
  47. protected override List<string> GetNumberColumn()
  48. {
  49. return new List<string>(new string[] {
  50. "SEND_NUM",
  51. "MONEY",
  52. "WEIGHT",
  53. "QUANTITY",
  54. "ACT_WGT",
  55. "OUTSTOCKMNY",
  56. "TRANSMNY",
  57. "PRICE",
  58. "PRICE_ORG",
  59. "MONEY_ORG",
  60. });
  61. }
  62. private Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Balance.SlmBalanceInfo slmBalanceInfo = null;
  63. private void FrmBalanceInvoceMgt_Load(object sender, EventArgs e)
  64. {
  65. this.ultraExpandableGroupBox2.Visible = false;
  66. this.dateTimePicker1.Value = System.DateTime.Now.AddMonths(-1);
  67. slmBalanceInfo = new Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Balance.SlmBalanceInfo(this.ob);
  68. initDataSource();
  69. this.ultraGrid5.DataSource = base.GetDataSetByColumnName(this.GetGrid5DataStruct(),
  70. null, GetColumnAndCaption());
  71. this.ultraGrid4.DataSource = base.GetDataSetByColumnName(this.GetGrid4DataStruct(),
  72. null, GetColumnAndCaption());
  73. base.SetGridStyle(ref this.ultraGrid1,ref this.ultraGrid5,ref this.ultraGrid2,ref this.ultraGrid3,ref this.ultraGrid4);
  74. InitGrid();
  75. HiddenColumn();
  76. InitGridValue();
  77. }
  78. private void SaveRealInvoiceNo()
  79. {
  80. this.ultraGrid1.UpdateData();
  81. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
  82. if (this.ultraGrid1.Rows.Count == 0)
  83. return;
  84. ugr = this.ultraGrid1.ActiveRow;
  85. if (ugr == null)
  86. {
  87. MessageBox.Show("请选择需要保存的行");
  88. return;
  89. }
  90. string invoiceno = ugr.Cells["INVOICENO_ORG"].Value.ToString();
  91. string realInvoiceNo = ugr.Cells["REALINVOICENO_ORG"].Value.ToString();
  92. if (realInvoiceNo.Length == 0)
  93. return;
  94. if (realInvoiceNo.Length > 30)
  95. {
  96. MessageBox.Show("发票号允许最大长度30");
  97. return;
  98. }
  99. string errMsg = "";
  100. this.slmBalanceInfo.UpdateRealInvoiceNoOrg(invoiceno, realInvoiceNo, CoreFS.SA06.CoreUserInfo.UserInfo
  101. .GetUserName(), out errMsg);
  102. if (errMsg.Length == 0)
  103. {
  104. MessageBox.Show("保存成功");
  105. }
  106. }
  107. private void InitGrid()
  108. {
  109. System.Drawing.Color color = System.Drawing.Color.FromArgb(255, 255, 128);
  110. try
  111. {
  112. this.ultraGrid1.DisplayLayout.Bands[0].Columns["REALINVOICENO"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  113. this.ultraGrid1.DisplayLayout.Bands[0].Columns["REALINVOICENO"].CellAppearance.BackColor = color;
  114. this.ultraGrid1.DisplayLayout.Bands[0].Columns["REALINVOICENO_ORG"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  115. this.ultraGrid1.DisplayLayout.Bands[0].Columns["REALINVOICENO_ORG"].CellAppearance.BackColor = color;
  116. }
  117. catch
  118. {
  119. }
  120. }
  121. private void InitGridValue()
  122. {
  123. try
  124. {
  125. this.ultraGrid1.DisplayLayout.Bands[0].Columns["FST_DRAWEE_UNIT"].ValueList
  126. = GetFstDraWeeUnit();
  127. }
  128. catch
  129. {
  130. }
  131. }
  132. private Infragistics.Win.ValueList GetFstDraWeeUnit()
  133. {
  134. Infragistics.Win.ValueList lit = new Infragistics.Win.ValueList();
  135. lit.ValueListItems.Add("120601", "N/A");
  136. lit.ValueListItems.Add("120602", "/");
  137. lit.ValueListItems.Add("120603", "天津钢管集团股份有限公司");
  138. lit.ValueListItems.Add("120604", "天津钢管钢铁贸易有限公司");
  139. lit.ValueListItems.Add("120605", "天津钢管国际贸易有限公司");
  140. lit.ValueListItems.Add("120606", "合同结算单位");
  141. return lit;
  142. }
  143. public override void ToolBar_Click(object sender, string ToolbarKey)
  144. {
  145. switch (ToolbarKey)
  146. {
  147. case "Query":
  148. {
  149. this.Query();
  150. break;
  151. }
  152. case "RollInv":
  153. {
  154. this.RollBackInvoiceNo();
  155. break;
  156. }
  157. case "Exit":
  158. {
  159. this.Close();
  160. break;
  161. }
  162. case "Save":
  163. {
  164. this.SaveRealInvoiceNo();
  165. break;
  166. }
  167. case "PrintInvoice":
  168. {
  169. this.PrintInvoice();
  170. break;
  171. }
  172. case "Credit":
  173. {
  174. this.Credit();
  175. break;
  176. }
  177. }
  178. }
  179. /// <summary>
  180. /// 冲减
  181. /// </summary>
  182. private void Credit()
  183. {
  184. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
  185. Infragistics.Win.UltraWinGrid.UltraGridRow ugrc = null;
  186. if (this.ultraGrid1.Rows.Count == 0)
  187. return;
  188. if (this.ultraGrid2.Rows.Count == 0)
  189. return;
  190. if (this.ultraGrid1.Rows.Count == 1)
  191. this.ultraGrid1.Rows[0].Activated = true;
  192. ugr = this.ultraGrid1.ActiveRow;
  193. if (ugr == null)
  194. {
  195. Util.MessageUtil.ShowTips("请选择需要保存的行");
  196. return;
  197. }
  198. if (this.ultraGrid5.Rows.Count == 0)
  199. return;
  200. if (this.ultraGrid5.Rows.Count == 1)
  201. this.ultraGrid5.Rows[0].Activated = true;
  202. ugrc = this.ultraGrid5.ActiveRow;
  203. if (ugrc == null)
  204. {
  205. Util.MessageUtil.ShowTips("请选择待冲减的行");
  206. return;
  207. }
  208. string invoiceno = ugr.Cells["INVOICENO_ORG"].Value.ToString();
  209. // "WEIGHT",
  210. // "MONEY",
  211. double money = Util.ConverObject.ConvertToDouble(ugr.Cells["MONEY_ORG"].Value);
  212. double weight = Util.ConverObject.ConvertToDouble(ugr.Cells["WEIGHT"].Value);
  213. double creditMny = Util.ConverObject.ConvertToDouble(ugrc.Cells["MONEY_ORG"].Value);
  214. if (creditMny >= money)
  215. {
  216. Util.MessageUtil.ShowError("冲减金额必须小于货款");
  217. return;
  218. }
  219. if (weight == 0)
  220. {
  221. Util.MessageUtil.ShowError("只能冲减货款");
  222. return;
  223. }
  224. if (Util.MessageUtil.ShowYesNoAndQuestion("是否确定冲减结算单?") == DialogResult.No) return;
  225. double dlivPrice = (money - creditMny) / weight;
  226. ArrayList list = new ArrayList();
  227. string[] str = null;
  228. string sub_seq = ugrc.Cells["SUB_SEQ"].Value.ToString();
  229. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugrr in this.ultraGrid2.Rows)
  230. {
  231. double seqmoney = dlivPrice * Util.ConverObject.ConvertToDouble(ugrr.Cells["WEIGHT"].Value);
  232. str = new string[] { invoiceno, ugrr.Cells["INVOICENO_SEQ_ORG"].Value.ToString(), dlivPrice + "",
  233. seqmoney +"",sub_seq};
  234. list.Add(str);
  235. }
  236. string errMsg = "";
  237. this.slmBalanceInfo.Credit(list, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), out errMsg);
  238. if (errMsg.Length == 0)
  239. {
  240. Util.MessageUtil.ShowTips("操作成功");
  241. }
  242. this.Query();
  243. }
  244. private void PrintInvoice()
  245. {
  246. string INVOICENO = "INVOICENO_ORG";
  247. List<string> list = new List<string>();
  248. if (this.ultraGrid1.Rows.Count == 0)
  249. return;
  250. if (this.ultraGrid1.Rows.Count == 1)
  251. this.ultraGrid1.Rows[0].Selected = true;
  252. this.ultraGrid1.ActiveRow.Selected = true;
  253. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Selected.Rows)
  254. {
  255. list.Add(ugr.Cells[INVOICENO].Value.ToString());
  256. }
  257. DlgInvoicePrint print = null;
  258. print = new DlgInvoicePrint(this.ob);
  259. print.listInvoiceNo = list;
  260. print.isOrgInvoice = true;
  261. print.ShowDialog();
  262. }
  263. private void RollBackInvoiceNo()
  264. {
  265. if (this.ultraGrid1.Rows.Count == 0)
  266. return;
  267. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  268. if (ugr == null)
  269. return;
  270. string invoinceno = ugr.Cells[this.INVOICENO].Value.ToString();
  271. this.slmBalanceInfo.RollBaskInvoiceNoOrg(invoinceno, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
  272. ugr.Delete(false);
  273. this.ultraGrid1.UpdateData();
  274. }
  275. private string saleOrg_Corp = "120603";
  276. private string saleOrg_Gm = "120604";
  277. private string saleOrg_Gtm = "120605";
  278. private void Query()
  279. {
  280. dsInvoiceDetail = this.slmBalanceInfo.GeOrgtInvoiceSlmBalaneInfoByInvoiceBeginDateAndEndDate(this.dateTimePicker1.Value,
  281. this.dateTimePicker2.Value);
  282. //if (this.textBox3.Text.Length > 0)
  283. //{
  284. // dsInvoiceDetail = Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch(dsInvoiceDetail, "ORD_NO", this.textBox3.Text.Trim());
  285. //}
  286. // 只显示首次受票单位为国贸,钢贸,集团的数据
  287. try
  288. {
  289. dsInvoiceDetail = Util.UtilDataSet.GetDataSetWithRowFilter(dsInvoiceDetail, "FST_DRAWEE_UNIT",
  290. new string[] { saleOrg_Corp, saleOrg_Gm, saleOrg_Gtm }
  291. );
  292. }
  293. catch
  294. { }
  295. DataSet ds = Util.UtilDataSet.GetDateSetByGroupColumnAndStaticsColumnName(dsInvoiceDetail, new List<string>(GetGroupByName()),
  296. new List<string>(GetShowName()), new List<string>(GetStaticName()));
  297. Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsInvoice, ds);
  298. SetTransMoneyAndOutStockMoney();
  299. // QueryTransMny();
  300. ClearGrid();
  301. }
  302. private DataSet GetTransMnyByInvoiceNo(string invoiceno)
  303. {
  304. string sql = @"select sum(a.money) money,sum(a.weight) weight,a.money_type,a.invoiceno_org
  305. from slm_balance_transmoney a where invoiceno_org = '{0}' and a.invoiceno_org is not null
  306. group by a.money_type,a.invoiceno_org";
  307. sql = string.Format(sql,invoiceno);
  308. DataSet ds = base.ExecuteReader(sql);
  309. return ds;
  310. }
  311. private void SetTransMoneyAndOutStockMoney()
  312. {
  313. if (this.dsInvoice == null || this.dsInvoice.Tables.Count == 0 || this.dsInvoice.Tables[0].Rows.Count == 0)
  314. return;
  315. foreach (DataRow dri in this.dsInvoice.Tables[0].Rows)
  316. {
  317. try
  318. {
  319. string invoiceno = dri[this.INVOICENO].ToString();
  320. DataSet ds = GetTransMnyByInvoiceNo(invoiceno);
  321. //DataSet ds = this.slmBalanceInfo.GetInvoiceSlmBalanceTransMoneyAndOutStockMoney(this.dateTimePicker1.Value,
  322. // this.dateTimePicker2.Value);
  323. if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
  324. continue;
  325. foreach (DataRow drd in ds.Tables[0].Rows)
  326. {
  327. if (drd["MONEY_TYPE"].ToString() == "运费")
  328. {
  329. dri["TRANSMNY"] = drd["MONEY"];
  330. }
  331. if (drd["MONEY_TYPE"].ToString() == "出库费")
  332. {
  333. dri["OUTSTOCKMNY"] = drd["MONEY"];
  334. }
  335. }
  336. }
  337. catch
  338. { }
  339. }
  340. this.dsInvoice.AcceptChanges();
  341. ClearGrid();
  342. }
  343. private void ClearGrid()
  344. {
  345. this.dsInvoiceSeq.Clear();
  346. this.dsInvoiceList.Clear();
  347. }
  348. private void QueryTransMny()
  349. {
  350. DataSet ds = this.slmBalanceInfo.GetInvoiceSlmBalanceTransMoney(this.dateTimePicker1.Value,
  351. this.dateTimePicker2.Value);
  352. if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
  353. return;
  354. ds.Tables[0].TableName = this.dsInvoice.Tables[0].TableName;
  355. this.dsInvoice.Merge(ds);
  356. this.dsInvoice.AcceptChanges();
  357. }
  358. private void QuryGrid2(string invoiceNo)
  359. {
  360. DataSet ds2 = Util.UtilDataSet.GetDataSetWithRowFilter(dsInvoiceDetail, this.INVOICENO, invoiceNo);
  361. DataSet ds = Util.UtilDataSet.GetDateSetByGroupColumnAndStaticsColumnName(ds2,
  362. new List<string>(this.GetGrid2GroupByCol()),
  363. new List<string>(this.GetGrid2ShowCol()),
  364. new List<string>(this.GetGrid2StaticCol()));
  365. Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsInvoiceSeq, ds);
  366. }
  367. private void QueryGrid3(String invoiceno, string invoiceno_seq)
  368. {
  369. DataSet ds2 = Util.UtilDataSet.GetDataSetWithRowFilter(dsInvoiceDetail, this.INVOICENO, invoiceno);
  370. DataSet ds3 = Util.UtilDataSet.GetDataSetWithRowFilter(ds2, this.INVOICENO_SEQ, invoiceno_seq);
  371. Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsInvoiceList, ds3);
  372. }
  373. private string[] GetGroupByName()
  374. {
  375. return new string[]
  376. {
  377. "INVOICENO_ORG",
  378. "FST_DRAWEE_UNIT",
  379. // "BUYERNAME",
  380. "FORECORPCODE"
  381. // "ORD_NO"
  382. };
  383. }
  384. private string[] GetShowName()
  385. {
  386. return new string[]
  387. {
  388. "REMARK" ,
  389. "PRICE_ORG",
  390. "REALINVOICENO_ORG"
  391. };
  392. }
  393. private string[] GetStaticName()
  394. {
  395. return new string[]
  396. {
  397. "WEIGHT",
  398. "MONEY_ORG"
  399. };
  400. }
  401. private string[] GetGrid1DataStruct()
  402. {
  403. return new string[]
  404. {
  405. "INVOICENO_ORG",
  406. "REALINVOICENO_ORG",
  407. "FST_DRAWEE_UNIT",
  408. "REALINVOICENO",
  409. // "BUYERNAME",
  410. "WEIGHT",
  411. "MONEY_ORG",
  412. "TRANSMNY",
  413. "OUTSTOCKMNY",
  414. // "TRANSMONEYQC",
  415. //"TRANSMONEYSY1",
  416. //"TRANSMONETRAIN",
  417. // "HOISTINGFEE",
  418. // "ORD_NO",
  419. "REMARK",
  420. "FORECORPCODE"
  421. }
  422. ;
  423. }
  424. private Hashtable GetColumnAndCaption()
  425. {
  426. return StaticData.TbColumnAndCaption.GetColumnAndCaption();
  427. Hashtable hs = new Hashtable();
  428. hs.Add("WEIGHT", "重量");
  429. hs.Add("INVOICENO", "结算单号");
  430. hs.Add("FORECORPCODE", "子公司");
  431. hs.Add("SHIPNO", "船号");
  432. hs.Add("TRANSMONEYQC", "汽运费");
  433. hs.Add("TRANSMONEYSY1", "船运费");
  434. hs.Add("TRANSMONETRAIN", "火运费");
  435. hs.Add("HOISTINGFEE", "吊装费");
  436. hs.Add("PLY", "厚/直径/壁厚");
  437. hs.Add("WIDTH", "宽/外径");
  438. hs.Add("ORD_NO", "合同号");
  439. hs.Add("BUYERNAME", "结算单位名称");
  440. hs.Add("BUYERCODE", "结算单位名称");
  441. hs.Add("FST_DRAWEE_UNIT", "首次受票人");
  442. hs.Add("STATIONCODE", "到站");
  443. hs.Add("MONEY_ORG", "金额");
  444. hs.Add("PRICE_ORG", "单价");
  445. hs.Add("INVOICENO_ORG", "结算单号");
  446. hs.Add("INVOICENO_SEQ_ORG", "序号");
  447. return hs;
  448. }
  449. protected override Hashtable GetGridColumnLength()
  450. {
  451. return StaticData.TbColumnAndCaption.GetDataSetColumnLength();
  452. }
  453. private string[] GetGrid5DataStruct()
  454. {
  455. return new string[]
  456. {
  457. "SUBTCT_TYP",
  458. "SUBTCT_MOD",
  459. "SUBTCT_MNY",
  460. "SUBTCT_DSP",
  461. "DCL_ID",
  462. "DCL_DTIME",
  463. "REV_ID",
  464. "REV_DTIME",
  465. "REV_DSP"
  466. }
  467. ;
  468. }
  469. private string[] GetGrid2DataStruct()
  470. {
  471. return new string[]
  472. {
  473. "INVOICENO_ORG",
  474. "INVOICENO_SEQ_ORG",
  475. "SPETKEY",
  476. "STEELCODEKEY",
  477. "PRICE_ORG",
  478. "WEIGHT",
  479. "MONEY_ORG"
  480. }
  481. ;
  482. }
  483. private string[] GetGrid2GroupByCol()
  484. {
  485. return new string[] { "INVOICENO_ORG", "INVOICENO_SEQ_ORG" };
  486. }
  487. private string[] GetGrid2ShowCol()
  488. {
  489. return GetGrid2DataStruct();
  490. }
  491. private string[] GetGrid2StaticCol()
  492. {
  493. return new string[] { "WEIGHT",
  494. "MONEY_ORG" };
  495. }
  496. private string[] GetGrid3DataStruct()
  497. {
  498. return new string[]
  499. {
  500. "SPETKEY",
  501. "STEELCODEKEY",
  502. "QUANTITY",
  503. "WEIGHT",
  504. "MONEY_ORG",
  505. "TRAINWAGON",
  506. // "SHIPNO",
  507. // "DOCKCODE",
  508. "STATIONCODE",
  509. }
  510. ;
  511. }
  512. private string[] GetGrid4DataStruct()
  513. {
  514. return new string[]
  515. {
  516. "SUBTCT_TYP",
  517. "SUBTCT_MOD",
  518. "SUBTCT_MNY",
  519. "SUBTCT_DSP",
  520. "SUBTCT_TIME"
  521. }
  522. ;
  523. }
  524. private string BUYERCODE = "BUYERCODE";
  525. private string ORD_NO = "ORD_NO";
  526. private string ORD_SEQ = "ORD_SEQ";
  527. private string ORD_LN_DLY = "ORD_LN_DLY";
  528. private string ASKPLAN_ID = "ASKPLAN_ID";
  529. private string ASKPLAN_ID_SEQ = "ASKPLAN_ID_SEQ";
  530. private string SPETKEY = "SPETKEY";
  531. private string STEELCODEKEY = "STEELCODEKEY";
  532. private string MONEY = "MONEY_ORG";
  533. private string WEIGHT = "WEIGHT";
  534. private string PRICE = "PRICE_ORG";
  535. private string BALANCESTATUS = "BALANCESTATUS";
  536. private string ADJUSTPRICEREASON = "ADJUSTPRICEREASON";
  537. private string INVOICENO = "INVOICENO_ORG";
  538. private string INVOICENO_SEQ = "INVOICENO_SEQ_ORG";
  539. private string BALANCESTATUS_INIT = "0";
  540. private string BALANCESTATUS_AFFRIM = "1";
  541. private string BALANCESTATUS_INVOINCE = "2";
  542. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  543. {
  544. if (this.ultraGrid1.Rows.Count == 0)
  545. return;
  546. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
  547. if (this.ultraGrid1.Rows.Count == 1)
  548. ugr = this.ultraGrid1.Rows[0];
  549. else
  550. ugr = this.ultraGrid1.ActiveRow;
  551. string invoiceno = ugr.Cells[this.INVOICENO].Value.ToString();
  552. this.QuryGrid2(invoiceno);
  553. }
  554. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  555. {
  556. if (this.ultraGrid2.Rows.Count == 0)
  557. return;
  558. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
  559. if (this.ultraGrid2.Rows.Count == 1)
  560. ugr = this.ultraGrid2.Rows[0];
  561. else
  562. ugr = this.ultraGrid2.ActiveRow;
  563. string invoiceno = ugr.Cells[this.INVOICENO].Value.ToString();
  564. string invoicenoseq = ugr.Cells[this.INVOICENO_SEQ].Value.ToString();
  565. this.QueryGrid3(invoiceno, invoicenoseq);
  566. }
  567. private void button3_Click(object sender, EventArgs e)
  568. {
  569. this.PrintInvoice();
  570. }
  571. private void ultraGrid1_AfterRowActivate_1(object sender, EventArgs e)
  572. {
  573. if (this.ultraGrid1.Rows.Count == 0)
  574. return;
  575. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
  576. if (this.ultraGrid1.Rows.Count == 1)
  577. ugr = this.ultraGrid1.Rows[0];
  578. else
  579. ugr = this.ultraGrid1.ActiveRow;
  580. string invoiceno = ugr.Cells[this.INVOICENO].Value.ToString();
  581. this.QuryGrid2(invoiceno);
  582. }
  583. private void ultraGrid2_AfterRowActivate_1(object sender, EventArgs e)
  584. {
  585. if (this.ultraGrid2.Rows.Count == 0)
  586. return;
  587. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
  588. if (this.ultraGrid2.Rows.Count == 1)
  589. ugr = this.ultraGrid2.Rows[0];
  590. else
  591. ugr = this.ultraGrid2.ActiveRow;
  592. string invoiceno = ugr.Cells[this.INVOICENO].Value.ToString();
  593. string invoicenoseq = ugr.Cells[this.INVOICENO_SEQ].Value.ToString();
  594. this.QueryGrid3(invoiceno, invoicenoseq);
  595. }
  596. }
  597. }