private void ReadControlsManual(TRptCalculator ACalc, TReportActionEnum AReportAction)
 {
     ACalc.AddParameter("param_ledger_number_i", FLedgerNumber);
     ACalc.AddParameter("param_with_analysis_attributes", true);
     ACalc.AddColumnLayout(6, 23, 0, 3);
     ACalc.AddColumnLayout(7, 26, 0, 3);
     ACalc.SetMaxDisplayColumns(8);
     ACalc.AddColumnCalculation(6, "AnalysisType");
     ACalc.AddColumnCalculation(7, "AnalysisValue");
 }
Пример #2
0
 private void ReadControlsManual(TRptCalculator ACalc, TReportActionEnum AReportAction)
 {
     ACalc.AddParameter("param_ledger_number_i", FLedgerNumber);
     ACalc.AddColumnLayout(0, 8, 0, 3);
     ACalc.AddColumnLayout(1, 11, 0, 3);
     ACalc.AddColumnLayout(2, 14, 0, 7);
     ACalc.SetMaxDisplayColumns(3);
     ACalc.AddColumnCalculation(0, "Debit");
     ACalc.AddColumnCalculation(1, "Credit");
     ACalc.AddParameter("param_daterange", "false");
 }
        private void ReadControlsManual(TRptCalculator ACalc, TReportActionEnum AReportAction)
        {
            ACalc.AddColumnLayout(0, 8, 0, 3);
            ACalc.AddColumnLayout(1, 11, 0, 3);
            ACalc.SetMaxDisplayColumns(2);
            ACalc.AddColumnCalculation(0, "Debit");
            ACalc.AddColumnCalculation(1, "Credit");

            ACalc.AddParameter("param_ledger_number_i", FLedgerNumber);
            ACalc.AddParameter("param_with_analysis_attributes", false);
            ACalc.AddParameter("param_depth", "summary");
            ACalc.AddParameter("param_sortby", "Cost Centre");
        }
