|
|
Re: HOW WE CAN SEND SALARY SLIP REPORT TO EACH EMPLOYEE EMAIL? [message #260306 is a reply to message #259558] |
Sat, 18 August 2007 05:11 |
raniahalga
Messages: 6 Registered: August 2007
|
Junior Member |
|
|
Pls find attached example may solve your problem:
/* Suppose you have the following two reports:
** MGR_RUN, which queries manager names, and invokes a second report named MAIL_IT
** MAIL_IT, which queries employee names for the manager that MGR_RUN passes it,
** and sends the report output to the manager via e-mail.
** The description of MGR_RUN could be as follows:
** Query:
SELECT ENAME, EMPNO FROM EMP WHERE JOB='MANAGER'
** Group Filter:
*/
FUNCTION FOO RETURN BOOLEAN IS
BEGIN
srw.run_report('report=MAIL_IT
desname='||:ename ||' desformat=dflt batch=yes
mgr_no='|| TO_CHAR(:empno) );
RETURN (TRUE);
EXCEPTION
when srw.run_report_failure then
srw.message(30, 'Error mailing reports.');
raise srw.program_abort;
END;
/* This PL/SQL invokes MAIL_IT, specifies that MAIL_IT's output
** should be sent to the manager via Oracle Mail, and passes the
** manager number, so that the MAIL_IT report can query only the
** manager's employees.
** Note: EMPNO's values must be converted to characters
** (TO_CHAR in the PL/SQL above), because SRW.RUN_REPORT
** requires a character string.
** Layout: None is needed, because this report only fetches data,
** then passes it to a second report.
** The description of MAIL_IT could be as follows:
** Query:
SELECT DEPTNO, ENAME, SAL FROM EMP WHERE MGR=:MGR_NO
** Layout: Master/Detail
*/
/* Suppose that you have three reports that you almost always run together.
** The reports are named SALARY, COMMISS, and TAXES. To run these reports
** with one RWRUN60 command, you create a driver report named PAYROLL.
** The description of PAYROLL could be as follows:
** Query:
SELECT DEPTNO FROM DEPT
** Before Report Trigger:
*/
FUNCTION FOO RETURN BOOLEAN IS
BEGIN
srw.run_report('batch=yes report=SALARY
destype=file desformat=dflt desname=salary.lis');
srw.run_report('batch=yes report=COMMISS
destype=file desformat=dflt desname=comiss.lis');
srw.run_report('batch=yes report=TAXES
destype=file desformat=dflt desname=comiss.lis');
RETURN (TRUE);
END;
/* Layout: Tabular
** When you run PAYROLL from the designer or RWRUN60, the other three
** reports will all be run. (Note that, in this case, the query and
** the layout for Payroll could be anything. They are only used here
** in order to make it possible to run PAYROLL.)
*/
|
|
|