FrmSlmGlAccrued.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using Core.Mes.Client.Comm.Control;
  11. using Core.Mes.Client.Comm.Server;
  12. using Core.Mes.Client.Comm.Tool;
  13. using CoreFS.CA06;
  14. using Infragistics.Win.UltraWinGrid;
  15. namespace Core.StlMes.Client.GlBusiness
  16. {
  17. public partial class FrmSlmGlAccrued : FrmBase
  18. {
  19. public FrmSlmGlAccrued()
  20. {
  21. InitializeComponent();
  22. }
  23. public override void ToolBar_Click(object sender, string ToolbarKey)
  24. {
  25. switch (ToolbarKey)
  26. {
  27. case "doQuery":
  28. doQuery();
  29. break;
  30. //case "doAdd":
  31. // doAdd();
  32. // break;
  33. case "doAddInvoices":
  34. doAddInvoices();
  35. break;
  36. case "doAddFreight":
  37. doAddFreight();
  38. break;
  39. case "doUpdate":
  40. doUpdate();
  41. break;
  42. case "doReset":
  43. doReset();
  44. break;
  45. case "doDelete":
  46. doDelete();
  47. break;
  48. case "Close":
  49. this.Close();
  50. break;
  51. }
  52. }
  53. private string setCreateTimeStart(Object value)
  54. {
  55. DateTime time = Convert.ToDateTime(value);
  56. DateTime endtime = new DateTime(time.Year, time.Month, time.Day, 0, 0, 0);
  57. endtime.ToLongTimeString();
  58. return endtime.ToString();
  59. }
  60. private string setCreateTimeEnd(Object value)
  61. {
  62. DateTime time = Convert.ToDateTime(value);
  63. DateTime endtime = new DateTime(time.Year, time.Month, time.Day, 23, 59, 59);
  64. return endtime.ToString();
  65. }
  66. /// <summary>
  67. /// 查询
  68. /// </summary>
  69. public void doQuery()
  70. {
  71. this.dataTable1.Clear();
  72. ArrayList parm = new ArrayList();
  73. parm.Add(txt_balanceNo.Text.Trim());
  74. parm.Add(txt_orderNo.Text.Trim());
  75. if (QcreateTime_Begin.Value != null)//创建开始时间
  76. {
  77. parm.Add(setCreateTimeStart(QcreateTime_Begin.Value));
  78. }
  79. if (QcreateTime_End.Value != null)//创建结束时间
  80. {
  81. parm.Add(setCreateTimeEnd(QcreateTime_End.Value));
  82. }
  83. parm.Add(cbxBALANCE_TYPE.Value.ToString());
  84. DataTable dt = ServerHelper.GetData("com.steering.pss.glbusiness.SlmGlAccrued.doQuery", new Object[] { parm }, this.ob);
  85. GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
  86. double ysPrice = 0;
  87. double yfPrice = 0;
  88. double sumYsPrice = 0;
  89. double sumYfPrice = 0;
  90. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  91. {
  92. if (ugr.Cells["BALANCE_TPYE_DESC"].Value.ToString().Trim().Equals("应收")) {
  93. Double.TryParse(ugr.Cells["BALNCE_TOL_PRICE"].Value.ToString().Trim(), out ysPrice);
  94. sumYsPrice += ysPrice;
  95. }
  96. else if (ugr.Cells["BALANCE_TPYE_DESC"].Value.ToString().Trim().Equals("应付")) {
  97. Double.TryParse(ugr.Cells["BALNCE_TOL_PRICE"].Value.ToString().Trim(), out yfPrice);
  98. sumYfPrice += yfPrice;
  99. }
  100. }
  101. sumPrice.Text = string.Format("{0:C}", Convert.ToDecimal(sumYsPrice - sumYfPrice));
  102. }
  103. /// <summary>
  104. /// 增加应收应付
  105. /// </summary>
  106. public void doAdd()
  107. {
  108. orderManage head = new orderManage();
  109. head.ob = this.ob;
  110. head.ShowDialog();
  111. }
  112. /// <summary>
  113. /// 增加发票
  114. /// </summary>
  115. public void doAddInvoices()
  116. {
  117. }
  118. /// <summary>
  119. /// 增加运费
  120. /// </summary>
  121. public void doAddFreight()
  122. {
  123. freightManage head = new freightManage();
  124. head.ob = this.ob;
  125. head.ShowDialog();
  126. }
  127. /// <summary>
  128. /// 重置
  129. /// </summary>
  130. public void doReset()
  131. {
  132. txt_balanceNo.Text = "";
  133. txt_orderNo.Text = "";
  134. cbxBALANCE_TYPE.SelectedIndex = 0;
  135. }
  136. /// <summary>
  137. /// 删除
  138. /// </summary>
  139. public void doDelete()
  140. {
  141. try
  142. {
  143. ultraGrid1.Update();
  144. if (ultraGrid1.ActiveRow == null)
  145. {
  146. MessageUtil.ShowTips("请选择需要废除的数据!");
  147. return;
  148. }
  149. if (MessageUtil.ShowYesNoAndQuestion("是否确定废除?") == DialogResult.No)
  150. {
  151. return;
  152. }
  153. ArrayList all = new ArrayList();
  154. //all.Add(UserInfo.GetUserID());
  155. all.Add(UserInfo.GetUserName());
  156. all.Add(ultraGrid1.ActiveRow.Cells["BALANCE_NO"].Value.ToString());
  157. CoreClientParam ccp = new CoreClientParam();
  158. ccp.ServerName = "com.steering.pss.glbusiness.SlmGlAccrued";
  159. ccp.MethodName = "doDelete";
  160. ccp.ServerParams = new object[] { all };
  161. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  162. if (ccp.ReturnCode == -1) return;
  163. MessageBox.Show("废除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  164. doQuery();
  165. }
  166. catch (System.Exception ex)
  167. {
  168. MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  169. }
  170. }
  171. /// <summary>
  172. /// 修改票据
  173. /// </summary>
  174. public void doUpdate()
  175. {
  176. try
  177. {
  178. this.ultraGrid1.UpdateData();
  179. if (ultraGrid1.ActiveRow == null)
  180. {
  181. MessageUtil.ShowTips("请选择需要修改的数据!");
  182. return;
  183. }
  184. if (MessageUtil.ShowYesNoAndQuestion("是否确定新增或修改票据?") == DialogResult.No)
  185. {
  186. return;
  187. }
  188. ArrayList all = new ArrayList();
  189. //all.Add(UserInfo.GetUserID());
  190. all.Add(ultraGrid1.ActiveRow.Cells["BILLS_KEY"].Text.ToString());
  191. all.Add(UserInfo.GetUserName());
  192. all.Add(ultraGrid1.ActiveRow.Cells["BALANCE_NO"].Value.ToString());
  193. CoreClientParam ccp = new CoreClientParam();
  194. ccp.ServerName = "com.steering.pss.glbusiness.SlmGlAccrued";
  195. ccp.MethodName = "doUpdate";
  196. ccp.ServerParams = new object[] { all };
  197. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  198. if (ccp.ReturnCode == -1) return;
  199. MessageBox.Show("操作成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  200. doQuery();
  201. }
  202. catch (System.Exception ex)
  203. {
  204. MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  205. }
  206. }
  207. private void FrmSlmGlPay_Load(object sender, EventArgs e)
  208. {
  209. QcreateTime_Begin.Value = DateTime.Now.AddMonths(-1);
  210. QcreateTime_End.Value = DateTime.Now;
  211. GridHelper.SetColumnsActivateAndColor(ultraGrid1.Rows.Band, "BILLS_KEY");
  212. cbxBALANCE_TYPE.SelectedIndex = 0;
  213. }
  214. }
  215. }