|
@@ -1809,4 +1809,354 @@
|
|
|
<if test="fBillstatus != null and fBillstatus != '' and fBillstatus != 'null' ">and tf.f_billstatus = #{fBillstatus}</if>
|
|
|
ORDER BY tf.f_id desc
|
|
|
</select>
|
|
|
+ <select id="anPinFinanceCenter" resultType="java.util.Map">
|
|
|
+ SELECT
|
|
|
+ t.f_billno AS fBillno,
|
|
|
+ t.f_goodsid AS fGoodsid ,
|
|
|
+ tp.f_name AS projectName,
|
|
|
+ t.f_sbu AS fSbu,
|
|
|
+ tc.f_name AS fSbuName,
|
|
|
+ w.f_id AS fSrcid,
|
|
|
+ t.f_id AS fSrcpid,
|
|
|
+ t.f_corpid AS fCorpid,
|
|
|
+ c.f_name AS fName,
|
|
|
+ w.fName AS fFeesName,
|
|
|
+ w.f_product_name AS fProductName,
|
|
|
+ w.f_bsdate AS fBsdate,
|
|
|
+ t.f_billtype AS fBilltype,
|
|
|
+ t.f_review_date AS fReviewDate,
|
|
|
+ w.f_feeid AS fFeeid,
|
|
|
+ w.src_bill_no AS srcBillNo,
|
|
|
+ w.f_marks AS fMarks,
|
|
|
+ f.f_name AS fFeeName,
|
|
|
+ f.f_tax_code AS fTaxCode,
|
|
|
+ w.f_dc AS fSrcdcs,
|
|
|
+ CASE
|
|
|
+
|
|
|
+ WHEN t.f_billtype = 'XS' THEN
|
|
|
+ 'D'
|
|
|
+ WHEN t.f_billtype = 'SQ' THEN
|
|
|
+ 'C'
|
|
|
+ END AS fSrcdc,
|
|
|
+ CASE
|
|
|
+
|
|
|
+ WHEN t.f_billtype = 'XS' THEN
|
|
|
+ '收'
|
|
|
+ WHEN t.f_billtype = 'SQ' THEN
|
|
|
+ '付'
|
|
|
+ END AS fSrcdcName,
|
|
|
+ <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != '' and map.tWareHouseFees.fBilltype == 'XXFP'">
|
|
|
+ ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmtdr,
|
|
|
+ ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmt,
|
|
|
+ </if>
|
|
|
+ <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != '' and map.tWareHouseFees.fBilltype == 'JXFP'">
|
|
|
+ ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmtdr,
|
|
|
+ ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmt,
|
|
|
+ </if>
|
|
|
+ dict.dict_label AS fFeeunitid,
|
|
|
+ w.f_qty AS fQty,
|
|
|
+ w.f_unitprice AS fUnitprice,
|
|
|
+ w.f_currency AS fCurreny,
|
|
|
+ w.f_taxrate AS fTaxrate,
|
|
|
+ w.remark AS remark,
|
|
|
+ w.create_time createTime,
|
|
|
+ CASE
|
|
|
+
|
|
|
+ WHEN t.f_billstatus = '1' THEN
|
|
|
+ '新建'
|
|
|
+ WHEN t.f_billstatus = '2' THEN
|
|
|
+ '暂存'
|
|
|
+ WHEN t.f_billstatus = '3' THEN
|
|
|
+ '驳回'
|
|
|
+ WHEN t.f_billstatus = '4' THEN
|
|
|
+ '提交'
|
|
|
+ WHEN t.f_billstatus = '5' THEN
|
|
|
+ '审批中'
|
|
|
+ WHEN t.f_billstatus = '6' THEN
|
|
|
+ '审批通过'
|
|
|
+ END AS fBillstatus
|
|
|
+ FROM
|
|
|
+ t_warehousebills t
|
|
|
+ LEFT JOIN t_corps c ON c.f_id = t.f_corpid
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ f.f_id AS f_id,
|
|
|
+ f.f_pid AS f_pid,
|
|
|
+ f.f_lineno AS f_lineno,
|
|
|
+ f.f_corpid,
|
|
|
+ f.f_feeid,
|
|
|
+ f.f_feeUnitid,
|
|
|
+ f.f_qty,
|
|
|
+ f.f_unitprice,
|
|
|
+ f.f_amount,
|
|
|
+ f.f_currency,
|
|
|
+ f.f_exrate,
|
|
|
+ f.f_taxrate,
|
|
|
+ f.f_dc,
|
|
|
+ f.f_billstatus,
|
|
|
+ f.f_statement_no,
|
|
|
+ f.f_accamount,
|
|
|
+ f.f_accamount_date,
|
|
|
+ f.f_stlamount_no,
|
|
|
+ f.f_stlamount,
|
|
|
+ f.f_stlamount_date,
|
|
|
+ f.f_invnos,
|
|
|
+ f.f_invamount,
|
|
|
+ f.f_askamount,
|
|
|
+ f.f_chargedate,
|
|
|
+ f.f_status,
|
|
|
+ f.remark,
|
|
|
+ f.f_mblno,
|
|
|
+ f.f_product_name,
|
|
|
+ f.src_bill_no,
|
|
|
+ f.f_billing_days,
|
|
|
+ f.f_inventory_days,
|
|
|
+ f.f_marks,
|
|
|
+ f.f_billing_deadline,
|
|
|
+ f.f_originalbilldate,
|
|
|
+ f.f_billtype,
|
|
|
+ f.f_business_type,
|
|
|
+ f.f_bsdate,
|
|
|
+ c.f_id AS fId,
|
|
|
+ c.f_name AS fName,
|
|
|
+ f.create_time
|
|
|
+ FROM
|
|
|
+ t_warehousebillsfees AS f
|
|
|
+ LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
|
|
|
+ ) w ON w.f_pid = t.f_id
|
|
|
+ LEFT JOIN t_fees f ON w.f_feeid = f.f_id
|
|
|
+ LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
|
|
|
+ AND dict.dict_type = 'data_unitfees'
|
|
|
+ AND dict.STATUS = '0'
|
|
|
+ LEFT JOIN t_project tp ON tp.f_id = t.f_goodsid
|
|
|
+ LEFT JOIN t_corps AS tc ON tc.f_id = t.f_sbu
|
|
|
+ <where>
|
|
|
+ <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
|
|
|
+ #{map.tWareHouseFees.fCorpid}
|
|
|
+ </if>
|
|
|
+ <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
|
|
|
+ #{map.tWareHouseFees.fToCorpid}
|
|
|
+ </if>
|
|
|
+ <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
|
|
|
+ <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
|
|
|
+ <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
|
|
|
+ concat('%', #{map.tWareHouseFees.fMblno}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
|
|
|
+ w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
|
|
|
+ and w.f_accamount_date IS NOT NULL
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
|
|
|
+ and w.f_accamount_date IS NULL
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
|
|
|
+ and w.f_dc = #{map.tWareHouseFees.fDc}
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
|
|
|
+ and w.f_dc = #{map.tWareHouseFees.fDc}
|
|
|
+ </if>
|
|
|
+ <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
|
|
|
+ and w.f_feeid in
|
|
|
+ <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
|
|
|
+ separator=",">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
|
|
|
+ and t.f_review_date >= #{map.tWareHouseFees.timeExamine[0]}
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
|
|
|
+ and t.f_review_date <= #{map.tWareHouseFees.timeExamine[1]}
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[0] != null and map.tWareHouseFees.createTimeList[0]!= ""'>
|
|
|
+ and w.create_time >= #{map.tWareHouseFees.createTimeList[0]}
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[1] != null and map.tWareHouseFees.createTimeList[1]!= ""'>
|
|
|
+ and w.create_time <= #{map.tWareHouseFees.createTimeList[1]}
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
|
|
|
+ and t.f_bsdate >= #{map.tWareHouseFees.timeInterval[0]}
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
|
|
|
+ and t.f_bsdate <= #{map.tWareHouseFees.timeInterval[1]}
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
|
|
|
+ and w.f_accamount_date >= #{map.tWareHouseFees.timeReconci[0]}
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
|
|
|
+ and w.f_accamount_date <= #{map.tWareHouseFees.timeReconci[1]}
|
|
|
+ </if>
|
|
|
+ <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
|
|
|
+ and w.f_business_type in
|
|
|
+ <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
|
|
|
+ and w.f_id in
|
|
|
+ <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
|
|
|
+ separator=",">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
|
|
|
+ and t.f_id in
|
|
|
+ <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
|
|
|
+ separator=",">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="map.tWareHouseFees.fName != null and map.tWareHouseFees.fName != ''">and c.f_name = like
|
|
|
+ concat('%', #{map.tWareHouseFees.fName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
|
|
|
+ </if>
|
|
|
+ <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != '' and map.tWareHouseFees.fBilltype == 'XXFP'">
|
|
|
+ and ifnull(w.f_amount, 0) - ifnull(w.f_invamount, 0) > 0
|
|
|
+ and t.f_billtype = 'XS'
|
|
|
+ </if>
|
|
|
+ <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != '' and map.tWareHouseFees.fBilltype == 'JXFP'">
|
|
|
+ and ifnull(w.f_amount, 0) - ifnull(w.f_invamount, 0) > 0
|
|
|
+ and t.f_billtype = 'SQ'
|
|
|
+ </if>
|
|
|
+ <if test="map.tWareHouseFees.fBillstatus != null and map.tWareHouseFees.fBillstatus != '' and map.tWareHouseFees.fBillstatus == 6 ">
|
|
|
+ and t.f_review_date IS NOT NULL
|
|
|
+ </if>
|
|
|
+ GROUP BY w.f_id
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+ <select id="anPinSelectTFeeList" parameterType="TFee" resultType="Map">
|
|
|
+ SELECT
|
|
|
+ f.f_id AS fId,
|
|
|
+ f.f_billno AS fBillno,
|
|
|
+ f.f_ctrlcorpid AS fCtrlcorpid,
|
|
|
+ pro.dict_label AS chargingMethod,
|
|
|
+ f.invoice_no AS invoiceNo,
|
|
|
+ f.bank AS fBank,
|
|
|
+ f.water_bill_no AS waterBillNo,
|
|
|
+ f.f_corpid AS fCorpid,
|
|
|
+ c.f_name AS fCorpidName,
|
|
|
+ f.f_accbilldate AS fAccbilldate,
|
|
|
+ f.t_mblno AS tMblno,
|
|
|
+ f.f_amtdr AS fAmtdr,
|
|
|
+ f.f_amtcr AS fAmtcr,
|
|
|
+ f.f_billtype AS fBilltype,
|
|
|
+ f.f_system_type AS fSystemType,
|
|
|
+ CASE
|
|
|
+ WHEN f.f_billstatus = '1' THEN '保存'
|
|
|
+ WHEN f.f_billstatus = '2' THEN '暂存'
|
|
|
+ WHEN f.f_billstatus = '3' THEN '审批驳回'
|
|
|
+ WHEN f.f_billstatus = '4' THEN '提交审核'
|
|
|
+ WHEN f.f_billstatus = '5' THEN '审核中'
|
|
|
+ WHEN f.f_billstatus = '6' THEN '审核完成'
|
|
|
+ END
|
|
|
+ AS fBillstatus,
|
|
|
+ f.f_remarks AS fRemarks,
|
|
|
+ f.create_by AS createBy,
|
|
|
+ tp.f_name AS createName,
|
|
|
+ f.create_time AS createTime,
|
|
|
+ f.update_by AS updateBy,
|
|
|
+ f.update_time AS updateTime,
|
|
|
+ tj.f_name AS projectName
|
|
|
+ FROM
|
|
|
+ t_fee AS f
|
|
|
+ LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
|
|
|
+ left join sys_user u on f.create_by = u.user_name
|
|
|
+ left join sys_dept d on f.f_deptid = d.dept_id
|
|
|
+ LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
|
|
|
+ LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
|
|
|
+ LEFT JOIN sys_dict_data pro ON pro.dict_value = f.charging_method and pro.dict_type = 'data_settlement_type'
|
|
|
+ LEFT JOIN t_project tj ON f.f_act_id = tj.f_id
|
|
|
+ <where>
|
|
|
+ <if test="fId != null ">and f.f_id = #{fId}</if>
|
|
|
+ <if test="projectId != null ">and tj.f_id = #{projectId}</if>
|
|
|
+ <if test="fBillno != null and fBillno != ''">and f.f_billno = #{fBillno}</if>
|
|
|
+ <if test="fCtrlcorpid != null ">and f.f_ctrlcorpid = #{fCtrlcorpid}</if>
|
|
|
+ <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
|
|
|
+ <if test="tMblno != null and tMblno != ''">and f.t_mblno = #{tMblno}</if>
|
|
|
+ <if test="fAmtdr != null ">and f.f_amtdr = #{fAmtdr}</if>
|
|
|
+ <if test="fAmtcr != null ">and f.f_amtcr = #{fAmtcr}</if>
|
|
|
+ <if test="fBilltype != null and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
|
|
|
+ <if test="fBillstatus != null and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
|
|
|
+ <if test="fRemarks != null and fRemarks != ''">and f.f_remarks like concat('%', #{fRemarks}, '%') </if>
|
|
|
+ <if test="fAccbilldate != null ">and f.f_accbilldate = #{fAccbilldate}</if>
|
|
|
+ <if test="fDeptid != null ">and f.f_deptid = #{fDeptid}</if>
|
|
|
+ <if test='fBsDateTime != null and fBsDateTime[0] != null and fBsDateTime[0]!= ""'>
|
|
|
+ and tw.f_bsdate >= #{fBsDateTime[0]}
|
|
|
+ </if>
|
|
|
+ <if test='fBsDateTime != null and fBsDateTime[1] != null and fBsDateTime[1]!= ""'>
|
|
|
+ and tw.f_bsdate <= #{fBsDateTime[1]}
|
|
|
+ </if>
|
|
|
+ <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
|
|
|
+ and f.f_accbilldate >= #{timeInterval[0]}
|
|
|
+ </if>
|
|
|
+ <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
|
|
|
+ and f.f_accbilldate <= #{timeInterval[1]}
|
|
|
+ </if>
|
|
|
+ <if test='money != null and money[0] != null and money[0]!= ""'>
|
|
|
+ and f.f_amtdr >= #{money[0]}
|
|
|
+ </if>
|
|
|
+ <if test='money != null and money[1] != null and money[1]!= ""'>
|
|
|
+ and f.f_amtdr <= #{money[1]}
|
|
|
+ </if>
|
|
|
+ <if test='amount != null and amount[0] != null and amount[0]!= ""'>
|
|
|
+ and f.f_amtdr >= #{amount[0]}
|
|
|
+ </if>
|
|
|
+ <if test='amount != null and amount[1] != null and amount[1]!= ""'>
|
|
|
+ and f.f_amtdr <= #{amount[1]}
|
|
|
+ </if>
|
|
|
+ <if test='applyTime != null and applyTime[0] != null and applyTime[0]!= ""'>
|
|
|
+ and f.create_time >= #{applyTime[0]}
|
|
|
+ </if>
|
|
|
+ <if test='applyTime != null and applyTime[1] != null and applyTime[1]!= ""'>
|
|
|
+ and f.create_time <= #{applyTime[1]}
|
|
|
+ </if>
|
|
|
+ <if test="chargingMethod != null ">and f.charging_method = #{chargingMethod}</if>
|
|
|
+ <if test="invoiceNo != null ">and f.invoice_no = #{invoiceNo}</if>
|
|
|
+ <if test="bank != null ">and f.bank = #{bank}</if>
|
|
|
+ <if test="waterBillNo != null ">and f.water_bill_no = #{waterBillNo}</if>
|
|
|
+ <if test="fSystemType != null and fSystemType != ''">and f.f_system_type = #{fSystemType}</if>
|
|
|
+ <if test="createBy != null and createBy != ''">and f.create_by = #{createBy}</if>
|
|
|
+ </where>
|
|
|
+ ORDER BY f.f_id desc
|
|
|
+ </select>
|
|
|
+ <select id="anPinSelectTFeeById" parameterType="Long" resultMap="TFeeResult">
|
|
|
+ SELECT f.f_id,
|
|
|
+ f.f_billno,
|
|
|
+ f.f_ctrlcorpid,
|
|
|
+ f.f_corpid,
|
|
|
+ c.f_name AS fCorpidName,
|
|
|
+ f.f_accbilldate,
|
|
|
+ f.t_mblno,
|
|
|
+ f.f_amtdr,
|
|
|
+ f.f_amtcr,
|
|
|
+ f.f_billtype,
|
|
|
+ f.f_system_type,
|
|
|
+ f.f_billstatus,
|
|
|
+ f.f_remarks,
|
|
|
+ f.create_by,
|
|
|
+ tp.f_name AS createName,
|
|
|
+ f.create_time,
|
|
|
+ f.update_by,
|
|
|
+ f.update_time,
|
|
|
+ tn.f_taxrate AS fTaxrate,
|
|
|
+ f.charging_method,
|
|
|
+ f.invoice_no,
|
|
|
+ f.bank,
|
|
|
+ f.water_bill_no,
|
|
|
+ tj.f_name AS projectName
|
|
|
+ FROM t_fee AS f
|
|
|
+ LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
|
|
|
+ left join sys_user u on f.create_by = u.user_name
|
|
|
+ left join sys_dept d on f.f_deptid = d.dept_id
|
|
|
+ LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
|
|
|
+ LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
|
|
|
+ LEFT JOIN(SELECT ti.f_pid, ti.f_taxrate FROM t_fee_invoice ti LIMIT 1) tn ON tn.f_pid = f.f_id
|
|
|
+ LEFT JOIN t_project tj ON f.f_act_id = tj.f_id
|
|
|
+ where f.f_id = #{fId}
|
|
|
+ </select>
|
|
|
</mapper>
|