mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-05 11:06:28 +00:00
Merge branch 'develop_v1.4.8'
This commit is contained in:
@@ -167,6 +167,7 @@ const _generateCashIn = async (uniqueCode) => {
|
||||
partnerRecon
|
||||
)}`
|
||||
);
|
||||
|
||||
for (const item of partnerRecon) {
|
||||
let reserve = [];
|
||||
let code = '';
|
||||
@@ -180,8 +181,8 @@ const _generateCashIn = async (uniqueCode) => {
|
||||
`SCHEDULER-FB70-${uniqueCode} generate cash in : ${code}`
|
||||
);
|
||||
|
||||
// Insert cahs in
|
||||
const dataCahsIn = {
|
||||
// Cash-in
|
||||
let dataCahsIn = {
|
||||
c_partner_code: item.c_partner_code,
|
||||
c_partner_name: item.c_partner_name,
|
||||
c_cash_in_no: code,
|
||||
@@ -196,8 +197,25 @@ const _generateCashIn = async (uniqueCode) => {
|
||||
dataCahsIn
|
||||
)}`
|
||||
);
|
||||
const cashIn = await model.insertCashIn(trx, dataCahsIn);
|
||||
|
||||
// CASH-IN DETAIL
|
||||
let data = [];
|
||||
const reserv = await model.getReserve(
|
||||
trx,
|
||||
item.c_partner_code,
|
||||
item.d_payment,
|
||||
item.c_invoice_no
|
||||
);
|
||||
|
||||
//TOTAL AMOUNT CASH-IN
|
||||
let cashInAmount = 0;
|
||||
for (const itemCI of reserv) {
|
||||
cashInAmount += parseInt(itemCI.i_reservation_amount);
|
||||
}
|
||||
dataCahsIn.i_amount = cashInAmount;
|
||||
|
||||
//INSERT CASH-IN
|
||||
const cashIn = await model.insertCashIn(trx, dataCahsIn);
|
||||
winston.logger.info(
|
||||
`SCHEDULER-FB70-${uniqueCode} INSERT CASH-IN HISTORY ${code} DATA : ${JSON.stringify(
|
||||
dataCahsIn
|
||||
@@ -210,14 +228,6 @@ const _generateCashIn = async (uniqueCode) => {
|
||||
trx
|
||||
);
|
||||
|
||||
// Insert cahs in detail
|
||||
let data = [];
|
||||
const reserv = await model.getReserve(
|
||||
trx,
|
||||
item.c_partner_code,
|
||||
item.d_payment,
|
||||
item.c_invoice_no
|
||||
);
|
||||
for (const detail of reserv) {
|
||||
// data.push({
|
||||
// i_cash_in: cashIn.i_cash_in,
|
||||
@@ -237,9 +247,8 @@ const _generateCashIn = async (uniqueCode) => {
|
||||
d_payment_recon: detail.d_payment_recon,
|
||||
c_load_balance_no: detail.c_load_balance_no,
|
||||
};
|
||||
|
||||
|
||||
let reserveNo = detail.c_reservation_no;
|
||||
|
||||
let dataReserve = {
|
||||
c_cash_in_no: cashIn.c_cash_in_no,
|
||||
d_credit: cashIn.d_credit,
|
||||
@@ -249,6 +258,7 @@ const _generateCashIn = async (uniqueCode) => {
|
||||
await model.updateIntoReserve(trx, dataReserve, reserveNo);
|
||||
await model.insertCashInDetail(trx, temp);
|
||||
}
|
||||
|
||||
await wait(5000);
|
||||
winston.logger.info(
|
||||
`SCHEDULER-FB70-${uniqueCode} INSERT CASH-IN TO RESERVE ${code} DATA : ${JSON.stringify(
|
||||
|
||||
Reference in New Issue
Block a user