fix: rollback jurnal
This commit is contained in:
parent
c2b4b5ec30
commit
953161c4b2
|
@ -1310,12 +1310,26 @@ export class TransactionService {
|
||||||
relations: ['product_price'],
|
relations: ['product_price'],
|
||||||
});
|
});
|
||||||
|
|
||||||
const dataTransactionJurnal = await this.transactionJournalRepository.find({
|
let dataTransactionJurnal;
|
||||||
where: {
|
if (dataTransaction.type == typeTransaction.ORDER) {
|
||||||
transaction_head: trxId,
|
dataTransactionJurnal = await this.transactionJournalRepository.find({
|
||||||
},
|
where: {
|
||||||
relations: ['coa'],
|
transaction_head: trxId,
|
||||||
});
|
},
|
||||||
|
relations: ['coa'],
|
||||||
|
skip: 4,
|
||||||
|
order: {
|
||||||
|
createdAt: 'ASC',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
dataTransactionJurnal = await this.transactionJournalRepository.find({
|
||||||
|
where: {
|
||||||
|
transaction_head: trxId,
|
||||||
|
},
|
||||||
|
relations: ['coa'],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let dataRollbackJurnal = [];
|
let dataRollbackJurnal = [];
|
||||||
|
|
||||||
|
@ -1333,18 +1347,20 @@ export class TransactionService {
|
||||||
dataRollbackJurnal.push(data);
|
dataRollbackJurnal.push(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
if (dataRollbackJurnal.length > 0) {
|
||||||
await this.connection.transaction(async (manager) => {
|
try {
|
||||||
await this.accountingTransaction({
|
await this.connection.transaction(async (manager) => {
|
||||||
createTransaction: false,
|
await this.accountingTransaction({
|
||||||
transactionalEntityManager: manager,
|
createTransaction: false,
|
||||||
transaction: dataTransaction,
|
transactionalEntityManager: manager,
|
||||||
amount: dataTransaction.amount,
|
transaction: dataTransaction,
|
||||||
journals: dataRollbackJurnal,
|
amount: dataTransaction.amount,
|
||||||
|
journals: dataRollbackJurnal,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
} catch (e) {
|
||||||
} catch (e) {
|
throw e;
|
||||||
throw e;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user