/// <summary>
        /// Checks the entire gift batch for inactive values and informs the user
        /// </summary>
        /// <param name="AAction"></param>
        /// <param name="AMainDS"></param>
        /// <param name="APetraUtilsObject"></param>
        /// <param name="AIsRecurringGift"></param>
        /// <returns></returns>
        public static bool CheckForConsistentFieldValues(GiftBatchAction AAction,
                                                         GiftBatchTDS AMainDS,
                                                         TFrmPetraEditUtils APetraUtilsObject,
                                                         Boolean AIsRecurringGift = false)
        {
            bool RetVal = false;

            //TODO: check for field value consistency before saving

            //TODO: Check Batch, Gift and Detail key field consistency
            //  e.g. consecutive numbers, last number values etc
            if (!AIsRecurringGift)
            {
            }
            else
            {
            }

            //TODO: Check Method of Payment between Batch and Gift level
            if (!AIsRecurringGift)
            {
            }
            else
            {
            }

            //TODO: Check for Tax value correctness at Gift Detail level
            if (!AIsRecurringGift)
            {
            }

            //Nothing to do for recurring

            return(RetVal);
        }
Beispiel #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="APetraUtilsObject">Reference to the PetraUtilsObject for the form</param>
        /// <param name="ALedgerNumber">Ledger number</param>
        /// <param name="AMainDS">The main data set</param>
        /// <param name="AFilterFindPanelObject">The filter panel control object</param>
        public TUC_GiftBatches_LoadAndFilter(TFrmPetraEditUtils APetraUtilsObject,
                                             int ALedgerNumber,
                                             GiftBatchTDS AMainDS,
                                             TFilterAndFindPanel AFilterFindPanelObject)
        {
            FPetraUtilsObject      = APetraUtilsObject;
            FLedgerNumber          = ALedgerNumber;
            FMainDS                = AMainDS;
            FFilterFindPanelObject = AFilterFindPanelObject;

            FrbtEditing    = (RadioButton)AFilterFindPanelObject.FilterPanelControls.FindControlByName("rbtEditing");
            FrbtPosting    = (RadioButton)AFilterFindPanelObject.FilterPanelControls.FindControlByName("rbtPosting");
            FrbtAll        = (RadioButton)AFilterFindPanelObject.FilterPanelControls.FindControlByName("rbtAll");
            FcmbYearEnding = (TCmbAutoComplete)AFilterFindPanelObject.FilterPanelControls.FindControlByName("cmbYearEnding");
            FcmbPeriod     = (TCmbAutoComplete)AFilterFindPanelObject.FilterPanelControls.FindControlByName("cmbPeriod");

            FMainDS.AGiftBatch.DefaultView.Sort = String.Format("{0}, {1} DESC",
                                                                AGiftBatchTable.GetLedgerNumberDBName(),
                                                                AGiftBatchTable.GetBatchNumberDBName()
                                                                );

            // Populate the Year ComboBox with available years for the specified ledger
            TFinanceControls.InitialiseAvailableGiftYearsList(ref FcmbYearEnding, FLedgerNumber);
            //TLogging.Log("Gift Years completed");

            // Ensure that we start with the status set to 'editing'.
            FrbtEditing.Checked = true;
            //TLogging.Log("Editing checkbox selected");
        }
Beispiel #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 public TUC_GiftBatches_Import(TFrmPetraEditUtils APetraUtilsObject, Int32 ALedgerNumber, IUC_GiftBatches AUserControl)
 {
     FPetraUtilsObject = APetraUtilsObject;
     FLedgerNumber     = ALedgerNumber;
     FMyUserControl    = AUserControl;
     FMyForm           = (TFrmGiftBatch)FPetraUtilsObject.GetForm();
 }
Beispiel #4
0
        /// <summary>
        /// Constructor
        /// </summary>
        public TUC_RecurringGiftBatches_Submit(TFrmPetraEditUtils APetraUtilsObject, Int32 ALedgerNumber, GiftBatchTDS AMainDS)
        {
            FPetraUtilsObject = APetraUtilsObject;
            FLedgerNumber     = ALedgerNumber;
            FMainDS           = AMainDS;

            FMyForm = (TFrmRecurringGiftBatch)FPetraUtilsObject.GetForm();
        }
