diff --git a/src/helper/irs-api.ts b/src/helper/irs-api.ts index 1c5b439..37b4bc4 100644 --- a/src/helper/irs-api.ts +++ b/src/helper/irs-api.ts @@ -1,6 +1,6 @@ import axios from 'axios'; -const irs_url = 'http://h2h.elangpangarep.com/api/h2h'; +const irs_url = 'http://h2h.elangpixiu.com/api/h2h'; const irs_id = 'PT0005'; const irs_pin = '04JFGC'; const irs_user = 'D10BD0'; diff --git a/src/helper/irs-service.ts b/src/helper/irs-service.ts index 32e70a7..1ca2687 100644 --- a/src/helper/irs-service.ts +++ b/src/helper/irs-service.ts @@ -5,7 +5,7 @@ export const createTransaction = async (kode, tujuan) => { return axios.default .get( - `http://h2h.elangpixiu.com/api/h2h ?id=PT0005&pin=04JFGC&user=D10BD0&pass=6251F3&kodeproduk=${kode}&tujuan=${tujuan}&counter=1&idtrx=${codeTransaksi}`, + `http://h2h.elangpixiu.com/api/h2h?id=PT0005&pin=04JFGC&user=D10BD0&pass=6251F3&kodeproduk=${kode}&tujuan=${tujuan}&counter=1&idtrx=${codeTransaksi}`, ) .then((response) => { return response.data; diff --git a/src/transaction/transaction.service.ts b/src/transaction/transaction.service.ts index e51a280..d4e07d4 100644 --- a/src/transaction/transaction.service.ts +++ b/src/transaction/transaction.service.ts @@ -505,9 +505,11 @@ export class TransactionService { responseAPISupplier: hitSupplier, }); + let costInventory = product_price.price; + if (hitSupplier.harga != product_price.price) { product_price.endDate = new Date(); - + costInventory = hitSupplier.harga; const listActivePrice = await this.productHistoryPriceService.getAllActivePriceByProduct( product.id, @@ -570,20 +572,20 @@ export class TransactionService { journals: [ { coa_id: coaInventory.id, - credit: product_price.price, + credit: costInventory, }, { coa_id: coaCostOfSales.id, - debit: product_price.price, + debit: costInventory, }, { coa_id: coaAccount.id, - debit: product_price.mark_up_price + product_price.price, + debit: product_price.mark_up_price + costInventory, }, { // eslint-disable-next-line camelcase coa_id: coaSales.id, - credit: product_price.mark_up_price + product_price.price, + credit: product_price.mark_up_price + costInventory, }, ], }); @@ -1325,7 +1327,7 @@ export class TransactionService { return { coa_id: coaAccount.id, - credit: (totalPrice * commissionValue.commission) / 100, + credit: Math.floor((totalPrice * commissionValue.commission) / 100), }; }), );