diff --git a/app/Services/System/AnalysisService.php b/app/Services/System/AnalysisService.php index 6263bd7..a4c38c4 100644 --- a/app/Services/System/AnalysisService.php +++ b/app/Services/System/AnalysisService.php @@ -535,9 +535,9 @@ public function getProfitMetrics(?Carbon $startDate = null, ?Carbon $endDate = n $totalExpenses = (int) $purchaseTotal + (int) $expenseTotal + (int) $advanceTotal; - $labaKotor = $totalRevenue - $totalHpp - $totalDiscount - $marketplaceFees; - $labaBersih = $labaKotor - (int) $expenseTotal - (int) $advanceTotal; - $profitMargin = $totalRevenue > 0 ? round(($labaBersih / $totalRevenue) * 100, 1) : 0; + $grossProfit = $totalRevenue - $totalHpp - $totalDiscount - $marketplaceFees; + $netProfit = $grossProfit - (int) $expenseTotal - (int) $advanceTotal; + $profitMargin = $totalRevenue > 0 ? round(($netProfit / $totalRevenue) * 100, 1) : 0; $aov = $totalOrders > 0 ? (int) round($totalRevenue / $totalOrders) : 0; $itemsPerTransaction = $totalOrders > 0 ? round($totalItems / $totalOrders, 1) : 0; @@ -545,8 +545,8 @@ public function getProfitMetrics(?Carbon $startDate = null, ?Carbon $endDate = n 'total_orders' => $totalOrders, 'total_products_sold' => $totalQty, 'hpp' => $totalHpp, - 'laba_kotor' => $labaKotor, - 'laba_bersih' => $labaBersih, + 'gross_profit' => $grossProfit, + 'net_profit' => $netProfit, 'profit_margin' => $profitMargin, 'aov' => $aov, 'items_per_transaction' => $itemsPerTransaction, diff --git a/resources/js/pages/admin/Analysis.vue b/resources/js/pages/admin/Analysis.vue index e018684..1f1e2f9 100644 --- a/resources/js/pages/admin/Analysis.vue +++ b/resources/js/pages/admin/Analysis.vue @@ -102,8 +102,8 @@ const props = defineProps<{ total_orders: number; total_products_sold: number; hpp: number; - laba_kotor: number; - laba_bersih: number; + gross_profit: number; + net_profit: number; profit_margin: number; aov: number; items_per_transaction: number; @@ -741,7 +741,7 @@ watch([startDate, endDate], () => {