Пример #4
0
        private void ReadControlsManual(TRptCalculator ACalc, TReportActionEnum AReportAction)
        {
            ACalc.AddParameter("param_ledger_number_i", FLedgerNumber);
            ACalc.AddColumnLayout(0, 8, 0, 3);
            ACalc.AddColumnLayout(1, 11, 0, 3);
            ACalc.AddColumnLayout(2, 14, 0, 7);
            ACalc.SetMaxDisplayColumns(3);
            ACalc.AddColumnCalculation(0, "Debit");
            ACalc.AddColumnCalculation(1, "Credit");
            ACalc.AddColumnCalculation(2, "Transaction Narrative");
            ACalc.AddParameter("param_daterange", "false");
            ACalc.AddParameter("param_rgrAccounts", "AllAccounts");
            ACalc.AddParameter("param_rgrCostCentres", "CostCentreList");
            // TODO need to allow to specify an ICH run number
            ACalc.AddParameter("param_ich_number", 0);

            ACalc.AddStringParameter("param_cost_centre_codes", clbCostCentres.GetCheckedStringList(true));
        }
        private void ReadControlsManual(TRptCalculator ACalc, TReportActionEnum AReportAction)
        {
            if ((AReportAction == TReportActionEnum.raGenerate)
                && (rbtPartner.Checked && (txtRecipient.Text == "0000000000")))
            {
                TVerificationResult VerificationResult = new TVerificationResult(
                    Catalog.GetString("No recipient selected."),
                    Catalog.GetString("Please select a recipient."),
                    TResultSeverity.Resv_Critical);
                FPetraUtilsObject.AddVerificationResult(VerificationResult);
            }

            if ((AReportAction == TReportActionEnum.raGenerate)
                && rbtExtract.Checked
                && (txtExtract.Text == ""))
            {
                TVerificationResult VerificationMessage = new TVerificationResult(
                    Catalog.GetString("Enter an extract name."),
                    Catalog.GetString("No extract name entered!"), TResultSeverity.Resv_Critical);
                FPetraUtilsObject.AddVerificationResult(VerificationMessage);
            }

            if ((AReportAction == TReportActionEnum.raGenerate)
                && rbtSelectedFields.Checked
                && (clbFields.GetCheckedStringList().Length == 0))
            {
                TVerificationResult VerificationMessage = new TVerificationResult(
                    Catalog.GetString("Please select at least one field."),
                    Catalog.GetString("No fields selected!"), TResultSeverity.Resv_Critical);
                FPetraUtilsObject.AddVerificationResult(VerificationMessage);
            }

            if ((AReportAction == TReportActionEnum.raGenerate)
                && rbtSelectedTypes.Checked
                && (clbTypes.GetCheckedStringList().Length == 0))
            {
                TVerificationResult VerificationMessage = new TVerificationResult(
                    Catalog.GetString("Please select at least one type."),
                    Catalog.GetString("No types selected!"), TResultSeverity.Resv_Critical);
                FPetraUtilsObject.AddVerificationResult(VerificationMessage);
            }

            ACalc.AddParameter("param_recipient_key", txtRecipient.Text);
            ACalc.AddParameter("param_extract_name", txtExtract.Text);

            ACalc.AddParameter("param_ledger_number_i", FLedgerNumber);

            //TODO: Calendar vs Financial Date Handling - Confirm that these should not be ledger dates, i.e. allowing for >12 periods and non-calendar period boundaries
            DateTime FromDateThisYear = new DateTime(DateTime.Today.Year, 1, 1);
            DateTime ToDatePreviousYear = new DateTime(DateTime.Today.Year - 1, 12, 31);
            DateTime FromDatePreviousYear = new DateTime(DateTime.Today.Year - 1, 1, 1);

            ACalc.AddParameter("Year0", DateTime.Today.Year);
            ACalc.AddParameter("Year1", DateTime.Today.Year - 1);
            ACalc.AddParameter("Year2", DateTime.Today.Year - 2);
            ACalc.AddParameter("Year3", DateTime.Today.Year - 3);

            ACalc.AddParameter("param_to_date_0", DateTime.Today);
            ACalc.AddParameter("param_from_date_0", FromDateThisYear);
            ACalc.AddParameter("param_to_date_1", ToDatePreviousYear);
            ACalc.AddParameter("param_from_date_1", FromDatePreviousYear);
            ACalc.AddParameter("param_to_date_2", ToDatePreviousYear.AddYears(-1));
            ACalc.AddParameter("param_from_date_2", FromDatePreviousYear.AddYears(-1));
            ACalc.AddParameter("param_to_date_3", ToDatePreviousYear.AddYears(-2));
            ACalc.AddParameter("param_from_date_3", FromDatePreviousYear.AddYears(-2));

            int ColumnCounter = 0;
            ACalc.AddParameter("param_calculation", "PartnerKey", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)2.5, ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "DonorName", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)6.0, ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "DonorClass", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)3.0, ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "Year-0", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)2.0, ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "Year-1", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)2.0, ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "Year-2", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)2.0, ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "Year-3", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)2.0, ColumnCounter);
            ++ColumnCounter;

            ACalc.SetMaxDisplayColumns(ColumnCounter);
        }
        private void ReadControlsManual(TRptCalculator ACalc, TReportActionEnum AReportAction)
        {
            if (AReportAction == TReportActionEnum.raGenerate)
            {
                if (rbtPartner.Checked && (txtDonor.Text == "0000000000"))
                {
                    TVerificationResult VerificationResult = new TVerificationResult(
                        Catalog.GetString("No donor selected."),
                        Catalog.GetString("Please select a donor."),
                        TResultSeverity.Resv_Critical);

                    FPetraUtilsObject.AddVerificationResult(VerificationResult);
                }

                if (rbtExtract.Checked && (txtExtract.Text == ""))
                {
                    TVerificationResult VerificationMessage = new TVerificationResult(
                        Catalog.GetString("Enter an extract name"),
                        Catalog.GetString("No extract name entered!"), TResultSeverity.Resv_Critical);
                    FPetraUtilsObject.AddVerificationResult(VerificationMessage);
                }

                if (txtMinAmount.NumberValueInt > txtMaxAmount.NumberValueInt)
                {
                    TVerificationResult VerificationResult = new TVerificationResult(
                        Catalog.GetString("Gift Limit wrong."),
                        Catalog.GetString("Minimum Amount can't be greater than Maximum Amount."),
                        TResultSeverity.Resv_Critical);
                    FPetraUtilsObject.AddVerificationResult(VerificationResult);
                }

                if (!dtpFromDate.ValidDate() || !dtpToDate.ValidDate())
                {
                    TVerificationResult VerificationResult = new TVerificationResult(
                        Catalog.GetString("Date format problem"),
                        Catalog.GetString("Please check the date entry."),
                        TResultSeverity.Resv_Critical);
                    FPetraUtilsObject.AddVerificationResult(VerificationResult);
                }

                if ((cmbReportType.SelectedItem.ToString() == "Complete")
                    && (dtpFromDate.Date > dtpToDate.Date))
                {
                    TVerificationResult VerificationResult = new TVerificationResult(
                        Catalog.GetString("From date is later than to date."),
                        Catalog.GetString("Please change from date or to date."),
                        TResultSeverity.Resv_Critical);
                    FPetraUtilsObject.AddVerificationResult(VerificationResult);
                }
            }

            ACalc.AddParameter("param_ledger_number_i", FLedgerNumber);
            ACalc.AddParameter("param_donorkey", txtDonor.Text);
            ACalc.AddParameter("param_extract_name", txtExtract.Text);

            //TODO: Calendar vs Financial Date Handling - Confirm that these should not be ledger dates, i.e. allowing for >12 periods and non-calendar period boundaries
            DateTime FromDateThisYear = new DateTime(DateTime.Today.Year, 1, 1);
            DateTime ToDatePreviousYear = new DateTime(DateTime.Today.Year - 1, 12, 31);
            DateTime FromDatePreviousYear = new DateTime(DateTime.Today.Year - 1, 1, 1);

            ACalc.AddParameter("param_end_date_this_year", DateTime.Today);
            ACalc.AddParameter("param_start_date_this_year", FromDateThisYear);
            ACalc.AddParameter("param_end_date_previous_year", ToDatePreviousYear);
            ACalc.AddParameter("param_start_date_previous_year", FromDatePreviousYear);

            if (cmbReportType.SelectedItem.ToString() == "Totals")
            {
                DateTime FromDate = new DateTime(DateTime.Today.Year - 3, 1, 1);
                ACalc.RemoveParameter("param_from_date");
                ACalc.RemoveParameter("param_to_date");
                ACalc.AddParameter("param_from_date", FromDate);
                ACalc.AddParameter("param_to_date", DateTime.Today);

                ACalc.AddParameter("Month0", 1);
                ACalc.AddParameter("Month1", 2);
                ACalc.AddParameter("Year0", DateTime.Today.Year);
                ACalc.AddParameter("Year1", DateTime.Today.Year - 1);
                ACalc.AddParameter("Year2", DateTime.Today.Year - 2);
                ACalc.AddParameter("Year3", DateTime.Today.Year - 3);

                int ColumnCounter = 0;
                ACalc.AddParameter("param_calculation", "Month", ColumnCounter);
                ACalc.AddParameter("ColumnWidth", (float)3.0, ColumnCounter);
                ++ColumnCounter;
                ACalc.AddParameter("param_calculation", "Year-0", ColumnCounter);
                ACalc.AddParameter("ColumnWidth", (float)2.0, ColumnCounter);
                ++ColumnCounter;
                ACalc.AddParameter("param_calculation", "Count-0", ColumnCounter);
                ACalc.AddParameter("ColumnWidth", (float)0.8, ColumnCounter);
                ++ColumnCounter;
                ACalc.AddParameter("param_calculation", "Year-1", ColumnCounter);
                ACalc.AddParameter("ColumnWidth", (float)2.0, ColumnCounter);
                ++ColumnCounter;
                ACalc.AddParameter("param_calculation", "Count-1", ColumnCounter);
                ACalc.AddParameter("ColumnWidth", (float)0.8, ColumnCounter);
                ++ColumnCounter;
                ACalc.AddParameter("param_calculation", "Year-2", ColumnCounter);
                ACalc.AddParameter("ColumnWidth", (float)2.0, ColumnCounter);
                ++ColumnCounter;
                ACalc.AddParameter("param_calculation", "Count-2", ColumnCounter);
                ACalc.AddParameter("ColumnWidth", (float)0.8, ColumnCounter);
                ++ColumnCounter;
                ACalc.AddParameter("param_calculation", "Year-3", ColumnCounter);
                ACalc.AddParameter("ColumnWidth", (float)2.0, ColumnCounter);
                ++ColumnCounter;
                ACalc.AddParameter("param_calculation", "Count-3", ColumnCounter);
                ACalc.AddParameter("ColumnWidth", (float)0.8, ColumnCounter);
                ++ColumnCounter;
                ACalc.SetMaxDisplayColumns(ColumnCounter);
            }
            else
            {
                int MaxColumns = ACalc.GetParameters().Get("MaxDisplayColumns").ToInt();

                for (int Counter = 0; Counter <= MaxColumns; ++Counter)
                {
                    String ColumnName = ACalc.GetParameters().Get("param_calculation", Counter, 0).ToString();

                    if (ColumnName == "Gift Amount")
                    {
                        ACalc.AddParameter("param_gift_amount_column", Counter);
                    }
                }
            }
        }
 private void ReadControlsManual(TRptCalculator ACalc, TReportActionEnum AReportAction)
 {
     ACalc.AddColumnLayout(0, 0, 0, 19);
     ACalc.SetMaxDisplayColumns(1);
     ACalc.AddColumnCalculation(0, "Emergency Data");
 }
        private void ReadControlsManual(TRptCalculator ACalc, TReportActionEnum AReportAction)
        {
            if ((AReportAction == TReportActionEnum.raGenerate)
                && (clbFields.GetCheckedStringList().Length == 0))
            {
                TVerificationResult VerificationMessage = new TVerificationResult(
                    Catalog.GetString("Please select at least one field."),
                    Catalog.GetString("No fields selected!"), TResultSeverity.Resv_Critical);
                FPetraUtilsObject.AddVerificationResult(VerificationMessage);
            }

            int Years = Convert.ToInt16(txtYears.Text);

            if ((AReportAction == TReportActionEnum.raGenerate)
                && ((Years > 4) || (Years < 1)))
            {
                TVerificationResult VerificationMessage = new TVerificationResult(
                    Catalog.GetString("Set the year range between 1 and 4"),
                    Catalog.GetString("Wrong year range entered"), TResultSeverity.Resv_Critical);
                FPetraUtilsObject.AddVerificationResult(VerificationMessage);
            }

            ACalc.AddParameter("param_ledger_number_i", FLedgerNumber);

            ACalc.AddParameter("Year0", DateTime.Today.Year);
            ACalc.AddParameter("param_Year0", DateTime.Today.Year);
            ACalc.AddParameter("Year3", DateTime.Today.Year - 3);

            ACalc.AddParameter("Month0", 1);
            ACalc.AddParameter("Month1", 2);
            ACalc.AddParameter("MonthCombined", 0);
            ACalc.AddParameter("CountCombined", 0);

            int ColumnCounter = 0;
            ACalc.AddParameter("param_calculation", "Month", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)4, ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "AmountWorker", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)3.0, ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "CountWorker", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)1, ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "AmountField", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)3.0, ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "CountField", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)1, ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "AmountCombined", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)3.0, ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "CountCombined", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)1, ColumnCounter);
            ++ColumnCounter;

            ACalc.SetMaxDisplayColumns(ColumnCounter);
        }
