feat: add negotiation price to marketing sales calculations and update header label for discounts
This commit is contained in:
parent
dd3a2aa1eb
commit
25a316ccf0
@ -745,6 +745,7 @@ public function getMarketingSales(?string $startDate, ?string $endDate, ?User $u
|
||||
->selectRaw('COALESCE(SUM(orders.total_amount), 0) as total_revenue')
|
||||
->selectRaw('COALESCE(SUM(orders.subtotal), 0) as total_subtotal')
|
||||
->selectRaw('COALESCE(SUM(orders.discount), 0) as total_discount')
|
||||
->selectRaw('COALESCE(SUM(orders.nego_price), 0) as total_nego_price')
|
||||
->groupBy('orders.marketing_id', 'user_profiles.full_name')
|
||||
->get();
|
||||
|
||||
@ -764,7 +765,7 @@ public function getMarketingSales(?string $startDate, ?string $endDate, ?User $u
|
||||
'total_products_sold' => (int) ($productCounts[$item->marketing_id] ?? 0),
|
||||
'total_revenue' => $totalRevenue,
|
||||
'total_subtotal' => (int) $item->total_subtotal,
|
||||
'total_discount' => (int) $item->total_discount,
|
||||
'total_discount' => (int) $item->total_discount + (int) $item->total_nego_price,
|
||||
'avg_order' => $totalOrders > 0 ? (int) ($totalRevenue / $totalOrders) : 0,
|
||||
];
|
||||
})->toArray();
|
||||
|
||||
@ -1014,7 +1014,7 @@ export default function Analysis({
|
||||
<th className="px-4 py-3 text-right font-medium text-muted-foreground">Produk Terjual</th>
|
||||
<th className="px-4 py-3 text-right font-medium text-muted-foreground">Total Pendapatan</th>
|
||||
<th className="px-4 py-3 text-right font-medium text-muted-foreground">Total Subtotal</th>
|
||||
<th className="px-4 py-3 text-right font-medium text-muted-foreground">Total Diskon</th>
|
||||
<th className="px-4 py-3 text-right font-medium text-muted-foreground">Total Diskon & Potongan Nego</th>
|
||||
<th className="px-4 py-3 text-right font-medium text-muted-foreground">Rata-rata Order</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user