示例#1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            OfficialReport9 rpt = new OfficialReport9();

            rpt.Site = this.Site;
            return(rpt);
        }
示例#2
0
        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();
        }