示例#1
0
        private string setReport()
        {
            List <string>     message = null;
            ClsReportDocument cls     = new ClsReportDocument();

            foreach (string code in _propReport.reportCode)
            {
                ClsReportDocument.reportDoc rptDoc = new ClsReportDocument.reportDoc();
                rptDoc = cls.rptDoc(code);
                if (rptDoc.report != null)
                {
                    if (report == null)
                    {
                        report = new List <struReport>();
                    }
                    ReportDocument rpt = rptDoc.report;
                    setParameter(ref rpt, code);
                    using (InhCheckupDataContext dbc = new InhCheckupDataContext())
                    {
                        struReport stRpt = dbc.mst_reports.Where(x => x.mrt_code == code && x.mrt_status == 'A' &&
                                                                 DateTime.Today.Date >= x.mrt_effective_date.Value.Date &&
                                                                 DateTime.Today.Date <= (x.mrt_expire_date == null ? DateTime.Today.Date : x.mrt_expire_date.Value.Date))
                                           .Select(x => new struReport()
                        {
                            reportNameTH  = x.mrt_tname,
                            reportNameEng = x.mrt_ename,
                            reportCode    = code,
                            reportDoc     = rpt
                        }).FirstOrDefault();
                        if (report == null)
                        {
                            report = new List <struReport>();
                        }
                        report.Add(stRpt);
                    }
                }
                else
                {
                    if (message == null)
                    {
                        message = new List <string>();
                    }
                    message.Add(rptDoc.messege);
                }
            }
            if (report != null)
            {
                currentReport = report.First();
                crystalReportViewer1.ReportSource = _currentReport.reportDoc;
            }
            cls.Dispose();
            if (message != null)
            {
                return(string.Join("/r/n", message));
            }
            else
            {
                return(null);
            }
        }
示例#2
0
        public frmPreviewReport(int id, string reportCode, string site)
        {
            InitializeComponent();
            using (InhCheckupDataContext cdc = new InhCheckupDataContext())
            {
                ClsReportDocument.reportDoc rptDoc = new ClsReportDocument.reportDoc();
                ClsReportDocument           cls    = new ClsReportDocument();
                ReportDocument rpt = new ReportDocument();
                if (reportCode == "AV103")
                {
                    rptDoc = cls.rptDoc("AV103");
                    rpt    = rptDoc.report;
                    rpt.SetParameterValue("@tram_id", id);
                }
                else if (reportCode == "AV104")
                {
                    rptDoc = cls.rptDoc("AV104");
                    rpt    = rptDoc.report;
                    rpt.SetParameterValue("@trvh_id", id);
                    rpt.SetParameterValue("@dept", site);
                }
                struReport stRpt = cdc.mst_reports.Where(x => x.mrt_code == reportCode && x.mrt_status == 'A' &&
                                                         DateTime.Today.Date >= x.mrt_effective_date.Value.Date &&
                                                         DateTime.Today.Date <= (x.mrt_expire_date == null ? DateTime.Today.Date : x.mrt_expire_date.Value.Date))
                                   .Select(x => new struReport()
                {
                    reportNameTH  = x.mrt_tname,
                    reportNameEng = x.mrt_ename,
                    reportCode    = reportCode,
                    reportDoc     = rpt
                }).FirstOrDefault();
                if (report == null)
                {
                    report = new List <struReport>();
                }
                report.Add(stRpt);
                if (report != null)
                {
                    currentReport = report.First();
                    crystalReportViewer1.ReportSource = _currentReport.reportDoc;
                }
                cls.Dispose();
            }
            this.Top  = Screen.PrimaryScreen.WorkingArea.Top;
            this.Left = Screen.PrimaryScreen.WorkingArea.Left;
            this.Size = Screen.PrimaryScreen.WorkingArea.Size;
            _propertyReport prop = new _propertyReport()
            {
                tpr_id                 = 0,
                showSelectCopy         = false,
                defaultCopy            = 0,
                printOutBarcodePrinter = false
            };

            this.propertyReport = prop;
            this.ShowDialog();
        }
示例#3
0
        public ReportDocument getReportDoc()
        {
            ClsReportDocument.reportDoc rptDoc = new ClsReportDocument.reportDoc();
            ClsReportDocument           cls    = new ClsReportDocument();

            rptDoc = cls.rptDoc(_propReport.reportCode.First());
            ReportDocument rpt = rptDoc.report;

            setParameter(ref rpt, _propReport.reportCode.First());
            return(rpt);
        }
示例#4
0
        public frmPreviewReport(int tpr_id, string queueNo)
        {
            InitializeComponent();
            ClsReportDocument.reportDoc rptDoc = new ClsReportDocument.reportDoc();
            ClsReportDocument           cls    = new ClsReportDocument();

            rptDoc = cls.rptDoc("RG000");
            using (InhCheckupDataContext cdc = new InhCheckupDataContext())
            {
                ReportDocument rpt = rptDoc.report;
                rpt.SetParameterValue("@tpr_id", tpr_id);
                rpt.SetParameterValue("@print_user", getNameUser());
                rpt.SetParameterValue("@mrt_code", "RG000");
                //setParameter(ref rpt, _propReport.reportCode.First());
                rpt.SetParameterValue("@Queue", queueNo);
                struReport stRpt = cdc.mst_reports.Where(x => x.mrt_code == "RG000" && x.mrt_status == 'A' &&
                                                         DateTime.Today.Date >= x.mrt_effective_date.Value.Date &&
                                                         DateTime.Today.Date <= (x.mrt_expire_date == null ? DateTime.Today.Date : x.mrt_expire_date.Value.Date))
                                   .Select(x => new struReport()
                {
                    reportNameTH  = x.mrt_tname,
                    reportNameEng = x.mrt_ename,
                    reportCode    = "RG000",
                    reportDoc     = rpt
                }).FirstOrDefault();
                if (report == null)
                {
                    report = new List <struReport>();
                }
                report.Add(stRpt);
                if (report != null)
                {
                    currentReport = report.First();
                    crystalReportViewer1.ReportSource = _currentReport.reportDoc;
                }
            }
            this.Top  = Screen.PrimaryScreen.WorkingArea.Top;
            this.Left = Screen.PrimaryScreen.WorkingArea.Left;
            this.Size = Screen.PrimaryScreen.WorkingArea.Size;
            _propertyReport prop = new _propertyReport()
            {
                tpr_id                 = tpr_id,
                showSelectCopy         = true,
                defaultCopy            = 1,
                printOutBarcodePrinter = true
            };

            this.propertyReport = prop;
            this.Activated     += new EventHandler(activateForShowCopy);
            this.ShowDialog();
            //return rpt;
            //using (InhCheckupDataContext cdc = new InhCheckupDataContext())
            //{
            //    string path = cdc.mst_reports.Where(x => x.mrt_code == "").Select(x => x.mrt_path_file + x.mrt_file_name;
            //    rpt.Load("");
            //    rpt.SetParameterValue("", "");
            //    rpt.SetParameterValue("", "");
            //    rpt.SetParameterValue("", "");
            //    rpt.SetParameterValue("@Queue", queueNo);
            //}
        }