This commit is contained in:
Nuranggi Hermawan
2022-12-08 11:47:45 +07:00
parent c4a2332206
commit 1ae4fc3b27
2 changed files with 14 additions and 8 deletions
@@ -146,6 +146,7 @@ const apiPostingCahsIn = async (req, res) => {
const _generateCashIn = async (uniqueCode) => {
let partnerRecon = await model.getPartnerRecon(knex)
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} getPartner Recon cash in : ${JSON.stringify(partnerRecon)}`)
for (const item of partnerRecon) {
let reserve = []
let code = ""
@@ -164,17 +165,18 @@ const _generateCashIn = async (uniqueCode) => {
i_amount : item.amount
}
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} cash in ${code} data : ${JSON.stringify(dataCahsIn)}`)
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} INSERT CASH-IN ${code} DATA : ${JSON.stringify(dataCahsIn)}`)
const cashIn = await model.insertCashIn(trx, dataCahsIn)
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} INSERT CASH-IN HISTORY ${code} DATA : ${JSON.stringify(dataCahsIn)}`)
const paymentyHistory = await model.writePaynentHistory(dataCahsIn, "SUCCESSFULLY", 0, trx)
// Insert cahs in detail
let data = []
// let data = []
const reserv = await model.getReserve(trx, item.c_partner_code, item.d_payment)
for (const detail of reserv) {
data.push({
let data = {
i_cash_in : cashIn.i_cash_in,
c_reservation_no : detail.c_reservation_no,
m_amount : detail.i_reservation_amount,
@@ -182,7 +184,7 @@ const _generateCashIn = async (uniqueCode) => {
d_payment : detail.d_payment,
d_payment_recon : detail.d_payment_recon,
c_load_balance_no : detail.c_load_balance_no
})
}
let reserveNo = detail.c_reservation_no
@@ -192,10 +194,14 @@ const _generateCashIn = async (uniqueCode) => {
c_in_period : cashIn.c_in_period,
}
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} UPDATE CASH-IN TO RESERVE ${code} DATA : ${JSON.stringify(dataCahsIn)}`)
await model.updateIntoReserve(trx, dataReserve, reserveNo)
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} INSERT CASH-IN TO RESERVE ${code} DATA : ${JSON.stringify(dataCahsIn)}`)
await model.insertCashInDetail(trx, data)
}
// await model.insertPostingEt(code, item, trx)
await model.insertCashInDetail(trx, data)
})
}
+3 -3
View File
@@ -167,7 +167,7 @@ app.use("/api/", cashinRoute);
} catch (error) {
// create log
winston.logger.error(
`500 internal server error - backend server | ${error.message}`
`500 SCHEDULER-FB70 internal server error - backend server | ${error.message}`
);
}
});
@@ -183,7 +183,7 @@ app.use("/api/", cashinRoute);
} catch (error) {
// create log
winston.logger.error(
`500 internal server error - backend server | ${error.message}`
`500 SCHEDULER-FB70 internal server error - backend server | ${error.message}`
);
}
});
@@ -199,7 +199,7 @@ app.use("/api/", cashinRoute);
} catch (error) {
// create log
winston.logger.error(
`500 internal server error - backend server | ${error.message}`
`500 SCHEDULER-FB70 internal server error - backend server | ${error.message}`
);
}
});