private void button2_Click(object sender, EventArgs e) { AdminScript adminScript = new AdminScript(); string sql_query = "SELECT tbl_emp_id, tbl_emp_name, (SELECT COUNT(*) FROM `tbl_code_edit` WHERE `tbl_code_user_emp` = e.`tbl_emp_id` AND MONTH(tbl_code_date) = '" + date_start.Value.Month + "' AND YEAR(tbl_code_date) = '" + date_start.Value.Year + "') AS amount , `tbl_code_date`,tbl_cpoint_id,tbl_cpoint_name,tbl_code_note FROM `tbl_code_edit` LEFT JOIN `tbl_emp` e ON `tbl_code_user_emp` = tbl_emp_id LEFT JOIN `tbl_cpoint` ON `tbl_cpoint_id` = `tbl_code_cpoint` WHERE `tbl_code_status` IS NOT NULL AND MONTH(tbl_code_date) = '" + date_start.Value.Month + "' AND YEAR(tbl_code_date) = '" + date_start.Value.Year + "' ORDER BY tbl_cpoint_id,DATE_FORMAT(tbl_code_date,'%d-%m-%Y'),tbl_code_user_emp"; MySqlDataAdapter adap = new MySqlDataAdapter(); MySqlConnection conn = new MySqlConnection(adminScript.strCon); MySqlCommand cmd = new MySqlCommand();; DataSet_Report dataSet1 = new DataSet_Report(); PopupReport popup = new PopupReport(); string nameCpoint = script.GetCpoint(File.ReadAllText(script.file_cpoint).Split('|')[0]); popup.Text = "รายงานการขอแก้ไขงาน ระบบ TIS"; cmd.Connection = conn; conn.Close(); conn.Open(); cmd.CommandText = sql_query; adap.SelectCommand = cmd; dataSet1.Clear(); adap.Fill(dataSet1, "report_EditJob"); conn.Close(); EditJob editJob = new EditJob(); editJob.SetDataSource(dataSet1); /*DefectiveStrapsReport defectiveStraps = new DefectiveStrapsReport(); * defectiveStraps.SetDataSource(dataSet1); * defectiveStraps.SetParameterValue("para_cpoint", nameCpoint);*/ popup.cry_View.ReportSource = editJob; popup.Show(); }
private void button1_Click(object sender, EventArgs e) { if (textBox2.Text != "") { script.Load_page(); MySqlDataAdapter adap = new MySqlDataAdapter(); MySqlConnection conn = script.conn; MySqlCommand cmd; DataSet_Report reportDB = new DataSet_Report(); PopupReport popup = new PopupReport(); popup.Text = "ใบท้าย ธร.3"; string sql = "SELECT 'เงินเกินบัญชี' AS title, null AS row_num, tbl_emp_name, CONCAT('ตู้ ',tbl_income_cabinet) AS tbl_income_cabinet, CONCAT(tbl_income_in_time,' น. - ',tbl_income_out_time,' น.') AS tbl_around_time, 'จำนวน' AS unit, tbl_income_over AS amount FROM tbl_income JOIN tbl_emp ON tbl_emp_id = tbl_income_emp_id JOIN tbl_status_around ON tbl_status_around_id = tbl_income_around_id JOIN tbl_around ON tbl_status_around_aid = tbl_around_id WHERE tbl_status_around_aid = '" + around + "' AND tbl_status_around_date = '" + date_start_r1.ToString("dd-MM-yyyy") + "' AND tbl_income_over > 0 AND tbl_status_around_cpoint_id ='" + mainForm.cpoint_id + "' UNION SELECT 'เงินเกินบัญชี' AS title, 0 AS row_num, NULL AS tbl_emp_name, 'ตู้ 99' AS tbl_income_cabinet, NULL AS tbl_around_time, IF( SUM(tbl_income_over) IS NOT NULL, 'รวม', NULL ) AS unit, SUM(tbl_income_over) AS amount FROM tbl_income JOIN tbl_emp ON tbl_emp_id = tbl_income_emp_id JOIN tbl_status_around ON tbl_status_around_id = tbl_income_around_id JOIN tbl_around ON tbl_status_around_aid = tbl_around_id WHERE tbl_status_around_aid = '" + around + "' AND tbl_status_around_date = '" + date_start_r1.ToString("dd-MM-yyyy") + "' AND tbl_income_over > 0 AND tbl_status_around_cpoint_id ='" + mainForm.cpoint_id + "' UNION SELECT 'ผู้ใช้ทางไม่รับเงินทอน' AS title, NULL AS row_num, tbl_emp_name, CONCAT('ตู้ ',tbl_income_cabinet) AS tbl_income_cabinet , CONCAT(tbl_income_in_time,' น. - ',tbl_income_out_time,' น.') AS tbl_around_time, 'จำนวน' AS unit, tbl_income_user AS amount FROM tbl_income JOIN tbl_emp ON tbl_emp_id = tbl_income_emp_id JOIN tbl_status_around ON tbl_status_around_id = tbl_income_around_id JOIN tbl_around ON tbl_status_around_aid = tbl_around_id WHERE tbl_status_around_aid = '" + around + "' AND tbl_status_around_date = '" + date_start_r1.ToString("dd-MM-yyyy") + "' AND tbl_income_user > 0 AND tbl_status_around_cpoint_id ='" + mainForm.cpoint_id + "' UNION SELECT 'ผู้ใช้ทางไม่รับเงินทอน' AS title, 0 AS row_num, NULL AS tbl_emp_name, 'ตู้ 99' AS tbl_income_cabinet, NULL AS tbl_around_time, IF( SUM(tbl_income_user) IS NOT NULL, 'รวม', NULL ) AS unit, SUM(tbl_income_user) AS amount FROM tbl_income JOIN tbl_emp ON tbl_emp_id = tbl_income_emp_id JOIN tbl_status_around ON tbl_status_around_id = tbl_income_around_id JOIN tbl_around ON tbl_status_around_aid = tbl_around_id WHERE tbl_status_around_aid = '" + around + "' AND tbl_status_around_date = '" + date_start_r1.ToString("dd-MM-yyyy") + "' AND tbl_income_user > 0 AND tbl_status_around_cpoint_id ='" + mainForm.cpoint_id + "' ORDER BY tbl_income_cabinet,tbl_around_time"; cmd = new MySqlCommand(); cmd.Connection = conn; conn.Close(); conn.Open(); cmd.CommandText = sql; //cmd.Parameters.Add("@row", 1); //cmd.Parameters.Add("@row_u", 1); adap.SelectCommand = cmd; reportDB.Clear(); adap.Fill(reportDB, "Report_ts3"); conn.Close(); Report_TS3 myReport = new Report_TS3(); string direction = ""; if (mainForm.cpoint_id == "902" || mainForm.cpoint_id == "904") { direction = "ขาเข้า"; } if (mainForm.cpoint_id == "903" || mainForm.cpoint_id == "905") { direction = "ขาออก"; } myReport.SetDataSource(reportDB); //myReport.SetParameterValue("para_head", ""); myReport.SetParameterValue("para_cpoint", script.GetCpoint(mainForm.cpoint_id)); myReport.SetParameterValue("para_around", script.GetAroundTime(around.ToString())); myReport.SetParameterValue("para_date", date_start_r1); myReport.SetParameterValue("para_in_out", direction); myReport.SetParameterValue("para_user", script.getEmpName_Group(textBox1.Text).Split('|')[0]); myReport.SetParameterValue("para_group_user", script.NotManager(textBox1.Text)); myReport.SetParameterValue("para_head", comboBox1.Text); myReport.SetParameterValue("para_print", textBox2.Text.Trim()); myReport.SetParameterValue("pos", label5.Text.Split(':')[0]); //myReport.PrintToPrinter(1, true, 0, 0); popup.cry_View.ReportSource = myReport; popup.Show(); } else { } }
private void reportStrapes(bool print, MySqlConnection para_conn, string cpoint) { try { string sql_query = "SELECT tbl_straps_date AS date_value , s.tbl_straps_number AS straps,CONCAT(e.tbl_emp_id,' ',e.tbl_emp_name) AS emp, CONCAT(c.tbl_emp_id,' ',c.tbl_emp_name) AS control, s.tbl_straps_note AS note FROM tbl_straps s LEFT JOIN tbl_emp e ON s.tbl_straps_emp_operate = e.tbl_emp_id LEFT JOIN tbl_emp c ON c.tbl_emp_id = s.tbl_straps_emp_control WHERE MONTH(s.tbl_straps_date) = '" + date_start.Value.Month + "' AND YEAR(s.tbl_straps_date) = '" + date_start.Value.Year + "' AND tbl_straps_status = 1 AND tbl_straps_note != 'นำไปใช้รัดถุงเงินพิเศษ (ผจด) / ' ORDER BY tbl_straps_date"; MySqlDataAdapter adap = new MySqlDataAdapter(); MySqlConnection conn = para_conn; MySqlCommand cmd = new MySqlCommand();; DataSet_Report dataSet1 = new DataSet_Report(); PopupReport popup = new PopupReport(); string nameCpoint = script.GetCpoint(cpoint); popup.Text = "รายงานสายรัดชำรุด ด่านฯ" + nameCpoint; cmd.Connection = conn; conn.Close(); conn.Open(); cmd.CommandText = sql_query; adap.SelectCommand = cmd; dataSet1.Clear(); adap.Fill(dataSet1, "tbl_strape"); conn.Close(); DefectiveStrapsReport defectiveStraps = new DefectiveStrapsReport(); defectiveStraps.SetDataSource(dataSet1); defectiveStraps.SetParameterValue("para_cpoint", nameCpoint); if (print) { try { defectiveStraps.PrintToPrinter(1, true, 0, 0); MessageBox.Show("พิมพ์ " + nameCpoint + "สำเร็จ", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show("พิมพ์ " + nameCpoint + "ไม่สำเร็จ", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { popup.cry_View.ReportSource = defectiveStraps; popup.Show(); } } catch { MessageBox.Show("พิมพ์ " + script.GetCpoint(cpoint) + "ไม่สำเร็จ", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void GetReport(int around, string date, bool all, bool print, bool sendBank) { if (around != 0) { script.Load_page(); MySqlDataAdapter adap = new MySqlDataAdapter(); MySqlConnection conn = script.conn; MySqlCommand cmd; DataSet_Report reportDB = new DataSet_Report(); PopupReport popup = new PopupReport(); popup.Text = "รายงานการนำส่งรายได้ค่าธรรมเนียมผ่านทาง"; string sql = ""; string sql1 = ""; string sql_mana = ""; if (sendBank) { } else { string sql_line9 = "IF(tbl_income_over_sys=0,null,tbl_income_over_sys)"; if (mainForm.line9 == "9") { sql_line9 = "null"; } if (all) { string sum_select = "(SELECT SUM(tbl_incom_other_amount) FROM tbl_incom_other WHERE tbl_incom_other_date_send = '" + date_start_r1.Text + "' AND ( tbl_incom_other_list_incom_id = 2 OR tbl_incom_other_list_incom_id = 3 ) AND tbl_incom_cpoint_id = '" + mainForm.cpoint_id + "')"; sql = "SELECT tbl_status_around_aid, tbl_around_time, tbl_status_around_date, tbl_income_money_bag, tbl_income_straps AS tbl_income_straps, IF( tbl_income_emp_id IS NULL, 'ถุงเงินพิเศษ', tbl_income_emp_id ) AS tbl_income_emp_id, IF( e.tbl_emp_name IS NULL, CONCAT(o.`tbl_emp_name`,'(รองฯ)'), e.tbl_emp_name ) AS tbl_emp_name, tbl_income_cabinet, tbl_income_job, tbl_income_in_time, tbl_income_out_time, tbl_income_total, tbl_income_bank, IF(tbl_income_user_tmp=0,null,tbl_income_user_tmp) as tbl_income_user, IF(tbl_income_fine_tmp=0,null,tbl_income_fine_tmp) as tbl_income_fine, IF(tbl_income_other=0,null,tbl_income_other) as tbl_income_other, tbl_cpoint_name, STR_TO_DATE( tbl_status_around_date, '%e-%c-%Y' ) AS date_around,IF(tbl_income_over = 0,null,tbl_income_over) as tbl_income_over," + sql_line9 + " as tbl_income_over_sys,IF(tbl_income_other_ts2=0,null,tbl_income_other_ts2) as tbl_income_other_ts2 FROM tbl_income LEFT JOIN tbl_emp e ON e.tbl_emp_id = tbl_income_emp_id JOIN tbl_status_around ON tbl_income_around_id = tbl_status_around_id JOIN tbl_cpoint ON tbl_cpoint_id = tbl_status_around_cpoint_id JOIN tbl_around ON tbl_status_around_aid = tbl_around_id LEFT JOIN tbl_emp o ON o.`tbl_emp_id` = `tbl_status_around_emp_open_id`"; sql += " WHERE tbl_status_around_aid = '" + around + "' AND tbl_status_around_date = '" + date + "' AND tbl_cpoint_id = '" + mainForm.cpoint_id + "' ORDER BY tbl_income_cabinet,tbl_income_job"; sql1 = "SELECT tbl_incom_other_around AS tbl_status_around_aid, '" + date_start_r1.Text + "' AS tbl_around_time, tbl_incom_other_date AS tbl_status_around_date, tbl_incom_other_bag AS tbl_income_money_bag, tbl_incom_other_straps AS tbl_income_straps, IF(tbl_incom_other_emp_id IS NOT NULL,'ถุงเงินพิเศษ',NULL) AS tbl_income_emp_id, IF(tbl_incom_other_emp_id IS NOT NULL,'*ผู้ใช้ทางและค่าปรับบัตรหายที่เกิน 30 วัน',NULL) AS tbl_emp_name, '' AS tbl_income_cabinet, '' AS tbl_income_job, '' AS tbl_income_in_time, '' AS tbl_income_out_time, " + sum_select + " AS tbl_income_total, " + sum_select + " AS tbl_income_bank, '0' AS tbl_income_user, '0' AS tbl_income_fine, '0' AS tbl_income_other, '" + script.GetCpoint(mainForm.cpoint_id) + "' AS tbl_cpoint_name, STR_TO_DATE( tbl_incom_other_date_send, '%e-%c-%Y' ) AS date_around FROM tbl_incom_other WHERE tbl_incom_other_date_send ='" + date_start_r1.Text + "' AND (tbl_incom_other_list_incom_id = 2 OR tbl_incom_other_list_incom_id = 3) AND tbl_incom_cpoint_id = '" + mainForm.cpoint_id + "' GROUP BY tbl_incom_cpoint_sub_id"; sql_mana = "SELECT tbl_emp_name ,tbl_emp_group_name,CONCAT(tbl_cpoint_name,' ',tbl_status_around_cpoint_sub_id) AS cpoint_report FROM tbl_status_around a JOIN tbl_emp e ON a.tbl_status_around_emp_open_id = e.tbl_emp_id JOIN tbl_emp_group g ON g.tbl_emp_group_id = e.tbl_emp_group_id JOIN tbl_cpoint c ON c.tbl_cpoint_id = a.tbl_status_around_cpoint_id WHERE tbl_status_around_aid = '" + around + "' AND tbl_status_around_date = '" + date + "' AND tbl_cpoint_id = '" + mainForm.cpoint_id + "' ORDER BY tbl_status_around_cpoint_sub_id"; } else { sql = "SELECT tbl_status_around_aid, tbl_around_time, tbl_status_around_date, tbl_income_money_bag, tbl_income_straps AS tbl_income_straps, IF( tbl_income_emp_id IS NULL, 'ถุงเงินพิเศษ', tbl_income_emp_id ) AS tbl_income_emp_id, IF( e.tbl_emp_name IS NULL, CONCAT(o.`tbl_emp_name`,'(รองฯ)'), e.tbl_emp_name ) AS tbl_emp_name, tbl_income_cabinet, tbl_income_job, tbl_income_in_time, tbl_income_out_time, tbl_income_total, tbl_income_bank, IF(tbl_income_user_tmp=0,null,tbl_income_user_tmp) as tbl_income_user, IF(tbl_income_fine_tmp=0,null,tbl_income_fine_tmp) as tbl_income_fine, IF(tbl_income_other=0,null,tbl_income_other) as tbl_income_other, tbl_cpoint_name, STR_TO_DATE( tbl_status_around_date, '%e-%c-%Y' ) AS date_around,IF(tbl_income_over = 0,null,tbl_income_over) as tbl_income_over," + sql_line9 + " as tbl_income_over_sys,IF(tbl_income_other_ts2=0,null,tbl_income_other_ts2) as tbl_income_other_ts2 FROM tbl_income LEFT JOIN tbl_emp e ON e.tbl_emp_id = tbl_income_emp_id JOIN tbl_status_around ON tbl_income_around_id = tbl_status_around_id JOIN tbl_cpoint ON tbl_cpoint_id = tbl_status_around_cpoint_id JOIN tbl_around ON tbl_status_around_aid = tbl_around_id LEFT JOIN tbl_emp o ON o.`tbl_emp_id` = `tbl_status_around_emp_open_id`"; sql += " WHERE tbl_status_around_aid = '" + around + "' AND tbl_status_around_date = '" + date + "' AND tbl_cpoint_id = '" + mainForm.cpoint_id + "' AND tbl_status_around_cpoint_sub_id = '" + mainForm.sub_cpoint + "' ORDER BY tbl_income_cabinet,tbl_income_job"; sql1 = "SELECT tbl_incom_other_around AS tbl_status_around_aid, '" + date_start_r1.Text + "' AS tbl_around_time, tbl_incom_other_date AS tbl_status_around_date, tbl_incom_other_bag AS tbl_income_money_bag, tbl_incom_other_straps AS tbl_income_straps, IF(tbl_incom_other_emp_id IS NOT NULL,'ถุงเงินพิเศษ',NULL) AS tbl_income_emp_id, IF(tbl_incom_other_emp_id IS NOT NULL,'*ผู้ใช้ทางและค่าปรับบัตรหายที่เกิน 30 วัน',NULL) AS tbl_emp_name, '' AS tbl_income_cabinet, '' AS tbl_income_job, '' AS tbl_income_in_time, '' AS tbl_income_out_time, SUM(tbl_incom_other_amount) AS tbl_income_total, SUM(tbl_incom_other_amount) AS tbl_income_bank, '0' AS tbl_income_user, '0' AS tbl_income_fine, '0' AS tbl_income_other, '" + script.GetCpoint(mainForm.cpoint_id) + "' AS tbl_cpoint_name, STR_TO_DATE( tbl_incom_other_date_send, '%e-%c-%Y' ) AS date_around FROM tbl_incom_other WHERE tbl_incom_other_date_send ='" + date_start_r1.Text + "' AND (tbl_incom_other_list_incom_id = 2 OR tbl_incom_other_list_incom_id = 3) AND tbl_incom_cpoint_id = '" + mainForm.cpoint_id + "' AND tbl_incom_cpoint_sub_id = '" + mainForm.sub_cpoint + "'"; sql_mana = "SELECT tbl_emp_name ,tbl_emp_group_name,CONCAT(tbl_cpoint_name,' ',tbl_status_around_cpoint_sub_id) AS cpoint_report FROM tbl_status_around a JOIN tbl_emp e ON a.tbl_status_around_emp_open_id = e.tbl_emp_id JOIN tbl_emp_group g ON g.tbl_emp_group_id = e.tbl_emp_group_id JOIN tbl_cpoint c ON c.tbl_cpoint_id = a.tbl_status_around_cpoint_id WHERE tbl_status_around_aid = '" + around + "' AND tbl_status_around_date = '" + date + "' AND tbl_cpoint_id = '" + mainForm.cpoint_id + "' AND tbl_status_around_cpoint_sub_id = '" + mainForm.sub_cpoint + "' ORDER BY tbl_status_around_cpoint_sub_id"; } } cmd = new MySqlCommand(); cmd.Connection = conn; conn.Close(); conn.Open(); cmd.CommandText = sql; adap.SelectCommand = cmd; reportDB.Clear(); adap.Fill(reportDB, "Report_Around"); conn.Close(); if (reportDB.Tables[0].Rows.Count < 1) { MessageBox.Show("ไม่พบข้อมูล", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { if (sendBank) { /* * ReportSendBank p_sendBank = new ReportSendBank(); * p_sendBank.SetDataSource(reportDB); * p_sendBank.SetParameterValue("user_print", mainForm.emp_control_id + " " + script.GetEmpName(mainForm.emp_control_id)); * p_sendBank.SetParameterValue("date_job", date_start_r1.Value); * p_sendBank.SetParameterValue("sub_cpoint", all ? "" : mainForm.sub_cpoint); * * popup.cry_View.ReportSource = p_sendBank; * popup.Show(); */ } else { CrystalReport1 myReport = new CrystalReport1(); myReport.SetDataSource(reportDB); string us_p = "Administrator System"; if (mainForm.emp_control_id != "") { us_p = script.GetEmpName(mainForm.emp_control_id); } myReport.SetParameterValue("user_print", us_p); myReport.SetParameterValue("date_job", date_start_r1.Value); myReport.SetParameterValue("sub_cpoint", all ? "" : mainForm.sub_cpoint); int i = 1; int sub = script.GetSubNum(int.Parse(mainForm.cpoint_id)); MySqlDataReader rs = script.Select_SQL(sql_mana); while (rs.Read()) { myReport.SetParameterValue("DeputyManager" + i, rs.GetString("tbl_emp_name")); if (sub > 1) { myReport.SetParameterValue("cpoint" + i, rs.GetString("cpoint_report")); } else { myReport.SetParameterValue("cpoint" + i, rs.GetString("cpoint_report").Substring(0, rs.GetString("cpoint_report").Length - 1)); } string[] pos = rs.GetString("tbl_emp_group_name").Split(' '); if (pos.Length > 2) { string pos_tmp = ""; for (int j = 0; j < pos.Length; j++) { if (j == 0) { pos_tmp += pos[j] + "\r\n"; } else { pos_tmp += pos[j] + " "; } } myReport.SetParameterValue("DeputyManager" + i + "_pos", pos_tmp); } else { myReport.SetParameterValue("DeputyManager" + i + "_pos", rs.GetString("tbl_emp_group_name")); } i++; } rs.Close(); script.conn.Close(); if (i <= 3) { if (i <= 2) { myReport.SetParameterValue("cpoint2", ""); myReport.SetParameterValue("DeputyManager2", ""); myReport.SetParameterValue("DeputyManager2_pos", ""); } myReport.SetParameterValue("cpoint3", ""); myReport.SetParameterValue("DeputyManager3", ""); myReport.SetParameterValue("DeputyManager3_pos", ""); } if (print) { try { myReport.PrintToPrinter(1, true, 0, 0); } catch { MessageBox.Show("พิมพ์ไม่สำเร็จ กรุณาพิมพ์ในระบบย้อนหลัง", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { //myReport.PrintToPrinter(1, true, 0, 0); popup.cry_View.ReportSource = myReport; if (!all) { popup.cry_View.ShowPrintButton = false; popup.cry_View.ShowExportButton = false; } popup.Show(); } } } } }
private void Print(bool print, int doc) { Thread progressThread = new Thread(delegate() { ProgressForm progress = new ProgressForm(); //progress.Text = "กำลังพิมพ์..."; progress.ShowDialog(); }); progressThread.Start(); if (mainForm.line9 == "9") { OfficialReport9 report9 = new OfficialReport9(); report9.SetParameterValue("user_print", script.GetEmpName(mainForm.emp_control_id)); report9.SetParameterValue("cpoint", script.GetCpoint(mainForm.cpoint_id)); report9.SetParameterValue("doc_number", txt_doc_num.Text.Trim() == "" ? " " : txt_doc_num.Text.Trim()); report9.SetParameterValue("tel_cpoint", script.GetCpointTel(mainForm.cpoint_id)); report9.SetParameterValue("date_report", date_send.Text); report9.SetParameterValue("num_doc", CountDoc()); report9.SetParameterValue("1", numeric1.Value.ToString() == "0" ? "-" : numeric1.Value.ToString()); report9.SetParameterValue("2", numeric2.Value.ToString() == "0" ? "-" : numeric2.Value.ToString()); report9.SetParameterValue("3", numeric3.Value.ToString() == "0" ? "-" : numeric3.Value.ToString()); report9.SetParameterValue("4", numeric4.Value.ToString() == "0" ? "-" : numeric4.Value.ToString()); report9.SetParameterValue("5", numeric5.Value.ToString() == "0" ? "-" : numeric5.Value.ToString()); report9.SetParameterValue("6", numeric6.Value.ToString() == "0" ? "-" : numeric6.Value.ToString()); report9.SetParameterValue("7", numeric7.Value.ToString() == "0" ? "-" : numeric7.Value.ToString()); report9.SetParameterValue("8", numeric8.Value.ToString() == "0" ? "-" : numeric8.Value.ToString()); report9.SetParameterValue("9", numeric9.Value.ToString() == "0" ? "-" : numeric9.Value.ToString()); report9.SetParameterValue("10", numeric10.Value.ToString() == "0" ? "-" : numeric10.Value.ToString()); report9.SetParameterValue("11", numeric11.Value.ToString() == "0" ? "-" : numeric11.Value.ToString()); report9.SetParameterValue("user_send", script.GetEmpName(user_send)); report9.SetParameterValue("user_send_group", script.NotManager(user_send)); report9.SetParameterValue("head_moterway", File.ReadAllLines(script.file_head_moterway)); report9.SetParameterValue("total_doc", (numeric1.Value + numeric2.Value + numeric3.Value + numeric4.Value + numeric5.Value + numeric6.Value + numeric7.Value + numeric8.Value + numeric9.Value + numeric10.Value + numeric11.Value)); if (mainForm.line9 == "9") { report9.SetParameterValue("send_h", "1"); } else { if (int.Parse(mainForm.cpoint_id) < 705) { report9.SetParameterValue("send_h", "2"); } else { report9.SetParameterValue("send_h", "3"); } } report9.SetParameterValue("other_send", textBox1.Text.Trim()); report9.SetParameterValue("q_print", doc); if (print) { try { report9.PrintToPrinter(1, true, 0, 0); } catch { MessageBox.Show("พิมพ์ไม่สำเร็จ", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { PopupReport popup = new PopupReport(); popup = new PopupReport(); popup.cry_View.ReportSource = report9; //popup.cry_View.PrintMode = false; popup.Text = "บันทึกข้อมความ"; //popup.cry_View.Zoom(80); popup.Show(); } } else { OfficialReport7 report7 = new OfficialReport7(); report7.SetParameterValue("user_print", script.GetEmpName(mainForm.emp_control_id)); report7.SetParameterValue("cpoint", script.GetCpoint(mainForm.cpoint_id)); report7.SetParameterValue("doc_number", txt_doc_num.Text.Trim() == "" ? " " : txt_doc_num.Text.Trim()); report7.SetParameterValue("tel_cpoint", script.GetCpointTel(mainForm.cpoint_id)); report7.SetParameterValue("date_report", date_send.Text); report7.SetParameterValue("num_doc", CountDoc()); report7.SetParameterValue("1", numeric1.Value.ToString() == "0" ? "-" : numeric1.Value.ToString()); report7.SetParameterValue("2", numeric2.Value.ToString() == "0" ? "-" : numeric2.Value.ToString()); report7.SetParameterValue("3", numeric3.Value.ToString() == "0" ? "-" : numeric3.Value.ToString()); report7.SetParameterValue("4", numeric4.Value.ToString() == "0" ? "-" : numeric4.Value.ToString()); report7.SetParameterValue("5", numeric5.Value.ToString() == "0" ? "-" : numeric5.Value.ToString()); report7.SetParameterValue("6", numeric6.Value.ToString() == "0" ? "-" : numeric6.Value.ToString()); report7.SetParameterValue("7", numeric7.Value.ToString() == "0" ? "-" : numeric7.Value.ToString()); report7.SetParameterValue("8", numeric8.Value.ToString() == "0" ? "-" : numeric8.Value.ToString()); report7.SetParameterValue("9", numeric9.Value.ToString() == "0" ? "-" : numeric9.Value.ToString()); report7.SetParameterValue("10", numeric10.Value.ToString() == "0" ? "-" : numeric10.Value.ToString()); report7.SetParameterValue("11", numeric11.Value.ToString() == "0" ? "-" : numeric11.Value.ToString()); report7.SetParameterValue("user_send", script.GetEmpName(user_send)); report7.SetParameterValue("user_send_group", script.NotManager(user_send)); report7.SetParameterValue("total_doc", (numeric1.Value + numeric2.Value + numeric3.Value + numeric4.Value + numeric5.Value + numeric6.Value + numeric7.Value + numeric8.Value + numeric9.Value + numeric10.Value + numeric11.Value)); report7.SetParameterValue("head_moterway", File.ReadAllLines(script.file_head_moterway)); if (mainForm.line9 == "9") { report7.SetParameterValue("send_h", "1"); } else { if (int.Parse(mainForm.cpoint_id) < 705) { report7.SetParameterValue("send_h", "2"); } else { report7.SetParameterValue("send_h", "3"); } } report7.SetParameterValue("other_send", textBox1.Text.Trim()); report7.SetParameterValue("q_print", doc); if (print) { try { report7.PrintToPrinter(1, true, 0, 0); } catch { MessageBox.Show("พิมพ์ไม่สำเร็จ", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { PopupReport popup = new PopupReport(); popup = new PopupReport(); popup.cry_View.ReportSource = report7; //popup.cry_View.PrintMode = false; popup.Text = "บันทึกข้อมความ"; //popup.cry_View.Zoom(80); popup.Show(); } } progressThread.Abort(); }