|
@@ -373,7 +373,7 @@
|
|
|
pf.id as productionFundId,
|
|
|
pf.real_amount,
|
|
|
pf.production_should_amount as shouldAmount,
|
|
|
- fi.invoiceAmount,
|
|
|
+ (select sum(real_amount) from finance_invoice where state = '已开票' and deleted =0 and order_fund_id = orf.id and if(production_fund_id is null,1=1,production_fund_id = pf.id)) as invoiceAmount,
|
|
|
mp.delivery,
|
|
|
mp.delivery_date,
|
|
|
(case mp.repertory_state when 0 then '已入库' when 1 then '已出库' else '未入库' end ) repertoryState,
|
|
@@ -389,8 +389,6 @@
|
|
|
left join customer_linkman cl on cl.id = m.clientele_contact_id
|
|
|
left join (select * from order_fund where business_type ='MAJOR_BUSINESS' and deleted = 0) orf on orf.business_id = m.id
|
|
|
left join (select * from production_fund where business_type = 'MAJOR_BUSINESS' and deleted = 0) pf on (pf.business_id = m.id and pf.production_no = mp.report_no and mp.production = pf.production_type)
|
|
|
- left join (select sum(real_amount) as invoiceAmount,order_fund_id,production_fund_id from finance_invoice where state='已开票' and deleted = 0 group by production_fund_id) fi on (fi.order_fund_id = orf.id and fi.production_fund_id = pf.id)
|
|
|
-
|
|
|
</sql>
|
|
|
|
|
|
<sql id="myOrderSql">
|