业绩明细:C 方案——三条通用等式档(未减冲减/优惠/优惠和冲减)在口径标识行让位给口径兜底;差额待核实档排除口径标识行
This commit is contained in:
parent
74a9b5b81f
commit
422497cfcc
@ -301,9 +301,12 @@ class Pages extends Controller
|
||||
. " WHERE b.order_no = store_receipt_order_match_rows.online_order_no AND b.bill_item LIKE '价保扣款%'), 0)";
|
||||
$rules['订单实付未减退款'] = "platform = '京东账单' AND " . $effective . ' < -0.005'
|
||||
. ' AND ABS(ROUND(ABS(' . $effective . ') - ' . $jiabaoRefund . ', 2)) <= 0.02';
|
||||
$rules[$label . '未减冲减'] = "match_status = '已匹配' AND ABS(COALESCE($column, 0) - (COALESCE(income_amount, 0) + COALESCE(discount_amount, 0))) < 0.005";
|
||||
$rules[$label . '未减优惠'] = "match_status = '已匹配' AND ABS(COALESCE($column, 0) - (COALESCE(income_amount, 0) + COALESCE(offset_amount, 0))) < 0.005";
|
||||
$rules[$label . '未减优惠和冲减'] = "match_status = '已匹配' AND ABS(COALESCE($column, 0) - COALESCE(income_amount, 0)) < 0.005";
|
||||
// C 方案:这三条是"通用等式档"——口径(卖家实收 / 应付已付)能对上账单的行让位给口径兜底
|
||||
// (归零 + 口径标识),只有口径也对不上时才显示这三档,避免把口径差标成一堆"未减优惠/冲减"。
|
||||
$notBasisMarked = "COALESCE(remark, '') NOT IN ('订单实付按卖家实收核对', '订单实付按应付/已付核对')";
|
||||
$rules[$label . '未减冲减'] = "match_status = '已匹配' AND ABS(COALESCE($column, 0) - (COALESCE(income_amount, 0) + COALESCE(discount_amount, 0))) < 0.005 AND " . $notBasisMarked;
|
||||
$rules[$label . '未减优惠'] = "match_status = '已匹配' AND ABS(COALESCE($column, 0) - (COALESCE(income_amount, 0) + COALESCE(offset_amount, 0))) < 0.005 AND " . $notBasisMarked;
|
||||
$rules[$label . '未减优惠和冲减'] = "match_status = '已匹配' AND ABS(COALESCE($column, 0) - COALESCE(income_amount, 0)) < 0.005 AND " . $notBasisMarked;
|
||||
|
||||
// 抖音「订单实付含已退款部分」:负差额能在聚水潭退款单/取消子单金额里对上
|
||||
// (≈差额,或放宽口径 ≈实付−收入=差额+优惠+冲减)才标注。
|
||||
@ -335,7 +338,7 @@ class Pages extends Controller
|
||||
}
|
||||
|
||||
// 兜底档:有差额但没命中任何原因 →「差额待核实」(与页面渲染的兜底备注保持一致)。
|
||||
$conditions['差额待核实'] = 'ABS(' . $effective . ') > 0.005 AND NOT (' . implode(' OR ', $seen) . ')';
|
||||
$conditions['差额待核实'] = 'ABS(' . $effective . ') > 0.005 AND NOT (' . implode(' OR ', $seen) . ') AND ' . $notBasisMarked;
|
||||
|
||||
return $conditions;
|
||||
}
|
||||
@ -486,13 +489,19 @@ class Pages extends Controller
|
||||
return '订单实付未减退款';
|
||||
}
|
||||
}
|
||||
if (abs($product - ($income + $discount)) < 0.005) {
|
||||
// C 方案:口径标识行让位给口径兜底,这三条通用等式档只对"口径也对不上"的行生效。
|
||||
$basisMarked = in_array(
|
||||
trim((string) ($row->remark ?? '')),
|
||||
['订单实付按卖家实收核对', '订单实付按应付/已付核对'],
|
||||
true
|
||||
);
|
||||
if (! $basisMarked && abs($product - ($income + $discount)) < 0.005) {
|
||||
return $label . '未减冲减';
|
||||
}
|
||||
if (abs($product - ($income + $offset)) < 0.005) {
|
||||
if (! $basisMarked && abs($product - ($income + $offset)) < 0.005) {
|
||||
return $label . '未减优惠';
|
||||
}
|
||||
if (abs($product - $income) < 0.005) {
|
||||
if (! $basisMarked && abs($product - $income) < 0.005) {
|
||||
return $label . '未减优惠和冲减';
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user