Inheritance: System.Collections.Specialized.NameObjectCollectionBase
        private void getLineAux(cReportSection sec, cReportPageFields fields)
        {
            // for every control in every section line of sec
            // we need to create a new cPageField
            //
            cReportPageField field = null;
            cReportSectionLine secLn = null;
            cReportControl ctrl = null;
            bool isVisible = false;
            int indexCtrl = 0;

            // this indexes are used to
            //
            // indicate in which data source is this field
            //
            int indexRows = 0;
            //
            // in which row is this field
            //
            int indexRow = 0;
            //
            // in which column is this field
            //
            int indexField = 0;

            if (sec.getHasFormulaHide())
            {
                isVisible = cUtil.val(m_compiler.resultFunction(sec.getFormulaHide())) != 0;
            }
            else
            {
                isVisible = true;
            }

            if (isVisible)
            {
                // for every section line in sec
                //
                for (int _i = 0; _i < sec.getSectionLines().count(); _i++)
                {
                    secLn = sec.getSectionLines().item(_i);
                    m_lineIndex++;

                    if (secLn.getHasFormulaHide())
                    {
                        m_compiler.evalFunction(secLn.getFormulaHide());
                        isVisible = cUtil.val(m_compiler.resultFunction(secLn.getFormulaHide())) != 0;
                    }
                    else
                    {
                        isVisible = true;
                    }

                    if (isVisible)
                    {
                        // for every control in the section line
                        //
                        int[] collByLeft = secLn.getControls().getCollByLeft();
                        for (indexCtrl = 0; indexCtrl < collByLeft.Length; indexCtrl++)
                        {
                            ctrl = secLn.getControls().item(collByLeft[indexCtrl]);

                            // add a new field to the collection
                            //
                            field = fields.add(null, "");
                            field.setIndexLine(m_lineIndex);

                            if (ctrl.getHasFormulaValue())
                            {
                                field.setValue(
                                    cReportGlobals.format(
                                        m_compiler.resultFunction(ctrl.getFormulaValue()),
                                        ctrl.getLabel().getAspect().getFormat()));
                            }
                            else
                            {
                                cReportLabel w_label = null;
                                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:
                                        w_label = ctrl.getLabel();
                                        field.setValue(cReportGlobals.format(w_label.getText(), w_label.getAspect().getFormat()));
                                        break;

                                    case csRptControlType.CSRPTCTIMAGE:
                                        w_label = ctrl.getLabel();
                                        field.setValue(cReportGlobals.format(w_label.getText(), w_label.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;
                                }
                            }

                            if (ctrl.getHasFormulaHide())
                            {
                                field.setVisible(cUtil.val(m_compiler.resultFunction(ctrl.getFormulaHide())) != 0);
                            }
                            else
                            {
                                field.setVisible(true);
                            }

                            // set a reference to the definition of this field
                            //
                            field.setInfo(m_pageSetting.item(ctrl.getKey()));
                        }
                    }
                }
            }
        }
        // it returns every controls of a line
        // it moves through every row in the main recordset
        //
        public csRptGetLineResult getLine(ref cReportPageFields fields)
        {
            // to know if we need to print in a new page
            // because a group has changed its value
            //
            bool bGetNewPage = false;

            if (fields != null)
            {
                fields.clear();
            }

            // if there are not pending calls to close or open groups
            //
            if (!(m_bCloseFooter || m_bOpenHeader))
            {

                // if there are not group headers to be re-printed in this page
                //
                if (!pExistsGroupHeadersToReprint())
                {

                    // we process the line
                    //
                    csRptGetLineResult rslt = pGetLineWork(ref fields, out bGetNewPage);
                    if (bGetNewPage)
                    {
                        return csRptGetLineResult.CSRPTGLNEWPAGE;
                    }
                    else
                    {
                        if (rslt == csRptGetLineResult.CSRPTGLEND || rslt == csRptGetLineResult.CSRPTGLVIRTUALF)
                        {
                            return rslt;
                        }
                    }
                }
            }

            // if we must close footers
            //
            if (m_bCloseFooter)
            {
                return pGetLineAuxGroupFooter(fields);
            }
            // if the group has changed
            //
            else if (m_bOpenHeader)
            {
                return pGetLineAuxGroupHeader(bGetNewPage, fields);
            }
            // process a details line
            //
            else
            {
                return pGetLineAuxDetail(fields);
            }
        }
        private csRptGetLineResult pGetLineAuxGroupHeader(bool bGetNewPage, cReportPageFields fields)
        { // TODO: Use of ByRef founded Private Function pGetLineAuxGroupHeader(ByVal bGetNewPage As Boolean, ByRef Fields As cReportPageFields) As csRptGetLineResult
            cReportSection headerSec = null;

            if (bGetNewPage && !m_firstGroup)
            {
                // in the deatil and group headers the row for formulas
                // is the current row
                //
                m_iRowFormula = m_iRow;

                return csRptGetLineResult.CSRPTGLNEWPAGE;
            }
            else
            {

                // if we need to evaluate the functions which must
                // run before printing
                //
                if (m_bEvalPreGroups)
                {
                    // if we are not reprinting group headers
                    //
                    if (!m_bHaveToRePrintGroup)
                    {
                        // in the detail and group headers the row for formulas
                        // is the current row
                        //
                        m_iRowFormula = m_iRow;
                    }
                    // to force the next call to getLine() to print the footer
                    //
                    m_bEvalPreGroups = false;

                    return csRptGetLineResult.CSRPTGLVIRTUALH;
                }
                else
                {

                    m_bOpenHeader = false;

                    // to force the next call to getLine() to return CSRPTGLVIRTUALF
                    //
                    m_bEvalPreGroups = true;
                    headerSec = m_groups.item(m_idxGroupHeader).getHeader();
                    getLineAux(headerSec, fields);

                    // set this flag on to indicate we have footers to close
                    //
                    m_bPrintFooter = true;

                    // we return a group line
                    //
                    return csRptGetLineResult.CSRPTGLGROUPHEADER;
                }
            }
        }
        private csRptGetLineResult pGetLineAuxDetail(cReportPageFields fields)
        { // TODO: Use of ByRef founded Private Function pGetLineAuxDetail(ByRef Fields As cReportPageFields) As csRptGetLineResult
            m_firstGroup = false;

            getLineAux(m_details.item(0), fields);

            // we return a detail line
            //
            return csRptGetLineResult.CSRPTGLDETAIL;
        }
        private csRptGetLineResult pGetLineWork(ref cReportPageFields fields, out bool bGetNewPage)
        {
            bGetNewPage = false;

            // if the user has cancel we have finished
            //
            if (pGetLineAuxReportCancel() == csRptGetLineResult.CSRPTGLEND)
            {
                return csRptGetLineResult.CSRPTGLEND;
            }

            // if we reach the end of the report and there are not groups to process
            // we have finished
            //
            csRptGetLineResult rslt = pGetLineWorkAuxReportEnd();
            if (rslt == csRptGetLineResult.CSRPTGLEND || rslt == csRptGetLineResult.CSRPTGLVIRTUALF)
            {
                return rslt;
            }

            // field collection for this line
            //
            fields = new cReportPageFields();

            // if we need to print the group in a new page
            //
            if (m_idxGroupToPrintNP > -1)
            {
                pGetLineAuxPrintGroupInNP();
            }
            // we need to process groups
            //
            else
            {
                // if the report have groups
                //
                if (m_groupCount > 0)
                {
                    // if we don't need to re-print group headers
                    //
                    if (!m_bHaveToRePrintGroup)
                    {
                        pEvalFooterToClose();
                    }

                    // if we don't need to re-print group footers
                    //
                    if (!m_bCloseFooter)
                    {
                        // if have done all the pending work we have finished
                        //
                        if (pGetLineAuxReportIsDone() == csRptGetLineResult.CSRPTGLEND)
                        {
                            return csRptGetLineResult.CSRPTGLEND;
                        }

                        // continue with the next group
                        //
                        pGetLineAuxDoGroups(ref bGetNewPage);
                    }
                }
            }
            return csRptGetLineResult.CSRPTGLNONE;
        }
        private csRptGetLineResult pGetLineAuxGroupFooter(cReportPageFields fields)
        { // TODO: Use of ByRef founded Private Function pGetLineAuxGroupFooter(ByRef Fields As cReportPageFields) As csRptGetLineResult
            cReportSection footerSec = null;
            cReportControl ctrl = null;
            cReportSectionLine secLn = null;

            // if we need to evaluate functions which must run
            // before printing
            //
            if (m_bEvalPreGroups)
            {
                // when we are evaluating this kind of formulas we must use
                // the previous row because here we are closing groups
                // which means the current row doesn't belong to the
                // group we are closing
                //
                // NOTE: whe we have done whit printing the footers
                // we need to set m_iRowFormula and m_iRow2 to their 
                // original values
                //
                m_iRowFormula = m_iRow - 1;
                m_iRow2 = m_iRow - 1;

                // to force the next call to getLine() to close the footer
                //
                m_bEvalPreGroups = false;

                return csRptGetLineResult.CSRPTGLVIRTUALF;
            }
            else
            {

                // if there are more footers to be printed this
                // flag will be turn on in the next call to getLine()
                //
                m_bCloseFooter = false;

                // to force the next call to return CSRPTGLVIRTUALF
                //
                m_bEvalPreGroups = true;

                footerSec = m_groups.item(m_idxGroupFooter).getFooter();

                getLineAux(footerSec, fields);

                return csRptGetLineResult.CSRPTGLGROUPFOOTER;
            }
        }
Exemple #7
0
 public void setDetail(cReportPageFields rhs)
 {
     m_detail = rhs;
 }
Exemple #8
0
 public void setFooter(cReportPageFields rhs)
 {
     m_footer = rhs;
 }
Exemple #9
0
 public void setHeader(cReportPageFields rhs)
 {
     m_header = rhs;
 }
 public void setFooter(cReportPageFields rhs)
 {
     m_footer = rhs;
 }
 public void setDetail(cReportPageFields rhs)
 {
     m_detail = rhs;
 }
 public void setHeader(cReportPageFields rhs)
 {
     m_header = rhs;
 }
        private CSReportDll.cReportPageFields pGetLineAux(int indexLine, CSReportDll.cReportPageFields fields)
        {
            CSReportDll.cReportPageFields flds = new CSReportDll.cReportPageFields();

            for (int _i = 0; _i < fields.count(); _i++)
            {
                CSReportDll.cReportPageField fld = fields.item(_i);
                if (fld.getIndexLine() == indexLine)
                {
                    flds.add(fld);
                }
            }
            return flds;
        }