refactor: rename profit metrics in AnalysisService and Analysis.vue for clarity; update variable names from laba_kotor and laba_bersih to gross_profit and net_profit
This commit is contained in:
parent
82fdb9ee0a
commit
deabe6b043
@ -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,
|
||||
|
||||
@ -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], () => {
|
||||
|
||||
<StatCard v-if="can('analysis.profit_gross') || can('analysis.profit_hpp')" title="Laba Kotor"
|
||||
:icon="TrendingUp" main-label="Laba Kotor"
|
||||
:main-value="'Rp' + formatRupiah(profitMetrics.laba_kotor)" :items="[
|
||||
:main-value="'Rp' + formatRupiah(profitMetrics.gross_profit)" :items="[
|
||||
{
|
||||
label: 'Pendapatan',
|
||||
value: 'Rp' + formatRupiah(revenueSummary.total_revenue),
|
||||
@ -752,7 +752,7 @@ watch([startDate, endDate], () => {
|
||||
},
|
||||
{
|
||||
label: 'Laba Bersih',
|
||||
value: 'Rp' + formatRupiah(profitMetrics.laba_bersih) + ' (' + profitMetrics.profit_margin + '%)',
|
||||
value: 'Rp' + formatRupiah(profitMetrics.net_profit) + ' (' + profitMetrics.profit_margin + '%)',
|
||||
},
|
||||
]" />
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user