private void InitializeManualCode()
        {
            tabGiftBatch.Selecting += new TabControlCancelEventHandler(TabSelectionChanging);
            this.tpgRecurringTransactions.Enabled = false;

            // read system and user defaults
            bool DonorZeroIsValid     = TSystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_DONORZEROISVALID, false);
            bool RecipientZeroIsValid = TSystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_RECIPIENTZEROISVALID, false);

            //If user is FINANCE-3 level then their user settings can override system level setting
            FDonorZeroIsValid     = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_DONOR_ZERO_IS_VALID, DonorZeroIsValid);
            FRecipientZeroIsValid = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_RECIPIENT_ZERO_IS_VALID, RecipientZeroIsValid);
            //Use the same setting as for posting
            FWarnOfInactiveValuesOnSubmitting = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_WARN_OF_INACTIVE_VALUES_ON_POSTING, true);
            FNewDonorWarning           = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_NEW_DONOR_ALERT, true);
            mniNewDonorWarning.Checked = FNewDonorWarning;

            // only add this event if the user want a new donor warning (this will still work without the condition)
            if (FNewDonorWarning)
            {
                FPetraUtilsObject.DataSaved += new TDataSavedHandler(FPetraUtilsObject_DataSaved);
            }

            mniFilePrint.Enabled = true;

            // change the event that gets called when 'Save' is clicked (i.e. changed from generated code)
            tbbSave.Click     -= FileSave;
            mniFileSave.Click -= FileSave;
            tbbSave.Click     += FileSaveManual;
            mniFileSave.Click += FileSaveManual;

            tabGiftBatch.GotFocus += new EventHandler(tabGiftBatch_GotFocus);
        }
Exemplo n.º 2
0
        private void LoadReportParams(TRptCalculator ACalc)
        {
            // Add standard parameters for the report header
            ACalc.GetParameters().Add("param_requested_by", UserInfo.GUserInfo.UserID);
            Version ClientVersion = Assembly.GetAssembly(typeof(FastReportsWrapper)).GetName().Version;

            ACalc.GetParameters().Add("param_version", ClientVersion.Major.ToString() + "." +
                                      ClientVersion.Minor.ToString() + "." +
                                      ClientVersion.Build.ToString() + "." +
                                      ClientVersion.Revision.ToString());
            //
            // Some params are always provided for reports:
            bool TaxDeductiblePercentageEnabled =
                TSystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_TAXDEDUCTIBLEPERCENTAGE, false);

            ACalc.AddParameter("param_tax_deductible_pct", TaxDeductiblePercentageEnabled);


            ArrayList  reportParam = ACalc.GetParameters().Elems;
            MethodInfo FastReport_SetParameterValue = FFastReportType.GetMethod("SetParameterValue");

            foreach (Shared.MReporting.TParameter p in reportParam)
            {
                if (p.name.StartsWith("param") && (p.name != "param_calculation"))
                {
                    FastReport_SetParameterValue.Invoke(FfastReportInstance, new object[] { p.name, p.value.ToObject() });
                }
            }
        }
        private void RunOnceOnActivationManual()
        {
            Boolean useGovId = TSystemDefaults.GetBooleanDefault("GovIdEnabled", false);

            if (useGovId)
            {
                pnlRequireBpkCode.Visible           = true;
                chkRequireBpkCode.CheckedChanged   += ChkRequireBpkCode_CheckedChanged;
                chkRequireNoBpkCode.CheckedChanged += ChkRequireNoBpkCode_CheckedChanged;
            }
        }
        private void InitializeManualCode()
        {
            FDonorZeroIsValidSystemDefault     = TSystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_DONORZEROISVALID, false);
            FRecipientZeroIsValidSystemDefault = TSystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_RECIPIENTZEROISVALID, false);

            FInitiallySelectedLedger = TLstTasks.InitiallySelectedLedger;

            //New Donor alert
            FNewDonorAlert           = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_NEW_DONOR_ALERT, true);
            chkNewDonorAlert.Checked = FNewDonorAlert;

            //Donor zero is valid
            FDonorZeroIsValid           = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_DONOR_ZERO_IS_VALID, FDonorZeroIsValidSystemDefault);
            chkDonorZeroIsValid.Checked = FDonorZeroIsValid;

            //Auto-copying fields
            FAutoCopyIncludeMailingCode           = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_AUTO_COPY_INCLUDE_MAILING_CODE, false);
            chkAutoCopyIncludeMailingCode.Checked = FAutoCopyIncludeMailingCode;

            FAutoCopyIncludeComments           = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_AUTO_COPY_INCLUDE_COMMENTS, false);
            chkAutoCopyIncludeComments.Checked = FAutoCopyIncludeComments;

            //Recipient zero is valid
            FRecipientZeroIsValid = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_RECIPIENT_ZERO_IS_VALID,
                                                                    FRecipientZeroIsValidSystemDefault);
            chkRecipientZeroIsValid.Checked = FRecipientZeroIsValid;

            //Allow auto-saving of form
            FAutoSave           = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_AUTO_SAVE, false);
            chkAutoSave.Checked = FAutoSave;

            //Warn of inactive values on posting
            FWarnOfInactiveValuesOnPosting = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_WARN_OF_INACTIVE_VALUES_ON_POSTING,
                                                                             true);
            chkWarnOfInactiveValuesOnPosting.Checked = FWarnOfInactiveValuesOnPosting;

            //Only highest level finance users can change these settings
            if (!UserInfo.GUserInfo.IsInModule("FINANCE-3"))
            {
                chkDonorZeroIsValid.Enabled     = false;
                chkRecipientZeroIsValid.Enabled = false;
            }
            else
            {
                chkDonorZeroIsValid.CheckStateChanged     += new System.EventHandler(ConfirmDonorZeroChange);
                chkRecipientZeroIsValid.CheckStateChanged += new System.EventHandler(ConfirmRecipientZeroChange);
            }
        }
