private void ReallocationLoop(TGlmpInfo AGlmpInfo, TCommonAccountingTool YearEndBatch, String AAccountFrom, String ACostCentreFrom) { string strCostCentreTo = TLedgerInfo.GetStandardCostCentre(FledgerInfo.LedgerNumber); string strAccountTo; FaccountInfo.AccountCode = AAccountFrom; Boolean blnDebitCredit = FaccountInfo.DebitCreditIndicator; String narrativeMessage = FstrNarrativeToMessage; string strCCAccoutCode = FaccountInfo.SetCarryForwardAccount(); // Move FaccountInfo to the Carry Forward Account - if there is one. if (FaccountInfo.IsValid) // The CarryForward account exists.. { strAccountTo = FaccountInfo.AccountCode; if (strCCAccoutCode == "SAMECC") { strCostCentreTo = ACostCentreFrom; narrativeMessage = FstrNarrativeFromToMessage; } } else // If there's no Carry Forward account, use EARNINGS_BF_ACCT { FaccountInfo.SetSpecialAccountCode(TAccountPropertyEnum.EARNINGS_BF_ACCT); strAccountTo = FaccountInfo.AccountCode; } if (FledgerInfo.IltAccountFlag) // In either case, change that if ICH_ACCT is set { FaccountInfo.SetSpecialAccountCode(TAccountPropertyEnum.ICH_ACCT); strAccountTo = FaccountInfo.AccountCode; } if (FledgerInfo.BranchProcessing) // Keep the original Cost Centres - don't roll up { strCostCentreTo = ACostCentreFrom; narrativeMessage = FstrNarrativeFromToMessage; } if (FglmInfo.YtdActualBase < 0) { blnDebitCredit = !blnDebitCredit; } Decimal TransactionAmount = Math.Abs(AGlmpInfo.ActualBase); YearEndBatch.AddBaseCurrencyTransaction( AAccountFrom, ACostCentreFrom, String.Format(narrativeMessage, ACostCentreFrom, AAccountFrom, strCostCentreTo, strAccountTo), FstrYearEnd, !blnDebitCredit, TransactionAmount); YearEndBatch.AddBaseCurrencyTransaction( strAccountTo, strCostCentreTo, String.Format(narrativeMessage, ACostCentreFrom, AAccountFrom, strCostCentreTo, strAccountTo), FstrYearEnd, blnDebitCredit, TransactionAmount); }
public void Test_09_TAccountPropertyHandler() { TLedgerInfo tHandleLedgerInfo = new TLedgerInfo(FLedgerNumber); TAccountInfo tHandleAccountInfo = new TAccountInfo(tHandleLedgerInfo.LedgerNumber); tHandleAccountInfo.SetSpecialAccountCode(TAccountPropertyEnum.ICH_ACCT); Assert.IsTrue(tHandleAccountInfo.IsValid, "ICH_ACCT shall exist"); Assert.AreEqual("8500", tHandleAccountInfo.AccountCode); }
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(); }