| | |
| | | left join ( |
| | | SELECT |
| | | sl.customer_id, |
| | | sum(sor.stock_out_num * slp.tax_inclusive_unit_price) as outboundAmount |
| | | sum(sor.stock_out_num * slp.tax_inclusive_unit_price / IFNULL(NULLIF(slp.single_quantity, 0), 1)) as outboundAmount |
| | | FROM stock_out_record sor |
| | | LEFT join shipping_info s on sor.record_id = s.id |
| | | LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id |
| | |
| | | left join ( |
| | | SELECT |
| | | sl.id, |
| | | sum(sor.stock_out_num * slp.tax_inclusive_unit_price) as outboundAmount |
| | | sum(sor.stock_out_num * slp.tax_inclusive_unit_price / IFNULL(NULLIF(slp.single_quantity, 0), 1)) as outboundAmount |
| | | FROM stock_out_record sor |
| | | left join shipping_info s on sor.record_id = s.id |
| | | LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id |