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(); }
/******************************************************************************************************************************************************************************* **************************************************** Get Data And Replace To Form Function ******************************************************** **************************************************** ******************************************************** *******************************************************************************************************************************************************************************/ private void _GetLeasing(string Leasing_id) { Car_Leasings_Manager cls_mng = new Car_Leasings_Manager(); Car_Leasings cls_tmp = cls_mng.getCarLeasingById(Leasing_id); Deps_No_TBx.Text = cls_tmp.Deps_no; Leasing_No_TBx.Text = cls_tmp.Leasing_no; Leasing_Code_DDL.SelectedValue = cls_tmp.bs_ls_code.Leasing_code_id.ToString(); Leasing_Date_TBx.Text = DateTimeUtility.convertDateToPageRealServer(cls_tmp.Leasing_date); Company_DDL.SelectedValue = cls_tmp.bs_cpn.Company_id.ToString(); Zone_DDL.SelectedValue = cls_tmp.bs_zn.Zone_id.ToString(); Court_DDL.SelectedValue = cls_tmp.bs_ct.Court_id.ToString(); Person_Receive_Trasfer_TBx.Text = cls_tmp.PeReT; TotalPaymentTime_DDL.SelectedValue = cls_tmp.TotalPaymentTime.ToString(); Total_Require_TBx.Text = cls_tmp.Total_require.ToString(); Interest_Rate_TBx.Text = cls_tmp.Interest_rate.ToString(); Total_Period_TBx.Text = cls_tmp.Total_period.ToString(); Total_Sum_TBx.Text = cls_tmp.Total_sum.ToString("#,##0.00"); Total_Interest_TBx.Text = cls_tmp.Total_Interest.ToString("#,##0.00"); Total_Tax_TBx.Text = cls_tmp.Total_Tax.ToString("#,##0.00"); Total_Leasing_TBx.Text = cls_tmp.Total_leasing.ToString("#,##0.00"); Total_Net_Leasing_TBx.Text = cls_tmp.Total_Net_leasing.ToString("#,##0.00"); Period_Cal_TBx.Text = cls_tmp.Period_cal.ToString("#,##0.00"); Period_interst_TBx.Text = cls_tmp.Period_interst.ToString("#,##0.00"); Period_tax_TBx.Text = cls_tmp.Period_tax.ToString("#,##0.00"); Period_pure_TBx.Text = cls_tmp.Period_pure.ToString("#,##0.00"); Period_Payment_TBx.Text = cls_tmp.Period_payment.ToString("#,##0.00"); Period_require_TBx.Text = cls_tmp.Period_require.ToString("#,##0.00"); Payment_Schedule_DDL.SelectedValue = cls_tmp.Payment_schedule.ToString(); First_Payment_Date_TBx.Text = DateTimeUtility.convertDateToPageRealServer(cls_tmp.First_payment_date); // ข้อมูลรถ Car_Register_Date_TBx.Text = string.IsNullOrEmpty(cls_tmp.Car_register_date) ? "" : DateTimeUtility.convertDateToPageRealServer(cls_tmp.Car_register_date); Car_Plate_TBx.Text = cls_tmp.Car_license_plate; Car_Plate_Province_DDL.SelectedValue = cls_tmp.Car_license_plate_province.IndexOf('.') >= 1 ? Thai_Province._getThaiProvinces(cls_tmp.Car_license_plate_province.Split('.')[1]) : "0"; Car_Type_TBx.Text = cls_tmp.Car_type; Car_Feature_TBx.Text = cls_tmp.Car_feature; Car_Brand_DDL.SelectedValue = cls_tmp.bs_cbrn.car_brand_id.ToString(); Car_Model_TBx.Text = cls_tmp.Car_model; Car_Year_DDL.SelectedValue = cls_tmp.Car_year; Car_Color_TBx.Text = cls_tmp.Car_color; Engine_No_TBx.Text = cls_tmp.Car_engine_no; Engine_No_At_TBx.Text = cls_tmp.Car_engine_no_at; Engine_Brand_TBx.Text = cls_tmp.Car_engine_brand; Chassis_No_TBx.Text = cls_tmp.Car_chassis_no; Chassis_No_At_TBx.Text = cls_tmp.Car_chassis_no_at; Car_Fuel_Type_TBx.Text = cls_tmp.Car_fual_type; Car_Gas_No_TBx.Text = cls_tmp.Car_gas_No; Car_Used_DDL.SelectedValue = cls_tmp.Car_used_id.ToString(); Car_Distance_TBx.Text = cls_tmp.Car_distance.ToString(); Car_Next_Register_Date_TBx.Text = string.IsNullOrEmpty(cls_tmp.Car_next_register_date) ? "" : DateTimeUtility.convertDateToPageRealServer(cls_tmp.Car_next_register_date); Car_Tax_Value_TBx.Text = cls_tmp.Car_tax_value.ToString(); Car_Credits_TBx.Text = cls_tmp.Car_credits; Car_agent_TBx.Text = cls_tmp.Car_agent; Car_Old_Owner_TBx.Text = cls_tmp.Car_old_owner; Car_Old_Owner_Idcard_TBx.Text = cls_tmp.Car_old_owner_idcard; Car_old_owner_b_date_TBx.Text = string.IsNullOrEmpty(cls_tmp.Car_old_owner_b_date) ? "" : DateTimeUtility.convertDateToPageRealServer(cls_tmp.Car_old_owner_b_date); Car_Old_Owner_Address_No_TBx.Text = cls_tmp.Car_old_owner_address_no; Car_Old_Owner_Vilage_TBx.Text = cls_tmp.Car_old_owner_vilage.IndexOf('.') >= 1 ? cls_tmp.Car_old_owner_vilage.Split('.')[1] : ""; Car_Old_Owner_Vilage_No_TBx.Text = cls_tmp.Car_old_owner_vilage_no.IndexOf('.') >= 1 ? cls_tmp.Car_old_owner_vilage_no.Split('.')[1] : ""; Car_Old_Owner_alley_TBx.Text = cls_tmp.Car_old_owner_alley.IndexOf('.') >= 1 ? cls_tmp.Car_old_owner_alley.Split('.')[1] : ""; Car_Old_Owner_Road_TBx.Text = cls_tmp.Car_old_owner_road.IndexOf('.') >= 1 ? cls_tmp.Car_old_owner_road.Split('.')[1] : ""; Car_Old_Owner_Subdistrict_TBx.Text = cls_tmp.Car_old_owner_subdistrict.IndexOf('.') >= 1 ? cls_tmp.Car_old_owner_subdistrict.Split('.')[1] : ""; Car_Old_Owner_District_TBx.Text = cls_tmp.Car_old_owner_district.IndexOf('.') >= 1 ? cls_tmp.Car_old_owner_district.Split('.')[1] : ""; Car_Old_Owner_Province_DDL.SelectedValue = cls_tmp.Car_old_owner_province.IndexOf('.') >= 1 ? Thai_Province._getThaiProvinces(cls_tmp.Car_old_owner_province.Split('.')[1]) : "0"; Car_Old_Owner_Contry_TBx.Text = cls_tmp.Car_old_owner_contry; Car_Old_Owner_Zipcode_TBx.Text = cls_tmp.Car_old_owner_zipcode; Tent_car_DDL.SelectedValue = cls_tmp.tent_car.Tent_car_id.ToString(); Cheque_receiver_TBx.Text = cls_tmp.Cheque_receiver; Cheque_bank_TBx.Text = cls_tmp.Cheque_bank; Cheque_bank_branch_TBx.Text = cls_tmp.Cheque_bank_branch; Cheque_number_TBx.Text = cls_tmp.Cheque_number; Cheque_sum_TBx.Text = cls_tmp.Cheque_sum.ToString(); Cheque_receive_date_TBx.Text = string.IsNullOrEmpty(cls_tmp.Cheque_receive_date) ? "" : DateTimeUtility.convertDateToPageRealServer(cls_tmp.Cheque_receive_date); Leasing_Comment_TBx.Text = cls_tmp.Leasing_Comment; _CheckLeasingPayment(Leasing_id); }
private void _checkOldData(string leasing_id) { cls = cls_mng.getCarLeasingById(leasing_id); /*string error = string.Empty; * * SqlConnection con = MSSQLConnection.connectionMSSQL(); * * List<Car_Leasings_Payment> list_cls_pay_shd = cls_pay_mng.getPaymentSchedule(cls.Leasing_id); * * Car_Leasings_Payment cls_pay_shd = list_cls_pay_shd[0]; * * if (cls_pay_shd.Period_payment_status == 0) * { * * try * { * con.Open(); * * string sql = " SELECT * FROM view_payment_byday WHERE cntNoTemp = '" + cls.Deps_no + "' ORDER BY scheduleno "; * * SqlCommand cmd = new SqlCommand(sql, con); * cmd.CommandTimeout = 0; * * SqlDataReader reader = cmd.ExecuteReader(); * * while (reader.Read()) * { * int defaultNum = 0; * string defaultString = ""; * * Car_Leasings_Payment cls_pay = new Car_Leasings_Payment(); * * cls_pay.Leasing_id = cls.Leasing_id; * cls_pay.Bill_no = reader.IsDBNull(2) ? defaultString : reader.GetString(2); * cls_pay.Period_fee = reader.IsDBNull(5) ? defaultNum : Convert.ToDouble(reader.GetDecimal(5)); * cls_pay.Period_track = reader.IsDBNull(7) ? defaultNum : Convert.ToDouble(reader.GetDecimal(7)); * cls_pay.Total_payment_fine = reader.IsDBNull(17) ? defaultNum : Convert.ToDouble(reader.GetDecimal(17)); * cls_pay.Discount = reader.IsDBNull(9) ? defaultNum : Convert.ToDouble(reader.GetDecimal(9)); * cls_pay.Real_payment = reader.IsDBNull(4) ? defaultNum : Convert.ToDouble(reader.GetDecimal(4)); * * cls_pay.Real_payment_date = reader.IsDBNull(3) ? null : DateTimeUtility.convertDateToMYSQLRealServer(reader.GetDateTime(3).ToString()); // Real Server JKLFTP * * //cls_pay.Real_payment_date = reader.IsDBNull(3) ? null : DateTimeUtility.convertDateToMYSQL(reader.GetDateTime(3).ToString()); // Second Server JKLWebBase * * cls_pay.acc_lgn = new Account_Login(); * * cls_pay.bs_cpn = new Base_Companys(); * * cls_pay.bs_cpn.Company_id = _getCompanys(reader.GetString(20)); * * if (cls_pay.Discount <= 0) * { * cls_pay_mng.addPayment_Mod_I(cls_pay, 1); * } * else * { * cls_pay_mng.addPayment_Mod_I(cls_pay, 2); * } * } * } * catch (SqlException ex) * { * error = "SqlException ==> Form_Leasings --> Leasing_Payment --> _checkOldData() "; * Log_Error._writeErrorFile(error, ex); * } * catch (Exception ex) * { * error = "Exception ==> Form_Leasings --> Leasing_Payment --> _checkOldData() "; * Log_Error._writeErrorFile(error, ex); * } * finally * { * con.Close(); * con.Dispose(); * } * }*/ cls_pay_mng.calculateFine(cls.Leasing_id); }