Reporte seguimiento solicitudes Brasil
Enviado por Spirits of the Capybara age of empires 2 definitive • 10 de Agosto de 2021 • Apuntes • 35.770 Palabras (144 Páginas) • 126 Visitas
[pic 1]
[pic 2]
|
Corporativo Cinepolis |
Especificación Técnica |
Reporte seguimiento solicitudes Brasil |
Contenido
Diseño de especificación 2
Proyecto 2
Component 3
Menu 3
Page 3
Record PeopleCode 4
Record 8
SQR 11
Diseño de especificación
El proyecto contiene: el Reporte de seguimiento a solicitudes, donde se agrego un filtro en la página del reporte para clasificadores OPEX y CAPEX así como campos adicionales para proyecto,referencia de presupuesto y referencia de pago.
Proyecto
Nombre: CPLPO_RPSEGSOLG_IMPV1
Existe/No Existe: No Existe
[pic 3][pic 4] [pic 5]
Page
Nombre: CPLPO_RPTRQF_PG
Existe/No Existe: Existe
[pic 6]
Record
Nombre: CPL_BU_VW
Existe/No Existe: Existe
[pic 7]
Nombre: CPL_PO_RCTRQF_TB
Existe/No Existe: Existe
[pic 8]
SQR
Nombre: CPLPORTR3.SQR
Existe/No Existe: Existe
!******************************************! ! AREYESG ! ! Cinepolis ! ! Seguimiento de Solicitudes ! ! 2019-12-09 ! ! Correccion de LEFT JOINS Extraccion de voucher y pago por procedures! ! 26-06-2020 ! ! cambio de rutinas de impresion para omitir libreria sylk! !******************************************!
#include 'setenv.sqc' !Set environment begin-setup #include 'ptset02.sqc' ! Init printer and page size #include 'setupdb.sqc' ! Database specific setup end-setup !----------------------------------------------------! ! !----------------------------------------------------! begin-report do Initialize do MainReport do Terminate do Commit-Transaction end-report !---------------------------------------------------------------------------------Initialize begin-procedure Initialize let #xRow = 3 do Init-DateTime do Define-Prcs-Vars do Get-Run-Control-Parms do Init-Number do Get-Run-Control-Parms-CPM !Do WriteHeader move 'CPLPORTR' to $ReportID do Get-Current-DateTime
end-procedure !----------------------------------------------------------------------------------Terminate begin-procedure Terminate if #prcs_process_instance > 0 do Update-Prcs-Run-Status end-if do Reset end-procedure !----------------------------------------------------------------------------------Get-Run-Control-Parms-CPM begin-procedure Get-Run-Control-Parms-CPM Let $where ='' Let $Flag ='' Let $Flag1 ='' Let $DescrRs ='' begin-select run_cntl.SETID run_cntl.BUSINESS_UNIT_GL run_cntl.FLAG run_cntl.FLAG1 to_char(run_cntl.DATE_BEGIN, 'dd/mm/yyyy') &DATEINI to_char(run_cntl.DATE_END, 'dd/mm/yyyy') &DATEFIN run_cntl.LANGUAGE_CD run_cntl.cplpo_capx_opx Let $SETID = &run_cntl.SETID Let $BU = &run_cntl.BUSINESS_UNIT_GL Let $Flag = &run_cntl.FLAG Let $Flag1 = &run_cntl.FLAG1 !Let $FIn = &run_cntl.DATE_BEGIN !Let $FFin = &run_cntl.DATE_END Let $FIn = strtodate(&DATEINI,'dd/mm/yyyy') Let $FFin = strtodate(&DATEFIN,'dd/mm/yyyy') Let $LANGUAGE_CD = &run_cntl.LANGUAGE_CD let $cplpo_capx_opx = &run_cntl.cplpo_capx_opx Let $BunitD = $BU DO Desc-Bu Let $DescrRs = $DescrBu
FROM SYSADM.PS_CPLPO_RCTRQF_TB run_cntl where run_cntl.OPRID = $prcs_oprid AND run_cntl.RUN_CNTL_ID = $prcs_run_cntl_id end-select end-procedure begin-procedure WriteHeader let #x = 9 let $separador = ',' begin-select to_char(sysdate,'dd/mm/yyyy') &dateR to_char(sysdate,'HH:MI:ss') &timeR let $DateReport = &dateR let $TimeReport = &timeR from dual end-select IF $LANGUAGE_CD ='POR'
WRITE 1 FROM 'Data Exec:' $SEPARADOR $DateReport WRITE 1 FROM 'Relatorio Rastreamento de Requisicoes' WRITE 1 FROM 'Hora: ' $SEPARADOR $TimeReport WRITE 1 FROM 'Id Relatorio: ' $SEPARADOR $ReportID WRITE 1 FROM 'Data Inicial: ' $SEPARADOR $FIn $SEPARADOR 'Data Final: ' $SEPARADOR $FFin
ELSE
WRITE 1 FROM 'Exec Date:' $SEPARADOR $DateReport WRITE 1 FROM 'Requisition Tracing Report' WRITE 1 FROM 'Hora: ' $SEPARADOR $TimeReport WRITE 1 FROM 'Report ID : ' $SEPARADOR $ReportID WRITE 1 FROM 'Starting Date:: ' $SEPARADOR $FIn $SEPARADOR 'End Date : ' $SEPARADOR $FFin
END-IF
end-procedure begin-procedure WriteHeaderPO let #x = 9 let $separador = ',' begin-select to_char(sysdate,'dd/mm/yyyy') &dateR2 to_char(sysdate,'HH:MI:ss') &timeR2 let $DateReport = &dateR2 let $TimeReport = &timeR2 from dual end-select IF $LANGUAGE_CD ='POR'
WRITE 1 FROM 'Data Exec:' $SEPARADOR $DateReport WRITE 1 FROM 'Relatorio Rastreamento de Requisicoes' WRITE 1 FROM 'Hora: ' $SEPARADOR $TimeReport WRITE 1 FROM 'Id Relatorio: ' $SEPARADOR $ReportID WRITE 1 FROM 'Data Inicial: ' $SEPARADOR $FIn $SEPARADOR 'Data Final: ' $SEPARADOR $FFin ELSE
WRITE 1 FROM 'Exec Date:' $SEPARADOR $DateReport WRITE 1 FROM 'Requisition Tracing Report' WRITE 1 FROM 'Hora: ' $SEPARADOR $TimeReport WRITE 1 FROM 'Report ID : ' $SEPARADOR $ReportID WRITE 1 FROM 'Starting Date:: ' $SEPARADOR $FIn $SEPARADOR 'End Date : ' $SEPARADOR $FFin
END-IF
end-procedure begin-procedure RevisaHdrs let $separador = ','
If $Flag1 = 'Y' !todas las BUS
If $Flag = 'Y' !Sumarizado Do EncabezadoSumarizado Else Do EncabezadoDetalle End-If
IF $LANGUAGE_CD ='POR' ELSE END-IF Do GetTodas_BU_por_SETID Else IF $LANGUAGE_CD ='POR' WRITE 1 FROM 'Nome da Empresa :' $SEPARADOR $BU $SEPARADOR $DescrRs
ELSE WRITE 1 FROM 'Business Name :' $SEPARADOR $BU $SEPARADOR $DescrRs
END-IF If $Flag = 'Y' Do EncabezadoSumarizado Else Do EncabezadoDetalle End-If
DO Genera-Reporte End-If
end-procedure begin-procedure RevisaHdrsPO let $separador = ',' If $Flag1 = 'Y' !todas las BUS
If $Flag = 'Y' !Sumarizado Do EncabezadoSumarizadoPO Else Do EncabezadoDetallePO End-If
IF $LANGUAGE_CD ='POR' ELSE END-IF Do GetTodas_BU_por_SETIDPO Else IF $LANGUAGE_CD ='POR' WRITE 1 FROM 'Nome da Empresa :' $SEPARADOR $BU $SEPARADOR $DescrRs
ELSE WRITE 1 FROM 'Business Name :' $SEPARADOR $BU $SEPARADOR $DescrRs
END-IF If $Flag = 'Y' Do EncabezadoSumarizadoPO Else Do EncabezadoDetallePO End-If
DO Genera-ReportePO End-If
end-procedure !----------------------------------------------------------------------! ! Procedure: Setid-Completo ! ! Description: Gets akk the BU's from the setid and calls the report ! !----------------------------------------------------------------------! Begin-Procedure GetTodas_BU_por_SETID let #Cont = 0 let #EntraInf = 0 Begin-Select BU.BUSINESS_UNIT LET $BU = '' Let $BU = &BU.BUSINESS_UNIT
if #cont >= 1 and #EntraInf = 1 let #x = #x + 2 end-if let #Cont = #Cont + 1 let #EntraInf = 0
Do Genera-Reporte FROM PS_BUS_UNIT_TBL_PM BU, PS_SET_CNTRL_TBL SETID WHERE SETID.SETID = $SETID AND BU.BUSINESS_UNIT = SETID.SETCNTRLVALUE ORDER BY BU.BUSINESS_UNIT End-Select End-Procedure Begin-Procedure Genera-Reporte let $where = '' If $Flag = 'Y' Let $where = $where || ' Where A.BUSINESS_UNIT = '''||$BU||'''' Let $where = $where || ' And A.REQ_DT BETWEEN TO_DATE('''||$FIn||''',''dd/mm/yyyy'')' ||' AND TO_DATE('''||$FFin ||''',''dd/mm/yyyy'' )'
!sigi if $cplpo_capx_opx ='CPX' Let $where = $where || ' AND D.PROJECT_ID <> '''||' '||'''' END-IF IF $cplpo_capx_opx ='OPX' Let $where = $where || ' AND D.PROJECT_ID = '''||' '||'''' END-IF !sigi
Do Seguimiento-Sumarizado Else Let $where = $where || ' Where RH1.BUSINESS_UNIT = '''||$BU||'''' Let $where = $where || ' and RH1.REQ_DT BETWEEN TO_DATE('''||$FIn||''',''dd/mm/yyyy'')' ||' AND TO_DATE('''||$FFin ||''',''dd/mm/yyyy'' )'
!sigi if $cplpo_capx_opx ='CPX' Let $where = $where || ' AND D1.PROJECT_ID <> '''||' '||'''' END-IF IF $cplpo_capx_opx ='OPX' Let $where = $where || ' AND D1.PROJECT_ID = '''||' '||'''' END-IF !sigi Do Seguimiento-Detalle End-If End-Procedure !----------------------------------------------------------------------! ! Procedure: Setid-Completo ! ! Description: Gets akk the BU's from the setid and calls the report ! !----------------------------------------------------------------------! Begin-Procedure GetTodas_BU_por_SETIDPO let #Cont = 0 let #EntraInf = 0 Begin-Select BU2.BUSINESS_UNIT LET $BU = '' Let $BU = &BU2.BUSINESS_UNIT
if #cont >= 1 and #EntraInf = 1 let #x = #x + 2 end-if let #Cont = #Cont + 1 let #EntraInf = 0
Do Genera-ReportePO FROM PS_BUS_UNIT_TBL_PM BU2, PS_SET_CNTRL_TBL SETID2 WHERE SETID2.SETID = $SETID AND BU2.BUSINESS_UNIT = SETID2.SETCNTRLVALUE ORDER BY BU2.BUSINESS_UNIT End-Select End-Procedure Begin-Procedure Genera-ReportePO let $where = '' If $Flag = 'Y' Let $where = $where || ' Where HP.BUSINESS_UNIT = '''||$BU||'''' Let $where = $where || ' And HP.PO_DT BETWEEN TO_DATE('''||$FIn||''',''dd/mm/yyyy'')' ||' AND TO_DATE('''||$FFin ||''',''dd/mm/yyyy'' )'
!sigi if $cplpo_capx_opx ='CPX' Let $where = $where || ' AND LDP.PROJECT_ID <> '''||' '||'''' END-IF IF $cplpo_capx_opx ='OPX' Let $where = $where || ' AND LDP.PROJECT_ID = '''||' '||'''' END-IF !sigi
Do Seguimiento-SumarizadoPO Else Let $where = $where || ' Where HP.BUSINESS_UNIT = '''||$BU||'''' Let $where = $where || ' and HP.PO_DT BETWEEN TO_DATE('''||$FIn||''',''dd/mm/yyyy'')' ||' AND TO_DATE('''||$FFin ||''',''dd/mm/yyyy'' )'
!sigi if $cplpo_capx_opx ='CPX' Let $where = $where || ' AND ldp.PROJECT_ID <> '''||' '||'''' END-IF IF $cplpo_capx_opx ='OPX' Let $where = $where || ' AND ldp.PROJECT_ID = '''||' '||'''' END-IF !sigi
Do Seguimiento-DetallePO End-If End-Procedure !---- Reporte Nivel Detalle Begin-Procedure Seguimiento-Detalle Let $Bu = '' Let $ReqId = '' Let $RequesId = '' Let $Reques = '' Let $Origin = '' Let $ReqSt = '' Let $ReqBud = '' Let $Class = '' Let $ReqDt = '' Let $UsrId = '' Let $Usr = '' Let $AprovalId = '' Let $AprovalNa = '' Let $CurrB = '' Let $CurrT = '' Let #ReqAmtT = 0 Let #ReqAmt = 0 Let #ReqAmtVat = 0 Let #ReqAmtBT = 0 Let #ReqAmtB = 0 Let #ReqAmtVatB = 0 Let $Account = '' Let $Altacct = '' Let $Deptid = '' Let $OperUnit = '' Let $Project = '' Let $BudgetR = '' Let $PoId = '' Let $PoSt = '' Let $Buyer = '' Let $VndrId = '' Let $VndrNm = '' Let $VndrSet = '' Let $Status = '' Let $Field = '' LET $Deptid = '' LET $Project = '' let $Class = ''
Let $PODt = '' Let #PoAmtT = 0 Let #PoAmt = 0 Let #PoAmtIPI = 0 Let #PoAmtST = 0 Let $POCurrB = '' Let $POCurrT = '' Let #PoAmtBT = 0 Let #PoAmtB = 0 Let #PoAmtIPIB = 0 Let #PoAmtSTB = 0
begin-select RH1.business_unit RH1.req_id RH1.REQUESTOR_ID RH1.ORIGIN RH1.REQ_STATUS RH1.BUDGET_HDR_STATUS RH1.REQ_DT RH1.OPRID_ENTERED_BY RH1.OPRID_APPROVED_BY RH1.CURRENCY_CD RH1.CURRENCY_CD_BASE D1.MERCHANDISE_AMT RVAT1.VAT_AMT D1.MERCH_AMT_BSE RVAT1.VAT_AMT_BASE D1.ACCOUNT D1.ALTACCT D1.DEPTID D1.OPERATING_UNIT D1.PROJECT_ID D1.BUDGET_REF HP1.PO_ID HP1.PO_STATUS HP1.TOF_PBL HP1.PO_DT LDP1.MERCHANDISE_AMT (select I.ADJ_AMT from sysadm.ps_PO_VAL_ADJ I where I.ADJ_TYPE = 'IPI' and I.Business_unit = LDP1.BUSINESS_UNIT and I.PO_ID = LDP1.PO_ID and I.LINE_NBR = LDP1.LINE_NBR and I.SCHED_NBR = LDP1.SCHED_NBR ) &Valor_IPI (select I.ADJ_AMT from sysadm.ps_PO_VAL_ADJ I where I.ADJ_TYPE = 'ISUB' and I.Business_unit = LDP1.BUSINESS_UNIT and I.PO_ID = LDP1.PO_ID and I.LINE_NBR = LDP1.LINE_NBR and I.SCHED_NBR = LDP1.SCHED_NBR ) &Valor_ST LDP1.CURRENCY_CD LDP1.MERCH_AMT_BSE (select I.ADJ_AMT_BSE from sysadm.ps_PO_VAL_ADJ I where I.ADJ_TYPE = 'IPI' and I.Business_unit = LDP1.BUSINESS_UNIT and I.PO_ID = LDP1.PO_ID and I.LINE_NBR = LDP1.LINE_NBR and I.SCHED_NBR = LDP1.SCHED_NBR ) &ValorB_IPI (select I.ADJ_AMT_BSE from sysadm.ps_PO_VAL_ADJ I where I.ADJ_TYPE = 'ISUB' and I.Business_unit = LDP1.BUSINESS_UNIT and I.PO_ID = LDP1.PO_ID and I.LINE_NBR = LDP1.LINE_NBR and I.SCHED_NBR = LDP1.SCHED_NBR ) &ValorB_ST LDP1.CURRENCY_CD_BASE HP1.BUYER_ID HP1.VENDOR_ID Let $Bu = &RH1.BUSINESS_UNIT Let $ReqId = &RH1.REQ_ID Let $RequesId = &RH1.REQUESTOR_ID Do Obtiene-Solicitante Let $Origin = &RH1.ORIGIN Let $ReqSt = &RH1.REQ_STATUS Let $ReqBud = &RH1.BUDGET_HDR_STATUS Let $ReqDt = EDIT(&RH1.REQ_DT, 'DD/MM/YYYY') Let $UsrId = &RH1.OPRID_ENTERED_BY Do Obtiene-Usuario Let $AprovalId = &RH1.OPRID_APPROVED_BY Do Obtiene-Aprobador Let $CurrB = &RH1.CURRENCY_CD_BASE Let $CurrT = &RH1.CURRENCY_CD Let #ReqAmtT = &D1.MERCHANDISE_AMT + &RVAT1.VAT_AMT Let #ReqAmt = &D1.MERCHANDISE_AMT Let #ReqAmtVat = &RVAT1.VAT_AMT Let #ReqAmtBT = &D1.MERCH_AMT_BSE + &RVAT1.VAT_AMT_BASE Let #ReqAmtB = &D1.MERCH_AMT_BSE Let #ReqAmtVatB = &RVAT1.VAT_AMT_BASE Let $Account = &D1.ACCOUNT Let $Altacct = &D1.ALTACCT Let $Deptid = &D1.DEPTID Let $OperUnit = &D1.OPERATING_UNIT Let $Project = &D1.PROJECT_ID Let $BudgetR = &D1.BUDGET_REF Let $PoId = &HP1.PO_ID Let $PoSt = &HP1.PO_STATUS Let $PoOF = &HP1.TOF_PBL
Let $PODt = EDIT(&HP1.PO_DT, 'DD/MM/YYYY') Let #PoAmtT = &LDP1.MERCHANDISE_AMT + &Valor_IPI + &Valor_ST Let #PoAmt = &LDP1.MERCHANDISE_AMT Let #PoAmtIPI = &Valor_IPI Let #PoAmtST = &Valor_ST Let $POCurrB = &LDP1.CURRENCY_CD_BASE Let $POCurrT = &LDP1.CURRENCY_CD Let #PoAmtBT = &LDP1.MERCH_AMT_BSE + &ValorB_IPI + &ValorB_ST Let #PoAmtB = &LDP1.MERCH_AMT_BSE Let #PoAmtIPIB = &ValorB_IPI Let #PoAmtSTB = &ValorB_ST
Let $Buyer = &HP1.BUYER_ID Let $VndrId = &HP1.VENDOR_ID
if $Deptid <> ' ' Let $Class = 'OPEX' END-IF
if $Project <> ' ' Let $Class = 'CAPEX' END-IF do Get_vendor_inf
do Imprime-Detalle
FROM ( ( ((( sysadm.PS_REQ_HDR RH1 LEFT JOIN sysadm.PS_REQ_LINE B1 ON RH1.BUSINESS_UNIT= B1.BUSINESS_UNIT AND RH1.REQ_ID = B1.REQ_ID) LEFT JOIN sysadm.PS_REQ_LINE_SHIP C ON B1.BUSINESS_UNIT=C.BUSINESS_UNIT AND B1.REQ_ID =C.REQ_ID AND B1.LINE_NBR =C.LINE_NBR) LEFT JOIN sysadm.PS_REQ_LN_DISTRIB D1 ON C.BUSINESS_UNIT=D1.BUSINESS_UNIT AND C.REQ_ID =D1.REQ_ID AND C.LINE_NBR =D1.LINE_NBR AND C.SCHED_NBR =D1.SCHED_NBR) LEFT JOIN PS_REQ_LN_DIST_VAT RVAT1 ON D1.BUSINESS_UNIT =RVAT1.BUSINESS_UNIT AND D1.REQ_ID =RVAT1.REQ_ID AND D1.LINE_NBR =RVAT1.LINE_NBR AND D1.SCHED_NBR =RVAT1.SCHED_NBR AND D1.DISTRIB_LINE_NUM=RVAT1.DISTRIB_LINE_NUM) left join ((( SYSADM.ps_po_hdr HP1 LEFT JOIN SYSADM.ps_po_line LP1 on HP1.business_unit = LP1.business_unit AND HP1.PO_ID = LP1.PO_ID) LEFT JOIN SYSADM.ps_po_line_ship LSP1 ON LP1.business_unit = LSP1.business_unit AND LP1.po_id = LSP1.po_id AND LP1.line_nbr = LSP1.line_nbr) LEFT JOIN sysadm.ps_po_line_distrib LDP1 ON LSP1.business_unit = LDP1.business_unit AND LSP1.po_id = LDP1.po_id AND LSP1.line_nbr = LDP1.line_nbr AND LSP1.sched_nbr = LDP1.sched_nbr) on !ECARVAJAL.- se cambia todo el amarre D1.business_unit = LDP1.business_unit AND D1.REQ_ID = LDP1.REQ_ID AND D1.line_nbr = LDP1.req_line_nbr AND D1.sched_nbr = LDP1.req_sched_nbr AND D1.DISTRIB_LINE_NUM = LDP1.req_distrib_nbr) [$where] ORDER BY RH1.business_unit, RH1.req_id,HP1.PO_ID end-select end-procedure Begin-Procedure Seguimiento-DetallePO Let $Bu = '' Let $Origin = '' Let $StatusDesc = '' Let $PoBud = '' Let $UsrId = '' Let $Usr = '' Let $AprovalId = '' Let $AprovalNa = '' Let $PoId = '' Let $PoSt = '' Let $Buyer = '' Let $VndrId = '' Let $VndrNm = '' Let $VndrSet = '' Let $Status = '' Let $Field = '' LET $Deptid = '' LET $Project = '' let $Class = '' Let $PODt = '' Let #POAmt = 0 Let #ValIPI = 0 Let #ValST = 0 Let $POCurrT = '' Let #POAmB = 0 Let #PoAmtBT = 0 Let #POAmB = 0 Let #ValBIPI = 0 Let #ValBST = 0 Let $POCurrB = ''
begin-select HP.BUSINESS_UNIT &BU3 HP.PO_ID &POID3 LP.CNTRCT_ID &CONTR HP.BUYER_ID &BUYER3 HP.ORIGIN &ORIGIN3 HP.TOF_PBL &OF3 HP.PO_STATUS &PO_STATUS3 HP.BUDGET_HDR_STATUS &BUDGET3 LDP.MERCHANDISE_AMT &POamt3 (select I.ADJ_AMT from sysadm.ps_PO_VAL_ADJ I where I.ADJ_TYPE = 'IPI' and I.Business_unit = LDP.BUSINESS_UNIT and I.PO_ID = LDP.PO_ID and I.LINE_NBR = LDP.LINE_NBR and I.SCHED_NBR = LDP.SCHED_NBR ) &Valor_IPI3 (select I.ADJ_AMT from sysadm.ps_PO_VAL_ADJ I where I.ADJ_TYPE = 'ISUB' and I.Business_unit = LDP.BUSINESS_UNIT and I.PO_ID = LDP.PO_ID and I.LINE_NBR = LDP.LINE_NBR and I.SCHED_NBR = LDP.SCHED_NBR ) &Valor_ST3 LDP.CURRENCY_CD &Moneda3 LDP.MERCH_AMT_BSE &POamtB3 (select I.ADJ_AMT_BSE from sysadm.ps_PO_VAL_ADJ I where I.ADJ_TYPE = 'IPI' and I.Business_unit = LDP.BUSINESS_UNIT and I.PO_ID = LDP.PO_ID and I.LINE_NBR = LDP.LINE_NBR and I.SCHED_NBR = LDP.SCHED_NBR ) &ValorB_IPI3 (select I.ADJ_AMT_BSE from sysadm.ps_PO_VAL_ADJ I where I.ADJ_TYPE = 'ISUB' and I.Business_unit = LDP.BUSINESS_UNIT and I.PO_ID = LDP.PO_ID and I.LINE_NBR = LDP.LINE_NBR and I.SCHED_NBR = LDP.SCHED_NBR ) &ValorB_ST3 LDP.CURRENCY_CD_BASE &MONEDA_BASE3 LDP.ACCOUNT &Accoun3 LDP.ALTACCT &AlAccount3 LDP.DEPTID &Deptid3 LDP.OPERATING_UNIT &OPUnit LDP.PROJECT_ID &pjto3 LDP.BUDGET_REF &BudRef3 HP.PO_DT &PO_DT3 HP.OPRID_ENTERED_BY &USER3 HP.OPRID_APPROVED_BY &APROV3 HP.VENDOR_ID &VENDOR3 Let $Bu = &BU3 Let $PoId = &POID3 Let $Contract = &CONTR Let $Buyer = &BUYER3 Let $Origin = &ORIGIN3 Let $OF = &OF3 Let $PoSt = &PO_STATUS3 Let $PoBud = &BUDGET3 Let #PoAmtT = &POamt3 + &Valor_IPI3 + &Valor_ST3 Let #PoAmt = &POamt3 Let #PoAmtIPI = &Valor_IPI3 Let #PoAmtST = &Valor_ST3 Let $POCurrB = &MONEDA_BASE3 Let $POCurrT = &Moneda3 Let #PoAmtBT = &POamtB3 + &ValorB_IPI3 + &ValorB_ST3 Let #PoAmtB = &POamtB3 Let #PoAmtIPIB = &ValorB_IPI3 Let #PoAmtSTB = &ValorB_ST3 Let $PODt = EDIT(&PO_DT3, 'DD/MM/YYYY') Let $UsrId = &USER3 Do Obtiene-Usuario Let $AprovalId = &APROV3 Let $Account = &Accoun3 Let $Altacct = &AlAccount3 Let $Deptid = &Deptid3 Let $OperUnit = &OPUnit Let $Project = &pjto3 Let $BudgetR = &BudRef3 Do Obtiene-Aprobador Let $VndrId = &VENDOR3 do Get_vendor_inf if $Deptid <> ' ' Let $Class = 'OPEX' END-IF if $Project <> ' ' Let $Class = 'CAPEX' END-IF do Imprime-DetallePO
FROM ((( SYSADM.ps_po_hdr Hp LEFT JOIN SYSADM.ps_po_line LP on HP.business_unit = lP.business_unit AND HP.PO_ID = LP.PO_ID) LEFT JOIN SYSADM.ps_po_line_ship LSP ON lp.business_unit = lsp.business_unit AND lp.po_id = lsp.po_id AND lp.line_nbr = lsp.line_nbr) LEFT JOIN sysadm.ps_po_line_distrib LDP ON lsp.business_unit = ldp.business_unit AND lsp.po_id = ldp.po_id AND lsp.line_nbr = ldp.line_nbr AND lsp.sched_nbr = ldp.sched_nbr) [$where] AND LDP.REQ_ID = ' ' order by 1,2 end-select end-procedure !----------------------------------------------------------------------! ! Procedure: Seguimiento-Sumarizado ! ! Description: Gets the requisitions info ! !----------------------------------------------------------------------! Begin-Procedure Seguimiento-Sumarizado Let $Bu = '' Let $ReqId = '' Let $RequesId = '' Let $Reques = '' Let $Origin = '' Let $ReqSt = '' Let $StatusDesc = '' Let $ReqBud = ''
Let #ReqAmtT = 0 Let #ReqAmt = 0 Let #ReqAmtVat = 0 Let #ReqAmtBT = 0 Let #ReqAmtB = 0 Let #ReqAmtVatB = 0
Let $CurrB = '' Let $CurrT = '' Let $ReqDt = '' Let $UsrId = '' Let $Usr = '' Let $AprovalId = '' Let $AprovalNa = '' Let $PoId = '' Let $PoSt = '' Let $Buyer = '' Let $VndrId = '' Let $VndrNm = '' Let $VndrSet = '' Let $Status = '' Let $Field = '' LET $Deptid = '' LET $Project = '' let $Class = '' Let $PODt = '' Let #POAmt = 0 Let #ValIPI = 0 Let #ValST = 0 Let $POCurrT = '' Let #POAmB = 0 Let #POAmBT = 0 Let #POAmB = 0 Let #ValBIPI = 0 Let #ValBST = 0 Let $POCurrB = '' Let $PostAP = '' Let $PoApDt = '' Let $PoBuSt = ''
begin-select A.business_unit A.req_id A.REQUESTOR_ID A.ORIGIN A.REQ_STATUS A.BUDGET_HDR_STATUS SUM(D.MERCHANDISE_AMT) &MerchAMT SUM(RVAT.VAT_AMT) &VatAMT A.CURRENCY_CD SUM(D.MERCH_AMT_BSE) &MerchBase SUm(RVAT.VAT_AMT_BASE) &VatBase A.CURRENCY_CD_BASE A.REQ_DT A.OPRID_ENTERED_BY A.OPRID_APPROVED_BY D.DEPTID D.PROJECT_ID D.budget_ref HP.PO_ID HP.PO_STATUS HP.TOF_PBL HP.PO_DT sum(LDP.MERCHANDISE_AMT) &POMerchAMT LDP.CURRENCY_CD sum (LDP.MERCH_AMT_BSE) &POMerchAMTB LDP.CURRENCY_CD_BASE HP.BUYER_ID Hp.VENDOR_ID RH.RECEIVER_ID RH.RECV_STATUS RH.NF_BRL_PBL RH.NF_BRL_DATE RH.NF_BRL_SERIES NFT.NF_BRL_TYPE NFH.NF_BRL_ID NFH.NF_BRL_STATUS NFH.NF_BRL_TYPE HP.APPROVAL_DT HP.BUDGET_HDR_STATUS B.merch_amt_bse &b.merch_amt_bse1 !ultimo cambio Let $Bu = &A.BUSINESS_UNIT Let $ReqId = &A.REQ_ID Let $RequesId = &A.REQUESTOR_ID Do Obtiene-Solicitante Let $Origin = &A.ORIGIN Let $ReqSt = &A.REQ_STATUS Let $ReqBud = &A.BUDGET_HDR_STATUS ! let $bugl = &V.BUSINESS_UNIT Let #ReqAmtT = &MerchAMT + &VatAMT Let #ReqAmt = &MerchAMT Let #ReqAmtVat = &VatAMT Let #ReqAmtBT = &MerchBase + &VatBase Let #ReqAmtB = &MerchBase Let #ReqAmtVatB = &VatBase
!Do Obtiene-Montos Let $CurrB = &A.CURRENCY_CD_BASE Let $CurrT = &A.CURRENCY_CD Let $ReqDt = EDIT(&A.REQ_DT, 'DD/MM/YYYY') Let $PoApDt = EDIT(&HP.APPROVAL_DT, 'DD/MM/YYYY') Let $UsrId = &A.OPRID_ENTERED_BY Do Obtiene-Usuario Let $AprovalId = &A.OPRID_APPROVED_BY Let $Deptid = &D.DEPTID Let $Project = &D.PROJECT_ID !sigi let $budget_ref = &D.budget_ref Do Obtiene-Aprobador Let $PoId = &HP.PO_ID Let $PoSt = &HP.PO_STATUS Let $PoBuSt = &HP.BUDGET_HDR_STATUS !let ultimo cambio let $merch_amt_bse =&b.merch_amt_bse1 Let $PoOF = &HP.TOF_PBL
Let $PODt = EDIT(&HP.PO_DT, 'DD/MM/YYYY')
Do Get_Impostos
Let #POAmt = &POMerchAMT Let #POAmtT = #POAmt + #ValIPI + #ValST Let $POCurrT = &LDP.CURRENCY_CD Let #POAmB = &POMerchAMTB Let #POAmBT = #POAmB + #ValBIPI + #ValBST Let $POCurrB = &LDP.CURRENCY_CD_BASE Let $Buyer = &HP.BUYER_ID Let $VndrId = &HP.VENDOR_ID do Get_vendor_inf let $IdRecepcion = &RH.RECEIVER_ID let $RecvStatus = &RH.RECV_STATUS LET $IdFactura = &RH.NF_BRL_PBL LET $NFdt = EDIT(&RH.NF_BRL_DATE,'DD/MM/YYYY') LET $NFS = &RH.NF_BRL_SERIES let $NFT = &NFT.NF_BRL_TYPE let $DocFiscal = &NFH.NF_BRL_ID let $DocStatus = &NFH.NF_BRL_STATUS let $NFT2 = &NFH.NF_BRL_TYPE
let $NFtype = $NFT if $NFT = '' let $NFtype = $NFT2 end-if
if $Deptid <> ' ' Let $Class = 'OPEX' END-IF
if $Project <> ' ' Let $Class = 'CAPEX' END-IF
let #EntraInf = 1
DO obtiene_voucher if $EXISTE_V = 'N' do Imprime-Sumarizado end-if let $IdComprobanteANT = $IdComprobante
Let $Bu = '' Let $ReqId = '' Let $RequesId = '' Let $Reques = '' Let $Origin = '' Let $ReqSt = '' Let $StatusDesc = '' LET $PoBuSt_desc = '' Let $ReqBud = '' Let $Class = '' LET #POAmtT = 0 Let #ReqAmtT = 0 Let #ReqAmt = 0 Let #ReqAmtVat = 0 Let #ReqAmtBT = 0 Let #ReqAmtB = 0 Let #ReqAmtVatB = 0
Let $CurrB = '' Let $CurrT = '' Let $ReqDt = '' Let $UsrId = '' Let $Usr = '' Let $AprovalId = '' Let $AprovalNa = '' Let $PoApDt = '' Let $PoId = '' Let $PoSt = '' Let $PODt = '' Let $PoBuSt = ''
Let #POAmt = 0 Let #ValIPI = 0 Let #ValST = 0 Let $POCurrT = '' Let #POAmB = 0 Let #POAmBT = 0 Let #POAmB = 0 Let #ValBIPI = 0 Let #ValBST = 0 Let $POCurrB = '' Let $PYMNT_ID ='' LET $PymntStatus_desc = ''
Let $Buyer = '' Let $VndrId = '' Let $VndrNm = '' Let $VndrSet = '' Let $Status = '' Let $Field = '' LET $ReqBud_desc = '' LET $PoSt_desc = '' LET $PoBuSt_desc = '' LET $RecvStatus_desc = ''
FROM ((((( ( ((( sysadm.PS_REQ_HDR A LEFT JOIN sysadm.PS_REQ_LINE B ON A.BUSINESS_UNIT= B.BUSINESS_UNIT AND A.REQ_ID = B.REQ_ID) LEFT JOIN sysadm.PS_REQ_LINE_SHIP C ON B.BUSINESS_UNIT=C.BUSINESS_UNIT AND B.REQ_ID =C.REQ_ID AND B.LINE_NBR =C.LINE_NBR) LEFT JOIN sysadm.PS_REQ_LN_DISTRIB D ON C.BUSINESS_UNIT=D.BUSINESS_UNIT AND C.REQ_ID =D.REQ_ID AND C.LINE_NBR =D.LINE_NBR AND C.SCHED_NBR =D.SCHED_NBR) LEFT JOIN sysadm.PS_REQ_LN_DIST_VAT RVAT ON D.BUSINESS_UNIT =RVAT.BUSINESS_UNIT AND D.REQ_ID =RVAT.REQ_ID AND D.LINE_NBR =RVAT.LINE_NBR AND D.SCHED_NBR =RVAT.SCHED_NBR AND D.DISTRIB_LINE_NUM=RVAT.DISTRIB_LINE_NUM) left join ((( SYSADM.ps_po_hdr Hp LEFT JOIN SYSADM.ps_po_line LP on HP.business_unit = lP.business_unit AND HP.PO_ID = LP.PO_ID) LEFT JOIN SYSADM.ps_po_line_ship LSP ON lp.business_unit = lsp.business_unit AND lp.po_id = lsp.po_id AND lp.line_nbr = lsp.line_nbr) LEFT JOIN sysadm.ps_po_line_distrib LDP ON lsp.business_unit = ldp.business_unit AND lsp.po_id = ldp.po_id AND lsp.line_nbr = ldp.line_nbr AND lsp.sched_nbr = ldp.sched_nbr) on !ECARVAJAL.- se cambia el amarre d.business_unit = ldp.business_unit AND D.REQ_ID = LDP.REQ_ID AND d.line_nbr = ldp.req_line_nbr AND d.sched_nbr = ldp.req_sched_nbr AND d.DISTRIB_LINE_NUM = LDP.req_distrib_nbr) left join (((sysadm.ps_recv_hdr RH left join sysadm.PS_CPLPO_NFRCP_TBL NFT on RH.BUSINESS_UNIT = NFT.BUSINESS_UNIT and RH.RECEIVER_ID = NFT.RECEIVER_ID ) LEFT JOIN sysadm.ps_RECV_LN_SHIP RLS on RH.BUSINESS_UNIT=RLS.BUSINESS_UNIT AND RH.RECEIVER_ID =RLS.RECEIVER_ID ) LEFT JOIN sysadm.ps_RECV_LN_DISTRIB RLD ON RLS.BUSINESS_UNIT = RLD.BUSINESS_UNIT AND RLS.RECEIVER_ID = RLD.RECEIVER_ID AND RLS.RECV_LN_NBR = RLD.RECV_LN_NBR AND RLS.RECV_SHIP_SEQ_NBR= RLD.RECV_SHIP_SEQ_NBR) ON !ECARVAJAL.- se cambia el amarre LDP.BUSINESS_UNIT = RLD.BUSINESS_UNIT AND LDP.PO_ID = RLD.PO_ID AND LDP.line_nbr = RLD.line_nbr AND LDP.sched_nbr = RLD.recv_ship_seq_nbr AND LDP.DISTRIB_LINE_NUM = RLD.po_dist_line_num) !OSANCHEZ - Se agrega join para el documento fiscal !AREYESG Se corrige join para el documento fiscal LEFT JOIN sysadm.PS_NF_HDR_BRL NFH ON RLD.BUSINESS_UNIT = NFH.BUSINESS_UNIT_RECV AND RLD.RECEIVER_ID = NFH.RECEIVER_ID))) [$where] GROUP BY A.business_unit, A.req_id, A.REQUESTOR_ID, A.ORIGIN, A.REQ_STATUS, A.BUDGET_HDR_STATUS, A.CURRENCY_CD, A.CURRENCY_CD_BASE, A.REQ_DT, A.OPRID_ENTERED_BY, A.OPRID_APPROVED_BY, D.DEPTID, D.PROJECT_ID, D.BUDGET_REF, HP.PO_ID, Hp.PO_STATUS, HP.TOF_PBL, HP.PO_DT, LDP.CURRENCY_CD, LDP.CURRENCY_CD_BASE, HP.BUYER_ID, Hp.VENDOR_ID, RH.RECEIVER_ID, RH.RECV_STATUS, RH.NF_BRL_PBL, RH.NF_BRL_DATE, RH.NF_BRL_SERIES, NFT.NF_BRL_TYPE, NFH.NF_BRL_ID, NFH.NF_BRL_STATUS, NFH.NF_BRL_TYPE, HP.APPROVAL_DT, HP.BUDGET_HDR_STATUS, B.merch_amt_bse ORDER BY A.business_unit, A.req_id,HP.PO_ID end-select end-procedure !----------------------------------------------------------------------! ! Procedure: Seguimiento-SumarizadoPO ! ! Description: Gets the requisitions info ! !----------------------------------------------------------------------! Begin-Procedure Seguimiento-SumarizadoPO Let $Bu = '' Let $Origin = '' Let $StatusDesc = '' Let $PoBud = '' Let $UsrId = '' Let $Usr = '' Let $AprovalId = '' Let $AprovalNa = '' Let $PoId = '' Let $PoSt = '' Let $Buyer = '' Let $VndrId = '' Let $VndrNm = '' Let $VndrSet = '' Let $Status = '' Let $Field = '' LET $Deptid = '' let $budget_ref ='' LET $Project = '' let $Class = '' Let $PODt = '' let $PYMNT_ID2 = '' Let #POAmt = 0 Let #ValIPI = 0 Let #ValST = 0 Let $POCurrT = '' Let #POAmB = 0 Let #POAmBT = 0 Let #POAmB = 0 Let #ValBIPI = 0 Let #ValBST = 0 Let $POCurrB = '' Let $PoApDt = '' Let $PoApSt = ''
begin-select HP.BUSINESS_UNIT &BU2 HP.PO_ID &POID2 HP.BUYER_ID &BUYER2 HP.ORIGIN &ORIGIN2 HP.TOF_PBL &OF HP.PO_STATUS &PO_STATUS2 HP.BUDGET_HDR_STATUS &BUDGET2 sum(LDP.MERCHANDISE_AMT) &POmonto LDP.CURRENCY_CD &MONEDA2 sum(LDP.MERCH_AMT_BSE) &POmonto_base LDP.CURRENCY_CD_BASE &MONEDA_BASE2 LDP.DEPTID &DPTO2 LDP.PROJECT_ID &PJTO2 LDP.budget_ref &budget_refPO HP.PO_DT &PO_DT2 HP.OPRID_ENTERED_BY &USER2 HP.OPRID_APPROVED_BY &APROV2 HP.VENDOR_ID &VENDOR2 RH.RECEIVER_ID &RECV2 RH.RECV_STATUS &RECV_STATUS2 RH.NF_BRL_PBL &NF2 RH.NF_BRL_DATE &NFDT2 RH.NF_BRL_SERIES &NFSERIE2 NFT.NF_BRL_TYPE &NFTYPE2 NFH.NF_BRL_ID &NFID2 NFH.NF_BRL_STATUS &NFSTATUS2 NFH.NF_BRL_TYPE &NFSTYPES22 HP.APPROVAL_DT &APPROVAL_DT Let $Bu = &BU2 Let $PoId = &POID2 Let $Buyer = &BUYER2 Let $Origin = &ORIGIN2 Let $OF = &OF Let $PoSt = &PO_STATUS2 Let $PoBud = &BUDGET2 !Let $PoApSt = &PoApDt2 !let $bugl2 = &BUSINESS_UNIT2 DO Get_Contrato
Do Get_Impostos
Let #POAmt = &POmonto Let #POAmtT = #POAmt + #ValIPI + #ValST Let $POCurrT = &MONEDA2 Let #POAmB = &POmonto_base Let #POAmBT = #POAmB + #ValBIPI + #ValBST Let $POCurrB = &MONEDA_BASE2 Let $PODt = EDIT(&PO_DT2, 'DD/MM/YYYY') Let $UsrId = &USER2 Do Obtiene-Usuario Let $AprovalId = &APROV2 Let $Deptid = &DPTO2 Let $Project = &PJTO2 let $budget_refPO = &budget_refPO Do Obtiene-Aprobador Let $VndrId = &VENDOR2 do Get_vendor_inf let $IdRecepcion = &RECV2 let $RecvStatus = &RECV_STATUS2 LET $IdFactura = &NF2 LET $NFdt = EDIT(&NFDT2,'DD/MM/YYYY') LET $NFS = &NFSERIE2 let $NFT = &NFTYPE2 let $DocFiscal = &NFID2 let $DocStatus = &NFSTATUS2 let $NFT2 = &NFSTYPES22 Let $PoApDt = EDIT(&APPROVAL_DT, 'DD/MM/YYYY') let $NFtype = $NFT if $NFT = '' let $NFtype = $NFT2 end-if
!let $IdComprobante2 = &VOCUHER2 !LET $PYMNT_ID2 = &PYMNT_ID2 !SHOW $PYMNT_ID2 !let $PymntStatus = &PAGO2
if $Deptid <> ' ' Let $Class = 'OPEX' END-IF
if $Project <> ' ' Let $Class = 'CAPEX' END-IF
let #EntraInf = 1 do obtiene_voucher2
if $EXISTE_V2 = 'N' do Imprime-SumarizadoPO END-IF Let $Bu = '' Let $Contract = '' Let $UsrId = '' Let $Usr = '' Let $PoId = '' Let $Buyer = '' Let $Origin = '' Let $OF = '' Let $Class = '' Let $StatusDesc = '' Let $UsrId = '' Let $Usr = '' Let $AprovalId = '' Let $AprovalNa = '' Let $PoId = '' Let $PoSt = '' Let $PODt = '' Let #POAmt = 0 LET #POAmtT = 0 Let #ValIPI = 0 Let #ValST = 0 Let $POCurrT = '' Let #POAmB = 0 Let #POAmBT = 0 Let #POAmB = 0 Let #ValBIPI = 0 Let #ValBST = 0 Let $POCurrB = '' Let $Buyer = '' Let $VndrId = '' Let $VndrNm = '' Let $VndrSet = '' Let $Status = '' Let $Field = '' Let $IdComprobante = '' Let $PYMNT_ID2 = '' Let $IdRecepcion = '' Let $IdFactura = '' Let $NFdt = '' Let $NFS = '' Let $NFtype = '' Let $DocFiscal = '' Let $PoApDt = '' Let $PoApSt = '' LET $RecvStatus_DESC = '' LET $DocStatus_DESC = '' LET $PoSt_DESC = '' LET $PYMNT_ID2 = '' LET $PymntStatus2_desc = '' let $PJTO2 ='' let $budget_refPO =''
FROM ((((((( SYSADM.ps_po_hdr Hp LEFT JOIN SYSADM.ps_po_line LP on HP.business_unit = lP.business_unit AND HP.PO_ID = LP.PO_ID) LEFT JOIN SYSADM.ps_po_line_ship LSP ON lp.business_unit = lsp.business_unit AND lp.po_id = lsp.po_id AND lp.line_nbr = lsp.line_nbr) LEFT JOIN sysadm.ps_po_line_distrib LDP ON lsp.business_unit = ldp.business_unit AND lsp.po_id = ldp.po_id AND lsp.line_nbr = ldp.line_nbr AND lsp.sched_nbr = ldp.sched_nbr ) left join (( (sysadm.ps_recv_hdr RH left join sysadm.PS_CPLPO_NFRCP_TBL NFT on RH.BUSINESS_UNIT = NFT.BUSINESS_UNIT and RH.RECEIVER_ID = NFT.RECEIVER_ID ) LEFT JOIN sysadm.ps_RECV_LN_SHIP RLS on RH.BUSINESS_UNIT=RLS.BUSINESS_UNIT AND RH.RECEIVER_ID =RLS.RECEIVER_ID ) LEFT JOIN sysadm.ps_RECV_LN_DISTRIB RLD ON RLS.BUSINESS_UNIT = RLD.BUSINESS_UNIT AND RLS.RECEIVER_ID = RLD.RECEIVER_ID AND RLS.RECV_LN_NBR = RLD.RECV_LN_NBR AND RLS.RECV_SHIP_SEQ_NBR= RLD.RECV_SHIP_SEQ_NBR) ON
LDP.BUSINESS_UNIT = RLD.BUSINESS_UNIT AND LDP.PO_ID = RLD.PO_ID AND LDP.line_nbr = RLD.line_nbr AND LDP.sched_nbr = RLD.recv_ship_seq_nbr AND LDP.DISTRIB_LINE_NUM = RLD.po_dist_line_num ) LEFT JOIN sysadm.PS_NF_HDR_BRL NFH ON RLD.BUSINESS_UNIT = NFH.BUSINESS_UNIT_RECV AND RLD.RECEIVER_ID = NFH.RECEIVER_ID))) [$where] AND LDP.REQ_ID = ' ' GROUP BY HP.Business_unit, HP.PO_ID, HP.Buyer_id, Hp.ORIGIN, Hp.TOF_PBL, HP.PO_STATUS, HP.BUDGET_HDR_STATUS, LDP.CURRENCY_CD, LDP.CURRENCY_CD_BASE, LDP.DEPTID, LDP.PROJECT_ID, LDP.BUDGET_REF, HP.PO_DT, HP.OPRID_ENTERED_BY, HP.OPRID_APPROVED_BY, HP.BUYER_ID, Hp.VENDOR_ID, RH.RECEIVER_ID, RH.RECV_STATUS, RH.NF_BRL_PBL, RH.NF_BRL_DATE, RH.NF_BRL_SERIES, NFT.NF_BRL_TYPE, NFH.NF_BRL_ID, NFH.NF_BRL_STATUS, NFH.NF_BRL_TYPE, HP.APPROVAL_DT order by 1,2 end-select end-procedure begin-procedure Get_Contrato Let $Contract = ' ' begin-select distinct LL.CNTRCT_ID Let $Contract = &LL.CNTRCT_ID from sysadm.PS_PO_LINE LL where LL.Business_unit = $Bu and LL.PO_ID = $PoId and LL.CNTRCT_ID <> ' ' end-select end-procedure !----------------------------------------------------------------------! ! Procedure: Get_Impostos ! ! Description: gets the IPI and ICMS ST ! !----------------------------------------------------------------------! begin-procedure Get_Impostos Let #ValIPI = 0 Let #ValST = 0 Let #ValBIPI = 0 Let #ValBST = 0 begin-select !Valor IPI Sum(I.ADJ_AMT) &ValorIPI Let #ValIPI = &ValorIPI from sysadm.ps_PO_VAL_ADJ I where I.ADJ_TYPE = 'IPI' and I.Business_unit = $Bu and I.PO_ID = $PoId end-select begin-select !Valor ST Sum(I.ADJ_AMT) &ValorST Let #ValST = &ValorST from sysadm.ps_PO_VAL_ADJ I where I.ADJ_TYPE = 'ISUB' and I.Business_unit = $Bu and I.PO_ID = $PoId end-select begin-select !Valor Base IPI Sum(I.ADJ_AMT_BSE) &ValorBIPI Let #ValBIPI = &ValorBIPI from sysadm.ps_PO_VAL_ADJ I where I.ADJ_TYPE = 'IPI' and I.Business_unit = $Bu and I.PO_ID = $PoId end-select begin-select ! Valor Base ST Sum(I.ADJ_AMT_BSE) &ValorBST Let #ValBST = &ValorBST from sysadm.ps_PO_VAL_ADJ I where I.ADJ_TYPE = 'ISUB' and I.Business_unit = $Bu and I.PO_ID = $PoId end-select end-procedure !Get_Impostos !----------------------------------------------------------------------! ! Procedure: Obtiene-Solicitante ! ! Description: gets the requestor description ! !----------------------------------------------------------------------! begin-procedure Obtiene-Solicitante Let $Reques = ' ' begin-select SOL.OPRDEFNDESC let $Reques = &SOL.OPRDEFNDESC from PS_PO_OPRDEFN_VW SOL where SOL.OPRID = $RequesId end-select end-procedure !----------------------------------------------------------------------! ! Procedure: Obtiene-Usuario ! ! Description: gets the user description ! !----------------------------------------------------------------------! begin-procedure Obtiene-Usuario Let $Usr = ' ' begin-select USR.OPRDEFNDESC let $Usr = &USR.OPRDEFNDESC from PSOPRDEFN USR where USR.OPRID = $UsrId end-select end-procedure !----------------------------------------------------------------------! ! Procedure: Obtiene-Aprovador ! ! Description: gets the aprover description ! !----------------------------------------------------------------------! begin-procedure Obtiene-Aprobador Let $AprovalNa = ' ' begin-select APR.OPRDEFNDESC let $AprovalNA = &APR.OPRDEFNDESC from PSOPRDEFN APR where APR.OPRID = $AprovalId end-select end-procedure !**** PROCEDIMIENTO PARA EXTRAER VENDOR INF.
begin-procedure Get_vendor_inf begin-select VNDR.Setid VNDR.NAME1 LET $VndrNm = &VNDR.NAME1 LET $VndrSet = &VNDR.Setid FROM PS_VENDOR VNDR WHERE VNDR.SETID= $SETID AND VENDOR_ID= $VndrId end-select end-procedure Begin-procedure EncabezadoSumarizado IF $LANGUAGE_CD ='POR'
WRITE 1 FROM ' ' WRITE 1 FROM 'Unidade de Negocio' $SEPARADOR 'Id Requisicao' $SEPARADOR 'Id Requisitante' $SEPARADOR 'Requisitante' $SEPARADOR 'Status Requisicao' $SEPARADOR 'Status do Orcamento' $SEPARADOR 'Valor da Mercadoria' $SEPARADOR 'Moeda da Transacao' $SEPARADOR 'Valor Base' $SEPARADOR 'Moeda Base' $SEPARADOR 'Data da Requisicao' $SEPARADOR 'ID Usuario' $SEPARADOR 'Usuario' $SEPARADOR 'Id Aprovador' $SEPARADOR 'Aprovador' $SEPARADOR 'Data da Aprovacao' $SEPARADOR 'Origem' $SEPARADOR 'Classificador' $SEPARADOR 'Projeto' $SEPARADOR 'R Orcamento' $SEPARADOR 'Id OC' $SEPARADOR 'Status da OC' $SEPARADOR 'Status do Orcamento' $SEPARADOR 'OF' $SEPARADOR 'Data da OC' $SEPARADOR 'Valor da Mercadoria' $SEPARADOR 'Valor IPI' $SEPARADOR 'Valor ST' $SEPARADOR 'Valor Total' $SEPARADOR 'Moeda da Transacao' $SEPARADOR 'Valor Base' $SEPARADOR 'Valor Base IPI' $SEPARADOR 'Valor Base ST' $SEPARADOR 'Valor Base Total' $SEPARADOR 'Moeda Base' $SEPARADOR 'Comprador' $SEPARADOR 'SETID Fornecedor' $SEPARADOR 'Id Fornecedor' $SEPARADOR 'Nome Fornecedor' $SEPARADOR 'Id Recebimento' $SEPARADOR 'Status Recebimento' $SEPARADOR 'Documento Fiscal' $SEPARADOR 'Data Emissao Doc.Fiscal' $SEPARADOR 'Serie Documento Fiscal' $SEPARADOR 'Tipo' $SEPARADOR 'ID Nota Fiscal' $SEPARADOR 'Status Nota Fiscal' $SEPARADOR 'Id Voucher' $SEPARADOR 'Status Voucher' $SEPARADOR 'Pagamento Id' $SEPARADOR 'Status Pagamento' $SEPARADOR 'R Pagamento' else WRITE 1 FROM ' ' WRITE 1 FROM 'Business Unit' $SEPARADOR 'Requisition Id' $SEPARADOR 'Requestor Id' $SEPARADOR 'Requestor' $SEPARADOR 'Req. Status' $SEPARADOR 'Budget' $SEPARADOR 'Transaction Total Amt' $SEPARADOR 'Transaction Amount' $SEPARADOR 'Transaction Tax Amount' $SEPARADOR 'Trans. Currency' $SEPARADOR 'Request Date' $SEPARADOR 'ID User' $SEPARADOR 'User' $SEPARADOR 'Approver Id' $SEPARADOR 'Approver' $SEPARADOR 'Approval Date' $SEPARADOR 'Origin' $SEPARADOR 'Budget Classifier' $SEPARADOR 'Proyect' $SEPARADOR 'Budget Ref' $SEPARADOR 'Purchase Order' $SEPARADOR 'Status da OC' $SEPARADOR 'Budget PO' $SEPARADOR 'OF' $SEPARADOR 'PO Date' $SEPARADOR 'Transaction Amount' $SEPARADOR 'IPI Amount' $SEPARADOR 'ST Amount' $SEPARADOR 'Total Amount' $SEPARADOR 'Trans. Currency' $SEPARADOR 'Base Amt' $SEPARADOR 'Base IPI Amount' $SEPARADOR 'Base ST Amount' $SEPARADOR 'Base Total Amount' $SEPARADOR 'Base Currency' $SEPARADOR 'Buyer ID' $SEPARADOR 'Vendor SETID' $SEPARADOR 'Vendor Id' $SEPARADOR 'Vendor Name' $SEPARADOR 'Receiver Id' $SEPARADOR 'Receiver Status' $SEPARADOR 'Invoice ID' $SEPARADOR 'Date of issue' $SEPARADOR 'Serie' $SEPARADOR 'Type' $SEPARADOR 'Fiscal Note ID' $SEPARADOR 'Fiscal Note Status' $SEPARADOR 'voucher Id' $SEPARADOR 'Status voucher' $SEPARADOR 'Pymnt Id' $SEPARADOR 'Pymnt Status' $SEPARADOR 'R Payment'
END-IF end-procedure Begin-procedure EncabezadoSumarizadoPO IF $LANGUAGE_CD ='POR' WRITE 1 FROM ' ' WRITE 1 FROM 'Unidade de Negocio' $SEPARADOR 'ID Usuario' $SEPARADOR 'Usuario' $SEPARADOR 'Id Aprovador' $SEPARADOR 'Aprovador' $SEPARADOR 'Data da Aprovacao' $SEPARADOR 'Origem' $SEPARADOR 'Classificador' $SEPARADOR 'Projeto' $SEPARADOR 'R Orcamento' $SEPARADOR 'ID OC' $SEPARADOR 'Status da OC' $SEPARADOR 'Status do Orcamento' $SEPARADOR 'OF' $SEPARADOR 'Data da OC' $SEPARADOR 'Valor da Mercadoria' $SEPARADOR 'Valor IPI' $SEPARADOR 'Valor ST' $SEPARADOR 'Valor Total' $SEPARADOR 'Moeda da Transacao' $SEPARADOR 'Valor Base' $SEPARADOR 'Valor Base IPI' $SEPARADOR 'Valor Base ST' $SEPARADOR 'Valor Base Total' $SEPARADOR 'Moeda Base' $SEPARADOR 'Comprador' $SEPARADOR 'SETID Fornecedor' $SEPARADOR 'Id Fornecedor' $SEPARADOR 'Nome' $SEPARADOR 'Id Recebimento' $SEPARADOR 'Status Recebimento' $SEPARADOR 'Documento Fiscal' $SEPARADOR 'Data Emissao Doc.Fiscal' $SEPARADOR 'Serie Documento Fiscal' $SEPARADOR 'Tipo' $SEPARADOR 'ID Nota Fiscal' $SEPARADOR 'Status Nota Fiscal' $SEPARADOR 'Id Voucher' $SEPARADOR 'Status Voucher' $SEPARADOR 'Pagamento Id' $SEPARADOR 'Status Pagamento' $SEPARADOR 'R Pagamento'
else WRITE 1 FROM ' ' WRITE 1 FROM 'Business Unit' $SEPARADOR 'User Id' $SEPARADOR 'User' $SEPARADOR 'Aprover Id' $SEPARADOR 'Aprover' $SEPARADOR 'Date Aprover' $SEPARADOR 'Origen' $SEPARADOR 'Budget Classifier' $SEPARADOR 'Proyect' $SEPARADOR 'Budget Ref' $SEPARADOR 'Purchase Order' $SEPARADOR 'Status OC' $SEPARADOR 'Budgeto' $SEPARADOR 'OF' $SEPARADOR 'PO Date' $SEPARADOR 'Transaction Amount' $SEPARADOR 'IPI Amount' $SEPARADOR 'ST Amount' $SEPARADOR 'Total Amount' $SEPARADOR 'Trans. Currency' $SEPARADOR 'Base Amt' $SEPARADOR 'Base IPI Amount' $SEPARADOR 'Base ST Amount' $SEPARADOR 'Base Total Amount' $SEPARADOR 'Base Currency' $SEPARADOR 'Buyer ID' $SEPARADOR 'Vendor SETID' $SEPARADOR 'Vendor Id' $SEPARADOR 'Vendor Name' $SEPARADOR 'Receiver Id' $SEPARADOR 'Receiver Status' $SEPARADOR 'Invoice ID' $SEPARADOR 'Date of issue' $SEPARADOR 'Serie' $SEPARADOR 'Type' $SEPARADOR 'Fiscal Note ID' $SEPARADOR 'Fiscal Note Status' $SEPARADOR 'voucher Id' $SEPARADOR 'Status voucher' $SEPARADOR 'Pymnt Id' $SEPARADOR 'Pymnt Status' $SEPARADOR 'R Payment'
END-IF end-procedure !---- procedimiento para imprimir el Detalle begin-procedure Imprime-Detalle
Let $Status = $ReqSt Let $Field = 'REQ_STATUS' If $LANGUAGE_CD <> 'POR' Do Obtengo_desc_Status_gnral('REQ_STATUS', $ReqSt, $LANGUAGE_CD, $ReqSt_desc) Else Do Obtengo_desc_Status_ENG('REQ_STATUS', $ReqSt, $ReqSt_desc) End-if If $LANGUAGE_CD <> 'POR' Do Obtengo_desc_Status_gnral('BUDGET_HDR_STATUS', $ReqBud, $LANGUAGE_CD, $ReqBud_desc) Else Do Obtengo_desc_Status_ENG('BUDGET_HDR_STATUS', $ReqBud, $ReqBud_desc) End-if
If $LANGUAGE_CD <> 'POR' Do Obtengo_desc_Status_gnral('PO_STATUS', $PoSt, $LANGUAGE_CD, $PoSt_desc) Else Do Obtengo_desc_Status_ENG('PO_STATUS', $PoSt, $PoSt_desc) End-if
LET $ReqAmtT = #ReqAmtT LET $ReqAmt = #ReqAmt LET $ReqAmtVat = #ReqAmtVat LET $ReqAmtBT = #ReqAmtBT LET $ReqAmtB = #ReqAmtB LET $ReqAmtVatB = #ReqAmtVatB LET $PoAmt = #PoAmt LET $PoAmtIPI = #PoAmtIPI LET $PoAmtST = #PoAmtST LET $PoAmtT = #PoAmtT LET $PoAmt = #PoAmt LET $PoAmtIPIB = #PoAmtIPIB LET $PoAmtSTB = #PoAmtSTB LET $PoAmtBT = #PoAmtBT LET $VndrNm = replace($VndrNm,',',';')
WRITE 1 FROM $Bu ',' $ReqId ',' $RequesId ',' $Reques ',' $Origin ',' $ReqSt_desc ',' $ReqBud_desc ',' $Class ',' $ReqDt ',' $UsrId ',' $Usr ',' $AprovalId ',' $AprovalNa ',' $ReqAmtT ',' $CurrT ',' $ReqAmtBT ',' $CurrB ',' $Account ',' $Altacct ',' $Deptid ',' $OperUnit ',' $Project ',' $BudgetR ',' $PoId ',' $PoSt_desc ',' $PoOF ',' $PODt ',' $PoAmt ',' $PoAmtIPI ',' $PoAmtST ',' $PoAmtT ',' $POCurrT ',' $PoAmt ',' $PoAmtIPIB ',' $PoAmtSTB ',' $PoAmtBT ',' $POCurrB ',' $Buyer ',' $VndrSet ',' $VndrId ',' $VndrNm ','
Let $Bu = '' Let $ReqId = '' Let $RequesId = '' Let $Reques = '' Let $Origin = '' Let $ReqSt = '' Let $ReqBud = '' Let $ReqDt = '' Let $UsrId = '' Let $Usr = '' Let $AprovalId = '' Let $AprovalNa = '' Let $CurrB = '' Let $CurrT = '' Let #ReqAmtT = 0 Let #ReqAmt = 0 Let #ReqAmtVat = 0 Let #ReqAmtBT = 0 Let #ReqAmtB = 0 Let #ReqAmtVatB = 0 Let $Account = '' Let $Altacct = '' Let $Deptid = '' Let $OperUnit = '' Let $Project = '' Let $BudgetR = '' Let $PoId = '' Let $PoSt = '' Let $Buyer = '' Let $VndrId = '' Let $VndrNm = '' Let $VndrSet = '' Let $Status = '' Let $Field = ''
Let $PODt = '' Let #PoAmtT = 0 Let #PoAmt = 0 Let #PoAmtIPI = 0 Let #PoAmtST = 0 Let $POCurrB = '' Let $POCurrT = '' Let #PoAmtBT = 0 Let #PoAmtB = 0 Let #PoAmtIPIB = 0 Let #PoAmtSTB = 0
end-procedure begin-procedure Imprime-DetallePO
If $LANGUAGE_CD <> 'POR' Do Obtengo_desc_Status_gnral('PO_STATUS', $PoSt, $LANGUAGE_CD, $PoSt_desc) Else Do Obtengo_desc_Status_ENG('PO_STATUS', $PoSt, $PoSt_desc) End-if
If $LANGUAGE_CD <> 'POR' Do Obtengo_desc_Status_gnral('BUDGET_HDR_STATUS', $PoBud, $LANGUAGE_CD, $PoBud_desc) Else Do Obtengo_desc_Status_ENG('BUDGET_HDR_STATUS', $PoBud, $PoBuddesc) End-if LET $PoAmt = #PoAmt LET $PoAmtIPI = #PoAmtIPI LET $PoAmtST = #PoAmtST LET $PoAmtT = #PoAmtT LET $PoAmtB = #PoAmtB LET $PoAmtIPIB = #PoAmtIPIB LET $PoAmtSTB = #PoAmtSTB LET $PoAmtBT = #PoAmtBT LET $VndrNm = replace($VndrNm,',',';')
WRITE 1 FROM $Bu ',' $Contract ',' $UsrId ',' $Usr ',' $PoId ',' $Buyer ',' $Origin ',' $OF ',' $PoSt_desc ',' $PoBuddesc ',' $Class ',' $PODt ',' $PoAmt ',' $PoAmtIPI ',' $PoAmtST ',' $PoAmtT ',' $POCurrT ',' $PoAmtB ',' $PoAmtIPIB ',' $PoAmtSTB ',' $PoAmtBT ',' $POCurrB ',' $Account ',' $Altacct ',' $Deptid ',' $OperUnit ',' $Project ',' $BudgetR ',' $AprovalId ',' $AprovalNa ',' $VndrSet ',' $VndrId ',' $VndrNm ','
Let $Bu = '' Let $Contract = '' Let $UsrId = '' Let $Usr = '' Let $PoId = '' Let $Buyer = '' Let $Origin = '' Let $OF = '' Let $Class = '' Let $StatusDesc = '' Let $UsrId = '' Let $Usr = '' Let $AprovalId = '' Let $AprovalNa = '' Let $PoId = '' Let $PoSt = '' Let $PODt = '' Let #POAmt = 0 Let #ValIPI = 0 Let #ValST = 0 Let $POCurrT = '' Let #POAmB = 0 Let #POAmBT = 0 Let #POAmB = 0 Let #ValBIPI = 0 Let #ValBST = 0 Let $POCurrB = '' Let $Buyer = '' Let $VndrId = '' Let $VndrNm = '' Let $VndrSet = '' Let $Status = '' Let $Field = ''
end-procedure !----------------------------------------------------------------------! ! Procedure: Imprime-Sumarizado ! ! Description: Prints the requisitions data ! !----------------------------------------------------------------------! begin-procedure Imprime-Sumarizado If $LANGUAGE_CD <> 'POR' Do Obtengo_desc_Status_gnral('REQ_STATUS', $ReqSt, $LANGUAGE_CD, $ReqSt_desc) Else Do Obtengo_desc_Status_ENG('REQ_STATUS', $ReqSt, $ReqSt_desc) End-if
If $LANGUAGE_CD <> 'POR' Do Obtengo_desc_Status_gnral('BUDGET_HDR_STATUS', $ReqBud, $LANGUAGE_CD, $ReqBud_desc) Else Do Obtengo_desc_Status_ENG('BUDGET_HDR_STATUS', $ReqBud, $ReqBud_desc) End-if
If $LANGUAGE_CD <> 'POR' Do Obtengo_desc_Status_gnral('PO_STATUS', $PoSt, $LANGUAGE_CD, $PoSt_desc) Else Do Obtengo_desc_Status_ENG('PO_STATUS', $PoSt, $PoSt_desc) End-if
If $LANGUAGE_CD <> 'POR' Do Obtengo_desc_Status_gnral('BUDGET_HDR_STATUS', $PoBuSt, $LANGUAGE_CD, $PoBuSt_desc) Else Do Obtengo_desc_Status_ENG('BUDGET_HDR_STATUS', $PoBuSt, $PoBuSt_desc) End-if
If $LANGUAGE_CD <> 'POR' Do Obtengo_desc_Status_gnral('RECV_STATUS', $RecvStatus, $LANGUAGE_CD, $RecvStatus_desc) Else Do Obtengo_desc_Status_ENG('RECV_STATUS', $RecvStatus, $RecvStatus_desc) End-if
If $LANGUAGE_CD <> 'POR' Do Obtengo_desc_Status_gnral('NF_BRL_STATUS', $DocStatus, $LANGUAGE_CD, $DocStatus_desc) Else Do Obtengo_desc_Status_ENG('NF_BRL_STATUS', $DocStatus, $DocStatus_desc) End-if
If $PostAP ='O' let $PostAP ='Aberto'
end-if
if $PostAP ='C' let $PostAP ='Cerrado'
end-if
LET $C_ReqAmtT =#ReqAmtT LET $C_ReqAmt =#ReqAmt LET $C_ReqAmtVat =#ReqAmtVat LET $C_ReqAmtBT =#ReqAmtBT LET $C_ReqAmtB =#ReqAmtB LET $C_ReqAmtVatB =#ReqAmtVatB
let $_c_POAmt = #POAmt let $_c_ValIPI = #ValIPI let $_c_ValST = #ValST let $_c_POAmtT = #POAmtT let $_c_POAmB = #POAmB let $_c_ValBIPI = #ValBIPI let $_c_ValBST = #ValBST let $_c_POAmBT = #POAmBT LET $VndrNm = replace($VndrNm,',',';')
WRITE 1 FROM $Bu ',' $ReqId ',' $RequesId ',' $Reques ',' $ReqSt_desc ',' $ReqBud_desc ',' $C_ReqAmtT ',' !$C_ReqAmt ',' $CurrT ',' !$C_ReqAmtVat ',' !$_c_POAmB ',' $merch_amt_bse ',' $CurrB ',' $ReqDt ',' $UsrId ',' $Usr ',' $AprovalId ',' $AprovalNa ',' $PoApDt ',' $Origin ',' $Class ',' $project ',' $budget_ref ',' $PoId ',' $PoSt_desc ',' $PoBuSt_desc ',' $PoOF ',' $PODt ',' $_c_POAmt ',' $_c_ValIPI ',' $_c_ValST ',' $_c_POAmtT ',' $POCurrT ',' $_c_POAmB ',' $_c_ValBIPI ',' $_c_ValBST ',' $_c_POAmBT ',' $POCurrB ',' $Buyer ',' $VndrSet ',' $VndrId ',' $VndrNm ',' $IdRecepcion ',' $RecvStatus_desc ',' $IdFactura ',' $NFdt ',' $NFS ',' $NFtype ',' $DocFiscal ',' $DocStatus_desc ',' $IdComprobante ',' $PostAP ',' $PYMNT_ID ',' $PymntStatus_desc ',' $pymnt_id_ref ','
!sigi
end-procedure !----------------------------------------------------- !AREYESG EXTRAE voucher 09/12/2019 !------------------------------------------------- begin-procedure obtiene_voucher let $IdComprobante = '' let $PostAP = '' let $PostAP_desc = '' let $PYMNT_ID = '' let $PymntStatus = '' LET $PymntStatus_desc = '' LET $EXISTE_V= 'N' let $pymnt_id_ref ='' begin-select distinct(V.VOUCHER_ID) &V.VOUCHER_ID !V.VOUCHER_ID !V.POST_STATUS_AP V.CLOSE_STATUS XR.PYMNT_ID XR.PYMNT_SELCT_STATUS PAY.pymnt_id_ref
let $IdComprobante = &V.VOUCHER_ID let $PostAP = &V.CLOSE_STATUS let $PYMNT_ID = &XR.PYMNT_ID let $PymntStatus = &XR.PYMNT_SELCT_STATUS let $PymntStatus = &XR.PYMNT_SELCT_STATUS let $pymnt_id_ref = &PAY.pymnt_id_ref
If $LANGUAGE_CD <> 'POR' !Do Obtengo_desc_Status_gnral('POST_STATUS_AP', $PostAP, $LANGUAGE_CD, $PostAP_desc) Else ! Do Obtengo_desc_Status_ENG('POST_STATUS_AP', $PostAP, $PostAP_desc) End-if
IF $PYMNT_ID <> '' AND $PYMNT_ID <> ' ' If $LANGUAGE_CD <> 'POR' Do Obtengo_desc_Status_gnral('PYMNT_SELCT_STATUS', $PymntStatus, $LANGUAGE_CD, $PymntStatus_desc) Else Do Obtengo_desc_Status_ENG('PYMNT_SELCT_STATUS', $PymntStatus, $PymntStatus_desc) End-if End-if do Imprime-Sumarizado
let $IdComprobante = '' let $PostAP = '' let $PostAP_desc = '' let $PYMNT_ID = '' let $PymntStatus = '' LET $PymntStatus_desc = '' LET $EXISTE_V= 'Y' LET $pymnt_id_ref ='' from (sysadm.PS_VOUCHER V LEFT JOIN sysadm.ps_PYMNT_VCHR_XREF XR ON XR.BUSINESS_UNIT= V.BUSINESS_UNIT AND XR.VOUCHER_ID=V.VOUCHER_ID), sysadm.ps_voucher_line VL, sysadm.ps_distrib_line VDL, (sysadm.ps_PYMNT_VCHR_XREF XR4 LEFT JOIN sysadm.ps_payment_tbl pay ON XR4.BANK_CD = PAY.BANK_CD and XR4.PYMNT_ID = PAY.PYMNT_ID and XR4.bank_cd = pay.bank_cd and XR4.bank_acct_key =pay.bank_acct_key) where V.BUSINESS_UNIT=VL.BUSINESS_UNIT AND V.VOUCHER_ID =VL.VOUCHER_ID and VL.BUSINESS_UNIT =VDL.BUSINESS_UNIT AND VL.VOUCHER_ID =VDL.VOUCHER_ID AND VL.VOUCHER_LINE_NUM=VDL.VOUCHER_LINE_NUM AND VDL.business_unit_recv= $Bu AND VDL.receiver_id= $IdRecepcion AND XR.BUSINESS_UNIT= XR4.BUSINESS_UNIT AND XR.VOUCHER_ID= XR4.VOUCHER_ID AND XR.PYMNT_CNT= XR4.PYMNT_CNT !and pay.pymnt_id = xr.pymnt_id end-select End-procedure !----------------------------------------------------- !AREYESG EXTRAE voucher2 09/12/2019 !------------------------------------------------- begin-procedure obtiene_voucher2 let $IdComprobante2 = '' let $PostAP2 = '' let $PostAP2_desc = '' LET $PYMNT_ID2 = '' LET $PymntStatus2= '' LET $PymntStatus2_desc= '' LET $EXISTE_V2= 'N' LET $pymnt_id_ref2= '' begin-select distinct(V2.VOUCHER_ID) &V2.VOUCHER_ID !V2.VOUCHER_ID !V2.POST_STATUS_AP V2.CLOSE_STATUS XR2.PYMNT_ID XR2.PYMNT_SELCT_STATUS pay2.pymnt_id_ref let $PYMNT_ID2 = &XR2.PYMNT_ID let $PymntStatus2 = &XR2.PYMNT_SELCT_STATUS let $IdComprobante2 = &V2.VOUCHER_ID let $PostAP2 = &V2.CLOSE_STATUS let $pymnt_id_ref2 = &pay2.pymnt_id_ref
IF $PYMNT_ID2 <>'' AND $PYMNT_ID2 <>' ' If $LANGUAGE_CD <> 'POR' Do Obtengo_desc_Status_gnral('PYMNT_SELCT_STATUS', $PymntStatus2, $LANGUAGE_CD, $PymntStatus2_desc) Else Do Obtengo_desc_Status_ENG('PYMNT_SELCT_STATUS', $PymntStatus2, $PymntStatus2_desc) End-if End-if
If $LANGUAGE_CD <> 'POR' !Do Obtengo_desc_Status_gnral('POST_STATUS_AP', $PostAP2, $LANGUAGE_CD, $PostAP2_desc) Else ! Do Obtengo_desc_Status_ENG('POST_STATUS_AP', $PostAP2, $PostAP2_desc) End-if
do Imprime-SumarizadoPO
LET $EXISTE_V2= 'Y' let $IdComprobante2 = '' let $PostAP2 = '' let $PostAP2_desc = '' LET $PYMNT_ID2 = '' LET $PymntStatus2= '' LET $PymntStatus2_desc= '' LET $pymnt_id_ref2 ='' from (sysadm.PS_VOUCHER V2 LEFT JOIN sysadm.ps_PYMNT_VCHR_XREF XR2 ON XR2.BUSINESS_UNIT= V2.BUSINESS_UNIT AND XR2.VOUCHER_ID=V2.VOUCHER_ID), sysadm.ps_voucher_line VL2, sysadm.ps_distrib_line VDL2, (sysadm.ps_PYMNT_VCHR_XREF XR3 LEFT JOIN sysadm.ps_payment_tbl pay2 ON XR3.BANK_CD = PAY2.BANK_CD and XR3.PYMNT_ID = PAY2.PYMNT_ID and XR3.bank_cd = pay2.bank_cd and XR3.bank_acct_key =pay2.bank_acct_key) where V2.BUSINESS_UNIT=VL2.BUSINESS_UNIT AND V2.VOUCHER_ID =VL2.VOUCHER_ID and VL2.BUSINESS_UNIT =VDL2.BUSINESS_UNIT AND VL2.VOUCHER_ID =VDL2.VOUCHER_ID AND VL2.VOUCHER_LINE_NUM = VDL2.VOUCHER_LINE_NUM AND XR2.BUSINESS_UNIT= XR3.BUSINESS_UNIT AND XR2.VOUCHER_ID= XR3.VOUCHER_ID AND XR2.PYMNT_CNT= XR3.PYMNT_CNT AND VDL2.business_unit_recv= $Bu AND VDL2.receiver_id= $IdRecepcion end-select End-procedure begin-procedure Imprime-SumarizadoPO
If $LANGUAGE_CD <> 'POR' !Do Obtengo_desc_Status_gnral('PO_STATUS', $PoSt, $LANGUAGE_CD, $PoSt_DESC) Else ! Do Obtengo_desc_Status_ENG('PO_STATUS', $PoSt, $PoSt_DESC) End-if
If $LANGUAGE_CD <> 'POR' Do Obtengo_desc_Status_gnral('BUDGET_HDR_STATUS', $PoBud, $LANGUAGE_CD, $PoBud_DESC) Else Do Obtengo_desc_Status_ENG('BUDGET_HDR_STATUS', $PoBud, $PoBud_DESC) End-if
If $LANGUAGE_CD <> 'POR' Do Obtengo_desc_Status_gnral('RECV_STATUS', $RecvStatus, $LANGUAGE_CD, $RecvStatus_DESC) Else Do Obtengo_desc_Status_ENG('RECV_STATUS', $RecvStatus, $RecvStatus_DESC) End-if
If $LANGUAGE_CD <> 'POR' Do Obtengo_desc_Status_gnral('NF_BRL_STATUS', $DocStatus, $LANGUAGE_CD, $DocStatus_DESC) Else Do Obtengo_desc_Status_ENG('NF_BRL_STATUS', $DocStatus, $DocStatus_DESC) End-if If $PostAP2 = 'O' let $PostAP2 = 'Aberto'
end-if
if $PostAP2 ='C' let $PostAP2 ='Cerrado'
End-if
LET $C_POAmt = #POAmt LET $C_ValIPI = #ValIPI LET $C_ValST = #ValST LET $C_POAmtT = #POAmtT LET $C_POAmB = #POAmB LET $C_ValBIPI = #ValBIPI LET $C_ValBST = #ValBST LET $C_POAmBT = #POAmBT LET $VndrNm = replace($VndrNm,',',';')
WRITE 1 FROM $Bu ',' $UsrId ',' $Usr ',' $AprovalId ',' $AprovalNa ',' $PoApDt ',' $Origin ',' $Class ',' $project ',' $budget_refPO ',' $PoId ',' $PoSt_DESC ',' $PoBud_DESC ',' $OF ',' $PODt ',' $C_POAmt ',' $C_ValIPI ',' $C_ValST ',' $C_POAmtT ',' $POCurrT ',' $C_POAmB ',' $C_ValBIPI ',' $C_ValBST ',' $C_POAmBT ',' $POCurrB ',' $Buyer ',' $VndrSet ',' $VndrId ',' $VndrNm ',' $IdRecepcion ',' $RecvStatus_DESC ',' $IdFactura ',' $NFdt ',' $NFS ',' $NFtype ',' $DocFiscal ',' $DocStatus_DESC ',' $IdComprobante2 ',' $PostAP2 ',' $PYMNT_ID2 ',' $PymntStatus2_desc ','
!sigi $pymnt_id_ref2 ',' end-procedure Begin-procedure EncabezadoDetalle IF $LANGUAGE_CD ='POR'
WRITE 1 FROM ' ' WRITE 1 FROM 'Unidade de Negocio' $SEPARADOR 'Id Requisicao' $SEPARADOR 'Id Requisitante' $SEPARADOR 'Requisitante' $SEPARADOR 'Origem' $SEPARADOR 'Status Requisicao' $SEPARADOR 'Status do Orcamento' $SEPARADOR 'Classificador' $SEPARADOR 'Data da Requisicao' $SEPARADOR 'ID Usuario' $SEPARADOR 'Usuario' $SEPARADOR 'Id Aprovador' $SEPARADOR 'Aprovador' $SEPARADOR 'Valor da Mercadoria' $SEPARADOR 'Moeda da Transacao' $SEPARADOR 'Valor Base' $SEPARADOR 'Moeda Base' $SEPARADOR 'Conta' $SEPARADOR 'Conta Alternativa' $SEPARADOR 'Departamento' $SEPARADOR 'Unidade Operacional' $SEPARADOR 'Projeto' $SEPARADOR 'Referência de Orcamento' $SEPARADOR 'Id OC' $SEPARADOR 'Status da OC' $SEPARADOR 'OF' $SEPARADOR 'Data da OC' $SEPARADOR 'Valor da Mercadoria' $SEPARADOR 'Valor IPI' $SEPARADOR 'Valor ST' $SEPARADOR 'Valor Total' $SEPARADOR 'Moeda da Transacao' $SEPARADOR 'Valor Base' $SEPARADOR 'Valor Base IPI' $SEPARADOR 'Valor Base ST' $SEPARADOR 'Valor Base Total' $SEPARADOR 'Moeda Base' $SEPARADOR 'Comprador' $SEPARADOR 'SETID Fornecedor' $SEPARADOR 'Id Fornecedor' $SEPARADOR 'Nome Fornecedor' $SEPARADOR
else WRITE 1 FROM ' ' WRITE 1 FROM 'Business Unit' $SEPARADOR 'Requisition Id' $SEPARADOR 'Requestor Id' $SEPARADOR 'Requestor' $SEPARADOR 'Origem' $SEPARADOR 'Req. Status' $SEPARADOR 'Budget' $SEPARADOR 'Budget Classifier' $SEPARADOR 'Requisition DT' $SEPARADOR 'User Id' $SEPARADOR 'User' $SEPARADOR 'Aprover Id' $SEPARADOR 'Aprover' $SEPARADOR 'Transaction Amount' $SEPARADOR 'Trans. Currency' $SEPARADOR 'Base Amt' $SEPARADOR 'Base Currency' $SEPARADOR 'Account' $SEPARADOR 'Alt Account' $SEPARADOR 'Department' $SEPARADOR 'Operating U' $SEPARADOR 'Project' $SEPARADOR 'Budget Ref' $SEPARADOR 'Id OC' $SEPARADOR 'Status da OC' $SEPARADOR 'OF' $SEPARADOR 'Data da OC' $SEPARADOR 'Transaction Amount' $SEPARADOR 'IPI Amount' $SEPARADOR 'ST Amount' $SEPARADOR 'Base Total Amount' $SEPARADOR 'Trans. Currency' $SEPARADOR 'Base Amt' $SEPARADOR 'Base IPI Amount' $SEPARADOR 'Base ST Amount' $SEPARADOR 'Valor Base Total' $SEPARADOR 'Base Currency' $SEPARADOR 'Buyer ID' $SEPARADOR 'Vendor SETID' $SEPARADOR 'Vendor Id' $SEPARADOR 'Vendor Name' $SEPARADOR
END-IF end-procedure Begin-procedure EncabezadoDetallePO IF $LANGUAGE_CD ='POR'
WRITE 1 FROM ' ' WRITE 1 FROM 'Unidade de Negocio' $SEPARADOR 'Id Contrato' $SEPARADOR 'ID Usuario' $SEPARADOR 'Usuario' $SEPARADOR 'ID OC' $SEPARADOR 'Comprador' $SEPARADOR 'Origem' $SEPARADOR 'OF' $SEPARADOR 'Status da OC' $SEPARADOR 'Status do Orcamento' $SEPARADOR 'Classificador' $SEPARADOR 'Data da OC' $SEPARADOR 'Valor da Mercadoria' $SEPARADOR 'Valor IPI' $SEPARADOR 'Valor ST' $SEPARADOR 'Valor Total' $SEPARADOR 'Moeda da Transacao' $SEPARADOR 'Valor Base' $SEPARADOR 'Valor Base IPI' $SEPARADOR 'Valor Base ST' $SEPARADOR 'Valor Base Total' $SEPARADOR 'Moeda Base' $SEPARADOR 'Conta' $SEPARADOR 'Conta Alternativa' $SEPARADOR 'Departamento' $SEPARADOR 'Unidade Operacional' $SEPARADOR 'Projeto' $SEPARADOR 'Referência de Orcamento' $SEPARADOR 'Id Aprovador' $SEPARADOR 'Aprovador' $SEPARADOR 'SETID Fornecedor' $SEPARADOR 'Id Fornecedor' $SEPARADOR 'Nome Fornecedor' $SEPARADOR
else WRITE 1 FROM ' ' WRITE 1 FROM 'Business Unit' $SEPARADOR 'Contract ID ' $SEPARADOR 'User Id' $SEPARADOR 'User' $SEPARADOR 'Purchse Order' $SEPARADOR 'Buyer ID' $SEPARADOR 'Origen' $SEPARADOR 'OF' $SEPARADOR 'Status da OC' $SEPARADOR 'Budget' $SEPARADOR 'Budget Classifier' $SEPARADOR 'Aprover Id' $SEPARADOR 'Aprover' $SEPARADOR 'Transaction Amount' $SEPARADOR 'IPI Amount' $SEPARADOR 'ST Amount' $SEPARADOR 'Total Amount' $SEPARADOR 'Trans. Currency' $SEPARADOR 'Base Amt' $SEPARADOR 'Base IPI Amount' $SEPARADOR 'Base ST Amount' $SEPARADOR 'Base Total Amount' $SEPARADOR 'Base Currency' $SEPARADOR 'Account' $SEPARADOR 'Alt Account' $SEPARADOR 'Department' $SEPARADOR 'Operating U' $SEPARADOR 'Project' $SEPARADOR 'Budget Ref' $SEPARADOR 'Aprover Id' $SEPARADOR 'Aprover' $SEPARADOR 'Vendor SETID' $SEPARADOR 'Vendor Id' $SEPARADOR 'Vendor Name' $SEPARADOR
END-IF end-procedure !Obtiene Traslate de Estatus! Begin-Procedure Obtengo_desc_Status_gnral($fieldname2, $fieldvalue2, $LANGUAGE_CD, :$StatusDes) Let $StatusDesc = '' Begin-Select XLO.XLATLONGNAME &XLO.XLATLONGNAME Let $StatusDesc = &XLO.XLATLONGNAME FROM PSXLATITEMLANG XLO WHERE LANGUAGE_CD = $LANGUAGE_CD AND FIELDNAME = $fieldname2 AND FIELDVALUE = $fieldvalue2 End-Select End-Procedure !**********************************************************************! ! Migracion de reporte PeopleSoft 9.0 a 9.1 ! ! Procedure : Obtengo_desc_Status_OTHER ! ! Description: ! ! Input : ! ! Output : ! !**********************************************************************! Begin-Procedure Obtengo_desc_Status_ENG($fieldname3, $fieldvalue3, :$StatusDesc) Let $StatusDesc = '' Begin-Select XLATLONGNAME &XLATLONGNAME Let $StatusDesc = &XLATLONGNAME FROM PSXLATITEM WHERE FIELDNAME = $fieldname3 AND FIELDVALUE = $fieldvalue3 End-Select End-Procedure !OSANCHEZ - Obtiene Descricpio de los fields Begin-Procedure Obtengo_desc_Field_ Let $LableField = '' Begin-Select LAB.LONGNAME &LAB.LONGNAME Let $LableField = &LAB.LONGNAME FROM SYSADM.PSDBFLDLABL LAB WHERE FIELDNAME = $Field AND LABEL_ID = $LabelID End-Select End-Procedure !Fin-OSANCHEZ !----------------------------------------------------------------------! ! Procedure: Desc-Bu ! ! Description: Gets the bu description ! !----------------------------------------------------------------------! begin-procedure Desc-Bu Let $DescrBu = ' ' begin-select B.DESCR let $DescrBu = &B.DESCR from PS_BUS_UNIT_TBL_FS B where B.BUSINESS_UNIT = $BunitD end-select end-procedure !-------------------------------------------------------------------------------------Report begin-procedure MainReport let $NombreArchivo = 'ReqTracingRep_' do Abre-Archivos !do Process_Main_Bu_gl do writeHeader do RevisaHdrs do closeFile
let $NombreArchivo = 'OCTracingRep_' do Abre-Archivos !do Process_Main_Bu_gl do WriteHeaderPO do RevisaHdrsPO do closeFile
end-procedure !----------------------------------------------------------------------------------closeFile Begin-Procedure closeFile close 1 End-Procedure BEGIN-PROCEDURE Abre-Archivos IF $SQR-PLATFORM = 'UNIX' LET $c_diag = '/' ELSE LET $c_diag = '\' END-IF BEGIN-SELECT prcs.prcsoutputdir LET $logoutputdirectory = &prcs.prcsoutputdir FROM psprcsparms prcs WHERE prcs.prcsinstance = #prcs_process_instance END-SELECT
LET $ruta1 = RTRIM($logoutputdirectory,' ') || RTRIM($c_diag,' ') || RTRIM($NombreArchivo,' ') || RTRIM($prcs_process_instance,' ') ||'.csv' OPEN $ruta1 AS 1 FOR-WRITING RECORD=90000:VARY STATUS = #open2 IF #open1 = -1 DISPLAY 'Error al abrir el Archivo de Salida' STOP quiet END-IF DISPLAY 'Apertura del Archivo Exitosa' LET $hoja = #page-count
END-PROCEDURE Abre-Archivos ! !----------------------------------------------------------------------! ! Called SQC Procedures !----------------------------------------------------------------------! #include 'reset.sqc' ! Reset printer #include 'curdttim.sqc' ! Current Date and Time #include 'chgampus.sqc' ! Change Ampersand to Underscore #Include 'datetime.sqc' ! Routines for date and time formatting #Include 'number.sqc' ! Routines to format numbers #include 'prcsapi.sqc' ! Update Process Request API #include 'prcsdef.sqc' ! Update Process Request variable declaration #include 'tranctrl.sqc' ! Transaction control !#include 'sylk.sqc' |
...