Exemplo n.º 1
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="cur2"></param>
        /// <param name="order"></param>
        /// <returns></returns>
        protected TRptField ParseField(XmlNode cur2, int order)
        {
            XmlNode   cur;
            Object    rg;
            TRptField element;

            cur     = cur2;
            element = new TRptField(order);
            element.strWhichfield  = GetAttribute(cur, "whichfield").ToLower();
            element.strCalculation = GetAttribute(cur, "calculation");
            element.strPos         = GetAttribute(cur, "pos").ToLower();
            element.strPos         = element.strPos.Replace(".", CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator);
            element.strWidth       = GetAttribute(cur, "width").ToLower();
            element.strWidth       = element.strWidth.Replace(".", CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator);
            element.strFormat      = GetAttribute(cur, "format");
            element.strAlign       = GetAttribute(cur, "align").ToLower();
            element.strLine        = GetAttribute(cur, "line").ToLower();
            cur = NextNotBlank(cur.FirstChild);
            rg  = ParseGroup(cur, ref report.valuesId, "value", out cur);

            if (rg != null)
            {
                element.rptGrpValue = ((List <TRptValue>)rg);
            }

            rg = ParseGroup(cur, ref report.fieldDetailsId, "fielddetail", out cur);

            if (rg != null)
            {
                element.rptGrpFieldDetail = ((List <TRptFieldDetail>)rg);
            }

            return(element);
        }
Exemplo n.º 2
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="cur2"></param>
        /// <param name="order"></param>
        /// <returns></returns>
        protected TRptField ParseField(XmlNode cur2, int order)
        {
            XmlNode cur;
            Object rg;
            TRptField element;

            cur = cur2;
            element = new TRptField(order);
            element.strWhichfield = GetAttribute(cur, "whichfield").ToLower();
            element.strCalculation = GetAttribute(cur, "calculation");
            element.strPos = GetAttribute(cur, "pos").ToLower();
            element.strPos = element.strPos.Replace(".", CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator);
            element.strWidth = GetAttribute(cur, "width").ToLower();
            element.strWidth = element.strWidth.Replace(".", CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator);
            element.strFormat = GetAttribute(cur, "format");
            element.strAlign = GetAttribute(cur, "align").ToLower();
            element.strLine = GetAttribute(cur, "line").ToLower();
            cur = NextNotBlank(cur.FirstChild);
            rg = ParseGroup(cur, ref report.valuesId, "value", out cur);

            if (rg != null)
            {
                element.rptGrpValue = ((List <TRptValue> )rg);
            }

            rg = ParseGroup(cur, ref report.fieldDetailsId, "fielddetail", out cur);

            if (rg != null)
            {
                element.rptGrpFieldDetail = ((List <TRptFieldDetail> )rg);
            }

            return element;
        }
Exemplo n.º 3
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="rptField"></param>
        public void Calculate(TRptField rptField)
        {
            int cmpos;
            string whichField;
            TRptDataCalcCalculation rptDataCalcCalculation;
            String list;
            String element;

            column = -1;
            whichField = rptField.strWhichfield;

            if (whichField.IndexOf("columns") == 0)
            {
                column = ReportingConsts.ALLCOLUMNS;
            }
            else if (whichField.IndexOf("column ") == 0)
            {
                if (whichField[7] == '{')
                {
                    String ParameterName = whichField.Substring(8, whichField.Length - 9);
                    column = GetParameters().Get(ParameterName).ToInt();
                }
                else
                {
                    column = (Int32)StringHelper.StrToInt(whichField.Substring(7, whichField.Length - 7));
                }
            }
            else if (whichField.IndexOf("left ") == 0)
            {
                column = ReportingConsts.COLUMNLEFT + (Int32)StringHelper.StrToInt(whichField.Substring(5, whichField.Length - 5)) + 1;
            }
            else if (whichField.IndexOf("header ") == 0)
            {
                column = ReportingConsts.HEADERCOLUMN + (Int32)StringHelper.StrToInt(whichField.Substring(7, whichField.Length - 7)) + 1;
            }
            else
            {
                if (whichField == "title1")
                {
                    column = ReportingConsts.HEADERTITLE1;
                }

                if (whichField == "title2")
                {
                    column = ReportingConsts.HEADERTITLE2;
                }

                if (whichField == "descr1")
                {
                    column = ReportingConsts.HEADERDESCR1;
                }

                if (whichField == "descr2")
                {
                    column = ReportingConsts.HEADERDESCR2;
                }

                if (whichField == "descr3")
                {
                    column = ReportingConsts.HEADERDESCR3;
                }

                if (whichField == "period1")
                {
                    column = ReportingConsts.HEADERPERIOD;
                }

                if (whichField == "period2")
                {
                    column = ReportingConsts.HEADERPERIOD2;
                }

                if (whichField == "period3")
                {
                    column = ReportingConsts.HEADERPERIOD3;
                }

                if (whichField == "left1")
                {
                    column = ReportingConsts.HEADERPAGELEFT1;
                }

                if (whichField == "left2")
                {
                    GetParameters().Add("FOOTER2LINES", new TVariant(true), -1, Depth);
                    column = ReportingConsts.HEADERPAGELEFT2;
                }

                if (whichField == "type")
                {
                    column = ReportingConsts.HEADERTYPE;
                }
            }

            if (rptField.strAlign != "")
            {
                GetParameters().Add("ColumnAlign", new TVariant(rptField.strAlign), column, Depth);
            }

            if (rptField.strFormat.Length != 0)
            {
                GetParameters().Add("ColumnFormat", new TVariant(rptField.strFormat), column, Depth);
            }

            if (rptField.strLine.IndexOf("above") != -1)
            {
                GetParameters().Add("LineAbove", new TVariant(true), column, Depth);
            }

            if (rptField.strLine.IndexOf("below") != -1)
            {
                GetParameters().Add("LineBelow", new TVariant(true), column, Depth);
            }

            if (rptField.strPos.IndexOf("indented") != -1)
            {
                GetParameters().Add("indented", new TVariant(true), column, Depth);
            }

            cmpos = rptField.strPos.IndexOf("cm");

            if (cmpos != -1)
            {
                GetParameters().Add("ColumnPosition", new TVariant(StringHelper.TryStrToDecimal(rptField.strPos.Substring(0,
                                cmpos), 0.0M)), column, Depth);
            }

            cmpos = rptField.strWidth.IndexOf("cm");

            if (cmpos != -1)
            {
                GetParameters().Add("ColumnWidth", new TVariant(StringHelper.TryStrToDecimal(rptField.strWidth.Substring(0,
                                cmpos), 0.0M)), column, Depth);
            }

            if (rptField.strCalculation.Length != 0)
            {
                rptDataCalcCalculation = new TRptDataCalcCalculation(this);

                // allow several helper calculations to be executed after each other;
                // e.g. giftbatchexport; first get the accumulated description of the gift details, then get bank account details
                list = rptField.strCalculation;

                while (list.Length != 0)
                {
                    element = StringHelper.GetNextCSV(ref list).Trim();
                    rptDataCalcCalculation.EvaluateHelperCalculation(element);
                }
            }

            if (column != -1)
            {
                if (rptField.rptGrpValue != null)
                {
                    // overwrite the global column calculation
                    GetParameters().Add("param_calculation", new TVariant(), column, Depth, null, null, ReportingConsts.CALCULATIONPARAMETERS);
                }

                Calculate(rptField.rptGrpValue, rptField.rptGrpFieldDetail);
            }
            else
            {
                throw new Exception("ERROR: whichField problem: " + whichField);
            }
        }