fix: writing journal entries of manual journal.

This commit is contained in:
a.bouhuolia
2021-01-03 19:39:17 +02:00
parent a2284945f1
commit ccf4fa55d9
13 changed files with 715 additions and 361 deletions

View File

@@ -370,7 +370,6 @@ export default class PaymentReceiveService {
tenantId,
paymentReceiveId
);
// Validate payment receive number uniquiness.
if (paymentReceiveDTO.paymentReceiveNo) {
await this.validatePaymentReceiveNoExistance(
@@ -391,21 +390,18 @@ export default class PaymentReceiveService {
paymentReceiveId,
paymentReceiveDTO.entries
);
// Validate payment receive invoices IDs existance and associated to the given customer id.
await this.validateInvoicesIDsExistance(
tenantId,
oldPaymentReceive.customerId,
paymentReceiveDTO.entries
);
// Validate invoice payment amount.
await this.validateInvoicesPaymentsAmount(
tenantId,
paymentReceiveDTO.entries,
oldPaymentReceive.entries
);
// Update the payment receive transaction.
const paymentReceive = await PaymentReceive.query().upsertGraphAndFetch({
id: paymentReceiveId,
@@ -669,8 +665,8 @@ export default class PaymentReceiveService {
/**
* Reverts the given payment receive journal entries.
* @param {number} tenantId
* @param {number} paymentReceiveId
* @param {number} tenantId - Tenant id.
* @param {number} paymentReceiveId - Payment receive id.
*/
async revertPaymentReceiveJournalEntries(
tenantId: number,