feat: correct stats for telecart dashboard

This commit is contained in:
2025-12-13 01:03:53 +03:00
parent 8f6e2177b0
commit 05af4949bf

View File

@@ -30,6 +30,9 @@ class StatsHandler
new RawExpression('SUM(orders.total) AS orders_total_amount'), new RawExpression('SUM(orders.total) AS orders_total_amount'),
]) ])
->from(db_table('order'), 'orders') ->from(db_table('order'), 'orders')
->join('telecart_customers', function (JoinClause $join) {
$join->on('orders.customer_id', '=', 'telecart_customers.oc_customer_id');
})
->join('telecart_order_meta', function (JoinClause $join) { ->join('telecart_order_meta', function (JoinClause $join) {
$join->on('orders.order_id', '=', 'telecart_order_meta.oc_order_id') $join->on('orders.order_id', '=', 'telecart_order_meta.oc_order_id')
->whereRaw('orders.store_id = telecart_order_meta.oc_store_id'); ->whereRaw('orders.store_id = telecart_order_meta.oc_store_id');