You are on page 1of 4

Paso SQL

%SelectInit(Fu_Programa, Fu_Otro_Programa, Fu_Instituc_Formal, Fu_Otrainstitucion,


Fu_Area_Formacion, Fu_Idioma, Fu_Otra_Ent_Adm, Fu_Entidad_Exp_Doc, Fu_Otr_Ent_Exp_Doc,
Emplid, Name_Display, Fu_Nomb_Instit_Adm)
SELECT Fu_Programa
, Fu_Otro_Programa
, Fu_Instituc_Formal
, Fu_Otrainstitucion
, Fu_Area_Formacion
, Fu_Idioma
, Fu_Otra_Ent_Adm
, Fu_Entidad_Exp_Doc
, Fu_Otr_Ent_Exp_Doc
, Emplid
, Name_Display
, Fu_Nomb_Instit_Adm
FROM %Table(Fu_Hjavida_Tbl)
WHERE Run_Cntl_Id = %Runcontrol
AND Oprid = %OperatorId
Paso PeopleCode
/*Inicio 001*/
import PSXP_RPTDEFNMANAGER:ReportDefn;
Local Record &rcdQryPrompts;
Local PSXP_RPTDEFNMANAGER:ReportDefn &oRptDefn;
Local string &sOutputFormat;
Local string &plantilla;
Local string &ErrMsg = "Ok";
Local boolean &success;
Local ApiObject &MYSESSION;
/*Array de parametros*/
Local array of any &AAny = CreateArrayAny();
REM &AAny = CreateArrayAny(FU_HJAVIDA_AET.PROCESS_INSTANCE.Value,
FU_HJAVIDA_AET.FU_PROGRAMA.Value, . . .);
&AAny.Push(FU_HJAVIDA_AET.PROCESS_INSTANCE.Value); /*Posicion 1*/
&AAny.Push(FU_HJAVIDA_AET.FU_PROGRAMA.Value); /*Posicion 2*/
&AAny.Push(FU_HJAVIDA_AET.FU_OTRO_PROGRAMA.Value); /*Posicion 3*/
&AAny.Push(FU_HJAVIDA_AET.FU_INSTITUC_FORMAL.Value); /*Posicion 4*/
&AAny.Push(FU_HJAVIDA_AET.FU_OTRAINSTITUCION.Value); /*Posicion 5*/
&AAny.Push(FU_HJAVIDA_AET.FU_AREA_FORMACION.Value); /*Posicion 6*/
&AAny.Push(FU_HJAVIDA_AET.FU_IDIOMA.Value); /*Posicion 7*/
&AAny.Push(FU_HJAVIDA_AET.FU_NOMB_INSTIT_ADM.Value); /*Posicion 8*/
&AAny.Push(FU_HJAVIDA_AET.FU_OTRA_ENT_ADM.Value); /*Posicion 9*/
&AAny.Push(FU_HJAVIDA_AET.FU_ENTIDAD_EXP_DOC.Value); /*Posicion 10*/
&AAny.Push(FU_HJAVIDA_AET.FU_OTR_ENT_EXP_DOC.Value); /*Posicion 11*/
&AAny.Push(FU_HJAVIDA_AET.EMPLID.Value); /*Posicion 12*/
&AAny.Push(FU_HJAVIDA_AET.NAME_DISPLAY.Value); /*Posicion 13*/
&AAny.Push(&ErrMsg); /*Posicion 14*/
/*
Local integer &INDEX = 0;
While &AAny.Next(&INDEX)
Warning MsgGetText(11111, 6, "Anny[%1] tiene valor : (%2) ", &INDEX, &AAny [&INDEX]);
End-While;
*/

If None(FU_HJAVIDA_AET.FU_PROGRAMA.Value, FU_HJAVIDA_AET.FU_OTRO_PROGRAMA.Value,
FU_HJAVIDA_AET.FU_INSTITUC_FORMAL.Value, FU_HJAVIDA_AET.FU_OTRAINSTITUCION.Value,
FU_HJAVIDA_AET.FU_AREA_FORMACION.Value, FU_HJAVIDA_AET.FU_IDIOMA.Value,
FU_HJAVIDA_AET.FU_NOMB_INSTIT_ADM.Value, FU_HJAVIDA_AET.FU_OTRA_ENT_ADM.Value,
FU_HJAVIDA_AET.EMPLID.Value, FU_HJAVIDA_AET.NAME_DISPLAY.Value) Then
Exit 1; /* En la propiedad On Return del paso Step01 se coloca Break */
REM MessageBox(%MsgStyle_OK, "", 65, 0, "Process Instance", "Process Not submitted");
Else
/*
&MYSESSION = GetSession();
&MYSESSION.Connect(1, "http://guacari.uninorte.edu.co:8300", "AEVALENCIA", "AEVALENCIA",
0);
Warning MsgGetText(11111, 6, "El resultado del proceso es:(%1)", &ErrMsg | " " |
%UserId);
*/
REM If SwitchUser("PS", "PS", "", "") Then
REM
Warning MsgGetText(11111, 6, "El resultado del proceso es:(%1)", &ErrMsg);
REM End-If;
&success = SQLExec("Execute Fu_Hjavida_Mf(:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :
12, :13, :14)", &AAny);
If (&success) Then
&oRptDefn = create PSXP_RPTDEFNMANAGER:ReportDefn("FU_HJAVID_RD");
&oRptDefn.Get();
/* fill query runtime prompt record */
&rcdQryPrompts = &oRptDefn.GetPSQueryPromptRecord();
If ( Not &rcdQryPrompts = Null) Then
&rcdQryPrompts.PROCESS_INSTANCE.Value = FU_HJAVIDA_AET.PROCESS_INSTANCE.Value;
&oRptDefn.SetPSQueryPromptRecord(&rcdQryPrompts);
End-If;
&oRptDefn.OutDestination = %FilePath;
&oRptDefn.UseBurstValueAsOutputFileName = True;
&oRptDefn.ReportFileName = "Hoja_Vida_" | DateTimeToLocalizedString(%Datetime, "dd-MMyyyy_h_mm_a");
/*generate report*/
&sOutputFormat = &oRptDefn.GetOutDestFormatString(8);
/*
* 2 PDF, 5 HTML, 8 XLS, 12 RTF
*/
/*Impresion Reporte en XML Publisher*/
&oRptDefn.ProcessReport(&plantilla, "ESP", %Date, &sOutputFormat);
Else
Warning MsgGetText(11111, 6, "Error al generar el reporte");
End-If;
End-If;
/*
&success = SQLExec("exec Fu_Hjavida_Mf(:FU_HJAVIDA_AET.PROCESS_INSTANCE,
:FU_HJAVIDA_AET.FU_PROGRAMA, :FU_HJAVIDA_AET.FU_OTRO_PROGRAMA,
:FU_HJAVIDA_AET.FU_INSTITUC_FORMAL, :FU_HJAVIDA_AET.FU_OTRAINSTITUCION,
:FU_HJAVIDA_AET.FU_AREA_FORMACION, :FU_HJAVIDA_AET.FU_IDIOMA,
:FU_HJAVIDA_AET.FU_NOMB_INSTIT_ADM, :FU_HJAVIDA_AET.FU_OTRA_ENT_ADM, :1)", &ErrMsg);
*/
/*Fin 001*/

