md
This commit is contained in:
parent
b37054e91d
commit
f4dd739e92
@ -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 @@
|
||||
</where>
|
||||
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
|
||||
<where>
|
||||
a.del_flag='0'
|
||||
<if test="billMonth != null and billMonth!='' "> and a.bill_month = #{billMonth}</if>
|
||||
<if test="openBillStatus != null and openBillStatus != ''"> and a.open_bill_status = #{openBillStatus}</if>
|
||||
<if test="paymentStatus != null and paymentStatus != ''"> and a.payment_status = #{paymentStatus}</if>
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
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() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date and esr.sales_ass=#{params.privEmpName}
|
||||
)
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
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
|
||||
<where>
|
||||
a.del_flag='0' and b.del_flag='0' and a.settle_bill_no=b.settle_bill_no and b.create_time <![CDATA[ <= ]]> a.payment_due_date
|
||||
<if test="billMonth != null and billMonth!='' "> and a.bill_month = #{billMonth}</if>
|
||||
<if test="openBillStatus != null and openBillStatus != ''"> and a.open_bill_status = #{openBillStatus}</if>
|
||||
<if test="paymentStatus != null and paymentStatus != ''"> and a.payment_status = #{paymentStatus}</if>
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
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() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date and esr.sales_ass=#{params.privEmpName}
|
||||
)
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
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
|
||||
<where>
|
||||
a.del_flag='0' and b.del_flag='0' and a.settle_bill_no=b.settle_bill_no and b.create_time <![CDATA[ > ]]> a.payment_due_date
|
||||
<if test="billMonth != null and billMonth!='' "> and a.bill_month = #{billMonth}</if>
|
||||
<if test="openBillStatus != null and openBillStatus != ''"> and a.open_bill_status = #{openBillStatus}</if>
|
||||
<if test="paymentStatus != null and paymentStatus != ''"> and a.payment_status = #{paymentStatus}</if>
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
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() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date and esr.sales_ass=#{params.privEmpName}
|
||||
)
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
group by salesmen,bill_month
|
||||
) tbd on tba.salesmen=tbd.salesmen and tba.billMonth=tbd.billMonth
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user