From f4dd739e92efa1a74b9dc629325bd679482195d4 Mon Sep 17 00:00:00 2001 From: linfso Date: Fri, 27 Sep 2024 06:19:39 +0800 Subject: [PATCH] md --- .../resources/mapper/EmisSettleBillMapper.xml | 74 ++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/emis-biz/src/main/resources/mapper/EmisSettleBillMapper.xml b/emis-biz/src/main/resources/mapper/EmisSettleBillMapper.xml index 9638c0664..d5048869d 100644 --- a/emis-biz/src/main/resources/mapper/EmisSettleBillMapper.xml +++ b/emis-biz/src/main/resources/mapper/EmisSettleBillMapper.xml @@ -91,7 +91,14 @@ tba.billMonth, tba.recPayMoney, tba.totalBillCount, - tba.hasRecdPayMoney + tba.hasRecdPayMoney, + tbb.hasPayBillCount, + tbb.somePayBillCount, + tbb.noPayBillCount, + tbc.recdPayMoney, + (tba.recPayMoney-tbc.recdPayMoney) as noRecdPayMoney, + tbd.expiredRecdPayMoney, + (tba.recPayMoney-tbd.expiredRecdPayMoney) as expiredNoRecdPayMoney from ( select salesmen,bill_month as billMonth, ROUND(sum(rec_money),2) as recPayMoney, @@ -115,6 +122,71 @@ group by salesmen,bill_month ) tba + left join ( + select salesmen,bill_month as billMonth, + sum(IF(payment_status='1',1,0)) as hasPayBillCount, + sum(IF(payment_status='2',1,0)) as somePayBillCount, + sum(IF(payment_status='0',1,0)) as noPayBillCount + from emis_settle_bill a + + a.del_flag='0' + and a.bill_month = #{billMonth} + and a.open_bill_status = #{openBillStatus} + and a.payment_status = #{paymentStatus} + + and ( + a.salesmen=#{params.privEmpName} + or a.payee=#{params.privEmpName} + or a.salesmen in( + select salesmen from emis_salesmen_rel esr where esr.del_flag='0' and esr.bl_open='1' and now() = ]]> esr.start_date and now() esr.end_date and esr.sales_ass=#{params.privEmpName} + ) + ) + + + group by salesmen,bill_month + ) tbb on tba.salesmen=tbb.salesmen and tba.billMonth=tbb.billMonth + left join ( + select a.salesmen,a.bill_month as billMonth, + sum(b.pay_money) as recdPayMoney + from emis_settle_bill a,emis_settle_pay_record b + + a.del_flag='0' and b.del_flag='0' and a.settle_bill_no=b.settle_bill_no and b.create_time a.payment_due_date + and a.bill_month = #{billMonth} + and a.open_bill_status = #{openBillStatus} + and a.payment_status = #{paymentStatus} + + and ( + a.salesmen=#{params.privEmpName} + or a.payee=#{params.privEmpName} + or a.salesmen in( + select salesmen from emis_salesmen_rel esr where esr.del_flag='0' and esr.bl_open='1' and now() = ]]> esr.start_date and now() esr.end_date and esr.sales_ass=#{params.privEmpName} + ) + ) + + + group by salesmen,bill_month + ) tbc on tba.salesmen=tbc.salesmen and tba.billMonth=tbc.billMonth + left join ( + select a.salesmen,a.bill_month as billMonth, + sum(b.pay_money) as expiredRecdPayMoney + from emis_settle_bill a,emis_settle_pay_record b + + a.del_flag='0' and b.del_flag='0' and a.settle_bill_no=b.settle_bill_no and b.create_time ]]> a.payment_due_date + and a.bill_month = #{billMonth} + and a.open_bill_status = #{openBillStatus} + and a.payment_status = #{paymentStatus} + + and ( + a.salesmen=#{params.privEmpName} + or a.payee=#{params.privEmpName} + or a.salesmen in( + select salesmen from emis_salesmen_rel esr where esr.del_flag='0' and esr.bl_open='1' and now() = ]]> esr.start_date and now() esr.end_date and esr.sales_ass=#{params.privEmpName} + ) + ) + + + group by salesmen,bill_month + ) tbd on tba.salesmen=tbd.salesmen and tba.billMonth=tbd.billMonth