Add invoice History

This commit is contained in:
Nuranggi Hermawan
2022-07-27 14:24:36 +07:00
parent b749446652
commit 58f7ea1893
2 changed files with 17 additions and 12 deletions
@@ -161,6 +161,12 @@ const _generateInvoice = async (invoiceDate, uniqueCode) => {
if(invoice.length > 0) for (const key in invoice) {
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} insert payment history et : ${JSON.stringify(invoice)}`)
let history = await model.writePaynentHistory(invoice[key], trx)
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} result insert payment history et : ${JSON.stringify(history)}`)
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} insert posting et ${JSON.stringify(invoice[key])}`)
let postingEt = await model.insertPostingEt(invoice[key], trx)
@@ -168,10 +174,6 @@ const _generateInvoice = async (invoiceDate, uniqueCode) => {
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} success insert posting et : ${JSON.stringify(postingEt)}`)
}
// write payment history
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} insert payment history et : ${JSON.stringify(invoice)}`)
let history = await model.writePaynentHistory(invoice, trx)
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} result insert payment history et : ${JSON.stringify(history)}`)
})
@@ -209,11 +211,11 @@ const _generateInvoice = async (invoiceDate, uniqueCode) => {
let xmlRequest = helper.generateXMLRequest('ZFMCMS_FI_001', xmlHeader, xmlItem)
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} REQUEST posting ${invoice[key].c_invoice_no} to SAP : ${xmlRequest}`);
winston.logger.debug(`SCHEDULER-FB70-${uniqueCode} REQUEST posting ${invoice[key].c_invoice_no} to SAP : ${xmlRequest}`);
const response = await helper.postingSAP(url, xmlRequest)
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} RESPONSE posting ${invoice[key].c_invoice_no} to SAP : ${JSON.stringify(response)}`);
winston.logger.debug(`SCHEDULER-FB70-${uniqueCode} RESPONSE posting ${invoice[key].c_invoice_no} to SAP : ${JSON.stringify(response)}`);
// new transaction
await knex.transaction(async trx => {