Ejemplo n.º 1
0
        protected List <builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn> GetPicsTwoColPerMea(DataTable picstable, int meaid)
        {
            int ipic = 0;
            var pics = new List <builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn>();

            builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn running = null;
            if (picstable != null)
            {
                foreach (DataRow dr in picstable.Rows)
                {
                    if (meaid == Convert.ToInt32(dr["MeaID"]) && mime.FiletypeIsImage((FileType)dr["iMIME"]))
                    {
                        var binid = Convert.ToInt32(dr["BinID"]);
                        if (ipic % 2 == 0)
                        {
                            running = new builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn()
                            {
                                UrlLeft  = MediaURLAbsolute(binid, 320, 320, new FileType[] { FileType.ft_jpg, FileType.ft_png }),
                                UrlRight = FileURLAbsolute("images/spacer.png")
                            };
                            pics.Add(running); /* add */
                        }
                        else
                        {
                            running.UrlRight = MediaURLAbsolute(binid, 320, 320, new FileType[] { FileType.ft_jpg, FileType.ft_png });
                        }
                        /* advance */
                        ++ipic;
                    }
                }
            }
            return(pics);
        }
Ejemplo n.º 2
0
        protected List <builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn> GetPicsTwoColumn(DataSet ds, string rdi)
        {
            int ipic      = 0;
            var pics      = new List <builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn>();
            var picstable = ds.Tables[rdi];

            builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn running = null;
            if (picstable != null)
            {
                foreach (DataRow dr in picstable.Rows)
                {
                    var binid = Convert.ToInt32(dr["BinID"]);
                    if (ipic % 2 == 0)
                    {
                        running = new builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn()
                        {
                            UrlLeft  = MediaURLAbsolute(binid, 320, 320, new FileType[] { FileType.ft_jpg, FileType.ft_png }),
                            UrlRight = FileURLAbsolute("images/spacer.png")
                        };
                        pics.Add(running); /* add */
                    }
                    else
                    {
                        running.UrlRight = MediaURLAbsolute(binid, 320, 320, new FileType[] { FileType.ft_jpg, FileType.ft_png });
                    }
                    /* document */
                    if (String.IsNullOrWhiteSpace(running.UrlLeft) == false)
                    {
                        Tracing.VerboseCore("Image URL for report (left): \"{0}\"", running.UrlLeft);
                    }
                    if (String.IsNullOrWhiteSpace(running.UrlRight) == false)
                    {
                        Tracing.VerboseCore("Image URL for report (right): \"{0}\"", running.UrlRight);
                    }
                    /* advance */
                    ++ipic;
                }
            }
            return(pics);
        }
