facilidades_de_pago/VERIFICAR EN OLYMPO/002 CUOTAS PAGADAS CONVENIOS.sql

32 lines
1.1 KiB
MySQL
Raw Permalink Normal View History

2024-11-15 12:22:39 -05:00
select
cll_v.id as voucher_id,
cll_v.code as voucher_code,
cll_v.date as date_voucher,
cll_c.code,
cll_c.description,
cll_c.amount as valor,
coalesce(sum(cll_vl.value_paid),0.00) capital_pagado,
coalesce(sum(cll_vl.penalty_agreement),0.00) interes_convenio,
coalesce(sum(cll_vl.to_paid),0.00) valor_pagado
from cll_vouchers_line cll_vl
inner join cll_vouchers cll_v on cll_v.id = cll_vl.vouchers_id
inner join cll_collection cll_c on cll_c.id = cll_vl.collection_id
where cll_vl.collection_dividend_id in(
select distinct cdl.id from cll_vouchers_line cvl
inner join cll_dividend_line cdl
on cdl.id = cvl.collection_dividend_id
where agreement_id = 2761
)
and cll_vl.collection_dividend_id is not null
--and cll_v.code = '001019/026199'
group by cll_v.id,cll_v.code,cll_v.date, cll_vl.collection_dividend_id, cll_c.code, cll_c.description,cll_c.amount
order by cll_vl.collection_dividend_id
select * from cll_vouchers where id in(11349814, 11349814, 11408028)
select * from cll_vouchers where id = 19486610
SELECT * FROM public.voucher_payment where vouchers_id = 19486610