| | |
| | | T1.attachment_materials, |
| | | T1.tenant_id, |
| | | T1.contract_amount, |
| | | T1.contract_type, |
| | | T1.net_contract_amount, |
| | | T1.contract_amount AS noInvoiceAmountTotal, |
| | | T1.execution_date, |
| | |
| | | left join ( |
| | | select slp.sales_ledger_id, SUM(spd.quantity) AS shipped_quantity |
| | | from sales_ledger_product slp |
| | | inner join shipping_info si on slp.id = si.sales_ledger_product_id and si.status = '已发货' |
| | | inner join shipping_info si on slp.id = si.sales_ledger_product_id and si.status IN ('审核通过', '已发货') |
| | | inner join shipping_product_detail spd on si.id = spd.shipping_info_id |
| | | inner join stock_out_record sor on sor.record_id = si.id |
| | | and TRIM(sor.record_type) = '13' |
| | | and sor.approval_status = 1 |
| | | group by slp.sales_ledger_id |
| | | ) shipped on sl.id = shipped.sales_ledger_id |
| | | where sl.parent_contract_id = #{parentContractId} |
| | |
| | | select IFNULL(SUM(spd.quantity), 0) |
| | | from sales_ledger slo |
| | | inner join sales_ledger_product slp on slo.id = slp.sales_ledger_id |
| | | inner join shipping_info si on slp.id = si.sales_ledger_product_id and si.status = '已发货' |
| | | inner join shipping_info si on slp.id = si.sales_ledger_product_id and si.status IN ('审核通过', '已发货') |
| | | inner join shipping_product_detail spd on si.id = spd.shipping_info_id |
| | | inner join stock_out_record sor on sor.record_id = si.id |
| | | and TRIM(sor.record_type) = '13' |
| | | and sor.approval_status = 1 |
| | | where slo.parent_contract_id = #{parentContractId} |
| | | </select> |
| | | |