Ejemplo n.º 3
0
        protected override bool RenderInternal(ref MemoryStream chunk, out string mime)
        {
            mime = null;
            try
            {
                /* 1. instantiate the report */
                string rdlcname;
                int    finpix_maxwidth  = sherm.core.formatting.mime.HARDCOPY_FINMEAPIC_MAXWIDTH;
                int    finpix_maxheight = sherm.core.formatting.mime.HARDCOPY_FINMEAPIC_MAXHEIGHT;
                if (CfgVariant2_OBSINS)
                {
                    /* [dlatikay 20150601] MEA-2015-00257, added */
                    rdlcname = "sherm.rpt.msdbrpt.ReportHardcopyObs001a.rdlc";
                    /* [dlatikay 20150612] MEA-2015-00274 */
                    finpix_maxwidth  = sherm.core.formatting.mime.HARDCOPY_FINMEAPIC_MAXWIDTH_LARGER;
                    finpix_maxheight = sherm.core.formatting.mime.HARDCOPY_FINMEAPIC_MAXHEIGHT_LARGER;
                }
                if (CfgVariant2_IMS)
                {
                    /* [dlatikay 20160609] MEA-2016-00131.13 et al */
                    rdlcname = "sherm.rpt.msdbrpt.ReportHardcopyObsIMS.rdlc";
                }
                else
                {
                    rdlcname = "sherm.rpt.msdbrpt.ReportHardcopyObs001.rdlc";
                }
                var rpt = new LocalReport()
                {
                    ReportEmbeddedResource = rdlcname, /* used for all types which derive from this class */
                    EnableExternalImages   = true
                };
                /* 1a. persons involved */
                var invo  = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_SHARED_PERS];
                var spers = new StringBuilder();
                foreach (DataRow dr in invo.Rows)
                {
                    var sheading = dr["Heading"].ToString();
                    var sname    = dr["Name"].ToString();
                    if (String.IsNullOrWhiteSpace(sheading))
                    {
                        spers.AppendFormat(", {0}", sname);
                    }
                    else
                    {
                        spers.AppendFormat("{0}<strong>{1}</strong> {2}", spers.Length > 0 ? "<br />" : String.Empty, sheading, sname);
                    }
                }
                /* 2. populate the report */
                rpt.DataSources.Clear();
                var Logo = MediaURLAbsolute(sherm.core.formatting.mime.BINGET_NAMEDRESOURCE_CORPORATELOGO, new FileType[] { FileType.ft_png });
                var dt   = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_REPORTVERBOSE].Rows[0];
                /* snapshot exists? */
                bool has_mea_snapshot = dt["HasMeaSnapshot"].Equals(DBNull.Value) == false && Convert.ToInt32(dt["HasMeaSnapshot"]) > 0;
                /* assign the scalars */
                rpt.SetParameters(new ReportParameter[] {
                    new ReportParameter("lClassification", m(187)),             /* Category */
                    new ReportParameter("LogoURL", Logo),
                    new ReportParameter("lNumber", m(27)),                      /* Number */
                    new ReportParameter("lOriginator", m(45)),                  /* Originator */
                    new ReportParameter("lEventDatetime", m(c_lEventDatetime)), /* Date */
                    new ReportParameter("lArea", m(48)),                        /* Area, Department */
                    new ReportParameter("lWorkplace", m(c_lArea)),              /* Workplace */
                    new ReportParameter("lPersInvolved", m(407)),               /* Persons involved */
                    new ReportParameter("lDescription", m(5646)),               /* Audit agenda */
                    new ReportParameter("lRemarks", m(c_lRemarks)),             /* Circumstances */
                    new ReportParameter("Status", dt["fStatus"].ToString()),
                    new ReportParameter("NrComposite", dt["NrComposite"].ToString()),
                    new ReportParameter("OriginatorName", dt["OriginatorName"].ToString()),
                    new ReportParameter("EventDatetime", dt["fTime"].ToString()),
                    new ReportParameter("Area", dt["OrgCap"].ToString()),
                    new ReportParameter("Workplace", dt["Workplace"].ToString()),
                    new ReportParameter("hPersInvolved", spers.ToString()),
                    new ReportParameter("Description", dt["fDescription"].ToString()), /* MEA-2016-00133 */
                    new ReportParameter("Remarks", dt["fRemarks"].ToString()),
                    new ReportParameter("Title", dt["fTitle"].ToString()),
                    new ReportParameter("Classification", dt["fCategory"].ToString()),
                    new ReportParameter("lcreawhen", m(2301)),                                  /* Created on */
                    new ReportParameter("crea_when", dt["fcrea_when"].ToString()),
                    new ReportParameter("llm_when", m(3255)),                                   /* Last modified */
                    new ReportParameter("lm_when", dt["flm_when_who"].ToString()),
                    new ReportParameter("lAspect", m(1510)),                                    /* Aspect */
                    new ReportParameter("Aspect", dt["fAspect"].ToString()),
                    new ReportParameter("lAppointment", m(2155)),                               /* Appointment */
                    new ReportParameter("Appointment", dt["fAppointment"].ToString()),
                    new ReportParameter("lPageNofM", m(2410)),                                  /* Page {0} of {1} */
                    new ReportParameter("lTabBasic", m(156)),                                   /* General information */
                    new ReportParameter("lDuration", m(53)),                                    /* Time taken */
                    new ReportParameter("Duration", dt["fDuration"].ToString()),
                    new ReportParameter("lAuditingArea", m(1775)),                              /* Auditing area */
                    new ReportParameter("AuditingArea", dt["fAuditingArea"].ToString()),
                    new ReportParameter("lEmployeesObserved", m(57)),                           /* Employees observed */
                    new ReportParameter("EmployeesObserved", dt["fEmployeesObserved"].ToString()),
                    new ReportParameter("lChecklist", m(50)),                                   /* Checklist */
                    new ReportParameter("Checklist", dt["fChecklist"].ToString()),
                    new ReportParameter("lPPEOffences", m(54)),                                 /* PPE offences */
                    new ReportParameter("PPEOffences", dt["fPPEOffences"].ToString()),
                    new ReportParameter("lResponsible", m(290)),                                /* Responsible */
                    new ReportParameter("Responsible", dt["fResponsible"].ToString()),
                    new ReportParameter("lRemarksUnsafe", m(59)),                               /* Remarks: unsafe */
                    new ReportParameter("RemarksUnsafe", dt["fRemarksUnsafe"].ToString()),
                    new ReportParameter("lRemarksSafe", m(58)),                                 /* Positive remarks */
                    new ReportParameter("RemarksSafe", dt["fRemarksSafe"].ToString()),
                    new ReportParameter("lTabMedia", m(56)),                                    /* Attached files */
                    new ReportParameter("lDocuments", m(3607)),                                 /* Documents */
                    new ReportParameter("Documents", dt["fDocuments"].ToString()),
                    new ReportParameter("lTabFinMea", m(4999)),                                 /* Findings, measures */
                    new ReportParameter("lTabMea", m(3850)),                                    /* Incomplete at the time the report was created */
                    new ReportParameter("lFinMeaStatusNumber", m(249)),                         /* Status */
                    new ReportParameter("lFinMeaCategory", m(3845)),                            /* Cat. */
                    new ReportParameter("lFinMeaArea", m(251)),                                 /* Area */
                    new ReportParameter("lFinMeaText", m(289)),                                 /* Text */
                    new ReportParameter("lFinMeaResponsible", m(290)),                          /* Responsible */
                    new ReportParameter("lFinMeaPicture", m(3166)),                             /* Pictures */
                    new ReportParameter("lTabChk", m(50)),                                      /* Checklist */
                    new ReportParameter("lChkLabel", m(3849)),                                  /* Item */
                    new ReportParameter("lChkAnswer", m(249)),                                  /* Status */
                    new ReportParameter("lChkText", m(3710)),                                   /* Antwort */
                    new ReportParameter("lChkMeasures", CfgVariant2_COMMON ? m(240) : m(3712)), /* Measures/Consequences */ /* [pkosec 20150108] MEA-2015-00005.b */
                    new ReportParameter("FooterInfoline", dt["fFooterInfoline"].ToString()),
                    /* added [dlatikay 20140508] */
                    new ReportParameter("HideSnapshot", has_mea_snapshot?String.Empty:"HIDDEN"),
                    new ReportParameter("lTabChkSummary", m(4589)),        /* Tri-state assessment */
                    new ReportParameter("lChkAnswer", m(3710)),            /* Answer */
                    new ReportParameter("lChkAnswerDescription", m(3738)), /* Interpretation */
                    new ReportParameter("lChkSummaryCount", m(4590)),      /* Assessment */
                    new ReportParameter("lTabChkChapterwise", m(4591)),    /* Chapter overview */
                    new ReportParameter("lChkChapter", m(980)),            /* Chapter */
                    /* added [pkosec 20150126] MEA-2015-00021 */
                    new ReportParameter("HidePSA", CfgVariant2_COMMON?"HIDDEN":String.Empty)
                });

                /* shovel the other lists;
                 * a) the chk table/s */
                var chks             = new List <builtin.msdbrpt_datasources.ReportHardcopyReportChk>();
                var chkstable        = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_CHECKLISTS];
                var chapterwise      = new List <builtin.msdbrpt_datasources.ReportHardcopyReportChkChapterwise>();
                var chapterwisetable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_CHKCHAPTERWISE];
                var chksummary       = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_CHKSUMMARY];
                if (chkstable.Rows.Count > 0)
                {
                    rpt.SetParameters(new ReportParameter[] {
                        new ReportParameter("HideChecklist", String.Empty)
                    });
                    foreach (DataRow dr in chkstable.Rows)
                    {
                        chks.Add(new builtin.msdbrpt_datasources.ReportHardcopyReportChk()
                        {
                            ItemLabel      = dr["fLabel"].ToString(),
                            AnswerPicURL   = FileURLAbsolute("images/" + dr["fAnswerPic"].ToString() + ".png"),
                            AnswerNumValue = dr["fAnswerNumValue"].ToString(), /* [dlatikay 20150601] MEA-2015-00207 */
                            HTML           = dr["fHTML"].ToString(),
                            Measures       = dr["fMeasures"].ToString()
                        });
                    }
                    /* even if there _are_ checklist items, not all customers want the summary representations */
                    if (dt["fHideChkSummaries"].ToString().Length > 0)
                    {
                        rpt.SetParameters(new ReportParameter[] {
                            new ReportParameter("HideChkSummary", "HIDDEN"),
                            new ReportParameter("HideChkChapterwise", "HIDDEN")
                        });
                    }
                    else
                    {
                        /* [pkosec 20140707] assign values to params */
                        foreach (DataRow dr in chksummary.Rows)
                        {
                            /* not hidden. compose their data:
                             * a) the totals, they're parameters */
                            rpt.SetParameters(new ReportParameter[] {
                                new ReportParameter("HideChkSummary", String.Empty),
                                new ReportParameter("HideChkChapterwise", String.Empty),
                                /* content */
                                new ReportParameter("ChkAnswerGreen", dr["ChkAnswerGreen"].ToString()),
                                new ReportParameter("ChkAnswerYellow", dr["ChkAnswerYellow"].ToString()),
                                new ReportParameter("ChkAnswerRed", dr["ChkAnswerRed"].ToString()),
                                new ReportParameter("ChkAnswerGray", dr["ChkAnswerGray"].ToString()),
                                new ReportParameter("ChkAnswerDescriptionGreen", dr["ChkAnswerDescriptionGreen"].ToString()),
                                new ReportParameter("ChkAnswerDescriptionYellow", dr["ChkAnswerDescriptionYellow"].ToString()),
                                new ReportParameter("ChkAnswerDescriptionRed", dr["ChkAnswerDescriptionRed"].ToString()),
                                new ReportParameter("ChkAnswerDescriptionGray", dr["ChkAnswerDescriptionGray"].ToString()),
                                new ReportParameter("ChkCountGreen", dr["ChkCountGreen"].ToString()),
                                new ReportParameter("ChkCountYellow", dr["ChkCountYellow"].ToString()),
                                new ReportParameter("ChkCountRed", dr["ChkCountRed"].ToString()),
                                new ReportParameter("ChkCountGray", dr["ChkCountGray"].ToString()),
                            });
                        }
                        /* b) the chapterwise */
                        if (chapterwisetable.Rows.Count > 0)
                        {
                            foreach (DataRow dr in chapterwisetable.Rows)
                            {
                                chapterwise.Add(new builtin.msdbrpt_datasources.ReportHardcopyReportChkChapterwise()
                                {
                                    ChapterLabel = dr["fChapterLabel"].ToString(),
                                    CountRed     = dr["CountRed"].ToString(),
                                    CountYellow  = dr["CountYellow"].ToString(),
                                    CountGreen   = dr["CountGreen"].ToString(),
                                    CountGray    = dr["CountGray"].ToString()
                                });
                            }
                        }
                    }
                }
                else
                {
                    /* hide all checklist-related subtables if empty */
                    rpt.SetParameters(new ReportParameter[] {
                        new ReportParameter("HideChkSummary", "HIDDEN"),
                        new ReportParameter("HideChkChapterwise", "HIDDEN"),
                        new ReportParameter("HideChecklist", "HIDDEN")
                    });
                }
                /* b) the item overview */
                var ovvw       = new List <builtin.msdbrpt_datasources.ReportHardcopyIncidentFinMea>();
                var itemstable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_MEASURES_OVW];
                foreach (DataRow dr in itemstable.Rows)
                {
                    ovvw.Add(new builtin.msdbrpt_datasources.ReportHardcopyIncidentFinMea()
                    {
                        Area     = dr["fAreaHTML"].ToString(),
                        Category = dr["fCategory"].ToString(),
                        HTML     = dr["fHTML"].ToString(),
                        Number   = dr["fNumber"].ToString(),
                        PicUrl   = (dr["HasAttachment"].Equals(DBNull.Value) || Convert.ToBoolean(dr["HasAttachment"]) == false)
                            ? FileURLAbsolute("images/spacer.png")
                            : (Convert.ToBoolean(dr["AttachmentIsPicture"])
                                ? MediaURLAbsolute(Convert.ToInt32(dr["AttachmentBinID"]), finpix_maxwidth, finpix_maxheight, new FileType[] { FileType.ft_png }) /* need not coerce to png, gallery thumbnails are always png anyway; [dlatikay 20131205] do need to - we're now no longer using the thumbnail for higher resolution requirement */
                                : FileURLAbsolute("images/attch.gif")                                                                                             /* [pkosec,dlatikay 20131206] MEA-2013-00783 */
                               ),
                        Responsible  = dr["fResponsibleHTML"].ToString(),
                        StatusPicFin = FileURLAbsolute("images/" + dr["fStatusPicFin"].ToString() + ".png"),
                        StatusPicMea = FileURLAbsolute("images/" + dr["fStatusPicMea"].ToString() + ".png")
                    });
                }
                /* c) the snapshot measures (obs only) */
                var snapshot = new List <builtin.msdbrpt_datasources.ReportHardcopyReportMea>();
                if (has_mea_snapshot && UseMeasureSnapshot)
                {
                    var meatable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_MEASURES_SNAPSHOT];
                    foreach (DataRow dr in meatable.Rows)
                    {
                        snapshot.Add(new builtin.msdbrpt_datasources.ReportHardcopyReportMea()
                        {
                            Area     = dr["fAreaHTML"].ToString(),
                            Category = dr["fCategory"].ToString(),
                            HTML     = dr["fHTML"].ToString(),
                            Number   = dr["fNumber"].ToString(),
                            PicUrl   = (dr["HasAttachment"].Equals(DBNull.Value) || Convert.ToBoolean(dr["HasAttachment"]) == false)
                                ? FileURLAbsolute("images/spacer.png")
                                : (Convert.ToBoolean(dr["AttachmentIsPicture"])
                                    ? MediaURLAbsolute(Convert.ToInt32(dr["AttachmentBinID"]), finpix_maxwidth, finpix_maxheight, new FileType[] { FileType.ft_png }) /* need not coerce to png, gallery thumbnails are always png anyway; [dlatikay 20131205] do need to - we're now no longer using the thumbnail for higher resolution requirement */
                                    : FileURLAbsolute("images/attch.gif")                                                                                             /* [pkosec,dlatikay 20131206] MEA-2013-00783 */
                                   ),
                            Responsible  = dr["fResponsibleHTML"].ToString(),
                            StatusPicMea = FileURLAbsolute("images/" + dr["fStatusPicMea"].ToString() + ".png")
                        });
                    }
                }
                /* d) the pictures */
                var incpics   = new List <builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn>();
                int ipic      = 0;
                var picstable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_SHARED_PICS];
                builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn running = null;
                foreach (DataRow dr in picstable.Rows)
                {
                    var binid = Convert.ToInt32(dr["BinID"]);
                    if (ipic % 2 == 0)
                    {
                        running = new builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn()
                        {
                            UrlLeft  = MediaURLAbsolute(binid, 320, 320, new FileType[] { FileType.ft_jpg, FileType.ft_png }),
                            UrlRight = FileURLAbsolute("images/spacer.png")
                        };
                        incpics.Add(running);
                    }
                    else
                    {
                        running.UrlRight = MediaURLAbsolute(binid, 320, 320, new FileType[] { FileType.ft_jpg, FileType.ft_png });
                    }
                    /* document */
                    if (String.IsNullOrWhiteSpace(running.UrlLeft) == false)
                    {
                        Tracing.VerboseCore("Image URL for report (left): \"{0}\"", running.UrlLeft);
                    }
                    if (String.IsNullOrWhiteSpace(running.UrlRight) == false)
                    {
                        Tracing.VerboseCore("Image URL for report (right): \"{0}\"", running.UrlLeft);
                    }
                    /* advance */
                    ++ipic;
                }
                /* equip the report with the rest of the data sources */
                var dsBasic       = "Basic";
                var dsPics        = "Pics";
                var dsChk         = "ChkTable";
                var dsChapterwise = "ChkChapterwise";
                var dsFinMea      = "FinMeaTable";
                var dsMea         = "MeaTable";
                var dynDS_Basic   = new ReportDataSource(dsBasic, new List <builtin.msdbrpt_datasources.ReportHardcopyIncidentBasic>()
                {
                    new builtin.msdbrpt_datasources.ReportHardcopyIncidentBasic()
                });                                                                                                                                                                                     /* [sic], this is but an empty record to satisfy the tablix, actual content comes with parameters */
                var dynDS_Pics        = new ReportDataSource(dsPics, incpics);
                var dynDS_Chk         = new ReportDataSource(dsChk, chks);
                var dynDS_Chapterwise = new ReportDataSource(dsChapterwise, chapterwise);
                var dynDS_FinMea      = new ReportDataSource(dsFinMea, ovvw);
                var dynDS_Mea         = new ReportDataSource(dsMea, snapshot);
                rpt.DataSources.Clear();
                rpt.DataSources.Add(dynDS_Basic);
                rpt.DataSources.Add(dynDS_Pics);
                rpt.DataSources.Add(dynDS_Chk);
                rpt.DataSources.Add(dynDS_Chapterwise);
                rpt.DataSources.Add(dynDS_FinMea);
                rpt.DataSources.Add(dynDS_Mea);
                /* 3. render the report into the desired format */
                rpt.Refresh();
                RenderAsMsdbrpt(ResultFileBasename, ref chunk, ref mime, rpt);
                /* succeeded */
                return(true);
            }
            catch (Exception ex)
            {
                /* some error */
                OnBuiltinReportError(ex.Message, ex);
                return(false);
            }
        }
        protected override bool RenderInternal(ref MemoryStream chunk, out string mime)
        {
            mime = null;
            try
            {
                /* 1. instantiate the report */
                var rpt = new LocalReport()
                {
                    ReportEmbeddedResource = ReportResourcename,
                    EnableExternalImages   = true
                };
                /* 1a. topic and subjects */
                //var subjects = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_TRAINING_SUBJECTS];
                /* 2. populate the report */
                rpt.DataSources.Clear();
                var Logo = MediaURLAbsolute(sherm.core.formatting.mime.BINGET_NAMEDRESOURCE_CORPORATELOGO, new FileType[] { FileType.ft_png });
                var dt   = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_TRAINING].Rows[0];
                rpt.SetParameters(new ReportParameter[] {
                    new ReportParameter("Title", dt["fTitle"].ToString()),
                    new ReportParameter("LogoURL", Logo),
                    new ReportParameter("Status", dt["fStatus"].ToString()),
                    new ReportParameter("lPageNofM", m(2410)),                              /* Page {0} of {1} */
                    new ReportParameter("lTabBasic", m(39)),                                /* Training */ /* updated [pkosec 20141110] MEA-2014-00481 */
                    new ReportParameter("lNumberMea", m(4838)),                             /* Measure number */ /* updated [pkosec 20141110] MEA-2014-00481 */
                    new ReportParameter("lEventDatetime", m(1320)),                         /* Date/time */
                    new ReportParameter("lArea", m(48)),                                    /* Area, Department */
                    new ReportParameter("lWorkplace", m(49)),                               /* Workplace */
                    new ReportParameter("NrComposite", dt["NrComposite"].ToString()),
                    new ReportParameter("NrCompositeMea", dt["NrCompositeMea"].ToString()), /* added [pkosec 20141110] MEA-2014-00481 */
                    new ReportParameter("EventDatetime", dt["fTime"].ToString()),
                    new ReportParameter("Area", dt["OrgCap"].ToString()),
                    new ReportParameter("Workplace", dt["Workplace"].ToString()),
                    new ReportParameter("lPartner", m(188)),        /* Contractor */
                    new ReportParameter("Partner", dt["fPartner"].ToString()),
                    new ReportParameter("lResource", m(3234)),      /* Raum/Resource */
                    new ReportParameter("Resource", dt["fResource"].ToString()),
                    new ReportParameter("lTopic", m(1599)),         /* Topic */
                    new ReportParameter("Topic", dt["fTopic"].ToString()),
                    new ReportParameter("lDuration", m(1115)),      /* Duration */
                    new ReportParameter("Duration", dt["fDuration"].ToString()),
                    new ReportParameter("lNext", m(3231)),          /* Next due */
                    new ReportParameter("Next", dt["fNext"].ToString()),
                    new ReportParameter("lTrainer", m(1309)),       /* Trainer */
                    new ReportParameter("Trainer", dt["fTrainer"].ToString()),
                    new ReportParameter("lInstitute", m(1322)),     /* Partner institute */
                    new ReportParameter("Institute", dt["fInstitute"].ToString()),
                    new ReportParameter("lSubjects", m(1324)),      /* Subjects */
                    new ReportParameter("Subjects", dt["fSubjects"].ToString()),
                    new ReportParameter("lRemark", m(291)),         /* Description */
                    new ReportParameter("Remark", dt["fRemark"].ToString()),
                    new ReportParameter("lSignature", m(1680)),     /* Signature */
                    new ReportParameter("lDocuments", m(3607)),     /* Documents */
                    new ReportParameter("Documents", dt["fDocuments"].ToString()),
                    new ReportParameter("lTabParti", m(796)),       /* Participants */
                    new ReportParameter("lPartiPers", m(588)),      /* Employee # */
                    new ReportParameter("lPartiName", m(744)),      /* Name */
                    new ReportParameter("lPartiArea", m(48)),       /* Area, Department */
                    new ReportParameter("lPartiRequired", m(1318)), /* Req. */
                    new ReportParameter("lPartiAttended", m(1616)), /* Participation */
                    new ReportParameter("lPartiDuration", m(1115)), /* Duration */
                    new ReportParameter("lPartiRemark", m(412)),    /* Remarks */
                    new ReportParameter("FooterInfoline", dt["fFooterInfoline"].ToString())
                });
                /* [pkosec 20131223] assign the parameters which are different from subclass to subclass (part of MEA-2013-00188) */
                AssignSpecificParameters(rpt, dt);

                /* shovel the other lists;
                 * a) the participation table */
                var partis     = new List <builtin.msdbrpt_datasources.ReportHardcopyTrainingParticipants>();
                var partitable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_TRAINING_AUDIENCE];
                foreach (DataRow dr in partitable.Rows)
                {
                    partis.Add(new builtin.msdbrpt_datasources.ReportHardcopyTrainingParticipants()
                    {
                        PersNr       = dr["PersNr"].ToString(),
                        PersName     = dr["PersName"].ToString(),
                        PersArea     = dr["PersArea"].ToString(),
                        PersRequired = dr["PersRequired"].ToString(),
                        PersAttended = dr["PersAttended"].ToString(),
                        PersDuration = dr["PersDuration"].ToString(),
                        PersRemark   = dr["PersRemark"].ToString()
                    });
                }
                /* b) the pictures */
                var trapics   = new List <builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn>();
                int ipic      = 0;
                var picstable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_SHARED_PICS];
                builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn running = null;
                foreach (DataRow dr in picstable.Rows)
                {
                    var binid = Convert.ToInt32(dr["BinID"]);
                    if (ipic % 2 == 0)
                    {
                        running = new builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn()
                        {
                            UrlLeft  = MediaURLAbsolute(binid, 320, 320, new FileType[] { FileType.ft_jpg, FileType.ft_png }),
                            UrlRight = FileURLAbsolute("images/spacer.png")
                        };
                        trapics.Add(running);
                    }
                    else
                    {
                        running.UrlRight = MediaURLAbsolute(binid, 320, 320, new FileType[] { FileType.ft_jpg, FileType.ft_png });
                    }
                    /* advance */
                    ++ipic;
                }
                /* equip the report with the rest of the data sources */
                var dsBasic     = "Basic";
                var dsPics      = "Pics";
                var dsParti     = "PartiTable";
                var dynDS_Basic = new ReportDataSource(dsBasic, new List <builtin.msdbrpt_datasources.ReportHardcopyIncidentBasic>()
                {
                    new builtin.msdbrpt_datasources.ReportHardcopyIncidentBasic()
                });                                                                                                                                                                                     /* this is but an empty record to satisfy the tablix, actual content comes with parameters */
                var dynDS_Pics  = new ReportDataSource(dsPics, trapics);
                var dynDS_Parti = new ReportDataSource(dsParti, partis);
                rpt.DataSources.Clear();
                rpt.DataSources.Add(dynDS_Basic);
                rpt.DataSources.Add(dynDS_Pics);
                rpt.DataSources.Add(dynDS_Parti);
                /* 3. render the report into the desired format */
                rpt.Refresh();
                RenderAsMsdbrpt(ResultFileBasename, ref chunk, ref mime, rpt);
                /* succeeded */
                return(true);
            }
            catch (Exception ex)
            {
                /* some error */
                OnBuiltinReportError(ex.Message, ex);
                return(false);
            }
        }
        protected override bool RenderInternal(ref MemoryStream chunk, out string mime)
        {
            mime = null;
            try
            {
                /* 1. instantiate the report */
                var rpt = new LocalReport()
                {
                    ReportEmbeddedResource = "sherm.rpt.msdbrpt.ReportHardcopyIncidentPlacard004.rdlc",
                    EnableExternalImages   = true
                };
                /* 2. populate the report */
                rpt.DataSources.Clear();
                var dt = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_SAFETYALERT].Rows[0];
                rpt.SetParameters(new ReportParameter[] {
                    /* static text */
                    new ReportParameter("lEventTimeFrom", String.Format("{0}:", m(547))),           /* Incident date and time */
                    new ReportParameter("lOrgCap", String.Format("{0}:", m(2279))),                 /* Department */
                    new ReportParameter("lWorkplace", String.Format("{0}:", m(739))),               /* Incident location */
                    new ReportParameter("lAffectedPersonOrg", dt["lAffectedPersonOrg"].ToString()), /* updated [pkosec 20150120] */
                    new ReportParameter("lCircumstances", m(550)),                                  /* Circumstances */
                    new ReportParameter("lNatureOfInjury", m(1005)),                                /* Injury */
                    new ReportParameter("lLostDays", m(2372)),                                      /* Estimated lost time (days) */
                    new ReportParameter("lImmediateCauses", m(551)),                                /* Immediate causes */
                    new ReportParameter("lImmediateMeasures", m(240)),                              /* Measures */
                    new ReportParameter("lTimestamp", m(2596)),                                     /* All time stamps are shown in CET (Central European Time) */
                    /* dynamic text */
                    new ReportParameter("LocationCap", dt["LocationLongCap"].ToString()),
                    new ReportParameter("IncClassMap", dt["fIncClassMap"].ToString()), /* [pkosec 20150116] C-1412-0419 */
                    new ReportParameter("NrComposite", dt["fNrComposite"].ToString()),
                    new ReportParameter("EventTimeFrom", dt["fEventTimeLocal"].ToString()),
                    new ReportParameter("OrgCap", dt["OrgCap"].ToString()),
                    new ReportParameter("Workplace", dt["Workplace"].ToString()),
                    new ReportParameter("AffectedPersonOrg", dt["fAffectedPersonOrg"].ToString()), /* updated [pkosec 20150120] */
                    new ReportParameter("Circumstances", dt["fCourseOfEvents"].ToString()),
                    new ReportParameter("NatureOfInjury", dt["NatureOfInjury"].ToString()),
                    new ReportParameter("LostDays", dt["LostTimeDays"].ToString()),
                    new ReportParameter("ImmediateCauses", dt["fCauses"].ToString()),
                    new ReportParameter("ImmediateMeasures", dt["fMeasures"].ToString()),
                    new ReportParameter("ColorHeader", dt["fColorHeader"].ToString()) /* [pkosec 20150108] C-1404-0510 */
                });

                /* [pkosec 20150121] handling pictures:
                 * a. populate a dataset when there are two
                 * b. use the image holder when there is only one */
                var incpics = new List <builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn>();
                if (dt["Image2"].Equals(DBNull.Value) == false)
                {   /* populate dataset (show both images) */
                    builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn pic = new builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn()
                    {
                        UrlLeft  = MediaURLAbsolute(Convert.ToInt32(dt["Image1"]), 450, 450, new FileType[] { FileType.ft_jpg, FileType.ft_png }),
                        UrlRight = MediaURLAbsolute(Convert.ToInt32(dt["Image2"]), 450, 450, new FileType[] { FileType.ft_jpg, FileType.ft_png })
                    };
                    incpics.Add(pic);
                    rpt.SetParameters(new ReportParameter("VisibilityImgOne", "HIDDEN"));   /* hide one image */
                    rpt.SetParameters(new ReportParameter("VisibilityPics", String.Empty)); /* show dataset */
                }
                else
                {   /* show only one image (in the middle) */
                    if (dt["Image1"].Equals(DBNull.Value) == false)
                    {
                        rpt.SetParameters(new ReportParameter("ImgUrlOne", MediaURLAbsolute(Convert.ToInt32(dt["Image1"]), 450, 450, new FileType[] { FileType.ft_jpg, FileType.ft_png })));
                        rpt.SetParameters(new ReportParameter("VisibilityPics", "HIDDEN"));       /* hide dataset */
                        rpt.SetParameters(new ReportParameter("VisibilityImgOne", String.Empty)); /* show image */
                    }
                    else
                    {                                                                         /* [pkosec 20150116] hide all placeholders if no image present */
                        rpt.SetParameters(new ReportParameter("VisibilityImgOne", "HIDDEN")); /* hide image */
                        rpt.SetParameters(new ReportParameter("VisibilityPics", "HIDDEN"));   /* hide dataset */
                    }
                }
                /* equip the report with the rest of the data sources */
                var dsPics     = "Pics";
                var dynDS_Pics = new ReportDataSource(dsPics, incpics);
                rpt.DataSources.Clear();
                rpt.DataSources.Add(dynDS_Pics);
                /* 3. render the report into the desired format */
                rpt.Refresh();
                RenderAsMsdbrpt(ResultFileBasename, ref chunk, ref mime, rpt);
                /* succeeded */
                return(true);
            }
            catch (Exception ex)
            {
                /* some error */
                OnBuiltinReportError(ex.Message, ex);
                return(false);
            }
        }
        protected override bool RenderInternal(ref MemoryStream chunk, out string mime)
        {
            mime = null;
            try
            {
                /* 1. instantiate the report */
                var rpt = new LocalReport()
                {
                    ReportEmbeddedResource = "sherm.rpt.msdbrpt.ReportHardcopyWpt001.rdlc",
                    EnableExternalImages   = true
                };
                /* 1a. persons involved */
                var invo  = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_WORKPERMIT_PER];
                var spers = new StringBuilder();
                foreach (DataRow dr in invo.Rows)
                {
                    var sheading = dr["Heading"].ToString();
                    var sname    = dr["Name"].ToString();
                    if (String.IsNullOrWhiteSpace(sheading))
                    {
                        spers.AppendFormat(", {0}", sname);
                    }
                    else
                    {
                        spers.AppendFormat("{0}<strong>{1}</strong> {2}", spers.Length > 0 ? "<br />" : String.Empty, sheading, sname);
                    }
                }
                /* 2. populate the report */
                rpt.DataSources.Clear();
                var Logo = MediaURLAbsolute(sherm.core.formatting.mime.BINGET_NAMEDRESOURCE_CORPORATELOGO, new FileType[] { FileType.ft_png });
                var dt   = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_WORKPERMIT].Rows[0];
                rpt.SetParameters(new ReportParameter[] {
                    /* labels */
                    new ReportParameter("lTabBasic", m(156)),        /* General information */
                    new ReportParameter("lPreprintNr", m(4069)),     /* Preprint # */
                    new ReportParameter("lNumber", m(27)),           /* Number */
                    new ReportParameter("lIssuedate", m(3911)),      /* Date of issue */
                    new ReportParameter("lValidTo", m(2248)),        /* Valid to */
                    new ReportParameter("lArea", m(48)),             /* Area, Department */
                    new ReportParameter("lWorkplace", m(49)),        /* Workplace */
                    new ReportParameter("lPersInvolved", m(407)),    /* Persons involved */
                    new ReportParameter("lResponsible", m(3912)),    /* Ordered by */
                    new ReportParameter("lResponsibleOrg", m(4068)), /* Ordering dept. */
                    new ReportParameter("lContractor", m(188)),      /* Contractor */
                    new ReportParameter("lExecutive", m(3913)),      /* Contractor's resp. */
                    new ReportParameter("lActivity", m(3915)),       /* Type of work */
                    new ReportParameter("lSecurity", m(3914)),       /* Work safety contact */
                    new ReportParameter("lDocuments", m(3607)),      /* Documents */
                    new ReportParameter("lTabMedia", m(56)),         /* Attached files */
                    new ReportParameter("lTabMails", m(4086)),       /* Notifications sent */
                    new ReportParameter("lMailRecipient", m(3672)),  /* Recipient */
                    new ReportParameter("lMailSubject", m(2223)),    /* Subject */
                    new ReportParameter("lMailSent", m(2713)),       /* Sent */
                    new ReportParameter("lRemarks", m(412)),         /* Remarks */
                    new ReportParameter("lPageNofM", m(2410)),       /* Page {0} of {1} */
                });
                rpt.SetParameters(new ReportParameter[] {
                    /* content */
                    new ReportParameter("LogoURL", Logo),
                    new ReportParameter("Title", dt["fTitle"].ToString()),
                    new ReportParameter("Status", dt["fStatus"].ToString()),
                    new ReportParameter("NrComposite", dt["NrComposite"].ToString()),
                    new ReportParameter("PreprintNr", dt["NrExternal"].ToString()),
                    new ReportParameter("Issuedate", dt["fIssueDate"].ToString()),
                    new ReportParameter("ValidTo", dt["fValidTo"].ToString()),
                    new ReportParameter("Area", dt["fArea"].ToString()),
                    new ReportParameter("Workplace", dt["Workcenter"].ToString()),
                    new ReportParameter("Responsible", dt["NameResponsible"].ToString()),
                    new ReportParameter("ResponsibleOrg", dt["OrgCapResponsible"].ToString()),
                    new ReportParameter("Executive", dt["NameExecutive"].ToString()),
                    new ReportParameter("Contractor", dt["PartnerCompanyname"].ToString()),
                    new ReportParameter("hPersInvolved", spers.ToString()),
                    new ReportParameter("Activity", dt["fActivity"].ToString()),
                    new ReportParameter("Security", dt["NameSecurity"].ToString()),
                    new ReportParameter("Remarks", dt["fRemark"].ToString()),
                    new ReportParameter("Documents", dt["fDocuments"].ToString()),
                    new ReportParameter("FooterInfoline", dt["fFooterInfoline"].ToString())
                });

                /* shovel the other lists;
                 * a) the pictures */
                var pics      = new List <builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn>();
                int ipic      = 0;
                var picstable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_WORKPERMIT_PICS];
                builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn running = null;
                foreach (DataRow dr in picstable.Rows)
                {
                    var binid = Convert.ToInt32(dr["BinID"]);
                    if (ipic % 2 == 0)
                    {
                        running = new builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn()
                        {
                            UrlLeft  = MediaURLAbsolute(binid, 320, 320, new FileType[] { FileType.ft_jpg, FileType.ft_png }),
                            UrlRight = FileURLAbsolute("images/spacer.png")
                        };
                        pics.Add(running);
                    }
                    else
                    {
                        running.UrlRight = MediaURLAbsolute(binid, 320, 320, new FileType[] { FileType.ft_jpg, FileType.ft_png });
                    }
                    /* document */
                    if (String.IsNullOrWhiteSpace(running.UrlLeft) == false)
                    {
                        Tracing.VerboseCore("Image URL for report (left): \"{0}\"", running.UrlLeft);
                    }
                    if (String.IsNullOrWhiteSpace(running.UrlRight) == false)
                    {
                        Tracing.VerboseCore("Image URL for report (right): \"{0}\"", running.UrlLeft);
                    }
                    /* advance */
                    ++ipic;
                }
                /* b) the notification mails table */
                var notis     = new List <builtin.msdbrpt_datasources.ReportHardcopyWorkpermitNoti>();
                var mailtable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_WORKPERMIT_MAILS];
                foreach (DataRow dr in mailtable.Rows)
                {
                    notis.Add(new builtin.msdbrpt_datasources.ReportHardcopyWorkpermitNoti()
                    {
                        EMailAddress = dr["fRecipient"].ToString(),
                        Subject      = dr["Subject"].ToString(),
                        fsent_when   = dr["fsent_when"].ToString()
                    });
                }
                /* equip the report with the rest of the data sources */
                var dsBasic     = "Basic";
                var dsPics      = "Pics";
                var dsMails     = "MailTable";
                var dynDS_Basic = new ReportDataSource(dsBasic, new List <builtin.msdbrpt_datasources.ReportHardcopyWorkpermitBasic>()
                {
                    new builtin.msdbrpt_datasources.ReportHardcopyWorkpermitBasic()
                });                                                                                                                                                                                         /* [sic], this is but an empty record to satisfy the tablix, actual content comes with parameters */
                var dynDS_Pics  = new ReportDataSource(dsPics, pics);
                var dynDS_Mails = new ReportDataSource(dsMails, notis);
                rpt.DataSources.Clear();
                rpt.DataSources.Add(dynDS_Basic);
                rpt.DataSources.Add(dynDS_Pics);
                rpt.DataSources.Add(dynDS_Mails);
                /* 3. render the report into the desired format */
                rpt.Refresh();
                RenderAsMsdbrpt(ResultFileBasename, ref chunk, ref mime, rpt);
                /* succeeded */
                return(true);
            }
            catch (Exception ex)
            {
                /* some error */
                OnBuiltinReportError(ex.Message, ex);
                return(false);
            }
        }
