Merge branch 'master' of https://gitlab.com/empatnusabangsa/ppob/ppob-backend into devops-production

This commit is contained in:
Fadli 2022-10-12 10:25:45 +07:00
commit fbfadede9a

View File

@ -2109,17 +2109,20 @@ export class TransactionService {
const { total_expense } = await baseQuery const { total_expense } = await baseQuery
.select('SUM(transaction_journal.amount) as total_expense') .select('SUM(transaction_journal.amount) as total_expense')
.innerJoin('transactions.transactionJournal', 'transaction_journal') .innerJoin('transactions.transactionJournal', 'transaction_journal')
.innerJoin('user', 'user')
.where( .where(
`transaction_journal.type = '0' and transaction_journal.amount < product_price.price`, `transaction_journal.type = '0' and transaction_journal.amount < product_price.price and transactions.status = 1 and user.partner_id is NULL`,
) )
.getRawOne(); .getRawOne();
console.log("totalprofitni", data.total_profit);
console.log("totalexpenseni", total_expense);
return { return {
total_amount: parseInt(data.total_amount), total_amount: parseInt(data.total_amount),
total_transaction: parseInt(data.total_transaction), total_transaction: parseInt(data.total_transaction),
total_modal: parseInt(data.total_modal), total_modal: parseInt(data.total_modal),
total_profit: parseInt(data.total_profit), total_profit: parseInt(data.total_profit),
total_commission: parseInt(total_expense) - parseInt(data.total_profit), total_commission: parseInt(data.total_profit) - parseInt(total_expense),
}; };
} }