|
@@ -16,7 +16,7 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="page" resultType="com.zjugis.business.bean.entity.Contract">
|
|
|
- SELECT c.*,PA.invoiceAmount,PA.returnAmount,(PA.invoiceAmount - PA.returnAmount) as receivableAmount,(c.CONTRACT_AMOUNT - pa.invoiceAmount) as contractBalance FROM CONTRACT c
|
|
|
+ SELECT c.*,COALESCE(PA.invoiceAmount,0),COALESCE(PA.returnAmount,0),(COALESCE(PA.invoiceAmount,0) - COALESCE(PA.returnAmount,0)) as receivableAmount,(COALESCE(c.CONTRACT_AMOUNT,0) - COALESCE(pa.invoiceAmount,0)) as contractBalance FROM CONTRACT c
|
|
|
LEFT JOIN (
|
|
|
SELECT CONTRACT_ID,
|
|
|
COALESCE(SUM(COALESCE(INVOICE_AMOUNT,0)),0) as invoiceAmount,
|
|
@@ -138,13 +138,13 @@
|
|
|
<select id="messageCountContract" resultType="com.zjugis.business.bean.response.ContractMessageCountResp">
|
|
|
|
|
|
SELECT NVL(SUM(c.CONTRACT_AMOUNT), 0) as signAmount,
|
|
|
- NVL(SUM(CASE WHEN c.SIGN_WAY = 3 then C.CONTRACT_AMOUNT ELSE 0 END), 0) AS newAmount
|
|
|
+ NVL(SUM(C.CONTRACT_AMOUNT), 0) AS newAmount
|
|
|
FROM CONTRACT c
|
|
|
RIGHT JOIN PROJECT pr ON pr.ID = c.PROJECT_ID
|
|
|
<where>
|
|
|
c.ISVALID = 1 AND c.FLOW_STATUS = 90
|
|
|
<if test="params != null and params.year != null and params.year != ''">
|
|
|
- AND TO_CHAR(c.CONTRACT_OFF,'YYYY') = #{params.year,jdbcType=VARCHAR}
|
|
|
+ AND TO_CHAR(c.CONTRACT_ON,'YYYY') = #{params.year,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
<if test="params != null and params.deptId != null and params.deptId != ''">
|
|
|
AND pr.ZRBM_ID = #{params.deptId}
|
|
@@ -167,7 +167,7 @@
|
|
|
COALESCE(SUM(COALESCE(PA.invoiceAmount,0)),0) as invoiceAmount,
|
|
|
COALESCE(SUM(COALESCE(PA.returnAmount,0)),0) as returnAmount,
|
|
|
COALESCE(SUM(COALESCE(PA.invoiceAmount - PA.returnAmount,0)),0) as receivableAmount,
|
|
|
- COALESCE(SUM(COALESCE(c.CONTRACT_AMOUNT - pa.invoiceAmount,0)),0) as contractBalance
|
|
|
+ COALESCE(SUM(COALESCE(c.CONTRACT_AMOUNT,0)),0) - COALESCE(SUM(COALESCE(PA.invoiceAmount,0)),0) as contractBalance
|
|
|
FROM CONTRACT c
|
|
|
LEFT JOIN (
|
|
|
SELECT CONTRACT_ID,
|