示例#1
0
 /// <summary>
 /// this function should be overwritten; sets the environment for running the function
 /// </summary>
 public virtual Boolean FunctionSelector(TRptSituation ASituation, String f, TVariant[] ops, out TVariant AValue)
 {
     this.situation = ASituation;
     parameters = situation.GetParameters();
     AValue = null;
     return false;
 }
示例#2
0
 /// <summary>
 /// this function should be overwritten; sets the environment for running the function
 /// </summary>
 public virtual Boolean FunctionSelector(TRptSituation ASituation, String f, TVariant[] ops, out TVariant AValue)
 {
     this.situation = ASituation;
     parameters     = situation.GetParameters();
     AValue         = null;
     return(false);
 }
示例#3
0
 /// <summary>
 /// this constructor is used when the System.Object is instantiated in other situations
 ///
 /// </summary>
 /// <returns>void</returns>
 public TRptUserFunctions(TRptSituation ASituation)
 {
     this.situation = ASituation;
     parameters = situation.GetParameters();
 }
        /// <summary>
        /// Evaluates if a partner has a receiving field assigned.
        /// If there is a receiving field the FInvisibleRowCounter is increased because in the Receiving
        /// Field Report this partner is not displayed in the "NO FIELD" list.
        /// </summary>
        /// <param name="ASituation"></param>
        /// <param name="APartnerKey"></param>
        /// <param name="ATargetFieldList"></param>
        /// <returns>True if there is a receiving field. Otherwise false.</returns>
        public bool HasAttendeeReceivingField(ref TRptSituation ASituation, long APartnerKey,
            String ATargetFieldList)
        {
            PPersonTable PersonTable;
            bool ReturnValue = false;
            PmStaffDataTable StaffDataTable = new PmStaffDataTable();
            PmStaffDataRow TemplateRow = (PmStaffDataRow)StaffDataTable.NewRow();

            TemplateRow.PartnerKey = APartnerKey;

            // 1. check the staff data if this partner has the same target / receiving field
            StaffDataTable = PmStaffDataAccess.LoadUsingTemplate(TemplateRow, ASituation.GetDatabaseConnection().Transaction);

            foreach (PmStaffDataRow StaffDataRow in StaffDataTable.Rows)
            {
                if ((StaffDataRow.StartOfCommitment < DateTime.Today)
                    && (StaffDataRow.IsEndOfCommitmentNull()
                        || (!StaffDataRow.IsEndOfCommitmentNull()
                            && (StaffDataRow.EndOfCommitment > DateTime.Today)))
                    && !StaffDataRow.IsReceivingFieldNull())
                {
                    if (ATargetFieldList.Contains(StaffDataRow.ReceivingField.ToString()))
                    {
                        ReturnValue = true;
                    }
                }
            }

            // 2. check the person gift destination
            PersonTable = PPersonAccess.LoadByPrimaryKey(APartnerKey, ASituation.GetDatabaseConnection().Transaction);

            if ((ReturnValue == false)
                && (PersonTable.Rows.Count > 0))
            {
                PPersonRow PersonRow = (PPersonRow)PersonTable.Rows[0];

                PPartnerGiftDestinationTable GiftDestinationTable =
                    PPartnerGiftDestinationAccess.LoadViaPPartner(PersonRow.FamilyKey, ASituation.GetDatabaseConnection().Transaction);

                if (GiftDestinationTable.Rows.Count > 0)
                {
                    foreach (PPartnerGiftDestinationRow Row in GiftDestinationTable.Rows)
                    {
                        // check if the gift destination is currently active
                        if ((Row.DateEffective <= DateTime.Today)
                            && (Row.IsDateExpiresNull() || ((Row.DateExpires >= DateTime.Today) && (Row.DateExpires != Row.DateEffective))))
                        {
                            ReturnValue = true;
                        }
                    }
                }
            }

            if (ReturnValue == true)
            {
                // Hide the line from the output
                FInvisibleRowCounter++;
                ASituation.GetParameters().Add("DONTDISPLAYROW", new TVariant(true), -1, -1, null, null, ReportingConsts.CALCULATIONPARAMETERS);
            }
            else
            {
                ASituation.GetParameters().Add("DONTDISPLAYROW", new TVariant(false), -1, -1, null, null, ReportingConsts.CALCULATIONPARAMETERS);
            }

            return ReturnValue;
        }
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="ASituation"></param>
        /// <param name="AConferenceKey"></param>
        public TConferenceFieldCalculation(ref TRptSituation ASituation, long AConferenceKey)
        {
            FConferenceKey = AConferenceKey;
            FInvisibleRowCounter = 0;

            int NumColumns = ASituation.GetParameters().GetParameter("MaxDisplayColumns").value.ToInt();

            FMaxNumColumns = 15;

            if (FMaxNumColumns < NumColumns)
            {
                FMaxNumColumns = NumColumns;
            }

            InitResultDataTable(ref ASituation, AConferenceKey);

            DetermineConferenceCostCharges(ref ASituation, AConferenceKey);
            DetermineConferenceCostType(ref ASituation, AConferenceKey);
            DetermineConferenceDate(ref ASituation, AConferenceKey);
            DetermineConferenceDiscounts(ref ASituation, AConferenceKey);

            FExtraCostLinePrinted = false;
        }
