|  | @@ -266,8 +266,8 @@
 | 
	
		
			
				|  |  |          IFNULL(paw.sum_payamount,0) sumPayamount,
 | 
	
		
			
				|  |  |          pba.state as state,
 | 
	
		
			
				|  |  |          (select label from pay_sys_dict where value = pba.state and type='客户状态' and site_id = #{siteId} and customer_id = #{customerId}) stateName,
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        dt.remaining ,
 | 
	
		
			
				|  |  | +        rech.remaining,
 | 
	
		
			
				|  |  | +        <!-- dt.remaining ,-->
 | 
	
		
			
				|  |  |          (select label from pay_sys_dict where value = pba.idtype and type='证件类型' and site_id = #{siteId} and customer_id = #{customerId}) idTypeName,
 | 
	
		
			
				|  |  |          pba.accountnumber,
 | 
	
		
			
				|  |  |          pba.name,
 | 
	
	
		
			
				|  | @@ -283,7 +283,8 @@
 | 
	
		
			
				|  |  |          where  site_id = #{siteId} and customer_id = #{customerId}  and year=#{year} and month=#{month}
 | 
	
		
			
				|  |  |          group by account_id
 | 
	
		
			
				|  |  |          ) paw on paw.account_id = pba.id
 | 
	
		
			
				|  |  | -        left join (
 | 
	
		
			
				|  |  | +        left join pay_pay_rechargeaccount rech on pba.id = rech.account_id
 | 
	
		
			
				|  |  | +        <!-- left join (
 | 
	
		
			
				|  |  |          select
 | 
	
		
			
				|  |  |          rech.account_id
 | 
	
		
			
				|  |  |          ,IFNULL(max(rech.remaining),0) - IFNULL(sum(rece.debt),0)  remaining
 | 
	
	
		
			
				|  | @@ -291,7 +292,7 @@
 | 
	
		
			
				|  |  |          left join pay_pay_receivable rece on rece.account_id=rech.account_id and rece.debt>0
 | 
	
		
			
				|  |  |          where rech.site_id = #{siteId} and rech.customer_id = #{customerId}
 | 
	
		
			
				|  |  |          group by rech.account_id
 | 
	
		
			
				|  |  | -        ) dt on pba.id = dt.account_id
 | 
	
		
			
				|  |  | +        ) dt on pba.id = dt.account_id -->
 | 
	
		
			
				|  |  |          left join (
 | 
	
		
			
				|  |  |          select account_id, count(1) waterNumber,max(office_id) office_id from pay_base_customerandmeterrela
 | 
	
		
			
				|  |  |          where site_id = #{siteId} and customer_id = #{customerId}
 | 
	
	
		
			
				|  | @@ -397,12 +398,13 @@
 | 
	
		
			
				|  |  |              (select IFNULL(sum(payamount),0) from pay_amount_waterusedamount paw where  paw.site_id=#{siteId} and paw.customer_id=#{customerId} and paw.state = 2 and paw.accountnumber = pba.accountnumber) sumPayamount,
 | 
	
		
			
				|  |  |              #{payment} as sumPayment,
 | 
	
		
			
				|  |  |              psd2.label as stateName,
 | 
	
		
			
				|  |  | -            (SELECT  remaining from pay_pay_rechargeaccount
 | 
	
		
			
				|  |  | +            ppr.remaining,
 | 
	
		
			
				|  |  | +            <!--(SELECT  remaining from pay_pay_rechargeaccount
 | 
	
		
			
				|  |  |              where  account_id=pba.id and site_id=#{siteId} and customer_id=#{customerId})
 | 
	
		
			
				|  |  |              -
 | 
	
		
			
				|  |  |              (select IFNULL(SUM(debt),0) debt  from pay_pay_receivable where
 | 
	
		
			
				|  |  |              accountnumber=pba.accountnumber and debt <![CDATA[<>]]> 0 and site_id =#{siteId} and customer_id=#{customerId})
 | 
	
		
			
				|  |  | -            as remaining,
 | 
	
		
			
				|  |  | +            as remaining,-->
 | 
	
		
			
				|  |  |              psd.label as idTypeName,
 | 
	
		
			
				|  |  |              pba.accountnumber,
 | 
	
		
			
				|  |  |              pba.name,
 |