update cash in

This commit is contained in:
lutfi
2025-01-01 14:52:36 +07:00
parent 22ce0b611a
commit 3c8fc4d81d
2 changed files with 17 additions and 3 deletions
@@ -261,6 +261,12 @@ const _generateCashIn = async (uniqueCode) => {
item.d_payment,
item.c_invoice_no
);
winston.logger.info(
`SCHEDULER-FB70-${uniqueCode} cashIn reserv ${code} DATA : ${JSON.stringify(
reserv
)}`
);
//TOTAL AMOUNT CASH-IN
let cashInAmount = 0;
@@ -269,6 +275,12 @@ const _generateCashIn = async (uniqueCode) => {
}
dataCahsIn.i_amount = cashInAmount;
winston.logger.info(
`SCHEDULER-FB70-${uniqueCode} cashInAmount ${code} DATA : ${JSON.stringify(
cashInAmount
)}`
);
if(cashInAmount > 0) {
//INSERT CASH-IN
const cashIn = await model.insertCashIn(trx, dataCahsIn);
+5 -3
View File
@@ -299,9 +299,11 @@ const getReserve = async (trx, code, date, invoice) => {
.where('tdpr.c_status', '=', 'S')
.whereNotNull('tdi.c_return_sap')
.whereNotNull('tdrb.c_load_balance_no')
.whereRaw(
`tdrb.c_reservation_no in (SELECT c_reservation_no FROM payment.t_d_payment_recon where c_status = 'S' ) AND tdrb.c_reservation_no NOT IN (SELECT c_reservation_no FROM payment.t_d_cash_in_detail WHERE b_reversal IS NOT TRUE)`
);
.whereNull('tdrb.c_cash_in_no')
// .whereRaw(
// `tdrb.c_reservation_no in (SELECT c_reservation_no FROM payment.t_d_payment_recon where c_status = 'S' ) AND tdrb.c_reservation_no NOT IN (SELECT c_reservation_no FROM payment.t_d_cash_in_detail WHERE b_reversal IS NOT TRUE)`
// );
return res;
};