|
@@ -302,7 +302,7 @@
|
|
autoReceivedamount
|
|
autoReceivedamount
|
|
from (
|
|
from (
|
|
select
|
|
select
|
|
- a.account_id as "accountId",
|
|
|
|
|
|
+ re.account_id as "accountId",
|
|
re.feetype,
|
|
re.feetype,
|
|
re.feetypename,
|
|
re.feetypename,
|
|
re.ladderlevel,
|
|
re.ladderlevel,
|
|
@@ -315,14 +315,15 @@
|
|
re.waterbasicprice,
|
|
re.waterbasicprice,
|
|
sum(case when payway != 5 then reced.receivedamount else 0 end ) receivedamount,
|
|
sum(case when payway != 5 then reced.receivedamount else 0 end ) receivedamount,
|
|
sum(case when payway = 5 then reced.receivedamount else 0 end ) autoReceivedamount
|
|
sum(case when payway = 5 then reced.receivedamount else 0 end ) autoReceivedamount
|
|
- from pay_amount_waterusedamount a
|
|
|
|
|
|
+ from rmcp_measurement_record a
|
|
left join pay_pay_receivable re on a.id=re.usedamount_id
|
|
left join pay_pay_receivable re on a.id=re.usedamount_id
|
|
left join pay_pay_received reced on reced.receivable_id=re.id
|
|
left join pay_pay_received reced on reced.receivable_id=re.id
|
|
- where re.feetype=1 and a.`year`*12+a.`month` >= #{minPeriod} and a.`year`*12+a.`month` <= #{maxPeriod} and a.account_id=#{accountId}
|
|
|
|
- group by a.account_id,re.feetype, re.feetypename,re.ladderlevel,re.payamount,re.waterbasicprice
|
|
|
|
|
|
+ where re.feetype=1 and year(a.create_date)*12+month(a.create_date) >= #{minPeriod}
|
|
|
|
+ and year(a.create_date)*12+month(a.create_date) <= #{maxPeriod} and re.account_id=#{accountId}
|
|
|
|
+ group by re.account_id,re.feetype, re.feetypename,re.ladderlevel,re.payamount,re.waterbasicprice
|
|
union all
|
|
union all
|
|
select
|
|
select
|
|
- a.account_id,
|
|
|
|
|
|
+ re.account_id,
|
|
re.feetype,
|
|
re.feetype,
|
|
re.feetypename,
|
|
re.feetypename,
|
|
'' as "ladderlevel",
|
|
'' as "ladderlevel",
|
|
@@ -331,11 +332,12 @@
|
|
max(re.waterbasicprice) as "waterbasicprice",
|
|
max(re.waterbasicprice) as "waterbasicprice",
|
|
sum(case when payway != 5 then reced.receivedamount else 0 end ) receivedamount,
|
|
sum(case when payway != 5 then reced.receivedamount else 0 end ) receivedamount,
|
|
sum(case when payway = 5 then reced.receivedamount else 0 end ) autoReceivedamount
|
|
sum(case when payway = 5 then reced.receivedamount else 0 end ) autoReceivedamount
|
|
- from pay_amount_waterusedamount a
|
|
|
|
|
|
+ from rmcp_measurement_record a
|
|
left join pay_pay_receivable re on a.id=re.usedamount_id
|
|
left join pay_pay_receivable re on a.id=re.usedamount_id
|
|
left join pay_pay_received reced on reced.receivable_id=re.id
|
|
left join pay_pay_received reced on reced.receivable_id=re.id
|
|
- where re.feetype !=1 and a.`year`*12+a.`month` >= #{minPeriod} and a.`year`*12+a.`month` <= #{maxPeriod} and a.account_id=#{accountId}
|
|
|
|
- group by a.account_id,re.feetype,re.feetypename
|
|
|
|
|
|
+ where re.feetype !=1 and year(a.create_date)*12+month(a.create_date) >= #{minPeriod} and
|
|
|
|
+ year(a.create_date)*12+month(a.create_date) <= #{maxPeriod} and re.account_id=#{accountId}
|
|
|
|
+ group by re.account_id,re.feetype,re.feetypename
|
|
)s
|
|
)s
|
|
order by s.accountId,s.feetype,s.ladderlevel
|
|
order by s.accountId,s.feetype,s.ladderlevel
|
|
</select>
|
|
</select>
|