feat: update AnalysisService and Analysis.vue to include HPP in net revenue calculations for more accurate financial reporting

This commit is contained in:
Yoga Pangestu 2026-07-02 13:20:12 +07:00
parent 15f2f0e1d0
commit 82fdb9ee0a
2 changed files with 3 additions and 2 deletions

View File

@ -319,12 +319,13 @@ public function getMonthlyRevenue(?Carbon $startDate = null, ?Carbon $endDate =
$revenue = $monthlyData->firstWhere('month_key', $key);
$fees = $monthlyFees->get($key, 0);
$discount = (int) ($revenue->total_discount ?? 0);
$hpp = (int) ($monthlyHpp->get($key, 0));
$deduction = $discount + $fees;
$result[] = [
'month' => $monthLabel,
'total' => (int) ($revenue->total_revenue ?? 0),
'net' => (int) ($revenue->total_revenue ?? 0) - $deduction,
'net' => (int) ($revenue->total_revenue ?? 0) - $deduction - $hpp,
'deduction' => $deduction,
];

View File

@ -194,7 +194,7 @@ const revenueChartConfig = {
const revenueTotals = computed(() => ({
total: props.revenueSummary.total_revenue,
net: props.revenueSummary.total_revenue - props.revenueSummary.total_deduction,
net: props.revenueSummary.total_revenue - props.revenueSummary.total_deduction - props.profitMetrics.hpp,
deduction: props.revenueSummary.total_deduction,
}));