declare
OUT_FILE TEXT_IO.FILE_TYPE;
ITEM VARCHAR2(10000);
localpath varchar2(1000);
kumpulanfilepdf varchar2(1000);
xcrecord number;
nama_file varchar2(100);
cursor c is
select rj_no,a.reg_no,reg_name,vno_sep
from rstxn_RJHDRS a,rsmst_pasiens b
where a.reg_no=b.reg_no
and rj_status='L'
and cek_bayar='1'
and klaim_id in (select klaim_id from RSMST_KLAIMTYPES where klaim_status='BPJS')
and to_char(rj_date,'mm/yyyy')=:tool_rj.bulan;
c_rec c%rowtype;
BEGIN
xcrecord:=1;
open c;
loop
fetch c into c_rec;
exit when c%notfound;
--membuat nama file
if c_rec.vno_sep is not null then
nama_file:=c_rec.vno_sep;
else
nama_file:=xcrecord;
end if;
localpath :='c:\RJ\'||replace(:tool_rj.bulan,'/','_')||'\'||nama_file||'_'||replace(c_rec.reg_name, chr(32), '')||'\';
--////////////COPY bpjs_PATH//////////////////////////
OUT_FILE := TEXT_IO.FOPEN('c:\anshary.bat','W');
ITEM := 'md '||localpath||'
del c:\anshary.bat';
TEXT_IO.PUT(OUT_FILE,ITEM);
TEXT_IO.FCLOSE(OUT_FILE);
--//////////////////////////////////////
host('c:\anshary.bat',NO_SCREEN );
--export KWITANSI TOTAL
declare
pl_id ParamList;
BEGIN
pl_id := Get_Parameter_List('tmpdata');
IF NOT Id_Null(pl_id) THEN
Destroy_Parameter_List( pl_id );
END IF;
pl_id := Create_Parameter_List('tmpdata');
--Add_Parameter(pl_id,'EMP_QUERY',DATA_PARAMETER,'EMP_RECS');
Add_Parameter(pl_id, 'PARAMFORM', TEXT_PARAMETER, 'no');
Add_Parameter(pl_id, 'rjno', TEXT_PARAMETER, c_rec.rj_no);
Add_Parameter(pl_id, 'td', TEXT_PARAMETER, c_rec.reg_name);
Add_Parameter(pl_id, 'Destype' , Text_Parameter , 'File');
Add_Parameter(pl_id, 'Desname' , Text_Parameter , localpath||'simrs01'||'.pdf');
Add_Parameter(pl_id, 'Desformat', Text_Parameter , 'Pdf');
Run_Product(REPORTS, 'exppdfbpjs.rep', SYNCHRONOUS, runtime,FILESYSTEM, pl_id, NULL);
END;
xcrecord:=xcrecord+1;
-- ///////////////////////////////
declare
cursor cxxx is
select uploadbpjs
from RSTXN_RJUPLOADBPJSES
where rj_no=c_rec.rj_no;
c_recxxx cxxx%rowtype;
vbpjspath varchar2(100);
BEGIN
select bpjs_path into vbpjspath from rsmst_identitases;
open cxxx;
loop
fetch cxxx into c_recxxx;
exit when cxxx%notfound;
--////////////COPY bpjs_PATH//////////////////////////
OUT_FILE := TEXT_IO.FOPEN('c:\anshary.bat','W');
ITEM := 'copy '||'"'||vbpjspath||c_recxxx.uploadbpjs||'" "'||localpath||'"
del c:\anshary.bat';
TEXT_IO.PUT(OUT_FILE,ITEM);
TEXT_IO.FCLOSE(OUT_FILE);
--//////////////////////////////////////
host('c:\anshary.bat',NO_SCREEN );
end loop;
close cxxx;
--////////////MERGE PDF//////////////////////////
select string_AGG(localpath||uploadbpjs) into kumpulanfilepdf from RSTXN_RJUPLOADBPJSES where rj_no=c_rec.rj_no;
kumpulanfilepdf:=replace(kumpulanfilepdf,',',chr(32));
OUT_FILE := TEXT_IO.FOPEN('c:\anshary.bat','W');
ITEM := 'gswin32 -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE='||localpath||nama_file||'.pdf'||' '||kumpulanfilepdf||' '||localpath||'simrs01'||'.pdf
del '||kumpulanfilepdf||' '||localpath||'simrs01'||'.pdf
del c:\anshary.bat';
TEXT_IO.PUT(OUT_FILE,ITEM);
TEXT_IO.FCLOSE(OUT_FILE);
--//////////////////////////////////////
host('c:\anshary.bat',NO_SCREEN );
end;
-- ///////////////////////////////
end loop;
msg_alert('Proses selesai.','I',false);
END;