|
@@ -2393,6 +2393,153 @@
|
|
|
)tp,
|
|
|
(SELECT @rank:= 0) b
|
|
|
</select>
|
|
|
+ <select id="receivable" resultType="com.ruoyi.finance.shipping.ReceivableExcel">
|
|
|
+ SELECT
|
|
|
+ DISTINCT
|
|
|
+ tv.f_name AS shipsName,#船名
|
|
|
+ ty.f_no AS voyage,# 航次
|
|
|
+ tc.f_name AS unitOfAccount,#结算单位
|
|
|
+ tw.f_mblno AS blNo,#提单号
|
|
|
+ ta.f_name AS portOfLoading,#起运港
|
|
|
+ td.f_name AS destination,#目的港
|
|
|
+ tw.f_bsdate sailingDate,#开船日期
|
|
|
+ tf.f_review_date AS auditDate,#审核日期
|
|
|
+ ROUND(IFNULL(SUM(f_amount),0),2) AS receivable, #应收金额
|
|
|
+ ROUND(IFNULL(SUM(f_stlamount),0),2) AS handle,#实收金额
|
|
|
+ ROUND((IFNULL(SUM(f_amount),0)-IFNULL(SUM(f_stlamount),0)),2) AS profit #未收金额
|
|
|
+ FROM
|
|
|
+ t_warehousebillsfees tf
|
|
|
+ LEFT JOIN t_warehousebills tw ON tf.f_pid = tw.f_id
|
|
|
+ LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
|
|
|
+ LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
|
|
|
+ LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
|
|
|
+ LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
|
|
|
+ LEFT JOIN t_address td ON td.f_id = tw.f_destportid
|
|
|
+ <where>
|
|
|
+ tf.f_dc = #{fDc}
|
|
|
+ <if test="fMblno != null and fMblno != ''">and tw.f_mblno like concat('%', #{fMblno}, '%')</if>
|
|
|
+ <if test="fVslid != null">and tw.f_vslid = #{fVslid}</if>
|
|
|
+ <if test="fCorpid != null">and tf.f_corpid = #{fCorpid}</if>
|
|
|
+ <if test="fVoyid != null">and tw.f_voyid = #{fVoyid}</if>
|
|
|
+ <if test="fLoadportid != null">and tw.f_loadportid = #{fLoadportid}</if>
|
|
|
+ <if test="fDestportid != null">and tw.f_destportid = #{fDestportid}</if>
|
|
|
+ <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
|
|
|
+ and tf.f_billstatus != 6
|
|
|
+ </if>
|
|
|
+ <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "2" '>
|
|
|
+ and tf.f_billstatus = 6
|
|
|
+ </if>
|
|
|
+ <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
|
|
|
+ and tf.f_review_date >= #{timeExamine[0]}
|
|
|
+ </if>
|
|
|
+ <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
|
|
|
+ and tf.f_review_date <= #{timeExamine[1]}
|
|
|
+ </if>
|
|
|
+ <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
|
|
|
+ and tw.f_bsdate >= #{timeInterval[0]}
|
|
|
+ </if>
|
|
|
+ <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
|
|
|
+ and tw.f_bsdate <= #{timeInterval[1]}
|
|
|
+ </if>
|
|
|
+ GROUP BY tw.f_mblno,tf.f_corpid
|
|
|
+ ORDER BY tw.f_bsdate DESC
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+ <select id="profit" resultType="com.ruoyi.finance.shipping.ProfitExcel">
|
|
|
+ SELECT
|
|
|
+ DISTINCT
|
|
|
+ tv.f_name AS shipsName,
|
|
|
+ ty.f_no AS voyage,
|
|
|
+ ROUND(sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ),2) AS receivable,
|
|
|
+ ROUND(sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ),2) AS handle,
|
|
|
+ ROUND((sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) - sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END )),2) AS profit,
|
|
|
+ ROUND(sum( CASE f_dc WHEN 'D' THEN f_stlamount ELSE 0 END ),2) AS actualReceivable,
|
|
|
+ ROUND(sum( CASE f_dc WHEN 'C' THEN f_stlamount ELSE 0 END ),2) AS actualHandle
|
|
|
+ FROM
|
|
|
+ t_warehousebillsfees tf
|
|
|
+ LEFT JOIN t_warehousebills tw ON tf.f_pid = tw.f_id
|
|
|
+ LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
|
|
|
+ LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
|
|
|
+ <where>
|
|
|
+ 1=1
|
|
|
+ <if test="fVslid != null">and tw.f_vslid = #{fVslid}</if>
|
|
|
+ <if test="fVoyid != null">and tw.f_voyid = #{fVoyid}</if>
|
|
|
+ <if test="fLoadportid != null">and tw.f_loadportid = #{fLoadportid}</if>
|
|
|
+ <if test="fDestportid != null">and tw.f_destportid = #{fDestportid}</if>
|
|
|
+ <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
|
|
|
+ and tf.f_billstatus != 6
|
|
|
+ </if>
|
|
|
+ <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "2" '>
|
|
|
+ and tf.f_billstatus = 6
|
|
|
+ </if>
|
|
|
+ <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
|
|
|
+ and tf.f_review_date >= #{timeExamine[0]}
|
|
|
+ </if>
|
|
|
+ <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
|
|
|
+ and tf.f_review_date <= #{timeExamine[1]}
|
|
|
+ </if>
|
|
|
+ <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
|
|
|
+ and tw.f_bsdate >= #{timeInterval[0]}
|
|
|
+ </if>
|
|
|
+ <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
|
|
|
+ and tw.f_bsdate <= #{timeInterval[1]}
|
|
|
+ </if>
|
|
|
+ GROUP BY tw.f_vslid,tw.f_voyid
|
|
|
+ ORDER BY tw.f_bsdate DESC
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+ <select id="handle" resultType="com.ruoyi.finance.shipping.HandleExcel">
|
|
|
+ SELECT
|
|
|
+ DISTINCT
|
|
|
+ tv.f_name AS shipsName,#船名
|
|
|
+ ty.f_no AS voyage,# 航次
|
|
|
+ tc.f_name AS unitOfAccount,#结算单位
|
|
|
+ tw.f_mblno AS blNo,#提单号
|
|
|
+ ta.f_name AS portOfLoading,#起运港
|
|
|
+ td.f_name AS destination,#目的港
|
|
|
+ tw.f_bsdate sailingDate,#开船日期
|
|
|
+ tf.f_review_date AS auditDate,#审核日期
|
|
|
+ ROUND(IFNULL(SUM(f_amount),0),2) AS receivable, #应收金额
|
|
|
+ ROUND(IFNULL(SUM(f_stlamount),0),2) AS handle,#实收金额
|
|
|
+ ROUND((IFNULL(SUM(f_amount),0)-IFNULL(SUM(f_stlamount),0)),2) AS profit #未收金额
|
|
|
+ FROM
|
|
|
+ t_warehousebillsfees tf
|
|
|
+ LEFT JOIN t_warehousebills tw ON tf.f_pid = tw.f_id
|
|
|
+ LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
|
|
|
+ LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
|
|
|
+ LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
|
|
|
+ LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
|
|
|
+ LEFT JOIN t_address td ON td.f_id = tw.f_destportid
|
|
|
+ <where>
|
|
|
+ tf.f_dc = #{fDc}
|
|
|
+ <if test="fMblno != null and fMblno != ''">and tw.f_mblno like concat('%', #{fMblno}, '%')</if>
|
|
|
+ <if test="fVslid != null">and tw.f_vslid = #{fVslid}</if>
|
|
|
+ <if test="fCorpid != null">and tf.f_corpid = #{fCorpid}</if>
|
|
|
+ <if test="fVoyid != null">and tw.f_voyid = #{fVoyid}</if>
|
|
|
+ <if test="fLoadportid != null">and tw.f_loadportid = #{fLoadportid}</if>
|
|
|
+ <if test="fDestportid != null">and tw.f_destportid = #{fDestportid}</if>
|
|
|
+ <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
|
|
|
+ and tf.f_billstatus != 6
|
|
|
+ </if>
|
|
|
+ <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "2" '>
|
|
|
+ and tf.f_billstatus = 6
|
|
|
+ </if>
|
|
|
+ <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
|
|
|
+ and tf.f_review_date >= #{timeExamine[0]}
|
|
|
+ </if>
|
|
|
+ <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
|
|
|
+ and tf.f_review_date <= #{timeExamine[1]}
|
|
|
+ </if>
|
|
|
+ <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
|
|
|
+ and tw.f_bsdate >= #{timeInterval[0]}
|
|
|
+ </if>
|
|
|
+ <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
|
|
|
+ and tw.f_bsdate <= #{timeInterval[1]}
|
|
|
+ </if>
|
|
|
+ GROUP BY tw.f_mblno,tf.f_corpid
|
|
|
+ ORDER BY tw.f_bsdate DESC
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
|
|
|
<select id="queryApplyInvoiceFeesList" resultType="java.util.Map">
|
|
|
SELECT
|