|  | @@ -1918,6 +1918,57 @@
 | 
	
		
			
				|  |  |              w.f_mblno
 | 
	
		
			
				|  |  |          </where>
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <select id="warehouseBillsFeesCustomProfitList" resultType="java.util.Map">
 | 
	
		
			
				|  |  | +        SELECT
 | 
	
		
			
				|  |  | +            c.f_name AS fName,
 | 
	
		
			
				|  |  | +            DATE_FORMAT(w.f_review_date,'%Y-%m') AS reviewDate,
 | 
	
		
			
				|  |  | +            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_warehousebillsfees w
 | 
	
		
			
				|  |  | +        LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
 | 
	
		
			
				|  |  | +        left join sys_user u on t.create_by = u.user_name
 | 
	
		
			
				|  |  | +        left join sys_user u1 on t.f_salesman_id = u1.user_id
 | 
	
		
			
				|  |  | +        left join sys_dept d on t.f_bsdeptid = d.dept_id
 | 
	
		
			
				|  |  | +        LEFT JOIN t_corps c ON c.f_id = t.f_corpid
 | 
	
		
			
				|  |  | +        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>
 | 
	
		
			
				|  |  | +            <if test="fSalesmanId != null and fSalesmanId != ''">and t.f_salesman_id = #{fSalesmanId}</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='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
 | 
	
		
			
				|  |  | +                and DATE_FORMAT(w.f_review_date, '%Y-%m') between #{timeExamine[0]} and #{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>
 | 
	
		
			
				|  |  | +            <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
 | 
	
		
			
				|  |  | +            ${params.dataScope}
 | 
	
		
			
				|  |  | +        </where>
 | 
	
		
			
				|  |  | +        GROUP BY
 | 
	
		
			
				|  |  | +            c.f_name,
 | 
	
		
			
				|  |  | +            reviewDate
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      <select id="selectFeeList" resultType="java.util.Map">
 | 
	
		
			
				|  |  |          select
 | 
	
		
			
				|  |  |              ware.create_by AS createBy,
 | 
	
	
		
			
				|  | @@ -2696,7 +2747,7 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="selectFinancialLedgerList" resultMap="feeVOResult">
 | 
	
		
			
				|  |  |          SELECT
 | 
	
		
			
				|  |  | -            c.f_name AS f_fees_name, w.f_corpid, w.f_mblno, w.f_billstatus, w.f_review_date,
 | 
	
		
			
				|  |  | +            c.f_name AS f_fees_name, w.f_corpid, w.f_mblno, w.f_billstatus, DATE_FORMAT(w.f_review_date,'%Y-%m') AS reviewDate,
 | 
	
		
			
				|  |  |              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
 | 
	
	
		
			
				|  | @@ -2721,17 +2772,18 @@
 | 
	
		
			
				|  |  |              <if test="isReviewed != null and isReviewed == 1">
 | 
	
		
			
				|  |  |                  and w.f_billstatus = 6
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  | -            <if test="fReconciliation!= null and fReconciliation != '' and fReconciliation == '0'">
 | 
	
		
			
				|  |  | +            <if test="fReconciliation!= null and fReconciliation != '' and fReconciliation == 0">
 | 
	
		
			
				|  |  |                  and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test="timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ''">
 | 
	
		
			
				|  |  | -                and w.f_review_date between #{timeExamine[0]} and #{timeExamine[1]}
 | 
	
		
			
				|  |  | +                and DATE_FORMAT(w.f_review_date, '%Y-%m') between #{timeExamine[0]} and #{timeExamine[1]}
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              ${params.dataScope}
 | 
	
		
			
				|  |  |          </where>
 | 
	
		
			
				|  |  |          GROUP BY
 | 
	
		
			
				|  |  |              w.f_corpid,
 | 
	
		
			
				|  |  | -            w.f_dc
 | 
	
		
			
				|  |  | +            w.f_dc,
 | 
	
		
			
				|  |  | +            reviewDate
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="selectFinancialLedgerDetails" resultMap="feeVOResult">
 | 
	
	
		
			
				|  | @@ -2758,7 +2810,7 @@
 | 
	
		
			
				|  |  |                  and w.f_billstatus = 6
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test='fAuditList != null and fAuditList[0] != null'>
 | 
	
		
			
				|  |  | -                and w.f_review_date BETWEEN #{fAuditList[0]} and #{fAuditList[1]}
 | 
	
		
			
				|  |  | +                and DATE_FORMAT(w.f_review_date, '%Y-%m') BETWEEN #{fAuditList[0]} and #{fAuditList[1]}
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |          GROUP BY
 | 
	
		
			
				|  |  |          w.f_id
 |