mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-05 11:06:28 +00:00
Merge branch 'develop' of https://github.com/mohamadihsan/topuponline into develop
This commit is contained in:
@@ -606,7 +606,7 @@ const _generateCashInSalesInternal = async (uniqueCode) => {
|
||||
//TOTAL AMOUNT CASH-IN
|
||||
let cashInAmount = 0;
|
||||
for (const itemCI of sales) {
|
||||
cashInAmount += parseInt(itemCI.i_total_billing);
|
||||
cashInAmount += parseInt(itemCI.i_total_price);
|
||||
}
|
||||
dataCahsIn.i_amount = cashInAmount;
|
||||
|
||||
@@ -627,7 +627,7 @@ const _generateCashInSalesInternal = async (uniqueCode) => {
|
||||
let temp = {
|
||||
i_cash_in: cashIn.i_cash_in,
|
||||
c_reservation_no: detail.c_sales_no,
|
||||
m_amount: detail.i_total_billing,
|
||||
m_amount: detail.i_total_price,
|
||||
c_payment_recon_no: detail.c_payment_recon_no,
|
||||
d_payment: detail.d_payment,
|
||||
d_payment_recon: detail.d_payment_recon,
|
||||
@@ -635,11 +635,9 @@ const _generateCashInSalesInternal = async (uniqueCode) => {
|
||||
|
||||
let salesNo = detail.c_sales_no;
|
||||
let dataSales = {
|
||||
c_cash_in_no: cashIn.c_cash_in_no,
|
||||
d_credit: cashIn.d_credit,
|
||||
c_in_period: cashIn.c_in_period,
|
||||
i_cash_in: cashIn.i_cash_in,
|
||||
};
|
||||
m_amount += parseInt(detail.i_total_billing);
|
||||
m_amount += parseInt(detail.i_total_price);
|
||||
|
||||
if(m_amount <= detail.invoice_amount) {
|
||||
await model.updateIntoSalesInternal(trx, dataSales, salesNo);
|
||||
@@ -670,6 +668,10 @@ const _generateCashInSalesInternal = async (uniqueCode) => {
|
||||
|
||||
} catch (error) {
|
||||
sts = "error";
|
||||
console.log("XXXXXXXXXXXXXXXXXXXXXXXXXX");
|
||||
throw new Error(error);
|
||||
|
||||
|
||||
await trx.rollback();
|
||||
}
|
||||
|
||||
|
||||
@@ -344,20 +344,21 @@ const getSalesInternal = async (trx, code, date, invoice) => {
|
||||
const res = await trx
|
||||
.select([
|
||||
'tdskm.c_sales_no',
|
||||
'tdskm.i_total_billing',
|
||||
'tdskm.i_total_price',
|
||||
'tdpr.c_payment_recon_no',
|
||||
'tdpr.d_payment',
|
||||
'tdpr.d_payment_recon',
|
||||
'tdskm.c_partner_code',
|
||||
'tdskm.c_partner_name',
|
||||
'tmp.c_code as c_partner_code',
|
||||
'tmp.c_name as c_partner_name',
|
||||
'tdsi.c_invoice_no',
|
||||
'tdsi.m_total_billing as invoice_amount'
|
||||
'tdsi.i_total_price as invoice_amount'
|
||||
])
|
||||
.from('trx.t_d_sales_internal AS tdskm')
|
||||
.leftJoin('payment.t_d_payment_recon_sales_internal as tdpr', 'tdpr.c_sales_no', 'tdskm.c_sales_no')
|
||||
.leftJoin('payment.t_d_sales_invoice_internal as tdsi', 'tdsi.i_sales_invoice', 'tdskm.i_sales_invoice')
|
||||
.leftJoin('payment.t_d_sales_invoice_internal as tdsi', 'tdsi.i_sales_invoice_internal', 'tdskm.i_sales_invoice_internal')
|
||||
.leftJoin('public.t_m_partner as tmp', 'tmp.i_partner', 'tdskm.i_partner')
|
||||
.where('tdsi.c_status', '!=', 'X')
|
||||
.where('tdskm.c_partner_code', '=', code)
|
||||
.where('tmp.c_code', '=', code)
|
||||
.where('tdpr.d_payment', '=', date)
|
||||
.where('tdsi.c_invoice_no', '=', invoice)
|
||||
.where('tdpr.c_status', '=', 'S')
|
||||
@@ -543,12 +544,12 @@ const getPartnerReconSalesInternal = async (trx) => {
|
||||
|
||||
const res = await trx
|
||||
.select([
|
||||
'tdsi.c_partner_code',
|
||||
'tdsi.c_partner_name',
|
||||
'tmp.c_code as c_partner_code',
|
||||
'tmp.c_name as c_partner_name',
|
||||
'tdsi.c_invoice_no',
|
||||
'tdsi.d_invoice_date',
|
||||
trx.raw("to_char(tdpr.d_payment, 'YYYY-MM-DD') AS d_payment"),
|
||||
trx.raw('coalesce(SUM(tdskm.i_total_billing),0) AS amount'),
|
||||
trx.raw('coalesce(SUM(tdskm.i_total_price),0) AS amount'),
|
||||
'tmp.c_account_sales_revenue',
|
||||
'tmp.c_account_code_sales_ar',
|
||||
trx.raw(`CASE WHEN to_char(tdpr.d_payment, 'YYYYMM') >= to_char(tdsi.d_invoice_date, 'YYYYMM')
|
||||
@@ -571,8 +572,8 @@ const getPartnerReconSalesInternal = async (trx) => {
|
||||
.whereNotNull('tdsi.c_return_sap_fi')
|
||||
.whereNull('tdskm.i_cash_in')
|
||||
.groupBy([
|
||||
'tdsi.c_partner_code',
|
||||
'tdsi.c_partner_name',
|
||||
'tmp.c_code',
|
||||
'tmp.c_name',
|
||||
'tdsi.c_invoice_no',
|
||||
'tdsi.d_invoice_date',
|
||||
'tdpr.d_payment',
|
||||
|
||||
Reference in New Issue
Block a user