Пример #1
0
        /// Returns true if it seems to be OK.
        private Boolean CloseRevaluationAccountingBatch(out Int32 glBatchNumber)
        {
            Boolean blnReturnValue = false;

            glBatchNumber = -1;

            if (F_GLDataset != null)
            {
                F_batch.BatchCreditTotal = F_journal.JournalCreditTotal;
                F_batch.BatchDebitTotal  = F_journal.JournalDebitTotal;
                TVerificationResultCollection AVerifications;
                blnReturnValue = (TGLTransactionWebConnector.SaveGLBatchTDS(
                                      ref F_GLDataset, out AVerifications, FDataBase) == TSubmitChangesResult.scrOK);

                if (!blnReturnValue)
                {
                    return(false);
                }

                F_GLDataset.AcceptChanges();

                blnReturnValue = (TGLPosting.PostGLBatch(
                                      F_batch.LedgerNumber, F_batch.BatchNumber, out AVerifications, FDataBase));

                if (blnReturnValue)
                {
                    glBatchNumber = F_batch.BatchNumber;
                }
            }

            return(blnReturnValue);
        } // Close Revaluation Accounting Batch
Пример #2
0
        private Boolean CloseSaveAndPost_(TVerificationResultCollection AVerifications)
        {
            if (FJournalCount != 0)
            {
                // The checksum of the "last journal" is used to update the checksum of the batch.
                FBatchRow.BatchControlTotal += FJournalRow.JournalDebitTotal - FJournalRow.JournalCreditTotal;
            }

            FBatchTDS.ThrowAwayAfterSubmitChanges = true;
            GLBatchTDSAccess.SubmitChanges(FBatchTDS);

            Boolean PostedOk = TGLPosting.PostGLBatch(
                FLedgerInfo.LedgerNumber, FBatchNumber, out AVerifications);

            // Make sure that this object cannot be used for another posting ...
            FBatchTDS   = null;
            FBatchRow   = null;
            FJournalRow = null;
            return(PostedOk);
        }
Пример #3
0
        public void TestPostGLBatchArgumentValidation()
        {
            TVerificationResultCollection VerificationResult = null;

            string Message = "Validation failed for posting a GL Batch with ledger number less than 1.";

            // Post a GL Batch with ledger number less than 1
            try
            {
                TGLPosting.PostGLBatch(-1, 1, out VerificationResult);

                if ((VerificationResult.CountCriticalErrors != 1) ||
                    (!VerificationResult.BuildVerificationResultString().Contains("The Ledger number must be greater than 0")))
                {
                    Assert.Fail(Message);
                }
            }
            catch
            {
                Assert.Fail(Message);
            }

            Message = "Validation failed for posting a GL Batch with batch number less than 1.";

            // Post a GL Batch with batch number less than 1
            try
            {
                TGLPosting.PostGLBatch(1, -1, out VerificationResult);

                if ((VerificationResult.CountCriticalErrors != 1) ||
                    (!VerificationResult.BuildVerificationResultString().Contains("The Batch number must be greater than 0")))
                {
                    Assert.Fail(Message);
                }
            }
            catch
            {
                Assert.Fail(Message);
            }
        }
Пример #4
0
        public void TestPostGLBatchArgumentValidation()
        {
            TVerificationResultCollection VerificationResult = null;

            string Message = "Validation failed for posting a GL Batch with ledger number less than 1.";

            // Post a GL Batch with ledger number less than 1
            try
            {
                TGLPosting.PostGLBatch(-1, 1, out VerificationResult);
                Assert.Fail(Message);
            }
            catch (EFinanceSystemInvalidLedgerNumberException e)
            {
                Assert.AreEqual(-1, e.LedgerNumber, Message);
            }
            catch
            {
                Assert.Fail(Message);
            }

            Message = "Validation failed for posting a GL Batch with batch number less than 1.";

            // Post a GL Batch with batch number less than 1
            try
            {
                TGLPosting.PostGLBatch(1, -1, out VerificationResult);
                Assert.Fail(Message);
            }
            catch (EFinanceSystemInvalidBatchNumberException e)
            {
                Assert.AreEqual(1, e.LedgerNumber, Message);
                Assert.AreEqual(-1, e.BatchNumber, Message);
            }
            catch
            {
                Assert.Fail(Message);
            }
        }