Exemplo n.º 1
0
        // we modify the report data source so it uses the CSReportWebServer instead of a real sql engine (SqlServer, PostgreSQL or Oracle)
        //
        public void init(JObject request)
        {
            m_webReportId = request["message"]["webReportId"].ToString();
            m_reportId    = Guid.NewGuid().ToString();
            m_database    = Guid.NewGuid().ToString();
            m_report      = new cReport();

            m_report.setDatabaseEngine(csDatabaseEngine.CSREPORT_WEB);

            m_report.Progress   += reportProgress;
            m_report.ReportDone += reportDone;

            cReportLaunchInfo oLaunchInfo = new cReportLaunchInfo();

            oLaunchInfo.setPrinter(cPrintAPI.getcPrinterFromDefaultPrinter(null));

            registerDataSource(request);

            if (!m_report.init(oLaunchInfo))
            {
                return;
            }

            m_report.setPathDefault(Application.StartupPath);
        }
Exemplo n.º 2
0
        public static void addCtrls(
            cReport report, TreeView tv_controls,
            int C_IMG_FOLDER, int C_IMG_FORMULA,
            int C_IMG_CONTROL, int C_IMG_DATBASE_FIELD)
        {
            tv_controls.Nodes.Clear();

            TreeNode nodeGroup;
            TreeNode nodeRoot = tv_controls.Nodes.Add(report.getName());

            nodeRoot.ImageIndex = C_IMG_FOLDER;

            nodeGroup            = nodeRoot.Nodes.Add("Headers");
            nodeGroup.ImageIndex = C_IMG_FOLDER;
            pAddCtrlsAux(report.getHeaders(), nodeGroup, C_IMG_FOLDER, C_IMG_FORMULA, C_IMG_CONTROL, C_IMG_DATBASE_FIELD);

            nodeGroup            = nodeRoot.Nodes.Add("Group Header");
            nodeGroup.ImageIndex = C_IMG_FOLDER;
            pAddCtrlsAux(report.getGroupsHeaders(), nodeGroup, C_IMG_FOLDER, C_IMG_FORMULA, C_IMG_CONTROL, C_IMG_DATBASE_FIELD);

            nodeGroup            = nodeRoot.Nodes.Add("Details");
            nodeGroup.ImageIndex = C_IMG_FOLDER;
            pAddCtrlsAux(report.getDetails(), nodeGroup, C_IMG_FOLDER, C_IMG_FORMULA, C_IMG_CONTROL, C_IMG_DATBASE_FIELD);

            nodeGroup            = nodeRoot.Nodes.Add("Group Footer");
            nodeGroup.ImageIndex = C_IMG_FOLDER;
            pAddCtrlsAux(report.getGroupsFooters(), nodeGroup, C_IMG_FOLDER, C_IMG_FORMULA, C_IMG_CONTROL, C_IMG_DATBASE_FIELD);

            nodeGroup            = nodeRoot.Nodes.Add("Footers");
            nodeGroup.ImageIndex = C_IMG_FOLDER;
            pAddCtrlsAux(report.getFooters(), nodeGroup, C_IMG_FOLDER, C_IMG_FORMULA, C_IMG_CONTROL, C_IMG_DATBASE_FIELD);

            nodeRoot.ExpandAll();
        }
Exemplo n.º 3
0
        internal static void createStandarSections(cReport report, Rectangle tr)
        {
            report.getHeaders().add(null, C_KEY_HEADER);
            report.getFooters().add(null, C_KEY_FOOTER);
            report.getDetails().add(null, C_KEY_DETAIL);

            //
            // main header
            //
            cReportSection sec = report.getHeaders().item(C_KEY_HEADER);

            sec.setName("Main header");

            cReportAspect aspect = sec.getAspect();

            aspect.setTop(0);
            aspect.setHeight(tr.height * 0.25f);
            aspect.setWidth(tr.width);
            cReportSectionLine secLn = sec.getSectionLines().item(0);

            secLn.setSectionName("Main header");
            aspect = secLn.getAspect();
            aspect.setTop(0);
            aspect.setHeight(tr.height * 0.25f);
            aspect.setWidth(tr.width);

            //
            // detail
            //
            sec = report.getDetails().item(C_KEY_DETAIL);
            sec.setName("Detail");

            aspect = sec.getAspect();
            aspect.setTop(tr.height * 0.25f);
            aspect.setHeight(tr.height * 0.25f);
            aspect.setWidth(tr.width);
            secLn = sec.getSectionLines().item(0);
            secLn.setSectionName("Detail");
            aspect = secLn.getAspect();
            aspect.setTop(tr.height * 0.25f);
            aspect.setHeight(tr.height * 0.25f);
            aspect.setWidth(tr.width);

            //
            // main footer
            //
            sec = report.getFooters().item(C_KEY_FOOTER);
            sec.setName("Main footer");

            aspect = sec.getAspect();
            aspect.setTop(tr.height * 0.75f);
            aspect.setHeight(tr.height * 0.25f);
            aspect.setWidth(tr.width);
            secLn = sec.getSectionLines().item(0);
            secLn.setSectionName("Main footer");
            aspect = secLn.getAspect();
            aspect.setTop(tr.height * 0.75f);
            aspect.setHeight(tr.height * 0.25f);
            aspect.setWidth(tr.width);
        }
Exemplo n.º 4
0
 private void cmd_search_Click(object sender, EventArgs e)
 {
     if (tx_toSearch.Text.Trim() == "")
     {
         cWindow.msgInfo("You must input some text to search");
     }
     else
     {
         cReport report = m_editor.getReport();
         searchInSections(report.getHeaders(), csObjType.iTypeSec);
         searchInSections(report.getGroupsHeaders(), csObjType.iTypeSecG);
         searchInSections(report.getDetails(), csObjType.iTypeSec);
         searchInSections(report.getGroupsFooters(), csObjType.iTypeSecG);
         searchInSections(report.getFooters(), csObjType.iTypeSec);
     }
 }
