protected void btnUserAdd_Click(object sender, EventArgs e) { if (txtPass.Text == txtPass.Text) { string sql_check = "SELECT * FROM tbl_user WHERE username = '******'"; string script = ""; MySqlDataReader rs = function.MySqlSelect(sql_check); if (!rs.Read()) { string sql = "INSERT INTO tbl_user (username,password,name,level,user_cpoint) VALUES ('" + txtUser.Text.Trim() + "','" + txtPass.Text.Trim() + "','" + txtName.Text + "','" + txtLevel.SelectedValue + "','" + txtCodeCpoint.Text.Trim() + "')"; if (function.MySqlQuery(sql)) { script = "บันทึกข้อมูลสำเร็จ"; } else { script = "Error : บันทึกข้อมูลล้มเหลว"; } } else { script = "Error : มี Username ในระบบอยู่แล้ว"; } rs.Close(); function.Close(); ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('" + script + "')", true); UserGridView.EditIndex = -1; BindData(); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('เพิ่มล้มเหลว < br /> -รหัสผ่านไม่ตรงกัน')", true); } }
protected void btnSubmit_Click1(object sender, EventArgs e) { string mess = ""; if (txtUser.Text.Trim() == "") { mess += "- กรุณาป้อน Username<br/>"; } if (txtPass.Text.Trim() == "") { mess += "- กรุณาป้อน Password<br/>"; } if (mess == "") { string sql = "SELECT * FROM tbl_user WHERE username ='******' AND PASSWORD = '******'"; MySqlDataReader rs = function.MySqlSelect(sql); if (rs.Read()) { if (!rs.IsDBNull(0)) { // Storee Session Session.Add("User", txtUser.Text); Session.Add("UserName", rs.GetString("name")); Session.Add("UserPrivilegeId", rs.GetString("level")); Session.Add("UserPrivilege", function.GetLevel(int.Parse(rs.GetString("level")))); Session.Add("UserCpoint", rs.GetString("user_cpoint")); Session.Timeout = 60 * 24; //Page.ClientScript.RegisterStartupScript(Page.GetType(), "Message Box", "<script language = 'javascript'>alert('dd')</script>"); Response.Redirect("/"); } else { mess += "- Username หรือ Password ไม่ถูกต้อง"; } } else { mess += "- Username หรือ Password ไม่ถูกต้อง"; } rs.Close(); function.Close(); } if (mess != "") { MsgBox(mess); } else { msgBox.Text = ""; } }
protected void btnStatusUpdate_Command(object sender, CommandEventArgs e) { cm_id = e.CommandName; Label1.Text = "#" + cm_id; string sql = "SELECT * FROM tbl_cm_detail cm JOIN tbl_device d ON cm.cm_detail_driver_id = d.device_id JOIN tbl_cpoint c ON c.cpoint_id=cm.cm_cpoint WHERE cm.cm_detail_id = '" + cm_id + "'"; MySqlDataReader rs = function.MySqlSelect(sql); if (rs.Read()) { Label5.Text = rs.GetString("cpoint_name") + " " + rs.GetString("cm_point"); Label2.Text = rs.GetString("cm_detail_channel"); Label3.Text = rs.GetString("device_name"); Label4.Text = rs.GetString("cm_detail_problem"); if (!rs.IsDBNull(8)) { txtEDate.Text = rs.GetString("cm_detail_edate"); } else { txtEDate.Text = ""; } if (!rs.IsDBNull(9)) { txtETime.Text = rs.GetString("cm_detail_etime"); } else { txtETime.Text = DateTime.Now.ToString("HH.mm"); } if (!rs.IsDBNull(11)) { txtMethod.Text = rs.GetString("cm_detail_method"); } else { txtMethod.Text = ""; } if (!rs.IsDBNull(12)) { txtNote.Text = rs.GetString("cm_detail_note"); } else { txtNote.Text = ""; } } rs.Close(); function.Close(); }
private void getStatusAmount(Label label, int status, string year) { string sql = "SELECT COUNT(*) AS count_num FROM tbl_claim c JOIN tbl_cpoint ON claim_cpoint = cpoint_id JOIN tbl_status ON status_id = claim_status LEFT JOIN tbl_user ON username = claim_user_start_claim JOIN tbl_status_detail sd ON sd.detail_claim_id = c.claim_id AND sd.detail_status_id = c.claim_status WHERE claim_delete = '0' AND c.claim_status = '" + status + "' AND c.claim_budget_year = '" + year + "'"; MySqlDataReader rs = function.MySqlSelect(sql); if (rs.Read()) { label.Text = rs.GetString("count_num") + " รายการ"; } else { label.Text = "0 รายการ"; } rs.Close(); function.Close(); function.conn.Close(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["user"] == null) { Response.Redirect("/"); } if (!this.IsPostBack) { string sql = ""; if (function.CheckLevel("Department", Session["UserPrivilegeId"].ToString())) { sql = "SELECT * FROM tbl_cpoint ORDER BY cpoint_id"; function.getListItem(txtCpoint, sql, "cpoint_name", "cpoint_id"); function.getListItem(txtCpointSearch, sql, "cpoint_name", "cpoint_id"); txtCpointSearch.Items.Insert(0, new ListItem("ทั้งหมด", "")); } else { sql = "SELECT * FROM tbl_cpoint WHERE cpoint_id = '" + Session["UserCpoint"].ToString() + "'"; function.getListItem(txtCpoint, sql, "cpoint_name", "cpoint_id"); function.getListItem(txtCpointSearch, sql, "cpoint_name", "cpoint_id"); //txtCpointSearch.Items.Insert(0, new ListItem("ทั้งหมด", "")); } string sql_Device = "SELECT * FROM tbl_device ORDER BY device_name"; function.getListItem(txtDeviceAdd, sql_Device, "device_name", "device_id"); txtDeviceAdd.Items.Insert(0, new ListItem("", "")); txtSTime.Text = DateTime.Now.ToString("HH.mm"); BindData(""); if (Request["ref"] != null) { txtRef.Value = Request["ref"].ToString(); sql = "SELECT * FROM tbl_cm_detail WHERE cm_detail_id = '" + txtRef.Value + "'"; MySqlDataReader rs = function.MySqlSelect(sql); if (rs.Read()) { txtCpoint.SelectedValue = rs.GetString("cm_cpoint"); txtPoint.Text = rs.GetString("cm_point"); txtChannel.Text = rs.GetString("cm_detail_channel"); txtSDate.Text = rs.GetString("cm_detail_sdate"); txtSTime.Text = rs.GetString("cm_detail_stime"); txtDeviceAdd.SelectedValue = rs.GetString("cm_detail_driver_id"); txtProblem.Text = rs.GetString("cm_detail_problem"); txtNote.Text = rs.GetString("cm_detail_note"); } rs.Close(); function.Close(); btnSaveCM.Visible = false; btnEditCM.Visible = true; btnCancelCM.Visible = true; if (function.CheckLevel("Techno", Session["UserPrivilegeId"].ToString())) { btnDeleteCM.Visible = true; } else { btnDeleteCM.Visible = false; } } else { btnSaveCM.Visible = true; btnEditCM.Visible = false; btnCancelCM.Visible = false; btnDeleteCM.Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["User"] != null) { if (Session["UserCpoint"].ToString() != "0") { Response.Redirect("/Claim/claimForm"); } if (!this.IsPostBack) { if (txtDateOrder.Text == "") { txtDateOrder.Text = DateTime.Now.ToString("dd-MM-") + (DateTime.Now.Year + 543); } if (txtDateSendOrder.Text == "") { txtDateSendOrder.Text = DateTime.Now.ToString("dd-MM-") + (DateTime.Now.Year + 543); txtDateSendOrder_TextChanged(null, null); } PageLoadData(); string sql = "SELECT * FROM tbl_company ORDER BY company_name"; function.getListItem(txtCompany, sql, "company_name", "company_id"); //lbTitle.Text = Session["codePK"].ToString(); sql = "SELECT * FROM tbl_quotations q JOIN tbl_company c ON q.quotations_company_id = c.company_id WHERE q.quotations_claim_id = '" + Session["codePK"].ToString() + "' AND quotations_delete = '0'"; function.getListItem(txtCompanyOrder, sql, "company_name", "company_id"); } if (int.Parse(Session["status_id"].ToString()) >= 3) { if (int.Parse(Session["status_id"].ToString()) != 3) { btnSaveNoteTo.Visible = false; } string[] readText = File.ReadAllLines(HostingEnvironment.MapPath("/Config/") + "ListDocTechno.txt"); int num = 1; foreach (string s in readText) { if (num != 7) { AddControls(num, num + ". " + s + " จำนวน", Panel1); } else { AddControls(num, num + ". " + s + " " + function.GetSelectValue("tbl_claim_com", "claim_id='" + Session["codePK"].ToString() + "'", "claim_detail_insurer") + " จำนวน", Panel1); } num++; } string sql_doc = "SELECT * FROM tbl_quotations q JOIN tbl_company c ON c.company_id = q.quotations_company_id WHERE q.quotations_claim_id = '" + Session["codePK"].ToString() + "'"; MySqlDataReader rs = function.MySqlSelect(sql_doc); while (rs.Read()) { AddControls(num, num + ". ใบประเมินราคาค่าเสียหาย ของ " + rs.GetString("company_name") + " จำนวน", Panel1); num++; } rs.Close(); function.Close(); if (!this.IsPostBack) { getDataStatus3(); } } if (int.Parse(Session["status_id"].ToString()) >= 4) { getDataStatus4(); } if (int.Parse(Session["status_id"].ToString()) >= 5) { getDataStatus5(); } } }
protected void btnSaveReport_Click(object sender, EventArgs e) { string sql_check = "SELECT * FROM tbl_claim WHERE claim_id='" + Session["CodePK"].ToString() + "'"; string note_number = "กท./ฝจ./" + txtCpoint.SelectedItem; if (txtPoint.Text.Trim().ToLower() != "tsb" && txtPoint.Text.Trim().ToLower() != "") { note_number += " " + txtPoint.Text.Trim(); } note_number += "/คร./"; if (note_number == "") { note_number += " "; } else { note_number += txtCpointNote.Text.Trim(); } note_number += "/" + txtCpointDate.Text.Split('-')[2]; MySqlDataReader rs = function.MySqlSelect(sql_check); if (rs.Read()) { rs.Close(); function.Close(); //Update string sql = ""; sql = "Update tbl_claim SET claim_equipment='" + txtEquipment.Text + "'" + ", claim_cpoint='" + txtCpoint.SelectedValue + "'" + ", claim_point='" + txtPoint.Text + "'" + ", claim_cpoint_note='" + note_number + "'" + ", claim_cpoint_date='" + txtCpointDate.Text + "'" + ", claim_start_date='" + txtStartDate.Text + "'" + ", claim_budget_year='" + function.getBudgetYear(txtCpointDate.Text) + "'" + " WHERE claim_id = '" + Session["CodePK"].ToString() + "'"; if (function.MySqlQuery(sql)) { string text = "claim_detail_note_to = '" + txtNoteTo.Text + "'" + ", claim_detail_around='" + txtAround.SelectedItem + "'" + ", claim_detail_point='" + txtPoint.Text.Trim() + "'" + ", claim_detail_point='" + txtPoint.Text.Trim() + "'" + ", claim_detail_time='" + txtTime.Text + "'" + ", claim_detail_user_alear='" + txtNameAleat.Text + "'" + ", claim_detail_pos_user_alear='" + txtPosAleat.SelectedItem + "'" + ", claim_detail_cb='" + txtCB.Text + "'" + ", claim_detail_cb_claim='" + txtCBClaim.Text + "'" + ", claim_detail_direction='" + txtDirection.Text + "'" + ", claim_detail_comefrom = '" + txtComeFrom.Text + "'" + ", claim_detail_direction_in='" + txtDirectionIn.Text + "'" + ", claim_detail_accident='" + txtDetail.Text + "'" + ", claim_detail_supervisor='" + txtSup.Text + "'" + ", claim_detail_supervisor_pos='" + txtPosSup.SelectedItem + "'" + ", claim_detail_car='" + txtCar.Text + "'" + ", claim_detail_license_plate='" + txtLicensePlate.Text + "'" + ", claim_detail_province='" + txtProvince.Text + "'" + ", claim_detail_driver='" + txtNameDrive.Text + "'" + ", claim_detail_idcard='" + txtIdcard.Text + "'" + ", claim_detail_address='" + txtAddressDriver.Text + "'" + ", claim_detail_lp2='" + txtLp2.Text + "'" + ", claim_detail_insurer='" + txtInsurer.Text + "'" + ", claim_detail_policyholders='" + txtPolicyholders.Text + "'" + ", claim_detail_clemence='" + txtClemence.Text + "'" + ", claim_detail_inform='" + txtInform.Text + "'" + ", claim_detail_tel='" + txtTelDrive.Text + "'"; sql = "UPDATE tbl_claim_com SET " + text + " WHERE claim_id = '" + Session["CodePK"].ToString() + "'"; if (function.MySqlQuery(sql)) { sql = "UPDATE tbl_status_detail SET detail_date_start ='" + txtStartDate.Text + "',detail_date_end ='" + function.ConvertDateTime(txtStartDate.Text, 3) + "' WHERE detail_status_id='1' AND detail_claim_id='" + Session["CodePK"].ToString() + "'"; function.MySqlQuery(sql); AlertPop("บันทึกข้อมูลสำเร็จ", "success"); //ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('บันทึกข้อมูลสำเร็จ')", true); } else { AlertPop("Error : บันทึกข้อมูลล้มเหลว", "error"); //ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('Error : บันทึกข้อมูลล้มเหลว')", true); } } else { AlertPop("Error : บันทึกข้อมูลล้มเหลว", "error"); //ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('Error : บันทึกข้อมูลล้มเหลว')", true); } } else { rs.Close(); function.Close(); //Insert string sql = "INSERT INTO tbl_claim ( claim_id, claim_equipment, claim_cpoint, claim_point, claim_cpoint_note, claim_cpoint_date, claim_status, claim_start_date, claim_user_start_claim, claim_user_start_claim_time, claim_delete,claim_budget_year ) VALUES ( '" + Session["CodePK"].ToString() + "', '" + txtEquipment.Text + "', '" + txtCpoint.SelectedValue + "', '" + txtPoint.Text + "', '" + note_number + "', '" + txtCpointDate.Text + "', '1', '" + txtStartDate.Text + "', '" + Session["User"].ToString() + "', NOW(), '0','" + function.getBudgetYear(txtCpointDate.Text) + "')"; if (function.MySqlQuery(sql)) { string text = ""; string values = ""; text += "claim_id" + ", claim_detail_note_to" + ", claim_detail_point" + ", claim_detail_around" + ", claim_detail_time" + ", claim_detail_user_alear" + ", claim_detail_pos_user_alear" + ", claim_detail_cb" + ", claim_detail_cb_claim" + ", claim_detail_direction" + ", claim_detail_comefrom" + ", claim_detail_direction_in" + ", claim_detail_accident" + ", claim_detail_supervisor" + ", claim_detail_supervisor_pos" + ", claim_detail_car" + ", claim_detail_license_plate" + ", claim_detail_province" + ", claim_detail_driver" + ", claim_detail_idcard" + ", claim_detail_address" + ", claim_detail_lp2" + ", claim_detail_insurer" + ", claim_detail_policyholders" + ", claim_detail_clemence" + ", claim_detail_inform" + ", claim_detail_tel"; values += "'" + Session["CodePK"].ToString() + "'" + ", '" + txtNoteTo.Text + "'" + ", '" + txtPoint.Text + "'" + ", '" + txtAround.SelectedItem + "'" + ", '" + txtTime.Text + "'" + ", '" + txtNameAleat.Text + "'" + ", '" + txtPosAleat.SelectedItem + "'" + ", '" + txtCB.Text + "'" + ", '" + txtCBClaim.Text + "'" + ", '" + txtDirection.Text + "'" + ", '" + txtComeFrom.Text + "'" + ", '" + txtDirectionIn.Text + "'" + ", '" + txtDetail.Text + "'" + ", '" + txtSup.Text + "'" + ", '" + txtPosSup.SelectedItem + "'" + ", '" + txtCar.Text + "'" + ", '" + txtLicensePlate.Text + "'" + ", '" + txtProvince.Text + "'" + ", '" + txtNameDrive.Text + "'" + ", '" + txtIdcard.Text + "'" + ", '" + txtAddressDriver.Text + "'" + ", '" + txtLp2.Text + "'" + ", '" + txtInsurer.Text + "'" + ", '" + txtPolicyholders.Text + "'" + ", '" + txtClemence.Text + "'" + ", '" + txtInform.Text + "'" + ", '" + txtTelDrive.Text + "'"; sql = "INSERT INTO tbl_claim_com (" + text + ") VALUES (" + values + ")"; if (function.MySqlQuery(sql)) { sql = "INSERT INTO tbl_status_detail (detail_status_id,detail_claim_id,detail_date_start,detail_date_end) VALUES ('1','" + Session["CodePK"].ToString() + "','" + txtStartDate.Text + "','" + function.ConvertDateTime(txtStartDate.Text, 3) + "')"; function.MySqlQuery(sql); AlertPop("บันทึกข้อมูลสำเร็จ", "success"); //ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('บันทึกข้อมูลสำเร็จ')", true); } else { AlertPop("Error : บันทึกข้อมูลล้มเหลว", "error"); //ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('Error : บันทึกข้อมูลล้มเหลว')", true); } } else { AlertPop("Error : บันทึกข้อมูลล้มเหลว", "error"); //ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('Error : บันทึกข้อมูลล้มเหลว')", true); } } }
void GetReport(string key, int report) { string startDate = ""; string around = ""; string time = ""; string nameAleat = ""; string posAleat = ""; string cpointName = ""; string cabinet = ""; string cabinet_claim = ""; string direction = ""; string directionIn = ""; string detail = ""; string supper = ""; string supperPos = ""; string car = ""; string licensePlate = ""; string licensePlate2 = ""; string province = ""; string comeFrom = ""; string nameDrive = ""; string idcard = ""; string address = ""; string telDrive = ""; string insurer = ""; string clemence = ""; string policyholders = ""; string inform = ""; string point = ""; string noteTo = ""; string noteTo1 = ""; string noteNumber = ""; string cpointDate = ""; string title = ""; string cpoint_manager = ""; string title2 = ""; string DateTitle = ""; string sql = "SELECT * FROM tbl_claim c JOIN tbl_claim_com cc ON cc.claim_id=c.claim_id JOIN tbl_cpoint cp ON cp.cpoint_id = c.claim_cpoint WHERE c.claim_id = '" + key + "'"; MySqlDataReader rs = function.MySqlSelect(sql); if (rs.Read()) { startDate = rs.GetString("claim_start_date"); around = rs.GetString("claim_detail_around"); time = rs.GetString("claim_detail_time"); nameAleat = rs.GetString("claim_detail_user_alear"); posAleat = rs.GetString("claim_detail_pos_user_alear"); cpointName = rs.GetString("cpoint_name"); cabinet = rs.GetString("claim_detail_cb"); cabinet_claim = rs.GetString("claim_detail_cb_claim"); direction = rs.GetString("claim_detail_direction"); directionIn = rs.GetString("claim_detail_direction_in"); detail = rs.GetString("claim_detail_accident"); supper = rs.GetString("claim_detail_supervisor"); supperPos = rs.GetString("claim_detail_supervisor_pos"); car = rs.GetString("claim_detail_car"); licensePlate = rs.GetString("claim_detail_license_plate"); licensePlate2 = rs.GetString("claim_detail_lp2"); province = rs.GetString("claim_detail_province"); comeFrom = rs.GetString("claim_detail_comefrom"); nameDrive = rs.GetString("claim_detail_driver"); idcard = rs.GetString("claim_detail_idcard"); address = rs.GetString("claim_detail_address"); telDrive = rs.GetString("claim_detail_tel"); insurer = rs.GetString("claim_detail_insurer"); clemence = rs.GetString("claim_detail_clemence"); policyholders = rs.GetString("claim_detail_policyholders"); inform = rs.GetString("claim_detail_inform"); point = rs.GetString("claim_detail_point"); noteTo = rs.GetString("claim_detail_note_to"); noteNumber = rs.GetString("claim_cpoint_note"); cpointDate = rs.GetString("claim_cpoint_date"); title = rs.GetString("claim_equipment"); cpoint_manager = rs.GetString("cpoint_manager"); } rs.Close(); function.Close(); string strNote = "เนื่องด้วยเมื่อวันที่ " + function.ConvertDatelongThai(startDate) + " " + around + " เวลาประมาณ " + time + " น. ได้รับแจ้งจาก" + nameAleat + " " + posAleat + " ปฏิบัติหน้าที่ประจำด่านฯ " + cpointName; if (cabinet != "") { strNote += " ตู้ " + cabinet; } strNote += " " + direction + " ได้แจ้งว่าเกิดอุบัติเหตุ" + detail + " ตู้ " + cabinet_claim + " จึงได้แจ้งรองผู้จัดการด่านฯ ประจำผลัด คือ " + supper + " ให้ทราบ"; strNote += " หลังจากได้รับแจ้งเหตุเจ้าหน้าที่ควบคุมระบบและรองผู้จัดการด่านฯ ได้ลงไปตรวจสอบที่เกิดเหตุพร้อมบันทึกภาพไว้เป็นหลักฐาน พบคู่กรณีเป็น" + car; if (licensePlate == "" || licensePlate == "-" || licensePlate == "ไม่ทราบ") { strNote += "ไม่ทราบหมายเลขทะเบียน"; } else { strNote += " หมายเลขทะเบียน " + licensePlate; if (licensePlate2 != "" && licensePlate2 != "-") { strNote += " ส่วนพ่วงหมายเลขทะเบียน " + licensePlate2; } strNote += " จังหวัด" + province + " ขับรถมาจาก" + comeFrom + "มุ่งหน้า" + directionIn + " โดยมี" + nameDrive + " เลขที่บัตรประจำตัวประชาชนเลขที่ " + idcard + " ที่อยู่ " + address + (telDrive.Trim() != "" && telDrive.Trim() != "-" ? " หมายเลขโทรศัพท์ " + telDrive : "") + " เป็นผู้ขับรถยนต์คันดังกล่าว"; if (insurer.Trim() == "" || insurer.Trim() == "-") { strNote += " ซึ่งรถยนต์คันดังกล่าวไม่ได้ทำประกันไว้"; } else { strNote += " ซึ่งรถยนต์คันดังกล่าวได้ทำประกันไว้กับ" + insurer + " หมายเลขเคลมเลขที่ " + clemence + " หมายเลขกรมธรรม์ " + policyholders; } strNote += " ทั้งนี้ ด่านฯ" + cpointName + " ได้ดำเนินการแจ้งความร้องทุกข์ไว้ที่ " + inform + " ไว้เป็นหลักฐานแล้ว"; } string name = ""; string com = ""; string dev = ""; string listDoc = ""; string doc_num = ""; string sql_com = "SELECT * FROM tbl_claim_com_working WHERE detail_com_id ='" + key + "'"; string sql_dev = "SELECT * FROM tbl_device_damaged d JOIN tbl_device dd ON d.device_id = dd.device_id WHERE claim_id ='" + key + "'"; int i = 1; if (report == 0) { rs = function.MySqlSelect(sql_com); while (rs.Read()) { if (i == 1) { name += "(" + rs.GetString("com_working_name") + ")\r\n" + rs.GetString("com_working_pos"); com += "ซึ่งมีเจ้าหน้าที่ควบคุมระบบปฏิบัติหน้าที่ประจำผลัด ดังนี้\r\n "; com += i + ". " + rs.GetString("com_working_name"); } else { com += "\r\n " + i + ". " + rs.GetString("com_working_name"); } i++; } rs.Close(); name += "\r\n\r\n\r\n"; name += "(" + function.GetSelectValue("tbl_claim_com", "claim_id='" + key + "'", "claim_detail_supervisor") + ")"; name += "\r\n" + function.GetSelectValue("tbl_claim_com", "claim_id='" + key + "'", "claim_detail_supervisor_pos"); function.Close(); i = 1; rs = function.MySqlSelect(sql_dev); while (rs.Read()) { if (i == 1) { dev += "จากการลงไปตรวจสอบเบื้องต้นพบทรัพย์สินของทางราชการเสียหาย ดังนี้\r\n "; dev += i + ". " + rs.GetString("device_name") + " " + rs.GetString("device_damaged"); } else { dev += "\r\n " + i + ". " + rs.GetString("device_name") + " " + rs.GetString("device_damaged"); } i++; } rs.Close(); function.Close(); } else { i = 1; rs = function.MySqlSelect(sql_dev); while (rs.Read()) { if (i == 1) { dev += "ความเสียหายของทรัพย์สินของทางราชการ เบื้องต้นสรุปได้ ดังนี้\r\n "; dev += i + ". " + rs.GetString("device_name") + " " + rs.GetString("device_damaged"); } else { dev += "\r\n " + i + ". " + rs.GetString("device_name") + " " + rs.GetString("device_damaged"); } i++; } rs.Close(); function.Close(); string sql_doc = "SELECT * FROM tbl_claim_doc WHERE claim_doc_id = '" + key + "' AND claim_doc_type = '0'"; rs = function.MySqlSelect(sql_doc); if (rs.Read()) { doc_num = rs.GetString("claim_doc_num"); noteTo1 = rs.GetString("claim_doc_to"); listDoc += "เอกสารประกอบการพิจารณาแนบ ดังนี้"; listDoc += "\r\n 1. สำเนารายงานประจำวันเกี่ยวกับคดี จำนวน " + converNum(rs.GetString("claim_doc_no1")) + " ฉบับ"; listDoc += "\r\n 2. สำเนาบันทึกการเปรียบเที่ยบปรับ จำนวน " + converNum(rs.GetString("claim_doc_no2")) + " ฉบับ"; listDoc += "\r\n 3. สำเนาใบเสร็จค่าปรับ จำนวน " + converNum(rs.GetString("claim_doc_no3")) + " ฉบับ"; listDoc += "\r\n 4. บันทึกข้อมูลการเกิดอุบัติเหตุถเบื้องต้นสำหรับการแจ้งความ จำนวน " + converNum(rs.GetString("claim_doc_no4")) + " ฉบับ"; listDoc += "\r\n 5. รายงานอุบัติเหตุบนทางหลวง (ส.3-02) จำนวน " + converNum(rs.GetString("claim_doc_no5")) + " ฉบับ"; listDoc += "\r\n 6. รายละเอียดเกี่ยวกับผู้ประสบอุบัติเหตุและยานพาหนะ จำนวน " + converNum(rs.GetString("claim_doc_no6")) + " ฉบับ"; listDoc += "\r\n 7. ข้อมูลเบื้องต้นจากการสอบปากคำผู้เกี่ยวข้อง สป.11 จำนวน " + converNum(rs.GetString("claim_doc_no7")) + " ฉบับ"; listDoc += "\r\n 8. หนังสือยอมความรับผิด จำนวน " + converNum(rs.GetString("claim_doc_no8")) + " ฉบับ"; listDoc += "\r\n 9. สำเนาบัตรประจำตัวประชาชน จำนวน " + converNum(rs.GetString("claim_doc_no9")) + " ฉบับ"; listDoc += "\r\n 10. สำเนาใบอนุญาตขับรถ จำนวน " + converNum(rs.GetString("claim_doc_no10")) + " ฉบับ"; listDoc += "\r\n 11. สำเนาใบรับรองความเสียหายต่อทรัพย์สิน (ใบเคลมประกัน) จำนวน " + converNum(rs.GetString("claim_doc_no11")) + " ฉบับ"; listDoc += "\r\n 12. บันทึกข้อความรายงานของ พ.ควบคุมระบบ และรองผจด.ประจำผลัด จำนวน " + converNum(rs.GetString("claim_doc_no12")) + " ฉบับ"; listDoc += "\r\n 13. รูปภาพประกอบ จำนวน " + converNum(rs.GetString("claim_doc_no13")) + " ฉบับ"; title2 = rs.GetString("claim_doc_title"); DateTitle = rs.GetString("claim_doc_date"); } rs.Close(); function.Close(); } ReportDocument rpt = new ReportDocument(); if (report == 0) { rpt.Load(Server.MapPath("/Claim/reportCom.rpt")); doc_num = noteNumber; rpt.SetParameterValue("list_com", com != "" ? com + "\r\n" : ""); rpt.SetParameterValue("name", name); rpt.SetParameterValue("txt_to", noteTo); rpt.SetParameterValue("note_title", title); rpt.SetParameterValue("date_thai", function.ConvertDatelongThai(cpointDate)); } else { rpt.Load(Server.MapPath("/Claim/reportOfficialBooks.rpt")); rpt.SetParameterValue("list_doc", listDoc != "" ? listDoc + "\r\n" : ""); rpt.SetParameterValue("name", "(" + cpoint_manager + ")\r\nผู้จัดการด่านฯ " + cpointName); rpt.SetParameterValue("txt_to", noteTo1); rpt.SetParameterValue("note_title", title2); rpt.SetParameterValue("date_thai", function.ConvertDatelongThai(DateTitle)); } rpt.SetParameterValue("cpoint_title", "ด่านฯ " + cpointName + " ฝ่ายบริหารการจัดเก็บเงินค่าธรรมเนียม โทร. " + function.GetSelectValue("tbl_cpoint", "cpoint_name='" + cpointName + "'", "cpoint_tel")); rpt.SetParameterValue("num_title", doc_num); rpt.SetParameterValue("note_text", strNote); rpt.SetParameterValue("part_img", Server.MapPath("/Claim/300px-Thai_government_Garuda_emblem_(Version_2).jpg")); rpt.SetParameterValue("list_dev", dev + "\r\n"); Session["Report"] = rpt; Session["ReportTitle"] = "บันทึกข้อความ"; //Response.Redirect("/Report/reportView", true); Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('/Report/reportView','_newtab');", true); }