declare al_id alert; al_button number; psdate date; pedate date; csdate date; cedate date; x number; num number; rtn number; temp number; temp1 number; temp2 varchar(300); begin al_id := find_alert('alt_todate'); if :mon is null then set_alert_property(al_id,alert_message_text, 'Month cannot be blank'); al_button := show_alert(al_id); go_item('mon'); RAISE Form_Trigger_failure ; end if ; select to_number(substr(to_char(last_day(to_date('01'||'-'||:mon||'-'|| to_char(sysdate,'yyyy'),'dd-mm-yyyy')),'dd-mm-yyyy'),0,2)) into temp from dual; select to_number(:days) into temp1 from dual; temp2 :=' Maximum no of days cannot be greater than ' || temp; if temp1>temp then set_alert_property('alt_todate',alert_message_text,temp2); x:=show_alert('alt_todate'); go_item('blk_main.days'); raise form_trigger_failure; END IF; ------------------------------------------------------------------------- if :blk_main.filename is null and :radio_options='File' then set_alert_property('ALT_TODATE',alert_message_text,'File name not specified !'); x:=show_alert('ALT_TODATE'); go_item('blk_main.FILENAME'); raise form_trigger_failure; END IF; ----------------------------------------------------------------------------- --AS If :radio_options='File' then Select count(*) into num from clients_reports where vc_client_code=:global.vc_client_code and vc_rep_name=:FILENAME; If num>=1 then al_id:=find_alert('ALT_TODATE'); Set_alert_property(al_id,alert_message_text, 'Report with this name already exists.Specify another name!'); rtn:=show_alert(al_id); go_item('FILENAME'); Raise form_trigger_failure; End If; IF :FILENAME like'%/%'or :FILENAME like'%\%' or :FILENAME like'%?%' or :FILENAME like'% %' or :FILENAME like'%\%%'escape'\' then al_id:=find_alert('ALT_TODATE'); Set_alert_property(al_id,alert_message_text, 'Invalid report name.(/,\,*,#,%,blank space not allowed)Specify another name!'); rtn:=show_alert(al_id); go_item('FILENAME'); Raise form_trigger_failure; End If; End If; proc_call; end; PROCEDURE proc_call IS BEGIN declare pi_id paramlist; oth varchar2(15); N_COPIES varchar2(5); File VARCHAR2(15); mon varchar2(50); day varchar2(10); compcode varchar2(2); com varchar2(500); repno number; al_id alert; al_report number; dt_expiry date; user varchar2(25); pass varchar2(25); today date; store_var varchar2(150); store_var1 varchar2(150); F_N varchar2(8); reg_val varchar2(150); reg_val1 varchar2(150); begin pi_id := get_parameter_list('dt_param'); if not Id_null(pi_id) then destroy_parameter_list(pi_id); end if; pi_id := create_parameter_list('dt_param'); if :days is null then day := '%'; else day := :days ; end if; add_parameter(pi_id,'month',TEXT_PARAMETER,:mon); add_parameter(pi_id,'day',TEXT_PARAMETER,day); compcode := :global.vc_comp_code; add_parameter(pi_id,'comp_code',TEXT_PARAMETER,compcode); add_parameter(pi_id,'PARAMFORM',TEXT_PARAMETER,'no'); oth := :RADIO_OPTIONS; add_parameter(pi_id,'DESTYPE',TEXT_PARAMETER,oth); IF :radio_options ='File' THEN Select count(*)into repno from clients_reports where vc_client_code=:global.vc_client_code; If repno>=25 then al_id:=Find_alert('ALT_CAUTION'); Set_alert_property(al_id,alert_message_text, 'Already twenty five reports exist,do you want to delete some reports for offline report generation?'); al_report:=show_alert(al_id); tool_env.getvar('TRI',reg_val1); If al_report=alert_button1 then :global.del_ret_code:='del'; call_form(reg_val1||'\forms\del_1.fmx'); raise form_trigger_failure; else raise form_trigger_failure; End If; Else user:=get_application_property(USERNAME); pass:=get_application_property(PASSWORD); F_N:=:FILENAME; Tool_env.getvar('HRD',store_var); Tool_env.getvar('REP',store_var1); com:='RWCLI60 server=repserver report='||store_var||'\reports\birthday.rdf userid='||user||'/'||pass||' destype=file desname='||store_var1||'\'||substr(:global.vc_client_code,7)||F_N||'.htm'||' month='||(:mon)||' day='||day||' comp_code='||compcode||' f_n='||f_n||' desformat=html errfile='||store_var1||'\'||substr(:global.vc_client_code,7)||F_N||'.htm'; al_id:=Find_alert('ALT_TODATE'); Select sysdate into today from dual; dt_expiry:=today+7; Set_alert_property(al_id,alert_message_text,'Your report will be stored on our sever and will be deleted on'||dt_expiry||'!'); al_report:=show_alert(al_id); insert into clients_reports(vc_client_code,vc_rep_name,vc_rep_desc,flag) values(:global.vc_client_code,F_N,:description,'P'); commit; HOST(com,NO_SCREEN); If not form_success then update clients_reports set flag='E' where vc_rep_name=F_N and vc_client_code=:global.vc_client_code; commit; End If; End If; Else tool_env.getvar('HRD',reg_val); RUN_PRODUCT(REPORTS,reg_val||'\reports\birthday.rdf',SYNCHRONOUS,RUNTIME,FILESYSTEM,pi_id,NULL); End If; end; END;