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;
|
$totalExpenses = (int) $purchaseTotal + (int) $expenseTotal + (int) $advanceTotal;
|
||||||
|
|
||||||
$labaKotor = $totalRevenue - $totalHpp - $totalDiscount - $marketplaceFees;
|
$grossProfit = $totalRevenue - $totalHpp - $totalDiscount - $marketplaceFees;
|
||||||
$labaBersih = $labaKotor - (int) $expenseTotal - (int) $advanceTotal;
|
$netProfit = $grossProfit - (int) $expenseTotal - (int) $advanceTotal;
|
||||||
$profitMargin = $totalRevenue > 0 ? round(($labaBersih / $totalRevenue) * 100, 1) : 0;
|
$profitMargin = $totalRevenue > 0 ? round(($netProfit / $totalRevenue) * 100, 1) : 0;
|
||||||
$aov = $totalOrders > 0 ? (int) round($totalRevenue / $totalOrders) : 0;
|
$aov = $totalOrders > 0 ? (int) round($totalRevenue / $totalOrders) : 0;
|
||||||
$itemsPerTransaction = $totalOrders > 0 ? round($totalItems / $totalOrders, 1) : 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_orders' => $totalOrders,
|
||||||
'total_products_sold' => $totalQty,
|
'total_products_sold' => $totalQty,
|
||||||
'hpp' => $totalHpp,
|
'hpp' => $totalHpp,
|
||||||
'laba_kotor' => $labaKotor,
|
'gross_profit' => $grossProfit,
|
||||||
'laba_bersih' => $labaBersih,
|
'net_profit' => $netProfit,
|
||||||
'profit_margin' => $profitMargin,
|
'profit_margin' => $profitMargin,
|
||||||
'aov' => $aov,
|
'aov' => $aov,
|
||||||
'items_per_transaction' => $itemsPerTransaction,
|
'items_per_transaction' => $itemsPerTransaction,
|
||||||
|
|||||||
@ -102,8 +102,8 @@ const props = defineProps<{
|
|||||||
total_orders: number;
|
total_orders: number;
|
||||||
total_products_sold: number;
|
total_products_sold: number;
|
||||||
hpp: number;
|
hpp: number;
|
||||||
laba_kotor: number;
|
gross_profit: number;
|
||||||
laba_bersih: number;
|
net_profit: number;
|
||||||
profit_margin: number;
|
profit_margin: number;
|
||||||
aov: number;
|
aov: number;
|
||||||
items_per_transaction: 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"
|
<StatCard v-if="can('analysis.profit_gross') || can('analysis.profit_hpp')" title="Laba Kotor"
|
||||||
:icon="TrendingUp" main-label="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',
|
label: 'Pendapatan',
|
||||||
value: 'Rp' + formatRupiah(revenueSummary.total_revenue),
|
value: 'Rp' + formatRupiah(revenueSummary.total_revenue),
|
||||||
@ -752,7 +752,7 @@ watch([startDate, endDate], () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Laba Bersih',
|
label: 'Laba Bersih',
|
||||||
value: 'Rp' + formatRupiah(profitMetrics.laba_bersih) + ' (' + profitMetrics.profit_margin + '%)',
|
value: 'Rp' + formatRupiah(profitMetrics.net_profit) + ' (' + profitMetrics.profit_margin + '%)',
|
||||||
},
|
},
|
||||||
]" />
|
]" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user