public void Test_03_TAccountPeriodInfo() { TAccountPeriodInfo getAPI = new TAccountPeriodInfo(LedgerNumber); getAPI.AccountingPeriodNumber = 2; Assert.AreNotEqual(DateTime.MinValue, getAPI.PeriodStartDate, "Simple Date Check"); Assert.AreNotEqual(DateTime.MinValue, getAPI.PeriodEndDate, "Simple Date Check"); }
private void AddAJournal(decimal AExchangeRateToBase) { if (blnInitBatchDate) { TAccountPeriodInfo getAccountingPeriodInfo = new TAccountPeriodInfo(FLedgerInfo.LedgerNumber, FLedgerInfo.CurrentPeriod); FBatchRow.DateEffective = getAccountingPeriodInfo.PeriodEndDate; blnInitBatchDate = false; } if (FJournalCount != 0) { // The checksum of the "last journal" is used to update the checksum of the batch. FBatchRow.BatchControlTotal += FJournalRow.JournalDebitTotal - FJournalRow.JournalCreditTotal; } ++FJournalCount; FJournalRow = FBatchTDS.AJournal.NewRowTyped(); FJournalRow.LedgerNumber = FBatchRow.LedgerNumber; FJournalRow.BatchNumber = FBatchRow.BatchNumber; FJournalRow.JournalNumber = FJournalCount; FJournalRow.DateEffective = FBatchRow.DateEffective; FJournalRow.JournalPeriod = FLedgerInfo.CurrentPeriod; FJournalRow.TransactionCurrency = (FForeignJournal) ? FForeignCurrencyInfo.CurrencyCode : FBaseCurrencyInfo.CurrencyCode; FJournalRow.JournalDescription = FBatchRow.BatchDescription; FJournalRow.TransactionTypeCode = CommonAccountingTransactionTypesEnum.STD.ToString(); FJournalRow.SubSystemCode = CommonAccountingSubSystemsEnum.GL.ToString(); FJournalRow.LastTransactionNumber = 0; FJournalRow.DateOfEntry = DateTime.Now; FJournalRow.ExchangeRateToBase = AExchangeRateToBase; FJournalRow.JournalCreditTotal = 0; FJournalRow.JournalDebitTotal = 0; FBatchTDS.AJournal.Rows.Add(FJournalRow); blnReadyForTransaction = true; }
public void Test_PEMM_04_UnpostedGifts() { TAccountPeriodInfo getAccountingPeriodInfo = new TAccountPeriodInfo(FLedgerNumber, new TLedgerInfo( FLedgerNumber).CurrentPeriod); ImportGiftBatch(getAccountingPeriodInfo.PeriodStartDate); TVerificationResultCollection verificationResult; bool blnHasErrors = TPeriodIntervalConnector.PeriodMonthEnd( FLedgerNumber, true, out verificationResult); bool blnStatusArrived = false; for (int i = 0; i < verificationResult.Count; ++i) { if (verificationResult[i].ResultCode.Equals( TPeriodEndErrorAndStatusCodes.PEEC_08.ToString())) { blnStatusArrived = true; Assert.IsTrue(verificationResult[i].ResultSeverity == TResultSeverity.Resv_Critical, "Value shall be of type critical ..."); } } Assert.IsTrue(blnStatusArrived, "Message has not been shown"); Assert.IsTrue(blnHasErrors, "This is a Critical Message"); }
public void Test_YearEnd() { intLedgerNumber = CommonNUnitFunctions.CreateNewLedger(); TLedgerInfo LedgerInfo = new TLedgerInfo(intLedgerNumber); Assert.AreEqual(0, LedgerInfo.CurrentFinancialYear, "Before YearEnd, we should be in year 0"); TAccountPeriodInfo periodInfo = new TAccountPeriodInfo(intLedgerNumber, 1); Assert.AreEqual(new DateTime(DateTime.Now.Year, 1, 1), periodInfo.PeriodStartDate, "Calendar from base database should start with January 1st of this year"); CommonNUnitFunctions.LoadTestDataBase("csharp\\ICT\\Testing\\lib\\MFinance\\GL\\test-sql\\gl-test-year-end.sql", intLedgerNumber); TCommonAccountingTool commonAccountingTool = new TCommonAccountingTool(intLedgerNumber, "NUNIT"); commonAccountingTool.AddBaseCurrencyJournal(); commonAccountingTool.JournalDescription = "Test Data accounts"; string strAccountGift = "0200"; string strAccountBank = "6200"; string strAccountExpense = "4100"; // Accounting of some gifts ... commonAccountingTool.AddBaseCurrencyTransaction( strAccountBank, "4301", "Gift Example", "Debit", MFinanceConstants.IS_DEBIT, 100); commonAccountingTool.AddBaseCurrencyTransaction( strAccountBank, "4302", "Gift Example", "Debit", MFinanceConstants.IS_DEBIT, 200); commonAccountingTool.AddBaseCurrencyTransaction( strAccountBank, "4303", "Gift Example", "Debit", MFinanceConstants.IS_DEBIT, 300); commonAccountingTool.AddBaseCurrencyTransaction( strAccountGift, "4301", "Gift Example", "Credit", MFinanceConstants.IS_CREDIT, 100); commonAccountingTool.AddBaseCurrencyTransaction( strAccountGift, "4302", "Gift Example", "Credit", MFinanceConstants.IS_CREDIT, 200); commonAccountingTool.AddBaseCurrencyTransaction( strAccountGift, "4303", "Gift Example", "Credit", MFinanceConstants.IS_CREDIT, 300); // Accounting of some expenses ... commonAccountingTool.AddBaseCurrencyTransaction( strAccountExpense, "4301", "Expense Example", "Debit", MFinanceConstants.IS_DEBIT, 150); commonAccountingTool.AddBaseCurrencyTransaction( strAccountExpense, "4302", "Expense Example", "Debit", MFinanceConstants.IS_DEBIT, 150); commonAccountingTool.AddBaseCurrencyTransaction( strAccountExpense, "4303", "Expense Example", "Debit", MFinanceConstants.IS_DEBIT, 200); commonAccountingTool.AddBaseCurrencyTransaction( strAccountBank, "4301", "Expense Example", "Credit", MFinanceConstants.IS_CREDIT, 150); commonAccountingTool.AddBaseCurrencyTransaction( strAccountBank, "4302", "Expense Example", "Credit", MFinanceConstants.IS_CREDIT, 150); commonAccountingTool.AddBaseCurrencyTransaction( strAccountBank, "4303", "Expense Example", "Credit", MFinanceConstants.IS_CREDIT, 200); commonAccountingTool.CloseSaveAndPost(); // returns true if posting seemed to work TVerificationResultCollection verificationResult = new TVerificationResultCollection(); bool blnLoop = true; while (blnLoop) { if (LedgerInfo.ProvisionalYearEndFlag) { blnLoop = false; } else { TVerificationResultCollection VerificationResult; TPeriodIntervalConnector.PeriodMonthEnd(intLedgerNumber, false, out VerificationResult); CommonNUnitFunctions.EnsureNullOrOnlyNonCriticalVerificationResults(VerificationResult, "Running MonthEnd gave critical error"); } } // check before year end that income and expense accounts are not 0 int intYear = 0; CheckGLMEntry(intLedgerNumber, intYear, strAccountBank, -50, 0, 50, 0, 100, 0); CheckGLMEntry(intLedgerNumber, intYear, strAccountExpense, 150, 0, 150, 0, 200, 0); CheckGLMEntry(intLedgerNumber, intYear, strAccountGift, 100, 0, 200, 0, 300, 0); // test that we cannot post to period 12 anymore, all periods are closed? LedgerInfo = new TLedgerInfo(intLedgerNumber); Assert.AreEqual(true, LedgerInfo.ProvisionalYearEndFlag, "Provisional YearEnd flag should be set"); Assert.AreEqual(TYearEndProcessStatus.RESET_STATUS, (TYearEndProcessStatus)LedgerInfo.YearEndProcessStatus, "YearEnd process status should be still on RESET"); // // Reallocation is never called explicitly like this - it's not really appropriate // because I'm about to call it again as part of YearEnd, below. // But a tweak in the reallocation code means that it should now cope with being called twice. TReallocation reallocation = new TReallocation(LedgerInfo); reallocation.VerificationResultCollection = verificationResult; reallocation.IsInInfoMode = false; reallocation.RunOperation(); // check amounts after reallocation CheckGLMEntry(intLedgerNumber, intYear, strAccountBank, -50, 0, 50, 0, 100, 0); CheckGLMEntry(intLedgerNumber, intYear, strAccountExpense, 0, -150, 0, -150, 0, -200); CheckGLMEntry(intLedgerNumber, intYear, strAccountGift, 0, -100, 0, -200, 0, -300); // first run in info mode TPeriodIntervalConnector.PeriodYearEnd(intLedgerNumber, true, out verificationResult); CommonNUnitFunctions.EnsureNullOrOnlyNonCriticalVerificationResults(verificationResult, "YearEnd test should not have critical errors"); // now run for real TPeriodIntervalConnector.PeriodYearEnd(intLedgerNumber, false, out verificationResult); CommonNUnitFunctions.EnsureNullOrOnlyNonCriticalVerificationResults(verificationResult, "YearEnd should not have critical errors"); ++intYear; // check after year end that income and expense accounts are 0, bank account remains CheckGLMEntry(intLedgerNumber, intYear, strAccountBank, -50, 0, 50, 0, 100, 0); CheckGLMEntry(intLedgerNumber, intYear, strAccountExpense, 0, 0, 0, 0, 0, 0); CheckGLMEntry(intLedgerNumber, intYear, strAccountGift, 0, 0, 0, 0, 0, 0); // also check the glm period records CheckGLMPeriodEntry(intLedgerNumber, intYear, 1, strAccountBank, -50, 50, 100); CheckGLMPeriodEntry(intLedgerNumber, intYear, 1, strAccountExpense, 0, 0, 0); CheckGLMPeriodEntry(intLedgerNumber, intYear, 1, strAccountGift, 0, 0, 0); // 9700 is the account that the expenses and income from last year is moved to TGlmInfo glmInfo = new TGlmInfo(intLedgerNumber, intYear, "9700"); glmInfo.Reset(); Assert.IsTrue(glmInfo.MoveNext(), "9700 account not found"); Assert.AreEqual(100, glmInfo.YtdActualBase); Assert.AreEqual(0, glmInfo.ClosingPeriodActualBase); LedgerInfo = new TLedgerInfo(intLedgerNumber); Assert.AreEqual(1, LedgerInfo.CurrentFinancialYear, "After YearEnd, we are in a new financial year"); Assert.AreEqual(1, LedgerInfo.CurrentPeriod, "After YearEnd, we are in Period 1"); Assert.AreEqual(false, LedgerInfo.ProvisionalYearEndFlag, "After YearEnd, ProvisionalYearEnd flag should not be set"); Assert.AreEqual(TYearEndProcessStatus.RESET_STATUS, (TYearEndProcessStatus)LedgerInfo.YearEndProcessStatus, "after year end, year end process status should be RESET"); periodInfo = new TAccountPeriodInfo(intLedgerNumber, 1); Assert.AreEqual(new DateTime(DateTime.Now.Year + 1, 1, 1), periodInfo.PeriodStartDate, "new Calendar should start with January 1st of next year"); }
public void Test_TAccountPeriodToNewYear() { // create new ledger which is in year 2010 int intLedgerNumber2010 = CommonNUnitFunctions.CreateNewLedger(new DateTime(2010, 1, 1)); // We are in 2010 and this and 2011 is not a leap year TVerificationResultCollection verificationResult = new TVerificationResultCollection(); TAccountPeriodToNewYear accountPeriodToNewYear = new TAccountPeriodToNewYear(intLedgerNumber2010); accountPeriodToNewYear.VerificationResultCollection = verificationResult; accountPeriodToNewYear.IsInInfoMode = false; // RunEndOfPeriodOperation ... accountPeriodToNewYear.RunOperation(); TAccountPeriodInfo accountPeriodInfo = new TAccountPeriodInfo(intLedgerNumber2010); accountPeriodInfo.AccountingPeriodNumber = 2; Assert.AreEqual(2011, accountPeriodInfo.PeriodStartDate.Year, "Test of the year"); Assert.AreEqual(28, accountPeriodInfo.PeriodEndDate.Day, "Test of the Feb. 28th"); // Switch to 2012 - this is a leap year ... accountPeriodToNewYear = new TAccountPeriodToNewYear(intLedgerNumber2010); accountPeriodToNewYear.IsInInfoMode = false; accountPeriodToNewYear.RunOperation(); accountPeriodInfo = new TAccountPeriodInfo(intLedgerNumber2010); accountPeriodInfo.AccountingPeriodNumber = 2; Assert.AreEqual(29, accountPeriodInfo.PeriodEndDate.Day, "Test of the Feb. 29th"); }
public void Test_2YearEnds() { intLedgerNumber = CommonNUnitFunctions.CreateNewLedger(); CommonNUnitFunctions.LoadTestDataBase("csharp\\ICT\\Testing\\lib\\MFinance\\GL\\test-sql\\gl-test-year-end.sql", intLedgerNumber); TLedgerInfo LedgerInfo = new TLedgerInfo(intLedgerNumber); for (int countYear = 0; countYear < 2; countYear++) { TLogging.Log("preparing year number " + countYear.ToString()); // accounting one gift string strAccountGift = "0200"; string strAccountBank = "6200"; TCommonAccountingTool commonAccountingTool = new TCommonAccountingTool(intLedgerNumber, "NUNIT"); commonAccountingTool.AddBaseCurrencyJournal(); commonAccountingTool.JournalDescription = "Test Data accounts"; commonAccountingTool.AddBaseCurrencyTransaction( strAccountBank, "4301", "Gift Example", "Debit", MFinanceConstants.IS_DEBIT, 100); commonAccountingTool.AddBaseCurrencyTransaction( strAccountGift, "4301", "Gift Example", "Credit", MFinanceConstants.IS_CREDIT, 100); Boolean PostedOk = commonAccountingTool.CloseSaveAndPost(); // returns true if posting seemed to work Assert.AreEqual(true, PostedOk, "Test batch can't be posted"); bool blnLoop = true; while (blnLoop) { // System.Windows.Forms.MessageBox.Show(LedgerInfo.CurrentPeriod.ToString(), "MonthEnd Period"); if (LedgerInfo.ProvisionalYearEndFlag) { blnLoop = false; } else { TVerificationResultCollection VerificationResult; TPeriodIntervalConnector.PeriodMonthEnd(intLedgerNumber, false, out VerificationResult); CommonNUnitFunctions.EnsureNullOrOnlyNonCriticalVerificationResults(VerificationResult, "MonthEnd gave critical error at Period" + LedgerInfo.CurrentPeriod + ":\r\n"); } } TLogging.Log("Closing year number " + countYear.ToString()); TReallocation reallocation = new TReallocation(LedgerInfo); TVerificationResultCollection verificationResult = new TVerificationResultCollection(); reallocation.VerificationResultCollection = verificationResult; reallocation.IsInInfoMode = false; // Assert.AreEqual(1, reallocation.GetJobSize(), "Check 1 reallocation job is required"); // No job size is published by Reallocation reallocation.RunOperation(); TYearEnd YearEndOperator = new TYearEnd(LedgerInfo); TGlmNewYearInit glmNewYearInit = new TGlmNewYearInit(LedgerInfo, countYear, YearEndOperator); glmNewYearInit.VerificationResultCollection = verificationResult; glmNewYearInit.IsInInfoMode = false; // Assert.Greater(glmNewYearInit.GetJobSize(), 0, "Check that NewYearInit has work to do"); // in this version, GetJobSize returns 0 glmNewYearInit.RunOperation(); } Assert.AreEqual(2, LedgerInfo.CurrentFinancialYear, "After YearEnd, Ledger is in year 2"); TAccountPeriodInfo periodInfo = new TAccountPeriodInfo(intLedgerNumber, 1); Assert.AreEqual(new DateTime(DateTime.Now.Year + 2, 1, 1), periodInfo.PeriodStartDate, "new Calendar should start with January 1st of next year"); }
/// <summary> /// Populate ledger with gifts and invoices, post batches, close periods and years, according to FNumberOfClosedPeriods /// </summary> public static void PopulateData(string datadirectory, bool smallNumber = false) { int periodOverall = 0; int yearCounter = 0; int period = 1; int YearAD = DateTime.Today.Year - (FNumberOfClosedPeriods / 12); SampleDataGiftBatches.FLedgerNumber = FLedgerNumber; SampleDataAccountsPayable.FLedgerNumber = FLedgerNumber; SampleDataGiftBatches.LoadBatches(Path.Combine(datadirectory, "donations.csv"), smallNumber); SampleDataAccountsPayable.GenerateInvoices(Path.Combine(datadirectory, "invoices.csv"), YearAD, smallNumber); while (periodOverall <= FNumberOfClosedPeriods) { TLogging.LogAtLevel(1, "working on year " + yearCounter.ToString() + " / period " + period.ToString()); SampleDataGiftBatches.CreateGiftBatches(period); if (!SampleDataGiftBatches.PostBatches(yearCounter, period, (periodOverall == FNumberOfClosedPeriods) ? 1 : 0)) { throw new Exception("could not post gift batches"); } if (!SampleDataAccountsPayable.PostAndPayInvoices(yearCounter, period, (periodOverall == FNumberOfClosedPeriods) ? 1 : 0)) { throw new Exception("could not post invoices"); } TLedgerInfo LedgerInfo = new TLedgerInfo(FLedgerNumber); if (periodOverall < FNumberOfClosedPeriods) { TAccountPeriodInfo AccountingPeriodInfo = new TAccountPeriodInfo(FLedgerNumber, period); TLogging.Log("closing period at " + AccountingPeriodInfo.PeriodEndDate.ToShortDateString()); // run month end TMonthEnd MonthEndOperator = new TMonthEnd(LedgerInfo); MonthEndOperator.SetNextPeriod(); if (period == 12) { TYearEnd YearEndOperator = new TYearEnd(LedgerInfo); // run year end TVerificationResultCollection verificationResult = new TVerificationResultCollection(); TReallocation reallocation = new TReallocation(LedgerInfo); reallocation.VerificationResultCollection = verificationResult; reallocation.IsInInfoMode = false; reallocation.RunOperation(); TGlmNewYearInit glmNewYearInit = new TGlmNewYearInit(LedgerInfo, yearCounter, YearEndOperator); glmNewYearInit.VerificationResultCollection = verificationResult; glmNewYearInit.IsInInfoMode = false; glmNewYearInit.RunOperation(); YearAD++; yearCounter++; SampleDataAccountsPayable.GenerateInvoices(Path.Combine(datadirectory, "invoices.csv"), YearAD, smallNumber); period = 0; } } period++; periodOverall++; } }
/// <summary> /// init the exchange rate, to avoid messages "Cannot find exchange rate for EUR USD" /// </summary> public static void InitExchangeRate() { TAccountPeriodInfo AccountingPeriodInfo = new TAccountPeriodInfo(FLedgerNumber, 1); ADailyExchangeRateTable dailyrates = new ADailyExchangeRateTable(); ADailyExchangeRateRow row = dailyrates.NewRowTyped(true); row.DateEffectiveFrom = AccountingPeriodInfo.PeriodStartDate; row.TimeEffectiveFrom = 100; row.FromCurrencyCode = "USD"; row.ToCurrencyCode = "EUR"; row.RateOfExchange = 1.34m; dailyrates.Rows.Add(row); row = dailyrates.NewRowTyped(true); row.DateEffectiveFrom = AccountingPeriodInfo.PeriodStartDate; row.TimeEffectiveFrom = 100; row.FromCurrencyCode = "USD"; row.ToCurrencyCode = "GBP"; row.RateOfExchange = 1.57m; dailyrates.Rows.Add(row); if (!ADailyExchangeRateAccess.Exists(row.FromCurrencyCode, row.ToCurrencyCode, row.DateEffectiveFrom, row.TimeEffectiveFrom, null)) { ADailyExchangeRateAccess.SubmitChanges(dailyrates, null); } }
private void InitBatchAndJournal(decimal AExchangeRate, string ACurrencyCode) { F_GLDataset = TGLPosting.CreateABatch(F_LedgerNum); F_batch = F_GLDataset.ABatch[0]; F_batch.BatchDescription = Catalog.GetString("Period end revaluations"); TAccountPeriodInfo accountingPeriodInfo = new TAccountPeriodInfo(F_LedgerNum); accountingPeriodInfo.AccountingPeriodNumber = F_batch.BatchPeriod; F_batch.DateEffective = accountingPeriodInfo.PeriodEndDate; F_batch.BatchStatus = MFinanceConstants.BATCH_UNPOSTED; F_journal = F_GLDataset.AJournal.NewRowTyped(); F_journal.LedgerNumber = F_batch.LedgerNumber; F_journal.BatchNumber = F_batch.BatchNumber; F_journal.JournalNumber = 1; F_journal.DateEffective = F_batch.DateEffective; F_journal.ExchangeRateTime = 14400; // revaluations are typically later than 'new rates' F_journal.JournalPeriod = F_batch.BatchPeriod; F_journal.TransactionCurrency = F_BaseCurrency; F_journal.JournalDescription = F_batch.BatchDescription; F_journal.TransactionTypeCode = CommonAccountingTransactionTypesEnum.REVAL.ToString(); F_journal.SubSystemCode = CommonAccountingSubSystemsEnum.GL.ToString(); F_journal.LastTransactionNumber = 0; F_journal.DateOfEntry = DateTime.Now; F_journal.ExchangeRateToBase = 1.0M; F_GLDataset.AJournal.Rows.Add(F_journal); ARevaluationRow revalRow = F_GLDataset.ARevaluation.NewRowTyped(); revalRow.LedgerNumber = F_journal.LedgerNumber; revalRow.BatchNumber = F_journal.BatchNumber; revalRow.JournalNumber = F_journal.JournalNumber; revalRow.ExchangeRateToBase = AExchangeRate; revalRow.RevaluationCurrency = ACurrencyCode; F_GLDataset.ARevaluation.Rows.Add(revalRow); }
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; } }
/// <summary> /// init the exchange rate, to avoid messages "Cannot find exchange rate for EUR USD" /// </summary> public static void InitExchangeRate() { TAccountPeriodInfo AccountingPeriodInfo = new TAccountPeriodInfo(FLedgerNumber, 1); ADailyExchangeRateTable dailyrates = new ADailyExchangeRateTable(); ADailyExchangeRateRow row = dailyrates.NewRowTyped(true); row.DateEffectiveFrom = AccountingPeriodInfo.PeriodStartDate; row.TimeEffectiveFrom = 100; row.FromCurrencyCode = "USD"; row.ToCurrencyCode = "EUR"; row.RateOfExchange = 1.34m; dailyrates.Rows.Add(row); row = dailyrates.NewRowTyped(true); row.DateEffectiveFrom = AccountingPeriodInfo.PeriodStartDate; row.TimeEffectiveFrom = 100; row.FromCurrencyCode = "USD"; row.ToCurrencyCode = "GBP"; row.RateOfExchange = 1.57m; dailyrates.Rows.Add(row); if (!ADailyExchangeRateAccess.Exists(row.FromCurrencyCode, row.ToCurrencyCode, row.DateEffectiveFrom, row.TimeEffectiveFrom, null)) { ADailyExchangeRateAccess.SubmitChanges(dailyrates, null); } ALedgerTable Ledger = ALedgerAccess.LoadByPrimaryKey(FLedgerNumber, null); for (int periodCounter = 1; periodCounter <= Ledger[0].NumberOfAccountingPeriods + Ledger[0].NumberFwdPostingPeriods; periodCounter++) { AccountingPeriodInfo = new TAccountPeriodInfo(FLedgerNumber, periodCounter); ACorporateExchangeRateTable corprates = new ACorporateExchangeRateTable(); ACorporateExchangeRateRow corprow = corprates.NewRowTyped(true); corprow.DateEffectiveFrom = AccountingPeriodInfo.PeriodStartDate; corprow.TimeEffectiveFrom = 100; corprow.FromCurrencyCode = "USD"; corprow.ToCurrencyCode = "EUR"; corprow.RateOfExchange = 1.34m; corprates.Rows.Add(corprow); corprow = corprates.NewRowTyped(true); corprow.DateEffectiveFrom = AccountingPeriodInfo.PeriodStartDate; corprow.TimeEffectiveFrom = 100; corprow.FromCurrencyCode = "USD"; corprow.ToCurrencyCode = "GBP"; corprow.RateOfExchange = 1.57m; corprates.Rows.Add(corprow); if (!ACorporateExchangeRateAccess.Exists(corprow.FromCurrencyCode, corprow.ToCurrencyCode, corprow.DateEffectiveFrom, null)) { ACorporateExchangeRateAccess.SubmitChanges(corprates, null); } } }