Пример #1
0
 public override void SubReportChanged(SubReportEvent newstate, string newgroup)
 {
     base.SubReportChanged(newstate, newgroup);
     if (newstate == SubReportEvent.Start)
     {
         OldStreamPos = -1;
         FOldStream   = null;
     }
 }
Пример #2
0
        public void SubReportChanged(SubReportEvent aevent, string newgroup)
        {
            int            i, j;
            Section        sec;
            PrintItem      compo;
            int            index;
            int            ffirstdetail, flastdetail;
            SubReportEvent newstate = aevent;

            // Updates group values
            if ((newstate == SubReportEvent.Start) ||
                (newstate == SubReportEvent.SubReportStart))
            {
                FillGroupValues();
                for (i = 0; i < Sections.Count; i++)
                {
                    sec = Sections[i];
                    sec.ClearPageCountList();
                }
            }
            else
            {
                index = -1;
                if (newstate == SubReportEvent.GroupChange)
                {
                    index = GroupIndex(newgroup);
                }
                else
                if (newstate == SubReportEvent.SubReportEnd)
                {
                    index = GroupCount;
                }
                if (index > 0)
                {
                    ffirstdetail = FirstDetail;
                    flastdetail  = LastDetail;
                    while (index > 0)
                    {
                        Sections[ffirstdetail - index].UpdatePageCounts();
                        Sections[ffirstdetail - index].ClearPageCountList();
                        Sections[flastdetail + index].UpdatePageCounts();
                        Sections[ffirstdetail + index].ClearPageCountList();
                        index--;
                    }
                }
            }
            for (i = 0; i < Sections.Count; i++)
            {
                sec = Sections[i];
                sec.SubReportChanged(newstate, newgroup);
                for (j = 0; j < sec.Components.Count; j++)
                {
                    compo = sec.Components[j];
                    compo.SubReportChanged(newstate, newgroup);
                }
            }
        }
Пример #3
0
        public override void SubReportChanged(SubReportEvent newstate, string newgroup)
        {
            switch (newstate)
            {
            case SubReportEvent.Start:
                FClearValue = new Variant();
                FSerieValue = new Variant();
                Clear();
                break;

            case SubReportEvent.DataChange:
                // Gets a value if the condition is true
                if (CheckValueCondition())
                {
                    GetNewValue();
                }
                break;
            }
            base.SubReportChanged(newstate, newgroup);
        }
Пример #4
0
 /// <summary>
 /// This event is generated while report is processing to allow the report items to update contents
 /// </summary>
 /// <param name="newstate">New state for the subreport</param>
 /// <param name="newgroup">New group if apply</param>
 public virtual void SubReportChanged(SubReportEvent newstate, string newgroup)
 {
 }
Пример #5
0
 public override void SubReportChanged(SubReportEvent newstate, string newgroup)
 {
     base.SubReportChanged(newstate, newgroup);
     FUpdated = false;
 }
