private void _GetLeasingCode() { List <Base_Leasing_Code> list_data = new Base_Leasing_Code_Manager().getLeasingCode(); int row = list_data.Count; Session["List_Base_Leasing_Code"] = list_data; }
/******************************************************************************************************************************************************************************* **************************************************** Load Default Data to Form ******************************************************** **************************************************** ******************************************************** *******************************************************************************************************************************************************************************/ // รหัสสัญญา private void _loadLeasingCode() { List <Base_Leasing_Code> list_data = new Base_Leasing_Code_Manager().getLeasingCode(); for (int i = 0; i < list_data.Count; i++) { Base_Leasing_Code data = list_data[i]; if (string.IsNullOrEmpty(data.Leasing_code_S_Name)) { Leasing_Code_ChkBxL.Items.Add(new ListItem(data.Leasing_code_name, data.Leasing_code_id.ToString())); } else { Leasing_Code_ChkBxL.Items.Add(new ListItem(data.Leasing_code_name + " ( " + data.Leasing_code_S_Name + " ) ", data.Leasing_code_id.ToString())); } } }
private void _loadReport() { string deposit_no = (string)Session["deposit_no_rpt"]; string leasing_no = (string)Session["leasing_no_rpt"]; string idcard = (string)Session["idcard_rpt"]; string fname = (string)Session["fname_rpt"]; string lname = (string)Session["lname_rpt"]; string date_str = (string)Session["date_str_rpt"]; string date_end = (string)Session["date_end_rpt"]; string lost_str = (string)Session["lost_str_rpt"]; string lost_end = (string)Session["lost_end_rpt"]; string district = (string)Session["district_rpt"]; string province = (string)Session["province_rpt"]; string leasing_Code_inline = (string)Session["leasing_Code_inline_rpt"]; string Company_id_inline = (string)Session["Company_id_inline_rpt"]; string zone_id_inline = (string)Session["zone_id_inline_rpt"]; string report_header = " รายงานลูกค้าขาดชำระค่างวด "; string report_case = "ค้นหา : "; if (!string.IsNullOrEmpty(lost_str) && string.IsNullOrEmpty(lost_end)) { report_case = report_case + " [ ขาด " + lost_str + " ] "; } else if (string.IsNullOrEmpty(lost_str) && !string.IsNullOrEmpty(lost_end)) { report_case = report_case + " [ ขาด " + lost_end + " ] "; } else if (!string.IsNullOrEmpty(lost_str) && !string.IsNullOrEmpty(lost_end)) { report_case = report_case + " [ ขาด " + lost_str + " - " + lost_end + " ] "; } if (!string.IsNullOrEmpty(district)) { report_case = report_case + " [ " + district + " ] "; } if (!string.IsNullOrEmpty(province)) { report_case = report_case + " [ " + province + " ] "; } if (!string.IsNullOrEmpty(leasing_Code_inline)) { string[] lsc = leasing_Code_inline.Split(','); List <Base_Leasing_Code> list_data = new Base_Leasing_Code_Manager().getLeasingCode(); for (int lsc_index = 0; lsc_index < lsc.Length; lsc_index++) { for (int i = 0; i < list_data.Count; i++) { if (lsc[lsc_index] == list_data[i].Leasing_code_id.ToString()) { report_case = report_case + " [ " + list_data[i].Leasing_code_name + " ] "; } } } } package_login = (Base_Companys)Session["Package"]; acc_lgn = (Account_Login)Session["Login"]; MySqlConnection con = MySQLConnection.connectionMySQL(); try { con.Open(); MySqlCommand cmd = new MySqlCommand("rpt_generals_leasing", con); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 0; cmd.Parameters.AddWithValue("@i_Deps_no", deposit_no); cmd.Parameters.AddWithValue("@i_Leasing_no", leasing_no); cmd.Parameters.AddWithValue("@i_Cust_idcard", idcard); cmd.Parameters.AddWithValue("@i_Cust_Fname", fname); cmd.Parameters.AddWithValue("@i_Cust_LName", lname); cmd.Parameters.AddWithValue("@i_Leasing_date_str", date_str); cmd.Parameters.AddWithValue("@i_Leasing_date_end", date_end); 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_lost_str", lost_str); cmd.Parameters.AddWithValue("@i_lost_end", lost_end); cmd.Parameters.AddWithValue("@i_district", district); cmd.Parameters.AddWithValue("@i_province", province); 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_General_Leasings"].Load(reader); Lost_Payment rpt = new Lost_Payment(); 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); rpt.SetParameterValue("Report_Case", report_case); 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 ==> Lost_Payment_Hurry_Export --> _loadReport() "; Log_Error._writeErrorFile(error, ex); } catch (Exception ex) { error = "Exception ==> Lost_Payment_Hurry_Export --> _loadReport() "; 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(); }