            rows=[]
            for order in data['orders']:
                prices=[p for p in output['prices'] if p['sku']==order['sku'] and p['effective_date']<=order['date']]
                p=max(prices,key=lambda x:x['effective_date']) if prices else None
                rows.append({**order,'effective_price':p['price'] if p else None,'source_effective_date':p['effective_date'] if p else None,'amount':money(D(p['price'])*order['qty']) if p else None,'review':p is None})
            check('订单只向过去匹配价格',[r['effective_price'] for r in rows]==['10.00','12.00',None]);check('不拿未来价格填缺口',rows[2]['review']);check('日期边界含生效当天',max((p for p in output['prices'] if p['sku']=='A' and p['effective_date']<='2026-10-10'),key=lambda p:p['effective_date'])['price']=='12.00');cout('order-price-audit.csv',rows);result={'orders':rows,'known_total':money(sum(D(r['amount']) for r in rows if r['amount'] is not None))}