Beispiel #5
0
        /// <summary>
        /// Constructor
        /// </summary>
        public TUC_GLBatches_Cancel(TFrmPetraEditUtils APetraUtilsObject, Int32 ALedgerNumber, GLBatchTDS AMainDS)
        {
            FPetraUtilsObject = APetraUtilsObject;
            FLedgerNumber     = ALedgerNumber;
            FMainDS           = AMainDS;

            FMyForm = (TFrmGLBatch)FPetraUtilsObject.GetForm();
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public TUC_GLBatches_Post(TFrmPetraEditUtils APetraUtilsObject, Int32 ALedgerNumber, GLBatchTDS AMainDS, IUC_GLBatches AUserControl)
        {
            FPetraUtilsObject = APetraUtilsObject;
            FLedgerNumber     = ALedgerNumber;
            FMainDS           = AMainDS;
            FMyUserControl    = AUserControl;

            FMyForm = (TFrmGLBatch)FPetraUtilsObject.GetForm();
        }
 /// <summary>
 /// Constructor
 /// </summary>
 public MaintainBudget_Import(TFrmPetraEditUtils APetraUtilsObject,
                              Int32 ALedgerNumber,
                              Int32 ANumberOfPeriods,
                              TFrmMaintainBudget AUserControl)
 {
     FPetraUtilsObject = APetraUtilsObject;
     FLedgerNumber     = ALedgerNumber;
     FNumberOfPeriods  = ANumberOfPeriods;
     FUserControl      = AUserControl;
     FParentForm       = AUserControl;
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="APetraUtilsObject">Reference to the PetraUtilsObject for the form</param>
        /// <param name="ALedgerNumber">Ledger number</param>
        /// <param name="AMainDS">The main data set</param>
        /// <param name="AFilterFindPanelObject">The filter panel control object</param>
        public TUC_RecurringGiftBatches_LoadAndFilter(TFrmPetraEditUtils APetraUtilsObject,
                                                      int ALedgerNumber,
                                                      GiftBatchTDS AMainDS,
                                                      TFilterAndFindPanel AFilterFindPanelObject)
        {
            FPetraUtilsObject      = APetraUtilsObject;
            FLedgerNumber          = ALedgerNumber;
            FMainDS                = AMainDS;
            FFilterFindPanelObject = AFilterFindPanelObject;

            FMainDS.ARecurringGiftBatch.DefaultView.Sort = String.Format("{0}, {1} DESC",
                                                                         ARecurringGiftBatchTable.GetLedgerNumberDBName(),
                                                                         ARecurringGiftBatchTable.GetBatchNumberDBName()
                                                                         );
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="APetraUtilsObject">Reference to the PetraUtilsObject for the form</param>
        /// <param name="ALedgerNumber">Ledger number</param>
        /// <param name="AMainDS">The main data set</param>
        /// <param name="AFilterFindPanelObject">The filter panel control object</param>
        public TUC_GLBatches_LoadAndFilter(TFrmPetraEditUtils APetraUtilsObject,
                                           int ALedgerNumber,
                                           GLBatchTDS AMainDS,
                                           TFilterAndFindPanel AFilterFindPanelObject)
        {
            FPetraUtilsObject      = APetraUtilsObject;
            FFilterFindPanelObject = AFilterFindPanelObject;
            FMainDS       = AMainDS;
            FLedgerNumber = ALedgerNumber;

            FcmbYearEnding = (TCmbAutoComplete)AFilterFindPanelObject.FilterPanelControls.FindControlByName("cmbYearEnding");
            FcmbPeriod     = (TCmbAutoComplete)AFilterFindPanelObject.FilterPanelControls.FindControlByName("cmbPeriod");
            FrbtEditing    = (RadioButton)AFilterFindPanelObject.FilterPanelControls.FindControlByName("rbtEditing");
            FrbtPosting    = (RadioButton)AFilterFindPanelObject.FilterPanelControls.FindControlByName("rbtPosting");
            FrbtAll        = (RadioButton)AFilterFindPanelObject.FilterPanelControls.FindControlByName("rbtAll");

            TFinanceControls.InitialiseAvailableFinancialYearsList(ref FcmbYearEnding, FLedgerNumber, false, true);
            //TLogging.Log("GL Financial Years completed");
            FrbtEditing.Checked = true;
            //TLogging.Log("Editing checkbox selected");
        }
        /// <summary>
        /// Looks for gifts where the recipient is an ExWorker and asks the user if they want to continue.
        /// (Make sure GetDataFromControls is called before this method so that AMainDS is up-to-date.)
        /// </summary>
        /// <param name="AAction">Why this method is being called</param>
        /// <param name="AMainDS"></param>
        /// <param name="APetraUtilsObject"></param>
        /// <param name="APostingGiftDetails">Only used when being called in order to carry out a batch posting</param>
        /// <returns>Returns true if saving/posting can continue</returns>
        public static bool CanContinueWithAnyExWorkers(GiftBatchAction AAction,
                                                       GiftBatchTDS AMainDS,
                                                       TFrmPetraEditUtils APetraUtilsObject,
                                                       DataTable APostingGiftDetails = null)
        {
            DataTable ExWorkers     = null;
            string    Msg           = string.Empty;
            int       BatchNumber   = -1;
            int       ExWorkerGifts = 0;

            string ExWorkerSpecialType = TSystemDefaults.GetStringDefault(SharedConstants.SYSDEFAULT_EXWORKERSPECIALTYPE, "EX-WORKER");

            // first check for Ex-Workers in the batch that is being posted/submitted (if a batch is being posted/submitted)
            if ((APostingGiftDetails != null) && (APostingGiftDetails.Rows.Count > 0))
            {
                ExWorkers      = TRemote.MFinance.Gift.WebConnectors.FindGiftRecipientExWorker(APostingGiftDetails, BatchNumber);
                ExWorkerGifts += ExWorkers.Rows.Count;

                Msg = GetExWorkersString(AAction, ExWorkerSpecialType, ExWorkers);

                if (ExWorkers.Rows.Count > 0)
                {
                    BatchNumber = (int)APostingGiftDetails.Rows[0][GiftBatchTDSAGiftDetailTable.GetBatchNumberDBName()];
                }
            }

            // check for Ex-Workers in all added and modified data
            if (APetraUtilsObject.HasChanges)
            {
                DataTable Changes = new DataTable();

                if (AMainDS.AGiftDetail.GetChangesTyped() != null)
                {
                    Changes.Merge(AMainDS.AGiftDetail.GetChangesTyped());
                }
                else if (AMainDS.ARecurringGiftDetail.GetChangesTyped() != null)
                {
                    Changes.Merge(AMainDS.ARecurringGiftDetail.GetChangesTyped());
                }

                if ((Changes != null) && (Changes.Rows.Count > 0))
                {
                    ExWorkers      = TRemote.MFinance.Gift.WebConnectors.FindGiftRecipientExWorker(Changes, BatchNumber);
                    ExWorkerGifts += ExWorkers.Rows.Count;

                    Msg += GetExWorkersString(null, ExWorkerSpecialType, ExWorkers);
                }
            }

            // alert the user to any recipients who are Ex-Workers
            if (Msg != string.Empty)
            {
                if (AAction == GiftBatchAction.SAVING)
                {
                    Msg += Environment.NewLine + Environment.NewLine;
                    Msg += Catalog.GetString("Do you want to continue with saving anyway?");
                }
                else
                {
                    Msg += Environment.NewLine + Environment.NewLine;
                    Msg += Catalog.GetString("(any changes will also need to be saved before ");

                    if (AAction == GiftBatchAction.NEWBATCH)
                    {
                        Msg += Catalog.GetString("a new batch can be created");
                    }
                    else //POSTING, CANCELLING, SUBMITTING, DELETING
                    {
                        Msg += Catalog.GetString("this batch continues with " + AAction.ToString().ToLower());
                    }

                    Msg += ")" + Environment.NewLine + Environment.NewLine;
                    Msg += Catalog.GetString("Do you want to continue?");
                }

                TFrmExtendedMessageBox extendedMessageBox = new TFrmExtendedMessageBox(APetraUtilsObject.GetForm());

                if (extendedMessageBox.ShowDialog(Msg,
                                                  Catalog.GetString("Ex-Workers Found"), string.Empty,
                                                  TFrmExtendedMessageBox.TButtons.embbYesNo,
                                                  TFrmExtendedMessageBox.TIcon.embiWarning)
                    == TFrmExtendedMessageBox.TResult.embrNo)
                {
                    return(false);
                }
            }

            return(true);
        }
        /// <summary>
        /// Checks the entire gift batch for inactive values and informs the user
        /// </summary>
        /// <param name="ALedgerNumber"></param>
        /// <param name="AAction"></param>
        /// <param name="AMainDS"></param>
        /// <param name="APetraUtilsObject"></param>
        /// <param name="AIsRecurringGift"></param>
        /// <returns></returns>
        public static bool CheckForInactiveFieldValues(Int32 ALedgerNumber,
                                                       GiftBatchAction AAction,
                                                       GiftBatchTDS AMainDS,
                                                       TFrmPetraEditUtils APetraUtilsObject,
                                                       Boolean AIsRecurringGift = false)
        {
            #region Validate Arguments

            if (AMainDS == null)
            {
                throw new EFinanceSystemInvalidLedgerNumberException(String.Format(Catalog.GetString(
                                                                                       "Function:{0} - The Gift Batch dataset is empty!"),
                                                                                   Utilities.GetMethodName(true)));
            }
            else if (AMainDS.AGiftBatch.Count == 0)
            {
                throw new ArgumentException(String.Format(Catalog.GetString(
                                                              "Function:{0} - The Gift Batch table contains no batches to validate!"),
                                                          Utilities.GetMethodName(true)));
            }

            #endregion Validate Arguments

            //TODO: Need to rewrite...

            bool RetVal = false;

            bool ChangesAtGiftBatchLevel  = false;
            bool ChangesAtGiftLevel       = false;
            bool ChangesAtGiftDetailLevel = false;

            string IndentifyRecurring = (AIsRecurringGift ? "ARecurring" : "A");
            Type   GiftBatchTableType = Type.GetType(IndentifyRecurring + "GiftBatchTable");


            bool WarnOfInactiveValuesOnPosting = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_WARN_OF_INACTIVE_VALUES_ON_POSTING, true);

            if ((AAction == GiftBatchAction.POSTING) && !WarnOfInactiveValuesOnPosting)
            {
                return(true);
            }

            if (APetraUtilsObject.HasChanges)
            {
                GiftBatchTDS Changes = new GiftBatchTDS();

                //Batch level
                if (!AIsRecurringGift && (AMainDS.AGiftBatch.GetChangesTyped() != null))
                {
                    Changes.Merge(AMainDS.AGiftBatch.GetChangesTyped());
                    ChangesAtGiftBatchLevel = true;
                }
                else if (AIsRecurringGift && (AMainDS.ARecurringGiftBatch.GetChangesTyped() != null))
                {
                    Changes.Merge(AMainDS.ARecurringGiftBatch.GetChangesTyped());
                    ChangesAtGiftBatchLevel = true;
                }

                //Gift level
                if (!AIsRecurringGift && (AMainDS.AGift.GetChangesTyped() != null))
                {
                    Changes.Merge(AMainDS.AGift.GetChangesTyped());
                    ChangesAtGiftLevel = true;
                }
                else if (AIsRecurringGift && (AMainDS.ARecurringGift.GetChangesTyped() != null))
                {
                    Changes.Merge(AMainDS.ARecurringGift.GetChangesTyped());
                    ChangesAtGiftLevel = true;
                }

                //Detail level
                if (!AIsRecurringGift && (AMainDS.AGiftDetail.GetChangesTyped() != null))
                {
                    Changes.Merge(AMainDS.AGiftDetail.GetChangesTyped());
                    ChangesAtGiftDetailLevel = true;
                }
                else if (AIsRecurringGift && (AMainDS.ARecurringGiftDetail.GetChangesTyped() != null))
                {
                    Changes.Merge(AMainDS.ARecurringGiftDetail.GetChangesTyped());
                    ChangesAtGiftDetailLevel = true;
                }

                //Process changes
                if (ChangesAtGiftBatchLevel)
                {
                    //***Batch level
                    //TODO: Check for inactive Bank Cost Centre
                    if (!AIsRecurringGift)
                    {
                    }
                    else
                    {
                        //Recurring gift batch changes
                    }

                    //TODO: Check for inactive Bank Account
                    if (!AIsRecurringGift)
                    {
                    }
                    else
                    {
                        //Recurring gift batch changes
                    }

                    //TODO: Check for inactive Currency Code
                    if (!AIsRecurringGift)
                    {
                    }
                    else
                    {
                        //Recurring gift batch changes
                    }

                    //TODO: Check for inactive Method of Payment
                    if (!AIsRecurringGift)
                    {
                    }
                    else
                    {
                        //Recurring gift batch changes
                    }
                }

                if (ChangesAtGiftLevel)
                {
                    //**Gift-level
                    //TODO: Check for inactive Donor
                    if (!AIsRecurringGift)
                    {
                    }
                    else
                    {
                        //Recurring gift batch changes
                    }

                    //TODO: Check for inactive Method of Payment
                    if (!AIsRecurringGift)
                    {
                    }
                    else
                    {
                        //Recurring gift batch changes
                    }

                    //TODO: Check for inactive Method of Giving
                    if (!AIsRecurringGift)
                    {
                    }
                    else
                    {
                        //Recurring gift batch changes
                    }
                }

                if (ChangesAtGiftDetailLevel)
                {
                    //*Detail-level
                    //TODO: Check for inactive Recipient
                    if (!AIsRecurringGift)
                    {
                    }
                    else
                    {
                        //Recurring gift batch changes
                    }

                    //TODO: Check for inactive Key Ministry
                    if (!AIsRecurringGift)
                    {
                    }
                    else
                    {
                        //Recurring gift batch changes
                    }

                    //TODO: Check for inactive Cost Centre
                    if (!AIsRecurringGift)
                    {
                    }
                    else
                    {
                        //Recurring gift batch changes
                    }

                    //TODO: Check for inactive Account
                    if (!AIsRecurringGift)
                    {
                    }
                    else
                    {
                        //Recurring gift batch changes
                    }

                    //TODO: Check for inactive Tax Account
                    if (!AIsRecurringGift)
                    {
                    }
                    else
                    {
                        //Recurring gift batch changes
                    }

                    //TODO: Check for inactive Motivation Group or Detail
                    if (!AIsRecurringGift)
                    {
                    }
                    else
                    {
                        //Recurring gift batch changes
                    }

                    //TODO: Check for inactive MailingCode
                    if (!AIsRecurringGift)
                    {
                    }
                    else
                    {
                        //Recurring gift batch changes
                    }
                }
            }

            return(RetVal);
        }
Beispiel #12
0
        /// <summary>
        /// Looks for gifts where the recipient is an ExWorker and asks the user if they want to continue.
        /// (Make sure GetDataFromControls is called before this method so that AMainDS is up-to-date.)
        /// </summary>
        /// <param name="AAction">Why this method is being called</param>
        /// <param name="AMainDS"></param>
        /// <param name="APetraUtilsObject"></param>
        /// <param name="APostingGiftDetails">Only used when being called in order to carry out a batch posting</param>
        /// <returns>Returns true if saving/posting can continue</returns>
        public static bool CanContinueWithAnyExWorkers(GiftBatchAction AAction,
                                                       GiftBatchTDS AMainDS,
                                                       TFrmPetraEditUtils APetraUtilsObject,
                                                       DataTable APostingGiftDetails = null)
        {
            DataTable ExWorkers     = null;
            string    Msg           = string.Empty;
            int       BatchNumber   = -1;
            int       ExWorkerGifts = 0;

            string ExWorkerSpecialType = TSystemDefaults.GetSystemDefault(SharedConstants.SYSDEFAULT_EXWORKERSPECIALTYPE, "EX-WORKER");

            // first check for Ex-Workers in the batch that is being posted/submitted (if a batch is being posted/submitted)
            if ((APostingGiftDetails != null) && (APostingGiftDetails.Rows.Count > 0))
            {
                ExWorkers      = TRemote.MFinance.Gift.WebConnectors.FindGiftRecipientExWorker(APostingGiftDetails, BatchNumber);
                ExWorkerGifts += ExWorkers.Rows.Count;

                Msg = GetExWorkersString(AAction, ExWorkerSpecialType, ExWorkers);

                if (ExWorkers.Rows.Count > 0)
                {
                    BatchNumber = (int)APostingGiftDetails.Rows[0][GiftBatchTDSAGiftDetailTable.GetBatchNumberDBName()];
                }
            }

            // check for Ex-Workers in all added and modified data
            if (APetraUtilsObject.HasChanges)
            {
                DataTable Changes = new DataTable();

                if (AMainDS.AGiftDetail.GetChangesTyped() != null)
                {
                    Changes.Merge(AMainDS.AGiftDetail.GetChangesTyped());
                }
                else if (AMainDS.ARecurringGiftDetail.GetChangesTyped() != null)
                {
                    Changes.Merge(AMainDS.ARecurringGiftDetail.GetChangesTyped());
                }

                if ((Changes != null) && (Changes.Rows.Count > 0))
                {
                    ExWorkers      = TRemote.MFinance.Gift.WebConnectors.FindGiftRecipientExWorker(Changes, BatchNumber);
                    ExWorkerGifts += ExWorkers.Rows.Count;

                    Msg += GetExWorkersString(null, ExWorkerSpecialType, ExWorkers);
                }
            }

            // alert the user to any recipients who are Ex-Workers
            if (Msg != string.Empty)
            {
                if (AAction == GiftBatchAction.SAVING)
                {
                    Msg += Catalog.GetString("Do you want to continue with saving anyway?");
                }
                else
                {
                    // singular
                    if (ExWorkerGifts == 1)
                    {
                        if (AAction == GiftBatchAction.POSTING)
                        {
                            Msg += Catalog.GetString("This gift will need to be saved before this batch can be posted.");
                        }
                        else if (AAction == GiftBatchAction.NEWBATCH)
                        {
                            Msg += Catalog.GetString("This gift will need to be saved before a new batch can be created.");
                        }
                        else if (AAction == GiftBatchAction.CANCELLING)
                        {
                            Msg += Catalog.GetString("This gift will need to be saved before this batch can be cancelled.");
                        }
                        else if (AAction == GiftBatchAction.SUBMITTING)
                        {
                            Msg += Catalog.GetString("This gift will need to be saved before this batch can be submitted.");
                        }
                        else if (AAction == GiftBatchAction.DELETING)
                        {
                            Msg += Catalog.GetString("This gift will need to be saved before this batch can be deleted.");
                        }
                    }
                    // plural
                    else
                    {
                        if (AAction == GiftBatchAction.POSTING)
                        {
                            Msg += Catalog.GetString("These gifts will need to be saved before this batch can be posted.");
                        }
                        else if (AAction == GiftBatchAction.NEWBATCH)
                        {
                            Msg += Catalog.GetString("These gifts will need to be saved before a new batch can be created.");
                        }
                        else if (AAction == GiftBatchAction.CANCELLING)
                        {
                            Msg += Catalog.GetString("These gifts will need to be saved before this batch can be cancelled.");
                        }
                        else if (AAction == GiftBatchAction.SUBMITTING)
                        {
                            Msg += Catalog.GetString("These gifts will need to be saved before this batch can be submitted.");
                        }
                        else if (AAction == GiftBatchAction.DELETING)
                        {
                            Msg += Catalog.GetString("These gifts will need to be saved before this batch can be deleted.");
                        }
                    }

                    Msg += " " + Catalog.GetString("Do you want to continue?");
                }

                if (MessageBox.Show(
                        Msg, string.Format(Catalog.GetString("{0} Warning"), ExWorkerSpecialType), MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
                    == DialogResult.No)
                {
                    return(false);
                }
            }

            return(true);
        }