|
@@ -1002,7 +1002,7 @@
|
|
|
</where>
|
|
|
</select>
|
|
|
<!--安品出入库统计-->
|
|
|
- <select id="selectTWarehouseInorOut" parameterType="TWarehousebills"
|
|
|
+ <select id="selectTWarehouseInorOut" parameterType="TWarehousebillsfees"
|
|
|
resultType="com.ruoyi.anpin.WarhousrExcel">
|
|
|
SELECT ti.f_bsdate AS fBsdate,/*进货时间*/
|
|
|
tf.f_name AS feeName,/*物资名称*/
|
|
@@ -1018,6 +1018,7 @@
|
|
|
sti.dict_label AS fIsfillesName,/*索证索票*/
|
|
|
std.dict_label AS fFeetype,/*物资类别*/
|
|
|
sr.user_name AS purchaseName,/*采购人*/
|
|
|
+ tp.f_name AS projectName,/*项目名称*/
|
|
|
CASE
|
|
|
|
|
|
WHEN tw.f_billtype = 'CK' THEN
|
|
@@ -1039,6 +1040,7 @@
|
|
|
LEFT JOIN sys_dict_data sti ON sti.dict_value = tw.f_isfilles
|
|
|
AND sti.dict_type = 'f_evidence'
|
|
|
LEFT JOIN t_warehousebills ti ON tw.f_pid = ti.f_id
|
|
|
+ LEFT JOIN t_project tp ON ti.f_goodsid = tp.f_id
|
|
|
LEFT JOIN t_corps tc ON ti.f_corpid = tc.f_id
|
|
|
LEFT JOIN sys_user sr ON sr.user_id = ti.f_purchase
|
|
|
LEFT JOIN sys_dict_data std ON std.dict_value = tf.f_feetype
|
|
@@ -1049,6 +1051,7 @@
|
|
|
<if test="fBillstatus != null and fBillstatus == 1">and tw.f_billstatus = 6</if>
|
|
|
<if test="fBillstatus != null and fBillstatus == 2">and tw.f_billstatus != 6</if>
|
|
|
<if test="fCorpid != null ">and ti.f_corpid = #{fCorpid}</if>
|
|
|
+ <if test="fGoodsid != null ">and ti.f_goodsid = #{fGoodsid}</if>
|
|
|
<if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
|
|
|
<if test="fBilltype == null or fBilltype == ''">and tw.f_billtype in ('CK','RK')</if>
|
|
|
<if test="fFeeid != null ">and tw.f_feeid = #{fFeeid}</if>
|
|
@@ -1193,8 +1196,8 @@
|
|
|
tf.f_billtype = 'XS'
|
|
|
AND tf.del_flag = '0'
|
|
|
AND tw.del_flag = '0'
|
|
|
- AND tf.f_billstatus = 6
|
|
|
- <if test="fGoodsid != null and fGoodsid != ''">and tw.f_goodsid = #{fGoodsid}</if>
|
|
|
+ <if test="fBillstatus != null and fBillstatus != ''">and tf.f_billstatus = #{fBillstatus}</if>
|
|
|
+ <if test="fGoodsid != null and fGoodsid != ''">and tf.f_corpid = #{fGoodsid}</if>
|
|
|
<if test="fFeeType != null">and te.f_feetype = #{fFeeType}</if>
|
|
|
<if test="annual != null and annual != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{annual}</if>
|
|
|
<if test="monthList != null and monthList[0] != null and monthList[0]!= ''">
|
|
@@ -1213,7 +1216,7 @@
|
|
|
) xs
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
- tf.f_corpid,
|
|
|
+ tp.f_corpid,
|
|
|
DATE_FORMAT( tf.f_bsdate, '%Y' ) AS years,
|
|
|
DATE_FORMAT( tf.f_bsdate, '%m' ) AS months,
|
|
|
IFNULL( SUM( tf.f_amount ), 0 ) AS collect
|
|
@@ -1221,12 +1224,13 @@
|
|
|
t_warehousebillsfees tf
|
|
|
LEFT JOIN t_warehousebills tw ON tf.f_pid = tw.f_id
|
|
|
LEFT JOIN t_fees te ON tf.f_feeid = te.f_id
|
|
|
+ LEFT JOIN t_project tp ON tp.f_id = tw.f_goodsid
|
|
|
WHERE
|
|
|
tf.f_billtype = 'SQ'
|
|
|
AND tf.del_flag = '0'
|
|
|
AND tw.del_flag = '0'
|
|
|
- AND tf.f_billstatus = 6
|
|
|
- <if test="fGoodsid != null and fGoodsid != ''">and tw.f_goodsid = #{fGoodsid}</if>
|
|
|
+ <if test="fBillstatus != null and fBillstatus != ''">and tf.f_billstatus = #{fBillstatus}</if>
|
|
|
+ <if test="fGoodsid != null and fGoodsid != ''">and tp.f_corpid = #{fGoodsid}</if>
|
|
|
<if test="fFeeType != null">and te.f_feetype = #{fFeeType}</if>
|
|
|
<if test="annual != null and annual != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{annual}</if>
|
|
|
<if test='monthList != null and monthList[0] != null and monthList[0]!= ""'>
|
|
@@ -1238,7 +1242,7 @@
|
|
|
GROUP BY
|
|
|
DATE_FORMAT( tf.f_bsdate, '%Y' ),
|
|
|
DATE_FORMAT( tf.f_bsdate, '%m' ),
|
|
|
- tf.f_corpid
|
|
|
+ tp.f_corpid
|
|
|
ORDER BY
|
|
|
DATE_FORMAT( tf.f_bsdate, '%Y' ),
|
|
|
DATE_FORMAT( tf.f_bsdate, '%m' )
|
|
@@ -1268,7 +1272,7 @@
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
- tf.f_corpid,
|
|
|
+ tp.f_corpid,
|
|
|
DATE_FORMAT( tf.f_bsdate, '%Y' ) AS years,
|
|
|
DATE_FORMAT( tf.f_bsdate, '%m' ) AS months,
|
|
|
IFNULL( SUM( tf.f_amount ), 0 ) AS collect
|
|
@@ -1276,12 +1280,13 @@
|
|
|
t_warehousebillsfees tf
|
|
|
LEFT JOIN t_warehousebills tw ON tf.f_pid = tw.f_id
|
|
|
LEFT JOIN t_fees te ON tf.f_feeid = te.f_id
|
|
|
+ LEFT JOIN t_project tp ON tp.f_id = tw.f_goodsid
|
|
|
WHERE
|
|
|
tf.f_billtype = 'SQ'
|
|
|
AND tf.del_flag = '0'
|
|
|
AND tw.del_flag = '0'
|
|
|
- AND tf.f_billstatus = 6
|
|
|
- <if test="fGoodsid != null and fGoodsid != ''">and tw.f_goodsid = #{fGoodsid}</if>
|
|
|
+ <if test="fBillstatus != null and fBillstatus != ''">and tf.f_billstatus = #{fBillstatus}</if>
|
|
|
+ <if test="fGoodsid != null and fGoodsid != ''">and tp.f_corpid = #{fGoodsid}</if>
|
|
|
<if test="fFeeType != null">and te.f_feetype = #{fFeeType}</if>
|
|
|
<if test="annual != null and annual != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{annual}</if>
|
|
|
<if test='monthList != null and monthList[0] != null and monthList[0]!= ""'>
|
|
@@ -1293,7 +1298,7 @@
|
|
|
GROUP BY
|
|
|
DATE_FORMAT( tf.f_bsdate, '%Y' ),
|
|
|
DATE_FORMAT( tf.f_bsdate, '%m' ),
|
|
|
- tf.f_corpid
|
|
|
+ tp.f_corpid
|
|
|
ORDER BY
|
|
|
DATE_FORMAT( tf.f_bsdate, '%Y' ),
|
|
|
DATE_FORMAT( tf.f_bsdate, '%m' )
|
|
@@ -1312,8 +1317,8 @@
|
|
|
tf.f_billtype = 'XS'
|
|
|
AND tf.del_flag = '0'
|
|
|
AND tw.del_flag = '0'
|
|
|
- AND tf.f_billstatus = 6
|
|
|
- <if test="fGoodsid != null and fGoodsid != ''">and tw.f_goodsid = #{fGoodsid}</if>
|
|
|
+ <if test="fBillstatus != null and fBillstatus != ''">and tf.f_billstatus = #{fBillstatus}</if>
|
|
|
+ <if test="fGoodsid != null and fGoodsid != ''">and tf.f_corpid = #{fGoodsid}</if>
|
|
|
<if test="fFeeType != null">and te.f_feetype = #{fFeeType}</if>
|
|
|
<if test="annual != null and annual != ''">and DATE_FORMAT(tf.f_bsdate,'%Y') = #{annual}</if>
|
|
|
<if test='monthList != null and monthList[0] != null and monthList[0]!= "" '>
|
|
@@ -1376,18 +1381,18 @@
|
|
|
/*库区*/
|
|
|
th.f_warehouse_information AS fWarehouseName,
|
|
|
/*库区中文名*/
|
|
|
- ifnull(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<=#{timeInterval[0]} THEN tf.f_qty ELSE 0 END ) - sum( CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate<=#{timeInterval[0]} THEN tf.f_qty ELSE 0 END ),0) AS fBeginQty,
|
|
|
+ ifnull(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_qty ELSE 0 END ) - sum( CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_qty ELSE 0 END ),0) AS fBeginQty,
|
|
|
/*期初数量*/
|
|
|
ROUND(
|
|
|
IFNULL((
|
|
|
- sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<=#{timeInterval[0]} THEN tf.f_amount ELSE 0 END ) - sum( CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate<=#{timeInterval[0]} THEN tf.f_amount ELSE 0 END ))/(
|
|
|
- sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<=#{timeInterval[0]} THEN tf.f_qty ELSE 0 END ) - sum( CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate<=#{timeInterval[0]} THEN tf.f_qty ELSE 0 END )),
|
|
|
+ sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_amount ELSE 0 END ) - sum( CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_amount ELSE 0 END ))/(
|
|
|
+ sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_qty ELSE 0 END ) - sum( CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_qty ELSE 0 END )),
|
|
|
0
|
|
|
),
|
|
|
2
|
|
|
) AS fBeginUnitprice,
|
|
|
/*期初单价*/
|
|
|
- IFNULL(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<=#{timeInterval[0]} THEN tf.f_amount ELSE 0 END ) - sum( CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate<=#{timeInterval[0]} THEN tf.f_amount ELSE 0 END ),0) AS fBeginAmount,
|
|
|
+ IFNULL(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_amount ELSE 0 END ) - sum( CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_amount ELSE 0 END ),0) AS fBeginAmount,
|
|
|
/*期初金额*/
|
|
|
IFNULL(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate>=#{timeInterval[0]} AND tf.f_bsdate<=#{timeInterval[1]} THEN tf.f_qty ELSE 0 END ),0) AS rQty,
|
|
|
/*入库数量*/
|