fix(profit-caliber): 博海口径 §4-1/§4-2/§4-5 落地 —— 固定成本仅借方 + 6403 进变动 + 财务收益单列 + 批次备注
ci/woodpecker/push/main Pipeline was successful

ASK-20261014-04(任总 2026-10-14 11:20「放行4」)批后口径:
- §4-1 博海固定成本弃净额:6601/6602/6603 仅借方(133.98 万,2026-01..09);2026-03 单月由 -9.02 万转正;
  6603 贷方(现金折扣收益 64.40 万)改 finance_income_terms 单列备查,不进固定成本/末行/勾稽。
- §4-2 博海变动成本追加 6403 营业税金及附加(530.17 万)。
- §4-3/§4-4 维持现行(酣客收入/边际贡献基数不动)。
- §4-5 管理利润表页加「数据批次/导入时刻」纯展示备注(import_logs)。
- 口径唯一源仍为 bep_caliber.ENTITY_CALIBERS;报表/卡面/派生器一律经 fixed_cost_spec() 解析(读口写口一致)。
This commit is contained in:
Hermes CI Fix
2026-10-16 12:32:52 +08:00
parent ff2d92ba54
commit 289cc8f2cc
7 changed files with 228 additions and 50 deletions
+10 -4
View File
@@ -118,7 +118,7 @@ CARRY_SUBJECT = "3103" # 本年利润(carry_forward=1 且该科目 = 该
# (博海账套的结转行 carry_forward 仍是 0,不剔除则已结账期间净额恒 0 ⇒ 指标被清零)
# 同表被 backend/app/api/dashboard.py::/bep-card 共用(口径不漂移)。
from app.utils.bep_caliber import ( # noqa: E402 (紧随 sys.path 之后导入)
CLOSING_SUMMARY_LIKE, ENTITY_CALIBERS, caliber_for,
CLOSING_SUMMARY_LIKE, ENTITY_CALIBERS, caliber_for, fixed_cost_spec,
)
# 智享通落盘目录(与 app/api/data.py 的 ZXT_LANDING_DIR 一致)——结账信号次选来源
@@ -509,12 +509,18 @@ def run_derive(db, entity_id: int, period: str, rebate_rate_pct: float = None,
months = int(period[5:7]) # YTD 月数(1月=1 ... 7月=7)
# 1. 取数(元 → 万元)——按实体口径
# 固定成本经 bep_caliber.fixed_cost_spec() 唯一解析口:e1 前缀净额 / e2 带号科目项仅借方(§4-1)
fix_mode, fix_spec = fixed_cost_spec(cal)
sales_sum_w = _sum_field(db, entity_id, period_from, period_to,
cal["revenue_field"], cal["revenue_filter"],
exclude_closing=cal["exclude_closing"]) / 10000.0
admin_sum_w = _sum_field(db, entity_id, period_from, period_to, "net",
subject_filters=cal["fixed_filters"],
exclude_closing=cal["exclude_closing"]) / 10000.0
if fix_mode == "terms":
admin_sum_w = _sum_terms(db, entity_id, period_from, period_to, fix_spec,
exclude_closing=cal["exclude_closing"]) / 10000.0
else:
admin_sum_w = _sum_field(db, entity_id, period_from, period_to, "net",
subject_filters=fix_spec,
exclude_closing=cal["exclude_closing"]) / 10000.0
dep_sum_w = _sum_field(db, entity_id, period_from, period_to,
cal["dep_field"], cal["dep_filter"],
exclude_closing=cal["exclude_closing"]) / 10000.0