コード例 #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            DefectiveStrapsReport rpt = new DefectiveStrapsReport();

            rpt.Site = this.Site;
            return(rpt);
        }
コード例 #2
0
ファイル: DefectiveFrom.cs プロジェクト: kenji2511/TIS
        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); }
        }