Exemplo n.º 5
0
        private void InitializeManualCode()
        {
            // set the number of days to default according to settings used in System Manager
            String NumberOfDays = TSystemDefaults.GetStringDefault
                                      (SharedConstants.SYSDEFAULT_PURGEEXTRACTS, "no,365").Split(',')[1];

            txtNumberOfDays.NumberValueInt = Convert.ToInt32(NumberOfDays);

            if ((UserInfo.GUserInfo.IsInModule("PTNRADMIN") == false) &&
                (TSystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_MODIFY_PUBLIC_EXTRACTS_REQUIRES_ADMIN, false) == true))
            {
                FRestrictToCurrentClient = true;
                chkAllUsers.Enabled      = false;
                cmbUser.SetSelectedString(UserInfo.GUserInfo.UserID);
                cmbUser.Enabled = false;
            }

            FPurgingSuccessful = false;
        }
        // This function is necessary because there seemed to be no way to get the DataSet back from GetReportDataSet().
        // I tested the obvious (explicit refs didn't work either):
        // DataSet ReportDataSet = null;
        // Thread t = new Thread(() => { ReportDataSet = TRemote.MReporting.WebConnectors.GetReportDataSet("DonorGiftStatement", paramsDictionary); });
        // but ReportDataSet was null afterwards, even if I did a Thread.Join or while (!ThreadFinished){Thread.Sleep(50);}
        private void GetDGSDataSet(ref DataSet Results, Dictionary <String, TVariant> AParameters, ref Boolean ThreadFinished, TRptCalculator ACalc)
        {
            Results = TRemote.MReporting.WebConnectors.GetReportDataSet("DonorGiftStatement", AParameters);

            if ((Results != null) && (Results.Tables["Donors"] != null) && (Results.Tables["Donors"].Rows.Count != 0))
            {
                // Moved this lot in here from LoadReportData() and added AWaitForThreadComplete so that we can keep the progress bar open during this step, which in
                // testing on a large report (~2000 pages) was rather substantial (10-15 seconds) which might lead the user to think it had hung.
                Boolean useGovId = TSystemDefaults.GetBooleanDefault("GovIdEnabled", false);
                ACalc.AddParameter("param_use_gov_id", useGovId);

                // Register datatables with the report
                FPetraUtilsObject.FFastReportsPlugin.RegisterData(Results.Tables["Donors"], "Donors");
                FPetraUtilsObject.FFastReportsPlugin.RegisterData(Results.Tables["PartnersAddresses"], "DonorAddresses");
                FPetraUtilsObject.FFastReportsPlugin.RegisterData(Results.Tables["Recipients"], "Recipients");
                FPetraUtilsObject.FFastReportsPlugin.RegisterData(Results.Tables["Totals"], "Totals");
                FPetraUtilsObject.FFastReportsPlugin.RegisterData(Results.Tables["TaxRef"], "TaxRef");
            }

            ThreadFinished = true;
        }
        private PPartnerRow RetrieveDonorRow(long APartnerKey)
        {
            if (APartnerKey == 0)
            {
                return(null);
            }

            // find PPartnerRow from dataset
            PPartnerRow DonorRow = (PPartnerRow)FMainDS.DonorPartners.Rows.Find(new object[] { APartnerKey });

            // if PPartnerRow cannot be found, load it from db
            if ((DonorRow == null) || (DonorRow[PPartnerTable.GetReceiptEachGiftDBName()] == DBNull.Value))
            {
                PPartnerTable PartnerTable = TRemote.MFinance.Gift.WebConnectors.LoadPartnerData(APartnerKey);

                if ((PartnerTable == null) || (PartnerTable.Rows.Count == 0))
                {
                    // invalid partner
                    return(null);
                }
                else
                {
                    FMainDS.DonorPartners.Merge(PartnerTable);

                    if (TSystemDefaults.GetBooleanDefault("GovIdEnabled", false))
                    {
                        PTaxTable taxTbl = TRemote.MFinance.Gift.WebConnectors.LoadPartnerPtax(APartnerKey);

                        if ((taxTbl != null) && (taxTbl.Rows.Count > 0))
                        {
                            FMainDS.PTax.Merge(taxTbl);
                        }
                    }
                }

                DonorRow = PartnerTable[0];
            }

            return(DonorRow);
        }
