|
@@ -312,7 +312,7 @@
|
|
<result column="productionFundId" property="productionFundId" />
|
|
<result column="productionFundId" property="productionFundId" />
|
|
<result column="created" property="created" />
|
|
<result column="created" property="created" />
|
|
<result column="remark" property="remark" />
|
|
<result column="remark" property="remark" />
|
|
- <result column="plan_amount" property="planAmount" />
|
|
|
|
|
|
+ <result column="invoiceAmount" property="invoiceAmount" />
|
|
<result column="delivery" property="delivery" />
|
|
<result column="delivery" property="delivery" />
|
|
<result column="mDeclareResult" property="mDeclareResult" />
|
|
<result column="mDeclareResult" property="mDeclareResult" />
|
|
<result column="eDeclareResult" property="eDeclareResult" />
|
|
<result column="eDeclareResult" property="eDeclareResult" />
|
|
@@ -361,7 +361,7 @@
|
|
pf.id as productionFundId,
|
|
pf.id as productionFundId,
|
|
pf.real_amount,
|
|
pf.real_amount,
|
|
pf.production_should_amount as shouldAmount,
|
|
pf.production_should_amount as shouldAmount,
|
|
- fi.plan_amount,
|
|
|
|
|
|
+ fi.invoiceAmount,
|
|
mp.delivery,
|
|
mp.delivery,
|
|
( SELECT declare_result FROM commission_declare WHERE business_id = m.id AND production_id IS NULL AND business_type = 'COMMISSION_DECLARE_MAJOR_MARKET' AND deleted = 0 ) as mDeclareResult,
|
|
( SELECT declare_result FROM commission_declare WHERE business_id = m.id AND production_id IS NULL AND business_type = 'COMMISSION_DECLARE_MAJOR_MARKET' AND deleted = 0 ) as mDeclareResult,
|
|
( SELECT declare_result FROM commission_declare WHERE business_id = m.id AND production_id IS NULL AND business_type = 'COMMISSION_DECLARE_MAJOR_EVALUATE' AND deleted = 0 ) as eDeclareResult
|
|
( SELECT declare_result FROM commission_declare WHERE business_id = m.id AND production_id IS NULL AND business_type = 'COMMISSION_DECLARE_MAJOR_EVALUATE' AND deleted = 0 ) as eDeclareResult
|
|
@@ -375,7 +375,7 @@
|
|
left join customer_linkman cl on cl.id = m.clientele_contact_id
|
|
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 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)
|
|
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)
|
|
- left join (select plan_amount,order_fund_id,production_fund_id from finance_invoice where state in ('审核中','已开票') and deleted = 0) fi on (fi.order_fund_id = orf.id and fi.production_fund_id = pf.id)
|
|
|
|
|
|
+ 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>
|
|
|
|
|
|
@@ -645,6 +645,7 @@
|
|
off.production_should_amount as shouldAmount,
|
|
off.production_should_amount as shouldAmount,
|
|
off.id as productionFundId,
|
|
off.id as productionFundId,
|
|
off.real_amount,
|
|
off.real_amount,
|
|
|
|
+ fi.invoiceAmount,
|
|
ifnull(( SELECT declare_result FROM commission_declare WHERE business_id = m.id AND production_id = mp.id AND business_type = 'COMMISSION_DECLARE_MAJOR_MARKET' AND deleted = 0 ),
|
|
ifnull(( SELECT declare_result FROM commission_declare WHERE business_id = m.id AND production_id = mp.id AND business_type = 'COMMISSION_DECLARE_MAJOR_MARKET' AND deleted = 0 ),
|
|
( SELECT declare_result FROM commission_declare WHERE business_id = m.id and production_id is null AND business_type = 'COMMISSION_DECLARE_MAJOR_MARKET' AND deleted = 0 )) as mDeclareResult,
|
|
( SELECT declare_result FROM commission_declare WHERE business_id = m.id and production_id is null AND business_type = 'COMMISSION_DECLARE_MAJOR_MARKET' AND deleted = 0 )) as mDeclareResult,
|
|
ifnull(( SELECT declare_result FROM commission_declare WHERE business_id = m.id AND production_id = mp.id AND business_type = 'COMMISSION_DECLARE_MAJOR_EVALUATE' AND deleted = 0 ),
|
|
ifnull(( SELECT declare_result FROM commission_declare WHERE business_id = m.id AND production_id = mp.id AND business_type = 'COMMISSION_DECLARE_MAJOR_EVALUATE' AND deleted = 0 ),
|
|
@@ -657,7 +658,7 @@
|
|
LEFT JOIN user u ON u.id = m.principal_id
|
|
LEFT JOIN user u ON u.id = m.principal_id
|
|
LEFT JOIN user u1 ON u1.id = m.client_manager_id
|
|
LEFT JOIN user u1 ON u1.id = m.client_manager_id
|
|
LEFT JOIN customer_company cc ON cc.id = m.clientele_id
|
|
LEFT JOIN customer_company cc ON cc.id = m.clientele_id
|
|
-
|
|
|
|
|
|
+ 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 = off.id)
|
|
WHERE
|
|
WHERE
|
|
m.deleted = 0
|
|
m.deleted = 0
|
|
AND mp.deleted = 0
|
|
AND mp.deleted = 0
|
|
@@ -696,7 +697,10 @@
|
|
and ( SELECT declare_result FROM commission_declare WHERE business_id = m.id AND production_id = mp.id AND business_type = 'COMMISSION_DECLARE_MAJOR_EVALUATE' AND deleted = 0 ) is null
|
|
and ( SELECT declare_result FROM commission_declare WHERE business_id = m.id AND production_id = mp.id AND business_type = 'COMMISSION_DECLARE_MAJOR_EVALUATE' AND deleted = 0 ) is null
|
|
</if>
|
|
</if>
|
|
ORDER BY
|
|
ORDER BY
|
|
- mp.created DESC
|
|
|
|
|
|
+ <if test="vo!=null and vo.invoiceAmount!=null">
|
|
|
|
+ fi.invoiceAmount=${vo.invoiceAmount} desc,
|
|
|
|
+ </if>
|
|
|
|
+ mp.created DESC
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<update id="cancelDelivery">
|
|
<update id="cancelDelivery">
|