diff --git a/app/Console/Commands/SyncStoreReceiptProductCost.php b/app/Console/Commands/SyncStoreReceiptProductCost.php index 6241ec7d..23ad2683 100644 --- a/app/Console/Commands/SyncStoreReceiptProductCost.php +++ b/app/Console/Commands/SyncStoreReceiptProductCost.php @@ -120,10 +120,15 @@ class SyncStoreReceiptProductCost extends Command // 账单侧取数:业绩明细里本月(可按平台限定)的账单行,一行 = 一个店铺的一个订单。 // 只取「收入金额有数据且不为 0」的账单行:收入为 0 的行是补出来的优惠/冲减/无收款账单行, // 没有对应的收款商品,不参与商品成本。 + // 「种菜金额」有数据(>0)的账单行整条排除,不参与匹配。 $billQuery = $mirror->table(self::SOURCE_TABLE) ->where('report_month', $reportMonth) ->whereNotNull('income_amount') - ->where('income_amount', '!=', 0); + ->where('income_amount', '!=', 0) + ->where(static function ($query): void { + $query->whereNull('planting_amount') + ->orWhere('planting_amount', '<=', 0); + }); if ($platform !== '') { $billQuery->where('platform', $platform); } diff --git a/resources/views/business/pages/financial-operations/product-costs.blade.php b/resources/views/business/pages/financial-operations/product-costs.blade.php index e2326cab..3949b202 100644 --- a/resources/views/business/pages/financial-operations/product-costs.blade.php +++ b/resources/views/business/pages/financial-operations/product-costs.blade.php @@ -113,7 +113,8 @@