This commit is contained in:
linfso 2024-09-27 18:41:33 +08:00
parent 895509a9e2
commit 4b926d6183

View File

@ -113,8 +113,8 @@
tbb.noPayBillCount,
ifnull(tbc.recdPayMoney,0) as recdPayMoney,
(tba.recPayMoney-ifnull(tbc.recdPayMoney,0)) as noRecdPayMoney,
ifnull(tbd.expiredRecdPayMoney,0) as expiredRecdPayMoney,
(tba.recPayMoney-ifnull(tbd.expiredRecdPayMoney,0)) as expiredNoRecdPayMoney
ifnull(tbd.expiredRecdPayMoney,0) as expiredRecdPayMoney,
ifnull(tbe.expiredNoRecdPayMoney,0) as expiredNoRecdPayMoney
from (
select salesmen,bill_month as billMonth,
ROUND(sum(rec_money),2) as recPayMoney,
@ -207,6 +207,28 @@
</where>
group by salesmen,bill_month
) tbd on tba.salesmen=tbd.salesmen and tba.billMonth=tbd.billMonth
left join (
select a.salesmen,a.bill_month as billMonth,
ROUND(sum(rec_money-reced_money),2) as expiredNoRecdPayMoney
from emis_settle_bill a
<where>
a.del_flag='0' and now() <![CDATA[ > ]]> a.payment_due_date
<if test="salesmen != null and salesmen!='' "> and a.salesmen = #{salesmen}</if>
<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
) tbe on tba.salesmen=tbe.salesmen and tba.billMonth=tbe.billMonth
</select>