Exemplo n.º 8
0
        } // Total Gifts Through Field Month

        /// <summary>
        /// Find all the gifts for a year, returning "worker", "field" and "total" results.
        /// </summary>
        public static DataTable TotalGiftsThroughFieldYear(TParameterList AParameters, TResultList AResults)
        {
            bool TaxDeductiblePercentageEnabled =
                TSystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_TAXDEDUCTIBLEPERCENTAGE, false);

            Int32  LedgerNum     = AParameters.Get("param_ledger_number_i").ToInt32();
            Int32  NumberOfYears = AParameters.Get("param_NumberOfYears").ToInt32();
            string SqlQuery      = "SELECT batch.a_gl_effective_date_d as Date, motive.a_report_column_c AS ReportColumn, ";

            if (AParameters.Get("param_currency").ToString() == "Base")
            {
                SqlQuery += "detail.a_gift_amount_n AS Amount";

                if (TaxDeductiblePercentageEnabled)
                {
                    SqlQuery += ", detail.a_tax_deductible_amount_base_n AS TaxDeductAmount";
                }
            }
            else
            {
                SqlQuery += "detail.a_gift_amount_intl_n AS Amount";

                if (TaxDeductiblePercentageEnabled)
                {
                    SqlQuery += ", detail.a_tax_deductible_amount_intl_n AS TaxDeductAmount";
                }
            }

            SqlQuery += (" FROM PUB_a_gift as gift, PUB_a_gift_detail as detail, PUB_a_gift_batch as batch, PUB_a_motivation_detail AS motive"

                         + " WHERE detail.a_ledger_number_i = " + LedgerNum +
                         " AND batch.a_batch_status_c = 'Posted'" +
                         " AND batch.a_batch_number_i = gift.a_batch_number_i" +
                         " AND batch.a_ledger_number_i = " + LedgerNum

                         + " AND gift.a_ledger_number_i = " + LedgerNum +
                         " AND detail.a_batch_number_i = gift.a_batch_number_i" +
                         " AND detail.a_gift_transaction_number_i = gift.a_gift_transaction_number_i"

                         + " AND motive.a_ledger_number_i = " + LedgerNum +
                         " AND motive.a_motivation_group_code_c = detail.a_motivation_group_code_c" +
                         " AND motive.a_motivation_detail_code_c = detail.a_motivation_detail_code_c" +
                         " AND motive.a_receipt_l=true");

            DataTable      tempTbl     = null;
            TDBTransaction Transaction = null;

            DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted,
                                                                      TEnforceIsolationLevel.eilMinimum,
                                                                      ref Transaction,
                                                                      delegate
            {
                tempTbl = DBAccess.GDBAccessObj.SelectDT(SqlQuery, "result", Transaction);
            });

            DataTable resultTable = new DataTable();

            resultTable.Columns.Add("SummaryYear", typeof(Int32));              //
            resultTable.Columns.Add("YearWorker", typeof(Decimal));             // These are the names of the variables
            resultTable.Columns.Add("YearWorkerCount", typeof(Int32));          // returned by this calculation.
            resultTable.Columns.Add("YearField", typeof(Decimal));              //
            resultTable.Columns.Add("YearFieldCount", typeof(Int32));           //
            resultTable.Columns.Add("YearTotal", typeof(Decimal));              //
            resultTable.Columns.Add("YearTotalCount", typeof(Int32));           //

            resultTable.Columns.Add("YearWorkerTaxDeduct", typeof(Decimal));
            resultTable.Columns.Add("YearFieldTaxDeduct", typeof(Decimal));
            resultTable.Columns.Add("YearTotalTaxDeduct", typeof(Decimal));

            Int32 Year = DateTime.Now.Year;

            for (Int32 YearIdx = 0; YearIdx < NumberOfYears; YearIdx++)
            {
                //TODO: Calendar vs Financial Date Handling - Check if financial year start/end should be used not calendar
                string yearStart = String.Format("#{0:0000}-01-01#", Year - YearIdx);
                string yearEnd   = String.Format("#{0:0000}-12-31#", Year - YearIdx);

                tempTbl.DefaultView.RowFilter = "Date >= " + yearStart + " AND Date < " + yearEnd;

                Decimal WorkerTotal = 0;
                Decimal FieldTotal  = 0;
                Int32   WorkerCount = 0;
                Int32   FieldCount  = 0;
                Int32   TotalCount  = tempTbl.DefaultView.Count;

                Decimal WorkerTotalTaxDeduct = 0;
                Decimal FieldTotalTaxDeduct  = 0;

                for (int i = 0; i < TotalCount; i++)
                {
                    DataRow Row = tempTbl.DefaultView[i].Row;

                    if (Row["ReportColumn"].ToString() == "Worker")
                    {
                        WorkerCount++;
                        WorkerTotal += Convert.ToDecimal(Row["Amount"]);

                        if (TaxDeductiblePercentageEnabled)
                        {
                            WorkerTotalTaxDeduct += Convert.ToDecimal(Row["TaxDeductAmount"]);
                        }
                    }
                    else
                    {
                        FieldCount++;
                        FieldTotal += Convert.ToDecimal(Row["Amount"]);

                        if (TaxDeductiblePercentageEnabled)
                        {
                            FieldTotalTaxDeduct += Convert.ToDecimal(Row["TaxDeductAmount"]);
                        }
                    }
                }

                DataRow resultRow = resultTable.NewRow();

                resultRow["SummaryYear"]     = Year - YearIdx;
                resultRow["YearWorker"]      = WorkerTotal;
                resultRow["YearWorkerCount"] = WorkerCount;
                resultRow["YearField"]       = FieldTotal;
                resultRow["YearFieldCount"]  = FieldCount;
                resultRow["YearTotal"]       = WorkerTotal + FieldTotal;
                resultRow["YearTotalCount"]  = TotalCount;

                resultRow["YearWorkerTaxDeduct"] = WorkerTotalTaxDeduct;
                resultRow["YearFieldTaxDeduct"]  = FieldTotalTaxDeduct;
                resultRow["YearTotalTaxDeduct"]  = WorkerTotalTaxDeduct + FieldTotalTaxDeduct;

                resultTable.Rows.Add(resultRow);
            }

            return(resultTable);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Adds a duplicate Gift Detail (or reversed duplicate GiftDetail) to Gift.
        /// </summary>
        /// <param name="AMainDS"></param>
        /// <param name="AGift"></param>
        /// <param name="AOldGiftDetail"></param>
        /// <param name="AReversal">True for reverse or false for straight duplicate</param>
        /// <param name="ATransaction"></param>
        /// <param name="ARequestParams"></param>
        private static void AddDuplicateGiftDetailToGift(ref GiftBatchTDS AMainDS,
                                                         ref AGiftRow AGift,
                                                         AGiftDetailRow AOldGiftDetail,
                                                         bool AReversal,
                                                         TDBTransaction ATransaction,
                                                         Hashtable ARequestParams = null)
        {
            bool TaxDeductiblePercentageEnabled =
                TSystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_TAXDEDUCTIBLEPERCENTAGE, false);

            GiftAdjustmentFunctionEnum Function = (GiftAdjustmentFunctionEnum)ARequestParams["Function"];

            AGiftDetailRow giftDetail = AMainDS.AGiftDetail.NewRowTyped(true);

            DataUtilities.CopyAllColumnValuesWithoutPK(AOldGiftDetail, giftDetail);

            giftDetail.DetailNumber = AGift.LastDetailNumber + 1;
            AGift.LastDetailNumber++;

            giftDetail.LedgerNumber          = AGift.LedgerNumber;
            giftDetail.BatchNumber           = AGift.BatchNumber;
            giftDetail.GiftTransactionNumber = AGift.GiftTransactionNumber;

            decimal signum = (AReversal) ? -1 : 1;

            giftDetail.GiftTransactionAmount = signum * AOldGiftDetail.GiftTransactionAmount;
            giftDetail.GiftAmount            = signum * AOldGiftDetail.GiftAmount;
            giftDetail.GiftAmountIntl        = signum * AOldGiftDetail.GiftAmountIntl;

            if (TaxDeductiblePercentageEnabled)
            {
                if (!AReversal && Function.Equals(GiftAdjustmentFunctionEnum.TaxDeductiblePctAdjust))
                {
                    giftDetail.TaxDeductiblePct = Convert.ToDecimal(ARequestParams["NewPct"]);
                    TaxDeductibility.UpdateTaxDeductibiltyAmounts(ref giftDetail);
                }
                else if (!AReversal)
                {
                    if (ARequestParams.ContainsKey("UpdateTaxDeductiblePct"))
                    {
                        List <string[]> UpdateTaxDeductiblePctRecipeints = (List <string[]>)ARequestParams["UpdateTaxDeductiblePct"];
                        string[]        Result = UpdateTaxDeductiblePctRecipeints.Find(x => x[0] == giftDetail.RecipientKey.ToString());

                        // true if a new percentage is available and the user wants to use it
                        if (Result != null)
                        {
                            giftDetail.TaxDeductiblePct = Convert.ToDecimal(Result[1]);
                            TaxDeductibility.UpdateTaxDeductibiltyAmounts(ref giftDetail);
                        }
                    }
                }
                else
                {
                    giftDetail.TaxDeductibleAmount     = signum * AOldGiftDetail.TaxDeductibleAmount;
                    giftDetail.TaxDeductibleAmountBase = signum * AOldGiftDetail.TaxDeductibleAmountBase;
                    giftDetail.TaxDeductibleAmountIntl = signum * AOldGiftDetail.TaxDeductibleAmountIntl;
                    giftDetail.NonDeductibleAmount     = signum * AOldGiftDetail.NonDeductibleAmount;
                    giftDetail.NonDeductibleAmountBase = signum * AOldGiftDetail.NonDeductibleAmountBase;
                    giftDetail.NonDeductibleAmountIntl = signum * AOldGiftDetail.NonDeductibleAmountIntl;
                }
            }

            if (ARequestParams != null)
            {
                if ((bool)ARequestParams["AutoCompleteComments"]) // only used for tax deductible pct gift adjustments
                {
                    AGiftRow OldGiftRow = (AGiftRow)AMainDS.AGift.Rows.Find(
                        new object[] { AOldGiftDetail.LedgerNumber, AOldGiftDetail.BatchNumber, AOldGiftDetail.GiftTransactionNumber });

                    giftDetail.GiftCommentThree = Catalog.GetString("Original gift date: " + OldGiftRow.DateEntered.ToString("dd-MMM-yyyy"));
                    giftDetail.CommentThreeType = "Both";
                }
                else // user defined
                {
                    giftDetail.GiftCommentOne   = (String)ARequestParams["ReversalCommentOne"];
                    giftDetail.GiftCommentTwo   = (String)ARequestParams["ReversalCommentTwo"];
                    giftDetail.GiftCommentThree = (String)ARequestParams["ReversalCommentThree"];
                    giftDetail.CommentOneType   = (String)ARequestParams["ReversalCommentOneType"];
                    giftDetail.CommentTwoType   = (String)ARequestParams["ReversalCommentTwoType"];
                    giftDetail.CommentThreeType = (String)ARequestParams["ReversalCommentThreeType"];
                }
            }

            // If reversal: mark the new gift as a reversal
            if (AReversal)
            {
                giftDetail.ModifiedDetail = true;

                //Identify the reversal source
                giftDetail.ModifiedDetailKey = "|" + AOldGiftDetail.BatchNumber.ToString() + "|" +
                                               AOldGiftDetail.GiftTransactionNumber.ToString() + "|" +
                                               AOldGiftDetail.DetailNumber.ToString();
            }
            else
            {
                giftDetail.ModifiedDetail = false;

                // Make sure the motivation detail is still active. If not then we need a new one.
                AMotivationDetailTable MotivationDetailTable = AMotivationDetailAccess.LoadViaAMotivationGroup(
                    giftDetail.LedgerNumber, giftDetail.MotivationGroupCode, ATransaction);
                DataRow CurrentMotivationDetail = MotivationDetailTable.Rows.Find(
                    new object[] { giftDetail.LedgerNumber, giftDetail.MotivationGroupCode, giftDetail.MotivationDetailCode });

                // Motivation detail has been made inactive (or doesn't exist) then use default
                if (!((MotivationDetailTable != null) && (MotivationDetailTable.Rows.Count > 0) && (CurrentMotivationDetail != null)) ||
                    !Convert.ToBoolean(CurrentMotivationDetail[AMotivationDetailTable.GetMotivationStatusDBName()]))
                {
                    bool ActiveRowFound = false;

                    // search for first alternative active detail that is part of the same group
                    foreach (AMotivationDetailRow Row in MotivationDetailTable.Rows)
                    {
                        if ((Row.MotivationDetailCode != giftDetail.MotivationDetailCode) && Row.MotivationStatus)
                        {
                            ActiveRowFound = true;
                            giftDetail.MotivationGroupCode  = Row.MotivationGroupCode;
                            giftDetail.MotivationDetailCode = Row.MotivationDetailCode;
                            break;
                        }
                    }

                    // if none found then use default group and detail
                    if (!ActiveRowFound)
                    {
                        giftDetail.MotivationGroupCode  = MFinanceConstants.MOTIVATION_GROUP_GIFT;
                        giftDetail.MotivationDetailCode = MFinanceConstants.GROUP_DETAIL_SUPPORT;
                    }
                }

                // if the gift destination should be fixed
                if (ARequestParams.ContainsKey("FixedGiftDestination") &&
                    (Function.Equals(GiftAdjustmentFunctionEnum.TaxDeductiblePctAdjust) && (bool)ARequestParams["FixedGiftDestination"] ||
                     (((List <string>)ARequestParams["FixedGiftDestination"]).Exists(x => x == giftDetail.RecipientKey.ToString()))))
                {
                    giftDetail.FixedGiftDestination = true;
                }
                else
                {
                    giftDetail.FixedGiftDestination = false;
                }
            }

            AMainDS.AGiftDetail.Rows.Add(giftDetail);
        }
