|  | @@ -177,11 +177,11 @@
 | 
	
		
			
				|  |  |          t.f_bsdate AS fBsdate,
 | 
	
		
			
				|  |  |          t.f_billtype AS fBilltype,
 | 
	
		
			
				|  |  |          t.f_review_date AS fReviewDate,
 | 
	
		
			
				|  |  | -        w.f_amount AS fAmtdr,
 | 
	
		
			
				|  |  |          w.f_feeid AS fFeeid,
 | 
	
		
			
				|  |  |          f.f_name AS fFeeName,
 | 
	
		
			
				|  |  |          w.f_dc AS fSrcdc,
 | 
	
		
			
				|  |  | -        w.f_stlamount AS fAmt
 | 
	
		
			
				|  |  | +        ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) AS fAmtdr,
 | 
	
		
			
				|  |  | +        ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) AS fAmt
 | 
	
		
			
				|  |  |          FROM
 | 
	
		
			
				|  |  |          t_warehousebills t
 | 
	
		
			
				|  |  |          LEFT JOIN t_corps c ON c.f_id = t.f_corpid
 | 
	
	
		
			
				|  | @@ -262,8 +262,112 @@
 | 
	
		
			
				|  |  |              <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>
 | 
	
		
			
				|  |  | +            and  t.f_review_date IS NOT NULL
 | 
	
		
			
				|  |  | +            and  ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) > 0
 | 
	
		
			
				|  |  | +        </where>
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    <select id="warehouseBillsFeesListAccamount" 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,
 | 
	
		
			
				|  |  | +        w.fId AS fId,
 | 
	
		
			
				|  |  | +        w.fName AS fFeesName,
 | 
	
		
			
				|  |  | +        t.f_bscorpno AS fBscorpno,
 | 
	
		
			
				|  |  | +        t.f_mblno AS fMblno,
 | 
	
		
			
				|  |  | +        t.f_product_name AS fProductName,
 | 
	
		
			
				|  |  | +        t.f_bsdate AS fBsdate,
 | 
	
		
			
				|  |  | +        t.f_billtype AS fBilltype,
 | 
	
		
			
				|  |  | +        t.f_review_date AS fReviewDate,
 | 
	
		
			
				|  |  | +        w.f_feeid AS fFeeid,
 | 
	
		
			
				|  |  | +        f.f_name AS fFeeName,
 | 
	
		
			
				|  |  | +        w.f_dc AS fSrcdc,
 | 
	
		
			
				|  |  | +        ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) AS fAmtdr,
 | 
	
		
			
				|  |  | +        ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) AS fAmt
 | 
	
		
			
				|  |  | +        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_status,
 | 
	
		
			
				|  |  | +        f.remark,
 | 
	
		
			
				|  |  | +        c.f_id AS fId,
 | 
	
		
			
				|  |  | +        c.f_name AS fName
 | 
	
		
			
				|  |  | +        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
 | 
	
		
			
				|  |  | +        <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.fMblno != null  and map.tWareHouseFees.fMblno != ''">and t.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.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>
 | 
	
		
			
				|  |  |              and  t.f_review_date IS NOT NULL
 | 
	
		
			
				|  |  | +            and  ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) > 0
 | 
	
		
			
				|  |  |          </where>
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 |