Ejemplo n.º 7
0
        /* added [dlatikay 20161110] */
        /* -!!- removed now icons too small */
        //protected override int GetDPI { get { return 300; } }

#if LINUX
#else
        protected override bool RenderInternal(ref MemoryStream chunk, out string mime)
        {
            mime = null;
            try
            {
                /* 1. instantiate the report */
                string rdlcname;
                if (CfgVariant2_COMMON)
                {
                    /* [dlatikay 20141212] MEA-2014-00461 */
                    rdlcname = "sherm.rpt.msdbrpt.ReportHardcopyWra001a.rdlc";
                }
                else if (CfgVariant2_WRALANDSCAPE)
                {
                    /* [dlatikay 20161010] MEA-2016-00166 */
                    rdlcname = "sherm.rpt.msdbrpt.ReportHardcopyWra002landscape.rdlc";
                }
                else
                {
                    rdlcname = "sherm.rpt.msdbrpt.ReportHardcopyWra001.rdlc";
                }
                var rpt = new LocalReport()
                {
                    ReportEmbeddedResource = rdlcname,
                    EnableExternalImages   = true
                };
                /* 1a. persons involved */
                var invo  = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_SHARED_PERS];
                var spers = new StringBuilder();
                foreach (DataRow dr in invo.Rows)
                {
                    var sheading = dr["Heading"].ToString();
                    var sname    = dr["Name"].ToString();
                    if (String.IsNullOrWhiteSpace(sheading))
                    {
                        spers.AppendFormat(", {0}", sname);
                    }
                    else
                    {
                        spers.AppendFormat("{0}<strong>{1}</strong> {2}", spers.Length > 0 ? "<br />" : String.Empty, sheading, sname);
                    }
                }
                /* 2. populate the report */
                rpt.DataSources.Clear();
                var Logo = MediaURLAbsolute(sherm.core.formatting.mime.BINGET_NAMEDRESOURCE_CORPORATELOGO, new FileType[] { FileType.ft_png });
                var dt   = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_WRA_BASIC].Rows[0];
                rpt.SetParameters(new ReportParameter[] {
                    new ReportParameter("lPrimaryActivity", m(4236)), /* Primary job */
                    new ReportParameter("LogoURL", Logo),
                    new ReportParameter("lNumber", m(27)),            /* Number */
                    new ReportParameter("lOriginator", m(45)),        /* Originator */
                    new ReportParameter("lArea", m(48)),              /* Area, Department */
                    new ReportParameter("lWorkplace", m(49)),         /* Workplace */
                    new ReportParameter("lPersInvolved", m(407)),     /* Persons involved */
                    new ReportParameter("Status", dt["fStatus"].ToString()),
                    new ReportParameter("NrComposite", dt["NrComposite"].ToString()),
                    new ReportParameter("OriginatorName", dt["OriginatorName"].ToString()),
                    new ReportParameter("Area", dt["OrgCap"].ToString()),
                    new ReportParameter("Workplace", dt["Workplace"].ToString()),
                    new ReportParameter("hPersInvolved", spers.ToString()),
                    new ReportParameter("Title", dt["fTitle"].ToString()),
                    new ReportParameter("PrimaryActivity", dt["fPrimaryActivity"].ToString()),
                    new ReportParameter("lcrea_when", m(2301)),                                       /* Created on */
                    new ReportParameter("crea_when", dt["fcrea_when"].ToString()),
                    new ReportParameter("llm_when", m(3255)),                                         /* Last modified */
                    new ReportParameter("lm_when", dt["flm_when_who"].ToString()),
                    new ReportParameter("lRiskTarget", m(404)),                                       /* Risk target */
                    new ReportParameter("RiskTarget", dt["fRiskTarget"].ToString()),
                    new ReportParameter("lPageNofM", m(2410)),                                        /* Page {0} of {1} */
                    new ReportParameter("lTabBasic", m(156)),                                         /* General information */
                    new ReportParameter("lTabMedia", m(56)),                                          /* Attached files */
                    new ReportParameter("lDocuments", m(3607)),                                       /* Documents */
                    new ReportParameter("Documents", dt["fDocuments"].ToString()),
                    new ReportParameter("lTabFinMea", m(5000)),                                       /* Hazards, control measures */
                    new ReportParameter("lFinMeaStatusNumber", m(249)),                               /* Status */
                    new ReportParameter("lFinMeaText", m(289)),                                       /* Text */
                    new ReportParameter("lFinMeaResponsible", m(290)),                                /* Responsible */
                    new ReportParameter("lFinMeaPicture", m(3166)),                                   /* Pictures */
                    new ReportParameter("FooterInfoline", dt["fFooterInfoline"].ToString()),
                    new ReportParameter("lChkLabel", m(3849)),                                        /* Item */
                    new ReportParameter("lChkAnswer", m(249)),                                        /* Status */
                    new ReportParameter("lChkText", m(3710)),                                         /* Antwort */
                    new ReportParameter("lChkMeasures", m(3712)),                                     /* Consequences */
                    new ReportParameter("lRemarks", m(412)),                                          /* Remarks */
                    new ReportParameter("Remarks", dt["fRemarks"].ToString()),
                    new ReportParameter("lDescription", m(291)),                                      /* Description */
                    new ReportParameter("Description", dt["fDescription"].ToString()),
                    new ReportParameter("lRulesRegulations", m(415)),                                 /* Rules and Regulations */
                    new ReportParameter("RulesRegulations", dt["mRulesRegulations"].ToString()),
                    new ReportParameter("lRiskCurrent", m(405)),                                      /* Current risk */
                    new ReportParameter("RiskCurrent", dt["fRiskCurrent"].ToString()),
                    new ReportParameter("lEvalDuration", m(53)),                                      /* Time taken */
                    new ReportParameter("EvalDuration", dt["fDuration"].ToString()),
                    new ReportParameter("lEmployeecount", m(611)),                                    /* Employee count */
                    new ReportParameter("Employeecount", dt["fEmployeecount"].ToString()),
                    new ReportParameter("lEvalInitialDate", m(4233)),                                 /* Initially evaluated */
                    new ReportParameter("EvalInitialDate", dt["fEvalInitialDate"].ToString()),
                    new ReportParameter("lEvalLastDate", m(4234)),                                    /* Last evaluated on */
                    new ReportParameter("EvalLastDate", dt["fEvalLastDate"].ToString()),
                    new ReportParameter("lCostcenters", m(1777)),                                     /* Costcenters */
                    new ReportParameter("Costcenters", dt["Costcenters"].ToString()),
                    new ReportParameter("lResponsible", m(290)),                                      /* Responsible */
                    new ReportParameter("Responsible", dt["fResponsible"].ToString()),
                    new ReportParameter("lTabSections", m(4160)),                                     /* Assessment */
                    new ReportParameter("lSectionModule", m(1599)),                                   /* Topic */
                    new ReportParameter("lSectionApplicable", m(142)),                                /* Applicable */
                    new ReportParameter("lSectionText", CfgVariant2_WRALANDSCAPE ? m(5127) : m(672)), /* Facts, description and approach / Information */
                    new ReportParameter("lSectionHazFin", m(4237)),                                   /* Hazards/findings */
                    new ReportParameter("lMaterialtype", m(1493)),                                    /* Type */
                    new ReportParameter("lMatSubstanceName", m(3879)),                                /* Substance name */
                    new ReportParameter("lMatDatasheet", m(3872)),                                    /* Safety data sheet */
                    new ReportParameter("lMatStorage", m(4110)),                                      /* Stock qty. */
                    new ReportParameter("lMatConsumption", m(4111)),                                  /* Consumption */
                    new ReportParameter("lMatExposition", m(3979)),                                   /* Ø exposure time */
                    new ReportParameter("lMatMeasurement", m(4339)),                                  /* Last measurement */
                    new ReportParameter("lMatRemarks", m(412)),                                       /* Remarks */
                    new ReportParameter("lTabMat", m(4313)),                                          /* Raw and auxiliary materials */
                    new ReportParameter("lTabEqui", m(4253)),                                         /* Equipments */
                    new ReportParameter("lEquiStatus", m(249)),                                       /* Status */
                    new ReportParameter("lEquiNr", m(27)),                                            /* Number */
                    new ReportParameter("lEquiConstructiontype", m(4250)),                            /* Construction type/model */
                    new ReportParameter("lEquiName", m(571)),                                         /* Description */
                    new ReportParameter("lEquiExam", m(4310)),                                        /* Check conditions */
                    new ReportParameter("lEquiAdditionalInfo", m(412)),                               /* Remarks */
                    new ReportParameter("lWasteSubstanceName", m(3879)),                              /* Substance name */
                    new ReportParameter("lWasteDisposalKey", m(3995)),                                /* Waste disposal # */
                    new ReportParameter("lWasteDisposerName", m(4244)),                               /* Recycler */
                    new ReportParameter("lWasteDatasheet", m(3872)),                                  /* Safety data sheet */
                    new ReportParameter("lWasteQuantityUnit", m(4261)),                               /* Quantity */
                    new ReportParameter("lFinMeaCatAndArea", m(4369)),                                /* Category/area */
                    new ReportParameter("lFinMeaRisk", m(189)),                                       /* Risk */
                    new ReportParameter("lFinMeaDates", m(4370)),                                     /* Due/done/verified */
                    new ReportParameter("lTabWaste", m(4135)),                                        /* Waste */
                    /* [pkosec 20140722] MEA-2014-00297.7: control visibility of materials, equipment and waste */
                    new ReportParameter("VisibilitySections", String.Empty),
                    new ReportParameter("VisibilityChecklists", String.Empty),
                    new ReportParameter("VisibilityMaterials", dt["VisibilityMaterials"].ToString()),
                    new ReportParameter("VisibilityEquipment", dt["VisibilityEquipment"].ToString()),
                    new ReportParameter("VisibilityWaste", dt["VisibilityWaste"].ToString()),
                    new ReportParameter("VisibilityHazMea", String.Empty)
                });
                if (CfgVariant2_WRALANDSCAPE)
                {
                    rpt.SetParameters(new ReportParameter[] {
                        new ReportParameter("lHazMeaWorkplace", m(49)),                                                          /* Workplace */
                        new ReportParameter("lHazMeaStatus", m(249)),                                                            /* Status */
                        new ReportParameter("lHazMeaCaption", String.Format("{0}<br>{1}",
                                                                            System.Web.HttpUtility.HtmlEncode(m(292)),           /* Short description */
                                                                            System.Web.HttpUtility.HtmlEncode(m(187))            /* Category */
                                                                            )),
                        new ReportParameter("lHazMeaCategory", m(187)),                                                          /* Category */
                        new ReportParameter("lHazMeaRisk", m(189)),                                                              /* Risk */
                        new ReportParameter("lHazMeaContactCondition", String.Format("{0}<br>{1}",
                                                                                     System.Web.HttpUtility.HtmlEncode(m(5144)), /* Conditions */
                                                                                     System.Web.HttpUtility.HtmlEncode(m(290))   /* Responsible */
                                                                                     ))
                    });
                }

                /* 3. shovel the other lists;
                 * 3a) the pictures */
                var pics      = new List <builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn>();
                int ipic      = 0;
                var picstable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_SHARED_PICS];
                builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn running = null;
                foreach (DataRow dr in picstable.Rows)
                {
                    var binid = Convert.ToInt32(dr["BinID"]);
                    if (ipic % 2 == 0)
                    {
                        running = new builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn()
                        {
                            UrlLeft  = MediaURLAbsolute(binid, 320, 320, new FileType[] { FileType.ft_jpg, FileType.ft_png }),
                            UrlRight = FileURLAbsolute("images/spacer.png")
                        };
                        pics.Add(running);
                    }
                    else
                    {
                        running.UrlRight = MediaURLAbsolute(binid, 320, 320, new FileType[] { FileType.ft_jpg, FileType.ft_png });
                    }
                    /* document */
                    if (String.IsNullOrWhiteSpace(running.UrlLeft) == false)
                    {
                        Tracing.VerboseCore("Image URL for report (left): \"{0}\"", running.UrlLeft);
                    }
                    if (String.IsNullOrWhiteSpace(running.UrlRight) == false)
                    {
                        Tracing.VerboseCore("Image URL for report (right): \"{0}\"", running.UrlLeft);
                    }
                    /* advance */
                    ++ipic;
                }
                /* 3b) the primary checklist sections table */
                var secs      = new List <builtin.msdbrpt_datasources.ReportHardcopyWRASection>();
                var secstable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_WRA_SECS];
                foreach (DataRow dr in secstable.Rows)
                {
                    secs.Add(new builtin.msdbrpt_datasources.ReportHardcopyWRASection()
                    {
                        Module           = dr["Module"].ToString(),
                        ApplicablePicURL = FileURLAbsolute("images/" + dr["fApplicablePic"].ToString() + ".png"),
                        TextHTML         = dr["fTextHTML"].ToString(),
                        HazFinHTML       = dr["fHazFinHTML"].ToString()
                    });
                }
                /* 3c) the hierarchical checklists */
                var chkh      = new List <builtin.msdbrpt_datasources.ReportHardcopyWRAChk>();
                var chkstable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_CHECKLISTS];
                foreach (DataRow dr in chkstable.Rows)
                {
                    chkh.Add(new builtin.msdbrpt_datasources.ReportHardcopyWRAChk()
                    {
                        ChecklistCaption = dr["ChecklistCaption"].ToString(),
                        ItemLabel        = dr["fLabel"].ToString(),
                        AnswerPicURL     = FileURLAbsolute("images/" + dr["fAnswerPic"].ToString() + ".png"),
                        TextHTML         = dr["fTextHTML"].ToString(),
                        Hazards          = dr["fHazards"].ToString()
                    });
                }
                /* 3d) the equipments */
                var equi      = new List <builtin.msdbrpt_datasources.ReportHardcopyWRAEqui>();
                var equitable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_WRA_EQUI];
                foreach (DataRow dr in equitable.Rows)
                {
                    var equinr = dr["EquiNr"].ToString();
                    if (equinr == ".")
                    {
                        equinr = String.Empty;                /* [dlatikay 20150829] MEA-2015-00410 */
                    }
                    equi.Add(new builtin.msdbrpt_datasources.ReportHardcopyWRAEqui()
                    {
                        EquiNr                = equinr,
                        Equipmentname         = dr["Equipmentname"].ToString(),
                        StatusPicURL          = dr["fStatusPic"] != DBNull.Value ? "‐" : "",
                        ConstructiontypeModel = dr["fModel"].ToString(),
                        Examinations          = dr["fExaminations"].ToString(),
                        AdditionalInfoHTML    = dr["fAdditionalInfoHTML"].ToString()
                    });
                }
                /* 3e) the materials */
                var mats      = new List <builtin.msdbrpt_datasources.ReportHardcopyWRAMaterial>();
                var matstable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_WRA_MATS];
                foreach (DataRow dr in matstable.Rows)
                {
                    mats.Add(new builtin.msdbrpt_datasources.ReportHardcopyWRAMaterial()
                    {
                        Materialtype       = dr["fMaterialtype"].ToString(),
                        HazardousPicURL    = dr["fHazardousPic"] != DBNull.Value ? FileURLAbsolute("images/" + dr["fHazardousPic"].ToString()) : "",
                        DatasheetPicURL    = dr["fDatasheetPic"] != DBNull.Value ? FileURLAbsolute("images/" + dr["fDatasheetPic"].ToString()) : "",
                        SubstanceName      = dr["SubstanceName"].ToString(),
                        StorageQtyUnit     = dr["fStorageQtyUnit"].ToString(),
                        ConsumptionQtyUnit = dr["fConsumptionQtyUnit"].ToString(),
                        AverageExposition  = dr["AverageExposition"].ToString(),
                        LastMeasurement    = dr["LastMeasurement"].ToString(),
                        Remarks            = dr["mRemarks"].ToString()
                    });
                }
                /* 3f) the waste */
                var wast      = new List <builtin.msdbrpt_datasources.ReportHardcopyWRAWaste>();
                var wasttable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_WRA_WASTE];
                foreach (DataRow dr in wasttable.Rows)
                {
                    wast.Add(new builtin.msdbrpt_datasources.ReportHardcopyWRAWaste()
                    {
                        SubstanceName   = dr["SubstanceName"].ToString(),
                        Safetydatasheet = dr["fSafetydatasheet"].ToString(),
                        QuantityUnit    = dr["fQuantityUnit"].ToString(),
                        DisposalKey     = dr["DisposalKey"].ToString(),
                        DisposerName    = dr["DisposerName"].ToString()
                    });
                }
                /* 3g) the haz/mea overview */
                var hazmea  = new List <builtin.msdbrpt_datasources.ReportHardcopyWRAFinHazMea>();
                var hazmea2 = new List <builtin.msdbrpt_datasources.ReportHardcopyWRAFinHazMea2>();
                if (CfgVariant2_WRALANDSCAPE)
                {
                    var itemstable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_WRA_HAZMEA];
                    foreach (DataRow dr in itemstable.Rows)
                    {
                        var ishaz = (ObjectType)Convert.ToInt32(dr["OT"]) == ObjectType.ot_Hazard;
                        var row   = new builtin.msdbrpt_datasources.ReportHardcopyWRAFinHazMea2()
                        {
                            Workplace = dr["Workplace"].ToString(),
                            Number    = dr["fNumber"].ToString(),
                            OTPic     = FileURLAbsolute("images/" + (ishaz ? "hazard.png" : "measure.png")),
                            StatusPic = FileURLAbsolute("images/" + (ishaz ? dr["fStatusPicFin"].ToString() : dr["fStatusPicMea"].ToString()) + ".png"),
                            Caption   = dr["Caption"].ToString(),
                            Category  = dr["fCategory"].ToString(),
                            TextHTML  = dr["fHTML"].ToString(),
                            RiskColor = dr["fRiskColor"].ToString(),
                            RiskScore = dr["fRiskScore"].ToString(),
                            PicUrl    = (dr["HasAttachment"].Equals(DBNull.Value) || Convert.ToBoolean(dr["HasAttachment"]) == false)
                                ? FileURLAbsolute("images/spacer.png")
                                : (Convert.ToBoolean(dr["AttachmentIsPicture"])
                                    ? MediaURLAbsolute(Convert.ToInt32(dr["AttachmentBinID"]), sherm.core.formatting.mime.HARDCOPY_FINMEAPIC_MAXWIDTH, sherm.core.formatting.mime.HARDCOPY_FINMEAPIC_MAXHEIGHT, new FileType[] { FileType.ft_png })
                                    : FileURLAbsolute("images/attch.gif") /* [pkosec,dlatikay 20131206] MEA-2013-00783 */
                                   ),
                            ContactConditionHTML = dr["fContactCondition"].ToString(),
                            Responsible          = dr["fResponsible"].ToString()
                        };

                        /* [dlatikay 20161017] follow-up: in landscape version, we merge two fields ...
                         * responsible bold: [dlatikay 20161110] MEA-2016-00166.III */
                        if (String.IsNullOrWhiteSpace(row.ContactConditionHTML))
                        {
                            row.ContactConditionHTML = String.Format("<b>{0}</b>", System.Web.HttpUtility.HtmlEncode(row.Responsible));
                        }
                        else if (String.IsNullOrWhiteSpace(row.Responsible) == false)
                        {
                            row.ContactConditionHTML = String.Format("{0}<br><b>{1}</b>", row.ContactConditionHTML, System.Web.HttpUtility.HtmlEncode(row.Responsible));
                        }
                        /* ... and another two */
                        if (String.IsNullOrWhiteSpace(row.Caption))
                        {
                            row.Caption = System.Web.HttpUtility.HtmlEncode(row.Category);
                        }
                        else if (String.IsNullOrWhiteSpace(row.Category) == false)
                        {
                            /* category bold: [dlatikay 20161110] MEA-2016-00166.III */
                            row.Caption = String.Format("{0}<br><b>{1}</b>", System.Web.HttpUtility.HtmlEncode(row.Caption), System.Web.HttpUtility.HtmlEncode(row.Category));
                        }
                        else
                        {
                            row.Caption = System.Web.HttpUtility.HtmlEncode(row.Caption);
                        }
                        /* advance */
                        hazmea2.Add(row);
                    }
                }
                else
                {
                    var itemstable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_WRA_HAZMEA];
                    foreach (DataRow dr in itemstable.Rows)
                    {
                        var ishaz = (ObjectType)Convert.ToInt32(dr["OT"]) == ObjectType.ot_Hazard; /* [pkosec 20150126] MEA-2015-00020 */
                        hazmea.Add(new builtin.msdbrpt_datasources.ReportHardcopyWRAFinHazMea()
                        {
                            CatAndAreaHTML = String.Format("{2}{0}{1}{3}",
                                                           dr["fCategory"].ToString().Length > 0 ? dr["fCategory"].ToString() + "/" : String.Empty, /* [pkosec 20141022] appending the slash sign when category exists */
                                                           dr["fAreaHTML"].ToString(),                                                              /* MEA-2014-00297.8 */
                                                           ishaz && CfgVariant2_COMMON ? "<strong>" : String.Empty,                                 /* [pkosec 20150126] MEA-2015-00020: begin bold on haz (VDM flavor) */
                                                           ishaz && CfgVariant2_COMMON ? "</strong>" : String.Empty),                               /* [pkosec 20150126] MEA-2015-00020: end bold on haz (VDM flavor) */
                            TextHTML = dr["fHTML"].ToString(),                                                                                      /* MEA-2014-00297.8 */
                            Number   = dr["fNumber"].ToString(),
                            PicUrl   = (dr["HasAttachment"].Equals(DBNull.Value) || Convert.ToBoolean(dr["HasAttachment"]) == false)
                                ? FileURLAbsolute("images/spacer.png")
                                : (Convert.ToBoolean(dr["AttachmentIsPicture"])
                                    ? MediaURLAbsolute(Convert.ToInt32(dr["AttachmentBinID"]), sherm.core.formatting.mime.HARDCOPY_FINMEAPIC_MAXWIDTH, sherm.core.formatting.mime.HARDCOPY_FINMEAPIC_MAXHEIGHT, new FileType[] { FileType.ft_png })
                                    : FileURLAbsolute("images/attch.gif") /* [pkosec,dlatikay 20131206] MEA-2013-00783 */
                                   ),
                            Responsible = dr["fResponsibleHTML"].ToString(),
                            DatesHTML   = dr["fDatesHTML"].ToString(),
                            //RiskCurrent = dr["fRiskCurrent"].ToString(),
                            //RiskOriginal = dr["fRiskOriginal"].ToString(),
                            StatusPicFin = FileURLAbsolute("images/" + dr["fStatusPicFin"].ToString() + ".png"),
                            StatusPicMea = FileURLAbsolute("images/" + dr["fStatusPicMea"].ToString() + ".png")
                        });
                    }
                }
                /* hide sections that are empty, if in compact mode */
                if (this.PresentationOptions.HasFlag(ReportPresentationOptions.Suppresszero))
                {
                    if (secs.Count == 0)
                    {
                        rpt.SetParameters(new ReportParameter("VisibilitySections", "HIDDEN"));
                    }
                    if (chkh.Count == 0)
                    {
                        rpt.SetParameters(new ReportParameter("VisibilityChecklists", "HIDDEN"));
                    }
                    if (mats.Count == 0)
                    {
                        rpt.SetParameters(new ReportParameter("VisibilityMaterials", "HIDDEN"));
                    }
                    if (equi.Count == 0)
                    {
                        rpt.SetParameters(new ReportParameter("VisibilityEquipment", "HIDDEN"));
                    }
                    if (wast.Count == 0)
                    {
                        rpt.SetParameters(new ReportParameter("VisibilityWaste", "HIDDEN"));
                    }
                    if (hazmea.Count == 0 && hazmea2.Count == 0)
                    {
                        rpt.SetParameters(new ReportParameter("VisibilityHazMea", "HIDDEN"));
                    }
                }
                /* 4. equip the report with the rest of the data sources */
                var dsBasic     = "Basic";
                var dsPics      = "Pics";
                var dsSecs      = "SectionTable";
                var dsChkH      = "ChkHierarchy";
                var dsMats      = "MaterialsTable";
                var dsEqui      = "EquiTable";
                var dsWast      = "WasteTable";
                var dsFHM       = CfgVariant2_WRALANDSCAPE ? "FinHazMea2Table" : "FinHazMeaTable";
                var dynDS_Basic = new ReportDataSource(dsBasic, new List <builtin.msdbrpt_datasources.ReportHardcopyIncidentBasic>()
                {
                    new builtin.msdbrpt_datasources.ReportHardcopyIncidentBasic()
                });                                                                                                                                                                                     /* [sic], this is but an empty record to satisfy the tablix, actual content comes with parameters */
                var dynDS_Pics   = new ReportDataSource(dsPics, pics);
                var dynDS_Secs   = new ReportDataSource(dsSecs, secs);
                var dynDS_ChkH   = new ReportDataSource(dsChkH, chkh);
                var dynDS_Mats   = new ReportDataSource(dsMats, mats);
                var dynDS_Equi   = new ReportDataSource(dsEqui, equi);
                var dynDS_Wast   = new ReportDataSource(dsWast, wast);
                var dynDS_HazMea = new ReportDataSource(dsFHM, CfgVariant2_WRALANDSCAPE ? (object)hazmea2 : (object)hazmea);
                rpt.DataSources.Clear();
                rpt.DataSources.Add(dynDS_Basic);
                rpt.DataSources.Add(dynDS_Pics);
                rpt.DataSources.Add(dynDS_Secs);
                rpt.DataSources.Add(dynDS_ChkH);
                rpt.DataSources.Add(dynDS_Mats);
                rpt.DataSources.Add(dynDS_Equi);
                rpt.DataSources.Add(dynDS_Wast);
                rpt.DataSources.Add(dynDS_HazMea);
                /* 3. render the report into the desired format */
                rpt.Refresh();
                RenderAsMsdbrpt(ResultFileBasename, ref chunk, ref mime, rpt);
                /* succeeded */
                return(true);
            }
            catch (Exception ex)
            {
                /* some error */
                OnBuiltinReportError(ex.Message, ex);
                return(false);
            }
        }