Exemplo n.º 5
0
        public static bool showDbFields(ref string field, ref int fieldType, ref int index, cEditor editor)
        {
            fColumns fc = null;

            try {
                fc = new fColumns();

                fc.clearColumns();

                cReport report = editor.getReport();

                cReportConnect connect = report.getConnect();
                fc.fillColumns(connect.getDataSource(), connect.getColumns(), false);

                for (int _i = 0; _i < report.getConnectsAux().count(); _i++)
                {
                    connect = report.getConnectsAux().item(_i);
                    fc.fillColumns(connect.getDataSource(), connect.getColumns(), true);
                }

                fc.setField(field);
                fc.ShowDialog();

                if (fc.getOk())
                {
                    field     = fc.getField();
                    fieldType = fc.getFieldType();
                    index     = fc.getIndex();

                    return(true);
                }
                else
                {
                    return(false);
                }
            } catch (Exception ex) {
                cError.mngError(ex, "showDbFields", C_MODULE, "");
                return(false);
            }
            finally {
                if (fc != null)
                {
                    fc.Close();
                }
            }
        }
Exemplo n.º 6
0
        public string Retive_Rep_Data(Report_param <T> condition, string strReportPath, DataSet ds)
        {
            var result    = string.Empty;
            var oReport   = new cReport();
            var rptSource = new ReportDocument();

            try
            {
                string strReportDirectoryTempPhysicalPath = HttpContext.Current.Server.MapPath(this.ReportDirectoryTemp);
                Helper.DeleteUnusedFile(strReportDirectoryTempPhysicalPath, ReportAliveTime);
                string strFilename;
                string displayCompany = strCompanyName;
                if (condition.IsLockMajor == "Y")
                {
                    displayCompany = condition.Person_major_name + " - " + strCompanyName;
                }
                strFilename = "report_" + DateTime.Now.ToString("yyyyMMddHHmmssfff");
                string strPath = strReportPath;
                rptSource.Load(HttpContext.Current.Server.MapPath(strPath));
                rptSource.SetDataSource(ds.Tables[0]);
                rptSource.SetParameterValue("UserName", condition.Report_user_print);
                rptSource.SetParameterValue("CompanyName", displayCompany);
                rptSource.SetParameterValue("CriteriaDesc", condition.Report_criteria_desc);
                if (condition.Report_is_pdf)
                {
                    rptSource.ExportToDisk(ExportFormatType.PortableDocFormat, HttpContext.Current.Server.MapPath("~/temp/") + strFilename + ".pdf");
                }
                if (condition.Report_is_excel)
                {
                    rptSource.ExportToDisk(ExportFormatType.Excel, HttpContext.Current.Server.MapPath("~/temp/") + strFilename + ".xls");
                }
                result = strFilename;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                oReport.Dispose();
                rptSource.Dispose();
            }
            return(result);
        }
Exemplo n.º 7
0
        public string Retive_Rep_012(Report_param <T> condition)
        {
            var result  = string.Empty;
            var oReport = new cReport();

            try
            {
                var    ds      = oReport.SP_REP_012(condition.Report_criteria);
                string strPath = "~/reports/Rep_012.rpt";
                result = Retive_Rep_Data(condition, strPath, ds);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                oReport.Dispose();
            }
            return(result);
        }
Exemplo n.º 8
0
 public void addCtrls(cReport m_report)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 9
0
        public static void addCtrls(cReport report, ListView lv_controls, int C_CTRL_IMAGE, int C_DB_IMAGE)
        {
            lv_controls.Items.Clear();

            for (int i = 0; i < report.getControls().count(); i++)
            {
                var ctrl      = report.getControls().item(i);
                var ctrlName  = ctrl.getName();
                var ctrlInfo  = "";
                var ctrlField = "";

                switch (ctrl.getControlType())
                {
                case csRptControlType.CSRPTCTFIELD:
                    ctrlField = ctrl.getField().getName();
                    break;

                case csRptControlType.CSRPTCTDBIMAGE:
                    ctrlInfo = ctrl.getField().getName();
                    break;

                case csRptControlType.CSRPTCTIMAGE:
                    ctrlInfo = " (Image)";
                    break;

                case csRptControlType.CSRPTCTLABEL:
                    ctrlInfo = ctrl.getLabel().getText();
                    break;
                }

                if (ctrlInfo.Length > 0)
                {
                    ctrlName += " (" + ctrlInfo + ")";
                }

                var item = lv_controls.Items.Add(ctrlName, C_CTRL_IMAGE);
                item.Tag = ctrl.getKey();
                item.SubItems.Add("");
                item.SubItems.Add("");
                item.SubItems.Add("");

                if (ctrl.getHasFormulaValue())
                {
                    item.SubItems[1].Text = "*";
                }
                if (ctrl.getHasFormulaHide())
                {
                    item.SubItems[2].Text = "*";
                }

                if (ctrlField.Length > 0)
                {
                    item.SubItems[3].Text      = ctrlField;
                    item.SubItems[3].ForeColor = Color.Blue;
                    item.ImageIndex            = C_DB_IMAGE;
                }
                if (ctrl.getName().Length > 4 && ctrl.getName().Substring(0, 4) == "lnk_")
                {
                    item.ForeColor = Color.Red;
                }
            }
        }
Exemplo n.º 10
0
 internal static void createStandarSections(cReport report, Rectangle tr)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 11
0
 public void addCtrls(cReport report)
 {
     cGlobals.addCtrls(report, lv_controls, C_CTRL_IMAGE, C_DB_IMAGE);
 }