示例#6
0
        /// <summary>
        /// recalculate row after all the columns have been calculated already,
        /// but now the functions based on other columns are calculated.
        /// </summary>
        /// <param name="situation"></param>
        /// <param name="row"></param>
        public static void RecalculateRow(TRptSituation situation, TResult row)
        {
            int counter;
            string strCalculation;
            TVariant ColumnCalc;
            TVariant levelCalc;
            TRptDataCalcResult rptDataCalcResult;
            String ColumnFormat;
            TVariant value;

            for (counter = 0; counter <= row.column.Length - 1; counter += 1)
            {
                // calculation is used for display in the GUI, formula is used for adding ledgers
                ColumnCalc = situation.GetParameters().Get("param_formula", counter, -1, eParameterFit.eExact);

                if (ColumnCalc.IsZeroOrNull())
                {
                    ColumnCalc = situation.GetParameters().Get("param_calculation", counter, -1, eParameterFit.eExact);
                }

                levelCalc = situation.GetParameters().Get("param_formula", ReportingConsts.ALLCOLUMNS, row.depth, eParameterFit.eExact);

                if (levelCalc.IsZeroOrNull())
                {
                    levelCalc = situation.GetParameters().Get("param_calculation", ReportingConsts.ALLCOLUMNS, row.depth, eParameterFit.eExact);
                }

                strCalculation = "";

                if ((!ColumnCalc.IsZeroOrNull() && situation.GetReportStore().IsFunctionCalculation(situation.GetCurrentReport(), ColumnCalc.ToString())))
                {
                    // e.g. add(Column(1), Column(2))
                    strCalculation = ColumnCalc.ToString();
                }
                else if ((!levelCalc.IsZeroOrNull()
                          && situation.GetReportStore().IsFunctionCalculation(situation.GetCurrentReport(), levelCalc.ToString())))
                {
                    // e.g. getSumLowerReport
                    strCalculation = levelCalc.ToString();
                }

                if (situation.GetReportStore().IsFunctionCalculation(situation.GetCurrentReport(), strCalculation))
                {
                    rptDataCalcResult = new TRptDataCalcResult(situation, row.depth, counter, row.childRow, row.masterRow);
                    ColumnFormat = "";

                    if (situation.GetParameters().Exists("ColumnFormat", counter, row.depth))
                    {
                        ColumnFormat = situation.GetParameters().Get("ColumnFormat", counter, row.depth).ToString();
                    }

                    value = rptDataCalcResult.Precalculate(row.column);
                    value.ApplyFormatString(ColumnFormat);

                    if (value.ToFormattedString().Length > 0)
                    {
                        row.column[counter] = value;
                    }
                }
            }
        }
示例#7
0
        /// <summary>
        /// recalculate row after all the columns have been calculated already,
        /// but now the functions based on other columns are calculated.
        /// </summary>
        /// <param name="situation"></param>
        /// <param name="row"></param>
        public static void RecalculateRow(TRptSituation situation, TResult row)
        {
            int                counter;
            string             strCalculation;
            TVariant           ColumnCalc;
            TVariant           levelCalc;
            TRptDataCalcResult rptDataCalcResult;
            String             ColumnFormat;
            TVariant           value;

            for (counter = 0; counter <= row.column.Length - 1; counter += 1)
            {
                // calculation is used for display in the GUI, formula is used for adding ledgers
                ColumnCalc = situation.GetParameters().Get("param_formula", counter, -1, eParameterFit.eExact);

                if (ColumnCalc.IsZeroOrNull())
                {
                    ColumnCalc = situation.GetParameters().Get("param_calculation", counter, -1, eParameterFit.eExact);
                }

                levelCalc = situation.GetParameters().Get("param_formula", ReportingConsts.ALLCOLUMNS, row.depth, eParameterFit.eExact);

                if (levelCalc.IsZeroOrNull())
                {
                    levelCalc = situation.GetParameters().Get("param_calculation", ReportingConsts.ALLCOLUMNS, row.depth, eParameterFit.eExact);
                }

                strCalculation = "";

                if ((!ColumnCalc.IsZeroOrNull() && situation.GetReportStore().IsFunctionCalculation(situation.GetCurrentReport(), ColumnCalc.ToString())))
                {
                    // e.g. add(Column(1), Column(2))
                    strCalculation = ColumnCalc.ToString();
                }
                else if ((!levelCalc.IsZeroOrNull() &&
                          situation.GetReportStore().IsFunctionCalculation(situation.GetCurrentReport(), levelCalc.ToString())))
                {
                    // e.g. getSumLowerReport
                    strCalculation = levelCalc.ToString();
                }

                if (situation.GetReportStore().IsFunctionCalculation(situation.GetCurrentReport(), strCalculation))
                {
                    rptDataCalcResult = new TRptDataCalcResult(situation, row.depth, counter, row.childRow, row.masterRow);
                    ColumnFormat      = "";

                    if (situation.GetParameters().Exists("ColumnFormat", counter, row.depth))
                    {
                        ColumnFormat = situation.GetParameters().Get("ColumnFormat", counter, row.depth).ToString();
                    }

                    value = rptDataCalcResult.Precalculate(row.column);
                    value.ApplyFormatString(ColumnFormat);

                    if (value.ToFormattedString().Length > 0)
                    {
                        row.column[counter] = value;
                    }
                }
            }
        }
示例#8
0
 /// <summary>
 /// this constructor is used when the System.Object is instantiated in other situations
 ///
 /// </summary>
 /// <returns>void</returns>
 public TRptUserFunctions(TRptSituation ASituation)
 {
     this.situation = ASituation;
     parameters     = situation.GetParameters();
 }