Merge branch 'development' of https://gitlab.com/empatnusabangsa/ppob/ppob-backend into devops-staging

This commit is contained in:
Fadli 2023-01-07 01:25:55 +07:00
commit 3f6997de99
3 changed files with 6 additions and 13 deletions

View File

@ -13,11 +13,7 @@ export class COA extends BaseModel {
@Column('text')
balanceType: balanceType;
@Column({
type: 'numeric',
precision: 20,
scale: 2,
})
@Column()
amount: number;
@Column({

View File

@ -10,11 +10,7 @@ export class Transactions extends BaseModel {
@Column()
amount: number;
@Column({
type: 'numeric',
precision: 20,
scale: 2,
})
@Column()
balance_remaining: number;
@Column()

View File

@ -163,12 +163,13 @@ export class TransactionService {
HttpStatus.NOT_ACCEPTABLE,
);
}
console.log('suppliercodedist', supplier.code);
// GET COA
const coaBudget = await this.coaService.findByName(
`${coaType[coaType.BUDGET]}-${supplier.code}`,
);
console.log('coabudgetdist', coaBudget.amount);
console.log('amounttotaldist', distributeTransactionDto.amount);
if (coaBudget.amount < distributeTransactionDto.amount) {
throw new HttpException(
{
@ -1395,7 +1396,7 @@ export class TransactionService {
dataTransaction.callback_json = callback;
dataTransaction.failed_reason = `Trx ${product.code} ke ${dataTransaction.destination} gagal`;
dataTransaction.balance_remaining =
Math.floor(coaAccount.amount) + dataTransaction.amount;
coaAccount.amount + dataTransaction.amount;
const coaInventory = await this.coaService.findByName(
`${coaType[coaType.INVENTORY]}-${product.supplier.code}`,