private void CheckForSuspenseAccounts() { if (suspenseAccountInfo == null) { suspenseAccountInfo = new GetSuspenseAccountInfo(FledgerInfo.LedgerNumber); } if (suspenseAccountInfo.RowCount != 0) { TLogging.LogAtLevel(1, String.Format("MonthEnd: {0} suspense accounts in use.", suspenseAccountInfo.RowCount)); TVerificationResult tvr = new TVerificationResult( Catalog.GetString("Suspense Accounts found"), String.Format( Catalog.GetString( "Have you checked the details of suspense account {0}?"), suspenseAccountInfo.ToString()), "", TPeriodEndErrorAndStatusCodes.PEEC_07.ToString(), TResultSeverity.Resv_Status); FverificationResults.Add(tvr); } /* * else * { * TLogging.LogAtLevel(1, "MonthEnd: No suspense accounts used."); * } */ }
private void CheckForSuspenseAccountsZero() { if (FledgerInfo.CurrentPeriod == FledgerInfo.NumberOfAccountingPeriods) { // This means: The last accounting period of the year is running! if (getSuspenseAccountInfo == null) { getSuspenseAccountInfo = new GetSuspenseAccountInfo(FledgerInfo.LedgerNumber); } if (getSuspenseAccountInfo.RowCount > 0) { ASuspenseAccountRow aSuspenseAccountRow; for (int i = 0; i < getSuspenseAccountInfo.RowCount; ++i) { aSuspenseAccountRow = getSuspenseAccountInfo.Row(i); TGet_GLM_Info get_GLM_Info = new TGet_GLM_Info(FledgerInfo.LedgerNumber, aSuspenseAccountRow.SuspenseAccountCode, FledgerInfo.CurrentFinancialYear); if (get_GLM_Info.GLMExists) { TGlmpInfo get_GLMp_Info = new TGlmpInfo(FledgerInfo.LedgerNumber); get_GLMp_Info.LoadBySequence(get_GLM_Info.Sequence, FledgerInfo.CurrentPeriod); if (get_GLMp_Info.RowExists && (get_GLMp_Info.ActualBase != 0)) { TVerificationResult tvr = new TVerificationResult( Catalog.GetString("Non Zero Suspense Account found"), String.Format(Catalog.GetString("Suspense account {0} has the balance value {1}. It is required to be zero."), getSuspenseAccountInfo.ToString(), get_GLMp_Info.ActualBase), "", TPeriodEndErrorAndStatusCodes.PEEC_07.ToString(), TResultSeverity.Resv_Critical); FverificationResults.Add(tvr); FHasCriticalErrors = true; FverificationResults.Add(tvr); } } } } } } // CheckFor SuspenseAccountsZero
private void CheckForUnpostedBatches() { GetBatchInfo getBatchInfo = new GetBatchInfo( FledgerInfo.LedgerNumber, FledgerInfo.CurrentFinancialYear, FledgerInfo.CurrentPeriod); if (getBatchInfo.NumberOfBatches > 0) { TVerificationResult tvr = new TVerificationResult( Catalog.GetString("Unposted Batches found"), String.Format(Catalog.GetString( "Please post or cancel the batches {0} first!"), getBatchInfo.ToString()), "", TPeriodEndErrorAndStatusCodes.PEEC_06.ToString(), TResultSeverity.Resv_Critical); FverificationResults.Add(tvr); FHasCriticalErrors = true; } }
private void CheckIfRevaluationIsDone() { if (!FInfoMode) { return; } /* * I'm no longer looking at this flag, * since it can be set even though some accounts are left requiring revaluation. * See Mantis 0004059 * * if ((new TLedgerInitFlagHandler(FledgerInfo.LedgerNumber, * TLedgerInitFlagEnum.Revaluation).Flag)) * { * return; // Revaluation has been performed for the current period. * } */ TDBTransaction Transaction = null; DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted, ref Transaction, delegate { // TODO: could also check for the balance in this month of the foreign currency account. if all balances are zero, no revaluation is needed. string testForForeignKeyAccount = String.Format("SELECT COUNT(*) FROM PUB_a_account WHERE {0} = {1} and {2} = true", AAccountTable.GetLedgerNumberDBName(), FledgerInfo.LedgerNumber, AAccountTable.GetForeignCurrencyFlagDBName()); Int32 ForeignAccountCount = Convert.ToInt32(DBAccess.GDBAccessObj.ExecuteScalar(testForForeignKeyAccount, Transaction)); if (ForeignAccountCount > 0) { TVerificationResult tvr = new TVerificationResult( Catalog.GetString("Currency revaluation"), Catalog.GetString( "Before proceeding you may want to revalue the foreign currency accounts."), "", TPeriodEndErrorAndStatusCodes.PEEC_05.ToString(), TResultSeverity.Resv_Noncritical); // Error is non-critical - the user can choose to continue. FverificationResults.Add(tvr); } }); // Get NewOrExisting AutoReadTransaction }
private void CheckForUnpostedGiftBatches() { TAccountPeriodInfo getAccountingPeriodInfo = new TAccountPeriodInfo(FledgerInfo.LedgerNumber, FledgerInfo.CurrentPeriod); GetUnpostedGiftInfo getUnpostedGiftInfo = new GetUnpostedGiftInfo( FledgerInfo.LedgerNumber, getAccountingPeriodInfo.PeriodEndDate); if (getUnpostedGiftInfo.HasRows) { TVerificationResult tvr = new TVerificationResult( Catalog.GetString("Unposted Gift Batches found"), String.Format( "Please post or cancel the gift batches {0} first!", getUnpostedGiftInfo.ToString()), "", TPeriodEndErrorAndStatusCodes.PEEC_08.ToString(), TResultSeverity.Resv_Critical); FverificationResults.Add(tvr); FHasCriticalErrors = true; } }
private void CheckIfRevaluationIsDone() { if ((new TLedgerInitFlagHandler(FledgerInfo.LedgerNumber, TLedgerInitFlagEnum.Revaluation).Flag)) { return; // Revaluation has been performed for the current period. } bool NewTransaction = false; TDBTransaction transaction; try { transaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum, out NewTransaction); // TODO: could also check for the balance in this month of the foreign currency account. if all balances are zero, no revaluation is needed. string testForForeignKeyAccount = String.Format("SELECT COUNT(*) FROM PUB_a_account WHERE {0} = {1} and {2} = true", AAccountTable.GetLedgerNumberDBName(), FledgerInfo.LedgerNumber, AAccountTable.GetForeignCurrencyFlagDBName()); if (Convert.ToInt32(DBAccess.GDBAccessObj.ExecuteScalar(testForForeignKeyAccount, transaction)) != 0) { TVerificationResult tvr = new TVerificationResult( Catalog.GetString("Ledger revaluation"), Catalog.GetString("Please run a foreign currency revaluation first."), "", TPeriodEndErrorAndStatusCodes.PEEC_05.ToString(), TResultSeverity.Resv_Critical); // Error is critical but additional checks can still be done FverificationResults.Add(tvr); FHasCriticalErrors = true; } } finally { if (NewTransaction) { DBAccess.GDBAccessObj.RollbackTransaction(); } } }
private void CheckIfRevaluationIsDone() { if (!FInfoMode) { return; } TLedgerInitFlag flag = new TLedgerInitFlag(FledgerInfo.LedgerNumber, "", null); String RevalAccounts = flag.GetFlagValue(MFinanceConstants.LEDGER_INIT_FLAG_REVAL); if (RevalAccounts == "") { return; // Revaluation has been performed. } TVerificationResult tvr; if (FledgerInfo.CurrentPeriod < FledgerInfo.NumberOfAccountingPeriods) { tvr = new TVerificationResult( Catalog.GetString("Currency revaluation"), String.Format( Catalog.GetString("Before proceeding you may want to revalue foreign currency accounts {0}."), RevalAccounts), "", TPeriodEndErrorAndStatusCodes.PEEC_05.ToString(), TResultSeverity.Resv_Status); // Error is non-critical - the user can choose to continue. } else { tvr = new TVerificationResult( Catalog.GetString("Currency revaluation"), String.Format( Catalog.GetString("The foreign currency accounts {0} need to be revalued."), RevalAccounts), "", TPeriodEndErrorAndStatusCodes.PEEC_05.ToString(), TResultSeverity.Resv_Critical); // Error is critical - the user nust do a reval. } FverificationResults.Add(tvr); }
private void CheckForSuspenseAccounts() { if (getSuspenseAccountInfo == null) { getSuspenseAccountInfo = new GetSuspenseAccountInfo(FledgerInfo.LedgerNumber); } if (getSuspenseAccountInfo.RowCount != 0) { TVerificationResult tvr = new TVerificationResult( Catalog.GetString("Suspense Accounts found"), String.Format( Catalog.GetString( "Have you checked the details of suspense account {0}?"), getSuspenseAccountInfo.ToString()), "", TPeriodEndErrorAndStatusCodes.PEEC_07.ToString(), TResultSeverity.Resv_Status); FverificationResults.Add(tvr); } }
private void CalculateAccountInfo() { FaccountInfo = new TAccountInfo(FledgerInfo); bool blnIncomeFound = false; bool blnExpenseFound = false; String strIncomeAccount = TAccountTypeEnum.Income.ToString(); String strExpenseAccount = TAccountTypeEnum.Expense.ToString(); FaccountInfo.Reset(); FAccountList = new List <String>(); while (FaccountInfo.MoveNext()) { if (FaccountInfo.PostingStatus) { if (FaccountInfo.AccountType == strIncomeAccount) { FAccountList.Add(FaccountInfo.AccountCode); blnIncomeFound = true; } if (FaccountInfo.AccountType == strExpenseAccount) { FAccountList.Add(FaccountInfo.AccountCode); blnExpenseFound = true; } } } if (!blnIncomeFound) { TVerificationResult tvt = new TVerificationResult(Catalog.GetString("No Income Account found"), Catalog.GetString("At least one income account is required."), "", TPeriodEndErrorAndStatusCodes.PEEC_09.ToString(), TResultSeverity.Resv_Critical); FverificationResults.Add(tvt); FHasCriticalErrors = true; } if (!blnExpenseFound) { TVerificationResult tvt = new TVerificationResult(Catalog.GetString("No Expense Account found"), Catalog.GetString("At least one expense account is required."), "", TPeriodEndErrorAndStatusCodes.PEEC_10.ToString(), TResultSeverity.Resv_Critical); FverificationResults.Add(tvt); FHasCriticalErrors = true; } FaccountInfo.SetSpecialAccountCode(TAccountPropertyEnum.ICH_ACCT); if (FaccountInfo.IsValid) { FAccountList.Add(FaccountInfo.AccountCode); } else { TVerificationResult tvt = new TVerificationResult(Catalog.GetString("No ICH_ACCT Account defined"), Catalog.GetString("An ICH Account must be defined."), "", TPeriodEndErrorAndStatusCodes.PEEC_11.ToString(), TResultSeverity.Resv_Critical); FverificationResults.Add(tvt); FHasCriticalErrors = true; } TDBTransaction Transaction = null; DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum, ref Transaction, delegate { FCostCentreTbl = ACostCentreAccess.LoadViaALedger(FledgerInfo.LedgerNumber, Transaction); }); FCostCentreTbl.DefaultView.Sort = ACostCentreTable.GetCostCentreCodeDBName(); }