| | |
| | | slp.tax_inclusive_unit_price, |
| | | prop.return_quantity, |
| | | prop.purchase_return_order_id, |
| | | GREATEST(sir.stock_in_num - COALESCE(prop.return_quantity, 0), 0) AS un_quantity, |
| | | GREATEST(sir.stock_in_num - COALESCE(rs1.total_return_num1, 0), 0) AS un_quantity, |
| | | COALESCE(rs.total_return_num, 0) AS total_return_num |
| | | from purchase_return_order_products prop |
| | | left join purchase_return_orders pro on prop.purchase_return_order_id = pro.id |
| | |
| | | FROM purchase_return_order_products |
| | | WHERE 1 = 1 and purchase_return_order_id = #{id} |
| | | GROUP BY stock_in_record_id) rs ON rs.stock_in_record_id = sir.id |
| | | LEFT JOIN (SELECT stock_in_record_id, |
| | | SUM(return_quantity) AS total_return_num1 |
| | | FROM purchase_return_order_products |
| | | WHERE 1 = 1 and purchase_return_order_id = #{id} |
| | | GROUP BY stock_in_record_id) rs1 ON rs1.stock_in_record_id = sir.id |
| | | where pro.id = #{id} |
| | | </select> |
| | | </mapper> |