Compare commits

..

No commits in common. "6636c596f4b27ae081efac34e64ae2f916794d6d" and "f9dc49f7d5410e04d99c5a16d2bc0ec020e43bac" have entirely different histories.

1 changed files with 3 additions and 15 deletions

View File

@ -41,29 +41,17 @@ export class TransactionReadService extends BaseReadService<TransactionEntity> {
group by payment_type_counter, payment_type_method_name;`;
const transactions = await this.repo.query(query);
const qtyQuery = `select ti.item_id, ti.item_name, sum(ti.qty) total_qty, count(ti.item_name), sum(ti.qty), string_agg(distinct ti.item_price::text, '') price,
const qtyQuery = `select ti.item_name, sum(ti.qty) total_qty, count(ti.item_name), sum(ti.qty), string_agg(distinct ti.item_price::text, '') price,
sum(payment_total) payment_total, sum(payment_total_pay) payment_total_pay
from transactions t
inner join transaction_items ti on t.id = ti.transaction_id
where t.creator_counter_no IN (${posId})
and invoice_date = '${startDate}'
and t.status = 'settled'
group by ti.item_name, ti.item_id`;
group by ti.item_name`;
const qtyTransactions = await this.repo.query(qtyQuery);
const totalSalesQuery = `select sum(payment_total) payment_total
from transactions t
where 1=1
and t.creator_counter_no IN (${posId})
and invoice_date = '${startDate}'
and status = 'settled'`;
const totalSales = await this.repo.query(totalSalesQuery);
return {
payment: transactions,
qty: qtyTransactions,
totalSales: totalSales?.[0]?.payment_total ?? 0,
};
return { payment: transactions, qty: qtyTransactions };
}
async getLastTransactionByPos(