FrmInvoiceMonthMgt.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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 FrmInvoiceMonthMgt : Core.StlMes.Client.Sale.Common.FrmStyleBase.FrmUIBase
  15. {
  16. public FrmInvoiceMonthMgt()
  17. {
  18. InitializeComponent();
  19. }
  20. DataSet dsInfo = null;
  21. private void FrmInvoiceMonthMgt_Load(object sender, EventArgs e)
  22. {
  23. this.dateTimePicker2.Format = DateTimePickerFormat.Custom;
  24. this.dateTimePicker2.CustomFormat = "yyyyMM";
  25. this.dateTimePicker2.Value = System.DateTime.Now.AddMonths(-1);
  26. dsInfo = base.GetDataSetByColumnName(GetDataStruct(), null, GetColumnCaption());
  27. this.ultraGrid1.DataSource = dsInfo;
  28. SetDataSet();
  29. InitGrid();
  30. }
  31. private void UpdateSlmBalanceInfo(string month,string saleOrg)
  32. {
  33. string sqlBa = @" update slm_balanceinfo set INVOICE_MONTH = '{0}',INVOICE_STS = '{1}'
  34. where balancestatus = '3' and trim(realinvoiceno) is not null and realinvoiceno_date > to_date('{0}', 'yyyymm')
  35. and realinvoiceno_date <= last_day(to_date('{0}', 'yyyymm')) + 1 and forecorpcode = '{2}'
  36. ";
  37. string sqlBt = @" update SLM_BALANCE_TRANSMONEY set INVOICE_MONTH = '{0}',INVOICE_STS = '{1}'
  38. where STATUS_CD = '3' and trim(REALINVOICENO) is not null and REALINVOICE_DATE > to_date('{0}', 'yyyymm')
  39. and REALINVOICE_DATE <= last_day(to_date('{0}', 'yyyymm')) + 1 and forecorpname = '{2}'
  40. ";
  41. sqlBa = string.Format(sqlBa, month, "1", saleOrg);
  42. sqlBt = string.Format(sqlBt, month, "1", saleOrg);
  43. ArrayList array = new ArrayList();
  44. array.Add(sqlBa);
  45. array.Add(sqlBt);
  46. base.ExecuteNoReader(array);
  47. Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功");
  48. }
  49. private void UpdateSelFundCustFundInout(string month, string saleOrg)
  50. {
  51. string sqlBa = @" update sel_fund_cust_fundinout set INVOICE_MONTH = '{0}',INVOICE_STS = '{1}'
  52. where 1= 1 and ISVALID = '1'
  53. and INOUTTIME > to_date('{0}', 'yyyymm')
  54. and INOUTTIME <= last_day(to_date('{0}', 'yyyymm')) + 1 and BALANCESUBJECT = '{2}' ";
  55. sqlBa = string.Format(sqlBa,month,"1",saleOrg);
  56. base.ExecuteNoReader(sqlBa);
  57. Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功");
  58. }
  59. private void InitGrid()
  60. {
  61. this.ultraGrid1.DisplayLayout.Bands[0].Columns["BUTTON"].ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
  62. this.ultraGrid1.DisplayLayout.Bands[0].Columns["BUTTON"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Button;
  63. }
  64. private string[] GetDataStruct()
  65. {
  66. return new string[] { "INFO","SARE_ORG","BUTTON"};
  67. }
  68. private void SetDataSet()
  69. {
  70. DataRow dr = null;
  71. dr = dsInfo.Tables[0].NewRow();
  72. dr["INFO"] = "客户回款结转";
  73. dr["SARE_ORG"] = base.GetSaleOrgDesc();
  74. dr["BUTTON"] = "结转";
  75. dsInfo.Tables[0].Rows.Add(dr);
  76. dr = dsInfo.Tables[0].NewRow();
  77. dr["INFO"] = "客户发票结转";
  78. dr["SARE_ORG"] = base.GetSaleOrgDesc();
  79. dr["BUTTON"] = "结转";
  80. dsInfo.Tables[0].Rows.Add(dr);
  81. //dr = dsInfo.Tables[0].NewRow();
  82. //dr["INFO"] = "客户应收应付结转";
  83. //dr["SARE_ORG"] = base.GetSaleOrgDesc();
  84. //dr["BUTTON"] = "结转";
  85. //dsInfo.Tables[0].Rows.Add(dr);
  86. }
  87. private Hashtable GetColumnCaption()
  88. {
  89. Hashtable hs = new Hashtable();
  90. hs.Add("INFO","结转内容");
  91. hs.Add("BUTTON", "操作");
  92. hs.Add("SARE_ORG", "销售组织");
  93. return hs;
  94. }
  95. private void ultraGrid1_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  96. {
  97. if (this.dateTimePicker2.Value > System.DateTime.Now.AddDays(-System.DateTime.Now.Day ) )
  98. {
  99. Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("当月不能结转");
  100. return;
  101. }
  102. if (e.Cell.Row.Cells["INFO"].Value.ToString() == "客户发票结转")
  103. {
  104. UpdateSlmBalanceInfo(this.dateTimePicker2.Value.ToString("yyyyMM"),
  105. e.Cell.Row.Cells["SARE_ORG"].Value.ToString()
  106. );
  107. }
  108. else if (e.Cell.Row.Cells["INFO"].Value.ToString() == "客户回款结转")
  109. {
  110. UpdateSelFundCustFundInout(this.dateTimePicker2.Value.ToString("yyyyMM"),
  111. e.Cell.Row.Cells["SARE_ORG"].Value.ToString()
  112. );
  113. }
  114. else if (e.Cell.Row.Cells["INFO"].Value.ToString() == "客户应收应付结转")
  115. {
  116. }
  117. }
  118. }
  119. }