Paso SQL
%SelectInit(EMPLID)
SELECT EMPLID
FROM %Table( FU_INFOHV_TBL )
WHERE run_cntl_id = %RunControl
AND oprid = %OperatorId
Paso PeopleCode
/* Inicio-001 */
import PSXP_RPTDEFNMANAGER:*;
Local
Local
Local
Local

PSXP_RPTDEFNMANAGER:ReportDefn &oRptDefn;
Record &rcdQryPrompts;
string &LanguageCd, &MyReportName, &MyTemplate, &OutFormat;
date &AsOfDate;

Local SQL &Sql;


Local array of any &arrayFetch = CreateArrayAny();
Local string &secciones;
Local boolean &success;
Local string &ErrMsg = "Ok";
/* parametros enviados a la plantilla */
Local array of string &ParamNames, &ParamValues;
&LanguageCd = "ESP";
&MyReportName = "FU_INFOHV_RD";
&MyTemplate = "FU_INFOHV_RD_1";
&OutFormat = "PDF";
&AsOfDate = %Date;
Warning MsgGetText(11111, 6, "OprId [%1], EmployeeId [%2], Proceso [%3] %ProcessInstance",
%OperatorId, %EmployeeId, FU_INFOHV_AET.PROCESS_INSTANCE.Value);
&success = SQLExec("Execute Fu_Info_Hojavida(:1, :2, :3)", FU_INFOHV_AET.EMPLID.Value,
FU_INFOHV_AET.PROCESS_INSTANCE.Value, &ErrMsg);
If (&success) Then
&Sql = CreateSQL("Select Listagg(To_Char('*' || Fu_Section_Id), ',') Within Group(Order
By Fu_Section_Id) Lista From Ps_Fu_Secc_Dtl_Tbl a Where a.Oprid = :1", %OperatorId);
While &Sql.Fetch(&arrayFetch)
/* Process the row in &arrayFetch . */
&secciones = &arrayFetch [1];
&ParamNames = CreateArray("xslt.SECCIONES");
&ParamValues = CreateArray("'" | &secciones | "'");
End-While;
&oRptDefn = create PSXP_RPTDEFNMANAGER:ReportDefn(&MyReportName);
&oRptDefn.Get();
/* fill query runtime prompt record */
&rcdQryPrompts = &oRptDefn.GetPSQueryPromptRecord();
If ( Not &rcdQryPrompts = Null) Then
/* La funcin Prompt no puede ejecutarse en Application Engine
If Not Prompt(&oRptDefn.GetDatasource().Name, "", &rcdQryPrompts) Then
Exit;
End-If;

*/
&rcdQryPrompts.PROCESS_INSTANCE.Value = FU_INFOHV_AET.PROCESS_INSTANCE.Value;
/*&rcdQryPrompts.GetField(1).Value = &BEGIN_DT;*/
&oRptDefn.SetPSQueryPromptRecord(&rcdQryPrompts);
End-If;
&oRptDefn.SetRuntimeProperties(&ParamNames, &ParamValues);
/*generate report*/
rem &OutFormat = &oRptDefn.GetOutDestFormatString(8);
/*
2 PDF
5 HTML
8 XLS
12 RTF
*/
&oRptDefn.OutDestination = %FilePath;
&oRptDefn.UseBurstValueAsOutputFileName = True;
&oRptDefn.ReportFileName = "Hoja_Vida_" | FU_INFOHV_AET.EMPLID.Value;
/*generate report*/
&oRptDefn.ProcessReport(&MyTemplate, &LanguageCd, &AsOfDate, &OutFormat);
End-If;
SQLExec("DELETE FROM Ps_Fu_Infor_Hv_Tmp WHERE PROCESS_INSTANCE=:1",
FU_INFOHV_AET.PROCESS_INSTANCE.Value);
/*001 Fin*/
PLSQL
Fu_Info_Hojavida(i_Emplid In Ps_Fu_Hjavida_Tmp.Emplid%Type,
Process In Ps_Fu_Hjavida_Tmp.Process_Instance%Type,
Errmsg
In Out Varchar2)