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 >= 5) { Leasing_Code_Panel.Visible = true; Comapnys_Panel.Visible = true;; } else if (acc_lgn.acc_lv.level_access == 4) { Leasing_Code_Panel.Visible = true; Comapnys_Panel.Visible = false; } else { Leasing_Code_Panel.Visible = false; Comapnys_Panel.Visible = false; } /// แสดงปุ่มการออกรายงาน เฉพาะผู้เกี่ยวข้อง if (acc_lgn.acc_lv.level_access >= 5) { Export_Reported_mod_I_Btn.Visible = true; Export_Reported_mod_II_Btn.Visible = true; } else if (acc_lgn.acc_lv.level_access <= 4) { Export_Reported_mod_I_Btn.Visible = true; Export_Reported_mod_II_Btn.Visible = false; } else { Export_Reported_mod_I_Btn.Visible = false; Export_Reported_mod_II_Btn.Visible = false; } if (!IsPostBack) { _loadCompanys(); _loadLeasingCode(); _loadZoneService(); _loadMonth(); _loadYear(); /// Acticity Logs System /// string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " เข้าหน้าออกรายงานประจำเดือน ", 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 } }
protected void Payment_Btn_Click(object sender, EventArgs e) { string[] code = Request.Params["code"].Split('U'); string leasing_id = code[1]; string idcard = code[2]; cls = cls_mng.getCarLeasingById(leasing_id); double real_payment = string.IsNullOrEmpty(Real_Payment_TBx.Text) ? 0 : Convert.ToDouble(Real_Payment_TBx.Text); double cal_payment = string.IsNullOrEmpty(Cal_Period_Payment_TBx.Text) ? 0 : Convert.ToDouble(Cal_Period_Payment_TBx.Text); 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 real_payment_fine = string.IsNullOrEmpty(Real_Payment_Fine_TBx.Text) ? 0 : Convert.ToDouble(Real_Payment_Fine_TBx.Text); double discount = string.IsNullOrEmpty(Discount_TBx.Text) ? 0 : Convert.ToDouble(Discount_TBx.Text); double real_discount = string.IsNullOrEmpty(Real_Discount_TBx.Text) ? 0 : Convert.ToDouble(Real_Discount_TBx.Text); double sum_payment_left = total_payment_left; cls_pay.Leasing_id = leasing_id; cls_pay.Period_fee = string.IsNullOrEmpty(Period_free_TBx.Text) ? 0.00 : Convert.ToDouble(Period_free_TBx.Text); cls_pay.Period_track = string.IsNullOrEmpty(Period_track_TBx.Text) ? 0.00 : Convert.ToDouble(Period_track_TBx.Text); cls_pay.Total_payment_fine = Convert.ToDouble(Real_Payment_Fine_TBx.Text); cls_pay.Discount = Convert.ToDouble(Real_Discount_TBx.Text); cls_pay.Real_payment = Convert.ToDouble(Real_Payment_TBx.Text); 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 = package_login.Company_id; bool past_page = false; if (Cal_Status_Lbl.Visible == false) /* กรณีจ่าค่างวดแบบธรรมดา */ { if (real_payment >= sum_payment_left) { if (real_payment <= 0) { Note_Lbl.Text = "*** ระบุยอดชำระมากกว่า : 0.00 บาท ***"; Real_Payment_TBx.Focus(); } /*else if (period_fine > 0 && real_payment_fine != period_fine) * { * Note_Lbl.Text = "*** มียอดค่าปรับค้างชำระจำนวน : " + period_fine.ToString("#,###.00") + " บาท ***"; * * Real_Payment_Fine_TBx.Focus(); * } * else if (period_fine == 0 && real_payment_fine != period_fine) * { * Note_Lbl.Text = "*** ไม่มียอดค่าปรับค้างชำระกรุณาใส่ 0 ในช่องชำระค่าปรับ ***"; * * Real_Payment_Fine_TBx.Focus(); * }*/ else if (discount == 0 && real_discount != 0) { Note_Lbl.Text = "*** ไม่มียอดส่วนลดกรุณาใส่ 0 ในช่องส่วนลด ***"; Real_Payment_Fine_TBx.Focus(); } else if (real_payment > sum_payment_left) { Note_Lbl.Text = "*** ยอดปิดบัญชีจำนวน : " + sum_payment_left.ToString("#,###.00") + " บาท ***"; } else { Note_Lbl.Text = ""; if (!string.IsNullOrEmpty(Bill_No_Manual_Ref_TBx.Text)) { past_page = cls_pay_mng.addPayment_Mod_III(cls_pay, 1); } else { past_page = cls_pay_mng.addPayment(cls_pay, 1); } if (past_page) { /// Acticity Logs System /// string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " บันทึกข้อมูลการจ่ายเงิน ในสัญญา : " + cls.Leasing_no + " เลขที่ฝาก : " + cls.Deps_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 _clearRealPayment(); } 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 (period_fine > 0 && real_payment_fine > period_fine) * { * Note_Lbl.Text = "*** มียอดค่าปรับค้างชำระจำนวน : " + period_fine.ToString("#,###.00") + " บาท ***"; * * Real_Payment_Fine_TBx.Focus(); * } * else if (period_fine == 0 && real_payment_fine != period_fine) * { * Note_Lbl.Text = "*** ไม่มียอดค่าปรับค้างชำระกรุณาใส่ 0 ในช่องชำระค่าปรับ ***"; * * Real_Payment_Fine_TBx.Focus(); * }*/ else if (discount == 0 && real_discount != 0) { Note_Lbl.Text = "*** ไม่มียอดส่วนลดกรุณาใส่ 0 ในช่องส่วนลด ***"; Real_Payment_Fine_TBx.Focus(); } else { Note_Lbl.Text = ""; if (!string.IsNullOrEmpty(Bill_No_Manual_Ref_TBx.Text)) { past_page = cls_pay_mng.addPayment_Mod_III(cls_pay, 1); } else { past_page = cls_pay_mng.addPayment(cls_pay, 1); } if (past_page) { /// Acticity Logs System /// string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " บันทึกข้อมูลการจ่ายเงิน ในสัญญา : " + cls.Leasing_no + " เลขที่ฝาก : " + cls.Deps_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 _clearRealPayment(); } else { Alert_Danger_Panel.Visible = true; alert_header_danger_Lbl.Text = "แจ้งเตือน!!"; alert_danger_Lbl.Text = "กรุณาตรวจสอบ ข้อมูลอีกครั้ง"; Alert_Danger_Panel.Focus(); } } } _loadLeasingDetails(leasing_id, idcard); } else /* กรณีปิดบัญชี และมีส่วนลด */ { if (real_payment != cal_payment) { Note_Lbl.Text = "*** ไม่สามารถปิดบัญชีได้ เนื่องจาก ยอดชำระไม่ตรงกับที่ระบบคำนวนได้ " + cal_payment.ToString("#,###.00") + " บาท ***"; } /*else if (period_fine > 0 && real_payment_fine != period_fine) * { * Note_Lbl.Text = "*** มียอดค่าปรับค้างชำระจำนวน : " + period_fine.ToString("#,###.00") + " บาท ***"; * * Real_Payment_Fine_TBx.Focus(); * } * else if (period_fine == 0 && real_payment_fine != period_fine) * { * Note_Lbl.Text = "*** ไม่มียอดค่าปรับค้างชำระกรุณาใส่ 0 ในช่องชำระค่าปรับ ***"; * * Real_Payment_Fine_TBx.Focus(); * } * else if (discount == 0 && real_discount != discount) * { * Note_Lbl.Text = "*** ไม่มียอดส่วนลดกรุณาใส่ 0 ในช่องส่วนลด ***"; * * Real_Payment_Fine_TBx.Focus(); * } * else if (discount > 0 && real_discount != discount) * { * Note_Lbl.Text = "*** กรุณมระบุยอดส่วนลดจำนวน : " + discount.ToString("#,###.00") + " บาท ***"; * * Real_Discount_TBx.Focus(); * }*/ else { Note_Lbl.Text = ""; if (!string.IsNullOrEmpty(Bill_No_Manual_Ref_TBx.Text)) { past_page = cls_pay_mng.addPayment_Mod_III(cls_pay, 2); } else { past_page = cls_pay_mng.addPayment(cls_pay, 2); } if (past_page) { /// Acticity Logs System /// string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " บันทึกข้อมูลการจ่ายเงินแบบคำนวนการปิดบัญชี ในสัญญา : " + cls.Leasing_no + " เลขที่ฝาก : " + cls.Deps_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 _clearRealPayment(); _loadLeasingDetails(leasing_id, idcard); } else { Alert_Danger_Panel.Visible = true; alert_header_danger_Lbl.Text = "แจ้งเตือน!!"; alert_danger_Lbl.Text = "กรุณาตรวจสอบ ข้อมูลอีกครั้ง"; Alert_Danger_Panel.Focus(); } } } }
private void _loadReport_mod_I() { string year = (string)Session["year"]; string Company_id_inline = (string)Session["Company_id_inline_rpt"]; string leasing_Code_inline = (string)Session["leasing_Code_inline_rpt"]; string zone_id_inline = (string)Session["zone_id_inline_rpt"]; string report_header = "รายงานการชำระเงิน 1 ประจำปี " + (Convert.ToInt32(year) + 543); package_login = (Base_Companys)Session["Package"]; acc_lgn = (Account_Login)Session["Login"]; MySqlConnection con = MySQLConnection.connectionMySQL(); try { con.Open(); MySqlCommand cmd = new MySqlCommand("rpt_real_payment_yearly", con); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 0; cmd.Parameters.AddWithValue("@i_year", year); cmd.Parameters.AddWithValue("@i_Leasing_code_id", leasing_Code_inline); cmd.Parameters.AddWithValue("@i_Company_id", Company_id_inline); cmd.Parameters.AddWithValue("@i_Zone_id", zone_id_inline); cmd.Parameters.AddWithValue("@i_row_str", 0); cmd.Parameters.AddWithValue("@i_row_limit", 0); MySqlDataReader reader = cmd.ExecuteReader(); Leasing_Ds ls_ds = new Leasing_Ds(); ls_ds.Clear(); ls_ds.Tables["Report_Payments"].Load(reader); Payment_Summary_Yearly_mod_I_001 rpt = new Payment_Summary_Yearly_mod_I_001(); rpt.SetDataSource(ls_ds); rpt.SetParameterValue("Reported_By_User", "ออกโดย : " + acc_lgn.Account_F_name); rpt.SetParameterValue("Reported_Print_Date", "วันที่พิมพ์ : " + DateTimeUtility.convertDateTimeToPage(DateTimeUtility._dateTimeNOWForServer())); rpt.SetParameterValue("Report_Header", report_header); CRV_Display_Report.ReportSource = rpt; /// Export Report to PDF File with Save As Mode /// rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "หน้าการ์ด_" + cls.Deps_no); /// Response.End(); ExportReport_Mod_I(rpt); } catch (MySqlException ex) { error = "MysqlException ==> Payment_Summary_Yearly_Export --> _loadReport_mod_I() "; Log_Error._writeErrorFile(error, ex); } catch (Exception ex) { error = "Exception ==> Payment_Summary_Yearly_Export --> _loadReport_mod_I() "; Log_Error._writeErrorFile(error, ex); } finally { con.Close(); con.Dispose(); } /// Acticity Logs System /// string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " ออก" + report_header, 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 GC.Collect(); }