1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| (
wdate in date,
wsociete in varchar2,
tab_ctx_dll out bocursors.table_ctx_dll) is
wannee varchar2(4);
wmois varchar2(2);
begin
select to_char(wdate,'YYYY'), to_char(wdate,'MM')
into wannee, wmois
from dual;
case when wmois=1 then
open tab_ctx_dll
for
select wannee,
'01' mois,
bogroupe.u##corg,
bogroupe.lorg,
bogroupe.u##cagence,
bogroupe.cgroupe,
substr(Locaux.cpos,1,2),
boctx.ctyphas,
boctx.ltyphas,
boctx.u##idcompte,
count(distinct boctx.u##idcompte),
logirep_solde_compte(boctx.u##idcompte,last_day('01/01/'||wannee))
FROM
boctx,
faitloc,
locaux,
bogroupe
WHERE
faitloc.U##IDMENAGE=boctx.U##IDCOMPTE
and faitloc.U##IDLOCAL=locaux.U##IDLOCAL
and locaux.U##IDGROUPE=bogroupe.U##IDGROUPE
and (boctx.datclo is null or boctx.datclo > last_day('01/01/'||wannee))
and boctx.datevent <= last_day('01/01/'||wannee)
and boctx.ctyphas in('CDT', 'JUD', 'EXP')
and boctx.ctyproc='CPR'
and boctx.temctx = 'C'
and faitloc.temlprin = 1
and bogroupe.u##corg=wsociete
and boctx.nopha = Logirep_Max_No_Phase(boctx.u##idcompte, last_day('01/01/'||wannee))
group by wannee, |
Partager