Пример #9
0
        /// <summary>
        /// Reads the selected values from the controls,
        /// and stores them into the parameter system of FCalculator
        ///
        /// </summary>
        /// <param name="AColumnParameters">List with the current columns</param>
        /// <param name="ACalculator"></param>
        /// <returns>the MaxDisplayColumns number</returns>
        public static System.Int32 ReadControls(ref TParameterList AColumnParameters, ref TRptCalculator ACalculator)
        {
            System.Int32 MaxDisplayColumns;

            MaxDisplayColumns = AColumnParameters.Get("MaxDisplayColumns").ToInt();
            ACalculator.GetParameters().Add("MaxDisplayColumns", MaxDisplayColumns);

            for (int Counter = 0; Counter <= MaxDisplayColumns - 1; Counter += 1)
            {
                ACalculator.GetParameters().Copy(AColumnParameters, Counter, -1, eParameterFit.eExact, Counter);

                if (!ACalculator.GetParameters().Exists("param_ytd", Counter))
                {
                    // if param_ytd is not set for the column then add it.
                    ACalculator.GetParameters().Add("param_ytd", new TVariant(false), Counter);
                }
            }

            ACalculator.SetMaxDisplayColumns(MaxDisplayColumns);

            return MaxDisplayColumns;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="ACalculator"></param>
        /// <param name="AReportAction"></param>
        private void ReadControlsManual(TRptCalculator ACalculator, TReportActionEnum AReportAction)
        {
            TVerificationResult VerificationResult;

            string PublicationCodesToAdd = string.Empty;

            // Disabled selecting all publications for now as report currently cuts them off.
            // Can show a maximum of 8.

            /*if (rbtFromList.Checked)
             * {*/
            string SelectedPublicationCodes = clbPublicationCode.GetCheckedStringList(true);

            PublicationCodesToAdd = clbPublicationCode.GetCheckedStringList(false);

            if (AReportAction == TReportActionEnum.raGenerate)
            {
                if (clbPublicationCode.CheckedItemsCount == 0)
                {
                    VerificationResult = new TVerificationResult(Catalog.GetString("Select Publication Codes"),
                        Catalog.GetString("No Publication Code was selected!"),
                        TResultSeverity.Resv_Critical);
                    FPetraUtilsObject.AddVerificationResult(VerificationResult);
                }
                else if (clbPublicationCode.CheckedItemsCount > 8)
                {
                    VerificationResult = new TVerificationResult(Catalog.GetString("Select Publication Codes"),
                        string.Format(Catalog.GetString("You have selected {0} publications. Please reduce this number to 8 or fewer."),
                            clbPublicationCode.CheckedItemsCount),
                        TResultSeverity.Resv_Critical);
                    FPetraUtilsObject.AddVerificationResult(VerificationResult);
                }
            }

            ACalculator.AddStringParameter("param_clbPublicationCode", SelectedPublicationCodes);

            if (SelectedPublicationCodes.Length > 25)
            {
                SelectedPublicationCodes = "Selected Accounts";
            }

            ACalculator.AddParameter("param_publication_list_title", SelectedPublicationCodes);

            /*}
             * else
             * {
             *  PublicationCodesToAdd = clbPublicationCode.GetAllStringList();
             * }*/

            if (AReportAction == TReportActionEnum.raGenerate)
            {
                StringCollection PublicationCodesToAddSC = StringHelper.GetCSVList(PublicationCodesToAdd, ",");
                int ColumnCounter = 0;
                double Position = 0;

                // add extra parameters for user defined columns
                while (ACalculator.GetParameters().GetParameter("param_calculation", ColumnCounter, -1, eParameterFit.eAllColumnFit) != null)
                {
                    string Description =
                        ACalculator.GetParameters().GetParameter("param_calculation", ColumnCounter, -1, eParameterFit.eAllColumnFit).value.ToString();
                    double Width =
                        ACalculator.GetParameters().GetParameter("ColumnWidth", ColumnCounter, -1, eParameterFit.eAllColumnFit).value.ToDouble();

                    ACalculator.AddParameter("param_label", Description, ColumnCounter);
                    ACalculator.AddParameter("ColumnAlign", "left", ColumnCounter);
                    ACalculator.AddParameter("ColumnCaption", Description, ColumnCounter);
                    ACalculator.AddParameter("ColumnPosition", Position, ColumnCounter);

                    Position += Width;

                    ++ColumnCounter;
                }

                double ColumnWidth = 2.3;

                // add a new column for each publication
                foreach (string Code in PublicationCodesToAddSC)
                {
                    ACalculator.AddParameter("param_calculation", "Publication", ColumnCounter);
                    ACalculator.AddParameter("param_label", "Publication", ColumnCounter);
                    ACalculator.AddParameter("ColumnAlign", "left", ColumnCounter);
                    ACalculator.AddParameter("ColumnCaption", Code, ColumnCounter);
                    ACalculator.AddParameter("ColumnPosition", Position, ColumnCounter);
                    ACalculator.AddParameter("ColumnWidth", ColumnWidth, ColumnCounter);

                    Position += ColumnWidth;

                    ++ColumnCounter;
                }

                ACalculator.SetMaxDisplayColumns(ColumnCounter);

                // get the country code for this openpetra's site ledger
                string CountryCode = TRemote.MPartner.Partner.ServerLookups.WebConnectors.GetCountryCodeFromSiteLedger();
                ACalculator.AddParameter("param_cmbCountryCode", CountryCode);
            }
        }
        private void ReadControlsManual(TRptCalculator ACalc, TReportActionEnum AReportAction)
        {
            if (AReportAction == TReportActionEnum.raGenerate)
            {
                TVerificationResult VerificationResult = null;
                long UnitKey = 0;

                try
                {
                    UnitKey = Convert.ToInt64(txtPartnerKey.Text);
                }
                catch (Exception)
                {
                    UnitKey = 0;
                }

                if (UnitKey == 0)
                {
                    VerificationResult = new TVerificationResult("Insert a valid Key.",
                        "No Unit Key selected!",
                        TResultSeverity.Resv_Critical);
                    FPetraUtilsObject.AddVerificationResult(VerificationResult);
                }
            }

            int ColumnCounter;

            ColumnCounter = 0;
            ACalc.AddParameter("param_calculation", "UnitKey", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", "3", ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "UnitType", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", "4.5", ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "UnitName", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", "12", ColumnCounter);

            ACalc.SetMaxDisplayColumns(3);

            ACalc.AddParameter("param_txtUnitCode", txtPartnerKey.Text);
        }