FrmDressRental.cs 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018
  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. namespace LYFZ.Software.MainBusiness.Dresses.DressManagement.Rental
  10. {
  11. public partial class FrmDressRental : LYFZ.Software.UI.Dresses.DressManagement.Rental.FrmDressRental
  12. {
  13. LYFZ.BLL.BLL_ErpDressSaleRentalOrder DressSaleRentalOrderBll = new BLL.BLL_ErpDressSaleRentalOrder();
  14. LYFZ.BLL.BLL_ErpDressFrom DressFromBll = new BLL.BLL_ErpDressFrom();
  15. bool bl = false;
  16. public string Dsfm_DressNumber;
  17. public string PreselectedNumber_OK;
  18. public FrmDressRental()
  19. {
  20. this.FormClosed += FrmDressRental_FormClosed;
  21. }
  22. void FrmDressRental_FormClosed(object sender, FormClosedEventArgs e)
  23. {
  24. if (bl)
  25. {
  26. this.DialogResult = DialogResult.OK;
  27. }
  28. }
  29. #region 加载
  30. protected override void FrmDressRental_Shown(object sender, EventArgs e)
  31. {
  32. try
  33. {
  34. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.HidePhoneControls(this.txtCus_Telephone);
  35. #region 部门人员绑定
  36. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.txtDsro_CreateName, IsFirstNodeNull: true);
  37. //LYFZ.BLL.BLL_ErpDepartment BLLerpdepartment = new BLL.BLL_ErpDepartment();
  38. //DataTable tbl = BLLerpdepartment.GetAllList().Tables[0];
  39. //if (tbl.Rows.Count > 0)
  40. //{
  41. // TreeNode root = null;
  42. // for (int i = 0; i < tbl.Rows.Count; i++)
  43. // {
  44. // root = new TreeNode(tbl.Rows[i]["Dt_Name"].ToString());
  45. // this.CreateTreeViewDepartmentUser(root.Nodes, tbl.Rows[i]["ID"].ToString());
  46. // this.txtDsro_CreateName.TreeView.Nodes.Add(root);
  47. // }
  48. //}
  49. #endregion
  50. DataTable dt = new DataTable();
  51. if (!string.IsNullOrEmpty(PreselectedNumber_OK))
  52. {
  53. #region 获取已预选
  54. #region 隐藏
  55. btnCusSelect.Enabled = false;
  56. txtDsro_Amount.Text = "";
  57. txtDsro_MortgageAmount.Text = "";
  58. txtDsro_Remark.Text = "";
  59. txtDsro_CreateName.Text = "";
  60. txtDsro_CreateDateTime.Text = "";
  61. txtDsro_TakeDressTime.Text = "";
  62. txtDsro_ReservationBackTime.Text = "";
  63. txtCus_Name.Text = "";
  64. txtCus_Name.ReadOnly = true;
  65. txtCus_Telephone.Text = "";
  66. txtCus_Telephone.ReadOnly = true;
  67. txtCus_QQ.Text = "";
  68. txtCus_QQ.ReadOnly = true;
  69. txtCus_Address.Text = "";
  70. txtCus_Address.ReadOnly = true;
  71. txtCus_WorkUnit.Text = "";
  72. txtCus_WorkUnit.ReadOnly = true;
  73. txtCus_Birthday.Text = "";
  74. txtCus_Birthday.Enabled = false;
  75. chkCus_BirthdayLunar.Checked = false;
  76. chkCus_BirthdayLunar.Enabled = false;
  77. txtCus_DayForMarriage.Text = "";
  78. txtCus_DayForMarriage.Enabled = false;
  79. chkCus_DayForMarriageLunar.Checked = false;
  80. chkCus_DayForMarriageLunar.Enabled = false;
  81. txtCus_CustomerNumber.Text = "";
  82. txtDsro_CreateName.Enabled = false;
  83. #endregion
  84. #region 获取预选资料
  85. dt = DressSaleRentalOrderBll.View_DressSaleRentalOrder(" and Dsro_Number='" + PreselectedNumber_OK + "'").Tables[0];
  86. if (dt.Rows.Count > 0)
  87. {
  88. txtDsro_Number.Text = dt.Rows[0]["Dsro_Number"].ToString();
  89. txtDsro_Amount.Text = dt.Rows[0]["Dsro_Amount"].ToString();
  90. txtDsro_MortgageAmount.Text = dt.Rows[0]["Dsro_MortgageAmount"].ToString();
  91. txtDsro_CreateName.TagFindText(dt.Rows[0]["Dsro_CreateName"].ToString());
  92. txtDsro_HandledName.Text = dt.Rows[0]["经手人"].ToString();
  93. txtDsro_CreateDateTime.Text = Convert.ToDateTime(dt.Rows[0]["Dsro_CreateDateTime"]).ToString("yyyy-MM-dd");
  94. txtDsro_Remark.Text = dt.Rows[0]["Dsro_Remark"].ToString();
  95. txtDsro_TakeDressTime.Text = "";
  96. txtDsro_ReservationBackTime.Text = "";
  97. }
  98. #endregion
  99. #region 获取礼服资料
  100. if (!string.IsNullOrEmpty(Dsfm_DressNumber))
  101. {
  102. string[] Dsfm_DressNumbers = Dsfm_DressNumber.Split(',');
  103. for (int t = 0; t < Dsfm_DressNumbers.Length; t++)
  104. {
  105. dt = DressFromBll.View_tb_ErpDressFrom(" and Dsfm_DressNumber='" + Dsfm_DressNumbers[t] + "'").Tables[0];
  106. #region
  107. DataGridViewRow dgvr = new DataGridViewRow();
  108. DataGridViewCell cell = null;
  109. cell = new DataGridViewTextBoxCell();
  110. cell.Value = dt.Rows[0]["Dsfm_DressNumber"].ToString().Trim();
  111. dgvr.Cells.Add(cell);
  112. cell = new DataGridViewTextBoxCell();
  113. cell.Value = dt.Rows[0]["Dsfm_DressName"].ToString().Trim();
  114. dgvr.Cells.Add(cell);
  115. cell = new DataGridViewTextBoxCell();
  116. cell.Value = "1";
  117. dgvr.Cells.Add(cell);
  118. cell = new DataGridViewTextBoxCell();
  119. cell.Value = dt.Rows[0]["Dsfm_RentPrice"].ToString().Trim();
  120. dgvr.Cells.Add(cell);
  121. cell = new DataGridViewTextBoxCell();
  122. cell.Value = dt.Rows[0]["Dsfm_SalePrice"].ToString().Trim();
  123. dgvr.Cells.Add(cell);
  124. cell = new DataGridViewTextBoxCell();
  125. cell.Value = dt.Rows[0]["Dsfm_CostPrice"].ToString().Trim();
  126. dgvr.Cells.Add(cell);
  127. this.dgv.Rows.Add(dgvr);
  128. #endregion
  129. }
  130. dgv.ClearSelection();
  131. }
  132. #endregion
  133. #region 获取客户资料
  134. dt = new DataTable();
  135. LYFZ.BLL.BLL_ErpCustomer CustomerBll = new BLL.BLL_ErpCustomer();
  136. dt = CustomerBll.View_tb_ErpCustomer(" and Cus_CustomerNumber='" + DressSaleRentalOrderBll.View_DressSaleRentalOrder(" and Dsro_Number='" + PreselectedNumber_OK + "'").Tables[0].Rows[0]["Dsro_CustomerNumber"] + "'").Tables[0];
  137. txtCus_Name.Text = dt.Rows[0]["Cus_Name"].ToString();
  138. txtCus_Telephone.Text = dt.Rows[0]["Cus_Telephone"].ToString();
  139. txtCus_QQ.Text = dt.Rows[0]["Cus_QQ"].ToString();
  140. txtCus_Address.Text = dt.Rows[0]["Cus_Address"].ToString();
  141. txtCus_WorkUnit.Text = dt.Rows[0]["Cus_WorkUnit"].ToString();
  142. txtCus_Birthday.Text = dt.Rows[0]["Cus_Birthday"].ToString();
  143. string Cus_BirthdayLunar = dt.Rows[0]["Cus_BirthdayLunar"].ToString();
  144. if (Cus_BirthdayLunar.ToString() == "1")
  145. {
  146. chkCus_BirthdayLunar.Checked = true;
  147. }
  148. txtCus_DayForMarriage.Text = dt.Rows[0]["Cus_DayForMarriage"].ToString();
  149. string Cus_DayForMarriageLunar = dt.Rows[0]["Cus_DayForMarriageLunar"].ToString();
  150. if (Cus_DayForMarriageLunar.ToString() == "1")
  151. { chkCus_DayForMarriageLunar.Checked = true; }
  152. txtCus_CustomerNumber.Text = dt.Rows[0]["Cus_CustomerNumber"].ToString();
  153. #endregion
  154. #endregion
  155. }
  156. else
  157. {
  158. #region 无预选
  159. txtDsro_HandledName.Text = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name;
  160. txtDsro_CreateDateTime.Text = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().ToString("yyyy-MM-dd");
  161. #region 获取单号
  162. BindDsro_Number();
  163. #endregion
  164. #region 获取礼服资料
  165. if (!string.IsNullOrEmpty(Dsfm_DressNumber))
  166. {
  167. string[] Dsfm_DressNumbers = Dsfm_DressNumber.Split(',');
  168. for (int t = 0; t < Dsfm_DressNumbers.Length; t++)
  169. {
  170. dt = DressFromBll.View_tb_ErpDressFrom(" and Dsfm_DressNumber='" + Dsfm_DressNumbers[t] + "'").Tables[0];
  171. #region
  172. DataGridViewRow dgvr = new DataGridViewRow();
  173. DataGridViewCell cell = null;
  174. cell = new DataGridViewTextBoxCell();
  175. cell.Value = dt.Rows[0]["Dsfm_DressNumber"].ToString().Trim();
  176. dgvr.Cells.Add(cell);
  177. cell = new DataGridViewTextBoxCell();
  178. cell.Value = dt.Rows[0]["Dsfm_DressName"].ToString().Trim();
  179. dgvr.Cells.Add(cell);
  180. cell = new DataGridViewTextBoxCell();
  181. cell.Value = "1";
  182. dgvr.Cells.Add(cell);
  183. cell = new DataGridViewTextBoxCell();
  184. cell.Value = dt.Rows[0]["Dsfm_RentPrice"].ToString().Trim();
  185. dgvr.Cells.Add(cell);
  186. cell = new DataGridViewTextBoxCell();
  187. cell.Value = dt.Rows[0]["Dsfm_SalePrice"].ToString().Trim();
  188. dgvr.Cells.Add(cell);
  189. cell = new DataGridViewTextBoxCell();
  190. cell.Value = dt.Rows[0]["Dsfm_CostPrice"].ToString().Trim();
  191. dgvr.Cells.Add(cell);
  192. this.dgv.Rows.Add(dgvr);
  193. #endregion
  194. }
  195. dgv.ClearSelection();
  196. }
  197. #endregion
  198. #endregion
  199. }
  200. }
  201. catch (Exception ex)
  202. {
  203. MessageBoxCustom.Show(ex.Message);
  204. }
  205. }
  206. #region 获取礼服订单单号
  207. /// <summary>
  208. /// 获取礼服订单单号
  209. /// </summary>
  210. public void BindDsro_Number()
  211. {
  212. DataTable dt = new DataTable();
  213. //获取最大编号
  214. LYFZ.BLL.BLL_ErpDressSaleRentalOrder DressSaleRentalOrderbll = new BLL.BLL_ErpDressSaleRentalOrder();
  215. dt = DressSaleRentalOrderbll.GetAllList().Tables[0];
  216. if (dt.Rows.Count > 0)
  217. {
  218. int Count = Convert.ToInt32(DressSaleRentalOrderbll.Get_Max_Dsro_Number());
  219. this.txtDsro_Number.Text = "LFDH00" + Convert.ToInt32(Count + 1);
  220. }
  221. else
  222. {
  223. this.txtDsro_Number.Text = "LFDH001";
  224. }
  225. }
  226. #endregion
  227. #endregion
  228. #region dgv事件
  229. protected override void dgv_Click(object sender, EventArgs e)
  230. {
  231. if (dgv.Rows.Count > 0)
  232. {
  233. LYFZ.BLL.BLL_ErpDressFrom DressFromBll = new BLL.BLL_ErpDressFrom();
  234. DataTable dt = new DataTable();
  235. string Dsfm_DressNumber = dgv.CurrentRow.Cells["Dsfm_DressNumber"].Value.ToString();
  236. dt = DressFromBll.View_tb_ErpDressFrom(" and Dsfm_DressNumber='" + Dsfm_DressNumber + "'").Tables[0];
  237. if (dt.Rows.Count > 0)
  238. {
  239. string dressFromPath = BLL.BLL_ErpDressFrom.GetDressFromPath() + "\\" + dt.Rows[0]["Dsfm_PicturePath"];
  240. if (System.IO.File.Exists(dressFromPath))
  241. {
  242. picDsfm_PicturePath.Image = Image.FromFile(dressFromPath);
  243. }
  244. }
  245. }
  246. }
  247. #endregion
  248. #region 保存
  249. protected override void btnSave_Click(object sender, EventArgs e)
  250. {
  251. try
  252. {
  253. LYFZ.BLL.BLL_ErpOrder Orderbll = new LYFZ.BLL.BLL_ErpOrder();
  254. LYFZ.BLL.BLL_ErpDressSaleRentalOrder DressSaleRentalOrderBll = new BLL.BLL_ErpDressSaleRentalOrder();
  255. LYFZ.Model.Model_ErpDressSaleRentalOrder DressSaleRentalOrderModel = new Model.Model_ErpDressSaleRentalOrder();
  256. LYFZ.BLL.BLL_ErpDressSaleRentalDetail DressSaleRentalDetailBll = new BLL.BLL_ErpDressSaleRentalDetail();
  257. LYFZ.Model.Model_ErpDressSaleRentalDetail DressSaleRentalDetailModel = new Model.Model_ErpDressSaleRentalDetail();
  258. LYFZ.BLL.BLL_ErpDressFrom DressFromBll = new BLL.BLL_ErpDressFrom();
  259. LYFZ.Model.Model_ErpDressFrom DressFromModel = null;
  260. LYFZ.BLL.BLL_ErpSystemConfigure SystemConfigureBll = new BLL.BLL_ErpSystemConfigure();
  261. string ty = "";
  262. if (string.IsNullOrEmpty(txtDsro_TakeDressTime.DateValue))
  263. {
  264. MessageBoxCustom.Show("取衣时间不能为空!");
  265. return;
  266. }
  267. #region 判断礼服是否撞期
  268. if (dgv.Rows.Count > 0)
  269. {
  270. DataTable dt_DressSaleRentalDetail = Orderbll.GetView_Custom("View_DressSaleRentalDetail", StrWhere: "Dsro_Type='0' and Dsrd_BackStatus='3'", ShowColumnName: "Id,Dsrd_Number,Dsrd_DressNumber,Dsrd_DressName,Dsrd_SaleRentalQuantity,Dsrd_CostPrice,Dsrd_SalePrice,Dsrd_BackTime,Dsrd_BackStatus,Dsrd_BackRemark,Dsrd_CreateDateTime,Dsrd_CreateName,Dsrd_UpdateDateTime,Dsrd_UpdateName,Dsro_Number,Dsro_Type,Dsro_Amount,Dsro_MortgageAmount,Dsro_CustomerNumber,Dsro_TakeDressTime,Dsro_ReservationBackTime,Dsro_Remark,Dsro_CreateDateTime,Dsro_CreateName,Dsro_UpdateDateTime,Dsro_UpdateName,Cus_Name,还衣天数,还衣天数取衣日期,还衣天数加还衣日期,Dsfm_RentPrice").Tables[0];
  271. for (int i = 0; i < dgv.Rows.Count; i++)
  272. {
  273. //选择取衣时间
  274. DateTime TakeClothesTime = Convert.ToDateTime(txtDsro_TakeDressTime.DateValue);
  275. //礼服编号
  276. string Dsfm_DressNumber = dgv.Rows[i].Cells["Dsfm_DressNumber"].Value.ToString();
  277. DataRow[] row_DSRD = dt_DressSaleRentalDetail.Select(" Dsrd_DressNumber='" + Dsfm_DressNumber + "' ");
  278. if (row_DSRD.Length > 0)
  279. {
  280. for (int t = 0; t < row_DSRD.Length; t++)
  281. {
  282. DateTime StarTime = Convert.ToDateTime(row_DSRD[t]["还衣天数取衣日期"]);
  283. DateTime StarEnd = Convert.ToDateTime(row_DSRD[t]["还衣天数加还衣日期"]);
  284. if (TakeClothesTime >= StarTime && TakeClothesTime <= StarEnd)
  285. {
  286. ty = "1";
  287. }
  288. }
  289. if (ty == "1")
  290. {
  291. MessageBoxCustom.Show("(礼服编号:" + Dsfm_DressNumber + " " + " 礼服名称:" + dgv.Rows[i].Cells["Dsfm_DressName"].Value.ToString() + ") 已经撞期,无法租售");
  292. return;
  293. }
  294. }
  295. }
  296. }
  297. #endregion
  298. #region 出租
  299. if (radRent.Checked == true)
  300. {
  301. #region 判断输入框不能为空
  302. if (string.IsNullOrEmpty(txtDsro_Number.Text))
  303. {
  304. MessageBoxCustom.Show("单号不能为空!");
  305. return;
  306. }
  307. if (dgv.Rows.Count == 0)
  308. {
  309. MessageBoxCustom.Show("礼服资料不能为空!请选择礼服!");
  310. return;
  311. }
  312. if (string.IsNullOrEmpty(txtDsro_Amount.Text))
  313. {
  314. MessageBoxCustom.Show("金额不能为空!");
  315. return;
  316. }
  317. if (string.IsNullOrEmpty(txtDsro_MortgageAmount.Text))
  318. {
  319. MessageBoxCustom.Show("押金不能为空!");
  320. return;
  321. }
  322. if (string.IsNullOrEmpty(txtDsro_CreateName.Text.Trim()))
  323. {
  324. MessageBoxCustom.Show("销售人员不能为空!");
  325. return;
  326. }
  327. if (string.IsNullOrEmpty(txtCus_Name.Text))
  328. {
  329. MessageBoxCustom.Show("客户名称不能为空!");
  330. return;
  331. }
  332. if (string.IsNullOrEmpty(txtCus_Telephone.Text))
  333. {
  334. MessageBoxCustom.Show("客户电话不能为空!");
  335. return;
  336. }
  337. if (string.IsNullOrEmpty(txtDsro_ReservationBackTime.DateValue))
  338. {
  339. MessageBoxCustom.Show("还回时间不能为空!");
  340. return;
  341. }
  342. if (!string.IsNullOrEmpty(txtDsro_TakeDressTime.DateValue) && !string.IsNullOrEmpty(txtDsro_ReservationBackTime.DateValue))
  343. {
  344. if (Convert.ToDateTime(txtDsro_TakeDressTime.DateValue) > Convert.ToDateTime(txtDsro_ReservationBackTime.DateValue))
  345. {
  346. MessageBoxCustom.Show("取衣时间必须小于还衣时间!");
  347. return;
  348. }
  349. }
  350. int intMasse = this.txtCus_Birthday.CheckDateValue(this.txtCus_Birthday, chkCus_BirthdayLunar);
  351. if (intMasse == 1) { MessageBoxCustom.Show("生日日期日期格式输入错误"); return; }
  352. else if (intMasse == 2)
  353. { MessageBoxCustom.Show("生日日期:" + this.txtCus_Birthday.StrValue.Trim() + "不是公历日期,若要保存请勾上农历"); return; }
  354. intMasse = this.txtCus_DayForMarriage.CheckDateValue(this.txtCus_DayForMarriage, chkCus_DayForMarriageLunar);
  355. if (intMasse == 1) { MessageBoxCustom.Show("婚期日期日期格式输入错误"); return; }
  356. else if (intMasse == 2)
  357. { MessageBoxCustom.Show("婚期日期:" + this.txtCus_DayForMarriage.StrValue.Trim() + "不是公历日期,若要保存请勾上农历"); return; }
  358. #endregion
  359. #region 出租
  360. if (!string.IsNullOrEmpty(PreselectedNumber_OK))
  361. {
  362. DataTable dt = DressSaleRentalOrderBll.GetList(" Dsro_Number='" + PreselectedNumber_OK + "'").Tables[0];
  363. DressSaleRentalOrderModel = DressSaleRentalOrderBll.GetModel(Convert.ToInt32(dt.Rows[0]["ID"]));
  364. #region 修改礼服租售订单表
  365. DressSaleRentalOrderModel.Dsro_Type = "0";
  366. DressSaleRentalOrderModel.Dsro_Amount = Convert.ToDecimal(txtDsro_Amount.Text == "" ? "0.00" : txtDsro_Amount.Text);
  367. DressSaleRentalOrderModel.Dsro_MortgageAmount = Convert.ToDecimal(txtDsro_MortgageAmount.Text == "" ? "0.00" : txtDsro_MortgageAmount.Text);
  368. DressSaleRentalOrderModel.Dsro_TakeDressTime = Convert.ToDateTime(txtDsro_TakeDressTime.DateValue.ToString());
  369. DressSaleRentalOrderModel.Dsro_ReservationBackTime = Convert.ToDateTime(txtDsro_ReservationBackTime.DateValue); ;
  370. DressSaleRentalOrderModel.Dsro_Remark = txtDsro_Remark.Text.Trim();
  371. DressSaleRentalOrderModel.Dsro_UpdateDateTime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
  372. DressSaleRentalOrderModel.Dsro_UpdateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  373. DressSaleRentalOrderBll.Update(DressSaleRentalOrderModel);
  374. #endregion
  375. MessageBoxCustom.Show("保存成功!");
  376. this.Close();
  377. }
  378. else
  379. {
  380. #region 增加礼服租售订单表
  381. DressSaleRentalOrderModel.Dsro_Number = txtDsro_Number.Text.Trim();
  382. DressSaleRentalOrderModel.Dsro_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  383. DressSaleRentalOrderModel.Dsro_Type = "0";
  384. DressSaleRentalOrderModel.Dsro_Amount = Convert.ToDecimal(txtDsro_Amount.Text == "" ? "0.00" : txtDsro_Amount.Text);
  385. DressSaleRentalOrderModel.Dsro_MortgageAmount = Convert.ToDecimal(txtDsro_MortgageAmount.Text == "" ? "0.00" : txtDsro_MortgageAmount.Text);
  386. DressSaleRentalOrderModel.Dsro_TakeDressTime = Convert.ToDateTime(txtDsro_TakeDressTime.DateValue.ToString());
  387. DressSaleRentalOrderModel.Dsro_ReservationBackTime = Convert.ToDateTime(txtDsro_ReservationBackTime.DateValue); ;
  388. DressSaleRentalOrderModel.Dsro_Remark = txtDsro_Remark.Text.Trim();
  389. DressSaleRentalOrderModel.Dsro_CreateDateTime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
  390. DressSaleRentalOrderModel.Dsro_CreateName = txtDsro_CreateName.Tag.ToString();
  391. DressSaleRentalOrderModel.Dsro_HandledName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  392. #region 增加客户编号
  393. if (txtCus_Name.ReadOnly == true)
  394. {
  395. DressSaleRentalOrderModel.Dsro_CustomerNumber = txtCus_CustomerNumber.Text.Trim();
  396. }
  397. else
  398. {
  399. LYFZ.Model.Model_ErpCustomer model = new Model.Model_ErpCustomer();
  400. LYFZ.BLL.BLL_ErpCustomer bll = new BLL.BLL_ErpCustomer();
  401. #region 增加
  402. #region 手机存在
  403. if (!string.IsNullOrEmpty(txtCus_Telephone.Text))
  404. {
  405. if (bll.Exists("Cus_Telephone", txtCus_Telephone.Text) == true)
  406. {
  407. MessageBoxCustom.Show("客户手机已经存在");
  408. return;
  409. }
  410. }
  411. #endregion
  412. model.Cus_CustomerNumber = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().ToString("yyyyMMddHHmmssfff") + "1";//获取新编号
  413. model.Cus_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  414. model.Cus_CustomizeNumber = "";
  415. model.Cus_Type = "订单客户";
  416. model.Cus_ServiceType = "Clothing";
  417. model.Cus_Name = this.txtCus_Name.Text.ToString().Trim();
  418. model.Cus_Telephone = this.txtCus_Telephone.Text.ToString().Trim();
  419. model.Cus_QQ = this.txtCus_QQ.Text.ToString().Trim();
  420. model.Cus_Address = this.txtCus_Address.Text.ToString().Trim();
  421. model.Cus_WorkUnit = this.txtCus_WorkUnit.Text.ToString().Trim();
  422. model.Cus_Birthday = txtCus_Birthday.StrValue.Trim();
  423. if (chkCus_BirthdayLunar.Checked == true)
  424. {
  425. model.Cus_BirthdayLunar = "1";
  426. }
  427. else { model.Cus_BirthdayLunar = "0"; }
  428. model.Cus_DayForMarriage = txtCus_DayForMarriage.StrValue.ToString();
  429. if (chkCus_DayForMarriageLunar.Checked == true)
  430. {
  431. model.Cus_DayForMarriageLunar = "1";
  432. }
  433. else
  434. {
  435. model.Cus_DayForMarriageLunar = "0";
  436. }
  437. model.Cus_CreateDateTime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
  438. model.Cus_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  439. bll.Add(model);
  440. #endregion
  441. DressSaleRentalOrderModel.Dsro_CustomerNumber = model.Cus_CustomerNumber;
  442. }
  443. #endregion
  444. DressSaleRentalOrderBll.Add(DressSaleRentalOrderModel);
  445. #endregion
  446. #region 租售礼服详情表
  447. if (dgv.Rows.Count > 0)
  448. {
  449. for (int i = 0; i < dgv.Rows.Count; i++)
  450. {
  451. DressSaleRentalDetailModel.Dsrd_Number = DressSaleRentalOrderModel.Dsro_Number;
  452. DressSaleRentalDetailModel.Dsrd_DressNumber = dgv.Rows[i].Cells["Dsfm_DressNumber"].Value.ToString();
  453. DressSaleRentalDetailModel.Dsrd_DressName = dgv.Rows[i].Cells["Dsfm_DressName"].Value.ToString();
  454. DressSaleRentalDetailModel.Dsrd_SaleRentalQuantity = Convert.ToInt32(dgv.Rows[i].Cells["Dsfm_DressQuantity"].Value);
  455. DressSaleRentalDetailModel.Dsrd_CostPrice = Convert.ToDecimal(dgv.Rows[i].Cells["Dsfm_CostPrice"].Value);
  456. DressSaleRentalDetailModel.Dsrd_SalePrice = Convert.ToDecimal(dgv.Rows[i].Cells["Dsfm_SalePrice"].Value);
  457. DressSaleRentalDetailModel.Dsrd_CreateDateTime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
  458. DressSaleRentalDetailModel.Dsrd_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  459. DressSaleRentalDetailModel.Dsrd_BackTime = Convert.ToDateTime(null);
  460. DressSaleRentalDetailModel.Dsrd_BackStatus = "3";
  461. DressSaleRentalDetailModel.Dsrd_BackRemark = "";
  462. DressSaleRentalDetailBll.Add(DressSaleRentalDetailModel);
  463. }
  464. }
  465. #endregion
  466. MessageBoxCustom.Show("保存成功!");
  467. this.Close();
  468. }
  469. #endregion
  470. }
  471. #endregion
  472. #region 出售
  473. if (radSell.Checked == true)
  474. {
  475. #region 判断输入框不能为空
  476. if (string.IsNullOrEmpty(txtDsro_Number.Text))
  477. {
  478. MessageBoxCustom.Show("单号不能为空!");
  479. return;
  480. }
  481. if (dgv.Rows.Count == 0)
  482. {
  483. MessageBoxCustom.Show("礼服资料不能为空!请选择礼服!");
  484. return;
  485. }
  486. if (string.IsNullOrEmpty(txtDsro_Amount.Text))
  487. {
  488. MessageBoxCustom.Show("金额不能为空!");
  489. return;
  490. }
  491. if (string.IsNullOrEmpty(txtDsro_CreateName.Text.Trim()))
  492. {
  493. MessageBoxCustom.Show("销售人员不能为空!");
  494. return;
  495. }
  496. if (string.IsNullOrEmpty(txtCus_Name.Text))
  497. {
  498. MessageBoxCustom.Show("客户名称不能为空!");
  499. return;
  500. }
  501. if (string.IsNullOrEmpty(txtCus_Telephone.Text))
  502. {
  503. MessageBoxCustom.Show("客户电话不能为空!");
  504. return;
  505. }
  506. int intMasse = this.txtCus_Birthday.CheckDateValue(this.txtCus_Birthday, chkCus_BirthdayLunar);
  507. if (intMasse == 1) { MessageBoxCustom.Show("生日日期日期格式输入错误"); return; }
  508. else if (intMasse == 2)
  509. { MessageBoxCustom.Show("生日日期:" + this.txtCus_Birthday.StrValue.Trim() + "不是公历日期,若要保存请勾上农历"); return; }
  510. intMasse = this.txtCus_DayForMarriage.CheckDateValue(this.txtCus_DayForMarriage, chkCus_DayForMarriageLunar);
  511. if (intMasse == 1) { MessageBoxCustom.Show("婚期日期日期格式输入错误"); return; }
  512. else if (intMasse == 2)
  513. { MessageBoxCustom.Show("婚期日期:" + this.txtCus_DayForMarriage.StrValue.Trim() + "不是公历日期,若要保存请勾上农历"); return; }
  514. #endregion
  515. #region 出售
  516. if (!string.IsNullOrEmpty(PreselectedNumber_OK))
  517. {
  518. DataTable dt = DressSaleRentalOrderBll.GetList(" Dsro_Number='" + PreselectedNumber_OK + "'").Tables[0];
  519. DressSaleRentalOrderModel = DressSaleRentalOrderBll.GetModel(Convert.ToInt32(dt.Rows[0]["ID"]));
  520. #region 修改礼服租售订单表
  521. DressSaleRentalOrderModel.Dsro_Type = "1";
  522. DressSaleRentalOrderModel.Dsro_Amount = Convert.ToDecimal(txtDsro_Amount.Text == "" ? "0.00" : txtDsro_Amount.Text);
  523. DressSaleRentalOrderModel.Dsro_MortgageAmount = 0;
  524. DressSaleRentalOrderModel.Dsro_TakeDressTime = Convert.ToDateTime(txtDsro_TakeDressTime.DateValue.ToString());
  525. DressSaleRentalOrderModel.Dsro_ReservationBackTime = Convert.ToDateTime(null);
  526. DressSaleRentalOrderModel.Dsro_Remark = txtDsro_Remark.Text.Trim();
  527. DressSaleRentalOrderModel.Dsro_UpdateDateTime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
  528. DressSaleRentalOrderModel.Dsro_UpdateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  529. DressSaleRentalOrderBll.Update(DressSaleRentalOrderModel);
  530. #endregion
  531. #region 修改礼服详情表
  532. int i = DressSaleRentalOrderBll.Updatefl(PreselectedNumber_OK);
  533. #endregion
  534. #region 礼服出售减库存
  535. dt = new DataTable();
  536. dt = DressSaleRentalDetailBll.GetList("Dsrd_Number='" + PreselectedNumber_OK + "'").Tables[0];
  537. if (dt.Rows.Count > 0)
  538. {
  539. for (int t = 0; t < dt.Rows.Count; t++)
  540. {
  541. int count2 = Convert.ToInt32(dt.Rows[t]["Dsrd_SaleRentalQuantity"]);
  542. DataTable dt_df = DressFromBll.GetList("Dsfm_DressNumber='" + dt.Rows[t]["Dsrd_DressNumber"] + "'").Tables[0];
  543. int count1 = Convert.ToInt32(dt_df.Rows[0]["Dsfm_DressQuantity"]);
  544. DressFromModel = DressFromBll.GetModel(Convert.ToInt32(dt_df.Rows[0]["ID"]));
  545. DressFromModel.Dsfm_DressQuantity = Convert.ToInt32(count1) - Convert.ToInt32(count2);
  546. DressFromBll.Update(DressFromModel);
  547. }
  548. }
  549. #endregion
  550. MessageBoxCustom.Show("保存成功!");
  551. this.Close();
  552. }
  553. else
  554. {
  555. #region 增加礼服租售订单表
  556. DressSaleRentalOrderModel.Dsro_Number = txtDsro_Number.Text.Trim();
  557. DressSaleRentalOrderModel.Dsro_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  558. DressSaleRentalOrderModel.Dsro_Type = "1";
  559. DressSaleRentalOrderModel.Dsro_Amount = Convert.ToDecimal(txtDsro_Amount.Text == "" ? "0.00" : txtDsro_Amount.Text);
  560. DressSaleRentalOrderModel.Dsro_MortgageAmount = 0;
  561. DressSaleRentalOrderModel.Dsro_TakeDressTime = Convert.ToDateTime(txtDsro_TakeDressTime.DateValue.ToString());
  562. DressSaleRentalOrderModel.Dsro_ReservationBackTime = Convert.ToDateTime(null);
  563. DressSaleRentalOrderModel.Dsro_Remark = txtDsro_Remark.Text.Trim();
  564. DressSaleRentalOrderModel.Dsro_CreateDateTime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
  565. DressSaleRentalOrderModel.Dsro_CreateName = txtDsro_CreateName.Tag.ToString();
  566. DressSaleRentalOrderModel.Dsro_HandledName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  567. #region 增加客户编号
  568. if (txtCus_Name.ReadOnly == true)
  569. {
  570. DressSaleRentalOrderModel.Dsro_CustomerNumber = txtCus_CustomerNumber.Text.Trim();
  571. }
  572. else
  573. {
  574. LYFZ.Model.Model_ErpCustomer model = new Model.Model_ErpCustomer();
  575. LYFZ.BLL.BLL_ErpCustomer bll = new BLL.BLL_ErpCustomer();
  576. #region 增加
  577. #region 手机存在
  578. if (!string.IsNullOrEmpty(txtCus_Telephone.Text))
  579. {
  580. if (bll.Exists("Cus_Telephone", txtCus_Telephone.Text) == true)
  581. {
  582. MessageBoxCustom.Show("客户手机已经存在");
  583. return;
  584. }
  585. }
  586. #endregion
  587. model.Cus_CustomerNumber = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().ToString("yyyyMMddHHmmssfff") + "1";//获取新编号
  588. model.Cus_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  589. model.Cus_CustomizeNumber = "";
  590. model.Cus_Type = "订单客户";
  591. model.Cus_ServiceType = "Clothing";
  592. model.Cus_Name = this.txtCus_Name.Text.ToString().Trim();
  593. model.Cus_Telephone = this.txtCus_Telephone.Text.ToString().Trim();
  594. model.Cus_QQ = this.txtCus_QQ.Text.ToString().Trim();
  595. model.Cus_Address = this.txtCus_Address.Text.ToString().Trim();
  596. model.Cus_WorkUnit = this.txtCus_WorkUnit.Text.ToString().Trim();
  597. model.Cus_Birthday = txtCus_Birthday.StrValue.Trim();
  598. if (chkCus_BirthdayLunar.Checked == true)
  599. {
  600. model.Cus_BirthdayLunar = "1";
  601. }
  602. else { model.Cus_BirthdayLunar = "0"; }
  603. model.Cus_DayForMarriage = txtCus_DayForMarriage.StrValue.Trim();
  604. if (chkCus_DayForMarriageLunar.Checked == true)
  605. {
  606. model.Cus_DayForMarriageLunar = "1";
  607. }
  608. else
  609. {
  610. model.Cus_DayForMarriageLunar = "0";
  611. }
  612. model.Cus_CreateDateTime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
  613. model.Cus_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  614. bll.Add(model);
  615. #endregion
  616. DressSaleRentalOrderModel.Dsro_CustomerNumber = model.Cus_CustomerNumber;
  617. }
  618. #endregion
  619. DressSaleRentalOrderBll.Add(DressSaleRentalOrderModel);
  620. #endregion
  621. #region 租售礼服详情表
  622. if (dgv.Rows.Count > 0)
  623. {
  624. for (int i = 0; i < dgv.Rows.Count; i++)
  625. {
  626. DressSaleRentalDetailModel.Dsrd_Number = DressSaleRentalOrderModel.Dsro_Number;
  627. DressSaleRentalDetailModel.Dsrd_DressNumber = dgv.Rows[i].Cells["Dsfm_DressNumber"].Value.ToString();
  628. DressSaleRentalDetailModel.Dsrd_DressName = dgv.Rows[i].Cells["Dsfm_DressName"].Value.ToString();
  629. DressSaleRentalDetailModel.Dsrd_SaleRentalQuantity = Convert.ToInt32(dgv.Rows[i].Cells["Dsfm_DressQuantity"].Value);
  630. DressSaleRentalDetailModel.Dsrd_CostPrice = Convert.ToDecimal(dgv.Rows[i].Cells["Dsfm_CostPrice"].Value);
  631. DressSaleRentalDetailModel.Dsrd_SalePrice = Convert.ToDecimal(dgv.Rows[i].Cells["Dsfm_SalePrice"].Value);
  632. DressSaleRentalDetailModel.Dsrd_CreateDateTime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
  633. DressSaleRentalDetailModel.Dsrd_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  634. DressSaleRentalDetailModel.Dsrd_BackTime = Convert.ToDateTime(null);
  635. DressSaleRentalDetailModel.Dsrd_BackStatus = "";
  636. DressSaleRentalDetailModel.Dsrd_BackRemark = "";
  637. DressSaleRentalDetailBll.Add(DressSaleRentalDetailModel);
  638. }
  639. }
  640. #endregion
  641. #region 礼服出售减库存
  642. DataTable dt = new DataTable();
  643. dt = DressSaleRentalDetailBll.GetList("Dsrd_Number='" + txtDsro_Number.Text.Trim() + "'").Tables[0];
  644. if (dt.Rows.Count > 0)
  645. {
  646. for (int t = 0; t < dt.Rows.Count; t++)
  647. {
  648. int count2 = Convert.ToInt32(dt.Rows[t]["Dsrd_SaleRentalQuantity"]);
  649. DataTable dt_df = DressFromBll.GetList("Dsfm_DressNumber='" + dt.Rows[t]["Dsrd_DressNumber"] + "'").Tables[0];
  650. int count1 = Convert.ToInt32(dt_df.Rows[0]["Dsfm_DressQuantity"]);
  651. DressFromModel = DressFromBll.GetModel(Convert.ToInt32(dt_df.Rows[0]["ID"]));
  652. DressFromModel.Dsfm_DressQuantity = Convert.ToInt32(count1) - Convert.ToInt32(count2);
  653. DressFromBll.Update(DressFromModel);
  654. }
  655. }
  656. #endregion
  657. MessageBoxCustom.Show("保存成功!");
  658. this.Close();
  659. }
  660. #endregion
  661. }
  662. #endregion
  663. bl = true;
  664. LYFZ.Software.MainBusiness.Dresses.DressManagement.Rental.FrmPayment set = new FrmPayment();
  665. set.StrOrderNumber = txtDsro_Number.Text;
  666. set.ShowDialog();
  667. }
  668. catch (Exception ex)
  669. {
  670. MessageBoxCustom.Show(ex.Message);
  671. }
  672. }
  673. #endregion
  674. #region 客户选择
  675. protected override void btnCusSelect_Click(object sender, EventArgs e)
  676. {
  677. LYFZ.Software.MainBusiness.Dresses.DressManagement.FrmCusSelect set = new FrmCusSelect();
  678. set.ShowDialog();
  679. if (!string.IsNullOrEmpty(set.StrClientNumber))
  680. {
  681. LYFZ.BLL.BLL_ErpCustomer CustomerBll = new BLL.BLL_ErpCustomer();
  682. DataTable dt = CustomerBll.View_tb_ErpCustomer(" and Cus_CustomerNumber='" + set.StrClientNumber + "'").Tables[0];
  683. if (dt.Rows.Count > 0)
  684. {
  685. txtCus_Name.Text = "";
  686. txtCus_Name.ReadOnly = true;
  687. txtCus_Telephone.Text = "";
  688. txtCus_Telephone.ReadOnly = true;
  689. txtCus_QQ.Text = "";
  690. txtCus_QQ.ReadOnly = true;
  691. txtCus_Address.Text = "";
  692. txtCus_Address.ReadOnly = true;
  693. txtCus_WorkUnit.Text = "";
  694. txtCus_WorkUnit.ReadOnly = true;
  695. txtCus_Birthday.Text = "";
  696. txtCus_Birthday.Enabled = false;
  697. chkCus_BirthdayLunar.Checked = false;
  698. chkCus_BirthdayLunar.Enabled = false;
  699. txtCus_DayForMarriage.Text = "";
  700. txtCus_DayForMarriage.Enabled = false;
  701. chkCus_DayForMarriageLunar.Checked = false;
  702. chkCus_DayForMarriageLunar.Enabled = false;
  703. txtCus_CustomerNumber.Text = "";
  704. txtCus_Name.Text = dt.Rows[0]["Cus_Name"].ToString();
  705. txtCus_Telephone.Text = dt.Rows[0]["Cus_Telephone"].ToString();
  706. txtCus_QQ.Text = dt.Rows[0]["Cus_QQ"].ToString();
  707. txtCus_Address.Text = dt.Rows[0]["Cus_Address"].ToString();
  708. txtCus_WorkUnit.Text = dt.Rows[0]["Cus_WorkUnit"].ToString();
  709. txtCus_Birthday.Text = dt.Rows[0]["Cus_Birthday"].ToString();
  710. string Cus_BirthdayLunar = dt.Rows[0]["Cus_BirthdayLunar"].ToString();
  711. if (Cus_BirthdayLunar.ToString() == "1")
  712. {
  713. chkCus_BirthdayLunar.Checked = true;
  714. }
  715. txtCus_DayForMarriage.Text = dt.Rows[0]["Cus_DayForMarriage"].ToString();
  716. string Cus_DayForMarriageLunar = dt.Rows[0]["Cus_DayForMarriageLunar"].ToString();
  717. if (Cus_DayForMarriageLunar.ToString() == "1")
  718. { chkCus_DayForMarriageLunar.Checked = true; }
  719. txtCus_CustomerNumber.Text = dt.Rows[0]["Cus_CustomerNumber"].ToString();
  720. }
  721. }
  722. }
  723. #endregion
  724. #region 关闭
  725. protected override void btnClose_Click(object sender, EventArgs e)
  726. {
  727. this.Close();
  728. }
  729. #endregion
  730. #region 清空
  731. protected override void btnClear_Click(object sender, EventArgs e)
  732. {
  733. txtDsro_Remark.Text = "";
  734. btnCusSelect.Enabled = true;
  735. txtCus_Name.Text = "";
  736. txtCus_Name.ReadOnly = false;
  737. txtCus_Telephone.Text = "";
  738. txtCus_Telephone.ReadOnly = false;
  739. txtCus_QQ.Text = "";
  740. txtCus_QQ.ReadOnly = false;
  741. txtCus_Address.Text = "";
  742. txtCus_Address.ReadOnly = false;
  743. txtCus_WorkUnit.Text = "";
  744. txtCus_WorkUnit.ReadOnly = false;
  745. txtCus_Birthday.Text = "";
  746. txtCus_Birthday.Enabled = true;
  747. chkCus_BirthdayLunar.Checked = false;
  748. chkCus_BirthdayLunar.Enabled = true;
  749. txtCus_DayForMarriage.Text = "";
  750. txtCus_DayForMarriage.Enabled = true;
  751. chkCus_DayForMarriageLunar.Checked = false;
  752. chkCus_DayForMarriageLunar.Enabled = true;
  753. txtCus_CustomerNumber.Text = "";
  754. BindDsro_Number();
  755. txtDsro_CreateName.Text = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name;
  756. txtDsro_CreateDateTime.Text = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().ToString();
  757. txtDsro_CreateName.Enabled = true;
  758. }
  759. #endregion
  760. #region 单选按钮
  761. protected override void radSell_Click(object sender, EventArgs e)
  762. {
  763. lblDsro_MortgageAmount.Visible = false;
  764. txtDsro_MortgageAmount.Visible = false;
  765. lbltxtDsro_ReservationBackTime.Visible = false;
  766. txtDsro_ReservationBackTime.Visible = false;
  767. }
  768. protected override void radRent_Click(object sender, EventArgs e)
  769. {
  770. txtDsro_MortgageAmount.Text = "";
  771. txtDsro_ReservationBackTime.Text = "";
  772. lblDsro_MortgageAmount.Visible = true;
  773. txtDsro_MortgageAmount.Visible = true;
  774. lbltxtDsro_ReservationBackTime.Visible = true;
  775. txtDsro_ReservationBackTime.Visible = true;
  776. }
  777. #endregion
  778. #region 输入框设置
  779. protected override void txtCus_Telephone_KeyPress(object sender, KeyPressEventArgs e)
  780. {
  781. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  782. {
  783. e.Handled = true;
  784. }
  785. }
  786. protected override void txtDsro_MortgageAmount_KeyPress(object sender, KeyPressEventArgs e)
  787. {
  788. if (!Char.IsNumber(e.KeyChar) && !Char.IsPunctuation(e.KeyChar) && !Char.IsControl(e.KeyChar))
  789. {
  790. e.Handled = true; //获取或设置一个值,指示是否处理过System.Windows.Forms.Control.KeyPress事件
  791. }
  792. else if (Char.IsPunctuation(e.KeyChar))
  793. {
  794. if (e.KeyChar == '.')
  795. {
  796. if (((System.Windows.Forms.TextBox)sender).Text.LastIndexOf('.') != -1)
  797. {
  798. e.Handled = true;
  799. }
  800. }
  801. else
  802. {
  803. e.Handled = true;
  804. }
  805. }
  806. }
  807. protected override void txtDsro_Amount_KeyPress(object sender, KeyPressEventArgs e)
  808. {
  809. if (!Char.IsNumber(e.KeyChar) && !Char.IsPunctuation(e.KeyChar) && !Char.IsControl(e.KeyChar))
  810. {
  811. e.Handled = true; //获取或设置一个值,指示是否处理过System.Windows.Forms.Control.KeyPress事件
  812. }
  813. else if (Char.IsPunctuation(e.KeyChar))
  814. {
  815. if (e.KeyChar == '.')
  816. {
  817. if (((System.Windows.Forms.TextBox)sender).Text.LastIndexOf('.') != -1)
  818. {
  819. e.Handled = true;
  820. }
  821. }
  822. else
  823. {
  824. e.Handled = true;
  825. }
  826. }
  827. }
  828. #endregion
  829. #region 时间输入框设置
  830. protected override void txtDsro_ReservationBackTime_Leave(object sender, EventArgs e)
  831. {
  832. if (this.txtDsro_ReservationBackTime.Text.Trim() != "")
  833. {
  834. if (LYFZ.Command.Command_Validate.IsDateTime(this.txtDsro_ReservationBackTime.Text.Trim()) == false)
  835. {
  836. this.txtDsro_ReservationBackTime.Text = "";
  837. MessageBoxCustom.Show("还回时间格式输入错误");
  838. txtDsro_ReservationBackTime.Text = Convert.ToDateTime(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime()).ToString("yyyy-MM-dd");
  839. }
  840. }
  841. }
  842. protected override void txtDsro_ReservationBackTime_Enter(object sender, EventArgs e)
  843. {
  844. if (this.txtDsro_ReservationBackTime.Text == "")
  845. {
  846. txtDsro_ReservationBackTime.Text = Convert.ToDateTime(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime()).ToString("yyyy-MM-dd");
  847. }
  848. }
  849. protected override void txtDsro_TakeDressTime_Leave(object sender, EventArgs e)
  850. {
  851. if (this.txtDsro_TakeDressTime.Text.Trim() != "")
  852. {
  853. if (LYFZ.Command.Command_Validate.IsDateTime(this.txtDsro_TakeDressTime.Text.Trim()) == false)
  854. {
  855. this.txtDsro_TakeDressTime.Text = "";
  856. MessageBoxCustom.Show("取衣时间格式输入错误");
  857. txtDsro_TakeDressTime.Text = Convert.ToDateTime(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime()).ToString("yyyy-MM-dd");
  858. }
  859. }
  860. }
  861. protected override void txtDsro_TakeDressTime_Enter(object sender, EventArgs e)
  862. {
  863. if (this.txtDsro_TakeDressTime.Text == "")
  864. {
  865. txtDsro_TakeDressTime.Text = Convert.ToDateTime(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime()).ToString("yyyy-MM-dd");
  866. }
  867. }
  868. #endregion
  869. #region 绑定第二级人员
  870. /// <summary>
  871. /// 绑定第二级人员
  872. /// </summary>
  873. /// <param name="nodes">TreeView的节点集合</param>
  874. /// <param name="dataSource">数据源</param>
  875. /// <param name="parentid"></param>
  876. private void CreateTreeViewDepartmentUser(TreeNodeCollection nodes, string ClassCode)
  877. {
  878. if (ClassCode != "")
  879. {
  880. LYFZ.BLL.BLL_ErpUser BLLerpuser = new BLL.BLL_ErpUser();
  881. DataTable tbl = BLLerpuser.GetList("User_Department='" + ClassCode + "' and id!='1' and User_Status='在职'").Tables[0];
  882. if (tbl.Rows.Count > 0)
  883. {
  884. TreeNode node;
  885. for (int i = 0; i < tbl.Rows.Count; i++)
  886. {
  887. node = new TreeNode();
  888. node.Text = tbl.Rows[i]["User_Name"].ToString();
  889. node.Tag = tbl.Rows[i]["User_EmployeeID"].ToString();
  890. node.Name = tbl.Rows[i]["User_Account"].ToString();
  891. nodes.Add(node);
  892. }
  893. }
  894. }
  895. }
  896. #endregion
  897. }
  898. }