Ejemplo n.º 8
0
        protected override bool RenderInternal(ref MemoryStream chunk, out string mime)
        {
            mime = null;
            try
            {
                /* 1. instantiate the report */
                var rpt = new LocalReport()
                {
                    ReportEmbeddedResource = ReportDesignerResourcename,
                    EnableExternalImages   = true
                };
                /* 1a. persons involved */
                var invo  = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_SHARED_PERS];
                var spers = new StringBuilder();
                foreach (DataRow dr in invo.Rows)
                {
                    var sheading = dr["Heading"].ToString();
                    var sname    = dr["Name"].ToString();
                    if (String.IsNullOrWhiteSpace(sheading))
                    {
                        spers.AppendFormat(", {0}", sname);
                    }
                    else
                    {
                        spers.AppendFormat("{0}<strong>{1}</strong> {2}", spers.Length > 0 ? "<br />" : String.Empty, sheading, sname);
                    }
                }
                /* 2. populate the report */
                rpt.DataSources.Clear();
                var Logo = MediaURLAbsolute(sherm.core.formatting.mime.BINGET_NAMEDRESOURCE_CORPORATELOGO, new FileType[] { FileType.ft_png });
                var dt   = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_INCIDENTVERBOSE].Rows[0];
                /* 2a. set the parameters which are common to all subclasses of incidents */
                AssignCommonParameters(rpt, dt, Logo, spers);
                /* 2b. assign the parameters which are different from subclass to subclass */
                AssignSpecificParameters(rpt, dt);

                /* shovel the other lists;
                 * a) the action forces table */
                var acfs      = new List <builtin.msdbrpt_datasources.ReportHardcopyIncidentActionforce>();
                var acfstable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_INCIDENT_AFS];
                rpt.SetParameters(new ReportParameter("bACFHidden", acfstable.Rows.Count > 0 ? String.Empty : "hide"));
                foreach (DataRow dr in acfstable.Rows)
                {
                    acfs.Add(new builtin.msdbrpt_datasources.ReportHardcopyIncidentActionforce()
                    {
                        EventtimeFrom = dr["fEventtimeFrom"].ToString(),
                        CatCap        = dr["CatCaption"].ToString(),
                        Department    = dr["Department"].ToString(),
                        EventtimeTo   = dr["fEventtimeTo"].ToString(),
                        Remarks       = dr["fRemark"].ToString()
                    });
                }
                /* b) the rca table */
                var rcas      = new List <builtin.msdbrpt_datasources.ReportHardcopyIncidentRca>();
                var rcastable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_INCIDENT_RCA];
                /* [pkosec 20141211] MEA-2014-00492.2: let's show only one rca tablix */
                try
                {
                    rpt.SetParameters(new ReportParameter("bRCAHidden", CfgVariant2_COMMON ? String.Empty : "hide"));         /* VDM flavor without the verified column */
                    rpt.SetParameters(new ReportParameter("bRCAVerifiedHidden", CfgVariant2_COMMON ? "hide" : String.Empty)); /* the others have the verified column */
                }
                catch
                {
                    /* [dlatikay 20150129] quick and dirty fix for failure in EIN and FIR/EFR, which are
                     * derived from this but do not have these params */
                }
                foreach (DataRow dr in rcastable.Rows)
                {
                    rcas.Add(new builtin.msdbrpt_datasources.ReportHardcopyIncidentRca()
                    {
                        Number   = dr["fNumber"].ToString(),
                        Section  = dr["fSection"].ToString(),
                        Cause    = dr["fCauseHTML"].ToString(),
                        Verified = dr["fVerified"].ToString(),
                        Measures = dr["fMeasurecount"].ToString()
                    });
                }
                /* c) the item overview */
                var ovvw       = new List <builtin.msdbrpt_datasources.ReportHardcopyIncidentFinMea>();
                var itemstable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_MEASURES_OVW];
                foreach (DataRow dr in itemstable.Rows)
                {
                    ovvw.Add(new builtin.msdbrpt_datasources.ReportHardcopyIncidentFinMea()
                    {
                        Area     = dr["fAreaHTML"].ToString(),
                        Category = dr["fCategory"].ToString(),
                        HTML     = dr["fHTML"].ToString(),
                        Number   = dr["fNumber"].ToString(),
                        PicUrl   = (dr["HasAttachment"].Equals(DBNull.Value) || Convert.ToBoolean(dr["HasAttachment"]) == false)
                             ? FileURLAbsolute("images/spacer.png")
                             : (Convert.ToBoolean(dr["AttachmentIsPicture"])
                                 ? MediaURLAbsolute(Convert.ToInt32(dr["AttachmentBinID"]), sherm.core.formatting.mime.HARDCOPY_FINMEAPIC_MAXWIDTH, sherm.core.formatting.mime.HARDCOPY_FINMEAPIC_MAXHEIGHT, new FileType[] { FileType.ft_png }) /* need not coerce to png, gallery thumbnails are always png anyway; [dlatikay 20131205] do need to - we're now no longer using the thumbnail for higher resolution requirement */
                                 : FileURLAbsolute("images/attch.gif")                                                                                                                                                                           /* [pkosec,dlatikay 20131206] MEA-2013-00783 */
                                ),
                        Responsible  = dr["fResponsibleHTML"].ToString(),
                        StatusPicFin = FileURLAbsolute("images/" + dr["fStatusPicFin"].ToString() + ".png"),
                        StatusPicMea = FileURLAbsolute("images/" + dr["fStatusPicMea"].ToString() + ".png")
                    });
                }
                /* d) the pictures */
                var incpics   = new List <builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn>();
                int ipic      = 0;
                var picstable = Data.Tables[ReportDatatableIdentifiers.REPORT_DATATABLE_HARDCOPY_SHARED_PICS];
                builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn running = null;
                foreach (DataRow dr in picstable.Rows)
                {
                    var binid = Convert.ToInt32(dr["BinID"]);
                    if (ipic % 2 == 0)
                    {
                        running = new builtin.msdbrpt_datasources.ReportHardcopyIncidentPicsTwoColumn()
                        {
                            UrlLeft  = MediaURLAbsolute(binid, 320, 320, new FileType[] { FileType.ft_jpg, FileType.ft_png }),
                            UrlRight = FileURLAbsolute("images/spacer.png")
                        };
                        incpics.Add(running);
                    }
                    else
                    {
                        running.UrlRight = MediaURLAbsolute(binid, 320, 320, new FileType[] { FileType.ft_jpg, FileType.ft_png });
                    }
                    /* advance */
                    ++ipic;
                }
                /* equip the report with the rest of the data sources */
                var dsBasic     = "Basic";
                var dsPics      = "Pics";
                var dsAcf       = "AcfTable";
                var dsRca       = "RcaTable";
                var dsFinMea    = "FinMeaTable";
                var dynDS_Basic = new ReportDataSource(dsBasic, new List <builtin.msdbrpt_datasources.ReportHardcopyIncidentBasic>()
                {
                    new builtin.msdbrpt_datasources.ReportHardcopyIncidentBasic()
                });                                                                                                                                                                                     /* this is but an empty record to satisfy the tablix, actual content comes with parameters */
                var dynDS_Pics   = new ReportDataSource(dsPics, incpics);
                var dynDS_Acf    = new ReportDataSource(dsAcf, acfs);
                var dynDS_Rca    = new ReportDataSource(dsRca, rcas);
                var dynDS_FinMea = new ReportDataSource(dsFinMea, ovvw);
                rpt.DataSources.Clear();
                rpt.DataSources.Add(dynDS_Basic);
                rpt.DataSources.Add(dynDS_Pics);
                rpt.DataSources.Add(dynDS_Acf);
                rpt.DataSources.Add(dynDS_Rca);
                rpt.DataSources.Add(dynDS_FinMea);
                /* 3. render the report into the desired format */
                rpt.Refresh();
                RenderAsMsdbrpt(ResultFileBasename, ref chunk, ref mime, rpt);
                /* succeeded */
                return(true);
            }
            catch (Exception ex)
            {
                /* some error */
                OnBuiltinReportError(ex.Message, ex);
                return(false);
            }
        }