Пример #6
0
        public override void SubReportChanged(SubReportEvent newstate, string newgroup)
        {
            base.SubReportChanged(newstate, newgroup);

            Evaluator eval;

            eval = Report.Evaluator;
            switch (newstate)
            {
            case SubReportEvent.Start:
                FExportValue   = new Variant();
                FIsPartial     = false;
                FForcedPartial = false;
                FOldString     = "";
                FUpdated       = false;
                FDataCount     = 0;
                if (Aggregate != Aggregate.None)
                {
                    try
                    {
                        // Update with the initial value
                        eval.Expression = AgIniValue;
                        eval.Evaluate();
                        Value     = eval.Result;
                        FSumValue = Value;
                        FUpdated  = true;
                    }
                    catch (Exception E)
                    {
                        throw new ReportException(E.Message + ":Expression-" + Name + " Prop:AgIniValue", this, "AgIniValue");
                    }
                }
                break;

            case SubReportEvent.SubReportStart:
                FExportValue   = new Variant();
                FIsPartial     = false;
                FForcedPartial = false;
                FOldString     = "";
                FUpdated       = false;
                FDataCount     = 0;
                if ((Aggregate != Aggregate.None) && (Aggregate != Aggregate.General))
                {
                    try
                    {
                        // Update with the initial value
                        eval.Expression = AgIniValue;
                        eval.Evaluate();
                        Value     = eval.Result;
                        FSumValue = Value;
                        FUpdated  = true;
                    }
                    catch (Exception E)
                    {
                        throw new ReportException(E.Message + ":Expression-" + Name + " Prop:AgIniValue", this, "AgIniValue");
                    }
                }
                break;

            case SubReportEvent.DataChange:
                FIsPartial     = false;
                FForcedPartial = false;
                FUpdated       = false;
                FDataCount++;
                if (Aggregate != Aggregate.None)
                {
                    try
                    {
                        eval.Expression = Expression;
                        eval.Evaluate();
                        // Do the operation
                        switch (AgType)
                        {
                        case AggregateType.Summary:
                            if (eval.Result.VarType != VariantType.Null)
                            {
                                Value = Value + eval.Result;
                            }
                            break;

                        case AggregateType.Minimum:
                            if (eval.Result.VarType != VariantType.Null)
                            {
                                if (Value > eval.Result)
                                {
                                    Value = eval.Result;
                                }
                            }
                            break;

                        case AggregateType.Maximum:
                            if (eval.Result.VarType != VariantType.Null)
                            {
                                if (Value < eval.Result)
                                {
                                    Value = eval.Result;
                                }
                            }
                            break;

                        case AggregateType.Average:
                            if (eval.Result.VarType == VariantType.Null)
                            {
                                FDataCount--;
                            }
                            else
                            {
                                FSumValue = FSumValue + eval.Result;
                                Value     = FSumValue / FDataCount;
                            }
                            break;

                        case AggregateType.StandardDeviation:
                            if (eval.Result.VarType == VariantType.Null)
                            {
                                FDataCount--;
                            }
                            else
                            {
                                FValues.Add(eval.Result);
                                Value = DoubleUtil.StandardDeviation(FValues);
                            }
                            break;
                        }
                        FUpdated = true;
                    }
                    catch (Exception E)
                    {
                        throw new ReportException(E.Message + ":Expression-" + Name + " Prop:Expression", this, "Expression");
                    }
                }
                break;

            case SubReportEvent.GroupChange:
                FIsPartial     = false;
                FForcedPartial = false;
                FUpdated       = false;
                FOldString     = "";
                if (Aggregate == Aggregate.Group)
                {
                    if (GroupName.ToUpper() == newgroup.ToUpper())
                    {
                        // Update with the initial value
                        try
                        {
                            // Update with the initial value
                            eval.Expression = AgIniValue;
                            eval.Evaluate();
                            Value     = eval.Result;
                            FSumValue = Value;
                            FUpdated  = true;
                        }
                        catch (Exception E)
                        {
                            throw new ReportException(E.Message + ":Expression-" + Name + " Prop:AgIniValue", this, "AgIniValue");
                        }
                    }
                }
                break;

            case SubReportEvent.PageChange:
                FOldString = "";
                if (Aggregate == Aggregate.None)
                {
                    // Page variable must be recalculated
                    FUpdated = false;
                }
                if (Aggregate == Aggregate.Page)
                {
                    // Update with the initial value
                    try
                    {
                        // Update with the initial value
                        eval.Expression = AgIniValue;
                        eval.Evaluate();
                        Value     = eval.Result;
                        FSumValue = Value;
                        FUpdated  = true;
                    }
                    catch (Exception E)
                    {
                        throw new ReportException(E.Message + ":Expression-" + Name + " Prop:AgIniValue", this, "AgIniValue");
                    }
                    SubReportChanged(SubReportEvent.DataChange, "");
                }
                break;

            case SubReportEvent.InvalidateValue:
                FIsPartial     = false;
                FForcedPartial = false;
                FOldString     = "";
                FUpdated       = false;
                break;
            }
        }