From 90be14a5d697e22eef617883a520bb2a2b603b6a Mon Sep 17 00:00:00 2001 From: freedakgmail Date: Thu, 30 Jul 2026 10:02:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=80=BB=E9=83=A8=E9=A9=BE=E9=A9=B6?= =?UTF-8?q?=E8=88=B1=E5=A2=9E=E5=8A=A0=E7=90=86=E8=AE=BA/=E5=AE=9E?= =?UTF-8?q?=E9=99=85=E5=87=80=E5=88=A9=E6=B6=A6=E3=80=81=E5=87=80=E5=88=A9?= =?UTF-8?q?=E7=8E=87=E3=80=81=E9=A3=9F=E6=9D=90=E6=88=90=E6=9C=AC=E7=8E=87?= =?UTF-8?q?=E6=8C=87=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/pages/DashboardPage.tsx | 10 +++++----- server/src/routes/store-expense.ts | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/client/src/pages/DashboardPage.tsx b/client/src/pages/DashboardPage.tsx index 8c830fd..b1a47b4 100644 --- a/client/src/pages/DashboardPage.tsx +++ b/client/src/pages/DashboardPage.tsx @@ -190,12 +190,12 @@ export function DashboardPage() { {/* 利润与成本 */} {ex && ( - +
- - - - + + + +
diff --git a/server/src/routes/store-expense.ts b/server/src/routes/store-expense.ts index 7a72540..1355935 100644 --- a/server/src/routes/store-expense.ts +++ b/server/src/routes/store-expense.ts @@ -26,10 +26,18 @@ router.get('/overview', async (req: AuthRequest, res) => { round(sum(card_fee_expense)::numeric, 2) AS total_card_fee, round(sum(repair_clean_expense)::numeric, 2) AS total_repair, round(sum(actual_food_cost)::numeric, 2) AS total_food_cost, + round(sum(theoretical_cost)::numeric, 2) AS total_theoretical_cost, round(sum(actual_store_contribution)::numeric, 2) AS total_contribution, + round(sum(theoretical_store_contribution)::numeric, 2) AS total_theoretical_contribution, + round(sum(received) - sum(theoretical_cost) - sum(operating_expense), 2) AS theoretical_net_profit, + round(sum(received) - sum(actual_food_cost) - sum(operating_expense), 2) AS actual_net_profit, round(sum(area_sqm)::numeric, 2) AS total_area, round((1 - sum(operating_expense) / nullif(sum(received), 0)) * 100, 2) AS overall_expense_rate_pct, round((1 - (sum(actual_food_cost) + sum(operating_expense)) / nullif(sum(received), 0)) * 100, 2) AS overall_contribution_rate_pct, + round((sum(received) - sum(theoretical_cost) - sum(operating_expense)) / nullif(sum(received), 0) * 100, 2) AS theoretical_net_margin_pct, + round((sum(received) - sum(actual_food_cost) - sum(operating_expense)) / nullif(sum(received), 0) * 100, 2) AS actual_net_margin_pct, + round(sum(theoretical_cost) / nullif(sum(received), 0) * 100, 2) AS theoretical_food_cost_rate_pct, + round(sum(actual_food_cost) / nullif(sum(received), 0) * 100, 2) AS actual_food_cost_rate_pct, round(sum(wage_expense) / nullif(sum(received), 0) * 100, 2) AS overall_wage_rate_pct, round(sum(rent_expense) / nullif(sum(received), 0) * 100, 2) AS overall_rent_rate_pct, round(sum(utility_expense) / nullif(sum(received), 0) * 100, 2) AS overall_utility_rate_pct