FrmPrintInitialValue.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Linq;
  5. using System.Text;
  6. namespace LYFZ.Software.MainBusiness.ReportPrint
  7. {
  8. public class FrmPrintInitialValue : Software.UI.ReportPrint.FrmPrintInitialValue
  9. {
  10. public string companyCode = "";
  11. public FrmPrintInitialValue()
  12. {
  13. this.btn_Cancel.Click += btn_Cancel_Click;
  14. this.btn_Ok.Click += btn_Ok_Click;
  15. this.Load += FrmPrintInitialValue_Load;
  16. }
  17. void FrmPrintInitialValue_Load(object sender, EventArgs e)
  18. {
  19. }
  20. public bool CheckSetingPrintSerialNo()
  21. {
  22. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  23. DataTable dt = orbll.GetView_Custom("tb_ErpSystemConfigure", StrWhere: "Sconfig_Code = 'PrintReceiptSerial_" + companyCode + "'", ShowColumnName: "*").Tables[0];
  24. return dt.Rows.Count > 0;
  25. }
  26. void btn_Ok_Click(object sender, EventArgs e)
  27. {
  28. if(string.IsNullOrEmpty(companyCode))
  29. {
  30. MessageBoxCustom.Show("企业编号不能为空!");
  31. return;
  32. }
  33. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  34. DataTable dt = orbll.GetView_Custom("tb_ErpSystemConfigure", StrWhere: "Sconfig_Code = 'PrintReceiptSerial_" + companyCode + "'", ShowColumnName: "*").Tables[0];
  35. if (dt.Rows.Count == 0)
  36. {
  37. LYFZ.BLL.BLL_ErpSystemConfigure sgbll = new BLL.BLL_ErpSystemConfigure();
  38. LYFZ.Model.Model_ErpSystemConfigure model = new Model.Model_ErpSystemConfigure();
  39. model.Sconfig_Code = "PrintReceiptSerial_" + companyCode;
  40. model.Sconfig_Name = "收款单打印时候的序号";
  41. model.Sconfig_Value = string.Format("{0:0000000}", (Convert.ToDecimal(this.nud_ValueData.Value - 1)));
  42. model.Sconfig_IsEnabled = true;
  43. model.Sconfig_Remark = "收款单打印时候的序号(每张的号码重覆,每打一张这里垒加一)";
  44. model.Sconfig_Type = "";
  45. model.Sconfig_Order = 1;
  46. model.Sconfig_CreateDatetime = DateTime.Now;
  47. model.Sconfig_CreateName = "";
  48. sgbll.Add(model);
  49. }
  50. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  51. this.Close();
  52. }
  53. void btn_Cancel_Click(object sender, EventArgs e)
  54. {
  55. this.Close();
  56. }
  57. }
  58. }