|
@@ -8,7 +8,7 @@
|
|
|
convert(char(7),ssd.dPreDate,120) yearMonth,
|
|
|
ssd.iNatUnitPrice,
|
|
|
sum(ssd.iQuantity) as iQuantity,
|
|
|
- sum(ssd.iNatMoney) as iNatMoney
|
|
|
+ sum(ssd.iNatUnitPrice*ssd.iQuantity) as iNatMoney
|
|
|
FROM
|
|
|
SO_SOMain ss
|
|
|
LEFT JOIN (
|
|
@@ -23,9 +23,9 @@
|
|
|
) ssd ON ss.ID= ssd.ID
|
|
|
left join Department de on ss.cDepCode=de.cDepCode
|
|
|
left join Customer cc on ss.cCusCode = cc.cCusCode
|
|
|
- WHERE ss.iStatus = 1
|
|
|
+ <where>
|
|
|
<if test="map.startYearMonth!=null and map.startYearMonth!='' and map.endYearMonth!=null and map.endYearMonth!=''">
|
|
|
- AND CONVERT ( CHAR ( 7 ), ssd.dPreDate, 120 ) <![CDATA[ >= ]]> #{map.startYearMonth}
|
|
|
+ CONVERT ( CHAR ( 7 ), ssd.dPreDate, 120 ) <![CDATA[ >= ]]> #{map.startYearMonth}
|
|
|
AND CONVERT ( CHAR ( 7 ), ssd.dPreDate, 120 ) <![CDATA[ <= ]]> #{map.endYearMonth}
|
|
|
</if>
|
|
|
<if test="map.vendorType!=null and map.vendorType!='' and map.vendorType=='内部'">
|
|
@@ -40,6 +40,7 @@
|
|
|
<if test="map.customer!=null and map.customer!='' ">
|
|
|
and cc.cCusAbbName = #{map.customer}
|
|
|
</if>
|
|
|
+ </where>
|
|
|
GROUP BY de.cDepName,ss.cCusCode,convert(char(7),ssd.dPreDate,120),ssd.iNatUnitPrice,cc.cCusAbbName
|
|
|
--ORDER BY
|
|
|
--de.cDepName,ss.cCusCode,CONVERT ( CHAR ( 7 ), ssd.dPreDate, 120 ),ssd.iNatUnitPrice
|
|
@@ -49,7 +50,7 @@
|
|
|
SELECT
|
|
|
cc.cCusAbbName as cCusName,
|
|
|
sum(ssd.iQuantity) as iQuantity,
|
|
|
- sum(ssd.iNatMoney) as iNatMoney
|
|
|
+ sum(ssd.iNatUnitPrice*ssd.iQuantity) as iNatMoney
|
|
|
FROM
|
|
|
SO_SOMain ss
|
|
|
LEFT JOIN (
|
|
@@ -64,9 +65,9 @@
|
|
|
) ssd ON ss.ID= ssd.ID
|
|
|
left join Department de on ss.cDepCode=de.cDepCode
|
|
|
left join Customer cc on ss.cCusCode = cc.cCusCode
|
|
|
- WHERE ss.iStatus = 1
|
|
|
+ <where>
|
|
|
<if test="startYearMonth!=null and startYearMonth!='' and endYearMonth!=null and endYearMonth!=''">
|
|
|
- AND CONVERT ( CHAR ( 7 ), ssd.dPreDate, 120 ) <![CDATA[ >= ]]> #{startYearMonth}
|
|
|
+ CONVERT ( CHAR ( 7 ), ssd.dPreDate, 120 ) <![CDATA[ >= ]]> #{startYearMonth}
|
|
|
AND CONVERT ( CHAR ( 7 ), ssd.dPreDate, 120 ) <![CDATA[ <= ]]> #{endYearMonth}
|
|
|
</if>
|
|
|
<if test="vendorType!=null and vendorType!='' and vendorType=='内部'">
|
|
@@ -81,6 +82,7 @@
|
|
|
<if test="customer!=null and customer!='' ">
|
|
|
and cc.cCusAbbName = #{customer}
|
|
|
</if>
|
|
|
+ </where>
|
|
|
GROUP BY cc.cCusAbbName
|
|
|
</select>
|
|
|
|
|
@@ -89,7 +91,7 @@
|
|
|
SELECT
|
|
|
de.cDepName,
|
|
|
sum(ssd.iQuantity) as iQuantity,
|
|
|
- sum(ssd.iNatMoney) as iNatMoney
|
|
|
+ sum(ssd.iNatUnitPrice*ssd.iQuantity) as iNatMoney
|
|
|
FROM
|
|
|
SO_SOMain ss
|
|
|
LEFT JOIN (
|
|
@@ -104,9 +106,9 @@
|
|
|
) ssd ON ss.ID= ssd.ID
|
|
|
left join Customer cc on ss.cCusCode = cc.cCusCode
|
|
|
left join Department de on ss.cDepCode=de.cDepCode
|
|
|
- WHERE ss.iStatus = 1
|
|
|
+ <where>
|
|
|
<if test="startYearMonth!=null and startYearMonth!='' and endYearMonth!=null and endYearMonth!=''">
|
|
|
- AND CONVERT ( CHAR ( 7 ), ssd.dPreDate, 120 ) <![CDATA[ >= ]]> #{startYearMonth}
|
|
|
+ CONVERT ( CHAR ( 7 ), ssd.dPreDate, 120 ) <![CDATA[ >= ]]> #{startYearMonth}
|
|
|
AND CONVERT ( CHAR ( 7 ), ssd.dPreDate, 120 ) <![CDATA[ <= ]]> #{endYearMonth}
|
|
|
</if>
|
|
|
<if test="vendorType!=null and vendorType!='' and vendorType=='内部'">
|
|
@@ -121,6 +123,7 @@
|
|
|
<if test="customer!=null and customer!='' ">
|
|
|
and cc.cCusAbbName = #{customer}
|
|
|
</if>
|
|
|
+ </where>
|
|
|
GROUP BY de.cDepName
|
|
|
</select>
|
|
|
</mapper>
|