|  | @@ -27,10 +27,15 @@
 | 
	
		
			
				|  |  |          <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"/>
 | 
	
		
			
				|  |  |      </resultMap>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <sql id="selectTFeeVo">
 | 
	
		
			
				|  |  | -        select f_id, f_billno, f_ctrlcorpid, f_act_id, f_corpid, f_trans_act_id, t_mblno, f_amtdr, f_amtcr, f_billtype, f_billstatus, f_remarks, f_from_date, f_accbilldate, f_to_date, f_ref_no, del_flag, create_by, f_deptid, create_time, update_by, update_time from t_fee
 | 
	
		
			
				|  |  | +        select f_id, f_billno, f_ctrlcorpid, f_act_id, f_corpid, f_trans_act_id, t_mblno, f_amtdr, f_amtcr, f_billtype, f_billstatus, f_remarks, f_from_date, f_accbilldate, f_to_date, f_ref_no, del_flag, create_by, f_deptid, create_time, update_by,
 | 
	
		
			
				|  |  | +               update_time,charging_method ,invoice_no ,  bank , water_bill_no   from t_fee
 | 
	
		
			
				|  |  |       </sql>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="selectTFeeList" parameterType="TFee" resultMap="TFeeResult">
 | 
	
	
		
			
				|  | @@ -58,6 +63,10 @@
 | 
	
		
			
				|  |  |              <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
 | 
	
		
			
				|  |  |                  and f_accbilldate <= #{timeInterval[1]}
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  | +            <if test="chargingMethod != null ">and charging_method = #{chargingMethod}</if>
 | 
	
		
			
				|  |  | +            <if test="invoiceNo != null ">and invoice_no = #{invoiceNo}</if>
 | 
	
		
			
				|  |  | +            <if test="bank != null ">and bank = #{bank}</if>
 | 
	
		
			
				|  |  | +            <if test="waterBillNo != null ">and water_bill_no = #{waterBillNo}</if>
 | 
	
		
			
				|  |  |          </where>
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -97,6 +106,10 @@
 | 
	
		
			
				|  |  |              <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
 | 
	
		
			
				|  |  |                  and f.f_accbilldate <= #{timeInterval[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>
 | 
	
		
			
				|  |  |          </where>
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -130,6 +143,10 @@
 | 
	
		
			
				|  |  |              <if test="createTime != null">create_time,</if>
 | 
	
		
			
				|  |  |              <if test="updateBy != null">update_by,</if>
 | 
	
		
			
				|  |  |              <if test="updateTime != null">update_time,</if>
 | 
	
		
			
				|  |  | +            <if test="chargingMethod != null">charging_method,</if>
 | 
	
		
			
				|  |  | +            <if test="invoiceNo != null">invoice_no,</if>
 | 
	
		
			
				|  |  | +            <if test="bank != null">bank,</if>
 | 
	
		
			
				|  |  | +            <if test="waterBillNo != null">water_bill_no,</if>
 | 
	
		
			
				|  |  |          </trim>
 | 
	
		
			
				|  |  |          <trim prefix="values (" suffix=")" suffixOverrides=",">
 | 
	
		
			
				|  |  |              <if test="fId != null">#{fId},</if>
 | 
	
	
		
			
				|  | @@ -154,6 +171,10 @@
 | 
	
		
			
				|  |  |              <if test="createTime != null">#{createTime},</if>
 | 
	
		
			
				|  |  |              <if test="updateBy != null">#{updateBy},</if>
 | 
	
		
			
				|  |  |              <if test="updateTime != null">#{updateTime},</if>
 | 
	
		
			
				|  |  | +            <if test="chargingMethod != null">#{chargingMethod},</if>
 | 
	
		
			
				|  |  | +            <if test="invoiceNo != null">#{invoiceNo},</if>
 | 
	
		
			
				|  |  | +            <if test="bank != null">#{bank},</if>
 | 
	
		
			
				|  |  | +            <if test="waterBillNo != null">#{waterBillNo},</if>
 | 
	
		
			
				|  |  |          </trim>
 | 
	
		
			
				|  |  |      </insert>
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -181,6 +202,10 @@
 | 
	
		
			
				|  |  |              <if test="createTime != null">create_time = #{createTime},</if>
 | 
	
		
			
				|  |  |              <if test="updateBy != null">update_by = #{updateBy},</if>
 | 
	
		
			
				|  |  |              <if test="updateTime != null">update_time = #{updateTime},</if>
 | 
	
		
			
				|  |  | +            <if test="chargingMethod != null">charging_method = #{chargingMethod},</if>
 | 
	
		
			
				|  |  | +            <if test="invoiceNo != null">invoice_no = #{invoiceNo},</if>
 | 
	
		
			
				|  |  | +            <if test="bank != null">bank = #{bank},</if>
 | 
	
		
			
				|  |  | +            <if test="waterBillNo != null">water_bill_no = #{waterBillNo},</if>
 | 
	
		
			
				|  |  |          </trim>
 | 
	
		
			
				|  |  |          where f_id = #{fId}
 | 
	
		
			
				|  |  |      </update>
 | 
	
	
		
			
				|  | @@ -652,74 +677,22 @@
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |      <select id="warehouseBillsFeesProfitList" resultType="java.util.Map">
 | 
	
		
			
				|  |  |          SELECT
 | 
	
		
			
				|  |  | -        a.*,
 | 
	
		
			
				|  |  | -        ifnull( a.fAmount, 0 ) - ifnull( a.fStlamount, 0 ) AS nnfinished
 | 
	
		
			
				|  |  | -        FROM
 | 
	
		
			
				|  |  | -        (
 | 
	
		
			
				|  |  | -        SELECT
 | 
	
		
			
				|  |  |          t.f_id AS fSrcpid,
 | 
	
		
			
				|  |  |          c.f_name AS fName,
 | 
	
		
			
				|  |  | -        w.fId AS fId,
 | 
	
		
			
				|  |  | -        w.fName AS fFeesName,
 | 
	
		
			
				|  |  | +        c1.f_name AS fFeesName,
 | 
	
		
			
				|  |  |          w.f_mblno AS fMblno,
 | 
	
		
			
				|  |  |          w.f_product_name AS fProductName,
 | 
	
		
			
				|  |  |          w.f_marks AS fMarks,
 | 
	
		
			
				|  |  |          t.f_billtype AS fBilltype,
 | 
	
		
			
				|  |  | -        t.f_review_date AS fReviewDate,
 | 
	
		
			
				|  |  | -        SUM( w.fAmount ) AS fAmount,
 | 
	
		
			
				|  |  | -        SUM( w.fStlamount ) AS fStlamount
 | 
	
		
			
				|  |  | +        w.f_review_date AS fReviewDate,
 | 
	
		
			
				|  |  | +        sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) fAmount,
 | 
	
		
			
				|  |  | +        sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ) fStlamount,
 | 
	
		
			
				|  |  | +        sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) - sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ) nnfinished
 | 
	
		
			
				|  |  |          FROM
 | 
	
		
			
				|  |  | -        t_warehousebills t
 | 
	
		
			
				|  |  | +        t_warehousebillsfees w
 | 
	
		
			
				|  |  | +        LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
 | 
	
		
			
				|  |  |          LEFT JOIN t_corps c ON c.f_id = t.f_corpid
 | 
	
		
			
				|  |  | -        LEFT JOIN (
 | 
	
		
			
				|  |  | -        SELECT
 | 
	
		
			
				|  |  | -        a.*,
 | 
	
		
			
				|  |  | -        MAX( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) fAmount,
 | 
	
		
			
				|  |  | -        MAX( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ) fStlamount
 | 
	
		
			
				|  |  | -        FROM
 | 
	
		
			
				|  |  | -        (
 | 
	
		
			
				|  |  | -        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_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_status,
 | 
	
		
			
				|  |  | -        f.remark,
 | 
	
		
			
				|  |  | -        f.f_mblno,
 | 
	
		
			
				|  |  | -        f.f_product_name,
 | 
	
		
			
				|  |  | -        f.f_marks,
 | 
	
		
			
				|  |  | -        c.f_id AS fId,
 | 
	
		
			
				|  |  | -        c.f_name AS fName,
 | 
	
		
			
				|  |  | -        sum( f.f_amount ) AS f_amount
 | 
	
		
			
				|  |  | -        FROM
 | 
	
		
			
				|  |  | -        t_warehousebillsfees AS f
 | 
	
		
			
				|  |  | -        LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
 | 
	
		
			
				|  |  | -        GROUP BY
 | 
	
		
			
				|  |  | -        f.f_mblno,
 | 
	
		
			
				|  |  | -        f.f_dc
 | 
	
		
			
				|  |  | -        ) AS a
 | 
	
		
			
				|  |  | -        GROUP BY
 | 
	
		
			
				|  |  | -        f_mblno
 | 
	
		
			
				|  |  | -        ) w ON w.f_pid = t.f_id
 | 
	
		
			
				|  |  | -        LEFT JOIN t_fees f ON w.f_feeid = f.f_id
 | 
	
		
			
				|  |  | +        LEFT JOIN t_corps c1 ON c1.f_id = w.f_corpid
 | 
	
		
			
				|  |  |          <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>
 | 
	
	
		
			
				|  | @@ -733,18 +706,29 @@
 | 
	
		
			
				|  |  |                  and w.f_billstatus = 6
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
 | 
	
		
			
				|  |  | -                and t.f_review_date >= #{timeExamine[0]}
 | 
	
		
			
				|  |  | +                and w.f_review_date >= #{timeExamine[0]}
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
 | 
	
		
			
				|  |  | -                and t.f_review_date <= #{timeExamine[1]}
 | 
	
		
			
				|  |  | +                and w.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  t.f_review_date IS NOT NULL
 | 
	
		
			
				|  |  | +            <if test="fBusinessType != null  and fBusinessType != '' ">
 | 
	
		
			
				|  |  | +                and  w.f_business_type in
 | 
	
		
			
				|  |  | +                <foreach collection="fBusinessType" item="id" open="(" close=")" separator=",">
 | 
	
		
			
				|  |  | +                    #{id}
 | 
	
		
			
				|  |  | +                </foreach>
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="fFeeid != null  and fFeeid != '' ">
 | 
	
		
			
				|  |  | +                and  w.f_feeid in
 | 
	
		
			
				|  |  | +                <foreach collection="fFeeid" item="id" open="(" close=")" separator=",">
 | 
	
		
			
				|  |  | +                    #{id}
 | 
	
		
			
				|  |  | +                </foreach>
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            and  w.f_review_date IS NOT NULL
 | 
	
		
			
				|  |  |              GROUP BY
 | 
	
		
			
				|  |  |              w.f_mblno
 | 
	
		
			
				|  |  |          </where>
 | 
	
		
			
				|  |  | -        ) a
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  </mapper>
 |