FrmBalanceRegmMana.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;using Pur.Entity;
  10. using Pur.Entity.balanceEntity;
  11. using Core.Mes.Client.Comm.Control;
  12. using com.hnshituo.pur.vo;
  13. using Core.Mes.Client.Comm.Tool;
  14. using System.Collections;
  15. using Pur.Entity.configureEntity;
  16. using Pur.Pop_upWindow;
  17. using Pur.configure;
  18. using Infragistics.Win;
  19. namespace Pur.balance
  20. {
  21. public partial class FrmBalanceRegmMana : FrmPmsBase
  22. {
  23. public FrmBalanceRegmMana()
  24. {
  25. InitializeComponent();
  26. txt_CreateTimeStart.Value = ((DateTime)txt_CreateTimeStart.Value).AddMonths(-1);//将查询的截止日期加一天
  27. //GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], "Check");
  28. // ultraGrid2.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
  29. }
  30. /// <summary>
  31. /// toolbar工具栏加载
  32. /// </summary>
  33. /// <param name="sender"></param>
  34. /// <param name="ToolBarKey"></param>
  35. public override void ToolBar_Click(object sender, string ToolbarKey)
  36. {
  37. switch (ToolbarKey)
  38. {
  39. case "Query":
  40. getBalanceRegM();
  41. break;
  42. case "Update":
  43. //UpdPUR_MAT();
  44. break;
  45. case "ToSend":
  46. ToSend();// 送审
  47. break;
  48. case "BackSend":
  49. BackSend();// 驳回
  50. break;
  51. case "RegMExamine":
  52. RegmExamine();// 审批
  53. break;
  54. }
  55. }
  56. /// <summary>
  57. /// 获取报销单信息
  58. /// </summary>
  59. private void getBalanceRegM()
  60. {
  61. PurBalanceRegMEntity entity = getEnSelContion();
  62. DataTable dt = this.execute<DataTable>("com.hnshituo.pur.balance.service.BalanceRegMService", "getBalanceRegM", new object[] { entity });
  63. //按创建时间降序
  64. if (dt.Rows.Count > 0)
  65. {
  66. dt.DefaultView.Sort = "CREATETIME DESC";
  67. dt = dt.DefaultView.ToTable();
  68. }
  69. GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);//结算信息
  70. if (dt.Rows.Count < 1)
  71. {
  72. dataTable1.Rows.Clear();
  73. }
  74. }
  75. /// <summary>
  76. /// 获取报销单对应结算单信息
  77. /// </summary>
  78. private void getBalancemFromRegmId(string strREGM_ID)
  79. {
  80. DataTable dt = this.execute<DataTable>("com.hnshituo.pur.balance.service.BalanceRegCService", "getBalancemFromRegmId", new object[] { strREGM_ID });
  81. //按创建时间降序
  82. if (dt.Rows.Count > 0)
  83. {
  84. dt.DefaultView.Sort = "CREATETIME DESC";
  85. dt = dt.DefaultView.ToTable();
  86. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);//结算信息
  87. }
  88. else
  89. {
  90. dataTable1.Clear();
  91. }
  92. }
  93. /// <summary>
  94. /// 获取报销单查询条件
  95. /// </summary>
  96. /// <returns></returns>
  97. private PurBalanceRegMEntity getEnSelContion()
  98. {
  99. PurBalanceRegMEntity entity = new PurBalanceRegMEntity();
  100. if (txt_STATUS.Value != null && txt_STATUS.Value.ToString().Trim() != "")
  101. {
  102. entity.Status = txt_STATUS.Value.ToString();//状态
  103. }
  104. if (txt_ORDER_ID.Text != null)
  105. {
  106. entity.OrderId = txt_ORDER_ID.Text;//供应商名称
  107. }
  108. if (txt_CreateTimeStart.Value != null)
  109. {
  110. entity.CreateTime = (DateTime)txt_CreateTimeStart.Value;//起始时间
  111. }
  112. else
  113. {
  114. entity.CreateTime = DateTime.MinValue;
  115. }
  116. if (txt_CreateTimeEnd.Value != null)
  117. {
  118. entity.UpdateTime = (DateTime)txt_CreateTimeEnd.Value;//结束时间
  119. }
  120. else
  121. {
  122. entity.UpdateTime = DateTime.MaxValue;
  123. }
  124. entity.Validflag = "1";//状态
  125. return entity;
  126. }
  127. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  128. {
  129. getBalancemFromRegmId(ultraGrid2.ActiveRow.Cells["REGMID"].Value.ToString());
  130. }
  131. /// <summary>
  132. /// 送审
  133. /// </summary>
  134. private void ToSend()
  135. {
  136. ultraGrid2.UpdateData();
  137. ArrayList al_RegmId = new ArrayList();
  138. for (int i = 0; i < ultraGrid2.Rows.Count; i++)
  139. {
  140. if ((Boolean)ultraGrid2.Rows[i].Cells["Check"].Value)
  141. {
  142. string strREGMID = ultraGrid2.Rows[i].Cells["REGMID"].Value.ToString();
  143. if (ultraGrid2.Rows[i].Cells["STATUS"].Value.ToString() != "待提报")//判断状态是否适合当前操作
  144. {
  145. MessageUtil.ShowTips("报销单【" + strREGMID + "】的状态必须处在“待提报”才能进行送审操作");
  146. return;
  147. }
  148. al_RegmId.Add(ultraGrid2.Rows[i].Cells["REGMID"].Value.ToString());
  149. }
  150. }
  151. if (al_RegmId.Count < 1)
  152. {
  153. MessageUtil.ShowTips("请选择审批的数据");
  154. return;
  155. }
  156. CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.balance.service.BalanceRegMService", "ToSend", new object[] { al_RegmId });
  157. if (crt.Resultcode != 0)
  158. {
  159. MessageUtil.ShowTips("送审失败 " + crt.Resultmsg);
  160. return;
  161. }
  162. MessageUtil.ShowTips("送审成功!");
  163. getBalanceRegM();//刷新报销登记单
  164. }
  165. /// <summary>
  166. /// 驳回
  167. /// </summary>
  168. private void BackSend()
  169. {
  170. ultraGrid2.UpdateData();
  171. ArrayList al_RegmId = new ArrayList();
  172. for (int i = 0; i < ultraGrid2.Rows.Count; i++)
  173. {
  174. if ((Boolean)ultraGrid2.Rows[i].Cells["Check"].Value)
  175. {
  176. string strREGMID = ultraGrid2.Rows[i].Cells["REGMID"].Value.ToString();
  177. if (ultraGrid2.Rows[i].Cells["STATUS"].Value.ToString() != "审批中")//判断状态是否适合当前操作
  178. {
  179. MessageUtil.ShowTips("报销单【" + strREGMID + "】的状态必须处在“审批中”才能进行驳回操作");
  180. return;
  181. }
  182. al_RegmId.Add(strREGMID);
  183. }
  184. }
  185. if (al_RegmId.Count < 1)
  186. {
  187. MessageUtil.ShowTips("请选择审批的数据");
  188. return;
  189. }
  190. CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.balance.service.BalanceRegMService", "BackSend", new object[] { al_RegmId });
  191. if (crt.Resultcode != 0)
  192. {
  193. MessageUtil.ShowTips("驳回失败 " + crt.Resultmsg);
  194. return;
  195. }
  196. MessageUtil.ShowTips("驳回成功!");
  197. getBalanceRegM();//刷新报销登记单
  198. }
  199. /// <summary>
  200. /// 报销单审批
  201. /// </summary>
  202. private void RegmExamine()
  203. {
  204. ultraGrid2.UpdateData();
  205. if (ultraGrid2.ActiveRow == null)
  206. {
  207. MessageUtil.ShowTips("请选择审批的数据");
  208. return;
  209. }
  210. ArrayList al_RegmId = new ArrayList();
  211. for (int i = 0; i < ultraGrid2.Rows.Count; i++)
  212. {
  213. if ((Boolean)ultraGrid2.Rows[i].Cells["Check"].Value)
  214. {
  215. string strREGMID = ultraGrid2.Rows[i].Cells["REGMID"].Value.ToString();
  216. if (ultraGrid2.Rows[i].Cells["STATUS"].Value.ToString() != "审批中")//判断状态是否适合当前操作
  217. {
  218. MessageUtil.ShowTips("报销单【" + strREGMID + "】的状态必须处在“审批中”才能进行审批");
  219. return;
  220. }
  221. al_RegmId.Add(strREGMID);
  222. }
  223. }
  224. if (al_RegmId.Count < 1)
  225. {
  226. MessageUtil.ShowTips("请选择审批的数据");
  227. return;
  228. }
  229. frmExamineShow frm = new frmExamineShow();
  230. frm.ShowDialog();
  231. if (frm.Status != null)
  232. {
  233. //审批状态
  234. if (frm.Status == "2")
  235. {
  236. CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.balance.service.BalanceRegMService", "RegmExamine", new object[] { al_RegmId, true });
  237. if (crt.Resultcode != 0)
  238. {
  239. MessageUtil.ShowTips("审核失败 " + crt.Resultmsg);
  240. return;
  241. }
  242. MessageUtil.ShowTips("审核通过");
  243. }
  244. else
  245. {
  246. CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.balance.service.BalanceRegMService", "RegmExamine", new object[] { al_RegmId, false });
  247. if (crt.Resultcode != 0)
  248. {
  249. MessageUtil.ShowTips("审核失败 " + crt.Resultmsg);
  250. return;
  251. }
  252. MessageUtil.ShowTips("审核不通过");
  253. }
  254. getBalanceRegM();//刷新报销登记单
  255. }
  256. }
  257. }
  258. }