Forráskód Böngészése

修改打印票据详情

hym 3 éve
szülő
commit
2f5663ad32

+ 10 - 8
zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayInvoiceMapper.xml

@@ -302,7 +302,7 @@
             autoReceivedamount
         from (
             select
-            a.account_id as "accountId",
+            re.account_id as "accountId",
             re.feetype,
             re.feetypename,
             re.ladderlevel,
@@ -315,14 +315,15 @@
             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 ) 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_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
             select
-            a.account_id,
+            re.account_id,
             re.feetype,
             re.feetypename,
             '' as "ladderlevel",
@@ -331,11 +332,12 @@
             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 ) 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_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
         order by s.accountId,s.feetype,s.ladderlevel
     </select>