private void ValidateDataDetailsManual(ACorporateExchangeRateRow ARow)
        {
            TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection;

            TSharedFinanceValidation_GLSetup.ValidateCorporateExchangeRate(this, ARow, ref VerificationResultCollection,
                                                                           FPetraUtilsObject.ValidationControlsDict, FAvailableLedgers, FAlternativeFirstDayInMonth);

            // In MODAL mode we can validate that the date is the same as an accounting period...
        }
Exemple #2
0
        private void ValidateDataDetailsManual(AFeesReceivableRow ARow)
        {
            TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection;

            TSharedFinanceValidation_GLSetup.ValidateAdminGrantReceivable(this, ARow, ref VerificationResultCollection,
                                                                          FPetraUtilsObject.ValidationControlsDict);

            // Need to check the Fee Code has not been used in FeesPayable
            ValidateFeeCode(ARow.FeeCode, VerificationResultCollection);
        }
        private void ValidateRecord(AAccountingPeriodRow ARow, Boolean ACheckGapToPrevious, Boolean ACheckGapToNext)
        {
            TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection;
            DataColumn ValidationColumn;
            TValidationControlsData ValidationControlsData;
            TVerificationResult     VerificationResult = null;
            AAccountingPeriodRow    OtherRow;
            DataRow OtherDataRow;

            string CurrentDateRangeErrorCode;

            if (FDuringSave)
            {
                CurrentDateRangeErrorCode = PetraErrorCodes.ERR_PERIOD_DATE_RANGE;
            }
            else
            {
                CurrentDateRangeErrorCode = PetraErrorCodes.ERR_PERIOD_DATE_RANGE_WARNING;
            }

            // first run through general checks related to the current AccountingPeriod row
            TSharedFinanceValidation_GLSetup.ValidateAccountingPeriod(this, ARow, ref VerificationResultCollection,
                                                                      FPetraUtilsObject.ValidationControlsDict);

            // the following checks need to be done in this ManualCode file as they involve other rows on the screen:

            // check that there is no gap to previous accounting period
            if (ACheckGapToPrevious)
            {
                ValidationColumn = ARow.Table.Columns[AAccountingPeriodTable.ColumnPeriodStartDateId];

                if (FPetraUtilsObject.ValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
                {
                    if (!ARow.IsPeriodStartDateNull() &&
                        (ARow.PeriodStartDate != DateTime.MinValue))
                    {
                        OtherDataRow = FMainDS.AAccountingPeriod.Rows.Find(
                            new string[] { FLedgerNumber.ToString(), (ARow.AccountingPeriodNumber - 1).ToString() });

                        if (OtherDataRow != null)
                        {
                            OtherRow = (AAccountingPeriodRow)OtherDataRow;

                            if (OtherRow.PeriodEndDate != ARow.PeriodStartDate.Date.AddDays(-1))
                            {
                                VerificationResult = new TScreenVerificationResult(new TVerificationResult(this,
                                                                                                           ErrorCodes.GetErrorInfo(CurrentDateRangeErrorCode,
                                                                                                                                   new string[] { (ARow.AccountingPeriodNumber - 1).ToString() })),
                                                                                   ValidationColumn, ValidationControlsData.ValidationControl);
                            }
                            else
                            {
                                VerificationResult = null;
                            }

                            // Handle addition/removal to/from TVerificationResultCollection
                            VerificationResultCollection.Auto_Add_Or_AddOrRemove(this, VerificationResult, ValidationColumn);
                        }
                    }
                }
            }

            // check that there is no gap to next accounting period
            if (ACheckGapToNext)
            {
                ValidationColumn = ARow.Table.Columns[AAccountingPeriodTable.ColumnPeriodEndDateId];

                if (FPetraUtilsObject.ValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
                {
                    if (!ARow.IsPeriodEndDateNull() &&
                        (ARow.PeriodEndDate != DateTime.MinValue))
                    {
                        OtherDataRow = FMainDS.AAccountingPeriod.Rows.Find(
                            new string[] { FLedgerNumber.ToString(), (ARow.AccountingPeriodNumber + 1).ToString() });

                        if (OtherDataRow != null)
                        {
                            OtherRow = (AAccountingPeriodRow)OtherDataRow;

                            if (OtherRow.PeriodStartDate != ARow.PeriodEndDate.Date.AddDays(1))
                            {
                                VerificationResult = new TScreenVerificationResult(new TVerificationResult(this,
                                                                                                           ErrorCodes.GetErrorInfo(CurrentDateRangeErrorCode,
                                                                                                                                   new string[] { (ARow.AccountingPeriodNumber).ToString() })),
                                                                                   ValidationColumn, ValidationControlsData.ValidationControl);
                            }
                            else
                            {
                                VerificationResult = null;
                            }

                            // Handle addition/removal to/from TVerificationResultCollection
                            VerificationResultCollection.Auto_Add_Or_AddOrRemove(this, VerificationResult, ValidationColumn);
                        }
                    }
                }
            }
        }