fix: 老板驾驶舱统一全口径数据源 - 实收/客单价/账单数/风险占比均取自store-expense/overview,与利润瀑布一致
This commit is contained in:
@@ -16,6 +16,7 @@ router.get('/overview', async (req: AuthRequest, res) => {
|
||||
r.store_code,
|
||||
r.store_name,
|
||||
r.received,
|
||||
r.bill_count,
|
||||
r.theoretical_margin_pct,
|
||||
COALESCE(e.operating_expense, 0) AS operating_expense,
|
||||
COALESCE(e.wage_expense, 0) AS wage_expense,
|
||||
@@ -40,7 +41,9 @@ router.get('/overview', async (req: AuthRequest, res) => {
|
||||
count(*) FILTER (WHERE actual_store_contribution > 0) AS profitable_stores,
|
||||
count(*) FILTER (WHERE actual_store_contribution <= 0 AND received > 0) AS loss_stores,
|
||||
count(*) FILTER (WHERE operating_expense = 0) AS no_expense_stores,
|
||||
sum(bill_count)::bigint AS total_bills,
|
||||
round(sum(received)::numeric, 2) AS total_received,
|
||||
round(sum(received) / nullif(sum(bill_count), 0), 2) AS avg_bill_value,
|
||||
round(sum(operating_expense)::numeric, 2) AS total_expense,
|
||||
round(sum(wage_expense)::numeric, 2) AS total_wage,
|
||||
round(sum(rent_expense)::numeric, 2) AS total_rent,
|
||||
|
||||
Reference in New Issue
Block a user