DressOrderReportFormMain.cs 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  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. namespace LYFZ.Software.MainBusiness.Dresses
  11. {
  12. public partial class DressOrderReportFormMain : LYFZ.Software.UI.Dresses.DressOrderReportFormMain
  13. {
  14. LYFZ.BLL.BLL_ErpSystemLogs slogbll = new BLL.BLL_ErpSystemLogs();
  15. LYFZ.BLL.BLL_ErpDressSendWashOrder sworbll = new BLL.BLL_ErpDressSendWashOrder();
  16. LYFZ.BLL.BLL_ErpDressSendWashDetail swodbll = new BLL.BLL_ErpDressSendWashDetail();
  17. LYFZ.BLL.BLL_ErpPayment ptbll = new BLL.BLL_ErpPayment();
  18. LYFZ.BLL.BLL_ErpDressRefundRecord rsrrbll = new BLL.BLL_ErpDressRefundRecord();
  19. LYFZ.BLL.BLL_ErpDressSaleRentalOrder rsorbll = new BLL.BLL_ErpDressSaleRentalOrder();
  20. LYFZ.BLL.BLL_ErpDressSaleRentalDetail rsodbll = new BLL.BLL_ErpDressSaleRentalDetail();
  21. LYFZ.BLL.BLL_ErpDressDepositReceivables rsdebll = new BLL.BLL_ErpDressDepositReceivables();
  22. public DressOrderReportFormMain()
  23. {
  24. this.Load += DressOrderReportFormMain_Load;
  25. this.Shown += DressOrderReportFormMain_Shown;
  26. this.btnQuery.Click += btnQuery_Click;
  27. this.btnConditionQuery.Click += btnConditionQuery_Click;
  28. this.btnReservation.Click += btnReservation_Click;
  29. this.btnDelete.Click += btnDelete_Click;
  30. this.btnPayment.Click += btnPayment_Click;
  31. this.btnReturnDeposit.Click += btnReturnDeposit_Click;
  32. this.btnReturnDress.Click += btnReturnDress_Click;
  33. this.btnExport.Click += btnExport_Click;
  34. this.btnPrint.Click += btnPrint_Click;
  35. this.btnCloseed.Click += btnCloseed_Click;
  36. this.listViewData.Click += listViewData_Click;
  37. this.listViewData.ColumnClick += listViewData_ColumnClick;
  38. this.listViewData.MouseDoubleClick += listViewData_MouseDoubleClick;
  39. this.txtDreesDay.KeyPress += txtDreesDay_KeyPress;
  40. this.chkOutRent.Click += chkOutRent_Click;
  41. this.chkOutSale.Click += chkOutSale_Click;
  42. this.chkPreselected.Click += chkPreselected_Click;
  43. this.chkSendWash.Click += chkSendWash_Click;
  44. this.chkArrears.Click += chkArrears_Click;
  45. this.chkShowCompleteOrder.Click += chkShowCompleteOrder_Click;
  46. this.Resize += DressOrderReportFormMain_Resize;
  47. this.ucPagerEx1.EventPaging += UcPagerEx1_EventPaging;
  48. }
  49. /// <summary>
  50. /// 相片集合
  51. /// </summary>
  52. ImageList mlistImage = new ImageList();
  53. /// <summary>
  54. /// 用于排序的类
  55. /// </summary>
  56. LYFZ.ComponentLibrary.ListViewColumnSorter lvwColumnSorter;
  57. /// <summary>
  58. /// 窗体加载事件
  59. /// </summary>
  60. /// <param name="sender"></param>
  61. /// <param name="e"></param>
  62. void DressOrderReportFormMain_Load(object sender, EventArgs e)
  63. {
  64. this.listViewData.View = View.Details;
  65. this.listViewData.GridLines = true;
  66. this.mlistImage.ImageSize = new Size(1, 25);
  67. this.mlistImage.ColorDepth = ColorDepth.Depth32Bit;
  68. this.listViewData.SmallImageList = mlistImage;
  69. this.lvwColumnSorter = new ComponentLibrary.ListViewColumnSorter();
  70. this.listViewData.ListViewItemSorter = this.lvwColumnSorter;
  71. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView(this.cmbtreevDressStatus, "取衣,还衣", IsFirstNodeNull: true, IsFirstNodeName: " ");
  72. }
  73. /// <summary>
  74. /// 窗体加载事件
  75. /// </summary>
  76. /// <param name="sender"></param>
  77. /// <param name="e"></param>
  78. void DressOrderReportFormMain_Shown(object sender, EventArgs e)
  79. {
  80. bool b = LYFZ.Software.MainBusiness.VersionControl.StaticVersion.UIFunctionVersion(VersionControl.VersionFunctionEnum.礼服管理);
  81. if (!b)
  82. {
  83. this.Close();
  84. return;
  85. }
  86. this.PublicFunctionRows();
  87. }
  88. /// <summary>
  89. /// 查询
  90. /// </summary>
  91. /// <param name="sender"></param>
  92. /// <param name="e"></param>
  93. void btnQuery_Click(object sender, EventArgs e)
  94. {
  95. this.PublicFunctionRows();
  96. }
  97. /// <summary>
  98. /// 条件查询
  99. /// </summary>
  100. /// <param name="sender"></param>
  101. /// <param name="e"></param>
  102. void btnConditionQuery_Click(object sender, EventArgs e)
  103. {
  104. }
  105. /// <summary>
  106. /// 打开订单
  107. /// </summary>
  108. /// <param name="sender"></param>
  109. /// <param name="e"></param>
  110. void btnReservation_Click(object sender, EventArgs e)
  111. {
  112. if (this.listViewData.Items.Count > 0 && this.listViewData.SelectedItems.Count > 0)
  113. {
  114. switch (this.listViewData.SelectedItems[0].SubItems["订单类型"].Text.Trim())
  115. {
  116. case "出租":
  117. case "出售":
  118. if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DressManagement, CustomAttributes.OperatingAuthority.Dress_Rental))
  119. { MessageBoxCustom.Show("您无修改租租售单权限"); return; }
  120. LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleSmallForm frmRentSale = new SetSmallForm.DressOpenOrderRentSaleSmallForm();
  121. frmRentSale.StrOrderNumber = this.listViewData.SelectedItems[0].Text.Trim();
  122. frmRentSale.LoadType = this.listViewData.SelectedItems[0].SubItems["订单类型"].Text.Trim();
  123. frmRentSale.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
  124. frmRentSale.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
  125. frmRentSale.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
  126. frmRentSale.ShowDialog();
  127. if (frmRentSale.IsSaveed)
  128. { this.PublicFunctionRows(); }
  129. break;
  130. case "预选":
  131. if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DressManagement, CustomAttributes.OperatingAuthority.Dress_Preselection))
  132. { MessageBoxCustom.Show("您无修改预选单权限"); return; }
  133. LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrdePreselectedSmallForm frmPreselected = new SetSmallForm.DressOpenOrdePreselectedSmallForm();
  134. frmPreselected.StrOrderNumber = this.listViewData.SelectedItems[0].Text.Trim();
  135. frmPreselected.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
  136. frmPreselected.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
  137. frmPreselected.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
  138. frmPreselected.ShowDialog();
  139. if (frmPreselected.IsSaveed)
  140. { this.PublicFunctionRows(); }
  141. break;
  142. case "送洗":
  143. if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DressManagement, CustomAttributes.OperatingAuthority.Dress_Valet))
  144. { MessageBoxCustom.Show("您无修改送洗单权限"); return; }
  145. LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderSendWashSmallForm frmSendWash = new SetSmallForm.DressOpenOrderSendWashSmallForm();
  146. frmSendWash.StrOrderNumber = this.listViewData.SelectedItems[0].Text.Trim();
  147. frmSendWash.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
  148. frmSendWash.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
  149. frmSendWash.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
  150. frmSendWash.ShowDialog();
  151. if (frmSendWash.IsSaveed)
  152. { this.PublicFunctionRows(); }
  153. break;
  154. }
  155. }
  156. }
  157. /// <summary>
  158. /// 删除
  159. /// </summary>
  160. /// <param name="sender"></param>
  161. /// <param name="e"></param>
  162. void btnDelete_Click(object sender, EventArgs e)
  163. {
  164. if (this.listViewData.Items.Count > 0 && this.listViewData.SelectedItems.Count > 0)
  165. {
  166. if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DressManagement, CustomAttributes.OperatingAuthority.Delete))
  167. {
  168. switch (this.listViewData.SelectedItems[0].SubItems["订单类型"].Text.Trim())
  169. {
  170. case "出租":
  171. case "出售":
  172. DataTable dt = ptbll.GetList("Pay_OrdNumber = '" + this.listViewData.SelectedItems[0].Text.Trim() + "'").Tables[0];
  173. if (dt.Rows.Count > 0)
  174. { MessageBoxCustom.Show("礼服订单已收款不能删除!"); return; }
  175. break;
  176. }
  177. List<LYFZ.Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
  178. switch (this.listViewData.SelectedItems[0].SubItems["订单类型"].Text.Trim())
  179. {
  180. case "出租":
  181. case "出售":
  182. case "预选":
  183. clist.Add(rsorbll.GetDeleteCommandInfo("Dsro_Number", "=", this.listViewData.SelectedItems[0].Text.Trim()));
  184. clist.Add(rsodbll.GetDeleteCommandInfo("Dsrd_Number", "=", this.listViewData.SelectedItems[0].Text.Trim()));
  185. clist.Add(rsrrbll.GetDeleteCommandInfo("DRR_Number", "=", this.listViewData.SelectedItems[0].Text.Trim()));
  186. clist.Add(rsdebll.GetDeleteCommandInfo("DDR_Number", "=", this.listViewData.SelectedItems[0].Text.Trim()));
  187. clist.Add(ptbll.GetDeleteCommandInfo("Pay_OrdNumber", "=", this.listViewData.SelectedItems[0].Text.Trim()));
  188. break;
  189. case "送洗":
  190. clist.Add(sworbll.GetDeleteCommandInfo("Dswo_Number", "=", this.listViewData.SelectedItems[0].Text.Trim()));
  191. clist.Add(swodbll.GetDeleteCommandInfo("Dswd_Number", "=", this.listViewData.SelectedItems[0].Text.Trim()));
  192. break;
  193. }
  194. string logsContent = "删除礼服" + this.listViewData.SelectedItems[0].SubItems["订单类型"].Text.Trim() + ",订单号:" + this.listViewData.SelectedItems[0].Text.Trim();
  195. clist.Add(slogbll.GetAddCommandInfo(LYFZ.BLL.BLL_ErpSystemLogs.GetWriteLogModel(LYFZ.EnumPublic.SystemLogsType.删除礼服, logsContent, LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name, StrInfoID: LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID())));
  196. if (clist.Count > 0)
  197. {
  198. if (MessageBoxCustom.Show("你确定要删除吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  199. { return; }
  200. if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
  201. {
  202. MessageBoxCustom.Show("删除成功!");
  203. this.listViewData.Items.Remove(this.listViewData.SelectedItems[0]);
  204. }
  205. else
  206. { MessageBoxCustom.Show("删除失败!"); }
  207. }
  208. }
  209. else
  210. { MessageBoxCustom.Show("您无删除权限"); return; }
  211. }
  212. }
  213. /// <summary>
  214. /// 收款
  215. /// </summary>
  216. /// <param name="sender"></param>
  217. /// <param name="e"></param>
  218. void btnPayment_Click(object sender, EventArgs e)
  219. {
  220. if (this.listViewData.Items.Count > 0 && this.listViewData.SelectedItems.Count > 0)
  221. {
  222. if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DressManagement, CustomAttributes.OperatingAuthority.ReceivablesAll))
  223. {
  224. LYFZ.Software.MainBusiness.Dresses.DressManagement.Rental.FrmPayment frm = new DressManagement.Rental.FrmPayment();
  225. frm.StrOrderNumber = this.listViewData.SelectedItems[0].Text.Trim();
  226. frm.ShowDialog();
  227. if (frm.IsSaveed)
  228. { this.PublicFunctionRows(); }
  229. else
  230. { this.listViewData.Select(); }
  231. }
  232. else
  233. { MessageBoxCustom.Show("您无收款权限"); return; }
  234. }
  235. }
  236. /// <summary>
  237. /// 退押金
  238. /// </summary>
  239. /// <param name="sender"></param>
  240. /// <param name="e"></param>
  241. void btnReturnDeposit_Click(object sender, EventArgs e)
  242. {
  243. if (this.listViewData.Items.Count > 0 && this.listViewData.SelectedItems.Count > 0)
  244. {
  245. LYFZ.Software.MainBusiness.Dresses.DressManagement.Rental.FrmRefundRecord frm = new DressManagement.Rental.FrmRefundRecord();
  246. frm.StrOrderNumber = this.listViewData.SelectedItems[0].Text.Trim();
  247. frm.ShowDialog();
  248. if (frm.IsSaveed)
  249. { this.PublicFunctionRows(); }
  250. else
  251. { this.listViewData.Select(); }
  252. }
  253. }
  254. /// <summary>
  255. /// 还回礼服
  256. /// </summary>
  257. /// <param name="sender"></param>
  258. /// <param name="e"></param>
  259. void btnReturnDress_Click(object sender, EventArgs e)
  260. {
  261. if (this.listViewData.Items.Count > 0 && this.listViewData.SelectedItems.Count > 0)
  262. {
  263. LYFZ.Software.MainBusiness.Dresses.DressManagement.Rental.FrmAlsoBack frm = new DressManagement.Rental.FrmAlsoBack();
  264. frm.StrOrderNumber = this.listViewData.SelectedItems[0].Text.Trim();
  265. frm.OrderType = this.listViewData.SelectedItems[0].SubItems["订单类型"].Text.Trim();
  266. frm.ShowDialog();
  267. if (frm.IsSaveed)
  268. { this.PublicFunctionRows(); }
  269. else
  270. { this.listViewData.Select(); }
  271. }
  272. }
  273. /// <summary>
  274. /// 导出
  275. /// </summary>
  276. /// <param name="sender"></param>
  277. /// <param name="e"></param>
  278. void btnExport_Click(object sender, EventArgs e)
  279. {
  280. this.listViewData.ListViewToDataTable(StrFileName: "礼服订单报表");
  281. }
  282. /// <summary>
  283. /// 打印
  284. /// </summary>
  285. /// <param name="sender"></param>
  286. /// <param name="e"></param>
  287. void btnPrint_Click(object sender, EventArgs e)
  288. {
  289. if (this.listViewData.Items.Count > 0 && this.listViewData.SelectedItems.Count > 0)
  290. {
  291. switch (this.listViewData.SelectedItems[0].SubItems["订单类型"].Text.Trim())
  292. {
  293. case "出租":
  294. LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(LYFZ.EnumPublic.PrintTypeEnum.礼服出租清单, this.listViewData.SelectedItems[0].Text.Trim());
  295. break;
  296. case "出售":
  297. LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(LYFZ.EnumPublic.PrintTypeEnum.礼服出售清单, this.listViewData.SelectedItems[0].Text.Trim());
  298. break;
  299. }
  300. this.listViewData.Select();
  301. }
  302. }
  303. /// <summary>
  304. /// 关闭
  305. /// </summary>
  306. /// <param name="sender"></param>
  307. /// <param name="e"></param>
  308. void btnCloseed_Click(object sender, EventArgs e)
  309. {
  310. this.Close();
  311. }
  312. /// <summary>
  313. /// 列表点击事件(判断是订单类型)
  314. /// </summary>
  315. /// <param name="sender"></param>
  316. /// <param name="e"></param>
  317. void listViewData_Click(object sender, EventArgs e)
  318. {
  319. if (this.listViewData.Items.Count > 0 && this.listViewData.SelectedItems.Count > 0)
  320. {
  321. switch (this.listViewData.SelectedItems[0].SubItems["订单类型"].Text.Trim())
  322. {
  323. case "出租":
  324. this.btnPayment.Enabled = true;
  325. this.btnReturnDeposit.Enabled = true;
  326. this.btnPrint.Enabled = true;
  327. this.btnReturnDress.Enabled = true;
  328. break;
  329. case "出售":
  330. this.btnPayment.Enabled = true;
  331. this.btnReturnDeposit.Enabled = false;
  332. this.btnPrint.Enabled = true;
  333. this.btnReturnDress.Enabled = false;
  334. break;
  335. case "预选":
  336. this.btnPayment.Enabled = false;
  337. this.btnReturnDeposit.Enabled = false;
  338. this.btnPrint.Enabled = false;
  339. this.btnReturnDress.Enabled = false;
  340. break;
  341. case "送洗":
  342. this.btnPayment.Enabled = false;
  343. this.btnReturnDeposit.Enabled = false;
  344. this.btnReturnDress.Enabled = true;
  345. this.btnPrint.Enabled = false;
  346. break;
  347. }
  348. }
  349. }
  350. /// <summary>
  351. /// 点击排序
  352. /// </summary>
  353. /// <param name="sender"></param>
  354. /// <param name="e"></param>
  355. void listViewData_ColumnClick(object sender, ColumnClickEventArgs e)
  356. {
  357. // 检查点击的列是不是现在的排序列.
  358. if (e.Column == lvwColumnSorter.SortColumn)
  359. {
  360. // 重新设置此列的排序方法.
  361. if (lvwColumnSorter.Order == SortOrder.Ascending)
  362. { lvwColumnSorter.Order = SortOrder.Descending; }
  363. else
  364. { lvwColumnSorter.Order = SortOrder.Ascending; }
  365. }
  366. else
  367. {
  368. // 设置排序列,默认为正向排序
  369. lvwColumnSorter.SortColumn = e.Column;
  370. lvwColumnSorter.Order = SortOrder.Ascending;
  371. }
  372. // 用新的排序方法对ListView排序
  373. this.listViewData.Sort();
  374. //LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData);
  375. for (int i = 0; i < this.listViewData.Items.Count; i++)
  376. {
  377. if ((i % 2) > 0)
  378. { this.listViewData.Items[i].BackColor = System.Drawing.Color.PapayaWhip; }
  379. else
  380. { this.listViewData.Items[i].BackColor = System.Drawing.Color.PowderBlue; }
  381. if (this.listViewData.Items[i].SubItems["欠款金额"] != null)
  382. {
  383. if (Convert.ToDecimal(this.listViewData.Items[i].SubItems["欠款金额"].Text.Trim()) > 0)
  384. { this.listViewData.Items[i].SubItems["欠款金额"].ForeColor = Color.Red; }
  385. }
  386. if (this.listViewData.Items[i].SubItems["应收押金"] != null && this.listViewData.Items[i].SubItems["已收押金"] != null)
  387. {
  388. if ((Convert.ToDecimal(this.listViewData.Items[i].SubItems["应收押金"].Text.Trim()) - Convert.ToDecimal(this.listViewData.Items[i].SubItems["已收押金"].Text.Trim())) > 0)
  389. { this.listViewData.Items[i].SubItems["已收押金"].ForeColor = Color.Red; }
  390. }
  391. }
  392. }
  393. /// <summary>
  394. /// 列表双击事件
  395. /// </summary>
  396. /// <param name="sender"></param>
  397. /// <param name="e"></param>
  398. void listViewData_MouseDoubleClick(object sender, MouseEventArgs e)
  399. {
  400. if (this.listViewData.Items.Count > 0 && this.listViewData.SelectedItems.Count > 0)
  401. { this.btnReservation_Click(this, null); }
  402. }
  403. /// <summary>
  404. /// 出租
  405. /// </summary>
  406. /// <param name="sender"></param>
  407. /// <param name="e"></param>
  408. void chkOutRent_Click(object sender, EventArgs e)
  409. {
  410. this.chkOutSale.Checked = false;
  411. this.chkSendWash.Checked = false;
  412. this.chkPreselected.Checked = false;
  413. this.chkArrears.Enabled = true;
  414. this.btnPayment.Enabled = true;
  415. this.btnReturnDeposit.Enabled = true;
  416. this.btnPrint.Enabled = true;
  417. this.btnReturnDress.Enabled = true;
  418. this.PublicFunctionRows();
  419. }
  420. /// <summary>
  421. /// 出售
  422. /// </summary>
  423. /// <param name="sender"></param>
  424. /// <param name="e"></param>
  425. void chkOutSale_Click(object sender, EventArgs e)
  426. {
  427. this.chkOutRent.Checked = false;
  428. this.chkSendWash.Checked = false;
  429. this.chkPreselected.Checked = false;
  430. this.chkArrears.Enabled = true;
  431. this.btnPayment.Enabled = true;
  432. this.btnReturnDeposit.Enabled = false;
  433. this.btnPrint.Enabled = true;
  434. this.btnReturnDress.Enabled = false;
  435. this.PublicFunctionRows();
  436. }
  437. /// <summary>
  438. /// 预选
  439. /// </summary>
  440. /// <param name="sender"></param>
  441. /// <param name="e"></param>
  442. void chkPreselected_Click(object sender, EventArgs e)
  443. {
  444. this.chkSendWash.Checked = false;
  445. this.chkOutRent.Checked = false;
  446. this.chkOutSale.Checked = false;
  447. if (this.chkPreselected.Checked)
  448. {
  449. this.chkArrears.Checked = false;
  450. this.chkArrears.Enabled = false;
  451. this.btnPayment.Enabled = false;
  452. this.btnReturnDeposit.Enabled = false;
  453. this.btnPrint.Enabled = false;
  454. this.btnReturnDress.Enabled = false;
  455. }
  456. else
  457. {
  458. this.chkArrears.Enabled = true;
  459. this.btnPayment.Enabled = true;
  460. this.btnReturnDeposit.Enabled = true;
  461. this.btnPrint.Enabled = true;
  462. this.btnReturnDress.Enabled = true;
  463. }
  464. this.PublicFunctionRows();
  465. }
  466. /// <summary>
  467. /// 送洗
  468. /// </summary>
  469. /// <param name="sender"></param>
  470. /// <param name="e"></param>
  471. void chkSendWash_Click(object sender, EventArgs e)
  472. {
  473. this.chkOutRent.Checked = false;
  474. this.chkOutSale.Checked = false;
  475. this.chkPreselected.Checked = false;
  476. if (this.chkSendWash.Checked)
  477. {
  478. this.chkArrears.Checked = false;
  479. this.chkArrears.Enabled = false;
  480. this.btnPayment.Enabled = false;
  481. this.btnReturnDeposit.Enabled = false;
  482. this.btnReturnDress.Enabled = true;
  483. this.btnPrint.Enabled = false;
  484. }
  485. else
  486. {
  487. this.chkArrears.Enabled = true;
  488. this.btnPayment.Enabled = true;
  489. this.btnReturnDeposit.Enabled = true;
  490. this.btnReturnDress.Enabled = true;
  491. this.btnPrint.Enabled = true;
  492. }
  493. this.PublicFunctionRows();
  494. }
  495. /// <summary>
  496. /// 欠款
  497. /// </summary>
  498. /// <param name="sender"></param>
  499. /// <param name="e"></param>
  500. void chkArrears_Click(object sender, EventArgs e)
  501. {
  502. this.PublicFunctionRows();
  503. }
  504. /// <summary>
  505. /// 显示完成订单
  506. /// </summary>
  507. /// <param name="sender"></param>
  508. /// <param name="e"></param>
  509. void chkShowCompleteOrder_Click(object sender, EventArgs e)
  510. {
  511. this.PublicFunctionRows();
  512. }/// <summary>
  513. /// 显示数字
  514. /// </summary>
  515. /// <param name="sender"></param>
  516. /// <param name="e"></param>
  517. void txtDreesDay_KeyPress(object sender, KeyPressEventArgs e)
  518. {
  519. if (e.KeyChar != 8 && !Char.IsDigit(e.KeyChar))
  520. { e.Handled = true; }
  521. }
  522. /// <summary>
  523. /// 窗体大小发生变化
  524. /// </summary>
  525. /// <param name="sender"></param>
  526. /// <param name="e"></param>
  527. void DressOrderReportFormMain_Resize(object sender, EventArgs e)
  528. {
  529. switch (this.panelShowCompleteOrder.Location.Y)
  530. {
  531. case 3: this.flowLayoutPanel1.Height = 34; break;
  532. case 37: this.flowLayoutPanel1.Height = 68; break;
  533. case 71: this.flowLayoutPanel1.Height = 102; break;
  534. }
  535. }
  536. /// <summary>
  537. /// 创建行
  538. /// </summary>
  539. private void PublicFunctionRows()
  540. {
  541. this.ucPagerEx1.PageCurrent = 1;
  542. this.ucPagerEx1.PageSize = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPageSize();//3;分页条数
  543. this.ucPagerEx1.Bind();
  544. }
  545. /// <summary>
  546. /// 画分页
  547. /// </summary>
  548. /// <param name="e"></param>
  549. /// <returns></returns>
  550. private int UcPagerEx1_EventPaging(UCPager.EventPagingArg e)
  551. {
  552. this.listViewData.Clear();
  553. LYFZ.UCPager.PageData pageData = new LYFZ.UCPager.PageData();
  554. pageData.TableName = "BView_DressOrderReport";
  555. pageData.PageIndex = this.ucPagerEx1.PageCurrent;
  556. pageData.PageSize = this.ucPagerEx1.PageSize;
  557. pageData.QueryCondition = GetWhereStr();
  558. pageData.OrderStr = "录单时间 DESC";
  559. pageData.QueryFieldName = GetFieldName();
  560. DataTable dt = new DataTable();
  561. this.listViewData.BeginUpdate();
  562. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  563. {
  564. dt = pageData.QueryDataTable().Tables[0];
  565. try
  566. {
  567. this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate()
  568. {
  569. for (int i = 0; i < dt.Columns.Count; i++)
  570. {
  571. ColumnHeader ch = new ColumnHeader();
  572. ch.Text = dt.Columns[i].ColumnName.Trim();
  573. ch.TextAlign = HorizontalAlignment.Left;
  574. switch (dt.Columns[i].ColumnName.Trim())
  575. {
  576. case "订单号": ch.Width = 100; break;
  577. case "录单时间": ch.Width = 150; break;
  578. case "订单备注": ch.Width = 200; break;
  579. default: ch.Width = 100; break;
  580. }
  581. switch (dt.Columns[i].ColumnName.Trim())
  582. {
  583. case "应付金额":
  584. case "已付金额":
  585. case "欠款金额":
  586. case "应收押金":
  587. case "已收押金":
  588. case "未退押金":
  589. ch.TextAlign = HorizontalAlignment.Right;
  590. break;
  591. case "客户性别":
  592. case "取衣时间":
  593. case "还衣时间":
  594. case "录单时间":
  595. case "订单类型":
  596. case "是否还衣":
  597. ch.TextAlign = HorizontalAlignment.Center;
  598. break;
  599. default:
  600. ch.TextAlign = HorizontalAlignment.Left;
  601. break;
  602. }
  603. this.listViewData.Columns.Add(ch);
  604. }
  605. try
  606. {
  607. for (int i = 0; i < dt.Rows.Count; i++)
  608. {
  609. ListViewItem lvItem = new ListViewItem();
  610. ListViewItem.ListViewSubItem ListSubItem = null;
  611. if ((i % 2) > 0)
  612. { lvItem.BackColor = System.Drawing.Color.PapayaWhip; }
  613. else
  614. { lvItem.BackColor = System.Drawing.Color.PowderBlue; }
  615. for (int j = 0; j < dt.Columns.Count; j++)
  616. {
  617. ListSubItem = new ListViewItem.ListViewSubItem();
  618. if (j == 0)
  619. { lvItem.Text = dt.Rows[i][j].ToString().Trim(); }
  620. else
  621. {
  622. ListSubItem.Name = dt.Columns[j].ColumnName.Trim();
  623. ListSubItem.Text = dt.Rows[i][j].ToString().Trim();
  624. if (dt.Columns[j].ColumnName.Trim() == "欠款金额")
  625. {
  626. if (Convert.ToDecimal(dt.Rows[i]["欠款金额"]) > 0)
  627. { lvItem.ForeColor = Color.Red; }
  628. }
  629. else if (dt.Columns[j].ColumnName.Trim() == "已收押金")
  630. {
  631. if ((Convert.ToDecimal(dt.Rows[i]["应收押金"]) - Convert.ToDecimal(dt.Rows[i]["已收押金"])) > 0)
  632. { lvItem.ForeColor = Color.Red; }
  633. }
  634. lvItem.SubItems.Add(ListSubItem);
  635. }
  636. }
  637. this.listViewData.Items.Add(lvItem);
  638. }
  639. }
  640. catch (Exception ex)
  641. { MessageBoxCustom.Show(ex.Message.Trim()); }
  642. }));
  643. }
  644. catch
  645. { }
  646. });
  647. this.listViewData.EndUpdate();
  648. try
  649. {
  650. this.ucPagerEx1.TbDataSource = dt;
  651. }
  652. catch { }
  653. //LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData);
  654. return pageData.TotalCount;
  655. }
  656. /// <summary>
  657. /// 查询要获取的字段
  658. /// </summary>
  659. /// <returns></returns>
  660. private string GetFieldName()
  661. {
  662. string autoNumber = "";
  663. if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.AutoDressOrderNumber)
  664. {
  665. autoNumber = "用户单号,";
  666. }
  667. if (this.chkSendWash.Checked)
  668. { return "订单号," + autoNumber + "订单类型,取衣时间,还衣时间,是否还衣,订单状态,录单人员,录单时间,订单备注"; }
  669. else if (this.chkPreselected.Checked)
  670. { return "订单号," + autoNumber + "客户姓名,客户电话,订单类型,接单人,订单状态,录单人员,录单时间,订单备注"; }
  671. else
  672. { return "订单号," + autoNumber + "客户姓名,客户电话,订单类型,应付金额,已付金额,欠款金额,应收押金,已收押金,未退押金,取衣时间,还衣时间,是否还衣,订单状态,接单人,录单人员,录单时间,订单备注"; }
  673. }
  674. /// <summary>
  675. /// 返回要操作的条件
  676. /// </summary>
  677. /// <returns></returns>
  678. private string GetWhereStr()
  679. {
  680. string StrWhere = " 1=1 ";
  681. string StrText = this.cmbTextQuery.Text.Trim();
  682. #region 查询条件
  683. if (StrText != "")
  684. {
  685. Hashtable htData = new Hashtable();
  686. htData["订单号"] = "";
  687. htData["客户姓名"] = "";
  688. htData["客户拼音"] = "";
  689. htData["客户电话"] = "";
  690. bool Isbl = true;
  691. if (LYFZ.Command.Command_Validate.IsNumber(StrText))
  692. {
  693. htData["客户电话"] = "1";
  694. Isbl = false;
  695. }
  696. else if (LYFZ.Command.Command_Validate.IsEnglish(StrText))
  697. {
  698. htData["订单号"] = "1";
  699. htData["客户拼音"] = "1";
  700. Isbl = false;
  701. }
  702. else if (LYFZ.Command.Command_Validate.IsChinese(StrText))
  703. {
  704. htData["客户姓名"] = "1";
  705. Isbl = false;
  706. }
  707. else if (Isbl)
  708. {
  709. htData["订单号"] = "1";
  710. htData["客户姓名"] = "1";
  711. htData["客户拼音"] = "1";
  712. htData["客户电话"] = "1";
  713. }
  714. string strV = "";
  715. int i = 0;
  716. foreach (DictionaryEntry dic in htData)
  717. {
  718. if (dic.Value.ToString().Trim() != "")
  719. {
  720. if (i == 0)
  721. { strV += dic.Key + " like '%" + StrText + "%'"; }
  722. else
  723. { strV += " or " + dic.Key + " like '%" + StrText + "%'"; }
  724. i++;
  725. }
  726. }
  727. if (strV != "")
  728. { StrWhere += " and (" + strV + ")"; }
  729. }
  730. else
  731. {
  732. if (!this.chkShowCompleteOrder.Checked)
  733. { StrWhere += " And 订单状态 = '未完' "; }
  734. else
  735. { StrWhere += " And 订单状态 = 'OK' "; }
  736. }
  737. #endregion
  738. if (this.chkOutRent.Checked)
  739. { StrWhere += " And 订单类型 = '出租'"; }
  740. else if (this.chkOutSale.Checked)
  741. { StrWhere += " And 订单类型 = '出售'"; }
  742. else if (this.chkPreselected.Checked)
  743. { StrWhere += " And 订单类型 = '预选'"; }
  744. else if (this.chkSendWash.Checked)
  745. { StrWhere += " And 订单类型 = '送洗'"; }
  746. if (this.chkArrears.Checked)
  747. { StrWhere += " And 欠款金额 > 0"; }
  748. if (this.txtDreesDay.Text.Trim().Length > 0 && this.cmbtreevDressStatus.Text.Trim().Length > 0)
  749. {
  750. switch (this.cmbtreevDressStatus.Text.Trim())
  751. {
  752. case "取衣":
  753. StrWhere += " And (DATEDIFF(day, GETDATE(), 取衣时间) between 0 and " + Convert.ToInt32(this.txtDreesDay.Text) + ")";
  754. break;
  755. case "还衣":
  756. StrWhere += " And (DATEDIFF(day, GETDATE(), 还衣时间) between 0 And " + Convert.ToInt32(this.txtDreesDay.Text) + ") And 是否还衣 = '未还'";
  757. break;
  758. }
  759. }
  760. return StrWhere;
  761. }
  762. }
  763. }