update generate cash-in

This commit is contained in:
lutfi
2023-12-28 14:19:37 +07:00
parent 5d8369edd8
commit b1be54d5ba
+8 -8
View File
@@ -372,7 +372,7 @@ const getPartnerRecon = async (trx) => {
'tdi.d_invoice_date',
trx.raw("to_char(tdpr.d_payment, 'YYYY-MM-DD') AS d_payment"),
trx.raw('coalesce(SUM(tdrb.i_reservation_amount),0) AS amount'),
trx.raw('coalesce(SUM(tdcid.m_amount),0) AS amount_cash_in'),
// trx.raw('coalesce(SUM(tdcid.m_amount),0) AS amount_cash_in'),
'tmp.c_account_topup',
'tmp.c_account_code_topup',
'i_company',
@@ -401,9 +401,9 @@ const getPartnerRecon = async (trx) => {
.leftJoin('public.t_m_partner as tmp', function () {
this.on('tmp.i_partner', '=', 'tdrb.i_partner');
})
.leftJoin('payment.t_d_cash_in_detail as tdcid', function () {
this.on('tdcid.c_reservation_no', '=', 'tdrb.c_reservation_no');
})
// .leftJoin('payment.t_d_cash_in_detail as tdcid', function () {
// this.on('tdcid.c_reservation_no', '=', 'tdrb.c_reservation_no');
// })
.where('tdrb.c_status', '=', 'A')
.where('tdi.c_status', '!=', 'X')
@@ -421,10 +421,10 @@ const getPartnerRecon = async (trx) => {
'tmp.c_account_code_topup',
'tdi.i_company',
'i_holding',
])
.havingRaw(
'coalesce(SUM(tdrb.i_reservation_amount),0) > coalesce(SUM(tdcid.m_amount),0)'
);
]);
// .havingRaw(
// 'coalesce(SUM(tdrb.i_reservation_amount),0) > coalesce(SUM(tdcid.m_amount),0)'
// );
return res;
};