FINERACT-321 - Manual Journal entries should not allowed to reverse after accounting closure is done for that branch

This commit is contained in:
nazeer1100126
2017-03-17 17:49:05 +05:30
parent 8cc560cd84
commit 5f74453606
@@ -325,6 +325,19 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
final boolean useDefaultComment = StringUtils.isBlank(reversalComment);
validateCommentForReversal(reversalComment);
//Before reversal validate accounting closure is done for that branch or not.
final Date journalEntriesTransactionDate = journalEntries.get(0).getTransactionDate();
final GLClosure latestGLClosureByBranch = this.glClosureRepository.getLatestGLClosureByBranch(officeId);
if (latestGLClosureByBranch != null) {
if (latestGLClosureByBranch.getClosingDate().after(journalEntriesTransactionDate)
|| latestGLClosureByBranch.getClosingDate().equals(journalEntriesTransactionDate)) {
final String accountName = null;
final String accountGLCode = null;
throw new JournalEntryInvalidException(GL_JOURNAL_ENTRY_INVALID_REASON.ACCOUNTING_CLOSED,
latestGLClosureByBranch.getClosingDate(), accountName, accountGLCode);
}
}
for (final JournalEntry journalEntry : journalEntries) {
JournalEntry reversalJournalEntry;