public List <Base_Companys> getCompanys(int i_row_str, int i_row_limit) { MySqlConnection con = MySQLConnection.connectionMySQL(); try { con.Open(); MySqlCommand cmd = new MySqlCommand("g_companys", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@i_row_str", i_row_str); cmd.Parameters.AddWithValue("@i_row_limit", i_row_limit); MySqlDataReader reader = cmd.ExecuteReader(); int defaultNum = 0; string defaultString = ""; List <Base_Companys> list_cpn = new List <Base_Companys>(); while (reader.Read()) { Base_Companys bs_cpn = new Base_Companys(); bs_cpn.Company_id = reader.IsDBNull(0) ? defaultNum : reader.GetInt32(0); bs_cpn.Company_code = reader.IsDBNull(1) ? defaultString : reader.GetString(1); bs_cpn.Company_N_name = reader.IsDBNull(2) ? defaultString : reader.GetString(2); bs_cpn.Company_F_name = reader.IsDBNull(3) ? defaultString : reader.GetString(3); bs_cpn.Company_tax_id = reader.IsDBNull(4) ? defaultString : reader.GetString(4); bs_cpn.Company_tax_subcode = reader.IsDBNull(5) ? defaultString : reader.GetString(5); bs_cpn.Company_address_no = reader.IsDBNull(6) ? defaultString : reader.GetString(6); bs_cpn.Company_vilage = reader.IsDBNull(7) ? defaultString : reader.GetString(7); bs_cpn.Company_vilage_no = reader.IsDBNull(8) ? defaultString : reader.GetString(8); bs_cpn.Company_alley = reader.IsDBNull(9) ? defaultString : reader.GetString(9); bs_cpn.Company_road = reader.IsDBNull(10) ? defaultString : reader.GetString(10); bs_cpn.Company_subdistrict = reader.IsDBNull(11) ? defaultString : reader.GetString(11); bs_cpn.Company_district = reader.IsDBNull(12) ? defaultString : reader.GetString(12); bs_cpn.Company_province = reader.IsDBNull(13) ? defaultString : reader.GetString(13); bs_cpn.Company_country = reader.IsDBNull(14) ? defaultString : reader.GetString(14); bs_cpn.Company_zipcode = reader.IsDBNull(15) ? defaultString : reader.GetString(15); bs_cpn.Company_tel = reader.IsDBNull(16) ? defaultString : reader.GetString(16); bs_cpn.Company_Save_date = reader.IsDBNull(17) ? defaultString : reader.GetString(17); bs_cpn.Company_package = reader.IsDBNull(18) ? defaultString : reader.GetString(18); list_cpn.Add(bs_cpn); } return(list_cpn); } catch (MySqlException ex) { error = "MysqlException ==> Managers_Base --> Base_Companys_Manager --> getCompanys() "; Log_Error._writeErrorFile(error, ex); return(null); } catch (Exception ex) { error = "Exception ==> Managers_Base --> Base_Companys_Manager --> getCompanys() "; Log_Error._writeErrorFile(error, ex); return(null); } finally { con.Close(); con.Dispose(); } }
private void _loadLeasingDetails(string leasing_id, string idcard, string bill_no) { cls = cls_mng.getCarLeasingById(leasing_id); Leasing_Date_TBx.Text = DateTimeUtility.convertDateToPageRealServer(cls.Leasing_date); Deps_No_TBx.Text = cls.Deps_no; Leasing_No_TBx.Text = cls.Leasing_no; Leasing_Comments_Lbl.Text = cls.Leasing_Comment; bs_cpn = bs_cpn_mng.getCompanysById(cls.bs_cpn.Company_id.ToString()); Company_N_Name_TBx.Text = bs_cpn.Company_N_name; Company_F_Name_TBx.Text = bs_cpn.Company_F_name; bs_zn = bs_zn_mng.getZoneById(cls.bs_zn.Zone_id); Zone_Name_TBx.Text = bs_zn.Zone_code + " " + bs_zn.Zone_name; ctm = cls_ctm_mng.getCustomersLeasing(leasing_id, idcard); if (ctm != null) { Customer_Name_TBx.Text = ctm.Cust_Fname + " " + ctm.Cust_LName; Customer_Idcard_TBx.Text = ctm.Cust_Idcard.Length == 13 ? ctm.Cust_Idcard.Substring(0, 1) + "-" + ctm.Cust_Idcard.Substring(1, 4) + "-" + ctm.Cust_Idcard.Substring(5, 5) + "-" + ctm.Cust_Idcard.Substring(10, 2) + "-" + ctm.Cust_Idcard.Substring(12) : ctm.Cust_Idcard; //Customer_B_Date_TBx.Text = DateTimeUtility.convertDateToPage(ctm.Cust_B_date); //Customer_Age_TBx.Text = ctm.Cust_Age.ToString(); Customer_H_Address_TBx.Text = string.IsNullOrEmpty(ctm.Cust_Home_address_no) ? "" : ctm.Cust_Home_address_no; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_vilage_no) ? "" : ctm.Cust_Home_vilage_no.IndexOf('.') >= 1 ? ctm.Cust_Home_vilage_no.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_vilage_no : ""; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_vilage) ? "" : ctm.Cust_Home_vilage.IndexOf('.') >= 1 ? ctm.Cust_Home_vilage.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_vilage : ""; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_alley) ? "" : ctm.Cust_Home_alley.IndexOf('.') >= 1 ? ctm.Cust_Home_alley.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_alley : ""; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_road) ? "" : ctm.Cust_Home_road.IndexOf('.') >= 1 ? ctm.Cust_Home_road.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_road : ""; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_subdistrict) ? "" : ctm.Cust_Home_subdistrict.IndexOf('.') >= 1 ? ctm.Cust_Home_subdistrict.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_subdistrict : ""; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_district) ? "" : ctm.Cust_Home_district.IndexOf('.') >= 1 ? ctm.Cust_Home_district.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_district : ""; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_province) ? "" : ctm.Cust_Home_province.IndexOf('.') >= 1 ? ctm.Cust_Home_province.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_province : ""; Customer_C_Address_TBx.Text = string.IsNullOrEmpty(ctm.Cust_Current_address_no) ? "" : ctm.Cust_Current_address_no; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_vilage_no) ? "" : ctm.Cust_Current_vilage_no.IndexOf('.') >= 1 ? ctm.Cust_Current_vilage_no.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_vilage_no : ""; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_vilage) ? "" : ctm.Cust_Current_vilage.IndexOf('.') >= 1 ? ctm.Cust_Current_vilage.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_vilage : ""; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_alley) ? "" : ctm.Cust_Current_alley.IndexOf('.') >= 1 ? ctm.Cust_Current_alley.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_alley : ""; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_road) ? "" : ctm.Cust_Current_road.IndexOf('.') >= 1 ? ctm.Cust_Current_road.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_road : ""; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_subdistrict) ? "" : ctm.Cust_Current_subdistrict.IndexOf('.') >= 1 ? ctm.Cust_Current_subdistrict.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_subdistrict : ""; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_district) ? "" : ctm.Cust_Current_district.IndexOf('.') >= 1 ? ctm.Cust_Current_district.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_district : ""; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_province) ? "" : ctm.Cust_Current_province.IndexOf('.') >= 1 ? ctm.Cust_Current_province.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_province : ""; } Car_Type_TBx.Text = cls.Car_type; bs_cbrn = cbrn_mng.getCarBrandById(cls.bs_cbrn.car_brand_id); if (bs_cbrn != null) { Car_Brand_TBx.Text = bs_cbrn.car_brand_name_th + " ( " + bs_cbrn.car_brand_name_eng + " )"; } Car_Plate_TBx.Text = cls.Car_license_plate + " " + cls.Car_license_plate_province; Car_Chassis_No_TBx.Text = cls.Car_chassis_no; Car_Engine_No_TBx.Text = cls.Car_engine_no; cag_com = cag_mng.getAgentCommission("", leasing_id); Agent_Commission_TBx.Text = cag_com.Agent_commission.ToString("#,###.00"); Finance_Cost_TBx.Text = cls.Total_require.ToString("#,###.00"); Finance_Value_TBx.Text = cls.Total_sum.ToString("#,###.00"); Leasing_Cost_TBx.Text = cls.Total_Net_leasing.ToString("#,###.00"); Period_Amount_TBx.Text = cls.Total_period.ToString(); Period_Payment_TBx.Text = cls.Period_payment.ToString("#,###.00"); Payment_Schedule_TBx.Text = cls.Payment_schedule.ToString(); Frist_Payment_Date_TBx.Text = DateTimeUtility.convertDateToPageRealServer(cls.First_payment_date); Bill_No_TBx.Text = bill_no; Period_fee_TBx.Text = "0.00"; Period_track_TBx.Text = "0.00"; List <Car_Leasings_Payment> list_cls_pay = cls_pay_mng.getRealPaymentInfo(leasing_id); double total_payment_left = 0.00; double total_payment_fine = 0.00; double total_fee = 0.00; double total_track = 0.00; double total_real_payment = 0.00; double total_rea_payment_fine = 0.00; double total_discount = 0.00; for (int i = 0; i < list_cls_pay.Count; i++) { Car_Leasings_Payment cls_pay = list_cls_pay[i]; if (cls_pay.Bill_no == bill_no) { Payment_Date_TBx.Text = DateTimeUtility.convertDateToPageRealServer(cls_pay.Real_payment_date); total_fee += cls_pay.Period_fee; total_track += cls_pay.Period_track; total_real_payment += cls_pay.Real_payment; total_rea_payment_fine += cls_pay.Real_payment_fine; total_discount += cls_pay.Discount; total_payment_left = cls_pay.Total_payment_left; total_payment_fine = cls_pay.Total_payment_fine; Bill_No_Manual_Ref_TBx.Text = cls_pay.Bill_no_manual_ref; Session["old_company"] = cls_pay.bs_cpn.Company_id; } } Total_payment_left_TBx.Text = total_payment_left.ToString("#,###.00"); Total_payment_fine_TBx.Text = total_payment_fine.ToString("#,###.00"); Old_Period_fee_TBx.Text = total_fee.ToString("#,###.00"); Old_Period_track_TBx.Text = total_track.ToString("#,###.00"); Old_Real_Payment_TBx.Text = total_real_payment.ToString("#,###.00"); Old_Real_Payment_Fine_TBx.Text = total_rea_payment_fine.ToString("#,###.00"); Old_Real_Discount_TBx.Text = total_discount.ToString("#,###.00"); Session["list_cls_pay"] = list_cls_pay; Real_Payment_TBx.Focus(); }
/******************************************************************************************************************************************************************************* **************************************************** Add Data Function ******************************************************** **************************************************** ******************************************************** *******************************************************************************************************************************************************************************/ private void _EditAgent() { Agents_Manager cag_mng = new Agents_Manager(); Agents cag = new Agents(); bool past_page = false; if (Session["chk_agent"] != null) { Agents cag_tmp = (Agents)Session["chk_agent"]; cag.Agent_id = cag_mng.generateAgentID(); cag.Agent_Fname = string.IsNullOrEmpty(Agent_fname_TBx.Text) ? "" : Agent_fname_TBx.Text; cag.Agent_Lname = string.IsNullOrEmpty(Agent_lname_TBx.Text) ? "" : Agent_lname_TBx.Text; cag.Agent_Idcard = string.IsNullOrEmpty(Agent_idcard_TBx.Text) ? "" : Agent_idcard_TBx.Text; cag.Agent_Address_no = string.IsNullOrEmpty(Agent_address_no_TBx.Text) ? "" : Agent_address_no_TBx.Text; cag.Agent_Vilage = string.IsNullOrEmpty(Agent_vilage_TBx.Text) ? "บ.-" : "บ." + Agent_vilage_TBx.Text; cag.Agent_Vilage_no = string.IsNullOrEmpty(Agent_vilage_no_TBx.Text) ? "ม.-" : "ม." + Agent_vilage_no_TBx.Text; cag.Agent_Alley = string.IsNullOrEmpty(Agent_alley_TBx.Text) ? "ซ.-" : "ซ." + Agent_alley_TBx.Text; cag.Agent_Road = string.IsNullOrEmpty(Agent_road_TBx.Text) ? "ถ.-" : "ถ." + Agent_road_TBx.Text; cag.Agent_Subdistrict = string.IsNullOrEmpty(Agent_subdistrict_TBx.Text) ? "ต.-" : "ต." + Agent_subdistrict_TBx.Text; cag.Agent_District = string.IsNullOrEmpty(Agent_district_TBx.Text) ? "อ.-" : "อ." + Agent_district_TBx.Text; cag.Agent_Province = Agent_province_DDL.SelectedIndex <= 0 ? "จ.-" : "จ." + Agent_province_DDL.SelectedItem.Text; cag.Agent_Country = string.IsNullOrEmpty(Agent_country_TBx.Text) ? "" : Agent_country_TBx.Text; cag.Agent_Zipcode = string.IsNullOrEmpty(Agent_zipcode_TBx.Text) ? "" : Agent_zipcode_TBx.Text; past_page = cag_mng.editAgent(cag); } else { cag.Agent_id = cag_mng.generateAgentID(); cag.Agent_Fname = string.IsNullOrEmpty(Agent_fname_TBx.Text) ? "" : Agent_fname_TBx.Text; cag.Agent_Lname = string.IsNullOrEmpty(Agent_lname_TBx.Text) ? "" : Agent_lname_TBx.Text; cag.Agent_Idcard = string.IsNullOrEmpty(Agent_idcard_TBx.Text) ? "" : Agent_idcard_TBx.Text; cag.Agent_Address_no = string.IsNullOrEmpty(Agent_address_no_TBx.Text) ? "" : Agent_address_no_TBx.Text; cag.Agent_Vilage = string.IsNullOrEmpty(Agent_vilage_TBx.Text) ? "บ.-" : "บ." + Agent_vilage_TBx.Text; cag.Agent_Vilage_no = string.IsNullOrEmpty(Agent_vilage_no_TBx.Text) ? "ม.-" : "ม." + Agent_vilage_no_TBx.Text; cag.Agent_Alley = string.IsNullOrEmpty(Agent_alley_TBx.Text) ? "ซ.-" : "ซ." + Agent_alley_TBx.Text; cag.Agent_Road = string.IsNullOrEmpty(Agent_road_TBx.Text) ? "ถ.-" : "ถ." + Agent_road_TBx.Text; cag.Agent_Subdistrict = string.IsNullOrEmpty(Agent_subdistrict_TBx.Text) ? "ต.-" : "ต." + Agent_subdistrict_TBx.Text; cag.Agent_District = string.IsNullOrEmpty(Agent_district_TBx.Text) ? "อ.-" : "อ." + Agent_district_TBx.Text; cag.Agent_Province = Agent_province_DDL.SelectedIndex <= 0 ? "จ.-" : "จ." + Agent_province_DDL.SelectedItem.Text; cag.Agent_Country = string.IsNullOrEmpty(Agent_country_TBx.Text) ? "" : Agent_country_TBx.Text; cag.Agent_Zipcode = string.IsNullOrEmpty(Agent_zipcode_TBx.Text) ? "" : Agent_zipcode_TBx.Text; past_page = cag_mng.addAgent(cag); } if (past_page) { Session.Remove("chk_agent"); Alert_Success_Panel.Visible = true; /// Acticity Logs System /// package_login = (Base_Companys)Session["Package"]; acc_lgn = (Account_Login)Session["Login"]; 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 } else { Alert_Danger_Panel.Visible = true; alert_header_danger_Lbl.Text = "แจ้งเตือน!!"; alert_danger_Lbl.Text = "กรุณาตรวจสอบ ข้อมูลอีกครั้ง"; Alert_Danger_Panel.Focus(); } }
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(); _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 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(); } } } }
private void _loadReport() { cls = (Car_Leasings)Session["Leasings"]; package_login = (Base_Companys)Session["Package"]; acc_lgn = (Account_Login)Session["Login"]; MySqlConnection con_cls = MySQLConnection.connectionMySQL(); MySqlConnection con_cpn = MySQLConnection.connectionMySQL(); try { con_cls.Open(); MySqlCommand cmd_cls = new MySqlCommand("rpt_leasings", con_cls); cmd_cls.CommandType = CommandType.StoredProcedure; cmd_cls.Parameters.AddWithValue("@i_Leasing_id", cls.Leasing_id); MySqlDataReader reader_cls = cmd_cls.ExecuteReader(); con_cpn.Open(); MySqlCommand cmd_cpn = new MySqlCommand("rpt_withholding_tax", con_cpn); cmd_cpn.CommandType = CommandType.StoredProcedure; cmd_cpn.Parameters.AddWithValue("@i_Leasing_id", cls.Leasing_id); MySqlDataReader reader_cpn = cmd_cpn.ExecuteReader(); Leasing_Ds ls_ds = new Leasing_Ds(); ls_ds.Clear(); ls_ds.Tables["Leasings"].Load(reader_cls); ls_ds.Tables["Agent_Commission"].Load(reader_cpn); Withholding_Tax rpt = new Withholding_Tax(); rpt.SetDataSource(ls_ds); 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(rpt); } catch (MySqlException ex) { error = "MysqlException ==> Car_Leasing_KH11 : Page --> _loadReport() "; Log_Error._writeErrorFile(error, ex); } catch (Exception ex) { error = "Exception ==> Car_Leasing_KH11 : Page --> _loadReport() "; Log_Error._writeErrorFile(error, ex); } finally { con_cls.Close(); con_cpn.Close(); con_cls.Dispose(); con_cpn.Dispose(); } /// 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 GC.Collect(); }
protected void Company_Name_DDl_SelectedIndexChanged(object sender, EventArgs e) { _clearText(); if (Company_Name_DDl.SelectedValue != "0") { List <Base_Companys> list_data = new Base_Companys_Manager().getCompanysAddressForWebReport(Company_Name_DDl.SelectedValue); for (int i = 0; i < list_data.Count; i++) { Base_Companys data = list_data[i]; string address = ""; if (data.Company_tax_subcode == "000") { address += data.Company_address_no; address += data.Company_vilage.Split('.')[1] == "-" ? "" : " " + data.Company_vilage; address += data.Company_vilage_no.Split('.')[1] == "-" ? "" : " " + data.Company_vilage_no; address += data.Company_alley.Split('.')[1] == "-" ? "" : " " + data.Company_alley; address += data.Company_road.Split('.')[1] == "-" ? "" : " " + data.Company_road; address += data.Company_subdistrict.Split('.')[1] == "-" ? "" : " " + data.Company_subdistrict; address += data.Company_district.Split('.')[1] == "-" ? "" : " " + data.Company_district; address += " จ." + data.Company_province; Company_Address_TBx.Text = "สำนักงานใหญ่ : " + address; } else if (data.Company_tax_subcode == "001") { address += data.Company_address_no; address += data.Company_vilage.Split('.')[1] == "-" ? "" : " " + data.Company_vilage; address += data.Company_vilage_no.Split('.')[1] == "-" ? "" : " " + data.Company_vilage_no; address += data.Company_alley.Split('.')[1] == "-" ? "" : " " + data.Company_alley; address += data.Company_road.Split('.')[1] == "-" ? "" : " " + data.Company_road; address += data.Company_subdistrict.Split('.')[1] == "-" ? "" : " " + data.Company_subdistrict; address += data.Company_district.Split('.')[1] == "-" ? "" : " " + data.Company_district; address += " จ." + data.Company_province; SubCompany_Address_1_TBx.Text = data.Company_N_name + " : " + address; } else if (data.Company_tax_subcode == "002") { address += data.Company_address_no; address += data.Company_vilage.Split('.')[1] == "-" ? "" : " " + data.Company_vilage; address += data.Company_vilage_no.Split('.')[1] == "-" ? "" : " " + data.Company_vilage_no; address += data.Company_alley.Split('.')[1] == "-" ? "" : " " + data.Company_alley; address += data.Company_road.Split('.')[1] == "-" ? "" : " " + data.Company_road; address += data.Company_subdistrict.Split('.')[1] == "-" ? "" : " " + data.Company_subdistrict; address += data.Company_district.Split('.')[1] == "-" ? "" : " " + data.Company_district; address += " จ." + data.Company_province; SubCompany_Address_1_TBx.Text = data.Company_N_name + " : " + address; } else if (data.Company_tax_subcode == "003") { address += data.Company_address_no; address += data.Company_vilage.Split('.')[1] == "-" ? "" : " " + data.Company_vilage; address += data.Company_vilage_no.Split('.')[1] == "-" ? "" : " " + data.Company_vilage_no; address += data.Company_alley.Split('.')[1] == "-" ? "" : " " + data.Company_alley; address += data.Company_road.Split('.')[1] == "-" ? "" : " " + data.Company_road; address += data.Company_subdistrict.Split('.')[1] == "-" ? "" : " " + data.Company_subdistrict; address += data.Company_district.Split('.')[1] == "-" ? "" : " " + data.Company_district; address += " จ." + data.Company_province; SubCompany_Address_1_TBx.Text = data.Company_N_name + " : " + address; } } } }
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 _loadLeasingDetails(string leasing_id, string idcard) { cls = cls_mng.getCarLeasingById(leasing_id); Leasing_Comments_Lbl.Text = cls.Leasing_Comment; if (cls.Total_payment_left == 0) { Close_Leasing_Lbl.Visible = true; Cal_Status_Lbl.Visible = false; Payment_Btn.Visible = false; Calculate_Close_Leasing_Btn.Visible = false; Back_Before_Page_Btn.Visible = false; Leasing_Date_TBx.Text = DateTimeUtility.convertDateToPageRealServer(cls.Leasing_date); Deps_No_TBx.Text = cls.Deps_no; Leasing_No_TBx.Text = cls.Leasing_no; bs_cpn = bs_cpn_mng.getCompanysById(cls.bs_cpn.Company_id.ToString()); Company_N_Name_TBx.Text = bs_cpn.Company_N_name; Company_F_Name_TBx.Text = bs_cpn.Company_F_name; bs_zn = bs_zn_mng.getZoneById(cls.bs_zn.Zone_id); Zone_Name_TBx.Text = bs_zn.Zone_code + " " + bs_zn.Zone_name; ctm = cls_ctm_mng.getCustomersLeasing(leasing_id, idcard); if (ctm != null) { Customer_Name_TBx.Text = ctm.Cust_Fname + " " + ctm.Cust_LName; Customer_Idcard_TBx.Text = ctm.Cust_Idcard.Length == 13 ? ctm.Cust_Idcard.Substring(0, 1) + "-" + ctm.Cust_Idcard.Substring(1, 4) + "-" + ctm.Cust_Idcard.Substring(5, 5) + "-" + ctm.Cust_Idcard.Substring(10, 2) + "-" + ctm.Cust_Idcard.Substring(12) : ctm.Cust_Idcard; //Customer_B_Date_TBx.Text = DateTimeUtility.convertDateToPage(ctm.Cust_B_date); //Customer_Age_TBx.Text = ctm.Cust_Age.ToString(); Customer_H_Address_TBx.Text = string.IsNullOrEmpty(ctm.Cust_Home_address_no) ? "" : ctm.Cust_Home_address_no; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_vilage_no) ? "" : ctm.Cust_Home_vilage_no.IndexOf('.') >= 1 ? ctm.Cust_Home_vilage_no.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_vilage_no : ""; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_vilage) ? "" : ctm.Cust_Home_vilage.IndexOf('.') >= 1 ? ctm.Cust_Home_vilage.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_vilage : ""; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_alley) ? "" : ctm.Cust_Home_alley.IndexOf('.') >= 1 ? ctm.Cust_Home_alley.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_alley : ""; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_road) ? "" : ctm.Cust_Home_road.IndexOf('.') >= 1 ? ctm.Cust_Home_road.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_road : ""; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_subdistrict) ? "" : ctm.Cust_Home_subdistrict.IndexOf('.') >= 1 ? ctm.Cust_Home_subdistrict.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_subdistrict : ""; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_district) ? "" : ctm.Cust_Home_district.IndexOf('.') >= 1 ? ctm.Cust_Home_district.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_district : ""; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_province) ? "" : ctm.Cust_Home_province.IndexOf('.') >= 1 ? ctm.Cust_Home_province.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_province : ""; Customer_C_Address_TBx.Text = string.IsNullOrEmpty(ctm.Cust_Current_address_no) ? "" : ctm.Cust_Current_address_no; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_vilage_no) ? "" : ctm.Cust_Current_vilage_no.IndexOf('.') >= 1 ? ctm.Cust_Current_vilage_no.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_vilage_no : ""; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_vilage) ? "" : ctm.Cust_Current_vilage.IndexOf('.') >= 1 ? ctm.Cust_Current_vilage.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_vilage : ""; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_alley) ? "" : ctm.Cust_Current_alley.IndexOf('.') >= 1 ? ctm.Cust_Current_alley.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_alley : ""; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_road) ? "" : ctm.Cust_Current_road.IndexOf('.') >= 1 ? ctm.Cust_Current_road.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_road : ""; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_subdistrict) ? "" : ctm.Cust_Current_subdistrict.IndexOf('.') >= 1 ? ctm.Cust_Current_subdistrict.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_subdistrict : ""; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_district) ? "" : ctm.Cust_Current_district.IndexOf('.') >= 1 ? ctm.Cust_Current_district.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_district : ""; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_province) ? "" : ctm.Cust_Current_province.IndexOf('.') >= 1 ? ctm.Cust_Current_province.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_province : ""; } Car_Type_TBx.Text = cls.Car_type; bs_cbrn = cbrn_mng.getCarBrandById(cls.bs_cbrn.car_brand_id); if (bs_cbrn != null) { Car_Brand_TBx.Text = bs_cbrn.car_brand_name_th + " ( " + bs_cbrn.car_brand_name_eng + " )"; } Car_Plate_TBx.Text = cls.Car_license_plate + " " + cls.Car_license_plate_province; Car_Chassis_No_TBx.Text = cls.Car_chassis_no; Car_Engine_No_TBx.Text = cls.Car_engine_no; cag_com = cag_mng.getAgentCommission("", leasing_id); Agent_Commission_TBx.Text = cag_com.Agent_commission.ToString("#,###.00"); Finance_Cost_TBx.Text = cls.Total_require.ToString("#,###.00"); Finance_Value_TBx.Text = cls.Total_sum.ToString("#,###.00"); Leasing_Cost_TBx.Text = cls.Total_Net_leasing.ToString("#,###.00"); Period_Amount_TBx.Text = cls.Total_period.ToString(); Period_Payment_TBx.Text = cls.Period_payment.ToString("#,###.00"); Payment_Schedule_TBx.Text = cls.Payment_schedule.ToString(); Frist_Payment_Date_TBx.Text = DateTimeUtility.convertDateToPageRealServer(cls.First_payment_date); Payment_Date_TBx.Enabled = false; List <Car_Leasings_Payment> list_cls_pay = cls_pay_mng.getRealPaymentInfo(leasing_id); Session["list_cls_pay"] = list_cls_pay; Period_free_TBx.Enabled = false; Period_track_TBx.Enabled = false; Real_Payment_TBx.Enabled = false; Real_Payment_Fine_TBx.Enabled = false; Real_Discount_TBx.Enabled = false; Payment_Date_TBx.Text = ""; Period_No_TBx.Text = ""; Total_Payment_Period_TBx.Text = ""; Total_payment_left_TBx.Text = ""; Period_free_TBx.Text = ""; Period_track_TBx.Text = ""; Discount_TBx.Text = ""; Total_payment_fine_TBx.Text = ""; Total_period_left_TBx.Text = ""; Period_fine_TBx.Text = ""; Cal_Period_Payment_TBx.Text = ""; } else { Leasing_Date_TBx.Text = DateTimeUtility.convertDateToPageRealServer(cls.Leasing_date); Deps_No_TBx.Text = cls.Deps_no; Leasing_No_TBx.Text = cls.Leasing_no; bs_cpn = bs_cpn_mng.getCompanysById(cls.bs_cpn.Company_id.ToString()); Company_N_Name_TBx.Text = bs_cpn.Company_N_name; Company_F_Name_TBx.Text = bs_cpn.Company_F_name; bs_zn = bs_zn_mng.getZoneById(cls.bs_zn.Zone_id); Zone_Name_TBx.Text = bs_zn.Zone_code + " " + bs_zn.Zone_name; ctm = cls_ctm_mng.getCustomersLeasing(leasing_id, idcard); if (ctm != null) { Customer_Name_TBx.Text = ctm.Cust_Fname + " " + ctm.Cust_LName; Customer_Idcard_TBx.Text = ctm.Cust_Idcard.Length == 13 ? ctm.Cust_Idcard.Substring(0, 1) + "-" + ctm.Cust_Idcard.Substring(1, 4) + "-" + ctm.Cust_Idcard.Substring(5, 5) + "-" + ctm.Cust_Idcard.Substring(10, 2) + "-" + ctm.Cust_Idcard.Substring(12) : ctm.Cust_Idcard; //Customer_B_Date_TBx.Text = DateTimeUtility.convertDateToPage(ctm.Cust_B_date); //Customer_Age_TBx.Text = ctm.Cust_Age.ToString(); Customer_H_Address_TBx.Text = string.IsNullOrEmpty(ctm.Cust_Home_address_no) ? "" : ctm.Cust_Home_address_no; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_vilage_no) ? "" : ctm.Cust_Home_vilage_no.IndexOf('.') >= 1 ? ctm.Cust_Home_vilage_no.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_vilage_no : ""; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_vilage) ? "" : ctm.Cust_Home_vilage.IndexOf('.') >= 1 ? ctm.Cust_Home_vilage.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_vilage : ""; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_alley) ? "" : ctm.Cust_Home_alley.IndexOf('.') >= 1 ? ctm.Cust_Home_alley.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_alley : ""; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_road) ? "" : ctm.Cust_Home_road.IndexOf('.') >= 1 ? ctm.Cust_Home_road.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_road : ""; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_subdistrict) ? "" : ctm.Cust_Home_subdistrict.IndexOf('.') >= 1 ? ctm.Cust_Home_subdistrict.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_subdistrict : ""; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_district) ? "" : ctm.Cust_Home_district.IndexOf('.') >= 1 ? ctm.Cust_Home_district.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_district : ""; Customer_H_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Home_province) ? "" : ctm.Cust_Home_province.IndexOf('.') >= 1 ? ctm.Cust_Home_province.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Home_province : ""; Customer_C_Address_TBx.Text = string.IsNullOrEmpty(ctm.Cust_Current_address_no) ? "" : ctm.Cust_Current_address_no; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_vilage_no) ? "" : ctm.Cust_Current_vilage_no.IndexOf('.') >= 1 ? ctm.Cust_Current_vilage_no.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_vilage_no : ""; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_vilage) ? "" : ctm.Cust_Current_vilage.IndexOf('.') >= 1 ? ctm.Cust_Current_vilage.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_vilage : ""; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_alley) ? "" : ctm.Cust_Current_alley.IndexOf('.') >= 1 ? ctm.Cust_Current_alley.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_alley : ""; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_road) ? "" : ctm.Cust_Current_road.IndexOf('.') >= 1 ? ctm.Cust_Current_road.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_road : ""; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_subdistrict) ? "" : ctm.Cust_Current_subdistrict.IndexOf('.') >= 1 ? ctm.Cust_Current_subdistrict.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_subdistrict : ""; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_district) ? "" : ctm.Cust_Current_district.IndexOf('.') >= 1 ? ctm.Cust_Current_district.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_district : ""; Customer_C_Address_TBx.Text += string.IsNullOrEmpty(ctm.Cust_Current_province) ? "" : ctm.Cust_Current_province.IndexOf('.') >= 1 ? ctm.Cust_Current_province.Split('.')[1] == "-" ? "" : " " + ctm.Cust_Current_province : ""; } Car_Type_TBx.Text = cls.Car_type; bs_cbrn = cbrn_mng.getCarBrandById(cls.bs_cbrn.car_brand_id); if (bs_cbrn != null) { Car_Brand_TBx.Text = bs_cbrn.car_brand_name_th + " ( " + bs_cbrn.car_brand_name_eng + " )"; } Car_Plate_TBx.Text = cls.Car_license_plate + " " + cls.Car_license_plate_province; Car_Chassis_No_TBx.Text = cls.Car_chassis_no; Car_Engine_No_TBx.Text = cls.Car_engine_no; cag_com = cag_mng.getAgentCommission("", leasing_id); Agent_Commission_TBx.Text = cag_com.Agent_commission.ToString("#,###.00"); Finance_Cost_TBx.Text = cls.Total_require.ToString("#,###.00"); Finance_Value_TBx.Text = cls.Total_sum.ToString("#,###.00"); Leasing_Cost_TBx.Text = cls.Total_Net_leasing.ToString("#,###.00"); Period_Amount_TBx.Text = cls.Total_period.ToString(); Period_Payment_TBx.Text = cls.Period_payment.ToString("#,###.00"); Payment_Schedule_TBx.Text = cls.Payment_schedule.ToString(); Frist_Payment_Date_TBx.Text = DateTimeUtility.convertDateToPageRealServer(cls.First_payment_date); Payment_Date_TBx.Text = DateTimeUtility.convertDateToPageRealServer(DateTime.Now.ToString()); Period_No_TBx.Text = cls.Total_period_length; Total_Payment_Period_TBx.Text = cls.Total_period_lose == 0 ? "1" : cls.Total_period_lose.ToString(); Total_payment_left_TBx.Text = cls.Total_payment_left.ToString("#,###.00"); Period_free_TBx.Text = "0.00"; Period_track_TBx.Text = "0.00"; Discount_TBx.Text = "0.00"; List <Car_Leasings_Payment> list_cls_pay = cls_pay_mng.getRealPaymentInfo(leasing_id); double total_lost = 0.00; double total_payment_fine = 0.00; double payment_fine = 0.00; double real_payment_fine = 0.00; double real_payment = 0.00; double next_period_no = 1; double duplicate_period = 0; for (int i = 0; i < list_cls_pay.Count; i++) { Car_Leasings_Payment cls_pay = list_cls_pay[i]; if (string.IsNullOrEmpty(cls.Total_period_length)) { total_lost = cls_pay.Period_current; Period_No_TBx.Text = next_period_no.ToString(); } else { int period_str = Convert.ToInt32(cls.Total_period_length.Split('-')[0].Trim()); int period_end = Convert.ToInt32(cls.Total_period_length.Split('-')[1].Trim()); if (cls_pay.Period_no >= period_str && cls_pay.Period_no <= period_end && cls_pay.Period_no != duplicate_period) { total_lost += cls_pay.Period_current; } } if (cls_pay.Period_fine > 0 && cls_pay.Period_no != duplicate_period) { payment_fine += cls_pay.Period_fine; } if (cls_pay.Real_payment_fine > 0) { real_payment_fine += cls_pay.Real_payment_fine; } if (cls_pay.Real_payment > 0 && cls_pay.Period_payment_status != 9) { real_payment += cls_pay.Real_payment; } if (cls_pay.Period_payment_status == 9 && cls_pay.Period_no != duplicate_period) { next_period_no += 1; } duplicate_period = cls_pay.Period_no; } total_payment_fine = payment_fine - real_payment_fine; Total_payment_fine_TBx.Text = total_payment_fine > 0 ? total_payment_fine.ToString("#,###.00") : "0.00"; Total_period_left_TBx.Text = string.IsNullOrEmpty(cls.Total_period_length) ? "0.00" : (total_lost - real_payment).ToString("#,###.00"); Period_fine_TBx.Text = total_payment_fine < 0 ? "0.00" : total_payment_fine.ToString("#,###.00"); Cal_Period_Payment_TBx.Text = (total_lost - real_payment).ToString("#,###.00"); Session["list_cls_pay"] = list_cls_pay; Real_Payment_TBx.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(); }