Exemplo n.º 10
0
        /// <summary>
        /// get the details of the last gift of the partner
        /// </summary>
        /// <param name="APartnerKey"></param>
        /// <param name="ALastGiftDate"></param>
        /// <param name="AGiftInfo"></param>
        public static void GetLastGiftDetails(Int64 APartnerKey, out DateTime ALastGiftDate, out String AGiftInfo)
        {
            Boolean  LastGiftAvailable;
            DateTime LastGiftDate;
            decimal  LastGiftAmount;
            Int64    LastGiftGivenToPartnerKey;
            Int64    LastGiftRecipientLedger;
            String   LastGiftCurrencyCode;
            String   LastGiftDisplayFormat;
            String   LastGiftGivenToShortName;
            String   LastGiftRecipientLedgerShortName;
            Boolean  RestrictedGiftAccessDenied;

            AGiftInfo     = "";
            ALastGiftDate = DateTime.MinValue;

            TSystemDefaults SystemDefaults = new TSystemDefaults();

            LastGiftAvailable = GetLastGiftDetails(APartnerKey,
                                                   out LastGiftDate,
                                                   out LastGiftAmount,
                                                   out LastGiftGivenToPartnerKey,
                                                   out LastGiftRecipientLedger,
                                                   out LastGiftCurrencyCode,
                                                   out LastGiftDisplayFormat,
                                                   out LastGiftGivenToShortName,
                                                   out LastGiftRecipientLedgerShortName,
                                                   out RestrictedGiftAccessDenied);

            if (LastGiftAvailable)
            {
                ALastGiftDate = LastGiftDate;

                if (SystemDefaults.GetStringDefault(SharedConstants.SYSDEFAULT_DISPLAYGIFTAMOUNT).ToLower() == "true")
                {
                    // Check OpenPetra Module access to FINANCE-1 or Financial Development
                    if (UserInfo.GetUserInfo().IsInModule(SharedConstants.PETRAMODULE_FINANCE1) ||
                        UserInfo.GetUserInfo().IsInModule(SharedConstants.PETRAMODULE_DEVUSER))
                    {
                        if (LastGiftCurrencyCode != "")
                        {
                            AGiftInfo = LastGiftCurrencyCode + ' ' + StringHelper.FormatCurrency(LastGiftAmount, LastGiftDisplayFormat) + "  ";
                        }
                        else
                        {
                            AGiftInfo = LastGiftAmount.ToString() + "  ";
                        }
                    }
                }

                if (LastGiftGivenToPartnerKey == -1)
                {
                    // Split Gift
                    if ((SystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_DISPLAYGIFTRECIPIENT)) ||
                        (SystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_DISPLAYGIFTFIELD)))
                    {
                        AGiftInfo = AGiftInfo + StrSplitGift;
                    }
                }
                else
                {
                    // Not a Split Gift
                    if (SystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_DISPLAYGIFTRECIPIENT))
                    {
                        if (LastGiftGivenToPartnerKey != -1)
                        {
                            AGiftInfo = AGiftInfo + LastGiftGivenToShortName;
                        }
                        else
                        {
                            AGiftInfo = AGiftInfo + LastGiftGivenToPartnerKey.ToString();
                        }
                    }

                    if (SystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_DISPLAYGIFTFIELD))
                    {
                        if (LastGiftRecipientLedger != -1)
                        {
                            AGiftInfo = AGiftInfo + " (" + LastGiftRecipientLedgerShortName + ')';
                        }
                        else
                        {
                            AGiftInfo = AGiftInfo + " (" + LastGiftRecipientLedger.ToString() + ')';
                        }
                    }
                }
            }
            else
            {
                if (!RestrictedGiftAccessDenied)
                {
                    ALastGiftDate = TSaveConvert.ObjectToDate(LastGiftDate);
                    AGiftInfo     = "";
                }
                else
                {
                    AGiftInfo = Catalog.GetString("** confidential **");
                }
            }
        }