protected void Back_Before_Page_Btn_Click(object sender, EventArgs e) { string[] code = Request.Params["code"].Split('U'); string leasing_id = code[1]; string bill_no = code[2]; string idcard = (string)Session["ctm_leasing_payment"]; string ogn_code = CryptographyCode.GenerateSHA512String(leasing_id); Response.Redirect("/Form_Leasings/Leasing_Payment?code=" + CryptographyCode.EncodeTOAddressBar(ogn_code, leasing_id, idcard)); }
protected void Page_Load(object sender, EventArgs e) { if (Session["Login"] == null || Session["Package"] == null) { Response.Redirect("/Authorization/Login"); } package_login = (Base_Companys)Session["Package"]; acc_lgn = (Account_Login)Session["Login"]; if (acc_lgn.acc_lv.level_access < 7) { Save_Btn.Visible = false; } if (!IsPostBack) { if (Request.Params["code"] != null) { string[] code = Request.Params["code"].Split('U'); string leasing_id = code[1]; string bill_no = code[2]; string idcard = (string)Session["ctm_leasing_payment"]; if (Request.Params["mode"] == "e") { Close_Leasing_Lbl.Visible = false; _loadLeasingDetails(leasing_id, idcard, bill_no); } else if (Request.Params["mode"] == "r") { Car_Leasings_Payment_Manager cls_pay_mng = new Car_Leasings_Payment_Manager(); cls_pay_mng.removePayment(leasing_id, bill_no); /// Acticity Logs System /// string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " ลบข้อมูลการจ่ายเงิน เลขที่ใบเสร็จ : " + bill_no, acc_lgn.resu, package_login.Company_N_name); new Activity_Log_Manager().addActivityLogs(message, acc_lgn.Account_id, package_login.Company_id); /// Acticity Logs System string ogn_code = CryptographyCode.GenerateSHA512String(leasing_id); Response.Redirect("/Form_Leasings/Leasing_Payment?code=" + CryptographyCode.EncodeTOAddressBar(ogn_code, leasing_id, idcard)); } } } }
protected void Save_Btn_Click(object sender, EventArgs e) { string[] code = Request.Params["code"].Split('U'); string leasing_id = code[1]; string bill_no = code[2]; string idcard = (string)Session["ctm_leasing_payment"]; cls = cls_mng.getCarLeasingById(leasing_id); double total_payment_left = string.IsNullOrEmpty(Total_payment_left_TBx.Text) ? 0 : Convert.ToDouble(Total_payment_left_TBx.Text); double period_fine = string.IsNullOrEmpty(Total_payment_fine_TBx.Text) ? 0 : Convert.ToDouble(Total_payment_fine_TBx.Text); double old_period_fee = string.IsNullOrEmpty(Old_Period_fee_TBx.Text) ? 0.00 : Convert.ToDouble(Old_Period_fee_TBx.Text); double old_period_track = string.IsNullOrEmpty(Old_Period_track_TBx.Text) ? 0.00 : Convert.ToDouble(Old_Period_track_TBx.Text); double old_payment = string.IsNullOrEmpty(Old_Real_Payment_TBx.Text) ? 0 : Convert.ToDouble(Old_Real_Payment_TBx.Text); double old_payment_fine = string.IsNullOrEmpty(Old_Real_Payment_Fine_TBx.Text) ? 0 : Convert.ToDouble(Old_Real_Payment_Fine_TBx.Text); double old_discount = string.IsNullOrEmpty(Old_Real_Discount_TBx.Text) ? 0 : Convert.ToDouble(Old_Real_Discount_TBx.Text); double real_period_fee = string.IsNullOrEmpty(Period_fee_TBx.Text) ? 0.00 : Convert.ToDouble(Period_fee_TBx.Text); double real_period_track = string.IsNullOrEmpty(Period_track_TBx.Text) ? 0.00 : Convert.ToDouble(Period_track_TBx.Text); double real_payment = string.IsNullOrEmpty(Real_Payment_TBx.Text) ? 0 : Convert.ToDouble(Real_Payment_TBx.Text); double real_payment_fine = string.IsNullOrEmpty(Real_Payment_Fine_TBx.Text) ? 0 : Convert.ToDouble(Real_Payment_Fine_TBx.Text); double real_discount = string.IsNullOrEmpty(Real_Discount_TBx.Text) ? 0 : Convert.ToDouble(Real_Discount_TBx.Text); cls_pay.Leasing_id = leasing_id; cls_pay.Period_fee = real_period_fee; cls_pay.Period_track = real_period_track; cls_pay.Total_payment_fine = real_payment_fine; cls_pay.Discount = real_discount; cls_pay.Real_payment = real_payment; cls_pay.Real_payment_date = string.IsNullOrEmpty(Payment_Date_TBx.Text) ? DateTimeUtility._dateNOWForServer() : DateTimeUtility.convertDateToMYSQL(Payment_Date_TBx.Text); cls_pay.Bill_no_manual_ref = string.IsNullOrEmpty(Bill_No_Manual_Ref_TBx.Text) ? "" : Bill_No_Manual_Ref_TBx.Text; Base_Companys package_login = new Base_Companys(); Account_Login acc_lgn = new Account_Login(); package_login = (Base_Companys)Session["Package"]; acc_lgn = (Account_Login)Session["Login"]; cls_pay.acc_lgn = new Account_Login(); cls_pay.acc_lgn.Account_id = acc_lgn.Account_id; cls_pay.bs_cpn = new Base_Companys(); cls_pay.bs_cpn.Company_id = (int)Session["old_company"]; if (total_payment_left == 0) { if (real_payment <= 0) { Note_Lbl.Text = "*** ระบุยอดชำระมากกว่า : 0.00 บาท ***"; Real_Payment_TBx.Focus(); } else if (real_payment > old_payment) { Note_Lbl.Text = "*** ยอดชำระเกินกว่ายอดเดิม : " + old_payment.ToString("#,###.00") + " บาท ***"; Real_Payment_TBx.Focus(); } /* else if (period_fine == 0 && old_payment_fine != 0) * { * Note_Lbl.Text = "*** ระบุยอดชำระค่าปรับ : " + old_payment_fine.ToString("#,###.00") + " บาท ***"; * * Real_Payment_Fine_TBx.Focus(); * }*/ else if (old_discount != 0) { Note_Lbl.Text = "*** ระบุยอดส่วนลด : " + old_discount.ToString("#,###.00") + " บาท ***"; Real_Discount_TBx.Focus(); } else { Note_Lbl.Text = ""; if (cls_pay_mng.editPayment(cls_pay, bill_no)) { /// Acticity Logs System /// string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " แก้ไขข้อมูลการจ่ายเงิน ในสัญญา : " + cls.Leasing_no + " เลขที่ฝาก : " + cls.Deps_no + " เลขที่ใบเสร็จ : " + bill_no + " จำนวนเงิน [ค่างวด] [ค่าปรับ] [ส่วนลด] : [" + real_payment + "] [" + period_fine + "] [" + real_discount + "] ", acc_lgn.resu, package_login.Company_N_name); new Activity_Log_Manager().addActivityLogs(message, acc_lgn.Account_id, package_login.Company_id); /// Acticity Logs System string ogn_code = CryptographyCode.GenerateSHA512String(leasing_id); Session.Remove("old_company"); Response.Redirect("/Form_Leasings/Leasing_Payment?code=" + CryptographyCode.EncodeTOAddressBar(ogn_code, leasing_id, idcard)); } else { Alert_Danger_Panel.Visible = true; alert_header_danger_Lbl.Text = "แจ้งเตือน!!"; alert_danger_Lbl.Text = "กรุณาตรวจสอบ ข้อมูลอีกครั้ง"; Alert_Danger_Panel.Focus(); } } } else { if (real_payment <= 0) { Note_Lbl.Text = "*** ระบุยอดชำระมากกว่า : 0.00 บาท ***"; Real_Payment_TBx.Focus(); } /*else if(real_payment > total_payment_left && real_payment > 0) * { * Note_Lbl.Text = "*** ยอดชำระเกินกว่ายอดคงค้าง : " + total_payment_left.ToString("#,###.00") + " บาท ***"; * * Real_Payment_TBx.Focus(); * }*/ else if (old_discount == 0 && real_discount != 0) { Note_Lbl.Text = "*** ไม่มียอดส่วนลดกรุณาใส่ 0 ในช่องส่วนลด ***"; Real_Discount_TBx.Focus(); } else { Note_Lbl.Text = ""; if (cls_pay_mng.editPayment(cls_pay, bill_no)) { /// Acticity Logs System /// string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " แก้ไขข้อมูลการจ่ายเงิน ในสัญญา : " + cls.Leasing_no + " เลขที่ฝาก : " + cls.Deps_no + " เลขที่ใบเสร็จ : " + bill_no + " จำนวนเงิน [ค่างวด] [ค่าปรับ] [ส่วนลด] : [" + real_payment + "] [" + period_fine + "] [" + real_discount + "] ", acc_lgn.resu, package_login.Company_N_name); new Activity_Log_Manager().addActivityLogs(message, acc_lgn.Account_id, package_login.Company_id); /// Acticity Logs System string ogn_code = CryptographyCode.GenerateSHA512String(leasing_id); Session.Remove("old_company"); Response.Redirect("/Form_Leasings/Leasing_Payment?code=" + CryptographyCode.EncodeTOAddressBar(ogn_code, leasing_id, idcard)); } else { Alert_Danger_Panel.Visible = true; alert_header_danger_Lbl.Text = "แจ้งเตือน!!"; alert_danger_Lbl.Text = "กรุณาตรวจสอบ ข้อมูลอีกครั้ง"; Alert_Danger_Panel.Focus(); } } } }