feat: add assessment workbench and September reconciliation

Preserve August hydrogen revision and September audit evidence; calculate interrupted vehicle history across all prior months. Record remaining carry-policy and layout-baseline discrepancies.
This commit is contained in:
shishengliang
2026-10-09 18:21:45 +08:00
parent 3ed3548b9d
commit 65904c8270
108 changed files with 1368801 additions and 3 deletions
@@ -0,0 +1,120 @@
# 1—8月已发与9月发放核对
核对对象:2026年9月40,211.67元版本,145条发放项。原Excel保持不变。核对以用户确认的1—7月历史最终表、8月纯氢修正版实际已发45,065.47元为基准。
## 结论
**补发与金额算术检查通过;结转资格存在规则分支不一致,需要澄清后再将结果作为最终付款依据。**
按8月表内结转余额逐月减1的现行逻辑,独立重算9月仍为40,211.67元,未发现金额公式错误或重复历史补发。此结论不等于认可结转余额的形成口径。
## 1. 结转两种算法不一致:9月有150元需要复核
有实际考核记录的车组按“累计多跑里程÷月目标取整−实际已用结转期数”计算余额;无本月考核记录的车组却按“上期余额−1”,同时在累计目标中增加一个月目标。这是代码中不同分支的实际行为。
8月底有5辆车的表内结转余额比统一累计公式多1期。尚建华的粤AGP5158会影响9月当期150元,其余4辆在两种口径下9月都有至少1期可用结转,主要影响后续余额。
|车辆|负责人|8月底表内余额|累计公式余额|1—8月已领结转次数|9月结转|
|---|---|---:|---:|---:|---:|
|粤AGR8531|刘念念|4|3|4|150.00|
|粤AGP5158|尚建华|1|0|6|150.00|
|粤AGP9786|董剑煜|5|4|4|150.00|
|粤AGR6877|董剑煜|6|5|4|150.00|
|粤AGR5560|金可鹏|2|1|7|150.00|
粤AGP5158截至8月累计实际41,174.00公里、累计目标22,451.61公里、月目标3,000公里,实际已领6次结转。统一累计公式得到 floor((41,174.00−22,451.61)/3,000)−6=0期;8月表却保存1期,9月据此发150元。
**不能直接将150元定为多发并扣除。** 无考核月份是否应增加虚拟考核目标,决定了两种余额计算哪一种适用;若增加虚拟目标又扣除已领期数,可能重复消耗同一结转额度。应先统一规则,再调整9月及后续余额,1—8月实际已发保持不变。若明确要求保留目前累计目标、全部统一累计公式,则这笔150元不满足资格,9月在其他条件不变时为40,061.67元。这只是该口径下的测算,不是建议直接改付。
## 2. 同车新旧负责人同时领取,共涉及原负责人970元
本月无考核记录的结转共33笔、5,940元。其中以下5辆同时给新负责人发当月奖金、给旧负责人发历史结转。按目前“车牌+负责人”分账、历史结转继续发放的规则可以复现,并非同一负责人重复发放。若制度要求交接后原负责人停止领取,才会影响这970元。不能把它直接作为错付款扣除。
|车辆|原负责人|原负责人结转|新负责人发放|
|---|---|---:|---|
|粤AGP3080|董剑煜|150.00|尚建华 当月 5.00元|
|粤AGR6869|董剑煜|150.00|尚建华 当月 150.00元|
|粤AGP3627|金可鹏|260.00|秦挺 当月 260.00元|
|粤AGP3692|金可鹏|260.00|秦挺 当月 260.00元|
|粤AGR5560|金可鹏|150.00|钟祥 当月 5.00元|
## 3. 9月底17辆结转余额不同,33条累计状态显示不准确
17个无本月考核车组的表内结转余额与统一累计公式合计相差20期。这是口径差异,不能直接换算成确定多发金额;不同车辆奖励基准、未来有无考核及补数均可能变化。
|车辆|负责人|9月底表内余额|统一累计公式余额|
|---|---|---:|---:|
|粤AGP3508|刘念念|3|2|
|粤AGR8531|刘念念|3|1|
|粤AGP9825|尚建华|1|0|
|粤AGR0790|尚建华|1|0|
|粤AGR6859|尚建华|2|1|
|粤AGR9815|尚建华|3|2|
|粤AGR9866|尚建华|6|5|
|粤AGP3080|董剑煜|10|9|
|粤AGP9786|董剑煜|4|2|
|粤AGR2833|董剑煜|3|2|
|粤AGR6828|董剑煜|2|1|
|粤AGR6869|董剑煜|5|4|
|粤AGR6877|董剑煜|5|3|
|粤AGP3506|谯云|2|1|
|粤AGP9707|谯云|1|0|
|粤AGP3627|金可鹏|4|3|
|粤AGR5560|金可鹏|1|0|
33个无本月考核车组在程序中把累计达标标志固定为否,但显示的累计实际里程均已达到累计目标。例如粤AGP5158累计实际41,174.00大于目标25,451.61,计算过程仍显示“已有里程未达标”。这是展示语义问题,并不等于应额外补发。建议将“累计里程是否达标”与“本月是否有考核、是否具备补发资格”分开显示。
## 4. 已确认没有重复的7笔历史补发
按“车辆+原考核负责人+考核月”逐项检查1—8月已发;7笔合计819.67元,没有重复,非虚拟考核车组也未发现符合现行规则而遗漏的补发。
|车辆|负责人|补发类别|金额|9月累计实际|9月累计目标|
|---|---|---|---:|---:|---:|
|粤AGR5228|吴纬涛|补发8月|150.00|6069.00|6000.00|
|粤AGR8536|吴纬涛|补发8月|24.19|3603.70|3483.87|
|粤AGP3612|尚建华|补发5月|33.55|20767.20|20645.16|
|粤AGP3612|尚建华|补发7月|260.00|20767.20|20645.16|
|粤AGP3612|尚建华|补发8月|260.00|20767.20|20645.16|
|粤AGR0772|尚建华|补发8月|19.35|6470.60|3387.10|
|粤AGP5138|钟祥|补发8月|72.58|5932.30|4451.61|
粤AGP3612尚建华到9月累计超目标122.04公里,8月底尚差1,023.06公里,因此9月才补5月33.55元、7月260元、8月260元。6月已经实际发放,未重复补发。
粤AGR0772尚建华补8月19.35元,与谯云8月已发116.13元不是重复:分别为8月28—31日与8月1—24日两个负责人区间。
## 5. 台账、取数及报表一致性
- 1—6月已发台账逐条吻合历史最终表;6月人员转接后的个人合计也一致。
- 7月原明细仍列9笔离职不发款2,749.35元,已发台账已正确剔除。最终汇总62,616.73元与逐项和62,616.76元相差0.03元,是历史原表舍入差。
- 8月纯氢修正版实际已发45,065.47元及原扣减9.68元保持不变,扣减项不再次补发。
- 9月145条发放项与Excel缓存值一致,金额公式未发现错误。结转、当月、累计补发当月之间未发现同负责人同车的重复占用。
- 实际已领结转次数与1—8月台账逐车一致,问题发生在余额计算方式,不是漏记已领次数。
- 9月刘念念全部归业务一部,部门汇总与明细一致;新政策名单沿用原39辆、当月匹配36辆。
- 8,737个考核车辆日无重复计入,原始来源文件哈希未改变。此前中断月份清零触发误补发的问题在当前版本未再出现。
## 6. 仍有数据缺口
9月1,000个车辆日缺少所需来源,涉及176辆车;其中991个需仪表、9个需GPS。6条考核记录整段缺少可用里程。61条发放项(16,662.34元)带有本月或8月缺口标记,标记不代表这些金额均算错:部分已有里程已经足够达标,结转也可能来自历史。补齐数据后仍可能改变未达标、补发和结转余额。
尚建华粤AGR5535虽然9月2天全缺,仍列累计补发9月10元:仅历史已知里程4,246.80公里已经大于包含9月目标后的3,521.43公里,按现行累计达标规则可以复现;0仅为当前已知累计,不是实测零里程。
## 处理建议
1. 优先统一无本月考核车辆的结转目标、余额消耗方式,避免一边增加虚拟目标、一边重复扣已用期数。先核实粤AGP5158的150元,再统一17辆后续余额。
2. 明确交接后原负责人能否继续领取历史结转;若允许,表内将旧负责人历史结转与新负责人当月奖励清楚分开即可。
3. 更正无本月考核车组的累计状态文字,保持累计结果与补发资格两个概念分开。
4. 补齐1,000个车辆日缺口后重算。当前40,211.67元保留为现行口径暂算,不表示以上规则问题已解决。
## 核对范围及证据
全量核对145条9月发放、1—8月对应已发状态、369个当前车组的历史累计及结转次数;重复展示的个人页沿用已完成金额核验。没有重新从平台获取GPS,也未重新审核1—6月纯氢原始采集准确性。银行支付未另取流水,按用户确认的历史最终表作为已发。
当前9月文件SHA256:`48adeb7390b57bad94a78f06f84504988a8b8c845a6d3156e11845cb85a8bff4`
- [里程任务考核_1月核算.xlsx](/Users/shishengliang/Code/lingniu/mileage-bonus/里程任务考核_1月核算.xlsx)
- [里程任务考核_2月核算.xlsx](/Users/shishengliang/Code/lingniu/mileage-bonus/里程任务考核_2月核算.xlsx)
- [里程任务考核_3月核算.xlsx](/Users/shishengliang/Code/lingniu/mileage-bonus/里程任务考核_3月核算.xlsx)
- [里程任务考核_4月核算.xlsx](/Users/shishengliang/Code/lingniu/mileage-bonus/里程任务考核_4月核算.xlsx)
- [里程任务考核_5月核算.xlsx](/Users/shishengliang/Code/lingniu/mileage-bonus/里程任务考核_5月核算.xlsx)
- [里程任务考核_6月核算.xlsx](/Users/shishengliang/Code/lingniu/mileage-bonus/里程任务考核_6月核算.xlsx)
- [里程任务考核_7月核算.xlsx](/Users/shishengliang/Code/lingniu/mileage-bonus/7月绩效重算_多源考核里程_20260817/里程任务考核_7月核算.xlsx)
- [里程任务考核_8月核算_纯氢修正版.xlsx](/Users/shishengliang/Code/lingniu/mileage-bonus/outputs/hydrogen-history-20260916/里程任务考核_8月核算_纯氢修正版.xlsx)
- [里程任务考核_2026年9月_含缺口核算.xlsx](/Users/shishengliang/Code/lingniu/mileage-bonus/outputs/september-20261009/里程任务考核_2026年9月_含缺口核算.xlsx)
复核脚本:audit_september_against_paid.py、independent.py;逐项结果:audit_results.json、history_checks.json。
@@ -0,0 +1,820 @@
{
"amount": 40211.67,
"ledger_items": 145,
"expected_amount_under_locked_aug_carry": 40211.67,
"missing_payments": [],
"extra_payments": [],
"categories": {
"当月": 23692.01,
"结转": 13350.0,
"累计补发9月": 2349.99,
"补发8月": 526.12,
"补发7月": 260.0,
"补发6月": 0.0,
"补发5月": 33.55,
"补发4月": 0.0,
"补发3月": 0.0,
"补发2月": 0.0,
"补发1月": 0.0
},
"historical_backpay": [
{
"plate": "粤AGR5228",
"sales": "吴纬涛",
"category": "补发8月",
"amount": 150.0,
"aug_cumulative_target": 3000.0,
"aug_cumulative_actual": 1378.8,
"sep_cumulative_target": 6000.0,
"sep_cumulative_actual": 6069.0,
"historically_unpaid": true
},
{
"plate": "粤AGR8536",
"sales": "吴纬涛",
"category": "补发8月",
"amount": 24.19,
"aug_cumulative_target": 483.87,
"aug_cumulative_actual": 371.7,
"sep_cumulative_target": 3483.87,
"sep_cumulative_actual": 3603.7,
"historically_unpaid": true
},
{
"plate": "粤AGP3612",
"sales": "尚建华",
"category": "补发5月",
"amount": 33.55,
"aug_cumulative_target": 15645.16,
"aug_cumulative_actual": 14622.1,
"sep_cumulative_target": 20645.16,
"sep_cumulative_actual": 20767.2,
"historically_unpaid": true
},
{
"plate": "粤AGP3612",
"sales": "尚建华",
"category": "补发7月",
"amount": 260.0,
"aug_cumulative_target": 15645.16,
"aug_cumulative_actual": 14622.1,
"sep_cumulative_target": 20645.16,
"sep_cumulative_actual": 20767.2,
"historically_unpaid": true
},
{
"plate": "粤AGP3612",
"sales": "尚建华",
"category": "补发8月",
"amount": 260.0,
"aug_cumulative_target": 15645.16,
"aug_cumulative_actual": 14622.1,
"sep_cumulative_target": 20645.16,
"sep_cumulative_actual": 20767.2,
"historically_unpaid": true
},
{
"plate": "粤AGR0772",
"sales": "尚建华",
"category": "补发8月",
"amount": 19.35,
"aug_cumulative_target": 387.1,
"aug_cumulative_actual": 300.6,
"sep_cumulative_target": 3387.1,
"sep_cumulative_actual": 6470.6,
"historically_unpaid": true
},
{
"plate": "粤AGP5138",
"sales": "钟祥",
"category": "补发8月",
"amount": 72.58,
"aug_cumulative_target": 1451.61,
"aug_cumulative_actual": 718.5,
"sep_cumulative_target": 4451.61,
"sep_cumulative_actual": 5932.3,
"historically_unpaid": true
}
],
"prior_carry_basis_differences": [
{
"plate": "粤AGR8531",
"sales": "刘念念",
"aug_cumulative_target": 17516.13,
"aug_cumulative_actual": 40637.6,
"monthly_target": 3000,
"carry_paid_jan_aug": 4,
"aug_saved_balance": 4,
"aug_formula_balance": 3,
"sep_saved_balance": 3,
"sep_formula_balance": 1,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGP5158",
"sales": "尚建华",
"aug_cumulative_target": 22451.61,
"aug_cumulative_actual": 41174.0,
"monthly_target": 3000,
"carry_paid_jan_aug": 6,
"aug_saved_balance": 1,
"aug_formula_balance": 0,
"sep_saved_balance": 0,
"sep_formula_balance": 0,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGP9786",
"sales": "董剑煜",
"aug_cumulative_target": 15580.64,
"aug_cumulative_actual": 41070.5,
"monthly_target": 3000,
"carry_paid_jan_aug": 4,
"aug_saved_balance": 5,
"aug_formula_balance": 4,
"sep_saved_balance": 4,
"sep_formula_balance": 2,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGR6877",
"sales": "董剑煜",
"aug_cumulative_target": 16838.71,
"aug_cumulative_actual": 44184.4,
"monthly_target": 3000,
"carry_paid_jan_aug": 4,
"aug_saved_balance": 6,
"aug_formula_balance": 5,
"sep_saved_balance": 5,
"sep_formula_balance": 3,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGR5560",
"sales": "金可鹏",
"aug_cumulative_target": 22500.0,
"aug_cumulative_actual": 47026.6,
"monthly_target": 3000,
"carry_paid_jan_aug": 7,
"aug_saved_balance": 2,
"aug_formula_balance": 1,
"sep_saved_balance": 1,
"sep_formula_balance": 0,
"sep_payment": 150.0,
"virtual": true
}
],
"next_balance_differences": [
{
"plate": "粤AGP3508",
"sales": "刘念念",
"aug_cumulative_target": 23225.81,
"aug_cumulative_actual": 54980.6,
"monthly_target": 3000,
"carry_paid_jan_aug": 6,
"aug_saved_balance": 4,
"aug_formula_balance": 4,
"sep_saved_balance": 3,
"sep_formula_balance": 2,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGR8531",
"sales": "刘念念",
"aug_cumulative_target": 17516.13,
"aug_cumulative_actual": 40637.6,
"monthly_target": 3000,
"carry_paid_jan_aug": 4,
"aug_saved_balance": 4,
"aug_formula_balance": 3,
"sep_saved_balance": 3,
"sep_formula_balance": 1,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGP9825",
"sales": "尚建华",
"aug_cumulative_target": 23612.9,
"aug_cumulative_actual": 41230.0,
"monthly_target": 3000,
"carry_paid_jan_aug": 3,
"aug_saved_balance": 2,
"aug_formula_balance": 2,
"sep_saved_balance": 1,
"sep_formula_balance": 0,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGR0790",
"sales": "尚建华",
"aug_cumulative_target": 24000.0,
"aug_cumulative_actual": 34894.5,
"monthly_target": 3000,
"carry_paid_jan_aug": 1,
"aug_saved_balance": 2,
"aug_formula_balance": 2,
"sep_saved_balance": 1,
"sep_formula_balance": 0,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGR6859",
"sales": "尚建华",
"aug_cumulative_target": 22935.48,
"aug_cumulative_actual": 48164.7,
"monthly_target": 3000,
"carry_paid_jan_aug": 5,
"aug_saved_balance": 3,
"aug_formula_balance": 3,
"sep_saved_balance": 2,
"sep_formula_balance": 1,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGR9815",
"sales": "尚建华",
"aug_cumulative_target": 22838.71,
"aug_cumulative_actual": 50731.1,
"monthly_target": 3000,
"carry_paid_jan_aug": 5,
"aug_saved_balance": 4,
"aug_formula_balance": 4,
"sep_saved_balance": 3,
"sep_formula_balance": 2,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGR9866",
"sales": "尚建华",
"aug_cumulative_target": 22935.48,
"aug_cumulative_actual": 60137.7,
"monthly_target": 3000,
"carry_paid_jan_aug": 5,
"aug_saved_balance": 7,
"aug_formula_balance": 7,
"sep_saved_balance": 6,
"sep_formula_balance": 5,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGP3080",
"sales": "董剑煜",
"aug_cumulative_target": 16548.39,
"aug_cumulative_actual": 58747.1,
"monthly_target": 3000,
"carry_paid_jan_aug": 3,
"aug_saved_balance": 11,
"aug_formula_balance": 11,
"sep_saved_balance": 10,
"sep_formula_balance": 9,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGP9786",
"sales": "董剑煜",
"aug_cumulative_target": 15580.64,
"aug_cumulative_actual": 41070.5,
"monthly_target": 3000,
"carry_paid_jan_aug": 4,
"aug_saved_balance": 5,
"aug_formula_balance": 4,
"sep_saved_balance": 4,
"sep_formula_balance": 2,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGR2833",
"sales": "董剑煜",
"aug_cumulative_target": 17236.17,
"aug_cumulative_actual": 44475.6,
"monthly_target": 3000,
"carry_paid_jan_aug": 5,
"aug_saved_balance": 4,
"aug_formula_balance": 4,
"sep_saved_balance": 3,
"sep_formula_balance": 2,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGR6828",
"sales": "董剑煜",
"aug_cumulative_target": 14806.45,
"aug_cumulative_actual": 35422.1,
"monthly_target": 3000,
"carry_paid_jan_aug": 3,
"aug_saved_balance": 3,
"aug_formula_balance": 3,
"sep_saved_balance": 2,
"sep_formula_balance": 1,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGR6869",
"sales": "董剑煜",
"aug_cumulative_target": 11225.81,
"aug_cumulative_actual": 35687.9,
"monthly_target": 3000,
"carry_paid_jan_aug": 2,
"aug_saved_balance": 6,
"aug_formula_balance": 6,
"sep_saved_balance": 5,
"sep_formula_balance": 4,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGR6877",
"sales": "董剑煜",
"aug_cumulative_target": 16838.71,
"aug_cumulative_actual": 44184.4,
"monthly_target": 3000,
"carry_paid_jan_aug": 4,
"aug_saved_balance": 6,
"aug_formula_balance": 5,
"sep_saved_balance": 5,
"sep_formula_balance": 3,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGP3506",
"sales": "谯云",
"aug_cumulative_target": 22064.52,
"aug_cumulative_actual": 56936.05,
"monthly_target": 5000,
"carry_paid_jan_aug": 3,
"aug_saved_balance": 3,
"aug_formula_balance": 3,
"sep_saved_balance": 2,
"sep_formula_balance": 1,
"sep_payment": 260.0,
"virtual": true
},
{
"plate": "粤AGP9707",
"sales": "谯云",
"aug_cumulative_target": 22064.52,
"aug_cumulative_actual": 47339.56,
"monthly_target": 5000,
"carry_paid_jan_aug": 3,
"aug_saved_balance": 2,
"aug_formula_balance": 2,
"sep_saved_balance": 1,
"sep_formula_balance": 0,
"sep_payment": 260.0,
"virtual": true
},
{
"plate": "粤AGP3627",
"sales": "金可鹏",
"aug_cumulative_target": 40000.0,
"aug_cumulative_actual": 91230.6,
"monthly_target": 5000,
"carry_paid_jan_aug": 5,
"aug_saved_balance": 5,
"aug_formula_balance": 5,
"sep_saved_balance": 4,
"sep_formula_balance": 3,
"sep_payment": 260.0,
"virtual": true
},
{
"plate": "粤AGR5560",
"sales": "金可鹏",
"aug_cumulative_target": 22500.0,
"aug_cumulative_actual": 47026.6,
"monthly_target": 3000,
"carry_paid_jan_aug": 7,
"aug_saved_balance": 2,
"aug_formula_balance": 1,
"sep_saved_balance": 1,
"sep_formula_balance": 0,
"sep_payment": 150.0,
"virtual": true
}
],
"cumulative_status_inconsistencies": [
{
"plate": "粤AGP3508",
"sales": "刘念念",
"target": 26225.81,
"actual": 54980.6,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGP3607",
"sales": "刘念念",
"target": 44516.13,
"actual": 53398.0,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGP9835",
"sales": "刘念念",
"target": 26129.03,
"actual": 43693.2,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGR5050",
"sales": "刘念念",
"target": 25741.94,
"actual": 44215.4,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGR8531",
"sales": "刘念念",
"target": 20516.13,
"actual": 40637.6,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGP3027",
"sales": "尚建华",
"target": 28870.97,
"actual": 29873.8,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGP5158",
"sales": "尚建华",
"target": 25451.61,
"actual": 41174.0,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGP5165",
"sales": "尚建华",
"target": 27715.06,
"actual": 33049.8,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGP5770",
"sales": "尚建华",
"target": 20645.16,
"actual": 23343.6,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGP6639",
"sales": "尚建华",
"target": 26225.81,
"actual": 34430.1,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGP9825",
"sales": "尚建华",
"target": 26612.9,
"actual": 41230.0,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGQ3688",
"sales": "尚建华",
"target": 26225.81,
"actual": 48641.2,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGR0790",
"sales": "尚建华",
"target": 27000.0,
"actual": 34894.5,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGR5539",
"sales": "尚建华",
"target": 22358.06,
"actual": 41459.3,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGR6859",
"sales": "尚建华",
"target": 25935.48,
"actual": 48164.7,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGR6881",
"sales": "尚建华",
"target": 11612.91,
"actual": 18752.1,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGR9815",
"sales": "尚建华",
"target": 25838.71,
"actual": 50731.1,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGR9866",
"sales": "尚建华",
"target": 25935.48,
"actual": 60137.7,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGP3080",
"sales": "董剑煜",
"target": 19548.39,
"actual": 58747.1,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGP9785",
"sales": "董剑煜",
"target": 18870.97,
"actual": 29223.8,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGP9786",
"sales": "董剑煜",
"target": 18580.64,
"actual": 41070.5,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGR2833",
"sales": "董剑煜",
"target": 20236.17,
"actual": 44475.6,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGR6828",
"sales": "董剑煜",
"target": 17806.45,
"actual": 35422.1,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGR6869",
"sales": "董剑煜",
"target": 14225.81,
"actual": 35687.9,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGR6877",
"sales": "董剑煜",
"target": 19838.71,
"actual": 44184.4,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGR8500",
"sales": "董剑煜",
"target": 20332.95,
"actual": 35661.2,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGP3506",
"sales": "谯云",
"target": 27064.52,
"actual": 56936.05,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGP5760",
"sales": "谯云",
"target": 26741.94,
"actual": 44870.89,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGP9707",
"sales": "谯云",
"target": 27064.52,
"actual": 47339.56,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGR9769",
"sales": "谯云",
"target": 16935.49,
"actual": 28617.1,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGP3627",
"sales": "金可鹏",
"target": 45000.0,
"actual": 91230.6,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGP3692",
"sales": "金可鹏",
"target": 45000.0,
"actual": 73049.1,
"stored": false,
"calculated": true,
"virtual": true
},
{
"plate": "粤AGR5560",
"sales": "金可鹏",
"target": 25500.0,
"actual": 47026.6,
"stored": false,
"calculated": true,
"virtual": true
}
],
"used_count_differences": [],
"cross_owner_payments": [
{
"plate": "粤AGP3080",
"carry_owner": "董剑煜",
"carry_amount": 150.0,
"current_payments": [
{
"sales": "尚建华",
"category": "当月",
"amount": 5.0
}
]
},
{
"plate": "粤AGR6869",
"carry_owner": "董剑煜",
"carry_amount": 150.0,
"current_payments": [
{
"sales": "尚建华",
"category": "当月",
"amount": 150.0
}
]
},
{
"plate": "粤AGP3627",
"carry_owner": "金可鹏",
"carry_amount": 260.0,
"current_payments": [
{
"sales": "秦挺",
"category": "当月",
"amount": 260.0
}
]
},
{
"plate": "粤AGP3692",
"carry_owner": "金可鹏",
"carry_amount": 260.0,
"current_payments": [
{
"sales": "秦挺",
"category": "当月",
"amount": 260.0
}
]
},
{
"plate": "粤AGR5560",
"carry_owner": "金可鹏",
"carry_amount": 150.0,
"current_payments": [
{
"sales": "钟祥",
"category": "当月",
"amount": 5.0
}
]
}
],
"virtual_count": 33,
"virtual_amount": 5940.0,
"gap_payment_count": 61,
"gap_payment_amount": 16662.34,
"wholly_missing": [
{
"车牌号": "粤AGR5535",
"销售经理": "尚建华",
"考核天数": 2
},
{
"车牌号": "粤AG39007",
"销售经理": "吴纬涛",
"考核天数": 9
},
{
"车牌号": "粤AGP5139",
"销售经理": "吴纬涛",
"考核天数": 30
},
{
"车牌号": "粤AGP5639",
"销售经理": "吴纬涛",
"考核天数": 30
},
{
"车牌号": "粤AGR1586",
"销售经理": "吴纬涛",
"考核天数": 30
},
{
"车牌号": "粤AGR8551",
"销售经理": "吴纬涛",
"考核天数": 30
}
],
"source_hash_checks": {
"assessment": true,
"meter": true,
"gps": true,
"hydrogen": true,
"tests": true,
"policy": true
},
"excel_ledger_matches": true,
"formula_errors": [],
"workbook_sha256": "0f734b431c860b29aa97177ecc5c36e6f1ba04df4b1ecd853178bee7eb30ccf4"
}
@@ -0,0 +1,69 @@
"""Read-only audit. No business workbook or calculation state is modified."""
from pathlib import Path
from collections import Counter,defaultdict
from decimal import Decimal,ROUND_HALF_UP
import json,hashlib,calendar
import openpyxl
P=Path(__file__).resolve().parent;S=P.parent;H=S.parent/'hydrogen-history-20260916'
load=lambda p:json.loads(p.read_text())
d=load(S/'september_calculation.json');aug=load(H/'august_calculation.json');paid=load(H/'historical_paid.json')
money=lambda v:float(Decimal(str(v)).quantize(Decimal('.01'),rounding=ROUND_HALF_UP))
key=lambda x:(x['plate'],x['sales'])
groups={key(g):g for g in d['groups']};prior={key(g):g for g in aug['groups']}
hist={(x['month'],x['plate'],x['sales']):x for x in d['historical_months']}
settled={(r['assessment_month'],r['plate'],r['owner']) for r in paid}
settled.update((l['assessment_month'],*key(l)) for l in aug['ledger'] if l['gross_amount']>0)
carry_paid=Counter((r['plate'],r['owner']) for r in paid if r['category']=='结转')
carry_paid.update(key(l) for l in aug['ledger'] if l['category']=='结转' and l['amount']>0)
ledger={(l['plate'],l['sales'],l['category']):l for l in d['ledger']}
assert len(ledger)==len(d['ledger'])
expected={};details=[];carry_basis=[];balance_inconsistent=[];status_inconsistent=[];used_inconsistent=[];cross_owner=[]
for k,g in groups.items():
rows=[r for r in d['records'] if (r['车牌号'],r['销售经理'])==k]
hist_t=sum(x['target'] for h,x in hist.items() if h[1:]==k)
hist_a=sum(x['actual'] for h,x in hist.items() if h[1:]==k)
full_t=money(hist_t+g['target']);full_a=money(hist_a+g['actual']);cq=full_a>=full_t and full_t>0
assert abs(full_t-g['cum_target'])<.02 and abs(full_a-g['cum_actual'])<.02,k
prev=prior.get(k,{})
locked=prev.get('carry_left',0)
if locked>=1:expected[(*k,'结转')]=money(g['reward'])
else:
current=sum(Decimal(str(r['月奖励']))*Decimal(str(r['考核天数']))/30 for r in rows if r['实际行驶里程(km)']>=r['应考核里程(km)'])
if current:expected[(*k,'当月')]=money(current)
if cq and not g['virtual']:
for m in range(1,9):
old=hist.get((m,*k))
if old and (m,*k) not in settled:expected[(*k,f'补发{m}月')]=money(Decimal(str(old['reward']))*Decimal(str(old['days']))/calendar.monthrange(2026,m)[1])
if not any(r['实际行驶里程(km)']>=r['应考核里程(km)'] for r in rows) and locked<1:
expected[(*k,'累计补发9月')]=money(Decimal(str(g['reward']))*Decimal(str(g['days']))/30)
used_actual=carry_paid[k]+int(locked>=1)
if used_actual!=g['used_carry']:used_inconsistent.append(dict(plate=k[0],sales=k[1],ledger_used=used_actual,stored_used=g['used_carry']))
recomputed_prior=max(0,int(max(0,hist_a-hist_t)//g['monthly_target'])-carry_paid[k])
recomputed_balance=max(0,int(max(0,full_a-full_t)//g['monthly_target'])-used_actual)
evidence=dict(plate=k[0],sales=k[1],aug_cumulative_target=money(hist_t),aug_cumulative_actual=money(hist_a),monthly_target=g['monthly_target'],carry_paid_jan_aug=carry_paid[k],aug_saved_balance=locked,aug_formula_balance=recomputed_prior,sep_saved_balance=g['carry_left'],sep_formula_balance=recomputed_balance,sep_payment=g['total'],virtual=g['virtual'])
if recomputed_prior!=locked:carry_basis.append(evidence)
if recomputed_balance!=g['carry_left']:balance_inconsistent.append(evidence)
if cq!=g['cum_qualified']:status_inconsistent.append(dict(plate=k[0],sales=k[1],target=full_t,actual=full_a,stored=g['cum_qualified'],calculated=cq,virtual=g['virtual']))
if g['virtual']:
other=[l for l in d['ledger'] if l['plate']==k[0] and l['sales']!=k[1]]
if other:cross_owner.append(dict(plate=k[0],carry_owner=k[1],carry_amount=ledger.get((*k,'结转'),{}).get('amount',0),current_payments=[{f:l[f] for f in ['sales','category','amount']} for l in other]))
for l in d['ledger']:
if key(l)==k and l['assessment_month']<9:
assert (l['assessment_month'],*k) not in settled
details.append({**{f:l[f] for f in ['plate','sales','category','amount']},'aug_cumulative_target':prev.get('cum_target'),'aug_cumulative_actual':prev.get('cum_actual'),'sep_cumulative_target':full_t,'sep_cumulative_actual':full_a,'historically_unpaid':True})
missing=[dict(plate=k[0],sales=k[1],category=k[2],expected=v,actual=ledger.get(k,{}).get('amount',0)) for k,v in expected.items() if abs(v-ledger.get(k,{}).get('amount',0))>.001]
extra=[dict(plate=k[0],sales=k[1],category=k[2],actual=l['amount'],expected=expected.get(k,0)) for k,l in ledger.items() if abs(l['amount']-expected.get(k,0))>.001]
source_checks={}
for tag,x in d['sources'].items():source_checks[tag]=hashlib.sha256(Path(x['path']).read_bytes()).hexdigest()==x['sha256']
fp=S/'里程任务考核_2026年9月_含缺口核算.xlsx';wb=openpyxl.load_workbook(fp,data_only=True,read_only=True)
xrows=list(wb['9月奖金发放记录'].values)
excel_ledger={(r[0],r[1],r[4]):r[9] for r in xrows[1:] if r[0] and r[0]!='合计' and isinstance(r[9],(int,float))}
assert excel_ledger=={k:l['amount'] for k,l in ledger.items()}
errors=[(s.title,c.coordinate,c.value) for s in wb for row in s for c in row if c.data_type=='e'];wb.close()
assert not errors
by_cat={c:money(sum(l['amount'] for l in d['ledger'] if l['category']==c)) for c in d['categories']}
virtual_pay=[l for l in d['ledger'] if l['virtual']]
gap_pay=[l for l in d['ledger'] if l['gap_days']>0 or l['history_gap_days']>0]
wholly=[r for r in d['records'] if r['缺口天数']==r['考核天数']]
out=dict(amount=d['summary']['amount'],ledger_items=len(ledger),expected_amount_under_locked_aug_carry=money(sum(expected.values())),missing_payments=missing,extra_payments=extra,categories=by_cat,historical_backpay=details,prior_carry_basis_differences=carry_basis,next_balance_differences=balance_inconsistent,cumulative_status_inconsistencies=status_inconsistent,used_count_differences=used_inconsistent,cross_owner_payments=cross_owner,virtual_count=len(virtual_pay),virtual_amount=money(sum(l['amount'] for l in virtual_pay)),gap_payment_count=len(gap_pay),gap_payment_amount=money(sum(l['amount'] for l in gap_pay)),wholly_missing=[{f:r[f] for f in ['车牌号','销售经理','考核天数']} for r in wholly],source_hash_checks=source_checks,excel_ledger_matches=True,formula_errors=errors,workbook_sha256=hashlib.sha256(fp.read_bytes()).hexdigest())
(P/'audit_results.json').write_text(json.dumps(out,ensure_ascii=False,indent=2));print(json.dumps({k:v for k,v in out.items() if k not in ['next_balance_differences','cumulative_status_inconsistencies','source_hash_checks','historical_backpay']},ensure_ascii=False,indent=2));print('NEXT_BALANCES',len(balance_inconsistent),'STATUS',len(status_inconsistent))
@@ -0,0 +1,500 @@
{
"controls": [
{
"month": 1,
"raw_sum": 21212.27,
"locked_sum": 21212.27
},
{
"month": 2,
"raw_sum": 21152.15,
"locked_sum": 21152.15
},
{
"month": 3,
"raw_sum": 56907.08,
"locked_sum": 56907.08
},
{
"month": 4,
"raw_sum": 86848.09,
"locked_sum": 86848.09
},
{
"month": 5,
"raw_sum": 92912.54,
"locked_sum": 92912.54
},
{
"month": 6,
"raw_sum": 93696.88,
"locked_sum": 93696.88
},
{
"month": 7,
"raw_sum": 65366.11,
"locked_sum": 62616.76
}
],
"raw_vs_locked_differences": [
{
"payment_month": 7,
"assessment_month": 7,
"plate": "粤AGP5623",
"owner": "岑彦",
"category": "累计补发7月",
"amount": 260,
"source": "/Users/shishengliang/Code/lingniu/mileage-bonus/7月绩效重算_多源考核里程_20260817/里程任务考核_7月核算.xlsx",
"source_row": 83
},
{
"payment_month": 7,
"assessment_month": 7,
"plate": "粤AGP5685",
"owner": "岑彦",
"category": "结转",
"amount": 150,
"source": "/Users/shishengliang/Code/lingniu/mileage-bonus/7月绩效重算_多源考核里程_20260817/里程任务考核_7月核算.xlsx",
"source_row": 84
},
{
"payment_month": 7,
"assessment_month": 7,
"plate": "粤AGQ8399",
"owner": "岑彦",
"category": "结转",
"amount": 150,
"source": "/Users/shishengliang/Code/lingniu/mileage-bonus/7月绩效重算_多源考核里程_20260817/里程任务考核_7月核算.xlsx",
"source_row": 85
},
{
"payment_month": 7,
"assessment_month": 7,
"plate": "粤A02509F",
"owner": "赵连飞",
"category": "结转",
"amount": 1000,
"source": "/Users/shishengliang/Code/lingniu/mileage-bonus/7月绩效重算_多源考核里程_20260817/里程任务考核_7月核算.xlsx",
"source_row": 145
},
{
"payment_month": 7,
"assessment_month": 7,
"plate": "粤A06158F",
"owner": "赵连飞",
"category": "累计补发7月",
"amount": 451.61,
"source": "/Users/shishengliang/Code/lingniu/mileage-bonus/7月绩效重算_多源考核里程_20260817/里程任务考核_7月核算.xlsx",
"source_row": 146
},
{
"payment_month": 7,
"assessment_month": 7,
"plate": "粤AGP5691",
"owner": "赵连飞",
"category": "结转",
"amount": 260,
"source": "/Users/shishengliang/Code/lingniu/mileage-bonus/7月绩效重算_多源考核里程_20260817/里程任务考核_7月核算.xlsx",
"source_row": 147
},
{
"payment_month": 7,
"assessment_month": 7,
"plate": "粤AGP5712",
"owner": "赵连飞",
"category": "结转",
"amount": 260,
"source": "/Users/shishengliang/Code/lingniu/mileage-bonus/7月绩效重算_多源考核里程_20260817/里程任务考核_7月核算.xlsx",
"source_row": 148
},
{
"payment_month": 7,
"assessment_month": 7,
"plate": "粤AGP9331",
"owner": "赵连飞",
"category": "结转",
"amount": 150,
"source": "/Users/shishengliang/Code/lingniu/mileage-bonus/7月绩效重算_多源考核里程_20260817/里程任务考核_7月核算.xlsx",
"source_row": 149
},
{
"payment_month": 7,
"assessment_month": 7,
"plate": "粤AGR8539",
"owner": "赵连飞",
"category": "累计补发7月",
"amount": 67.74,
"source": "/Users/shishengliang/Code/lingniu/mileage-bonus/7月绩效重算_多源考核里程_20260817/里程任务考核_7月核算.xlsx",
"source_row": 150
}
],
"backpay_checks": [
{
"id": 129,
"plate": "粤AGP3612",
"sales": "尚建华",
"department": "业务二部",
"category": "补发5月",
"assessment_month": 5,
"base": 260,
"days": 4.0,
"month_days": 31,
"amount": 33.55,
"gross_amount": 33.55,
"withheld": 0,
"unrounded": 33.54838709677419,
"virtual": false,
"gap_days": 6,
"history_gap_days": 0,
"status": "按现有里程计算",
"prior_same_plate_month": []
},
{
"id": 130,
"plate": "粤AGP3612",
"sales": "尚建华",
"department": "业务二部",
"category": "补发7月",
"assessment_month": 7,
"base": 260,
"days": 31.0,
"month_days": 31,
"amount": 260.0,
"gross_amount": 260.0,
"withheld": 0,
"unrounded": 260.0,
"virtual": false,
"gap_days": 6,
"history_gap_days": 0,
"status": "按现有里程计算",
"prior_same_plate_month": []
},
{
"id": 131,
"plate": "粤AGP5138",
"sales": "钟祥",
"department": "业务一部",
"category": "补发8月",
"assessment_month": 8,
"base": 150,
"days": 15,
"month_days": 31,
"amount": 72.58,
"gross_amount": 72.58,
"withheld": 0,
"unrounded": 72.58064516129032,
"virtual": false,
"gap_days": 5,
"history_gap_days": 0,
"status": "按现有里程计算",
"prior_same_plate_month": []
},
{
"id": 132,
"plate": "粤AGP3612",
"sales": "尚建华",
"department": "业务二部",
"category": "补发8月",
"assessment_month": 8,
"base": 260,
"days": 31,
"month_days": 31,
"amount": 260.0,
"gross_amount": 260.0,
"withheld": 0,
"unrounded": 260.0,
"virtual": false,
"gap_days": 6,
"history_gap_days": 0,
"status": "按现有里程计算",
"prior_same_plate_month": []
},
{
"id": 133,
"plate": "粤AGR0772",
"sales": "尚建华",
"department": "业务二部",
"category": "补发8月",
"assessment_month": 8,
"base": 150,
"days": 4,
"month_days": 31,
"amount": 19.35,
"gross_amount": 19.35,
"withheld": 0,
"unrounded": 19.35483870967742,
"virtual": false,
"gap_days": 3,
"history_gap_days": 0,
"status": "按现有里程计算",
"prior_same_plate_month": [
{
"payment_month": 8,
"assessment_month": 8,
"plate": "粤AGR0772",
"owner": "谯云",
"category": "当月",
"amount": 116.13
}
]
},
{
"id": 134,
"plate": "粤AGR5228",
"sales": "吴纬涛",
"department": "业务三部",
"category": "补发8月",
"assessment_month": 8,
"base": 150,
"days": 31,
"month_days": 31,
"amount": 150.0,
"gross_amount": 150.0,
"withheld": 0,
"unrounded": 150.0,
"virtual": false,
"gap_days": 0,
"history_gap_days": 0,
"status": "数据齐全",
"prior_same_plate_month": []
},
{
"id": 135,
"plate": "粤AGR8536",
"sales": "吴纬涛",
"department": "业务三部",
"category": "补发8月",
"assessment_month": 8,
"base": 150,
"days": 5,
"month_days": 31,
"amount": 24.19,
"gross_amount": 24.19,
"withheld": 0,
"unrounded": 24.193548387096776,
"virtual": false,
"gap_days": 5,
"history_gap_days": 0,
"status": "按现有里程计算",
"prior_same_plate_month": []
}
],
"multiple_owners_same_plate_paid": [
{
"plate": "粤AGR5560",
"items": [
{
"id": 35,
"plate": "粤AGR5560",
"sales": "钟祥",
"department": "业务一部",
"category": "当月",
"assessment_month": 9,
"base": 150,
"days": 1,
"month_days": 30,
"amount": 5.0,
"gross_amount": 5.0,
"withheld": 0,
"unrounded": 5.0,
"virtual": false,
"gap_days": 1,
"history_gap_days": 0,
"status": "按现有里程计算"
},
{
"id": 128,
"plate": "粤AGR5560",
"sales": "金可鹏",
"department": "业务三部",
"category": "结转",
"assessment_month": 9,
"base": 150,
"days": 1,
"month_days": 1,
"amount": 150.0,
"gross_amount": 150.0,
"withheld": 0,
"unrounded": 150.0,
"virtual": true,
"gap_days": 0,
"history_gap_days": 0,
"status": "数据齐全"
}
]
},
{
"plate": "粤AGP3080",
"items": [
{
"id": 40,
"plate": "粤AGP3080",
"sales": "尚建华",
"department": "业务二部",
"category": "当月",
"assessment_month": 9,
"base": 150,
"days": 1,
"month_days": 30,
"amount": 5.0,
"gross_amount": 5.0,
"withheld": 0,
"unrounded": 5.0,
"virtual": false,
"gap_days": 0,
"history_gap_days": 0,
"status": "数据齐全"
},
{
"id": 116,
"plate": "粤AGP3080",
"sales": "董剑煜",
"department": "业务二部",
"category": "结转",
"assessment_month": 9,
"base": 150,
"days": 1,
"month_days": 1,
"amount": 150.0,
"gross_amount": 150.0,
"withheld": 0,
"unrounded": 150.0,
"virtual": true,
"gap_days": 0,
"history_gap_days": 0,
"status": "数据齐全"
}
]
},
{
"plate": "粤AGR6869",
"items": [
{
"id": 46,
"plate": "粤AGR6869",
"sales": "尚建华",
"department": "业务二部",
"category": "当月",
"assessment_month": 9,
"base": 150,
"days": 30,
"month_days": 30,
"amount": 150.0,
"gross_amount": 150.0,
"withheld": 0,
"unrounded": 150.0,
"virtual": false,
"gap_days": 0,
"history_gap_days": 0,
"status": "数据齐全"
},
{
"id": 120,
"plate": "粤AGR6869",
"sales": "董剑煜",
"department": "业务二部",
"category": "结转",
"assessment_month": 9,
"base": 150,
"days": 1,
"month_days": 1,
"amount": 150.0,
"gross_amount": 150.0,
"withheld": 0,
"unrounded": 150.0,
"virtual": true,
"gap_days": 0,
"history_gap_days": 0,
"status": "数据齐全"
}
]
},
{
"plate": "粤AGP3627",
"items": [
{
"id": 69,
"plate": "粤AGP3627",
"sales": "秦挺",
"department": "业务五部",
"category": "当月",
"assessment_month": 9,
"base": 260,
"days": 30,
"month_days": 30,
"amount": 260.0,
"gross_amount": 260.0,
"withheld": 0,
"unrounded": 260.0,
"virtual": false,
"gap_days": 1,
"history_gap_days": 0,
"status": "按现有里程计算"
},
{
"id": 122,
"plate": "粤AGP3627",
"sales": "金可鹏",
"department": "业务三部",
"category": "结转",
"assessment_month": 9,
"base": 260,
"days": 1,
"month_days": 1,
"amount": 260.0,
"gross_amount": 260.0,
"withheld": 0,
"unrounded": 260.0,
"virtual": true,
"gap_days": 0,
"history_gap_days": 0,
"status": "数据齐全"
}
]
},
{
"plate": "粤AGP3692",
"items": [
{
"id": 70,
"plate": "粤AGP3692",
"sales": "秦挺",
"department": "业务五部",
"category": "当月",
"assessment_month": 9,
"base": 260,
"days": 30,
"month_days": 30,
"amount": 260.0,
"gross_amount": 260.0,
"withheld": 0,
"unrounded": 260.0,
"virtual": false,
"gap_days": 1,
"history_gap_days": 0,
"status": "按现有里程计算"
},
{
"id": 123,
"plate": "粤AGP3692",
"sales": "金可鹏",
"department": "业务三部",
"category": "结转",
"assessment_month": 9,
"base": 260,
"days": 1,
"month_days": 1,
"amount": 260.0,
"gross_amount": 260.0,
"withheld": 0,
"unrounded": 260.0,
"virtual": true,
"gap_days": 0,
"history_gap_days": 0,
"status": "数据齐全"
}
]
}
],
"eligibility_mismatches": []
}
@@ -0,0 +1,39 @@
import json,openpyxl,re
from pathlib import Path
from collections import defaultdict,Counter
P=Path(__file__).resolve().parents[1];R=P.parents[1];H=P.parent/'hydrogen-history-20260916'
s=json.loads((P/'september_calculation.json').read_text());paid=json.loads((H/'historical_paid.json').read_text())
raw=[];dif=[];controls=[]
for m in range(1,8):
f=R/f'里程任务考核_{m}月核算.xlsx' if m<7 else R/'7月绩效重算_多源考核里程_20260817/里程任务考核_7月核算.xlsx'
w=openpyxl.load_workbook(f,data_only=True,read_only=True);rows=list(w[f'{m}月奖金发放记录'].values)
for rn,r in enumerate(rows[1:],2):
if not r[0] or not isinstance(r[9],(int,float)) or r[9]<=0:continue
q=dict(payment_month=m,assessment_month=int(re.search(r'补发(\d+)月',r[4]).group(1)) if '补发' in r[4] else m,plate=r[0],owner=r[1],category=r[4],amount=r[9],source=str(f),source_row=rn);raw.append(q)
found=[p for p in paid if p['payment_month']==m and p['source_row']==rn]
if not found or any(q[k]!=found[0][k] for k in ['plate','owner','category','amount','assessment_month']):dif.append(q)
controls.append(dict(month=m,raw_sum=round(sum(x['amount'] for x in raw if x['payment_month']==m),2),locked_sum=round(sum(x['amount'] for x in paid if x['payment_month']==m),2)))
w.close()
allpaid=raw+[dict(payment_month=8,assessment_month=l['assessment_month'],plate=l['plate'],owner=l['sales'],category=l['category'],amount=l['gross_amount']) for l in s['august_ledger'] if l['gross_amount']>0]
back=[]
for l in s['ledger']:
if l['assessment_month']<9:
prior=[p for p in allpaid if p['assessment_month']==l['assessment_month'] and p['plate']==l['plate']]
back.append(dict(**l,prior_same_plate_month=prior))
byplate=defaultdict(list)
for l in s['ledger']:byplate[l['plate']].append(l)
multi=[dict(plate=p,items=ls) for p,ls in byplate.items() if len({l['sales'] for l in ls})>1]
# Check complete history eligibility independently from engine, all record/group state used only as metadata.
elig=[]
for g in s['groups']:
if g['virtual']:continue
h=[h for h in s['historical_months'] if h['plate']==g['plate'] and h['sales']==g['sales']]
t=sum(x['target'] for x in h)+g['target'];a=sum(x['actual'] for x in h)+g['actual']
for x in h:
settled=any(p['assessment_month']==x['month'] and p['plate']==g['plate'] and p['owner']==g['sales'] for p in allpaid)
due=a>=t>0 and not settled
has=any(l['plate']==g['plate'] and l['sales']==g['sales'] and l['assessment_month']==x['month'] for l in s['ledger'])
if due!=has:elig.append(dict(group=g,month=x,due=due,has=has))
result=dict(controls=controls,raw_vs_locked_differences=dif,backpay_checks=back,multiple_owners_same_plate_paid=multi,eligibility_mismatches=elig)
(P/'audit_history/history_checks.json').write_text(json.dumps(result,ensure_ascii=False,indent=2))
print(json.dumps(result,ensure_ascii=False,indent=2))
@@ -0,0 +1,372 @@
{
"schemaVersion": 1,
"items": [
{
"id": "historical-backpay",
"title": "7笔历史补发未发现重复",
"queries": [
{
"id": "historical-backpay-evidence",
"source": {
"label": "2026年里程绩效核算表",
"files": [
{
"label": "里程任务考核_1月核算.xlsx"
},
{
"label": "里程任务考核_2月核算.xlsx"
},
{
"label": "里程任务考核_3月核算.xlsx"
},
{
"label": "里程任务考核_4月核算.xlsx"
},
{
"label": "里程任务考核_5月核算.xlsx"
},
{
"label": "里程任务考核_6月核算.xlsx"
},
{
"label": "里程任务考核_7月核算.xlsx"
},
{
"label": "里程任务考核_8月核算_纯氢修正版.xlsx"
},
{
"label": "里程任务考核_2026年9月_含缺口核算.xlsx"
}
],
"filters": [
"按车辆与原考核负责人区分资格",
"历史已发锁定,不追扣"
],
"caveats": [
"已发以用户确认的历史最终表为准,未另取银行流水。"
]
},
"reportingPeriod": "2026年1—8月已发,对比9月核算",
"columns": [
"plate",
"sales",
"category",
"amount"
],
"rows": [
{
"plate": "粤AGR5228",
"sales": "吴纬涛",
"category": "补发8月",
"amount": 150.0,
"aug_cumulative_target": 3000.0,
"aug_cumulative_actual": 1378.8,
"sep_cumulative_target": 6000.0,
"sep_cumulative_actual": 6069.0,
"historically_unpaid": true
},
{
"plate": "粤AGR8536",
"sales": "吴纬涛",
"category": "补发8月",
"amount": 24.19,
"aug_cumulative_target": 483.87,
"aug_cumulative_actual": 371.7,
"sep_cumulative_target": 3483.87,
"sep_cumulative_actual": 3603.7,
"historically_unpaid": true
},
{
"plate": "粤AGP3612",
"sales": "尚建华",
"category": "补发5月",
"amount": 33.55,
"aug_cumulative_target": 15645.16,
"aug_cumulative_actual": 14622.1,
"sep_cumulative_target": 20645.16,
"sep_cumulative_actual": 20767.2,
"historically_unpaid": true
},
{
"plate": "粤AGP3612",
"sales": "尚建华",
"category": "补发7月",
"amount": 260.0,
"aug_cumulative_target": 15645.16,
"aug_cumulative_actual": 14622.1,
"sep_cumulative_target": 20645.16,
"sep_cumulative_actual": 20767.2,
"historically_unpaid": true
},
{
"plate": "粤AGP3612",
"sales": "尚建华",
"category": "补发8月",
"amount": 260.0,
"aug_cumulative_target": 15645.16,
"aug_cumulative_actual": 14622.1,
"sep_cumulative_target": 20645.16,
"sep_cumulative_actual": 20767.2,
"historically_unpaid": true
},
{
"plate": "粤AGR0772",
"sales": "尚建华",
"category": "补发8月",
"amount": 19.35,
"aug_cumulative_target": 387.1,
"aug_cumulative_actual": 300.6,
"sep_cumulative_target": 3387.1,
"sep_cumulative_actual": 6470.6,
"historically_unpaid": true
},
{
"plate": "粤AGP5138",
"sales": "钟祥",
"category": "补发8月",
"amount": 72.58,
"aug_cumulative_target": 1451.61,
"aug_cumulative_actual": 718.5,
"sep_cumulative_target": 4451.61,
"sep_cumulative_actual": 5932.3,
"historically_unpaid": true
}
],
"methods": [
{
"language": "calculation",
"code": "33.55 + 260 + 260 + 72.58 + 19.35 + 150 + 24.19 = 819.67元;逐笔排除同车、同负责人、同考核月已经发放。"
}
]
}
]
},
{
"id": "carry-balance",
"title": "无本月考核车辆的结转余额存在两种口径",
"queries": [
{
"id": "carry-balance-evidence",
"source": {
"label": "2026年里程绩效核算表",
"files": [
{
"label": "里程任务考核_1月核算.xlsx"
},
{
"label": "里程任务考核_2月核算.xlsx"
},
{
"label": "里程任务考核_3月核算.xlsx"
},
{
"label": "里程任务考核_4月核算.xlsx"
},
{
"label": "里程任务考核_5月核算.xlsx"
},
{
"label": "里程任务考核_6月核算.xlsx"
},
{
"label": "里程任务考核_7月核算.xlsx"
},
{
"label": "里程任务考核_8月核算_纯氢修正版.xlsx"
},
{
"label": "里程任务考核_2026年9月_含缺口核算.xlsx"
}
],
"filters": [
"按车辆与原考核负责人区分资格",
"历史已发锁定,不追扣"
],
"caveats": [
"150元是口径待确认金额,不能直接认定多发;虚拟考核目标是否应增加尚需明确。"
]
},
"reportingPeriod": "2026年1—8月已发,对比9月核算",
"columns": [
"plate",
"sales",
"aug_saved_balance",
"aug_formula_balance",
"carry_paid_jan_aug"
],
"rows": [
{
"plate": "粤AGR8531",
"sales": "刘念念",
"aug_cumulative_target": 17516.13,
"aug_cumulative_actual": 40637.6,
"monthly_target": 3000,
"carry_paid_jan_aug": 4,
"aug_saved_balance": 4,
"aug_formula_balance": 3,
"sep_saved_balance": 3,
"sep_formula_balance": 1,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGP5158",
"sales": "尚建华",
"aug_cumulative_target": 22451.61,
"aug_cumulative_actual": 41174.0,
"monthly_target": 3000,
"carry_paid_jan_aug": 6,
"aug_saved_balance": 1,
"aug_formula_balance": 0,
"sep_saved_balance": 0,
"sep_formula_balance": 0,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGP9786",
"sales": "董剑煜",
"aug_cumulative_target": 15580.64,
"aug_cumulative_actual": 41070.5,
"monthly_target": 3000,
"carry_paid_jan_aug": 4,
"aug_saved_balance": 5,
"aug_formula_balance": 4,
"sep_saved_balance": 4,
"sep_formula_balance": 2,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGR6877",
"sales": "董剑煜",
"aug_cumulative_target": 16838.71,
"aug_cumulative_actual": 44184.4,
"monthly_target": 3000,
"carry_paid_jan_aug": 4,
"aug_saved_balance": 6,
"aug_formula_balance": 5,
"sep_saved_balance": 5,
"sep_formula_balance": 3,
"sep_payment": 150.0,
"virtual": true
},
{
"plate": "粤AGR5560",
"sales": "金可鹏",
"aug_cumulative_target": 22500.0,
"aug_cumulative_actual": 47026.6,
"monthly_target": 3000,
"carry_paid_jan_aug": 7,
"aug_saved_balance": 2,
"aug_formula_balance": 1,
"sep_saved_balance": 1,
"sep_formula_balance": 0,
"sep_payment": 150.0,
"virtual": true
}
],
"methods": [
{
"language": "calculation",
"code": "粤AGP5158:floor((41174.00 − 22451.61) / 3000) − 6 = 0期;8月表内余额1期,9月据此发150元。9月底另有17组余额与统一公式不一致。"
}
]
}
]
},
{
"id": "owner-handover",
"title": "5辆车原负责人领结转且新负责人领当月奖金",
"queries": [
{
"id": "owner-handover-evidence",
"source": {
"label": "2026年里程绩效核算表",
"files": [
{
"label": "里程任务考核_1月核算.xlsx"
},
{
"label": "里程任务考核_2月核算.xlsx"
},
{
"label": "里程任务考核_3月核算.xlsx"
},
{
"label": "里程任务考核_4月核算.xlsx"
},
{
"label": "里程任务考核_5月核算.xlsx"
},
{
"label": "里程任务考核_6月核算.xlsx"
},
{
"label": "里程任务考核_7月核算.xlsx"
},
{
"label": "里程任务考核_8月核算_纯氢修正版.xlsx"
},
{
"label": "里程任务考核_2026年9月_含缺口核算.xlsx"
}
],
"filters": [
"按车辆与原考核负责人区分资格",
"历史已发锁定,不追扣"
],
"caveats": [
"按目前车牌加负责人分账可以复现,不等于同一负责人重复发放;是否交接后停止旧负责人结转属于业务规则。"
]
},
"reportingPeriod": "2026年1—8月已发,对比9月核算",
"columns": [
"plate",
"owner",
"carry_amount",
"current"
],
"rows": [
{
"plate": "粤AGP3080",
"owner": "董剑煜",
"carry_amount": 150.0,
"current": "[{'sales': '尚建华', 'category': '当月', 'amount': 5.0}]"
},
{
"plate": "粤AGR6869",
"owner": "董剑煜",
"carry_amount": 150.0,
"current": "[{'sales': '尚建华', 'category': '当月', 'amount': 150.0}]"
},
{
"plate": "粤AGP3627",
"owner": "金可鹏",
"carry_amount": 260.0,
"current": "[{'sales': '秦挺', 'category': '当月', 'amount': 260.0}]"
},
{
"plate": "粤AGP3692",
"owner": "金可鹏",
"carry_amount": 260.0,
"current": "[{'sales': '秦挺', 'category': '当月', 'amount': 260.0}]"
},
{
"plate": "粤AGR5560",
"owner": "金可鹏",
"carry_amount": 150.0,
"current": "[{'sales': '钟祥', 'category': '当月', 'amount': 5.0}]"
}
],
"methods": [
{
"language": "calculation",
"code": "150 + 150 + 150 + 260 + 260 = 970元原负责人结转,包含在33笔无本月考核结转5940元中。"
}
]
}
]
}
]
}
@@ -0,0 +1,74 @@
from pathlib import Path
import json,hashlib
P=Path(__file__).parent;S=P.parent;R=S.parents[1]
a=json.loads((P/'audit_results.json').read_text());d=json.loads((S/'september_calculation.json').read_text())
lines=['# 1—8月已发与9月发放核对','',
'核对对象:2026年9月40,211.67元版本,145条发放项。原Excel保持不变。核对以用户确认的1—7月历史最终表、8月纯氢修正版实际已发45,065.47元为基准。',
'','## 结论','',
'**补发与金额算术检查通过;结转资格存在规则分支不一致,需要澄清后再将结果作为最终付款依据。**',
'按8月表内结转余额逐月减1的现行逻辑,独立重算9月仍为40,211.67元,未发现金额公式错误或重复历史补发。此结论不等于认可结转余额的形成口径。',
'','## 1. 结转两种算法不一致:9月有150元需要复核','',
'有实际考核记录的车组按“累计多跑里程÷月目标取整−实际已用结转期数”计算余额;无本月考核记录的车组却按“上期余额−1”,同时在累计目标中增加一个月目标。这是代码中不同分支的实际行为。',
'8月底有5辆车的表内结转余额比统一累计公式多1期。尚建华的粤AGP5158会影响9月当期150元,其余4辆在两种口径下9月都有至少1期可用结转,主要影响后续余额。',
'','|车辆|负责人|8月底表内余额|累计公式余额|1—8月已领结转次数|9月结转|',
'|---|---|---:|---:|---:|---:|']
for x in a['prior_carry_basis_differences']:lines.append(f"|{x['plate']}|{x['sales']}|{x['aug_saved_balance']}|{x['aug_formula_balance']}|{x['carry_paid_jan_aug']}|{x['sep_payment']:.2f}|")
lines += ['',
'粤AGP5158截至8月累计实际41,174.00公里、累计目标22,451.61公里、月目标3,000公里,实际已领6次结转。统一累计公式得到 floor((41,174.00−22,451.61)/3,000)−6=0期;8月表却保存1期,9月据此发150元。',
'**不能直接将150元定为多发并扣除。** 无考核月份是否应增加虚拟考核目标,决定了两种余额计算哪一种适用;若增加虚拟目标又扣除已领期数,可能重复消耗同一结转额度。应先统一规则,再调整9月及后续余额,1—8月实际已发保持不变。若明确要求保留目前累计目标、全部统一累计公式,则这笔150元不满足资格,9月在其他条件不变时为40,061.67元。这只是该口径下的测算,不是建议直接改付。',
'','## 2. 同车新旧负责人同时领取,共涉及原负责人970元','',
'本月无考核记录的结转共33笔、5,940元。其中以下5辆同时给新负责人发当月奖金、给旧负责人发历史结转。按目前“车牌+负责人”分账、历史结转继续发放的规则可以复现,并非同一负责人重复发放。若制度要求交接后原负责人停止领取,才会影响这970元。不能把它直接作为错付款扣除。',
'','|车辆|原负责人|原负责人结转|新负责人发放|','|---|---|---:|---|']
for x in a['cross_owner_payments']:
new=';'.join(f"{y['sales']} {y['category']} {y['amount']:.2f}元" for y in x['current_payments'])
lines.append(f"|{x['plate']}|{x['carry_owner']}|{x['carry_amount']:.2f}|{new}|")
lines += ['',
'','## 3. 9月底17辆结转余额不同,33条累计状态显示不准确','',
'17个无本月考核车组的表内结转余额与统一累计公式合计相差20期。这是口径差异,不能直接换算成确定多发金额;不同车辆奖励基准、未来有无考核及补数均可能变化。',
'','|车辆|负责人|9月底表内余额|统一累计公式余额|','|---|---|---:|---:|']
for x in a['next_balance_differences']:lines.append(f"|{x['plate']}|{x['sales']}|{x['sep_saved_balance']}|{x['sep_formula_balance']}|")
lines += ['',
'33个无本月考核车组在程序中把累计达标标志固定为否,但显示的累计实际里程均已达到累计目标。例如粤AGP5158累计实际41,174.00大于目标25,451.61,计算过程仍显示“已有里程未达标”。这是展示语义问题,并不等于应额外补发。建议将“累计里程是否达标”与“本月是否有考核、是否具备补发资格”分开显示。',
'','## 4. 已确认没有重复的7笔历史补发','',
'按“车辆+原考核负责人+考核月”逐项检查1—8月已发;7笔合计819.67元,没有重复,非虚拟考核车组也未发现符合现行规则而遗漏的补发。',
'','|车辆|负责人|补发类别|金额|9月累计实际|9月累计目标|','|---|---|---|---:|---:|---:|']
for x in a['historical_backpay']:lines.append(f"|{x['plate']}|{x['sales']}|{x['category']}|{x['amount']:.2f}|{x['sep_cumulative_actual']:.2f}|{x['sep_cumulative_target']:.2f}|")
lines += ['',
'粤AGP3612尚建华到9月累计超目标122.04公里,8月底尚差1,023.06公里,因此9月才补5月33.55元、7月260元、8月260元。6月已经实际发放,未重复补发。',
'粤AGR0772尚建华补8月19.35元,与谯云8月已发116.13元不是重复:分别为8月28—31日与8月1—24日两个负责人区间。',
'','## 5. 台账、取数及报表一致性','',
'- 1—6月已发台账逐条吻合历史最终表;6月人员转接后的个人合计也一致。',
'- 7月原明细仍列9笔离职不发款2,749.35元,已发台账已正确剔除。最终汇总62,616.73元与逐项和62,616.76元相差0.03元,是历史原表舍入差。',
'- 8月纯氢修正版实际已发45,065.47元及原扣减9.68元保持不变,扣减项不再次补发。',
'- 9月145条发放项与Excel缓存值一致,金额公式未发现错误。结转、当月、累计补发当月之间未发现同负责人同车的重复占用。',
'- 实际已领结转次数与1—8月台账逐车一致,问题发生在余额计算方式,不是漏记已领次数。',
'- 9月刘念念全部归业务一部,部门汇总与明细一致;新政策名单沿用原39辆、当月匹配36辆。',
'- 8,737个考核车辆日无重复计入,原始来源文件哈希未改变。此前中断月份清零触发误补发的问题在当前版本未再出现。',
'','## 6. 仍有数据缺口','',
'9月1,000个车辆日缺少所需来源,涉及176辆车;其中991个需仪表、9个需GPS。6条考核记录整段缺少可用里程。61条发放项(16,662.34元)带有本月或8月缺口标记,标记不代表这些金额均算错:部分已有里程已经足够达标,结转也可能来自历史。补齐数据后仍可能改变未达标、补发和结转余额。',
'尚建华粤AGR5535虽然9月2天全缺,仍列累计补发9月10元:仅历史已知里程4,246.80公里已经大于包含9月目标后的3,521.43公里,按现行累计达标规则可以复现;0仅为当前已知累计,不是实测零里程。',
'','## 处理建议','',
'1. 优先统一无本月考核车辆的结转目标、余额消耗方式,避免一边增加虚拟目标、一边重复扣已用期数。先核实粤AGP5158的150元,再统一17辆后续余额。',
'2. 明确交接后原负责人能否继续领取历史结转;若允许,表内将旧负责人历史结转与新负责人当月奖励清楚分开即可。',
'3. 更正无本月考核车组的累计状态文字,保持累计结果与补发资格两个概念分开。',
'4. 补齐1,000个车辆日缺口后重算。当前40,211.67元保留为现行口径暂算,不表示以上规则问题已解决。',
'','## 核对范围及证据','',
'全量核对145条9月发放、1—8月对应已发状态、369个当前车组的历史累计及结转次数;重复展示的个人页沿用已完成金额核验。没有重新从平台获取GPS,也未重新审核1—6月纯氢原始采集准确性。银行支付未另取流水,按用户确认的历史最终表作为已发。',
'',f"当前9月文件SHA256:`{a['workbook_sha256']}`",'']
paths=[R/f'里程任务考核_{m}月核算.xlsx' for m in range(1,7)]+[R/'7月绩效重算_多源考核里程_20260817/里程任务考核_7月核算.xlsx',S.parent/'hydrogen-history-20260916/里程任务考核_8月核算_纯氢修正版.xlsx',S/'里程任务考核_2026年9月_含缺口核算.xlsx']
lines.extend(f'- [{p.name}]({p})' for p in paths)
lines+=['','复核脚本:audit_september_against_paid.py、independent.py;逐项结果:audit_results.json、history_checks.json。']
(P/'1-8月与9月发放核对报告.md').write_text('\n'.join(lines))
nb={'nbformat':4,'nbformat_minor':5,'metadata':{'kernelspec':{'display_name':'Python 3','language':'python','name':'python3'}},'cells':[{'cell_type':'markdown','metadata':{},'source':['# 1—8月与9月发放只读核验\n','先阅读核对报告,代码只读取原表并写出核验结果,不修改奖金工作簿。']},{'cell_type':'code','metadata':{},'execution_count':None,'outputs':[],'source':(P/'audit_september_against_paid.py').read_text().replace("P=Path(__file__).resolve().parent",f"P=Path({str(P.resolve())!r})").splitlines(True)}]}
(P/'历史与9月发放核验.ipynb').write_text(json.dumps(nb,ensure_ascii=False,indent=2))
files=[{'label':p.name} for p in paths]
def q(id,title,rows,columns,caveats,method):
return {'id':id,'title':title,'queries':[{'id':id+'-evidence','source':{'label':'2026年里程绩效核算表','files':files,'filters':['按车辆与原考核负责人区分资格','历史已发锁定,不追扣'],'caveats':caveats},'reportingPeriod':'2026年1—8月已发,对比9月核算','columns':columns,'rows':rows,'methods':[{'language':'calculation','code':method}]}]}
receipt={'schemaVersion':1,'items':[
q('historical-backpay','7笔历史补发未发现重复',a['historical_backpay'],['plate','sales','category','amount'],['已发以用户确认的历史最终表为准,未另取银行流水。'],'33.55 + 260 + 260 + 72.58 + 19.35 + 150 + 24.19 = 819.67元;逐笔排除同车、同负责人、同考核月已经发放。'),
q('carry-balance','无本月考核车辆的结转余额存在两种口径',a['prior_carry_basis_differences'],['plate','sales','aug_saved_balance','aug_formula_balance','carry_paid_jan_aug'],['150元是口径待确认金额,不能直接认定多发;虚拟考核目标是否应增加尚需明确。'],'粤AGP5158:floor((41174.00 − 22451.61) / 3000) − 6 = 0期;8月表内余额1期,9月据此发150元。9月底另有17组余额与统一公式不一致。'),
q('owner-handover','5辆车原负责人领结转且新负责人领当月奖金',[{'plate':x['plate'],'owner':x['carry_owner'],'carry_amount':x['carry_amount'],'current':str(x['current_payments'])} for x in a['cross_owner_payments']],['plate','owner','carry_amount','current'],['按目前车牌加负责人分账可以复现,不等于同一负责人重复发放;是否交接后停止旧负责人结转属于业务规则。'],'150 + 150 + 150 + 260 + 260 = 970元原负责人结转,包含在33笔无本月考核结转5940元中。')
]}
(P/'sources_receipt.json').write_text(json.dumps(receipt,ensure_ascii=False,indent=2))
assert hashlib.sha256((S/'里程任务考核_2026年9月_含缺口核算.xlsx').read_bytes()).hexdigest()==a['workbook_sha256']
print('Read-only audit report and notebook saved; workbook unchanged.')
@@ -0,0 +1,98 @@
{
"nbformat": 4,
"nbformat_minor": 5,
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 1—8月与9月发放只读核验\n",
"先阅读核对报告,代码只读取原表并写出核验结果,不修改奖金工作簿。"
]
},
{
"cell_type": "code",
"metadata": {},
"execution_count": null,
"outputs": [],
"source": [
"\"\"\"Read-only audit. No business workbook or calculation state is modified.\"\"\"\n",
"from pathlib import Path\n",
"from collections import Counter,defaultdict\n",
"from decimal import Decimal,ROUND_HALF_UP\n",
"import json,hashlib,calendar\n",
"import openpyxl\n",
"P=Path('/Users/shishengliang/Code/lingniu/mileage-bonus/outputs/september-20261009/audit_history');S=P.parent;H=S.parent/'hydrogen-history-20260916'\n",
"load=lambda p:json.loads(p.read_text())\n",
"d=load(S/'september_calculation.json');aug=load(H/'august_calculation.json');paid=load(H/'historical_paid.json')\n",
"money=lambda v:float(Decimal(str(v)).quantize(Decimal('.01'),rounding=ROUND_HALF_UP))\n",
"key=lambda x:(x['plate'],x['sales'])\n",
"groups={key(g):g for g in d['groups']};prior={key(g):g for g in aug['groups']}\n",
"hist={(x['month'],x['plate'],x['sales']):x for x in d['historical_months']}\n",
"settled={(r['assessment_month'],r['plate'],r['owner']) for r in paid}\n",
"settled.update((l['assessment_month'],*key(l)) for l in aug['ledger'] if l['gross_amount']>0)\n",
"carry_paid=Counter((r['plate'],r['owner']) for r in paid if r['category']=='结转')\n",
"carry_paid.update(key(l) for l in aug['ledger'] if l['category']=='结转' and l['amount']>0)\n",
"ledger={(l['plate'],l['sales'],l['category']):l for l in d['ledger']}\n",
"assert len(ledger)==len(d['ledger'])\n",
"expected={};details=[];carry_basis=[];balance_inconsistent=[];status_inconsistent=[];used_inconsistent=[];cross_owner=[]\n",
"for k,g in groups.items():\n",
" rows=[r for r in d['records'] if (r['车牌号'],r['销售经理'])==k]\n",
" hist_t=sum(x['target'] for h,x in hist.items() if h[1:]==k)\n",
" hist_a=sum(x['actual'] for h,x in hist.items() if h[1:]==k)\n",
" full_t=money(hist_t+g['target']);full_a=money(hist_a+g['actual']);cq=full_a>=full_t and full_t>0\n",
" assert abs(full_t-g['cum_target'])<.02 and abs(full_a-g['cum_actual'])<.02,k\n",
" prev=prior.get(k,{})\n",
" locked=prev.get('carry_left',0)\n",
" if locked>=1:expected[(*k,'结转')]=money(g['reward'])\n",
" else:\n",
" current=sum(Decimal(str(r['月奖励']))*Decimal(str(r['考核天数']))/30 for r in rows if r['实际行驶里程(km)']>=r['应考核里程(km)'])\n",
" if current:expected[(*k,'当月')]=money(current)\n",
" if cq and not g['virtual']:\n",
" for m in range(1,9):\n",
" old=hist.get((m,*k))\n",
" if old and (m,*k) not in settled:expected[(*k,f'补发{m}月')]=money(Decimal(str(old['reward']))*Decimal(str(old['days']))/calendar.monthrange(2026,m)[1])\n",
" if not any(r['实际行驶里程(km)']>=r['应考核里程(km)'] for r in rows) and locked<1:\n",
" expected[(*k,'累计补发9月')]=money(Decimal(str(g['reward']))*Decimal(str(g['days']))/30)\n",
" used_actual=carry_paid[k]+int(locked>=1)\n",
" if used_actual!=g['used_carry']:used_inconsistent.append(dict(plate=k[0],sales=k[1],ledger_used=used_actual,stored_used=g['used_carry']))\n",
" recomputed_prior=max(0,int(max(0,hist_a-hist_t)//g['monthly_target'])-carry_paid[k])\n",
" recomputed_balance=max(0,int(max(0,full_a-full_t)//g['monthly_target'])-used_actual)\n",
" evidence=dict(plate=k[0],sales=k[1],aug_cumulative_target=money(hist_t),aug_cumulative_actual=money(hist_a),monthly_target=g['monthly_target'],carry_paid_jan_aug=carry_paid[k],aug_saved_balance=locked,aug_formula_balance=recomputed_prior,sep_saved_balance=g['carry_left'],sep_formula_balance=recomputed_balance,sep_payment=g['total'],virtual=g['virtual'])\n",
" if recomputed_prior!=locked:carry_basis.append(evidence)\n",
" if recomputed_balance!=g['carry_left']:balance_inconsistent.append(evidence)\n",
" if cq!=g['cum_qualified']:status_inconsistent.append(dict(plate=k[0],sales=k[1],target=full_t,actual=full_a,stored=g['cum_qualified'],calculated=cq,virtual=g['virtual']))\n",
" if g['virtual']:\n",
" other=[l for l in d['ledger'] if l['plate']==k[0] and l['sales']!=k[1]]\n",
" if other:cross_owner.append(dict(plate=k[0],carry_owner=k[1],carry_amount=ledger.get((*k,'结转'),{}).get('amount',0),current_payments=[{f:l[f] for f in ['sales','category','amount']} for l in other]))\n",
" for l in d['ledger']:\n",
" if key(l)==k and l['assessment_month']<9:\n",
" assert (l['assessment_month'],*k) not in settled\n",
" details.append({**{f:l[f] for f in ['plate','sales','category','amount']},'aug_cumulative_target':prev.get('cum_target'),'aug_cumulative_actual':prev.get('cum_actual'),'sep_cumulative_target':full_t,'sep_cumulative_actual':full_a,'historically_unpaid':True})\n",
"missing=[dict(plate=k[0],sales=k[1],category=k[2],expected=v,actual=ledger.get(k,{}).get('amount',0)) for k,v in expected.items() if abs(v-ledger.get(k,{}).get('amount',0))>.001]\n",
"extra=[dict(plate=k[0],sales=k[1],category=k[2],actual=l['amount'],expected=expected.get(k,0)) for k,l in ledger.items() if abs(l['amount']-expected.get(k,0))>.001]\n",
"source_checks={}\n",
"for tag,x in d['sources'].items():source_checks[tag]=hashlib.sha256(Path(x['path']).read_bytes()).hexdigest()==x['sha256']\n",
"fp=S/'里程任务考核_2026年9月_含缺口核算.xlsx';wb=openpyxl.load_workbook(fp,data_only=True,read_only=True)\n",
"xrows=list(wb['9月奖金发放记录'].values)\n",
"excel_ledger={(r[0],r[1],r[4]):r[9] for r in xrows[1:] if r[0] and r[0]!='合计' and isinstance(r[9],(int,float))}\n",
"assert excel_ledger=={k:l['amount'] for k,l in ledger.items()}\n",
"errors=[(s.title,c.coordinate,c.value) for s in wb for row in s for c in row if c.data_type=='e'];wb.close()\n",
"assert not errors\n",
"by_cat={c:money(sum(l['amount'] for l in d['ledger'] if l['category']==c)) for c in d['categories']}\n",
"virtual_pay=[l for l in d['ledger'] if l['virtual']]\n",
"gap_pay=[l for l in d['ledger'] if l['gap_days']>0 or l['history_gap_days']>0]\n",
"wholly=[r for r in d['records'] if r['缺口天数']==r['考核天数']]\n",
"out=dict(amount=d['summary']['amount'],ledger_items=len(ledger),expected_amount_under_locked_aug_carry=money(sum(expected.values())),missing_payments=missing,extra_payments=extra,categories=by_cat,historical_backpay=details,prior_carry_basis_differences=carry_basis,next_balance_differences=balance_inconsistent,cumulative_status_inconsistencies=status_inconsistent,used_count_differences=used_inconsistent,cross_owner_payments=cross_owner,virtual_count=len(virtual_pay),virtual_amount=money(sum(l['amount'] for l in virtual_pay)),gap_payment_count=len(gap_pay),gap_payment_amount=money(sum(l['amount'] for l in gap_pay)),wholly_missing=[{f:r[f] for f in ['车牌号','销售经理','考核天数']} for r in wholly],source_hash_checks=source_checks,excel_ledger_matches=True,formula_errors=errors,workbook_sha256=hashlib.sha256(fp.read_bytes()).hexdigest())\n",
"(P/'audit_results.json').write_text(json.dumps(out,ensure_ascii=False,indent=2));print(json.dumps({k:v for k,v in out.items() if k not in ['next_balance_differences','cumulative_status_inconsistencies','source_hash_checks','historical_backpay']},ensure_ascii=False,indent=2));print('NEXT_BALANCES',len(balance_inconsistent),'STATUS',len(status_inconsistent))\n"
]
}
]
}
@@ -0,0 +1,27 @@
# 1—8月已发及9月补发独立核验
本核验只读原Excel/JSON,没有修改核算结果。独立脚本 independent.py、完整逐项证据 history_checks.json 位于同目录。
## 确定结论
- 1—6月 historical_paid.json 每条实发金额、车牌、原负责人、发放类型及对应考核月均与根目录“里程任务考核_N月核算.xlsx”的“N月奖金发放记录”对应原行吻合。
- 6月已离职当月奖金转接后的收款人逐人合计,与6月汇总98—105行完全吻合。
- 7月发放记录页保留9条离职人员不发项,共2749.35元;已发JSON正确剔除。证据:“7月绩效重算_多源考核里程_20260817/离职人员7月奖金处理明细.xlsx”→离职人员发放处理总览,第2行处理规则、第5/7行不发2189.35+560。7月主表汇总C106为62616.73;逐项四舍五入相加62616.76,差0.03属于原表舍入差,非9月新增差错。7月个人合计舍入差最多0.01。
- 9月7条历史补发共819.67元,没有同车、同负责人、同考核月已发后再次补发。按所有历史考核目标和实际里程独立复核非虚拟车组的累计达标及未付月,未发现漏补。
- 9月发放记录130—136行分别:尚建华粤AGP3612补5月33.55、补7月260、补8月260;钟祥粤AGP5138补8月72.58;尚建华粤AGR0772补8月19.35;吴纬涛粤AGR5228补8月150、粤AGR8536补8月24.19。
- 粤AGR0772的19.35元和8月给谯云116.13元不重复:尚建华8月28—31日4天,谯云8月1—24日24天(8月修正版业务考核源行92、166)。
- 粤AGP3612到9月底累计20767.20/20645.16,超122.04公里;截至8月累计14622.10/15645.16,差1023.06公里。因9月新增6145.10公里而取得此前未付月资格。该车6月已发锁定,所以没有6月重复补发。
## 待业务口径确认,不应直接视为错误或擅自扣款
9月延用旧规则:原负责人本月无考核,但上月仍有结转资格,自动生成虚拟结转。共33项5940元。其中5辆同时给新负责人9月当月奖金,旧负责人结转合计970元:
|车辆|原负责人结转|新负责人当月|9月发放记录原负责人行/新负责人行|
|---|---:|---:|---|
|粤AGR5560|金可鹏150|钟祥5|129 / 36|
|粤AGP3080|董剑煜150|尚建华5|117 / 41|
|粤AGR6869|董剑煜150|尚建华150|121 / 47|
|粤AGP3627|金可鹏260|秦挺260|123 / 70|
|粤AGP3692|金可鹏260|秦挺260|124 / 71|
这五辆按现行车+负责人分账及无考核仍发结转规则计算一致;如果管理制度要求交车后原负责人停止结转,将影响970元,但现有确认“沿用8月”不足以直接改成停止结转。需要把这一具体业务情形展示给用户。