|
@@ -49,6 +49,62 @@
|
|
|
<result property="invoiceRemarks" column="invoice_remarks"/>
|
|
|
</resultMap>
|
|
|
|
|
|
+ <resultMap type="FeeVO" id="feeVOResult">
|
|
|
+ <result property="fId" column="f_id"/>
|
|
|
+ <result property="fBillno" column="f_billno"/>
|
|
|
+ <result property="fCtrlcorpid" column="f_ctrlcorpid"/>
|
|
|
+ <result property="fActId" column="f_act_id"/>
|
|
|
+ <result property="fCorpid" column="f_corpid"/>
|
|
|
+ <result property="tMblno" column="t_mblno"/>
|
|
|
+ <result property="fTransActId" column="f_trans_act_id"/>
|
|
|
+ <result property="fAmtdr" column="f_amtdr"/>
|
|
|
+ <result property="fAmtcr" column="f_amtcr"/>
|
|
|
+ <result property="fBilltype" column="f_billtype"/>
|
|
|
+ <result property="fBillstatus" column="f_billstatus"/>
|
|
|
+ <result property="fRemarks" column="f_remarks"/>
|
|
|
+ <result property="fFromDate" column="f_from_date"/>
|
|
|
+ <result property="fToDate" column="f_to_date"/>
|
|
|
+ <result property="fAccbilldate" column="f_accbilldate"/>
|
|
|
+ <result property="fRefNo" column="f_ref_no"/>
|
|
|
+ <result property="delFlag" column="del_flag"/>
|
|
|
+ <result property="createBy" column="create_by"/>
|
|
|
+ <result property="fDeptid" column="f_deptid"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateBy" column="update_by"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ <result property="chargingMethod" column="charging_method"/>
|
|
|
+ <result property="invoiceNo" column="invoice_no"/>
|
|
|
+ <result property="bank" column="bank"/>
|
|
|
+ <result property="waterBillNo" column="water_bill_no"/>
|
|
|
+ <result property="fSystemType" column="f_system_type"/>
|
|
|
+ <result property="fTrackingNumber" column="f_tracking_number"/>
|
|
|
+ <result property="fInvoiceRise" column="f_invoice_rise"/>
|
|
|
+ <result property="fSign" column="f_sign"/>
|
|
|
+ <result property="fSendTime" column="f_send_Time"/>
|
|
|
+ <result property="fApplyMoney" column="f_apply_money"/>
|
|
|
+ <result property="fAccountId" column="f_account_id"/>
|
|
|
+ <result property="fMake" column="f_make"/>
|
|
|
+ <result property="fVslid" column="f_vslid"/>
|
|
|
+ <result property="fVoyid" column="f_voyid"/>
|
|
|
+ <result property="fLoadportid" column="f_loadportid"/>
|
|
|
+ <result property="fDestportid" column="f_destportid"/>
|
|
|
+ <result property="fDc" column="f_dc"/>
|
|
|
+ <result property="fBankNumber" column="f_bank_number"/>
|
|
|
+ <result property="fReconciliation" column="f_reconciliation"/>
|
|
|
+ <result property="invoiceRemarks" column="invoice_remarks"/>
|
|
|
+ <result property="invoiceRemarks" column="invoice_remarks"/>
|
|
|
+ <result property="fFeesName" column="f_fees_name"/>
|
|
|
+ <result property="fAmount" column="f_amount"/>
|
|
|
+ <result property="fStlamount" column="f_stlamount"/>
|
|
|
+ <result property="storageFee" column="storage_fee"/>
|
|
|
+ <result property="otherFee" column="other_fee"/>
|
|
|
+ <result property="fSrcpid" column="f_srcpid"/>
|
|
|
+ <result property="fMblno" column="f_mblno"/>
|
|
|
+ <result property="fMarks" column="f_marks"/>
|
|
|
+ <result property="fProductName" column="f_product_name"/>
|
|
|
+ <result property="fReviewDate" column="f_review_date"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
<sql id="selectTFeeVo">
|
|
|
select f_id,
|
|
|
f_billno,
|
|
@@ -1856,33 +1912,33 @@
|
|
|
</select>
|
|
|
<select id="selectFeeList" resultType="java.util.Map">
|
|
|
select
|
|
|
- ware.create_by AS createBy,
|
|
|
- ware.f_billno AS fBillno,
|
|
|
- ware.f_ctrlcorpid AS fCtrlcorpid,
|
|
|
- ware.create_time AS createTime,
|
|
|
- ware.f_accbilldate AS fAccbilldate,
|
|
|
- ware.t_mblno AS tMblno,
|
|
|
- dict.dict_label AS chargingMethod,
|
|
|
- ware.invoice_no AS invoiceNo,
|
|
|
- ware.bank AS bank,
|
|
|
- ware.water_bill_no AS waterBillNo,
|
|
|
- ware.f_amtdr AS fAmtdr,
|
|
|
- ware.f_amtcr AS fAmtcr,
|
|
|
- ware.f_remarks AS fRemarks,
|
|
|
- CASE
|
|
|
- WHEN ware.f_billstatus = '1' THEN '新建'
|
|
|
- WHEN ware.f_billstatus = '2' THEN '暂存'
|
|
|
- WHEN ware.f_billstatus = '3' THEN '审批驳回'
|
|
|
- WHEN ware.f_billstatus = '4' THEN '提交审核'
|
|
|
- WHEN ware.f_billstatus = '5' THEN '审核中'
|
|
|
- WHEN ware.f_billstatus = '6' THEN '审核完成'
|
|
|
- END
|
|
|
- AS fBillstatus
|
|
|
+ ware.create_by AS createBy,
|
|
|
+ ware.f_billno AS fBillno,
|
|
|
+ ware.f_ctrlcorpid AS fCtrlcorpid,
|
|
|
+ ware.create_time AS createTime,
|
|
|
+ ware.f_accbilldate AS fAccbilldate,
|
|
|
+ ware.t_mblno AS tMblno,
|
|
|
+ dict.dict_label AS chargingMethod,
|
|
|
+ ware.invoice_no AS invoiceNo,
|
|
|
+ ware.bank AS bank,
|
|
|
+ ware.water_bill_no AS waterBillNo,
|
|
|
+ ware.f_amtdr AS fAmtdr,
|
|
|
+ ware.f_amtcr AS fAmtcr,
|
|
|
+ ware.f_remarks AS fRemarks,
|
|
|
+ CASE
|
|
|
+ WHEN ware.f_billstatus = '1' THEN '新建'
|
|
|
+ WHEN ware.f_billstatus = '2' THEN '暂存'
|
|
|
+ WHEN ware.f_billstatus = '3' THEN '审批驳回'
|
|
|
+ WHEN ware.f_billstatus = '4' THEN '提交审核'
|
|
|
+ WHEN ware.f_billstatus = '5' THEN '审核中'
|
|
|
+ WHEN ware.f_billstatus = '6' THEN '审核完成'
|
|
|
+ END
|
|
|
+ AS fBillstatus
|
|
|
from
|
|
|
- t_fee ware
|
|
|
- left join sys_user u on ware.create_by = u.user_name
|
|
|
- left join sys_dept d on ware.f_deptid = d.dept_id
|
|
|
- LEFT JOIN sys_dict_data dict ON dict.dict_value = ware.charging_method
|
|
|
+ t_fee ware
|
|
|
+ left join sys_user u on ware.create_by = u.user_name
|
|
|
+ left join sys_dept d on ware.f_deptid = d.dept_id
|
|
|
+ LEFT JOIN sys_dict_data dict ON dict.dict_value = ware.charging_method
|
|
|
<where>
|
|
|
dict.status = '0'
|
|
|
AND dict.dict_type = 'data_settlement_type'
|
|
@@ -2330,4 +2386,225 @@
|
|
|
(SELECT @rank:= 0) b
|
|
|
</select>
|
|
|
|
|
|
+ <select id="queryApplyInvoiceFeesList" resultType="java.util.Map">
|
|
|
+ SELECT
|
|
|
+ w.f_id AS fSrcid,
|
|
|
+ t.f_id AS fSrcpid,
|
|
|
+ t.f_corpid AS fCorpid,
|
|
|
+ c.f_name AS fName,
|
|
|
+ c.f_name AS fFeesName,
|
|
|
+ t.f_bscorpno AS fBscorpno,
|
|
|
+ w.f_mblno AS fMblno,
|
|
|
+ w.f_product_name AS fProductName,
|
|
|
+ w.f_bsdate AS fBsdate,
|
|
|
+ t.f_billtype AS fBilltype,
|
|
|
+ t.f_review_date AS fReviewDate,
|
|
|
+ w.f_marks AS fMarks,
|
|
|
+ w.f_feeid AS fFeeid,
|
|
|
+ w.f_billtype AS fBilltype,
|
|
|
+ w.f_chargedate AS fChargedate,
|
|
|
+ w.f_originalbilldate AS fOriginalbilldate,
|
|
|
+ w.f_billing_deadline AS fBillingDeadline,
|
|
|
+ w.f_billing_days AS fBillingDays,
|
|
|
+ w.f_inventory_days AS fInventoryDays,
|
|
|
+ f.f_name AS fFeeName,
|
|
|
+ w.f_dc AS fSrcdc,
|
|
|
+ CASE
|
|
|
+ WHEN w.f_dc = 'D' THEN
|
|
|
+ '收'
|
|
|
+ WHEN w.f_dc = 'C' THEN
|
|
|
+ '付'
|
|
|
+ END AS fSrcdcName,
|
|
|
+ ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
|
|
|
+ ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
|
|
|
+ dict.dict_label AS fFeeunitid,
|
|
|
+ w.f_qty AS fQty,
|
|
|
+ w.f_unitprice AS fUnitprice,
|
|
|
+ w.f_business_type AS fBusinessType
|
|
|
+ FROM
|
|
|
+ t_warehousebillsfees w
|
|
|
+ LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
|
|
|
+ LEFT JOIN t_corps c ON c.f_id = w.f_corpid
|
|
|
+ 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
|
|
|
+ <where>
|
|
|
+ dict.status = '0'
|
|
|
+ AND dict.dict_type = 'data_unitfees'
|
|
|
+ <if test="map.tWareHouseFees.stlTypeid != null">and w.f_stltypeid = #{map.tWareHouseFees.stlTypeid}</if>
|
|
|
+ <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and w.f_corpid =
|
|
|
+ #{map.tWareHouseFees.fCorpid}
|
|
|
+ </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.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
|
|
|
+ #{map.tWareHouseFees.fToCorpid}
|
|
|
+ </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 w.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 w.f_review_date <= #{map.tWareHouseFees.timeExamine[1]}
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
|
|
|
+ and w.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 w.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.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
|
|
|
+ and w.f_billtype = #{map.tWareHouseFees.fBilltype}
|
|
|
+ </if>
|
|
|
+ <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
|
|
|
+ and w.f_billtype = #{map.tWareHouseFees.fBilltype}
|
|
|
+ </if>
|
|
|
+ <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
|
|
|
+ and w.f_billtype = #{map.tWareHouseFees.fBilltype}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'KHDD'">
|
|
|
+ and w.f_billtype = #{map.tWareHouseFees.fBilltype}
|
|
|
+ </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.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
|
|
|
+ </if>
|
|
|
+ <if test='map.tWareHouseFees.createBy != null and map.tWareHouseFees.createBy != ""'>
|
|
|
+ and w.create_by = #{map.tWareHouseFees.createBy}
|
|
|
+ </if>
|
|
|
+ and w.f_review_date IS NOT NULL
|
|
|
+ and abs(IFNULL(w.f_amount, 0) - IFNULL(w.f_invamount, 0)) > 0
|
|
|
+ GROUP BY w.f_id
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectFinancialLedgerList" resultMap="feeVOResult">
|
|
|
+ SELECT
|
|
|
+ c.f_name AS f_fees_name, w.f_corpid, w.f_mblno, w.f_billstatus,
|
|
|
+ SUM( w.f_amount ) AS f_amount, SUM( w.f_stlamount ) AS f_stlamount,
|
|
|
+ ifnull( SUM( w.f_amount ), 0 ) - ifnull( SUM( w.f_stlamount ), 0 ) AS nnfinished
|
|
|
+ FROM
|
|
|
+ t_warehousebills t
|
|
|
+ LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
|
|
|
+ LEFT JOIN sys_user u ON t.create_by = u.user_name
|
|
|
+ LEFT JOIN sys_dept d ON t.f_bsdeptid = d.dept_id
|
|
|
+ LEFT JOIN t_corps c ON c.f_id = w.f_corpid
|
|
|
+ LEFT JOIN t_fees f ON w.f_feeid = f.f_id
|
|
|
+ <where>
|
|
|
+ <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid}</if>
|
|
|
+ <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid}</if>
|
|
|
+ <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
|
|
|
+ <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%')</if>
|
|
|
+ <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%',
|
|
|
+ #{fProductName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>
|
|
|
+ and w.f_billstatus != 6
|
|
|
+ </if>
|
|
|
+ <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
|
|
|
+ and w.f_billstatus = 6
|
|
|
+ </if>
|
|
|
+ <if test='fDc != null and fDc != "" and fDc == "D" '>
|
|
|
+ and w.f_dc = #{fDc}
|
|
|
+ </if>
|
|
|
+ <if test='fDc != null and fDc != "" and fDc == "C" '>
|
|
|
+ and w.f_dc = #{fDc}
|
|
|
+ </if>
|
|
|
+ <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
|
|
|
+ and t.f_review_date >= #{timeExamine[0]}
|
|
|
+ </if>
|
|
|
+ <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
|
|
|
+ and t.f_review_date <= #{timeExamine[1]}
|
|
|
+ </if>
|
|
|
+ <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
|
|
|
+ and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
|
|
|
+ </if>
|
|
|
+ and w.f_review_date IS NOT NULL
|
|
|
+ ${params.dataScope}
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ w.f_corpid,
|
|
|
+ w.f_dc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectFinancialLedgerDetails" resultMap="feeVOResult">
|
|
|
+ SELECT t.f_id AS f_srcpid, c.f_name AS f_fees_name, w.f_mblno AS f_mblno,
|
|
|
+ w.f_product_name, w.f_marks, t.f_billtype,
|
|
|
+ t.f_review_date,
|
|
|
+ IF ( w.f_feeid = #{feesId}, w.f_amount, 0.00 ) storage_fee,
|
|
|
+ IF ( w.f_feeid != #{feesId}, w.f_amount, 0.00 ) other_fee,
|
|
|
+ w.f_amount, w.f_stlamount AS fStlamount,
|
|
|
+ ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS nnfinished
|
|
|
+ FROM t_warehousebills t
|
|
|
+ LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
|
|
|
+ LEFT JOIN sys_user u ON t.create_by = u.user_name
|
|
|
+ LEFT JOIN sys_dept d ON t.f_bsdeptid = d.dept_id
|
|
|
+ LEFT JOIN t_corps c ON c.f_id = w.f_corpid
|
|
|
+ LEFT JOIN t_fees f ON w.f_feeid = f.f_id
|
|
|
+ where
|
|
|
+ w.f_dc = #{fDc}
|
|
|
+ <if test="fCorpId != null and fCorpId != ''">and t.f_corpid = #{fCorpId}</if>
|
|
|
+ <if test='fAuditList != null and fAuditList[0] != null'>
|
|
|
+ and t.f_review_date BETWEEN #{fAuditList[0]} and #{fAuditList[1]}
|
|
|
+ </if>
|
|
|
+ <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>
|
|
|
+ and w.f_billstatus != 6
|
|
|
+ </if>
|
|
|
+ <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
|
|
|
+ and w.f_billstatus = 6
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ w.f_id
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|