Пример #1
0
        public static object GetTotal(Dictionary dictionary, string name)
        {
            Total sum = dictionary.Totals.FindByName(name);

            if (sum != null)
            {
                return(sum.Value);
            }
            return(null);
        }
Пример #2
0
        internal void StartKeep()
        {
            if (!IsPageFooter || keeping)
            {
                return;
            }
            keeping = true;

            keepTotal = Clone();
        }
Пример #3
0
        internal object GetValue(string name)
        {
            Total t = FindByName(name);

            if (t == null)
            {
                throw new UnknownNameException(name);
            }
            return(t.Value);
        }
Пример #4
0
        internal void ResetValue()
        {
            if (IsInsideHierarchy)
            {
                Total subTotal = FindSubTotal(subPrefix + Report.Engine.HierarchyLevel.ToString());
                subTotal.ResetValue();
                return;
            }

            Clear();
        }
Пример #5
0
        private Total FindSubTotal(string name)
        {
            Total result = subTotals.FindByName(name);

            if (result == null)
            {
                result      = this.Clone();
                result.Name = name;
                subTotals.Add(result);
            }

            return(result);
        }
Пример #6
0
        internal Total Clone()
        {
            Total total = new Total();

            total.SetReport(Report);
            total.TotalType            = TotalType;
            total.Expression           = Expression;
            total.Evaluator            = Evaluator;
            total.PrintOn              = PrintOn;
            total.ResetAfterPrint      = ResetAfterPrint;
            total.ResetOnReprint       = ResetOnReprint;
            total.EvaluateCondition    = EvaluateCondition;
            total.IncludeInvisibleRows = IncludeInvisibleRows;
            return(total);
        }
Пример #7
0
        internal void AddValue()
        {
            if (IsInsideHierarchy)
            {
                Total subTotal = FindSubTotal(subPrefix + Report.Engine.HierarchyLevel.ToString());
                subTotal.AddValue();
                return;
            }

            if (!Evaluator.Visible && !IncludeInvisibleRows)
            {
                return;
            }
            if (!String.IsNullOrEmpty(EvaluateCondition) && (bool)Report.Calc(EvaluateCondition) == false)
            {
                return;
            }
            if (TotalType != TotalType.Count && String.IsNullOrEmpty(Expression))
            {
                return;
            }

            if (keeping)
            {
                keepTotal.AddValue();
                return;
            }

            // if Total refers to another total
            Total total = IsRefersToTotal();

            if (total != null)
            {
                if (!total.parentTotal.Contains(this))
                {
                    total.parentTotal.Add(this);
                }
                return;
            }

            object value = TotalType == TotalType.Count ? null : Report.Calc(Expression);

            AddValue(value);
            if (TotalType != TotalType.Avg || (value != null && !(value is DBNull)))
            {
                count++;
            }
        }
Пример #8
0
        /// <inheritdoc/>
        public override void Serialize(FRWriter writer)
        {
            Total c = writer.DiffObject as Total;

            base.Serialize(writer);

            if (TotalType != c.TotalType)
            {
                writer.WriteValue("TotalType", TotalType);
            }
            if (Expression != c.Expression)
            {
                writer.WriteStr("Expression", Expression);
            }
            if (Evaluator != c.Evaluator)
            {
                writer.WriteRef("Evaluator", Evaluator);
            }
            if (PrintOn != c.PrintOn)
            {
                writer.WriteRef("PrintOn", PrintOn);
            }
            if (ResetAfterPrint != c.ResetAfterPrint)
            {
                writer.WriteBool("ResetAfterPrint", ResetAfterPrint);
            }
            if (ResetOnReprint != c.ResetOnReprint)
            {
                writer.WriteBool("ResetOnReprint", ResetOnReprint);
            }
            if (EvaluateCondition != c.EvaluateCondition)
            {
                writer.WriteStr("EvaluateCondition", EvaluateCondition);
            }
            if (IncludeInvisibleRows != c.IncludeInvisibleRows)
            {
                writer.WriteBool("IncludeInvisibleRows", IncludeInvisibleRows);
            }
        }
Пример #9
0
        private object GetValue()
        {
            if (IsInsideHierarchy)
            {
                Total subTotal = FindSubTotal(subPrefix + Report.Engine.HierarchyLevel.ToString());
                return(subTotal.Value);
            }

            if (TotalType == TotalType.Avg)
            {
                if (value == null || count == 0)
                {
                    return(null);
                }
                return(new Variant(value) / count);
            }
            else if (TotalType == TotalType.Count)
            {
                return(count);
            }
            return(value);
        }
Пример #10
0
        internal void AddValue()
        {
            if (IsInsideHierarchy)
            {
                Total subTotal = FindSubTotal(subPrefix + Report.Engine.HierarchyLevel.ToString());
                subTotal.AddValue();
                return;
            }

            if (!Evaluator.Visible && !IncludeInvisibleRows)
            {
                return;
            }
            if (!String.IsNullOrEmpty(EvaluateCondition) && (bool)Report.Calc(EvaluateCondition) == false)
            {
                return;
            }
            if (TotalType != TotalType.Count && String.IsNullOrEmpty(Expression))
            {
                return;
            }

            if (FKeeping)
            {
                FKeepTotal.AddValue();
                return;
            }

            object value = TotalType == TotalType.Count ? null : Report.Calc(Expression);

            AddValue(value);
            if (TotalType != TotalType.Avg || (value != null && !(value is DBNull)))
            {
                FCount++;
            }
        }
Пример #11
0
        public static bool IsValidTotal(Dictionary dictionary, string name)
        {
            Total sum = dictionary.Totals.FindByName(name);

            return(sum != null);
        }