diff --git a/client/src/pages/ProfitAnalysis.tsx b/client/src/pages/ProfitAnalysis.tsx index c2b3f35..9c6fe58 100644 --- a/client/src/pages/ProfitAnalysis.tsx +++ b/client/src/pages/ProfitAnalysis.tsx @@ -40,6 +40,11 @@ const ProfitAnalysis = () => { return ProfitAnalysisService.calculateProfitMetrics(filteredOrders, products || [], filteredExpenses); }, [filteredOrders, products, filteredExpenses]); + // Monthly revenue / cost / profit trend + const monthlyTrends = useMemo(() => { + return ProfitAnalysisService.calculateMonthlyTrends(filteredOrders, products || [], filteredExpenses); + }, [filteredOrders, products, filteredExpenses]); + // Profit & loss statement + indicative GST summary for the selected period const plData = useMemo(() => { const revenue = filteredOrders.reduce((s, o) => s + orderNetRevenue(o), 0); @@ -456,13 +461,77 @@ const ProfitAnalysis = () => { )} - {/* Placeholder for trends view */} + {/* Monthly trends */} {selectedView === 'trends' && ( -
Interactive charts coming soon...
-No data for the selected period.
+| {h} | + ))} +||||||
|---|---|---|---|---|---|---|
| {m.month} | +{m.orderCount} | +{formatCurrency(m.revenue)} | +{formatCurrency(m.costs)} | +{formatCurrency(m.expenses)} | += 0 ? 'text-green-600' : 'text-red-600'}`}>{formatCurrency(m.profit)} | +{m.margin.toFixed(1)}% | +