Esempio n. 1
0
        private AAPInfos PostSimpleAPDocument(decimal AAmount, string ADocumentCode, string ANarrative,
                                              out decimal AAPAccountBalanceBefore, out decimal ABankAccountBefore, out decimal AExpAccountBefore,
                                              out List <int> ADocumentIds)
        {
            TVerificationResultCollection VerificationResult;

            ADocumentIds = new List <int>();

            AAPInfos APInfos = APTestsArrangement(SUPPLIER_PARTNER_KEY, AAmount, null, ADocumentCode, ANarrative);

            // Save the current amount on the AP account
            AAPAccountBalanceBefore = new TGet_GLM_Info(FLedgerNumber,
                                                        APInfos.ApAccountCode, APInfos.CostCentreCode).YtdActual;
            ABankAccountBefore = new TGet_GLM_Info(FLedgerNumber,
                                                   APInfos.BankAccount, APInfos.CostCentreCode).YtdActual;

            AExpAccountBefore = new TGet_GLM_Info(FLedgerNumber,
                                                  APInfos.ApDS.AApSupplier[0].DefaultExpAccount,
                                                  APInfos.CostCentreCode).YtdActual;

            VerificationResult = PostAPDocument(APInfos.ApDS, APInfos.PeriodStartDate, ref ADocumentIds);
            CommonNUnitFunctions.EnsureNullOrEmptyVerificationResult(VerificationResult);   // Guard Assert

            //
            // Guard Assert: Posting OK?
            //
            decimal ExpAccountAfter = new TGet_GLM_Info(FLedgerNumber,
                                                        APInfos.ApDS.AApSupplier[0].DefaultExpAccount,
                                                        APInfos.ApDS.AApSupplier[0].DefaultCostCentre).YtdActual;

            Assert.AreEqual(AAmount, ExpAccountAfter - AExpAccountBefore, "after posting the invoice, the expense account should be debited");

            return(APInfos);
        }
Esempio n. 2
0
        private AAPInfos PostForeignSupplierAPDocument(decimal AAmount, decimal AExchangeRatePosting, string ADocumentCode, string ANarrative,
                                                       out decimal AAPAccountBalanceBefore, out decimal ABankAccountBefore, out decimal AExpAccountBefore,
                                                       out decimal ARevalAccountBefore, out List <int> ADocumentIds)
        {
            TVerificationResultCollection VerificationResult;

            ADocumentIds = new List <int>();

            AAPInfos APInfos = APTestsArrangement(SUPPLIER_FOREIGN_PARTNER_KEY, AAmount, AExchangeRatePosting, ADocumentCode, ANarrative);

            // Save the current amount on the AP account
            AAPAccountBalanceBefore = new TGet_GLM_Info(FLedgerNumber,
                                                        APInfos.ApAccountCode, APInfos.CostCentreCode).YtdActual;
            ABankAccountBefore = new TGet_GLM_Info(FLedgerNumber,
                                                   APInfos.BankAccount, APInfos.CostCentreCode).YtdForeign;

            AExpAccountBefore = new TGet_GLM_Info(FLedgerNumber,
                                                  APInfos.ApDS.AApSupplier[0].DefaultExpAccount,
                                                  APInfos.CostCentreCode).YtdActual;
            ARevalAccountBefore = new TGet_GLM_Info(FLedgerNumber,
                                                    APInfos.ForexGainsLossesAccount,
                                                    APInfos.CostCentreCode).YtdActual;

            VerificationResult = PostAPDocument(APInfos.ApDS, APInfos.PeriodStartDate, ref ADocumentIds);
            CommonNUnitFunctions.EnsureNullOrEmptyVerificationResult(VerificationResult);   // Guard Assert

            //
            // Guard Assert: Posting OK?
            //
            decimal ExpAccountAfter = new TGet_GLM_Info(FLedgerNumber,
                                                        APInfos.ApDS.AApSupplier[0].DefaultExpAccount,
                                                        APInfos.ApDS.AApSupplier[0].DefaultCostCentre).YtdActual;

            Assert.AreEqual(Math.Round(AAmount / AExchangeRatePosting, 2), Math.Round(ExpAccountAfter - AExpAccountBefore,
                                                                                      2), "after posting the invoice, the expense account should be debited the amount in base currency (Exchange Rate is " +
                            AExchangeRatePosting + ")");

            return(APInfos);
        }
Esempio n. 3
0
        private AAPInfos APTestsArrangement(Int64 APartnerKey, decimal AAmount, decimal?AExchangeRatePosting,
                                            string ADocumentCode, string ANarrative)
        {
            AAPInfos APInfos = new AAPInfos();

            TVerificationResultCollection VerificationResult = CreateAPDocument(APartnerKey,
                                                                                AAmount,
                                                                                AExchangeRatePosting,
                                                                                ADocumentCode,
                                                                                ANarrative,
                                                                                out APInfos.ApDS);

            CommonNUnitFunctions.EnsureNullOrEmptyVerificationResult(VerificationResult);   // Guard Assert

            GetLedgerInfo(out APInfos.PeriodStartDate, out APInfos.PeriodEndDate, out APInfos.ForexGainsLossesAccount);

            SetupSupplierAndDocumentInfo(APInfos.ApDS,
                                         out APInfos.BankAccount,
                                         out APInfos.CurrencyCode,
                                         out APInfos.ApAccountCode,
                                         out APInfos.CostCentreCode);

            return(APInfos);
        }
Esempio n. 4
0
        private AAPInfos APTestsArrangement(Int64 APartnerKey, decimal AAmount, decimal? AExchangeRatePosting,
            string ADocumentCode, string ANarrative)
        {
            AAPInfos APInfos = new AAPInfos();

            TVerificationResultCollection VerificationResult = CreateAPDocument(APartnerKey,
                AAmount,
                AExchangeRatePosting,
                ADocumentCode,
                ANarrative,
                out APInfos.ApDS);

            CommonNUnitFunctions.EnsureNullOrEmptyVerificationResult(VerificationResult);   // Guard Assert

            GetLedgerInfo(out APInfos.PeriodStartDate, out APInfos.PeriodEndDate, out APInfos.ForexGainsLossesAccount);

            SetupSupplierAndDocumentInfo(APInfos.ApDS,
                out APInfos.BankAccount,
                out APInfos.CurrencyCode,
                out APInfos.ApAccountCode,
                out APInfos.CostCentreCode);

            return APInfos;
        }