Пример #1
0
        public cReportPage add(cReportPage c, String key)
        {
            try
            {
                if (c == null)
                {
                    c = new cReportPage();
                }

                if (key == "")
                {
                    key = cReportGlobals.getKey(cReportGlobals.getNextKey().ToString());
                }

                Add(key, c);

                return(c);
            }
            catch
            {
                return(null);
            }
        }
Пример #2
0
        private void addFieldToNewPage(cReportSections sections, cReportPage page, int where)
        { // TODO: Use of ByRef founded Private Sub AddFieldToNewPage(ByRef Sections As cReportSections, ByRef Page As cReportPage, ByVal Where As Long)
            cReportPageField field = null;
            cReportSection sec = null;
            cReportSectionLine secline = null;
            cReportControl ctrl = null;
            bool isVisible = false;
            int indexCtrl = 0;
            float offset = 0;
            int recordCount = 0;

            if (m_rows != null)
            {
                recordCount = m_vRowsIndex.Length;
            }

            // this indexes means
            //
            // in which datasource is this control
            //
            int indexRows = 0;
            // in which row of the datasource is the control
            //
            int indexRow = 0;
            int indexField = 0;

            for (int _i = 0; _i < sections.count(); _i++)
            {
                sec = sections.item(_i);
                m_lineIndex = m_lineIndex + 1;

                if (sec.getHasFormulaHide())
                {
                    isVisible = cUtil.val(m_compiler.resultFunction(sec.getFormulaHide())) != 0;
                }
                else
                {
                    isVisible = true;
                }
                if (isVisible)
                {
                    for (int _j = 0; _j < sec.getSectionLines().count(); _j++)
                    {
                        secline = sec.getSectionLines().item(_j);
                        if (secline.getHasFormulaHide())
                        {
                            isVisible = cUtil.val(m_compiler.resultFunction(secline.getFormulaHide())) != 0;
                        }
                        else
                        {
                            isVisible = true;
                        }
                        if (isVisible)
                        {
                            // For Each Ctrl In Secline.Controls
                            //
                            for (indexCtrl = 0; indexCtrl < secline.getControls().getCollByLeft().Length; indexCtrl++)
                            {
                                ctrl = secline.getControls().item(secline.getControls().getCollByLeft()[indexCtrl]);

                                if (where == C_HEADERS)
                                {
                                    field = page.getHeader().add(null, "");
                                }
                                else if (where == C_FOOTERS)
                                {
                                    field = page.getFooter().add(null, "");
                                }

                                field.setIndexLine(m_lineIndex);

                                if (ctrl.getHasFormulaValue())
                                {
                                    field.setValue(
                                        cReportGlobals.format(
                                            m_compiler.resultFunction(ctrl.getFormulaValue()), 
                                            ctrl.getLabel().getAspect().getFormat()));
                                }
                                else
                                {
                                    switch (ctrl.getControlType())
                                    {
                                        case csRptControlType.CSRPTCTFIELD:

                                            pGetIndexRows(out indexRows, out indexRow, out indexField, ctrl);

                                            if (m_collRows[indexRows] != null)
                                            {
                                                // it looks ugly, dont think you?
                                                //
                                                // maybe this help a litle:
                                                //
                                                //    m_vCollRows(IndexRows)    a matrix with the data 
                                                //                              contained in the datasource
                                                //                              referd by this control
                                                //
                                                //    (IndexField, IndexRow)    a cell in this matrix
                                                //
                                                object value = m_collRows[indexRows].Rows[indexRow][indexField];
                                                field.setValue(
                                                    cReportGlobals.format(
                                                        cReportGlobals.valVariant(value),
                                                        ctrl.getLabel().getAspect().getFormat()));
                                            }
                                            break;

                                        case csRptControlType.CSRPTCTLABEL:
                                            field.setValue(
                                                cReportGlobals.format(
                                                    ctrl.getLabel().getText(), 
                                                    ctrl.getLabel().getAspect().getFormat()));
                                            break;

                                        case csRptControlType.CSRPTCTIMAGE:
                                            field.setValue(
                                                cReportGlobals.format(
                                                    ctrl.getLabel().getText(), 
                                                    ctrl.getLabel().getAspect().getFormat()));
                                            field.setImage(ctrl.getImage().getImage());
                                            break;

                                        case csRptControlType.CSRPTCTDBIMAGE:

                                            pGetIndexRows(out indexRows, out indexRow, out indexField, ctrl);

                                            if (m_collRows[indexRows] != null)
                                            {
                                                field.setImage(pGetImage(indexRows, indexField, indexRow));
                                            }
                                            break;

                                        case csRptControlType.CSRPTCTCHART:

                                            pGetIndexRows(out indexRows, out indexRow, out indexField, ctrl);
                                            field.setImage(pGetChartImage(indexRows, indexField, indexRow, ctrl));
                                            break;
                                    }
                                }

                                field.setInfo(m_pageSetting.item(ctrl.getKey()));
                                field.setTop(field.getInfo().getAspect().getTop() + offset);

                                if (ctrl.getHasFormulaHide())
                                {
                                    field.setVisible(
                                        cUtil.val(m_compiler.resultFunction(ctrl.getFormulaHide())) != 0);
                                }
                                else
                                {
                                    field.setVisible(true);
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (where == C_HEADERS)
                    {
                        offset = offset - sec.getAspect().getHeight();
                    }
                    else if (where == C_FOOTERS)
                    {
                        offset = offset + sec.getAspect().getHeight();
                    }
                }
            }
        }
Пример #3
0
        private bool saveDataForWeb(cReportPage page, String dataName, String dataPath)
        { // TODO: Use of ByRef founded Private Function SaveDataForWeb(ByRef Page As cReportPage, ByVal DataName As String, ByVal DataPath As String) As Boolean
            CSXml.cXml docXml = null;
            docXml = new CSXml.cXml();

            docXml.init(null);
            docXml.setFilter("xml");
            docXml.setName(getFileName(dataName) + "-1.xml");
            docXml.setPath(dataPath);

            if (!docXml.newXml())
            {
                return false;
            }

            dataName = docXml.getName();

            CSXml.cXmlProperty xProperty = null;
            xProperty = new CSXml.cXmlProperty();

            xProperty.setName("Page_" + page.getPageNumber().ToString());
            xProperty.setValue(eTypes.eText, dataName);
            docXml.addProperty(xProperty);

            XmlNode nodeObj = null;

            xProperty.setName("Page");
            xProperty.setValue(eTypes.eText, "");
            nodeObj = docXml.addNode(xProperty);

            page.saveForWeb(docXml, nodeObj);

            return docXml.save();
        }
Пример #4
0
        public cReportPage add(cReportPage c, String key)
        {
            try
            {
                if (c == null)
                {
                    c = new cReportPage();
                }

                if (key == "")
                {
                    key = cReportGlobals.getKey(cReportGlobals.getNextKey().ToString());
                }

                Add(key, c);

                return c;
            }
            catch
            {
                return null;
            }
        }
Пример #5
0
 public cReportPage add(cReportPage c)
 {
     return add(c, "");
 }
Пример #6
0
 public cReportPage add(cReportPage c)
 {
     return(add(c, ""));
 }