UPD772870 CODECHANGES

Document Sample
UPD772870 CODECHANGES Powered By Docstoc
					                       Project: PRJ772870
     Platform            Oracle
     Database            HC890ts1
     Version             85
     Description         UPD772870
     Comments
                         Global Payroll 8.9 Bundle #18



Records
  ESTAB_TBL_GPIN
  GPCH_CA_DATA1
  GPCH_EG_STAT_DW
  GPCH_SI_DATA
  GPCH_TX_DATA
  GPDE_DV_SNDR_VW
  GPDE_UNPD_ABSVW
  GPES_FNQ_DEV_VW
  GPES_TAX_RS_VW
  GPES_TERM_MNG
  GPES_TER_EMP_VW
  GPFR_AFND_TMP
  GPFR_AF_EXTRACT
  GPFR_AF_EXTR_VW
  GPFR_AF_LREC_VW
  GPFR_AF_LVLF_VW
  GPFR_AF_ND_IMP
  GPFR_AF_ND_VW
  GPFR_AF_NODE
  GPFR_AF_NOD_IMP
  GPFR_RSLT_ER_VW
  GPIN_24Q_RC
  GPJP_LA_ENR_DTL        GPJP_CHAR22
  GPJP_LA_ENR_DTL        GPJP_CHAR30
  GPUS_EFT_COMPNY
  GPUS_EFT_DTL
  GPUS_IAT_5REC
  GPUS_IAT_6REC
  GPUS_IAT_710
  GPUS_IAT_711
  GPUS_IAT_712
  GPUS_IAT_713
  GPUS_IAT_714
  GPUS_IAT_715
  GPUS_IAT_716
  GPUS_MMREFST_VW
  GPUS_PPD_COMPNY
  GP_PSLP_PRI_VW2
  GP_SS_PSLP_1_VW
  GP_SS_PSLP_2_VW



Fields
  GPCH_EG_MONTH_RUN
  GPCH_SI_AHV_MIN
  GPES_TRAINING_REDN
  GPFR_AF_LVLKEY_REC
  GPFR_AF_LVLREC_ALS
  GPFR_AF_LVL_10_VAL
  GPFR_AF_LVL_1_VAL
  GPFR_AF_LVL_2_VAL
  GPFR_AF_LVL_3_VAL
  GPFR_AF_LVL_4_VAL
  GPFR_AF_LVL_5_VAL
  GPFR_AF_LVL_6_VAL
  GPFR_AF_LVL_7_VAL
  GPFR_AF_LVL_8_VAL
  GPFR_AF_LVL_9_VAL
  GPFR_AF_LVL_PARM
  GPIN_ED_TYPE
  GPIN_GOVT_IND
  GPJP_CHAR30
  GPJP_UC_CON_RENEW
  GPJP_UC_TERM_BY
  GPUS_FOREIGN_PMT
  GPUS_FOREIGN_TRC
  GPUS_FOREX_IND
  GPUS_FOREX_REF
  GPUS_FOREX_REF_IND
  GPUS_IAT_DSCRPTR
  GPUS_ISO_DCNTRY_CD
  GPUS_ISO_DCRNCY_CD
  GPUS_ISO_OCRNCY_CD
  GPUS_ODFI_BR_CNTRY
  GPUS_ODFI_ID
  GPUS_ODFI_ID_QUAL
  GPUS_ODFI_NAME
  GPUS_ORIG_ADDR
  GPUS_ORIG_CITY_ST
  GPUS_ORIG_CNTRY_PC
  GPUS_ORIG_NAME
  GPUS_OSTATUS_CD
  GPUS_PYEACCT_IAT
  GPUS_RCVR_ADDR
  GPUS_RCVR_CITY_ST
  GPUS_RCVR_CNTRY_PC
  GPUS_RCVR_ID
  GPUS_RCVR_NAME
  GPUS_RDFI_BR_CNTRY
  GPUS_RDFI_ID
  GPUS_RDFI_ID_QUAL
  GPUS_RDFI_NAME
  GPUS_RESERVED_10
  GPUS_RESERVED_13
  GPUS_RESERVED_14
  GPUS_RESERVED_34
  GPUS_RESERVED_6
  GPUS_TRACE_NBR7
  GPUS_TXN_TYPE



Translate Values
  GPCH_SI_AHV_MIN (1900-01-01)      N
  GPCH_SI_AHV_MIN (1900-01-01)      Y
  GPES_SSTC_CNT_FLG (2000-01-01)    D
  GPES_SSTC_CNT_FLG (2000-01-01)    I
  GPFR_AF_LVLREC_ALS (1900-01-01)   ENT
  GPFR_AF_LVLREC_ALS (1900-01-01)   PRM
  GPFR_AF_LVLREC_ALS (1900-01-01)   SEC
  GPIN_ED_TYPE (1900-01-01) A
  GPIN_ED_TYPE (1900-01-01) B
  GPIN_ED_TYPE (1900-01-01) D
  GPIN_ED_TYPE (1900-01-01) E
  GPIN_ED_TYPE (1900-01-01) F
  GPIN_ED_TYPE (1900-01-01) G
  GPIN_ED_TYPE (1900-01-01) H
  GPIN_ED_TYPE (1900-01-01) J
  GPIN_ED_TYPE (1900-01-01) K
  GPIN_ED_TYPE (1900-01-01) L
  GPIN_ED_TYPE (1900-01-01) M
  GPIN_ED_TYPE (1900-01-01) N
  GPIN_ED_TYPE (1900-01-01) P
  GPIN_ED_TYPE (1900-01-01) Q
  GPIN_ED_TYPE (1900-01-01) S
  GPIN_ED_TYPE (1900-01-01) T
  GPJP_LA_EMPL_TYP (2009-04-01)                    5
  GPJP_LA_EMPL_TYP (2009-04-01)                    6
  GPJP_LA_TRM_CONTR (2009-04-01)                   13
  GPJP_LA_TRM_CONTR (2009-04-01)                   15
  GPJP_LA_TRM_CONTR (2009-04-01)                   16
  GPJP_LA_TRM_CONTR (2009-04-01)                   17
  GPJP_UC_CON_RENEW (2009-04-01)                   D
  GPJP_UC_CON_RENEW (1900-01-01)                   N
  GPJP_UC_CON_RENEW (2009-04-01)                   N
  GPJP_UC_CON_RENEW (2009-04-01)                   O
  GPJP_UC_CON_RENEW (1900-01-01)                   Y
  GPJP_UC_TERM_BY (2009-04-01)                     1
  GPJP_UC_TERM_BY (2009-04-01)                     2
  GPJP_UC_TERM_BY (2009-04-01)                     3
  GPJP_UC_TERM_BY (2009-04-01)                     E
  GPJP_UC_TERM_BY (2009-04-01)                     R



Pages
  GPAU_ELG_ELM
  GPAU_ELIG_INQ
  GPCH_EG_RSTATUS
  GPCH_EG_ST_HDR_SBP
  GPCH_OT_JOB_HIST
  GPCH_OT_MNGR_L
  GPCH_SI_DATA
  GPCH_TX_DATA
  GPES_ABS_EVENT_ADD
  GPES_RC_SS_TC2
  GPES_TERM_MNG
  GPFR_AF_NODE_SEC
  GPIN_24Q_RC
  GPIN_ESTAB
  GPJP_UC_TERM_RSN
  GP_RSLT_RUN_SBP



Components
  GPCH_OT_STA_MGR_L (GBL)
  GPCH_OT_VW_MGR_L (GBL)
  GPCH_OT_VW_PA_L (GBL)



PeopleCode (Record)
  DERIVED_GP.SELECT_PB.FieldFormula
  DERIVED_GPES.GPES_ADLN_CALC_PB.FieldChange
  DERIVED_GPFR_AF.VIEW_SQL.FieldChange
  FUNCLIB_GPES.EMPLID.FieldFormula
  FUNCLIB_GPGB.GPGB_PAYSLIP_FNS.FieldFormula
  GPCH_EG_INS_DW.GPCH_EG_PRSN_XML.FieldFormula
  GPCH_EG_PRO_DW.PRINT_BTN.FieldChange
  GPCH_EG_PRO_DW.SAVE_PB.FieldChange
  GPCH_EG_STAT_DW.FUNCLIB.FieldFormula
  GPCH_EG_STAT_DW.GPCH_FK_QUARTER.FieldChange
  GPCH_EG_STAT_DW.GPCH_FK_QUARTER.FieldEdit
  GPCH_EG_ST_HDR.GPCH_EG_DOMAINID.SavePostChange
  GPCH_FM_FUNCLIB.GPCH_FM_FORM_ID.FieldFormula
  GPCH_TX_DATA.COMMENTS.FieldChange
  GPCH_TX_DATA.GPCH_TX_SEX_OVRD.FieldChange
  GPCH_TX_DATA.GPCH_TX_TRF_CD.FieldDefault
  GPCH_TX_DATA.GPCH_TX_TRF_CD.RowInit
  GPCH_TX_DATA.GPCH_TX_VILLAGE_CD.FieldDefault
  GPCH_TX_DATA.GPCH_TX_VILLAGE_CD.RowInit
  GPDE_AB_MATERN.GPDE_AB_BEGIN_DT1.FieldEdit
  GPDE_AB_MATERN.GPDE_AB_END_DT1.FieldEdit
  GPDE_AB_MATERN.GPDE_AB_EXPECT_DT1.FieldEdit
  GPDE_AB_MAT_EL.GPDE_MT_PIN_EL_NUM.SaveEdit
  GPES_DERIVED.SRCH_BTN.FieldChange
  GPES_RC_FNQ1_EE.EMPLID.FieldChange
  GPES_RC_FNQ1_EE.EMPLID.RowInit
  GPES_RC_FNQ1_EE.EMPL_RCD.FieldChange
  GPES_RC_FNQ1_EE.EMPL_RCD.RowInit
  GPES_RC_FNQ1_EE.TERMINATION_DT.RowInit
  GPES_RC_FNQ2.GPES_FROM_DT.FieldChange
  GPES_RC_FNQ2.GPES_TO_DT.FieldChange
  GPES_RC_FNQ2_EE.EMPLID.RowInit
  GPES_TERM_MNG.SENIORITY_PAY_DT.FieldDefault
  GPFR_AF_NODE.GPFR_AF_LEVEL.SavePreChange
  GPFR_AF_NODE.GPFR_AF_LVLKEY_REC.FieldChange
  GPFR_AF_NODE.GPFR_AF_LVLKEY_REC.RowInit
  GPFR_AF_NODE.GPFR_AF_LVLKEY_REC.SaveEdit
  GPFR_AF_NODE.GPFR_AF_LVLREC_ALS.FieldChange
  GPFR_AF_NODE.GPFR_AF_LVLREC_ALS.RowInit
  GPFR_ONPAY_WRK.GPFR_RESULTS_PB.FieldFormula
  GPGB_ABS_EVT_JR.GPGB_ABS_LINK_DUR.FieldFormula
  GPGB_ABS_EVT_JR.GPGB_ABS_LINK_DUR.SavePostChange
  GPGB_EDIFUNCLIB.GPGB_EDI_WORKS_ID.FieldFormula
  GPGB_EE_CO_HDR.EMPLID.SaveEdit
  GPGB_EE_TAX.GPGB_TAX_CD_SRC.FieldChange
  GPGB_RSLT_ARR_W.RSLT_SEG_NUM.RowInit
  GPGB_RSLT_ATX_W.RSLT_SEG_NUM.RowInit
  GPGB_RSLT_BTX_W.RSLT_SEG_NUM.RowInit
  GPGB_RSLT_ERN_W.RSLT_SEG_NUM.RowInit
  GPGB_RSLT_NI_W.RSLT_SEG_NUM.RowInit
  GPGB_RSLT_PI_W.RSLT_SEG_NUM.RowInit
  GPGB_RSLT_RTO_W.RSLT_SEG_NUM.RowInit
  GPGB_RSLT_TAX_W.RSLT_SEG_NUM.RowInit
  GPJP_UC_HEADER.EMPLID.RowInit
  GPJP_UC_HEADER.GPJP_UC_CON_RENEW.RowInit
  GP_PYE_OVR_SOVR.PIN_SOVR_NUM.SaveEdit
  GP_RCP_PYE_DTL.RECIPIENT_ID.FieldChange
  GP_RCP_PYE_DTL.RECIPIENT_ID.SaveEdit



Message Catalog Entries
  Global Payroll - Online   17000,     256
  Global Payroll - Online   17000,     482
  GP Switzerland - Online   17051,     182
  GP Switzerland - Online   17051,     183
  GP UK - Online            17130,     249
  GP UK - Batch             17135,     366
  GP UK - Batch             17135,     535
  GP UK - Batch             17135,     536
  GP Spain - Batch          17175,     362
  GP Australia - Text Messages                       17201, 4010
  GP Australia - Text Messages                       17201, 4011
  GP Australia - Text Messages                       17201, 4012



SQL
  GPAU_PSM_CREB1_Vals   Gross_AmS                    ApplEng
  GPAU_TFN_ELCB1_Data   Delete S                     ApplEng
  GPCH_IDENTIFY               Normal
  GPDE_CT_ABS_DATE            Normal
  GPDE_DV_MON EVENT13   FIND_TR2S                    ApplEng
  GPDE_DV_MON EVENT13   FIND_TRGS                    ApplEng
  GPDE_DV_MON EVENT17   FIND_TR2S                    ApplEng
  GPDE_DV_MON EVENT17   FIND_TRGS                    ApplEng
  GPDE_DV_MON EVENT3X   FIND_TR1S                    ApplEng
  GPDE_DV_MON EVENT3X   FIND_TR2S                    ApplEng
  GPDE_DV_MON EVENT3X   FIND_TRGS                    ApplEng
  GPDE_DV_REP DSME_PF   Step01 S                     ApplEng
  GPDE_DV_REP DSME_PF Step02 S         ApplEng
  GPDE_DV_REP DSME_PF Step03 S         ApplEng
  GPDE_DV_REP DSME_PF Step04 S         ApplEng
  GPDE_DV_REP REP_XFERUPDWKDPFS        ApplEng
  GPDE_DV_REP REP_XFERWRK_PF S         ApplEng
  GPDE_DV_SNDR_VW           View
  GPDE_UNPD_ABSVW           View
  GPES_FNQ_DEV_VW           View
  GPES_TAX_RS_VW            View
  GPES_TER_EMP_VW           View
  GPFR_AF_EXTR_VW           View
  GPFR_AF_LREC_VW           View
  GPFR_AF_LVLF_VW           View
  GPFR_AF_ND_VW             View
  GPFR_AF_RTRIM_LTRIM       Normal
  GPFR_AF_XML               Normal
  GPFR_PMT_AE POPULATEInsert1 S        ApplEng
  GPFR_RSLT_ER_VW           View
  GPGB_EDIP451P451_EE EEs     D        ApplEng
  GPGB_EDI_PRCEDIAcum Step01 S         ApplEng
  GPGB_EDI_PRCEDIAcum Step02 S         ApplEng
  GPGB_EDI_PRCEDIAcum Step03 S         ApplEng
  GPGB_EDI_PRCEDIAcum Step04 S         ApplEng
  GPGB_EDI_PRCEDIPrep Step05A2S        ApplEng
  GPGB_P45    CkPyPrc Step01 S         ApplEng
  GPGB_P45    CkPyPrc Step02 S         ApplEng
  GPGB_P45    CkPyPrc Step03 S         ApplEng
  GPGB_P45    CkPyPrc Step04 S         ApplEng
  GPGB_P45    GtPrvSegStep01 S         ApplEng
  GPGB_P45    GtPrvSegStep02 S         ApplEng
  GPGB_P45    GtRsltDtStep01 S         ApplEng
  GPGB_P45    GtRsltDtStep02 S         ApplEng
  GPGB_PSLIP_PU_H           View
  GPGB_SUPELM_SEL_RSLT      Normal
  GPJP_LA03   ENRL_DTLStep05 S         ApplEng
  GPJP_LA03   ENRL_DTLStep10 S         ApplEng
  GPMX_PMT_AE POPULATEStep02 D         ApplEng
  GPMX_PMT_AE UPDATE Step01 S          ApplEng
  GPMX_PMT_AE UPDATE Step02 S          ApplEng
  GPMX_PMT_AE UPDATE Step03 S          ApplEng
  GPMX_PMT_AE UPDATE Step05 S          ApplEng
  GPMX_PMT_AE UPDATE Step07 S          ApplEng
  GPUS_MMREFST_VW           View
  GPUS_PPD_EFTGET-DTL Step03 S         ApplEng
  GPUS_PPD_EFTGET-DTL Step09 S         ApplEng
  GP_PSLP_PRI_VW2           View
  GP_SS_PSLP_1_VW           View
  GP_SS_PSLP_2_VW           View



File Layout Definitions
  GPJP_LA_ENROLL
  GPUS_EFT_IAT
  GPUS_EFT_PPD



Appl Engine (Prog)
  GPFR_ASS_AE
  GPFR_RPT_AE



Appl Engine (Section)
  GPAU_TFN_ELC              B1_Data
  GPCH_AE_ELM               STAX_XML
  GPDE_CT_ARBS              2.3.2_1B
  GPDE_DV_REP               DSME_PF
  GPDE_DV_REP                  REP_XFER
  GPFR_ASS_AE                  DATA CAL
  GPFR_ASS_AE                  LPR
  GPFR_ASS_AE                  WAGE 7.3
  GPFR_RPT_AE                  XML
  GPGB_EDI_PRC                 EDIAcum
  GPGB_EDI_PRC                 EDIPrep
  GPGB_P45                     CkPyPrc
  GPGB_P45                     GtPrvSeg
  GPGB_P45                     GtRsltDt
  GPMX_PMT_AE                  POPULATE
  GPUS_PPD_EFT                 GET-DTL



PeopleCode (ApplEng)
  GPAU_PSM_CRE.A2_Data GBLdefault 1900-01-01.Cat_Val.OnExecute
  GPCH_AE_ELM.STAX_XMLGBLdefault 1900-01-01.Step01.OnExecute
  GPDE_CT_ARBS.2.3.2_1BGBLdefault 1900-01-01.Step03.OnExecute
  GPDE_CT_ARBS.2.3.6_4AGBLdefault 1900-01-01.Step05.OnExecute
  GPDE_DV_REP.REP_XFERGBLdefault 1900-01-01.XFER_DS4.OnExecute
  GPES_SS_TC2.MAIN    GBLdefault 1900-01-01.Step02.OnExecute
  GPFR_AF_AE.ADDPARM GBLdefault 1900-01-01.Step10.OnExecute
  GPFR_ASS_AE.LPR     GBLdefault 1900-01-01.Step01.OnExecute
  GPFR_RPT_AE.RPTFRA GBLdefault 1900-01-01.StepM10.OnExecute
  GPFR_RPT_AE.XML     GBLdefault 1900-01-01.Step01.OnExecute
  GPGB_EDIP453.P45(3) GBLdefault 1900-01-01.ATT1.1.OnExecute
  GPGB_EDIP6P9.P6P9    GBLdefault 1900-01-01.Step01.OnExecute
  GPGB_P45.CkPyPrc GBLdefault 1900-01-01.Step01.OnExecute
  GPGB_P45.CkPyPrc GBLdefault 1900-01-01.Step02.OnExecute
  GPGB_P45.CkPyPrc GBLdefault 1900-01-01.Step03.OnExecute
  GPGB_P45.CkPyPrc GBLdefault 1900-01-01.Step04.OnExecute
  GPJP_LA03.GEN_FIL GBLdefault 1900-01-01.Step05.OnExecute
  GPUS_CTX_EFT.GEN-FILEGBLdefault 1900-01-01.Step01.OnExecute
  GPUS_CTX_EFT.GET-DTL GBLdefault 1900-01-01.Step01.OnExecute
  GPUS_PPD_EFT.GEN-FILEGBLdefault 1900-01-01.Step01.OnExecute
  GPUS_PPD_EFT.GET-DTL GBLdefault 1900-01-01.Step01.OnExecute
  GPUS_SM1_C.PROCESS GBLdefault 1900-01-01.Step30.OnExecute



PeopleCode (Page)
  GPCH_EG_SEND_OPTN.Activate
  GPCH_TX_DATA.Activate
  GPES_TERM_MNG.Activate
  GP_ABS_EVENT_SEC.Activate



PeopleCode (Component)
  GPCH_IF_TX07(GBL).SavePostChange
  GPCH_RC_EGOVT(GBL).SavePostChange
  GPFR_AF_NODE(GBL).PostBuild
  GP_ABS_EESS_REQ(GBL).SavePreChange
  GP_ABS_MGRSS_REQ(GBL).SavePreChange
  GP_SS_EE_PSLP(GBL).PostBuild



PeopleCode (CompRecord)
  GPCH_TX_DATA(GBL).GPCH_TX_DATA.RowInit
  GPES_RC_SS_TC2(GBL).GPES_RC_SS_TC2W.RowInit



PeopleCode (CompRecFld)
  GPCH_TX_DATA(GBL).GPCH_TX_DATA.GPCH_TX_VILLAGE_CDFieldDefault
  GPDE_CT_MAIN(GBL).GPDE_CT_1_WRK.GPDE_CT_CR_PB     FieldChange
  GPDE_RC_TX01(GBL).GPDE_RC_PAYROLL.GPDE_RC_SEND_XML FieldChange
  GPES_ABS_EVENT(GBL).GP_ABS_EVENT.ABSENCE_REASON   FieldChange
  GPES_RC_SS_TC2(GBL).GPES_DERIVED.SRCH_BTN         FieldChange
  GPES_RC_SS_TC2(GBL).GPES_RC_SS_TC2W.SSN_EMPLOYER     FieldChange



Application Packages
  GPFR_AF_DATA:ApplicationFrameworkClasses
  GPFR_AF_DATA.GPFR_AF_DATA



PeopleCode (Appl Package)
  GPDE_EGOV_XML:ELSTER:eTin.OnExecute
  GPFR_AF_DATA:ApplicationFrameworkClasses:GenerateXML.OnExecute



File References
  AU772870_DAT_DAT
  AU772870_IMP_DMS
  CH772870_01_DAT
  CH772870_01_DMS
  CH772870_02_DAT
  CH772870_02_DMS
  CH772870_DAT_DAT
  CH772870_ELEMENTS_DAT
  CH772870_ELEMENTS_IMP_DMS
  CH772870_IMP_DMS
  CH772870_RECORDS_DAT
  CH772870_RECORDS_IMP_DMS
  CN772870_DAT_DAT
  CN772870_IMP_DMS
  DE772870_01_DMS
  DE772870_02_DAT
  DE772870_02_DMS
  DE772870_DAT_DAT
  DE772870_IMP_DMS
  ES772870_DAT_DAT
  ES772870_IMP_DMS
  FR772870_01_DAT
  FR772870_01_DMS
  FR772870_DAT_DAT
  FR772870_ELEMENTS_DAT
  FR772870_ELEMENTS_IMP_DMS
  FR772870_IMP_DMS
  FR772870_RECORDS_DAT
  FR772870_RECORDS_IMP_DMS
  GB772870_DAT_DAT
  GB772870_IMP_DMS
  GP801666_01_DMS
  GP801666_02_DMS
  GPAUPS02_SQC
  GPCDPDM5_CBL
  GPCHAL08_SQR
  GPCHAL10_SQC
  GPCHAL10_SQR
  GPCHST02_SQC
  GPCHST02_SQR
  GPCHTX02_SQR
  GPCHUT06_SQC
  GPCUDATE_CBL
  GPDEKU01_SQR
  GPDESI10_SQC
  GPDESI10_SQR
  GPESBNK5_SQR
  GPESFNQ1_SQR
  GPESFNQ2_SQR
   GPESSS01_SQR
   GPGBP14_SQR
   GPINQT01_SQR
   GPJPUC01_SQC
   GPJPUC01_SQR
   GPMYTX07_SQR
   GPPDPDM5_CBL
   GPPDPDM5_DMS
   GPPFILTR_CBL
   GPPTLGPI_DMS
   GPPUDATE_CBL
   GPPUELIG_CBL
   GPPUERND_CBL
   GPPUSCHD_CBL
   GPPUTAKE_CBL
   GPSGIR02_SQR
   GPSGIR06_SQR
   GPUSYT70_SQR
   HK772870_DAT_DAT
   HK772870_IMP_DMS
   IN772870_DAT_DAT
   IN772870_IMP_DMS
   MY772870_01_DAT
   MY772870_01_DMS
   MY772870_DAT_DAT
   MY772870_IMP_DMS
   UPD772870_STR_DAT
   UPD772870_STR_I_DMS
   US772870_01_DAT
   US772870_01_DMS
   US772870_02_DAT
   US772870_02_DMS
   US772870_ELEMENTS_DAT
   US772870_ELEMENTS_IMP_DMS
   US772870_RECORDS_DAT
   US772870_RECORDS_IMP_DMS



Object Type: 69 ?
   COBOL, , ,
   DATA, , ,
   SCRIPTS, , ,
   SQR, , ,




                               Record Detail
Record: ESTAB_TBL_GPIN
             Description                      Associate Record for Estab
             Record Type                      SQL Table
             Parent Record
             Related Language
             DDL Space Name                   GPAPP.PSHRDMOP
             Owner ID                         Global Payroll India
             Comments                         This is an associate record created to capture India
      Specific detai
                                              ls for Establishments

      FieldName          Type   Len   Key   Srch Req Edit Prompt           C Default

      [ . . . Description Unchanged . . . ]
Record: GPCH_CA_DATA1
             Description                       Child Allowance Data CHE
             Record Type                       SQL Table
             Parent Record
             Related Language
             DDL Space Name                    GPAPP.PSHRDMOP
             Owner ID                          Global Payroll Switzerland
             Comments                          Child Allowance Data CHE

      FieldName          Type     Len   Key Srch Req Edit Prompt              C Default
      EMPLID             Char      11   KALS     Req Prmt PERSON
      EMPL_RCD           Num        3   KA
      EFFDT              Date      10   KD       Req
      PER_ORG_ASGN_VW.HIRE_DT
      COMPANY            Char       3   KA            Prmt GPCH_FK_COMP_VW
      COMPANY            Char       3                 Prmt GPCH_FK_COMP_VW
      GPCH_TX_CANTON     Char       2                 Prmt GPCH_SI_STCD_VW
      FULL_PART_TIME     Char       1             Req Xlat                     JOB.FULL_PART_TIME
      GPCH_CA_SINGLE     Char       1             Req Y/N                      'N'
      GPCH_GR_OVRD       Char       1             Req Y/N                      'N'
      GPCH_CA_RHH_ALLWNC Char       1                 Y/N
      GPCH_CA_FAM_PCT    Num      2.2

      Extend Field Info    SetCtrlField        Label               PageControl   Audit

      [ . . . Description Unchanged . . . ]




Record: GPCH_EG_STAT_DW
             Description                       Year End Dash board Grid
             Record Type                       Derived/Work
             Parent Record
             Related Language
             Owner ID                          Global Payroll Switzerland
             Comments                          Year End Dash board Grid

      FieldName            Type   Len   Key   Srch Req Edit Prompt            C Default
      COMPANY              Char     3   KA             Prmt COMPANY_TBL
      EFFDT                Date    10   KD                                     %date
      GPCH_EG_DOMAINID     Num      3   KA             Prmt GPCH_EG_DSET_VW
      GPCH_RC_PAY_YEAR     Num      4
      GPCH_SI_PROV_TYPE    Char     1                  Xlat
      GPCH_EG_RPT_TYPE     Char     1                  Xlat                    'Y'
      GPCH_FK_QUARTER      Char     1                  Xlat                    '1'
      GPCH_AL_CPAY_ENDDT   Date    10
      GPCH_AL_CPAY_ENDDT   Date    10                  Prmt GPCH_RP_DATE_VW
      GPCH_RUN_OPTIONS     Char     1                                          'Y'
      GPCH_CANCEL_OPTION   Char     1                  Y/N                     'N'
      GPCH_EG_ADD_DTA      Char     1                                          'N'
      GPCH_REPORT_STATUS   Char     4                  Xlat
      TIME_STAMP           DT      26
      DETAILS_LINK         Char     1
      GPCH_EG_REQ_LBL      Char     1
      GROUP_LIST_ID        Char    10                  Prmt GP_GRP_LIST_VW
      GPCH_EG_MONTH_RUN    Char     1                  Y/N                     'N'
      FUNCLIB              Char     1

      Extend Field Info    SetCtrlField        Label               PageControl   Audit

      [ . . . Description Unchanged . . . ]




Record: GPCH_SI_DATA
             Description                       Personal Data
             Record Type                       SQL Table
             Parent Record
             Related Language
             DDL Space Name                    GPAPP.PSHRDMOP
             Owner ID                          Global Payroll Switzerland
             Comments                          for social insurance

      FieldName            Type   Len   Key Srch Req   Edit Prompt            C Default
      EMPLID               Char    11   KALS     Req   Prmt PERSON
      EMPL_RCD             Num      3   KA
      EFFDT                Date    10   KD       Req
      END_DT               Date    10            Req
      GPCH_SI_AHV_STATUS   Char     1            Req   Xlat                    '1'
      GPCH_SI_ALV_STATUS   Char     1            Req   Xlat                    '1'
      GPCH_SI_EE_AHV_PCT   Num    3.4
      GPCH_SI_TOT_AHV_PC   Num    3.4
      GPCH_SI_EE_ALV1_PC   Num    3.4
      GPCH_SI_EE_ALV2_PC   Num    3.4
      GPCH_SI_TOT_ALV1PC   Num    3.4
      GPCH_SI_TOT_ALV2PC   Num    3.4
      GPCH_SI_COV_UV       Char     1                 Prmt GPCH_SI_UV_PCT
      GPCH_TX_UV_STATUS    Char     1             Req Xlat                     '1'
      GPCH_SI_TOT_NBU_PC   Num    3.4
      GPCH_SI_EE_NBU_PCT   Num    3.4
      GPCH_SI_BU_PCT       Num    3.4
      GPCH_SI_PROV_TYPE    Char     1                 Xlat                      '2'
      GPCH_TX_UV_PROV_CD   Char     6             Req Prmt GPCH_PK_UV_VW
      GPCH_SI_YEAR         Char     1                 Y/N                      'N'
      GPCH_SI_AHV_MIN      Char     1




Record: GPCH_TX_DATA
             Description                       Source Tax Data CHE
             Record Type                       SQL Table
             Parent Record
             Related Language
             DDL Space Name                    GPAPP.PSHRDMOP
             Owner ID                          Global Payroll Switzerland
             Comments                          Source Tax Data CHE

      FieldName            Type   Len   Key   Srch Req Edit Prompt            C Default

      [ . . . Description Unchanged . . . ]




Record: GPDE_DV_SNDR_VW
             Description                       Prompt View for Deuev Sender
             Record Type                       SQL View
             Parent Record
             Related Language                  GPDE_DV_SND_LNG
             Build Seq                         1
             Owner ID                          Global Payroll Germany
             Comments                          Prompt View for Deuev Sender

      FieldName            Type   Len   Key   Srch Req Edit Prompt            C Default

      [ . . . Description Unchanged . . . ]




Record: GPDE_UNPD_ABSVW
             Description                       Unpaid Absence Days
             Record Type                       SQL View
             Parent Record
             Related Language
             Build Seq                         1
             Owner ID                          Global Payroll Germany
             Comments                         Report unpaid absence days.

      FieldName         Type    Len   Key   Srch Req Edit Prompt            C Default

      [ . . . Description Unchanged . . . ]




Record: GPES_FNQ_DEV_VW
             Description                      Termination earnings rate comp
             Record Type                      SQL View
             Parent Record
             Related Language
             Build Seq                        1
             Owner ID                         Global Payroll Spain
             Comments
                                              Rate components for the earnings that are paid at
      termination

      FieldName         Type    Len   Key   Srch Req Edit Prompt            C Default
      PIN_RATE_NUM      Num       8
      ACM_SIGN          Char      1                  Xlat




Record: GPES_TAX_RS_VW
             Description                      Inquire view
             Record Type                      SQL View
             Parent Record
             Related Language
             Build Seq                        1
             Owner ID                         Global Payroll Spain
             Comments
                                              Tax calculation results inquire

      FieldName         Type    Len   Key   Srch Req Edit Prompt            C Default

      [ . . . Description Unchanged . . . ]




Record: GPES_TERM_MNG
             Description                      Termination Details
             Record Type                      SQL Table
             Parent Record
             Related Language
             Query Security                   EMPLMT_SRCH_QRY
             DDL Space Name                   GPAPP.PSHRDMOP
             Owner ID                         Global Payroll Spain
             Comments                         Termination Details

      FieldName          Type   Len   Key Srch Req Edit Prompt              C Default
      EMPLID             Char    11   KALS     Req
      EMPL_RCD           Num      3   KALS
      TERMINATION_DT     Date    10   KALS     Req
      GPES_TERM_RSN      Char     4   AAL          Xlat
      GPES_PREADV_DAY    Num      3
      SENIORITY_PAY_DT   Date    10
      PER_ORG_ASGN.SENIORITY_PAY_DT
      GPES_WHO_PREADV    Char     3                  Xlat
      GPES_OVERW_INDM    Char     1                  Y/N                       'N'
      GPES_INDM_DAYS     Num      3
      GPES_MAX_PRDS      Num      3
      GPES_INDM_AMT      Num    9.2                                         Y Curr: CURRENCY_CD
      GPES_APPEAL_FLG    Char     1                  Y/N                      'N'
      GPES_CONC_DT       Date    10
      GPES_SEN_DT        Date    10
      GPES_FINAL_DT      Date    10
      GPES_SEN_LITIG     Num    9.2                                          Y Curr: CURRENCY_CD
      GPES_SEN_INDM      Num    9.2                                          Y Curr: CURRENCY_CD
      GPES_UNEMP_BENF    Num    9.2                                          Y Curr: CURRENCY_CD
      CURRENCY_CD        Char     3                   Prmt CURRENCY_CD_TBL
      OPR_DEF_TBL_HR.EXCHNG_TO_CURRENCY
      COMMENTS           Long

      Extend Field Info   SetCtrlField        Label                 PageControl   Audit

      [ . . . Description Unchanged . . . ]




Record: GPES_TER_EMP_VW
             Description                      Terminated Employees
             Record Type                      SQL View
             Parent Record
             Related Language
             Build Seq                        2
             Owner ID                         Global Payroll Spain
             Comments                         Terminated Employees

      FieldName           Type   Len   Key   Srch Req Edit Prompt            C Default

      [ . . . Description Unchanged . . . ]




Record: GPFR_AFND_TMP
             Description                      Temporay table - Node
             Record Type                      Temporal
             Parent Record
             Related Language
             DDL Space Name                   GPAPP.PSHRDMOP
             Owner ID                         Global Payroll France
             Comments                         Application Framework -
                                              Temporary table used in the extraction of Application
      Framework. Us
                                              ed to store the nodes selected for processing.

      FieldName           Type   Len   Key   Srch Req Edit Prompt            C Default

      [ . . . Description Unchanged . . . ]




Record: GPFR_AF_EXTRACT
             Description                      AF Extraction result table
             Record Type                      SQL Table
             Parent Record
             Related Language
             DDL Space Name                   GPAPP.PSHRDMOP
             Owner ID                         Global Payroll France
             Comments                         Application Framework - This output record stores the
      results of ex
                                              traction process GPFR_AF_AE

      FieldName           Type   Len   Key   Srch Req Edit Prompt            C Default

      [ . . . Description Unchanged . . . ]




Record: GPFR_AF_EXTR_VW
             Description                      Extraction view
             Record Type                      SQL View
             Parent Record                    GPFR_AF_EXTRACT
              Related Language
              Build Seq                       1
              Owner ID                        Global Payroll France
              Comments                        Application Framework - This view is used in extraction

      FieldName          Type    Len   Key   Srch Req Edit Prompt          C Default

      [ . . . Description Unchanged . . . ]




Record: GPFR_AF_LREC_VW
              Description                     Level Record view
              Record Type                     Dynamic View
              Parent Record
              Related Language
              Owner ID                        Global Payroll France
              Comments                        GPFR Af Level record views

      FieldName          Type    Len   Key   Srch Req Edit Prompt          C Default

      [ . . . Description Unchanged . . . ]




Record: GPFR_AF_LVLF_VW
              Description                     ESIT SQL View
              Record Type                     Dynamic View
              Parent Record
              Related Language
              Owner ID                        Global Payroll France
              Comments                        Application Framework - Used as Pormpt record in Update
      Page Filters

      FieldName          Type    Len   Key   Srch Req Edit Prompt          C Default

      [ . . . Description Unchanged . . . ]




Record: GPFR_AF_ND_IMP
              Description                     Define Nodes
              Record Type                     SQL Table
              Parent Record
              Related Language
              DDL Space Name                  GPAPP.PSHRDMOP
              Owner ID                        Global Payroll France
              Comments                        Application Framework - This record is used to define
      nodes

      FieldName          Type    Len   Key   Srch Req Edit Prompt          C Default

      [ . . . Description Unchanged . . . ]




Record: GPFR_AF_ND_VW
              Description                     Define Nodes
              Record Type                     SQL View
              Parent Record
              Related Language
              Build Seq                       1
              Owner ID                        Global Payroll France
              Comments                        Application Framework - This record is used to define
      nodes
      FieldName          Type    Len   Key   Srch Req Edit Prompt           C Default

      [ . . . Description Unchanged . . . ]




Record: GPFR_AF_NODE
              Description                     Define Nodes
              Record Type                     SQL Table
              Parent Record
              Related Language                GPFR_AF_ND_LNG
              DDL Space Name                  GPAPP.PSHRDMOP
              Owner ID                        Global Payroll France
              Comments                        Application Framework - This record is used to define
      nodes

      FieldName          Type    Len   Key   Srch Req Edit Prompt           C Default

      [ . . . Description Unchanged . . . ]




Record: GPFR_AF_NOD_IMP
              Description                     Upgrade Node/attribute process
              Record Type                     SQL Table
              Parent Record
              Related Language                GPFR_AF_NIP_LNG
              DDL Space Name                  GPAPP.PSHRDMOP
              Owner ID                        Global Payroll France
              Comments                        Application Framework - This record is used in
      upgradation of data
                                              related to node and attributes

      FieldName          Type    Len   Key   Srch Req Edit Prompt           C Default

      [ . . . Description Unchanged . . . ]




Record: GPFR_RSLT_ER_VW
             Description                      Result view: Ern/Ded Recalc
             Record Type                      SQL View
             Parent Record
             Related Language
             Query Security                   EMPLMT_SRCH_QRY
             Build Seq                        2
             Owner ID                         Global Payroll France
             Comments                         Result Table for earnings and deductions and deltas.
      View for the r
                                              ecalculation

      FieldName          Type    Len   Key   Srch Req Edit Prompt           C Default

      [ . . . Description Unchanged . . . ]




Record: GPIN_24Q_RC
              Description                     Form 24Q Runcontrol Table
              Record Type                     SQL Table
              Parent Record
              Related Language
              DDL Space Name                  GPAPP.PSHRDMOP
              Owner ID                        Global Payroll India
              Comments                        Form 24Q Runcontrol Parameter Table

      FieldName          Type    Len   Key   Srch Req Edit Prompt           C Default
      [ . . . Description Unchanged . . . ]




Record: GPUS_EFT_COMPNY
             Description                       GPUS EFT control table
             Record Type                       SQL Table
             Parent Record
             Related Language
             DDL Space Name                    GPAPP.PSHRDMOP
             Owner ID                          Global Payroll United States
             Comments                          Used by GPUS EFT, control the company record generating

      FieldName           Type   Len    Key   Srch Req Edit Prompt           C Default
      PROCESS_INSTANCE    Num     10    KA
      COMPANY_DESCR       Char    30    KA
      COMPANY             Char     3    KA




Record: GPUS_EFT_DTL
              Description                      EFT Detail Record
              Record Type                      Temporal
              Parent Record
              Related Language
              DDL Space Name                   GPAPP.PSHRDMOP
              Owner ID                         Global Payroll United States
              Comments                         This table is using to hold payment details of EFT
      transactions for
                                                PPD and CTX process - USA.

      FieldName           Type    Len   Key   Srch Req Edit Prompt           C Default
      PROCESS_INSTANCE    Num      10   KA
      SRC_BANK_ID         Char      8   KA
      COMPANY_DESCR       Char     30
      EMPLID              Char     11   KA
      EMPL_RCD            Num       3   KA
      PAY_ENTITY          Char     10   KA
      CAL_RUN_ID          Char     18   KA
      GP_PAYGROUP         Char     10   KA
      CAL_ID              Char     18   KA
      ORIG_CAL_RUN_ID     Char     18   KA
      RSLT_SEG_NUM        Num       4   KA
      PIN_NUM             Num       8   KA
      INSTANCE            Num       3   KA
      RECIPIENT_TAG       Num       3   KA
      RECIPIENT_ID        Char      8   KA
      RECIPIENT_NAME      Char     30
      DEBIT_DT            Date     10   KA
      PMT_TYPE            Char      2   KA
      PAY_END_DT          Date     10   KA
      CHECK_DT            Date     10   KA
      RECIPIENT_NAME      Char     30
      GPUS_BANK_CD        Char      9
      ACCOUNT_EC_ID       Char     35
      ACCOUNT_NAME        Char     50
      GP_PMT_AMT          Sign   12.6
      PYMT_ID             Char      6
      FEDERAL_EIN         Num       9
      GPUS_DEST_BANK_NM   Char     23
      PAY_END_DT          Date     10   KA
      CHECK_DT            Date     10   KA
      COMPANY             Char      3
      GPUS_PYEBANK_CD     Char      9
      GPUS_PYEACCT_ID     Char     35
      GPUS_PYEACCT_NM     Char     50
      GPUS_PYEACCT_IAT    Char      1
      ACCOUNT_TYPE_PYE    Char      1                 Xlat
      GPUS_PMT_AMT         Char    10
      GPUS_PAYEE_NAME      Char    22
      LAST_NAME            Char    30
      FIRST_NAME           Char    30
      GPUS_EMPL_STATUS     Char     1
      GPUS_FAM_MED_IND     Char     1
      GPUS_STATE           Char    25
      GPUS_GRN_CASEID      Char    25
      GPUS_FIPS            Char    25
      NATIONAL_ID          Char    20




Record: GPUS_IAT_5REC
              Description                       IAT 5 Record Type
              Record Type                       Temporal
              Parent Record
              Related Language
              DDL Space Name                    GPAPP.PSHRDMOP
              Owner ID                          Global Payroll United States
              Comments
                                                GP US EFT -- IAT Company/Batch Header Record for the PPD
      file.

      FieldName            Type   Len    Key   Srch Req Edit Prompt            C Default
      PROCESS_INSTANCE     Num     10    KA
      GPUS_REC_TYPE        Char     1
      GPUS_SVC_CLASS_CD    Char     3
      GPUS_IAT_DSCRPTR     Char    16
      GPUS_FOREX_IND       Char     2
      GPUS_FOREX_REF_IND   Char     1
      GPUS_FOREX_REF       Char    15
      GPUS_ISO_DCNTRY_CD   Char     2
      GPUS_EFT_CHAR        Char     1
      FEDERAL_EIN          Num      9
      GPUS_CLASS_CODE      Char     3
      GPUS_ENTRY_DESCR     Char    10
      GPUS_ISO_OCRNCY_CD   Char     3
      GPUS_ISO_DCRNCY_CD   Char     3
      GPUS_CHECK_DT        Char     6
      GPUS_SETTLE_DT       Char     3
      GPUS_OSTATUS_CD      Char     1
      GPUS_ORIGIN_DFI_ID   Char     8
      GPUS_BATCH_NBR       Char     7




Record: GPUS_IAT_6REC
              Description                       IAT 6 Record Type
              Record Type                       Temporal
              Parent Record
              Related Language
              DDL Space Name                    GPAPP.PSHRDMOP
              Owner ID                          Global Payroll United States
              Comments
                                                GP US EFT -- IAT Entry Detail Record for the PPD file

      FieldName            Type    Len   Key   Srch Req Edit Prompt            C Default
      PROCESS_INSTANCE     Num      10   KA
      GPUS_PYEBANK_CD      Char      9   KA
      ACCOUNT_NUM          Char     17   KA
      GP_PMT_AMT           Sign   12.6   KA
      GPUS_PAYEE_ID        Char     15   KA
      GPUS_PAYEE_NAME      Char     22   KA
      GPUS_RCV_DFI_ID      Char      8
      PYMT_ID              Char      6
      GPUS_REC_TYPE        Char      1
      GPUS_TRANS_CD        Char      2
      GPUS_CHECK_DIGIT     Char      1
      GPUS_ADDENDA_CNT    Char    4
      GPUS_RESERVED_13    Char   13
      GPUS_PMT_AMT        Char   10
      GPUS_RESERVED_2     Char    2
      GPUS_FILLER_2       Char    2
      GPUS_ADDENDA_IND    Char    1
      GPUS_TRACE_NBR      Char   15




Record: GPUS_IAT_710
             Description                      IAT 710 Record
             Record Type                      Temporal
             Parent Record
             Related Language
             DDL Space Name                   GPAPP.PSHRDMOP
             Owner ID                         Global Payroll United States
             Comments
                                              GP US EFT -- IAT 1st Addenda Record (7 Record Type, 10
      Addenda Type
                                              ) for the PPD file

      FieldName           Type   Len   Key   Srch Req Edit Prompt            C Default
      PROCESS_INSTANCE    Num     10   KA
      GPUS_REC_TYPE       Char     1
      GPUS_ADDENDA_TYPE   Char     2
      GPUS_TXN_TYPE       Char     3
      GPUS_FOREIGN_PMT    Char    18
      GPUS_FOREIGN_TRC    Char    22
      GPUS_RCVR_NAME      Char    35
      GPUS_RESERVED_6     Char     6
      GPUS_TRACE_NBR7     Char     7




Record: GPUS_IAT_711
             Description                      IAT 711 Record
             Record Type                      Temporal
             Parent Record
             Related Language
             DDL Space Name                   GPAPP.PSHRDMOP
             Owner ID                         Global Payroll United States
             Comments
                                              GP US EFT -- IAT 2nd Addenda Record (7 Record Type, 11
      Addenda Type
                                              ) for the PPD file

      FieldName           Type   Len   Key   Srch Req Edit Prompt            C Default
      PROCESS_INSTANCE    Num     10   KA
      GPUS_REC_TYPE       Char     1
      GPUS_ADDENDA_TYPE   Char     2
      GPUS_ORIG_NAME      Char    35
      GPUS_ORIG_ADDR      Char    35
      GPUS_RESERVED_14    Char    14
      GPUS_TRACE_NBR7     Char     7




Record: GPUS_IAT_712
             Description                      IAT 712 Record
             Record Type                      Temporal
             Parent Record
             Related Language
             DDL Space Name                   GPAPP.PSHRDMOP
             Owner ID                         Global Payroll United States
             Comments
                                              GP US EFT -- IAT 3rd Addenda Record (7 Record Type, 12
      Addenda Type
                                               ) for the PPD file

      FieldName            Type   Len   Key   Srch Req Edit Prompt            C Default
      PROCESS_INSTANCE     Num     10   KA
      GPUS_REC_TYPE        Char     1
      GPUS_ADDENDA_TYPE    Char     2
      GPUS_ORIG_CITY_ST    Char    35
      GPUS_ORIG_CNTRY_PC   Char    35
      GPUS_RESERVED_14     Char    14
      GPUS_TRACE_NBR7      Char     7




Record: GPUS_IAT_713
             Description                       IAT 713 Record
             Record Type                       Temporal
             Parent Record
             Related Language
             DDL Space Name                    GPAPP.PSHRDMOP
             Owner ID                          Global Payroll United States
             Comments
                                               GP US EFT -- IAT 4th Addenda Record (7 Record Type, 13
      Addenda Type
                                               ) for the PPD file

      FieldName            Type   Len   Key   Srch Req Edit Prompt            C Default
      PROCESS_INSTANCE     Num     10   KA
      GPUS_REC_TYPE        Char     1
      GPUS_ADDENDA_TYPE    Char     2
      GPUS_ODFI_NAME       Char    35
      GPUS_ODFI_ID_QUAL    Char     2
      GPUS_ODFI_ID         Char    34
      GPUS_ODFI_BR_CNTRY   Char     3
      GPUS_RESERVED_10     Char    10
      GPUS_TRACE_NBR7      Char     7




Record: GPUS_IAT_714
             Description                       IAT 714 Record
             Record Type                       Temporal
             Parent Record
             Related Language
             DDL Space Name                    GPAPP.PSHRDMOP
             Owner ID                          Global Payroll United States
             Comments
                                               GP US EFT -- IAT 5th Addenda Record (7 Record Type, 14
      Addenda Type
                                               ) for the PPD file

      FieldName            Type   Len   Key   Srch Req Edit Prompt            C Default
      PROCESS_INSTANCE     Num     10   KA
      GPUS_REC_TYPE        Char     1
      GPUS_ADDENDA_TYPE    Char     2
      GPUS_RDFI_NAME       Char    35
      GPUS_RDFI_ID_QUAL    Char     2
      GPUS_RDFI_ID         Char    34
      GPUS_RDFI_BR_CNTRY   Char     3
      GPUS_RESERVED_10     Char    10
      GPUS_TRACE_NBR7      Char     7




Record: GPUS_IAT_715
             Description                       IAT 715 Record
             Record Type                       Temporal
             Parent Record
             Related Language
             DDL Space Name                    GPAPP.PSHRDMOP
             Owner ID                          Global Payroll United States
             Comments
                                               GP US EFT -- IAT 6th Addenda Record (7 Record Type, 15
      Addenda Type
                                               ) for the PPD file

      FieldName            Type   Len   Key   Srch Req Edit Prompt            C Default
      PROCESS_INSTANCE     Num     10   KA
      GPUS_REC_TYPE        Char     1
      GPUS_ADDENDA_TYPE    Char     2
      GPUS_RCVR_ID         Char    15
      GPUS_RCVR_ADDR       Char    35
      GPUS_RESERVED_34     Char    34
      GPUS_TRACE_NBR7      Char     7




Record: GPUS_IAT_716
             Description                       IAT 716 Record
             Record Type                       Temporal
             Parent Record
             Related Language
             DDL Space Name                    GPAPP.PSHRDMOP
             Owner ID                          Global Payroll United States
             Comments
                                               GP US EFT -- IAT 7th Addenda Record (7 Record Type, 16
      Addenda Type
                                               ) for the PPD file

      FieldName            Type   Len   Key   Srch Req Edit Prompt            C Default
      PROCESS_INSTANCE     Num     10   KA
      GPUS_REC_TYPE        Char     1
      GPUS_ADDENDA_TYPE    Char     2
      GPUS_RCVR_CITY_ST    Char    35
      GPUS_RCVR_CNTRY_PC   Char    35
      GPUS_RESERVED_14     Char    14
      GPUS_TRACE_NBR7      Char     7




Record: GPUS_MMREFST_VW
              Description                      State MMREF View
              Record Type                      SQL View
              Parent Record
              Related Language                 GPUS_MMS_VW_LNG
              Build Seq                        2
              Owner ID                         Global Payroll United States
              Comments                         This is a view of STATE_NAMES_TBL.    The difference is
      GPUS_MMREFST
                                               _VW doesn't have COUNTRY as the high-order key.

      FieldName            Type   Len   Key   Srch Req Edit Prompt            C Default

      [ . . . Description Unchanged . . . ]




Record: GPUS_PPD_COMPNY
             Description                       GPUS EFT control table
             Record Type                       SQL Table
             Parent Record
             Related Language
             DDL Space Name                    GPAPP.PSHRDMOP
             Owner ID                          Global Payroll United States
             Comments
                                               Used by GPUS EFT, control the company record generating
      FieldName          Type    Len   Key   Srch Req Edit Prompt           C Default
      PROCESS_INSTANCE   Num      10   KA
      COMPANY            Char      3   KA
      GPUS_PYEACCT_IAT   Char      1   KA                                       'N'




Record: GP_PSLP_PRI_VW2
              Description                     Primary Job View   for Payslips           Primary Job
      View - HR
              Record Type                     SQL View
              Parent Record                   JOB_DATE_VW
              Related Language
              Build Seq                       1
              Owner ID                        Global Payroll Core Applicatn         Human Resources
              Comments                        PRIMARY_JOB_VW is used to return the most current
      Primary Job infor
                                              mation at a certain Effective Date for an Employee.

                                              (1) This view returns the 'active' job with the lowest
      employment r
                                              ecord number where the Job_Indicator is equal to "P";
                                              (2) If no row found under (1), it will return the active
      job with t
                                              he lowest empl_rcd#;
                                              (3) If no row found under (2), it will return the lowest
      empl_rcd#
                                              where the Job_Indicator is equal to "P";
                                              (4) If no row found under (3), it will return the lowest
      empl_rcd#.

                                              Note: This view will always return 1 row per employee
      as there shou
                                              ld be only one Primary Job.

      FieldName          Type    Len   Key   Srch Req Edit Prompt           C Default

      [ . . . Description Unchanged . . . ]




Record: GP_SS_PSLP_1_VW
             Description                      Slips for Self Service - DFLT
             Record Type                      SQL View
             Parent Record
             Related Language
             Build Seq                        6
             Owner ID                         Global Payroll Core Applicatn
             Comments                         This view will select Payslips from guide table that
      meet the defau
                                              lt availability setting in Payslip Options page

      FieldName          Type    Len   Key   Srch Req Edit Prompt           C Default

      [ . . . Description Unchanged . . . ]




Record: GP_SS_PSLP_2_VW
             Description                      Select Slips for Self Service
             Record Type                      SQL View
             Parent Record
             Related Language
             Build Seq                        6
             Owner ID                         Global Payroll Core Applicatn
             Comments                         This view will select Payslips from guide table that
      meet the avail
                                              ability by Run type setting in Payslip Options page
      FieldName           Type   Len     Key   Srch Req Edit Prompt            C Default

      [ . . . Description Unchanged . . . ]




                                 Field Detail
Field: GPCH_EG_MONTH_RUN
             Field Type                         Char
             Length                             1
             Format                             UpperCase
             Family Name
             Display Name
             Owner ID                           Global Payroll Switzerland
             Comments                           Field to Re-run the Dashboard for another Month.

      Label ID              Short Name         Long Name                         Def
      GPCH_MONTH_RUN        Month Run          New Month Run                     Yes
      GPCH_MONTH_RUN        Month Run          New Month Run
      GPCH_PERIOD RUN       Period Run         New Period Run                     Yes




Field: GPCH_SI_AHV_MIN
             Field Type                         Char
             Length                             1
             Format                             UpperCase
             Family Name
             Display Name
             Owner ID                           Global Payroll Switzerland

      Label ID              Short Name         Long Name                         Def
      GPCH_SI_AHV_MIN       AHV_AVS_MIN        Apply AHV_AVS Minimum             Yes




Field: GPES_TRAINING_REDN
             Field Type                         Num
             Length                             18
             Decimal Positions                  2
             Format                             UpperCase
             Family Name
             Display Name
             Owner ID                           Global Payroll Spain
             Comments                           Continuos Training Reduction

      Label ID              Short Name         Long Name                         Def
      GPES_TRAINING_RED     Cont. Training     Continuos Training Reduction      Yes
      FT                    FT Reduction       Tripatite Foundation Reduction
      GPES_TRAINING_RED     Training Redcnt    Continuos Training Reduction      Yes




Field: GPFR_AF_LVLKEY_REC
             Field Type                         Char
             Length                             15
             Format                             UpperCase
             Family Name
             Display Name
             Owner ID                           Global Payroll France
             Comments                         Field for Level Key Record Name

      Label ID              Short Name    Long Name                             Def

      [ . . . Description Unchanged . . . ]




Field: GPFR_AF_LVLREC_ALS
             Field Type                       Char
             Length                           4
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll France
             Comments                         Field for Level Record Alias

      Label ID              Short Name    Long Name                             Def

      [ . . . Description Unchanged . . . ]




Field: GPFR_AF_LVL_10_VAL
             Field Type                       Char
             Length                           50
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll France
             Comments                         Application Framework - Key Value 10

      Label ID              Short Name    Long Name                             Def

      [ . . . Description Unchanged . . . ]




Field: GPFR_AF_LVL_1_VAL
             Field Type                       Char
             Length                           50
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll France
             Comments                         Application Framework - Key Value 1

      Label ID              Short Name    Long Name                             Def

      [ . . . Description Unchanged . . . ]




Field: GPFR_AF_LVL_2_VAL
             Field Type                       Char
             Length                           50
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll France
             Comments                         Application Framework - Key Value 2

      Label ID              Short Name    Long Name                             Def

      [ . . . Description Unchanged . . . ]
Field: GPFR_AF_LVL_3_VAL
             Field Type                       Char
             Length                           50
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll France
             Comments                         Application Framework - Key Value 3

      Label ID              Short Name    Long Name                          Def

      [ . . . Description Unchanged . . . ]




Field: GPFR_AF_LVL_4_VAL
             Field Type                       Char
             Length                           50
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll France
             Comments                         Application Framework - Key Value 4

      Label ID              Short Name    Long Name                          Def

      [ . . . Description Unchanged . . . ]




Field: GPFR_AF_LVL_5_VAL
             Field Type                       Char
             Length                           50
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll France
             Comments                         Application Framework - Key Value 5

      Label ID              Short Name    Long Name                          Def

      [ . . . Description Unchanged . . . ]




Field: GPFR_AF_LVL_6_VAL
             Field Type                       Char
             Length                           50
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll France
             Comments                         Application Framework - Key Value 6

      Label ID              Short Name    Long Name                          Def

      [ . . . Description Unchanged . . . ]




Field: GPFR_AF_LVL_7_VAL
             Field Type                       Char
             Length                           50
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll France
             Comments                         Application Framework - Key Value 7

      Label ID              Short Name    Long Name                           Def

      [ . . . Description Unchanged . . . ]




Field: GPFR_AF_LVL_8_VAL
             Field Type                       Char
             Length                           50
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll France
             Comments                         Application Framework - Key Value 8

      Label ID              Short Name    Long Name                           Def

      [ . . . Description Unchanged . . . ]




Field: GPFR_AF_LVL_9_VAL
             Field Type                       Char
             Length                           50
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll France
             Comments                         Application Framework - Key Value 9

      Label ID              Short Name    Long Name                           Def

      [ . . . Description Unchanged . . . ]




Field: GPFR_AF_LVL_PARM
             Field Type                       Char
             Length                           50
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll France
             Comments                         Field for Level Key Func.Parm

      Label ID              Short Name    Long Name                           Def

      [ . . . Description Unchanged . . . ]




Field: GPIN_ED_TYPE
             Field Type                       Char
             Length                           1
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll India

      Label ID              Short Name    Long Name                           Def
      [ . . . Description Unchanged . . . ]




Field: GPIN_GOVT_IND
             Field Type
             Length
             Format
             Family Name
             Display Name
             Owner ID




Field: GPJP_CHAR30
             Field Type                       Char
             Length                           30
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll Japan
             Comments
                                              Character field of 30 bytes long

      Label ID              Short Name       Long Name                          Def
      GPJP_CHAR30           Term             Term of Contract                   Yes




Field: GPJP_UC_CON_RENEW
             Field Type                       Char
             Length                           1
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll Japan
             Comments                         Contract States renewal condition

      Label ID              Short Name       Long Name                          Def
      GPJP_UC_CON_RENEW     Contract Renew   Contract States Renewal            Yes
      GPJP_UC_CON_RENEW     Contract         Contract                           Yes




Field: GPJP_UC_TERM_BY
             Field Type                       Char
             Length                           1
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll Japan
             Comments                         Contract was terminated by (29)

      Label ID              Short Name       Long Name                          Def
      EMPLOYEE              Employee         Employee
      GPJP_UC_TERM_BY       Term By          Contract was terminated by         Yes




Field: GPUS_FOREIGN_PMT
             Field Type                       Char
             Length                           18
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll United States
             Comments
                                              Foreign Payment Amount

      Label ID              Short Name        Long Name                        Def
      GPUS_FOREIGN_PMT      Foreign Payment   Foreign Payment Amount           Yes




Field: GPUS_FOREIGN_TRC
             Field Type                       Char
             Length                           22
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll United States
             Comments
                                              Foreign Trace Number

      Label ID              Short Name        Long Name                        Def
      GPUS_FOREIGN_TRC      Foreign Trace     Foreign Trace Number             Yes




Field: GPUS_FOREX_IND
             Field Type                       Char
             Length                           2
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll United States
             Comments
                                              Foreign Exchange Indicator

      Label ID              Short Name        Long Name                        Def
      GPUS_FOREX_IND        FOREX Ind         Foreign Exchange Indicator       Yes




Field: GPUS_FOREX_REF
             Field Type                       Char
             Length                           15
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll United States
             Comments
                                              Foreign Exchange Reference

      Label ID              Short Name        Long Name                        Def
      GPUS_FOREX_REF        FOREX Ref         Foreign Exchange Reference       Yes




Field: GPUS_FOREX_REF_IND
             Field Type                       Char
             Length                           1
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll United States
             Comments
                                              Foreign Exchange Reference Indicator

      Label ID              Short Name        Long Name                        Def
      GPUS_FOREX_REF_IND    FOREX Ref Ind     Foreign Exchange Reference Ind   Yes
Field: GPUS_IAT_DSCRPTR
             Field Type                      Char
             Length                          16
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             IAT Descriptor

      Label ID              Short Name       Long Name                       Def
      GPUS_IAT_DSCRPTR      IAT Descriptor   IAT Descriptor                  Yes




Field: GPUS_ISO_DCNTRY_CD
             Field Type                      Char
             Length                          2
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             ISO Destination Country Code

      Label ID              Short Name       Long Name                       Def
      GPUS_ISO_DCNTRY_CD    Dest Country     ISO Destination Country Code    Yes




Field: GPUS_ISO_DCRNCY_CD
             Field Type                      Char
             Length                          3
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             ISO Destination Currency Code

      Label ID              Short Name       Long Name                       Def
      GPUS_ISO_DCRNCY_CD    Dest Currency    ISO Destination Currency Code   Yes




Field: GPUS_ISO_OCRNCY_CD
             Field Type                      Char
             Length                          3
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             ISO Originating Currency Code

      Label ID              Short Name       Long Name                       Def
      GPUS_ISO_OCRNCY_CD    Orig Currency    ISO Originating Currency Code   Yes




Field: GPUS_ODFI_BR_CNTRY
             Field Type                      Char
             Length                          3
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             ODFI Branch Country

      Label ID              Short Name       Long Name                      Def
      GPUS_ODFI_BR_CNTRY    Branch Country   ODFI Branch Country            Yes




Field: GPUS_ODFI_ID
             Field Type                      Char
             Length                          34
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             ODFI ID

      Label ID              Short Name       Long Name                      Def
      GPUS_ODFI_ID          ODFI ID          ODFI ID                        Yes




Field: GPUS_ODFI_ID_QUAL
             Field Type                      Char
             Length                          2
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             ODFI ID Qualifier

      Label ID              Short Name       Long Name                      Def
      GPUS_ODFI_ID QUAL     ID Qualifier     ODFI ID Qualifier              Yes




Field: GPUS_ODFI_NAME
             Field Type                      Char
             Length                          35
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             ODFI Name

      Label ID              Short Name       Long Name                      Def
      GPUS_ODFI_NAME        ODFI Name        ODFI Name                      Yes




Field: GPUS_ORIG_ADDR
             Field Type                      Char
             Length                          35
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             Originator Address
      Label ID              Short Name        Long Name                        Def
      GPUS_ORIG_ADDR        Originator Addr   Originator Address               Yes




Field: GPUS_ORIG_CITY_ST
             Field Type                       Char
             Length                           35
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll United States
             Comments
                                              Originator City and State

      Label ID              Short Name        Long Name                        Def
      GPUS_ORIG_CITY_ST     City/State        Originator City/State            Yes




Field: GPUS_ORIG_CNTRY_PC
             Field Type                       Char
             Length                           35
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll United States
             Comments
                                              Originator Country and Postal Code

      Label ID              Short Name        Long Name                        Def
      GPUS_ORIG_CNTRY_PC    Country/Postal    Originator Country/Postal Code   Yes




Field: GPUS_ORIG_NAME
             Field Type                       Char
             Length                           35
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll United States
             Comments
                                              Originator Name

      Label ID              Short Name        Long Name                        Def
      GPUS_ORIG_NAME        Originator Name   Originator Name                  Yes




Field: GPUS_OSTATUS_CD
             Field Type                       Char
             Length                           1
             Format                           UpperCase
             Family Name
             Display Name
             Owner ID                         Global Payroll United States
             Comments
                                              Originator Status Code

      Label ID              Short Name        Long Name                        Def
      GPUS_OSTATUS_CD       Orig Status       Originator Status Code           Yes




Field: GPUS_PYEACCT_IAT
             Field Type                      Char
             Length                          1
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             International ACH Transaction Bank (or IAT) Indicator

      Label ID              Short Name       Long Name                        Def
      GPUS_PYEACCT_IAT      Intl Bank Acct   International ACH Bank Account   Yes




Field: GPUS_RCVR_ADDR
             Field Type                      Char
             Length                          35
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             Receiver Address

      Label ID              Short Name       Long Name                        Def
      GPUS_RCVR_ADDR        Receiver Addr    Receiver Address                 Yes




Field: GPUS_RCVR_CITY_ST
             Field Type                      Char
             Length                          35
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             Receiver City and State

      Label ID              Short Name       Long Name                        Def
      GPUS_RCVR_CITY_ST     City/State       Receiver City/State              Yes




Field: GPUS_RCVR_CNTRY_PC
             Field Type                      Char
             Length                          35
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             Receiver Country and Postal Code

      Label ID              Short Name       Long Name                        Def
      GPUS_RCVR_CNTRY_PC    Country/Postal   Receiver Country/Postal Code     Yes




Field: GPUS_RCVR_ID
             Field Type                      Char
             Length                          15
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             Receiver ID

      Label ID              Short Name       Long Name                      Def
      GPUS_RCVR_ID          Receiver ID      Receiver ID                    Yes




Field: GPUS_RCVR_NAME
             Field Type                      Char
             Length                          35
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             Receiver Name

      Label ID              Short Name       Long Name                      Def
      GPUS_RCVR_NAME        Receiver Name    Receiver Name                  Yes




Field: GPUS_RDFI_BR_CNTRY
             Field Type                      Char
             Length                          3
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             RDFI Branch Country

      Label ID              Short Name       Long Name                      Def
      GPUS_RDFI_BR_CNTRY    Branch Country   RDFI Branch Country            Yes




Field: GPUS_RDFI_ID
             Field Type                      Char
             Length                          34
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             RDFI ID

      Label ID              Short Name       Long Name                      Def
      GPUS_RDFI_ID          RDFI ID          RDFI ID                        Yes




Field: GPUS_RDFI_ID_QUAL
             Field Type                      Char
             Length                          2
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             RDFI ID Qualifier

      Label ID              Short Name       Long Name                      Def
      GPUS_RDFI_ID_QUAL     ID Qualifier     RDFI ID Qualifier              Yes
Field: GPUS_RDFI_NAME
             Field Type                      Char
             Length                          35
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             RDFI Name

      Label ID              Short Name       Long Name                      Def
      GPUS_RDFI_NAME        RDFI Name        RDFI Name                      Yes




Field: GPUS_RESERVED_10
             Field Type                      Char
             Length                          10
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             Reserved 10 Bytes

      Label ID              Short Name       Long Name                      Def
      GPUS_RESERVED_10      Rsrvd 10 Bytes   Reserved 10 Bytes              Yes




Field: GPUS_RESERVED_13
             Field Type                      Char
             Length                          13
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             Reserved 13 Bytes

      Label ID              Short Name       Long Name                      Def
      GPUS_RESERVED_13      Rsrvd 13 Bytes   Reserved 13 Bytes              Yes




Field: GPUS_RESERVED_14
             Field Type                      Char
             Length                          14
             Format                          UpperCase
             Family Name
             Display Name
             Owner ID                        Global Payroll United States
             Comments
                                             Reserved 14 Bytes

      Label ID              Short Name       Long Name                      Def
      GPUS_RESERVED_14      Rsrvd 14 Bytes   Reserved 14 Bytes              Yes




Field: GPUS_RESERVED_34
             Field Type                      Char
             Length                          34
             Format                          UpperCase
             Family Name
              Display Name
              Owner ID                        Global Payroll United States
              Comments
                                              Reserved 34 Bytes

       Label ID              Short Name       Long Name                      Def
       GPUS_RESERVED_34      Rsrvd 34 Bytes   Reserved 34 Bytes              Yes




Field: GPUS_RESERVED_6
              Field Type                      Char
              Length                          6
              Format                          UpperCase
              Family Name
              Display Name
              Owner ID                        Global Payroll United States
              Comments
                                              Reserved 6 Bytes

       Label ID              Short Name       Long Name                      Def
       GPUS_RESERVED_6       Rsrvd 6 Bytes    Reserved 6 Bytes               Yes




Field: GPUS_TRACE_NBR7
              Field Type                      Char
              Length                          7
              Format                          UpperCase
              Family Name
              Display Name
              Owner ID                        Global Payroll United States
              Comments
                                              Trace Number (7 Bytes)

       Label ID              Short Name       Long Name                      Def
       GPUS_TRACE_NBR7       Trace Number     Trace Number                   Yes




Field: GPUS_TXN_TYPE
              Field Type                      Char
              Length                          3
              Format                          UpperCase
              Family Name
              Display Name
              Owner ID                        Global Payroll United States
              Comments
                                              Transaction Type Code

       Label ID              Short Name       Long Name                      Def
       GPUS_TXN_TYPE         Txn Type         Transaction TYpe Code          Yes




                  Translate Value Detail
Translate Value: GPCH_SI_AHV_MIN (1900-01-01)         N
              Field Name                      GPCH_SI_AHV_MIN
              Value                           N
              EffDt                           1900-01-01
              Status                          Active
              Long Name                   Don't apply Minimum
              Short Name                  Don't Appl




Translate Value: GPCH_SI_AHV_MIN (1900-01-01)     Y
              Field Name                  GPCH_SI_AHV_MIN
              Value                       Y
              EffDt                       1900-01-01
              Status                      Active
              Long Name                   Apply Minimum
              Short Name                  Apply




Translate Value: GPES_SSTC_CNT_FLG (2000-01-01)   D
              Field Name                  GPES_SSTC_CNT_FLG
              Value                       D
              EffDt                       2000-01-01
              Status                      Active
              Long Name                   Contract of Limited duration
              Short Name                  Limited




Translate Value: GPES_SSTC_CNT_FLG (2000-01-01)   I
              Field Name                  GPES_SSTC_CNT_FLG
              Value                       I
              EffDt                       2000-01-01
              Status                      Active
              Long Name                   Unlimited Contract
              Short Name                  Unlimited




Translate Value: GPFR_AF_LVLREC_ALS (1900-01-01) ENT
              Field Name                  GPFR_AF_LVLREC_ALS
              Value                       ENT
              EffDt                       1900-01-01
              Status                      Active
              Long Name                   ENTITY
              Short Name                  ENTITY




Translate Value: GPFR_AF_LVLREC_ALS (1900-01-01) PRM
              Field Name                  GPFR_AF_LVLREC_ALS
              Value                       PRM
              EffDt                       1900-01-01
              Status                      Active
              Long Name                   Flexible
              Short Name                  Flexible




Translate Value: GPFR_AF_LVLREC_ALS (1900-01-01) SEC
              Field Name                  GPFR_AF_LVLREC_ALS
              Value                       SEC
              EffDt                       1900-01-01
              Status                      Active
              Long Name                   SEC
              Short Name                  SEC
Translate Value: GPIN_ED_TYPE (1900-01-01)          A
              Field Name                     GPIN_ED_TYPE
              Value                          A
              EffDt                          1900-01-01
              Status                         Active
              Long Name                      Central Government
              Short Name                     CGT




Translate Value: GPIN_ED_TYPE (1900-01-01)          B
              Field Name                     GPIN_ED_TYPE
              Value                          B
              EffDt                          1900-01-01
              Status                         Active
              Long Name                      Body of Individuals
              Short Name                     BOI




Translate Value: GPIN_ED_TYPE (1900-01-01)          D
              Field Name                     GPIN_ED_TYPE
              Value                          D
              EffDt                          1900-01-01
              Status                         Active
              Long Name                      Statutory body (Central Govt.)
              Short Name                     SBC




Translate Value: GPIN_ED_TYPE (1900-01-01)          E
              Field Name                     GPIN_ED_TYPE
              Value                          E
              EffDt                          1900-01-01
              Status                         Active
              Long Name                      Statutory body (State Govt.)
              Short Name                     SBS




Translate Value: GPIN_ED_TYPE (1900-01-01)          F
              Field Name                     GPIN_ED_TYPE
              Value                          F
              EffDt                          1900-01-01
              Status                         Active
              Long Name                      Firm
              Short Name                     FRM




Translate Value: GPIN_ED_TYPE (1900-01-01)          G
              Field Name                     GPIN_ED_TYPE
              Value                          G
              EffDt                          1900-01-01
              Status                         Active
              Long Name                      Autonomous body (Central Govt)
              Short Name                     ABC




Translate Value: GPIN_ED_TYPE (1900-01-01)          H
              Field Name                     GPIN_ED_TYPE
              Value                          H
              EffDt                          1900-01-01
              Status                         Active
              Long Name                      Autonomous body (State Govt.)
              Short Name                     ABS




Translate Value: GPIN_ED_TYPE (1900-01-01)          J
              Field Name                     GPIN_ED_TYPE
              Value                          J
              EffDt                          1900-01-01
              Status                         Active
              Long Name                      Artificial Juridicial Person
              Short Name                     AJP




Translate Value: GPIN_ED_TYPE (1900-01-01)          K
              Field Name                     GPIN_ED_TYPE
              Value                          K
              EffDt                          1900-01-01
              Status                         Active
              Long Name                      Company
              Short Name                     CPY




Translate Value: GPIN_ED_TYPE (1900-01-01)          L
              Field Name                     GPIN_ED_TYPE
              Value                          L
              EffDt                          1900-01-01
              Status                         Active
              Long Name                      Local Authority (Central Govt)
              Short Name                     LAC




Translate Value: GPIN_ED_TYPE (1900-01-01)          M
              Field Name                     GPIN_ED_TYPE
              Value                          M
              EffDt                          1900-01-01
              Status                         Active
              Long Name                      Branch / Division of Company
              Short Name                     BDC




Translate Value: GPIN_ED_TYPE (1900-01-01)          N
              Field Name                     GPIN_ED_TYPE
              Value                          N
              EffDt                          1900-01-01
              Status                         Active
              Long Name                      Local Authority (State Govt.)
              Short Name                     LAS




Translate Value: GPIN_ED_TYPE (1900-01-01)          P
              Field Name                     GPIN_ED_TYPE
              Value                          P
              EffDt                          1900-01-01
              Status                         Active
              Long Name                      Association of Person (AOP)
              Short Name                     AOP
Translate Value: GPIN_ED_TYPE (1900-01-01)           Q
              Field Name                     GPIN_ED_TYPE
              Value                          Q
              EffDt                          1900-01-01
              Status                         Active
              Long Name                      Individual/HUF
              Short Name                     HUF




Translate Value: GPIN_ED_TYPE (1900-01-01)           S
              Field Name                     GPIN_ED_TYPE
              Value                          S
              EffDt                          1900-01-01
              Status                         Active
              Long Name                      State Government
              Short Name                     SGT




Translate Value: GPIN_ED_TYPE (1900-01-01)           T
              Field Name                     GPIN_ED_TYPE
              Value                          T
              EffDt                          1900-01-01
              Status                         Active
              Long Name                      Association of Person (Trust)
              Short Name                     AOT




Translate Value: GPJP_LA_EMPL_TYP (2009-04-01)       5
              Field Name                     GPJP_LA_EMPL_TYP
              Value                          5
              EffDt                          2009-04-01
              Status                         Active
              Long Name                      Dispatched Laborer
              Short Name                     Dispatched




Translate Value: GPJP_LA_EMPL_TYP (2009-04-01)       6
              Field Name                     GPJP_LA_EMPL_TYP
              Value                          6
              EffDt                          2009-04-01
              Status                         Active
              Long Name                      Predefined term of Contract
              Short Name                     Predefined




Translate Value: GPJP_LA_TRM_CONTR (2009-04-01) 13
               Field Name                    GPJP_LA_TRM_CONTR
               Value                         13
               EffDt                         2009-04-01                       2008-04-01
               Status                        Active
               Long Name                     W/ renewal cond , 0.5 <=sy < 1   W/ renewal cond
       , srv yrs < 1
               Short Name                    W/   0.5~1                       W/ sy < 1
Translate Value: GPJP_LA_TRM_CONTR (2009-04-01) 15
              Field Name                 GPJP_LA_TRM_CONTR
              Value                      15
              EffDt                      2009-04-01                       2008-04-01
              Status                     Active
              Long Name                  W/O renewal cond, 0.5 <=sy <1    W/O renewal
      cond , srv yrs < 1
              Short Name                 W/O 0.5~1                        W/O sy < 1




Translate Value: GPJP_LA_TRM_CONTR (2009-04-01) 16
                Field Name               GPJP_LA_TRM_CONTR
                Value                    16
                EffDt                    2009-04-01
                Status                   Active
                Long Name                W/O renewal cond, srv yrs <0.5
                Short Name               W/O sy<0.5




Translate Value: GPJP_LA_TRM_CONTR (2009-04-01) 17
                Field Name               GPJP_LA_TRM_CONTR
                Value                    17
                EffDt                    2009-04-01
                Status                   Active
                Long Name                W/ renewal cond, srv yrs <0.5
                Short Name               W/ sy <0.5




Translate Value: GPJP_UC_CON_RENEW (2009-04-01) D
                Field Name               GPJP_UC_CON_RENEW
                Value                    D
                EffDt                    2009-04-01
                Status                   Active
                Long Name                Doesn't Specify Renewal
                Short Name               Not Spec




Translate Value: GPJP_UC_CON_RENEW (1900-01-01) N
                Field Name               GPJP_UC_CON_RENEW
                Value                    N
                EffDt                    2009-04-01                       1900-01-01
                Status                   Active
                Long Name                States No Renewal/Notified       No Contract
      Renewal
                Short Name               Notified                         No




Translate Value: GPJP_UC_CON_RENEW (2009-04-01) N
                Field Name               GPJP_UC_CON_RENEW
                Value                    N
                EffDt                    2009-04-01                       1900-01-01
                Status                   Active
                Long Name                States No Renewal/Notified       No Contract
      Renewal
                Short Name               Notified                         No




Translate Value: GPJP_UC_CON_RENEW (2009-04-01) O
                 Field Name               GPJP_UC_CON_RENEW
                 Value                    O
                 EffDt                    2009-04-01
                 Status                   Active
                 Long Name                States No Renewal/Not Notified
                 Short Name               Not Notif




Translate Value: GPJP_UC_CON_RENEW (1900-01-01) Y
                 Field Name               GPJP_UC_CON_RENEW
                 Value                    Y
                 EffDt                    1900-01-01
                 Status                   Active
                 Long Name                States Renewal                   Contract States
       Renewal
                 Short Name               Yes




Translate Value: GPJP_UC_TERM_BY (2009-04-01)    1
                 Field Name               GPJP_UC_TERM_BY
                 Value                    1
                 EffDt                    2009-04-01
                 Status                   Active
                 Long Name                Requested Contract Renewal
                 Short Name               Renewal




Translate Value: GPJP_UC_TERM_BY (2009-04-01)    2
                 Field Name               GPJP_UC_TERM_BY
                 Value                    2
                 EffDt                    2009-04-01
                 Status                   Active
                 Long Name                Requested No Contract Renewal
                 Short Name               No Renewal




Translate Value: GPJP_UC_TERM_BY (2009-04-01)    3
                 Field Name               GPJP_UC_TERM_BY
                 Value                    3
                 EffDt                    2009-04-01
                 Status                   Active
                 Long Name                Didn't Make Any Request
                 Short Name               No Request




Translate Value: GPJP_UC_TERM_BY (2009-04-01)    E
                 Field Name               GPJP_UC_TERM_BY
                 Value                    E
                 EffDt                    2009-04-01                       1900-01-01
                 Status                   Inactive                         Active
                 Long Name                Employee
                 Short Name               Employee




Translate Value: GPJP_UC_TERM_BY (2009-04-01)    R
                 Field Name               GPJP_UC_TERM_BY
                 Value                    R
                 EffDt                    2009-04-01                       1900-01-01
                 Status                   Inactive                         Active
             Long Name                           Employer
             Short Name                          Employer




                                   Page Detail
Page: GPAU_ELG_ELM
              Description                        Eligibility Inquiry Page, Grid
              Type                               Standard Page
              Allow Deferred Proc.               Yes
              Owner ID                           Global Payroll Australia
              Comments                           This page is used to display the result of an employee's
      eligibilty
                                                 , element group and elements in a grid format.

      Type     ID      Lvl Record          Field                   Label               Attributes
      PSGrid   .1      1   GPAU_ELG_ELM_VW                         ''                  Lvl 1 #1
      noSelUpdInsDel
      EditBox .2       1     GPAU_ELG_ELM_VW ELIG_GRP              +ELIG_GRP           Gray noPrompt
      EditBox .3       1     GPAU_ELG_ELM_VW PIN_NM                [None ]             Gray noPrompt
      EditBox .4       1     GPAU_ELG_ELM_VW PIN_ELEM_NUM          +PIN_ELEM_NUM       Hide CtrlFld
      noPrompt
      EditBox .5       1     GP_PIN          PIN_NM                -ELEMENT            Gray Related:4
      PushBtn .6       1     GPAU_ELG_TREEWR SEARCH_BUTTON         [#17201,4001]       PushBtn->PCode
      PushBtn .6       1     GPAU_ELG_TREEWR SEARCH_BUTTON         [#17201,4010]       PushBtn->PCode




Page: GPAU_ELIG_INQ
              Description                        Eligibility Inquiry Page
              Type                               Standard Page
              Allow Deferred Proc.               Yes
              Owner ID                           Global Payroll Australia
              Comments                           This page conatins the search details for an eligibility
      group, ele
                                                 ment group and elements of an employee. It also displays
      the result
                                                  in a dynamic tree, on a HTML area

      Type       ID    Lvl   Record            Field               Label               Attributes
      GroupBox   1     0     GPAU_ELG_TREEWR                       'Employee'
      EditBox    2     0     GPAU_ELG_TREEWR   EMPLID              +EMPLID             CtrlFld
      EditBox    3     0     PERSON_NAME       NAME                [None ]             Gray Related:2
      EditBox    4     0     GPAU_ELG_TREEWR   EMPL_RCD            +EMPL_RCD#          Zero
      EditBox    5     0     GPAU_ELG_TREEWR   ASOFDATE            +ASOFDATE           Century
      PushBtn    6     0     GPAU_ELG_TREEWR   SEARCH_BTN          +SEARCH_BTN         PushBtn->PCode
      EditBox    7     0     GPAU_ELG_ELM_VW   ELIG_GRP            +ELIG_GRP           Gray
      PushBtn    8     0     PRCSRQSTDLG_WRK   LOADPRCSMONITORPB   [#28,182]           HypLink->PCode
      EditBox    9     0     GPAU_ELG_TREEWR   TREECNTRLFIELD      [None ]             Hide
      PushBtn    10    0     GPAU_ELG_TREEWR   SRCH_BTN            [#17201,4002]       HypLink->PCode
      PushBtn    11    0     GPAU_ELG_TREEWR   SEARCH_TYPE         [#17201,4003]       HypLink->PCode
      PushBtn    10    0     GPAU_ELG_TREEWR   SRCH_BTN            [#17201,4012]       HypLink->PCode
      PushBtn    11    0     GPAU_ELG_TREEWR   SEARCH_TYPE         [#17201,4011]       HypLink->PCode
      GroupBox   12    0     GPAU_ELG_TREEWR   ELEM_USE            -ELEM_USES
      HtmlArea   13    0     GPAU_ELG_TREEWR   HTMLAREA            [None ]             Gray




Page: GPCH_EG_RSTATUS
             Description                          Run Control - Year End Proces
             Type                                Standard Page
             Allow Deferred Proc.                No
             Owner ID                          Global Payroll Switzerland
             Comments                          Run Control - Year End Proces

      Type     ID    Lvl Record              Field                Label                 Attributes
      SubPage 1      0   PRCSRUNCNTL                              ''                    ->
      PRCSRUNCNTL_LC_SBP
      GroupBox 2     0   GPCH_EG_STAT_DW                          ''
      SubPage 3      0   GPCH_RC_PAYROLL                          ''                    ->
      GPCH_EG_ST_HDR_SBP
      EditBox 4      0   GPCH_EG_STAT_DW     GROUP_LIST_ID        +GROUP_LIST_ID
      PSGrid   .5    1   GPCH_EG_RSTATUS                          [None ]               Lvl 1 #**
      noInsDel noSort noDefrr
      EditBox .6     1   GPCH_EG_RSTATUS     GPCH_RC_PAY_YEAR     +PAY YEAR             Hide
      EditBox .7     1   GPCH_EG_RSTATUS     COMPANY              +COMPANY              Hide
      EditBox .8     1   GPCH_EG_RSTATUS     GPCH_EG_DOMAINID     +DOMAIN_ID            Hide
      EditBox .9     1   GPCH_EG_RSTATUS     GPCH_SI_PROV_TYPE    +PROV_TYPE_CH         Hide CtrlFld
      EditBox .10    1   PSXLATITEM          XLATLONGNAME         -TYPE                 Gray Related:9
      CheckBox .11   1   GPCH_EG_STAT_DW     GPCH_RUN_OPTIONS     +RUN_OPTIONS          On:Y Off:N
      CheckBox .12   1   GPCH_EG_STAT_DW     GPCH_CANCEL_OPTION   +CANCEL OPTIONS       On:Y Off:N
      CheckBox .11   1   GPCH_EG_STAT_DW     GPCH_RUN_OPTIONS     +RUN_OPTIONS          On:Y Off:N Hide
      CheckBox .12   1   GPCH_EG_STAT_DW     GPCH_CANCEL_OPTION   +CANCEL OPTIONS       On:Y Off:N Hide
      ComboBox .13   1   GPCH_EG_RSTATUS     GPCH_REPORT_STATUS   +REPORT_STATUS        Gray XLatLong
      ComboBox .14   1   GPCH_EG_STAT_DW     GPCH_EG_RPT_TYPE     +REPORT CYCLE         XLatShort
      ComboBox .15   1   GPCH_EG_STAT_DW     GPCH_FK_QUARTER      +QUARTER              XLatShort
      EditBox .16    1   GPCH_EG_STAT_DW     GPCH_AL_CPAY_ENDDT   +CURR_PAY_END_DT      Century
      CheckBox .17   1   GPCH_EG_STAT_DW     GPCH_EG_MONTH_RUN    +GPCH_MONTH_RUN       On:Y Off:N
      CheckBox .17   1   GPCH_EG_STAT_DW     GPCH_EG_MONTH_RUN    +GPCH_PERIOD RUN      On:Y Off:N
      GroupBox .18   1   GPCH_EG_STAT_DW     GPCH_EG_REQ_LBL      +REPORT SELECTIONS
      PSGrid   .19   1   GPCH_RC_EMPLID                           [None ]               Lvl 1 #10
      EditBox .20    1   GPCH_RC_EMPLID      EMPLID               +EMPLID
      PSGrid   .21   1   GPCH_RC_EMPLID                           [None ]               Lvl 1 #1
      ComboBox .22   1   GPCH_RC_PROVIDR     GPCH_SI_PROV_TYPE    +PROV_TYPE_CH         XLatShort
      EditBox .23    1   GPCH_RC_PROVIDR     GPCH_SI_PROV_CD      +PROVIDER_CD_CH




Page: GPCH_EG_ST_HDR_SBP
             Description                       ELM Header Sub Page
             Type                              SubPage
             Allow Deferred Proc.              Yes
             Owner ID                          Global Payroll Switzerland
             Comments                          ELM Header Sub Page

      Type     ID    Lvl   Record            Field                Label                 Attributes
      EditBox 1      0     GPCH_RC_PAYROLL   GPCH_RC_PAY_YEAR     +PAY YEAR
      EditBox 2      0     GPCH_EG_STAT_DW   EFFDT                +EFFDT                Hide Century
      EditBox 3      0     GPCH_RC_PAYROLL   COMPANY              +COMPANY
      EditBox 4      0     GPCH_RC_PAYROLL   GPCH_RC_ADJUST_DT    +ISSUE_DATE           Century
      EditBox 5      0     GPCH_RC_PAYROLL   GPCH_EG_DOMAINID     +DOMAIN_ID
      EditBox 6      0     GPCH_EG_STAT_DW   GPCH_EG_DOMAINID     +DOMAIN_ID            Hide
      EditBox 7      0     GPCH_EG_STAT_DW   COMPANY              +COMPANY              Hide
      GroupBox 8     0     GPCH_EG_STAT_DW   GPCH_EG_REQ_LBL      +REQUEST FOR
      GroupBox 8     0     GPCH_EG_STAT_DW   GPCH_EG_REQ_LBL      +DASHBOARD PARAM
      ScrBar   .9    1                                            [None ]               Lvl 1 #1 noIns
      PushBtn .10    1     GPCH_EG_ST_HDR                         [#19,178]             PushBtn->Scroll
      enableOnDispOnly
      EditBox .11    1     GPCH_EG_ST_HDR    GPCH_RC_PAY_YEAR     +PAY YEAR             Hide
      EditBox .12    1     GPCH_EG_ST_HDR    GPCH_EG_CREATE       +GPCH_EG_CREATEFILE   Gray   noPrompt
      EditBox .13    1     GPCH_EG_ST_HDR    GPCH_EG_NAME         +NAME                 Gray   noPrompt
      EditBox .14    1     GPCH_EG_ST_HDR    GPCH_EG_VALIDATE     +GPCH_EG_VALIDATE     Gray   noPrompt
      EditBox .15    1     GPCH_EG_ST_HDR    EMAILID              +EMAILID              Gray   noPrompt
      EditBox .16    1     GPCH_EG_ST_HDR    GPCH_EG_SIGN         +GPCH_EG_SIGN         Gray   noPrompt
      EditBox .17    1     GPCH_EG_ST_HDR    PHONE                +PHONE                Gray   noPrompt
      EditBox .18    1     GPCH_EG_ST_HDR    COMPANY              +COMPANY              Hide
      EditBox .19    1     GPCH_EG_ST_HDR    GPCH_EG_ENCRYPT      +GPCH_EG_ENCRYPT      Gray   noPrompt
      EditBox .20    1     GPCH_EG_ST_HDR    GPCH_EG_MONITOR_ID   +MONITOR_ID           Gray   noPrompt
      EditBox .21    1     GPCH_EG_ST_HDR    GPCH_EG_DOMAINID     +DOMAIN_ID            Hide
      EditBox .22    1     GPCH_EG_ST_HDR    FILE_OUTPUT_DIR      +FILE_OUTPUT_DIR      Gray   noPrompt
      EditBox .23    1     GPCH_EG_ST_HDR    COMMENTS             +COMMENTS             Gray
Page: GPCH_OT_JOB_HIST
              Description                       Self Service - Absence - Jobs
              Type                              Standard Page
              Allow Deferred Proc.              Yes
              Owner ID                          Global Payroll Switzerland
              Comments                          Self Service - Absence Requests: This page allows to
      select the EMP
                                                L_RCD for a given EMPLID. If only one EMPL_RCD exists
      for an employ
                                                ee, this page is skiped.

      Type     ID     Lvl Record              Field                Label              Attributes

      [ . . . Description Unchanged . . . ]




Page: GPCH_OT_MNGR_L
             Description                        Launch Page - Mngr Approval
             Type                               Standard Page
             Allow Deferred Proc.               No
             Owner ID                           Global Payroll Switzerland
             Comments                           Launch Page for Manager Approval - Overtime

      Type     ID     Lvl Record              Field                Label              Attributes

      [ . . . Description Unchanged . . . ]




Page: GPCH_SI_DATA
             Description                        Personal SI Data
             Type                               Standard Page
             Allow Deferred Proc.               Yes
             Owner ID                           Global Payroll Switzerland
             Comments                           Personal SI Data Switzerland.

      Type     ID     Lvl   Record            Field                Label              Attributes
      EditBox 1       0     PER_ORG_ASGN_VW   EMPLID               +EMPLID            Gray CtrlFld
      EditBox 2       0     PERSON_NAME       NAME                 [None ]            Gray Related:1
      EditBox 3       0     PER_ORG_ASGN_VW   EMPL_RCD             +EMPL_RCD#         Gray CtrlFld
      EditBox 4       0     JOB               BUSINESS_UNIT        [None ]            Hide CtrlFld
      Related:3
      EditBox 5       0     JOB               LOCATION             [None ]            Hide CtrlFld
      Related:3
      EditBox 6       0     JOB               COMPANY              [None ]            Hide CtrlFld
      Related:3
      EditBox 7       0     LOCATION_TBL      STATE                [None ]            Hide Related:5
      ScrArea .8      1                                            [#17052,16]        Lvl 1 #1
      EditBox .9      1     GPCH_SI_DATA      EFFDT                +EFFDT             Century
      EditBox .10     1     GPCH_SI_DATA      END_DT               +END_DT            Century
      ComboBox .11    1     GPCH_SI_DATA      GPCH_SI_AHV_STATUS   -AHV_STATUS_CH     XLatShort
      EditBox .12     1     GPCH_SI_DATA      GPCH_SI_EE_AHV_PCT   -EE_AHV_PCT_CH     Hide
      Label    .13    1                                            [#17052,63]
      EditBox .14     1     GPCH_SI_DATA      GPCH_SI_TOT_AHV_PC   -TOT_AHV_PCT_CH    Gray
      ComboBox .15    1     GPCH_SI_DATA      GPCH_SI_ALV_STATUS   +ALV_STATUS_CH     XLatShort
      EditBox .16     1     GPCH_SI_DATA      GPCH_SI_EE_ALV1_PC   -EE_ALV1_PCT_CH    Hide
      Label    .17    1                                            [#17052,63]
      EditBox .18     1     GPCH_SI_DATA      GPCH_SI_TOT_ALV1PC   -TOT_ALV1_PCT_CH   Gray
      EditBox .19     1     GPCH_SI_DATA      GPCH_SI_EE_ALV2_PC   -EE_ALV2_PCT_CH    Hide
      CheckBox .20    1     GPCH_SI_DATA      GPCH_SI_YEAR         +GPCH_SI_YEAR      On:Y Off:N
      Label    .21    1                                            [#17052,63]
      ComboBox .22    1     GPCH_SI_DATA      GPCH_TX_UV_STATUS    -UV_STATUS_CH      XLatShort
      EditBox .23     1     GPCH_SI_DATA      GPCH_TX_UV_PROV_CD   -UV_PROV_CD_CH     CtrlFld
      EditBox .24     1     GPCH_SI_PROVIDR   DESCR                [None ]            Gray Related:23
      EditBox .25     1     GPCH_SI_DATA      GPCH_SI_BU_PCT       -BU_PCT_CH         Gray
      EditBox    .26   1     GPCH_SI_DATA      GPCH_SI_COV_UV     +COV_UV_CH              CtrlFld
      EditBox    .27   1     GPCH_SI_UV_PCT    GPCH_SI_EE_NBU_PCT -EE_NBU_PCT_CH          Hide Related:26
      EditBox    .28   1     GPCH_SI_DATA      GPCH_SI_PROV_TYPE +PROV_TYPE_CH            Hide
      Label      .29   1                                          [#17052,63]
      EditBox    .30   1     GPCH_SI_UV_PCT    GPCH_SI_BU_PCT     -BU_PCT_CH              Hide Related:26
      EditBox    .31   1     GPCH_SI_DATA      GPCH_SI_TOT_NBU_PC -TOT_NBU_PCT_CH         Gray
      EditBox    .32   1     GPCH_SI_DATA      GPCH_SI_EE_NBU_PCT -EE_NBU_PCT_CH          Hide
      Label      .33   1                                          [#17052,63]
      EditBox    .34   1     GPCH_SI_UV_PCT    GPCH_SI_TOT_NBU_PC -TOT_NBU_PCT_CH         Hide Related:26
      EditBox    .35   1     GPCH_SI_DATA      GPCH_SI_TOT_ALV2PC -TOT_ALV2_PCT_CH        Gray
      PushBtn    .36   1     GPCH_AL_PAY_DW    GPCH_AL_RESET1     +RESET_CH               PushBtn->PCode
      EditBox    .37   1     GPCH_AL_PAY_DW    COUNTRY            +COUNTRY                Hide CtrlFld
      EditBox    .38   1     GPCH_SI_SYS       GPCH_SI_EE_AHV_PCT -EE_AHV_PCT_CH          Hide Related:37
      EditBox    .39   1     GPCH_SI_SYS       GPCH_SI_EE_ALV1_PC -EE_ALV1_PCT_CH         Hide Related:37
      EditBox    .40   1     GPCH_SI_SYS       GPCH_SI_EE_ALV2_PC -EE_ALV2_PCT_CH         Hide Related:37
      CheckBox   .35   1     GPCH_SI_DATA      GPCH_SI_AHV_MIN    -GPCH_SI_AHV_MIN        On:Y Off:N
      EditBox    .36   1     GPCH_SI_DATA      GPCH_SI_TOT_ALV2PC -TOT_ALV2_PCT_CH        Gray
      PushBtn    .37   1     GPCH_AL_PAY_DW    GPCH_AL_RESET1     +RESET_CH               PushBtn->PCode
      EditBox    .38   1     GPCH_AL_PAY_DW    COUNTRY            +COUNTRY                Hide CtrlFld
      EditBox    .39   1     GPCH_SI_SYS       GPCH_SI_EE_AHV_PCT -EE_AHV_PCT_CH          Hide Related:38
      EditBox    .40   1     GPCH_SI_SYS       GPCH_SI_EE_ALV1_PC -EE_ALV1_PCT_CH         Hide Related:38
      EditBox    .41   1     GPCH_SI_SYS       GPCH_SI_EE_ALV2_PC -EE_ALV2_PCT_CH         Hide Related:38




Page: GPCH_TX_DATA
             Description                         Employee Source Tax Data CHE
             Type                                Standard Page
             Allow Deferred Proc.                Yes
             Owner ID                            Global Payroll Switzerland
             Comments                            Swiss Employee Source Tax Data

      Type     ID      Lvl   Record          Field                  Label                 Attributes
      SubPage 1        0     PER_ORG_ASGN_VW                        ''                    -> EMPL_SRCH_SBP
      ScrArea .2       1                                            [#17052,15]           Lvl 1 #1
      EditBox .3       1     GPCH_TX_DATA      EMPLID               [None ]               Hide CtrlFld
      EditBox .4       1     GPCH_TX_DATA      EMPL_RCD             [None ]               Hide CtrlFld
      EditBox .5       1     GPCH_TX_DATA      EFFDT                +EFFDT                CtrlFld Century
      EditBox .6       1     PERS_DATA_EFFDT   SEX                  [None ]               Hide Related:3
      EditBox .7       1     JOB               BUSINESS_UNIT        [None ]               Hide Related:4
      EditBox .8       1     JOB               LOCATION             [None ]               Hide CtrlFld
      Related:4
      EditBox .9       1     LOCATION_TBL      STATE                [None ]               Hide Related:8
      EditBox .10      1     DERIVED_HR        ADDRESS_TYPE         [None ]               Hide CtrlFld
      EditBox .11      1     ADDRESSES         COUNTRY              [None ]               Hide Related:10
      PushBtn .12      1     GPCH_TX_DATA      COMMENTS             [#17051,148]          PushBtn->PCode
      EditBox .13      1     DERIVED           RECNAME_EDIT         +RECNAME_EDIT         Hide
      EditBox .14      1     ADDRESSES         STATE                [None ]               Hide CtrlFld
      Related:10
      EditBox .15      1     GPCH_AL_PAY_DW    GPCH_AL_CANTON       +GPCH_CANTON          Gray
      CheckBox .16     1     GPCH_TX_DATA      GPCH_GR_OVRD         +OVERRIDE             On:Y Off:N
      EditBox .17      1     GPCH_TX_DATA      GPCH_TX_CANTON       +CANTON_CH            CtrlFld
      EditBox .18      1     GPCH_SI_STCD_VW   DESCR                [None ]               Gray Related:17
      EditBox .19      1     GPCH_TX_DATA      GPCH_TX_VILLAGE_CD   +VILLAGE_CD_CH        CtrlFld
      EditBox .20      1     GPCH_AL_PAY_DW    DESCR                [None ]               Gray
      CheckBox .21     1     GPCH_TX_DATA      GPCH_TX_QS_SW        +QS_STATUS            On:Y Off:N
      CheckBox .22     1     GPCH_TX_DATA      GPCH_TX_SPOUSE_WL    +GPCH_TGX_SPOUSE_WL   On:Y Off:N
      EditBox .23      1     GPCH_TX_DATA      GPCH_TX_SEX_OVRD     +GPCH_TX_SEX_OVRD
      EditBox .24      1     GPCH_TX_DATA      GPCH_TX_TRF_CD       +TARIF_CD_CH          CtrlFld
      EditBox .25      1     GPCH_AL_PAY_DW    GPCH_RC_DESCR1       +DEFAULT              Gray
      EditBox .26      1     GPCH_TX_STAR_VW   SEX                  [None ]               Hide Related:24
      EditBox .27      1     GPCH_TX_DATA      GPCH_TX_OVRD_PCT     +OVRD_PCT_CH          Zero
      EditBox .28      1     GPCH_TX_DATA      GPCH_TX_TRF_TYPE     +TARIF_TYPE_CH        Hide
      EditBox .29      1     GPCH_TX_DATA      GPCH_TX_OVRD_AMT     +OVRD_AMT_CH          Zero
      EditBox .30      1     GPCH_TX_DATA      CURRENCY_CD          [None ]               Hide
      EditBox .31      1     GPCH_TX_DATA      GPCH_TX_EST_YRLY     +GPCH_TX_EST_YRLY
      EditBox .12      1     DERIVED           RECNAME_EDIT         +RECNAME_EDIT         Hide
      EditBox .13      1     ADDRESSES         STATE                [None ]               Hide CtrlFld
      Related:10
      EditBox .14      1     GPCH_AL_PAY_DW    GPCH_AL_CANTON       +GPCH_CANTON          Gray
      CheckBox   .15   1   GPCH_TX_DATA      GPCH_GR_OVRD         +OVERRIDE             On:Y Off:N
      EditBox    .16   1   GPCH_TX_DATA      GPCH_TX_CANTON       +CANTON_CH            CtrlFld
      EditBox    .17   1   GPCH_SI_STCD_VW   DESCR                [None ]               Gray Related:16
      EditBox    .18   1   GPCH_TX_DATA      GPCH_TX_VILLAGE_CD   +VILLAGE_CD_CH        CtrlFld
      EditBox    .19   1   GPCH_AL_PAY_DW    DESCR                [None ]               Gray
      CheckBox   .20   1   GPCH_TX_DATA      GPCH_TX_QS_SW        +QS_STATUS            On:Y Off:N
      CheckBox   .21   1   GPCH_TX_DATA      GPCH_TX_SPOUSE_WL    +GPCH_TGX_SPOUSE_WL   On:Y Off:N
      EditBox    .22   1   GPCH_TX_DATA      GPCH_TX_SEX_OVRD     +GPCH_TX_SEX_OVRD
      EditBox    .23   1   GPCH_TX_DATA      GPCH_TX_TRF_CD       +TARIF_CD_CH          CtrlFld
      EditBox    .24   1   GPCH_AL_PAY_DW    GPCH_RC_DESCR1       +DEFAULT              Gray
      EditBox    .25   1   GPCH_TX_STAR_VW   SEX                  [None ]               Hide Related:23
      EditBox    .26   1   GPCH_TX_DATA      GPCH_TX_OVRD_PCT     +OVRD_PCT_CH          Zero
      EditBox    .27   1   GPCH_TX_DATA      GPCH_TX_TRF_TYPE     +TARIF_TYPE_CH        Hide
      EditBox    .28   1   GPCH_TX_DATA      GPCH_TX_OVRD_AMT     +OVRD_AMT_CH          Zero
      EditBox    .29   1   GPCH_TX_DATA      CURRENCY_CD          [None ]               Hide
      EditBox    .30   1   GPCH_TX_DATA      GPCH_TX_EST_YRLY     +GPCH_TX_EST_YRLY




Page: GPES_ABS_EVENT_ADD
             Description                       Absence Event -Additional Data
             Type                              Standard Page
             Allow Deferred Proc.              Yes
             Owner ID                          Global Payroll Spain
             Comments                          Absence Event - Additional Data

      Type     ID    Lvl   Record          Field                  Label                 Attributes
      SubPage 1      0     EMPLMT_SRCH_GBL                        ''                    ->
      EMPL_SRCH_COMP_SBP
      EditBox 2      0     INSTALLATION      INSTALLED_GP_ESP     [None ]               Hide
      EditBox 3      0     DERIVED           GP_EDIT_FLD1         [None ]               Hide
      ScrArea .4     1                                            [#17171,114]          Lvl 1 #1
      noUpdInsDel
      PushBtn .5     1     DERIVED_GPES      SEARCH_BUTTON        -SEARCH_BUTTON        PushBtn->PCode
      EditBox .6     1     GP_ABS_EVENT      PIN_TAKE_NUM         [None ]               Hide CtrlFld
      EditBox .7     1     GP_PIN            COUNTRY              [None ]               Hide Related:6
      EditBox .8     1     GP_PIN_NM_VW      PIN_NM               +ABSENCE_TAKE         Gray CtrlFld
      Related:6
      EditBox .9     1     GP_PIN_DESCR_VW   DESCR                [None ]               Gray Related:6
      EditBox .10    1     GP_ABS_EVENT      ABSENCE_REASON       +ABSENCE_REASON       CtrlFld
      EditBox .10    1     GP_ABS_EVENT      ABSENCE_REASON       +ABSENCE_REASON       noDefrr CtrlFld
      EditBox .11    1     GP_ABS_REASON     DESCR                [None ]               Gray Related:10
      EditBox .12    1     GP_ABS_EVENT_D    EFFDT                [None ]               Hide Century
      EditBox .13    1     GP_ABS_REASON     ABS_TYPE_OPTN        [None ]               Hide CtrlFld
      Related:6
      ComboBox .14   1     GP_PIN            USED_BY              [None ]               Hide Related:6
      XLatShort
      EditBox .15    1     GP_ABS_EVENT      BGN_DT              +BGN_DT             Gray Century
      EditBox .16    1     GP_ABS_EVENT      END_DT             +END_DT              Gray Century
      EditBox .17    1     GP_ABS_EVENT      ORIG_BEGIN_DT      +ORIG_BEGIN_DT       Gray Century
      ScrBar   ..18 2                                            [None ]             Lvl 2 #1 Hide
      GroupBox ..19 2      DERIVED_GPES      GPES_LBL_GRPBOX1   +FDI_DATA
      EditBox ..20 2       GPES_ABSEVT_AD    GPES_CHILD_NUM     +GPES_CHILD_NUM
      CheckBox ..21 2      GPES_ABSEVT_AD    GPES_LACKING_IND   +GPES_LACKING_IND    On:Y Off:N
      EditBox ..22 2       GPES_ABSEVT_AD    GPES_SICK_DATE     +GPES_INJURY_DATE    Century
      PSGrid   ..23 2      GPES_ABSEVT_NT                       [#17171,151]         Lvl 2 #1
      ComboBox ..24 2      GPES_ABSEVT_NT    GPES_FDI_NOTE_TYPE +GPES_FDI_NOTE_TYPE noDefrr XLatShort
      EditBox ..25 2       GPES_ABSEVT_NT    GPES_SICK_DATE     +GPES_SICK_DATE      Century
      EditBox ..26 2       GPES_ABSEVT_NT    GPES_FDI_NUMBER    +GPES_FDI_NUMBER
      ComboBox ..27 2      GPES_ABSEVT_NT    GPES_REASON_DISCHR +GPES_REASON_DISCHR XLatShort
      EditBox ..28 2       GPES_ABSEVT_NT    GPES_SENDING_ID    +GPES_SENDING_ID     Gray
      EditBox ..29 2       GPES_ABSEVT_NT    GPES_AREA_ID_CODE +GPES_AREA_ID_CODE
      EditBox ..30 2       GPES_ABSEVT_NT    NUMERIC_CD         +STATE
      EditBox ..31 2       GPES_ABSEVT_NT    GPES_STATE_REG      +STATE
      EditBox ..32 2       GPES_ABSEVT_NT    GPES_PHYSICIAN_ID +GPES_PHYSICIAN_ID
      CheckBox ..33 2      GPES_ABSEVT_NT    GPES_CONFIRM_SEND -GPES_CONFIRM_SEND On:Y Off:N
      noDefrr Gray
      CheckBox ..34 2      GPES_ABSEVT_NT    GPES_FDI_MODIFIED    +GPES_FDI_MODIFIED    On:Y Off:N
      noDefrr
      ScrBar   ..35 2                                             [None ]               Lvl 2 #1 Hide
      GroupBox ..36   2    DERIVED_GPES      GPES_LBL_GRPBOX1     +ECONOMICAL_DATA
      ComboBox ..37   2    GPES_ABSEVT_AD    FULL_PART_TIME       +FULL_PART_TIME       noDefrr
      XLatShort
      ComboBox ..38   2    GPES_ABSEVT_AD    GPES_DAYS_BSE_OVRD   +GPES_DAYS_BSE_OVRD   noDefrr XLatShort
      EditBox ..39    2    GPES_ABSEVT_AD    CONTRIB_DAYS_ESP     +CONTRIB_DAYS_ESP
      EditBox ..40    2    GPES_ABSEVT_AD    CONTRIB_BASE_ESP     +CONTRIB_BASE_ESP     Commas
      EditBox ..41    2    GPES_ABSEVT_AD    CONTRIB_OVER_ESP     +CONTRIB_OVER_ESP     Commas
      PSGrid   .42    1    GPES_ABS_TRIGR1                        [None ]               Lvl 1 #1 noSelUpd
      Hide
      EditBox .43     1    GPES_ABS_TRIGR1 EMPLID                 +EMPLID
      EditBox .44     1    GPES_ABS_TRIGR1 EFFDT                  +EFFDT                Century
      PSGrid   .45    1    GPES_ABS_TRIGR2                        [None ]               Lvl 1 #1 noSelUpd
      Hide
      EditBox .46     1    GPES_ABS_TRIGR2 EMPLID                 +EMPLID
      EditBox .47     1    GPES_ABS_TRIGR2 EFFDT                  +EFFDT                Century
      PSGrid   .48    1    GPES_ABS_TRIGR3                        [None ]               Lvl 1 #1 noSelUpd
      Hide
      EditBox .49     1    GPES_ABS_TRIGR3 EMPLID                 +EMPLID
      EditBox .50     1    GPES_ABS_TRIGR3 EFFDT                  +EFFDT                Century




Page: GPES_RC_SS_TC2
              Description                      FAN File Run Control
              Type                             Standard Page
              Allow Deferred Proc.             Yes
              Owner ID                         Global Payroll Spain
              Comments                         FAN File Run Control. This process generates the TC2
      flat file

      Type     ID    Lvl   Record            Field                Label                 Attributes
      SubPage 1      0     GPES_RC_SS                             ''                    ->
      PRCSRUNCNTL_SBP
      GroupBox 2     0     HR_LBL_WRK        RPT_PARAM_LBL        +RPT_PARAM_LBL
      EditBox 3      0     GPES_RC_SS        COMPANY              +COMPANY              CtrlFld
      EditBox 4      0     COMPANY_TBL       DESCR                [None ]               Gray Related:3
      ComboBox 5     0     GPES_RC_SS        YEARCD               [None ]               XLatShort
      EditBox 6      0     GPES_LABELS_WRK   GPES_LABEL           -SLASH                Hide
      ComboBox 7     0     GPES_RC_SS        GPES_MONTHCD         +YEAR_MONTH           XLatLong
      ComboBox 8     0     GPES_RC_SS        GPES_SSTC_PYMT_OPT   +PAYMENT_OPTN         XLatLong
      CheckBox 9     0     GPES_RC_SS        GPES_SPLIT_RTR_PMT   +GPES_SPLIT_RTR_PMT   On:Y Off:N
      EditBox 10     0     GPES_RC_SS        GPES_OOD_COMM_SUR    +GPES_COMPL_SURCHRG
      ComboBox 11    0     GPES_RC_SS        SOCS_PAY_TYPE_ESP    [None ]               Hide XLatLong
      CheckBox 12    0     GPES_RC_SS        GPES_SSTC_OUTOF_DT   +GPES_OVERUDE_PMNT    On:3 Off:0
      EditBox 13     0     GPES_RC_SS        GPES_OOD_PYMT_SUR    +GPES_OOD_PYMT_SUR
      CheckBox 14    0     GPES_RC_SS        GPES_TC2_MATH_VALD   +GPES_TC2_MATH_VLD    On:Y Off:N
      noDefrr
      EditBox 15     0     GPES_RC_SS        GPES_TC2_MATH_TOLR   +GPES_TC2_MATH_TOLR   Zero
      EditBox 16     0     GPES_RC_SS        GPES_FILE_PATH       -PATH
      EditBox 17     0     GPES_RC_SS        GPES_FILE_NAME       +GPES_FILE_NAME
      EditBox 18     0     GPES_RC_SS        GPES_FILE_NAME       +FAN                  Hide
      PSGrid   .19   1     GPES_RC_SS_TC2W                        [#17171,46]           Lvl 1 #3
      EditBox .20    1     GPES_RC_SS_TC2W   SSN_EMPLOYER         +SSN_EMPLOYER         CtrlFld
      EditBox .21    1     GPES_SS_WC_VW     DESCR                +DESCR                Gray Related:20
      ComboBox .22   1     GPES_SS_WC_VW     SSN_EMPL_TYPE        +SSN_EMPL_TYPE        Gray Related:20
      XLatShort
      EditBox .23    1     GPES_RC_SS_TC2W GPES_TRAINING_REDN +GPES_TRAINING_RED
      TabSepar .20   1                                        [#17171,69]
      EditBox .21    1     GPES_RC_SS_TC2W SSN_EMPLOYER       +SSN_EMPLOYER             CtrlFld
      EditBox .22    1     GPES_SS_WC_VW   DESCR              +DESCR                    Gray Related:21
      ComboBox .23   1     GPES_SS_WC_VW   SSN_EMPL_TYPE      -SSN_EMPL_TYPE            Gray Related:21
      XLatShort
      TabSepar .24   1                                        'Training Reduction
      EditBox .25    1     GPES_RC_SS_TC2W GPES_TRAINING_REDN -FT                 noPrompt Commas
      PushBtn .26    1     GPES_DERIVED    SRCH_BTN           +REFRESH_BTN        ImgBtn->PCode




Page: GPES_TERM_MNG
       Description                       Manage Terminations
       Type                              Standard Page
       Allow Deferred Proc.              Yes
       Owner ID                          Global Payroll Spain
       Comments                          Manage Terminations

Type     ID      Lvl   Record          Field                Label                 Attributes
EditBox 1        0     GPES_TERM_MNG   EMPLID               -EMPLID               Gray CtrlFld
EditBox 2        0     PERSON_NAME     NAME                 [None ]               Gray Related:1
EditBox 3        0     GPES_TERM_MNG   EMPL_RCD             -EMPL_RCD#            Gray Zero
GroupBox 4       0     DERIVED_GPES    GPES_LBL_GRPBOX1     +MAN_TERM
EditBox 5        0     GPES_TERM_MNG   TERMINATION_DT       +TERMINATION_DT       Gray Century
EditBox 6        0     PER_ORG_ASGN    CMPNY_SENIORITY_DT   +CMPNY_SENIORITY_DT   Gray Century
EditBox 7        0     PER_ORG_ASGN    SENIORITY_PAY_DT     +CMPNY_SENIORITY_DT   Gray Century
ComboBox 8       0     GPES_TERM_MNG   GPES_TERM_RSN        +GPES_TERM_RSN        noDefrr CtrlFld
XLatLong
EditBox 9        0   GPES_TERM_MNG     CURRENCY_CD          +CURRENCY_CD
SecPage 10       0                                          ''                    ->
CURRENCY_OTHER   Hide
GroupBox 11      0   DERIVED_GPES      GPES_LBL_GRPBOX1     +PREADVISED
EditBox 12       0   GPES_TERM_MNG     GPES_PREADV_DAY      +GPES_PREADV_DAY      Zero
ComboBox 13      0   GPES_TERM_MNG     GPES_WHO_PREADV      +GPES_WHO_PREADV      XLatLong
CheckBox 14      0   GPES_TERM_MNG     GPES_OVERW_INDM      +GPES_OVERW_INDM      On:Y Off:N
noDefrr
GroupBox 15      0     DERIVED_GPES    GPES_LBL_GRPBOX1     +SEVERANCE_PAY
Label    16      0                                          [#17171,127]
EditBox 17       0     GPES_TERM_MNG   GPES_INDM_DAYS       +GPES_INDM_DAYS       noDefrr Zero
EditBox 18       0     GPES_STA_TERM   GPES_INDM_DAYS       [None ]               noDefrr Gray
Related:8 Zero
EditBox 19       0     GPES_TERM_MNG   GPES_MAX_PRDS        +GPES_MAX_PRDS        noDefrr Zero
EditBox 20       0     GPES_STA_TERM   GPES_MAX_PRDS        [None ]               Gray Related:8
Zero
EditBox 21       0     GPES_TERM_MNG   GPES_INDM_AMT        +GPES_INDM_AMT        noDefrr MultCurr
Commas
CheckBox 22      0     GPES_TERM_MNG   GPES_APPEAL_FLG      +GPES_APPEAL_FLG      On:Y Off:N
noDefrr
GroupBox 23      0     DERIVED_GPES    GPES_LBL_GRPBOX1     +APPEALED
EditBox 24       0     GPES_TERM_MNG   GPES_CONC_DT         +GPES_CONC_DT         Century
EditBox 25       0     GPES_TERM_MNG   GPES_SEN_DT          +GPES_SEN_DT          Century
EditBox 26       0     GPES_TERM_MNG   GPES_FINAL_DT        +GPES_FINAL_DT        Century
EditBox 27       0     GPES_TERM_MNG   GPES_SEN_LITIG       +GPES_SEN_LITIG       noDefrr Commas
EditBox 28       0     GPES_TERM_MNG   GPES_SEN_INDM        +GPES_SEN_INDM        noDefrr Commas
EditBox 29       0     GPES_TERM_MNG   GPES_UNEMP_BENF      +GPES_UNEMP_BENF      noDefrr Commas
EditBox 30       0     GPES_TERM_MNG   COMMENTS             +COMMENTS
EditBox 6        0     GPES_TERM_MNG   SENIORITY_PAY_DT     +CMPNY_SENIORITY_DT   Century
EditBox 7        0     PER_ORG_ASGN    CMPNY_SENIORITY_DT   [None ]               Hide Century
EditBox 8        0     PER_ORG_ASGN    SENIORITY_PAY_DT     [None ]               Hide Century
ComboBox 9       0     GPES_TERM_MNG   GPES_TERM_RSN        +GPES_TERM_RSN        noDefrr CtrlFld
XLatLong
EditBox 10       0   GPES_TERM_MNG     CURRENCY_CD          +CURRENCY_CD
SecPage 11       0                                          ''                    ->
CURRENCY_OTHER   Hide
GroupBox 12      0   DERIVED_GPES      GPES_LBL_GRPBOX1     +PREADVISED
EditBox 13       0   GPES_TERM_MNG     GPES_PREADV_DAY      +GPES_PREADV_DAY      Zero
ComboBox 14      0   GPES_TERM_MNG     GPES_WHO_PREADV      +GPES_WHO_PREADV      XLatLong
CheckBox 15      0   GPES_TERM_MNG     GPES_OVERW_INDM      +GPES_OVERW_INDM      On:Y Off:N
noDefrr
GroupBox 16      0     DERIVED_GPES    GPES_LBL_GRPBOX1     +SEVERANCE_PAY
Label    17      0                                          [#17171,127]
EditBox 18       0     GPES_TERM_MNG   GPES_INDM_DAYS       +GPES_INDM_DAYS       noDefrr Zero
EditBox 19       0     GPES_STA_TERM   GPES_INDM_DAYS       [None ]               noDefrr Gray
Related:9 Zero
EditBox 20       0     GPES_TERM_MNG   GPES_MAX_PRDS        +GPES_MAX_PRDS        noDefrr Zero
EditBox 21       0     GPES_STA_TERM   GPES_MAX_PRDS        [None ]               Gray Related:9
Zero
EditBox 22       0     GPES_TERM_MNG   GPES_INDM_AMT        +GPES_INDM_AMT        noDefrr MultCurr
Commas
CheckBox 23      0     GPES_TERM_MNG   GPES_APPEAL_FLG      +GPES_APPEAL_FLG      On:Y Off:N
noDefrr
GroupBox 24      0     DERIVED_GPES    GPES_LBL_GRPBOX1     +APPEALED
EditBox 25       0     GPES_TERM_MNG   GPES_CONC_DT         +GPES_CONC_DT         Century
      EditBox    26    0   GPES_TERM_MNG    GPES_SEN_DT         +GPES_SEN_DT         Century
      EditBox    27    0   GPES_TERM_MNG    GPES_FINAL_DT       +GPES_FINAL_DT       Century
      EditBox    28    0   GPES_TERM_MNG    GPES_SEN_LITIG      +GPES_SEN_LITIG      noDefrr Commas
      EditBox    29    0   GPES_TERM_MNG    GPES_SEN_INDM       +GPES_SEN_INDM       noDefrr Commas
      EditBox    30    0   GPES_TERM_MNG    GPES_UNEMP_BENF     +GPES_UNEMP_BENF     noDefrr Commas
      EditBox    31    0   GPES_TERM_MNG    COMMENTS            +COMMENTS




Page: GPFR_AF_NODE_SEC
              Description                     Node Properties
              Type                            Secondary Page
              Allow Deferred Proc.            Yes
              Owner ID                        Global Payroll France
              Comments                        Application Framework - This page is used to enter
      properties of No
                                              de

      Type       ID    Lvl Record           Field               Label                Attributes

      [ . . . Description Unchanged . . . ]




Page: GPIN_24Q_RC
                Description                   Form 24Q Runcontrol Page
                Type                          Standard Page
                Allow Deferred Proc.          Yes
                Owner ID                      Global Payroll India
                Comments                      Form 24Q Runcontrol Page

      Type       ID    Lvl Record           Field               Label                Attributes

      [ . . . Description Unchanged . . . ]




Page: GPIN_ESTAB
              Description                     Establishment Registrations
              Type                            Standard Page
              Allow Deferred Proc.            Yes
              Owner ID                        Global Payroll India
              Comments                        This is the Main Page under Establishment India. This
      Page captures
                                               the Registration Details under Factories/Shops Act.

      Type       ID    Lvl Record           Field               Label                Attributes

      [ . . . Description Unchanged . . . ]




Page: GPJP_UC_TERM_RSN
                Description                   UC Reason of termination
                Type                          Standard Page
                Allow Deferred Proc.          No
                Owner ID                      Global Payroll Japan
                Comments                      Page to display and capture UC Reason of termination

      Type     ID    Lvl   Record           Field               Label                Attributes
      SubPage 1      0     JOB                                  ''                   ->
      EMPL_SRCH_COMP_SBP
      ScrArea .2     1                                          [#17270,179]         Lvl 1 #1 noInsDel
      EditBox .3     1     GPJP_UC_HEADER   GPJP_UC_TERM_DATE   +GPJP_UC_TERM_DATE   Gray noPrompt
      Century
      GroupBox .4    1     GPJP_LBL_WRK     GPJP_WORK1          +UC_REASON
      Label    .5    1                                          [#17271,151]
      RadioBtn   .6    1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:001
      Label      .7    1                                       [#17271,152]
      RadioBtn   .8    1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:002
      Label      .9    1                                       [#17271,154]
      Label      .10   1                                       [#17271,153]
      RadioBtn   .11   1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:003
      EditBox    .12   1   GPJP_UC_HEADER   GPJP_UC_RETIRE_AGE +GPJP_UC_RETIRE_AGE
      Label      .13   1                                       [#17271,155]
      RadioBtn   .14   1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:004
      Label      .15   1                                       [#17271,182]
      Label      .16   1                                       [#17271,156]
      RadioBtn   .17   1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:005
      EditBox    .18   1   GPJP_UC_HEADER   GPJP_UC_MTH_CONTR +GPJP_UC_MTH_CONTR
      EditBox    .19   1   GPJP_UC_HEADER   GPJP_UC_TOT_MTH    +GPJP_UC_TOT_MTH
      EditBox    .20   1   GPJP_UC_HEADER   GPJP_UC_NUM_UPDT   +GPJP_UC_NUM_UPDT
      EditBox    .21   1   GPJP_UC_HEADER   GPJP_UC_CON_RENEW +GPJP_UC_CON_RENEW
      ComboBox   .22   1   GPJP_UC_HEADER   GPJP_UC_TERM_BY    +GPJP_UC_TERM_BY      XLatShort
      ComboBox   .21   1   GPJP_UC_HEADER   GPJP_UC_CON_RENEW +GPJP_UC_CON_RENEW     XLatLong
      ComboBox   .22   1   GPJP_UC_HEADER   GPJP_UC_TERM_BY    +GPJP_UC_TERM_BY      XLatLong
      Label      .23   1                                       [#17271,157]
      RadioBtn   .24   1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:006
      Label      .25   1                                       [#17271,158]
      RadioBtn   .26   1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:007
      Label      .27   1                                       [#17271,160]
      Label      .28   1                                       [#17271,159]
      RadioBtn   .29   1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:008
      Label      .30   1                                       [#17271,161]
      RadioBtn   .31   1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:009
      Label      .32   1                                       [#17271,162]
      Label      .33   1                                       [#17271,163]
      RadioBtn   .34   1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:010
      Label      .35   1                                       [#17271,164]
      RadioBtn   .36   1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:011
      Label      .37   1                                       [#17271,166]
      Label      .38   1                                       [#17271,167]
      Label      .39   1                                       [#17271,165]
      RadioBtn   .40   1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:014
      Label      .41   1                                       [#17271,171]
      EditBox    .42   1   GPJP_UC_HEADER   GPJP_UC_TRAINING   +GPJP_UC_TRAINING
      Label      .43   1                                       [#17271,170]
      RadioBtn   .44   1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:017
      Label      .45   1                                       [#17271,173]
      RadioBtn   .46   1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:012
      Label      .47   1                                       [#17271,184]
      Label      .48   1                                       [#17271,168]
      RadioBtn   .49   1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:015
      RadioBtn   .50   1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:013
      Label      .51   1                                       [#17271,169]
      RadioBtn   .52   1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:016
      Label      .53   1                                       [#17271,172]
      EditBox    .54   1   GPJP_UC_HEADER   GPJP_UC_OLD_LOC    +GPJP_UC_OLD_LOC
      EditBox    .55   1   GPJP_UC_HEADER   GPJP_UC_NEW_LOC    +GPJP_UC_NEW_LOC
      RadioBtn   .56   1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:018
      Label      .57   1                                       [#17271,174]
      RadioBtn   .58   1   GPJP_UC_HEADER   GPJP_UC_TERM_RSN   [None ]               Value:019
      Label      .59   1                                       [#17271,175]
      EditBox    .60   1   GPJP_UC_HEADER   GPJP_UC_REASON     +GPJP_UC_REASON
      Label      .61   1                                       [#17271,180]
      EditBox    .62   1   GPJP_UC_HEADER   GPJP_UC_STATEMENT [None ]




Page: GP_RSLT_RUN_SBP
             Description                      Results - Calendar Summary
             Type                             SubPage
             Allow Deferred Proc.             Yes
             Owner ID                         Global Payroll Core Applicatn
             Comments                         Results - Calendar Summary

      Type       ID    Lvl Record           Field              Label                 Attributes
      [ . . . Description Unchanged . . . ]




                        Component Detail
Component: GPCH_OT_STA_MGR_L (GBL)
              Description                     Launch Overtime Requests
              Search Record                   OPR_ROWS_VW
              Add Search Record
              Force Search                    No
              Disable Saving Page             Yes
              Include in Navigator            Yes
              Mandatory SpellCheck            No
              Actions                         Update
              Comments                        Self Service transaction for a manager role to launch
      the Overtime
                                              Requests transaction for their employees.
             Owner ID                         Global Payroll Switzerland

             Internet
             Primary Action                   Search
             Default Action                   Update
             Default Lookup Type              Basic
             Allow Action Mode Sel.           Yes
             Link to App Page    Msg          124
                                 Nbr          62
             Link to Search Page Msg          124
                                 Nbr          63
             Instructional Text Msg           124
                                 Nbr          50
             Disp Folder Tab (top)            Yes
             Disp Hiperlinks (bottom)         Yes
             Processing Mode                  Deffered
             Allow Expert Entry               No
             Show ToolBar                     Yes
                Save                          No
                Cancel                        Yes
                SpellCheck                    No
                Return to List                Yes
                Next in List                  No
                Prev in List                  No
                Next Page                     No                                   Yes
                Prev Page                     No                                   Yes
                Refresh                       No
                Notify                        Yes
                View Worklist                 Yes
                Next Worklist                 Yes
                Prov Worklist                 Yes
                Add                           No
                Update                        No
                UpdateAll                     No
                Correction                    No
             Show Pagebar                     Yes
                Help Link                     Yes
                Copy URL Link                 Yes
                New Window Link               Yes
                Customize Page Link           Yes

      Panel Name         Item Name                  Hid   Item Label             Folder Tab Label

      [ . . . Description Unchanged . . . ]
Component: GPCH_OT_VW_MGR_L (GBL)
              Description                     Launch Overtime Requests
              Search Record                   OPR_ROWS_VW
              Add Search Record
              Force Search                    No
              Disable Saving Page             Yes
              Include in Navigator            Yes
              Mandatory SpellCheck            No
              Actions                         Update
              Comments                        Self Service transaction for a manager role to launch
      the Overtime
                                              Requests transaction for their employees.
             Owner ID                         Global Payroll Switzerland

             Internet
             Primary Action                   Search
             Default Action                   Update
             Default Lookup Type              Basic
             Allow Action Mode Sel.           Yes
             Link to App Page    Msg          124
                                 Nbr          62
             Link to Search Page Msg          124
                                 Nbr          63
             Instructional Text Msg           124
                                 Nbr          50
             Disp Folder Tab (top)            Yes
             Disp Hiperlinks (bottom)         Yes
             Processing Mode                  Deffered
             Allow Expert Entry               No
             Show ToolBar                     Yes
                Save                          No
                Cancel                        Yes
                SpellCheck                    No
                Return to List                Yes
                Next in List                  No
                Prev in List                  No
                Next Page                     No                                   Yes
                Prev Page                     No                                   Yes
                Refresh                       No
                Notify                        Yes
                View Worklist                 Yes
                Next Worklist                 Yes
                Prov Worklist                 Yes
                Add                           No
                Update                        No
                UpdateAll                     No
                Correction                    No
             Show Pagebar                     Yes
                Help Link                     Yes
                Copy URL Link                 Yes
                New Window Link               Yes
                Customize Page Link           Yes

      Panel Name         Item Name                     Hid   Item Label          Folder Tab Label

      [ . . . Description Unchanged . . . ]




Component: GPCH_OT_VW_PA_L (GBL)
             Description                      Launch Overtime
             Search Record                    OPR_ROWS_VW
             Add Search Record
             Force Search                     No
             Disable Saving Page              Yes
             Include in Navigator             Yes
             Mandatory SpellCheck             No
             Actions                          Update
               Comments                          Self Service transaction for a Personnel Administrator
        role to laun
                                                 ch the Overtime transaction for their employees.
                Owner ID                         Global Payroll Switzerland

                Internet
                Primary Action                   Search
                Default Action                   Update
                Default Lookup Type              Basic
                Allow Action Mode Sel.           Yes
                Link to App Page    Msg          124
                                    Nbr          62
                Link to Search Page Msg          124
                                    Nbr          63
                Instructional Text Msg           124
                                    Nbr          50
                Disp Folder Tab (top)            Yes
                Disp Hiperlinks (bottom)         Yes
                Processing Mode                  Deffered
                Allow Expert Entry               No
                Show ToolBar                     Yes
                   Save                          No
                   Cancel                        Yes
                   SpellCheck                    No
                   Return to List                Yes
                   Next in List                  No
                   Prev in List                  No
                   Next Page                     No                                     Yes
                   Prev Page                     No                                     Yes
                   Refresh                       No
                   Notify                        Yes
                   View Worklist                 Yes
                   Next Worklist                 Yes
                   Prov Worklist                 Yes
                   Add                           No
                   Update                        No
                   UpdateAll                     No
                   Correction                    No
                Show Pagebar                     Yes
                   Help Link                     Yes
                   Copy URL Link                 Yes
                   New Window Link               Yes
                   Customize Page Link           Yes

        Panel Name            Item Name                Hid   Item Label               Folder Tab Label

        [ . . . Description Unchanged . . . ]




                  Message Catalog Detail
Message Catalog Entry: Global Payroll - Online          17000, 256
                Severity                         Error
                Msg Text                         Supporting Element Override data not entered.
                Explanation
                                                 Enter Supporting Element Override data.      Or, if you
        wish to delete
                                                 the row, use the "-" (minus) button on the grid.




Message Catalog Entry: Global Payroll - Online          17000, 482
                Severity                         Error
                Msg Text                         Recipient Tag must be greater than zero when specifying
       an Individual Recipient
               Explanation                       A Payee's Deduction Recipient must use a Recipient Tag
       greater than
                                                  zero, when selecting a Recipient ID that is defined as
       an Individu
                                                 al Recipient.
                                                  zero, when selecting a Recipient Name or a Recipient
       ID that is de
                                                 fined as an Individual Recipient.




Message Catalog Entry: GP Switzerland - Online           17051, 182
                Severity                         Error
                Msg Text                         Report is already run for specified Calendar End Date.

                Explanation
                                                 Kindly delete the corresponding RequestID and Re-run
       dashboard.




Message Catalog Entry: GP Switzerland - Online           17051, 183
                Severity                         Error
                Msg Text                         Year in Current Pay end Date does not match Domain Pay
       Year .
                Explanation
                                                 Year in Current Pay end Date does not match Domain Pay
       Year .




Message Catalog Entry: GP UK - Online                    17130, 249
                Severity                         Message
                Msg Text                         There is a system limit of 2 for each CTA Court Order.

                Explanation
                                                 Accoding to the legislation , a maximum of only 2 CTA
       Court Orders
                                                 can be operated from one charging authority.




Message Catalog Entry: GP UK - Batch                     17135, 366
               Severity                          Message
               Msg Text                          P6/P9 Warning : employee %1 has multiple jobs - will only
       update empl rcd %2                        P6/P9 Warning : employee %1 has multiple jobs - will only
       update empl rcd 0
               Explanation                       EDI Message




Message Catalog Entry: GP UK - Batch                     17135, 535
                Severity                         Warning
                Msg Text                         Incorrect Emplid,Empl_Rcd derived from WorksId: %1
                Explanation                      Incorrect Emplid,Empl_Rcd derived from WorksId




Message Catalog Entry: GP UK - Batch                     17135, 536
              Severity                           Message
              Msg Text                           P6/P9 Error : No Employment Record Available For   %1 for
       WorksId (%2)
              Explanation
                                                 P6/P9 Error : No related UK Employment Record available
       For Update.
                                               Hence the update fails.




Message Catalog Entry: GP Spain - Batch                  17175, 362
              Severity                       Error
              Msg Text                       Employee is assigned to a daily work group and you have
       informed SS VR TRATA DIARIO with value %1
              Explanation
                                             Variable SS VR TRATA DIARIO should be informed only to
       monthly empl
                                             oyees.




Message Catalog Entry: GP Australia - Text Messages      17201, 4010
               Severity                        Message
               Msg Text                        Return
               Explanation
                                               Return




Message Catalog Entry: GP Australia - Text Messages      17201, 4011
               Severity                        Message
               Msg Text                        Print
               Explanation
                                               Print




Message Catalog Entry: GP Australia - Text Messages      17201, 4012
               Severity                        Message
               Msg Text                        Convert to Excel
               Explanation
                                               Convert to Excel




        Appl Engine (Program) Detail
Appl Engine (Prog): GPFR_ASS_AE
               Description                     ASSEDIC :Data Retrieval.
               Disable Restart                 No
               Application Library             No
               ProgType                        Standard
               Batch Only                      No
               Message Set                     0
               Instance Count                  0
               TempTable cannot Assign         Continue
               Date Override                   No
               As of Date                      1900-01-01
               Owner ID                        Global Payroll France
               Comments                        ASSEDIC Certificate :Data Retrieval.

       State Record      Def

       [ . . . Description Unchanged . . . ]
Appl Engine (Prog): GPFR_RPT_AE
              Description                       Library for Appframework
              Disable Restart                   No
              Application Library               Yes
              ProgType                          Standard
              Batch Only                        No
              Message Set                       0
              Instance Count                    0
              TempTable cannot Assign           Continue
              Date Override                     No
              As of Date                        1900-01-01
              Owner ID                          Global Payroll France
              Comments                          Library for Application Framework which contains
       sections to be cal
                                                led from Node Definitions

       State Record     Def

       [ . . . Description Unchanged . . . ]




         Appl Engine (Section) Detail
Appl Engine (Section): GPAU_TFN_ELC                    B1_Data
               Description                      Get Data for TFN
               Market                           GBL
               DataBase                         Default
               EffDt                            1900-01-01
               Effective Status                 Active
               Section Type                     Prepare Only
               Auto Commit                      No
               Comment                          Select Employee Tax records with effective date within
       the specifie
                                                d From and To dates, and all the supporting information
       and write i
                                                t into a temporary table - GPAU_FTP_EL_TAO

       Step/Action        Description                        Attributes
       [TFN     ]         Get TFN data
           [SQL         ] Get TFN data

       [TFN2    ]           Update stats
           [SQL         ]

       [Term    ]         Update termination indicator
           [SQL         ] Update termination indicator

       [Delete ]            Term2 description
           [SQL         ]




Appl Engine (Section): GPCH_AE_ELM                     STAX_XML
              Description                       Source Tax File Generation
              Market                            GBL
              DataBase                          Default
              EffDt                             1900-01-01
              Effective Status                  Active
              Section Type                      Prepare Only
              Auto Commit                       No

       Step/Action          Description                      Attributes
       [Step01 ]             Create Source Tax File
           [PeopleCode   ]
           [PeopleCode   ]                                    On Return: Break

       [Step02 ]             Save the File Name
           [PeopleCode   ]
           [SQL          ]




Appl Engine (Section): GPDE_CT_ARBS                      2.3.2_1B
              Description                         General Information on Employm
              Market                              GBL
              DataBase                            Default
              EffDt                               1900-01-01
              Effective Status                    Active
              Section Type                        Prepare Only
              Auto Commit                         No

       Step/Action           Description                      Attributes
       [Step01 ]             Employee not paid a month
           [SQL          ]

       [Step02 ]          Update temp table
           [Call Section]                                     Section: GPDE_CT_ARBS.ARBS_UPD

       [Step03 ]             Not paid a month's information
           [PeopleCode   ]




Appl Engine (Section): GPDE_DV_REP                       DSME_PF
              Description                         DSME_SO for Pension Fund
              Market                              GBL
              DataBase                            Default
              EffDt                               1900-01-01
              Effective Status                    Active
              Section Type                        Prepare Only
              Auto Commit                         No

       Step/Action           Description                      Attributes
       [Step01 ]             Delete from GPDE_DV_DSME_PF
           [SQL          ]

       [Step02 ]             Insert into GPDE_DV_DSME_PF
           [SQL          ]

       [Step04 ]             Update DSME_PF.CAL_RUN_ID
           [SQL          ]

       [Step03 ]             Copy PF into GPDE_DV_DSME_SO
           [SQL          ]




Appl Engine (Section): GPDE_DV_REP                       REP_XFER
              Description                         Transfer generated reports
              Market                              GBL
              DataBase                            Default
              EffDt                               1900-01-01
              Effective Status                    Active
              Section Type                        Critical Updates
              Auto Commit                         No
              Comment                             Soll neu melden

                                                  (Alle DSME haben bei Generierung: Worked = N)

                                                  1. alle DSME in Soll mit
                                               - Run Id
                                               - einem identischen DSME und identischem DBME in Ist
                                               Worked = Y setzen

                                               2. alle DSME in Soll mit
                                               - Run Id
                                               - Worked = N
                                               nach Ist uebertragen

                                               3. alle DBME in Soll mit
                                               - einem DSME mit Worked = N
                                               nach Ist uebertragen

                                               4. Alle DSME in Soll mit
                                               - Run Id
                                               - Worked = N
                                               Worked = Y setzen

       Step/Action           Description                     Attributes
       [EXIST? ]             EXIST?
           [SQL          ]

       [EX_AEND ]            EX_AEND
           [SQL          ]

       [EX_CONTR]            EX_CONTR
           [SQL          ]

       [WRK_PF ]             Update GPDE_DV_WORK for PF
           [SQL          ]

       [XFER_DS ]            XFER_DS
           [SQL          ]

       [XFER_DS4]            Membership number validation
           [PeopleCode   ]

       [XFER_DB ]            XFER_DB
           [SQL          ]

       [XFER_DUV]            XFER_DUV
           [SQL          ]

       [UPD_WKD ]            UPD_WKD
           [SQL          ]

       [UPDWKDPF]            UPD_WKD Pension Fund
           [SQL          ]




Appl Engine (Section): GPFR_ASS_AE                        DATA CAL
              Description                      Call HR Procedures
              Market                           GBL
              DataBase                         Default
              EffDt                            1900-01-01
              Effective Status                 Active
              Section Type                     Prepare Only
              Auto Commit                      No

       Step/Action        Description                        Attributes
       [CALL0   ]         Delete in working tables
           [Call Section] Delete in working tables           Section: GPFR_ASS_AE.DEL DAT

       [CALL1   ]         Fill in GPFR_ASS_COMP
           [Call Section] Call Section COMP DAT              Section: GPFR_ASS_AE.COMP DAT

       [CALL2   ]         Fill in GPFR_ASS_PAYEE
           [Call Section] Call Section EMPL DAT              Section: GPFR_ASS_AE.EMPL DAT
       [CALL3   ]         Fill in GPFR_ASS_PAYEE
           [Call Section] Call Section FUNDS                Section: GPFR_ASS_AE.FUNDS

       [CALL4   ]         Fill in Job Data
           [Call Section] Call Section JOB DATA             Section: GPFR_ASS_AE.JOB

       [CALL5   ]         Fill in Notice Period and Job
           [Call Section] Call Section NOTICE               Section: GPFR_ASS_AE.NOTICE

       [CALL6   ]         Fill in Wages Frame 7.1
           [Call Section] Call Section WAGE 7.1             Section: GPFR_ASS_AE.WAGE 7.1
           [Do Select   ] Select Main From Pay              Type: Select/Fetch

       [CALL7   ]         Fill in Wages Frame 7.2
           [Call Section] Call Section WAGE 7.2             Section: GPFR_ASS_AE.WAGE 7.2
           [Do Select   ] Select Main from Pay              Type: Select/Fetch

       [CALL8   ]         Fill in Wages Frame 7.3
           [Call Section] Call Section WAGE 7.3             Section: GPFR_ASS_AE.WAGE 7.3
           [Do Select   ] Select Main from Pay              Type: Select/Fetch

       [CALL9   ]
           [Call Section]                                   Section: GPFR_ASS_AE.LPR




Appl Engine (Section): GPFR_ASS_AE                   LPR
              Description                     Section1 description
              Market                          GBL
              DataBase                        Default
              EffDt                           1900-01-01
              Effective Status                Active
              Section Type                    Prepare Only
              Auto Commit                     No

       Step/Action           Description                    Attributes
       [Step01 ]
           [PeopleCode   ]




Appl Engine (Section): GPFR_ASS_AE                   WAGE 7.3
              Description                     Wages Frame 7.3
              Market                          GBL
              DataBase                        Default
              EffDt                           1900-01-01
              Effective Status                Active
              Section Type                    Prepare Only
              Auto Commit                     No

       Step/Action         Description                    Attributes
       [Step01 ]           Insert into PS_GPFR_ASS_WAGE_3
           [SQL          ] Insert into PS_GPFR_ASS_WAGE_3

       [Step02 ]           Select Results From WA
           [Do Select    ] Select results from WA           Type: Select/Fetch
           [SQL          ] Update GPFR_ASS_WAGE_3

       [Step03 ]           Sum of Allowances
           [PeopleCode   ] Set Sum of Allowances

       [Step04 ]           Set Flag Redundancy
           [SQL          ] Set Flag

       [Step05 ]           Set Flag Redundancy Additionna
           [SQL          ] Set Flag

       [Step06 ]           Set Flag End CDD
           [SQL          ] Set Flag End CDD
       [Step07 ]           Set Flag End Mission
           [SQL          ] Set Flag End Mission

       [Step08 ]           Set Flag Retirement
           [SQL          ] Set Flag Retirement

       [Step09 ]           Set Flag Special Allowance
           [SQL          ] Set Flag Special Allowance

       [Step10 ]           Set Flag Journalist
           [SQL          ] Set Flag Journalist

       [Step11 ]           Set Flag Customer
           [SQL          ] Set Flag Customer

       [Step12 ]           Set Flag Crew
           [SQL          ] Set Flag Crew

       [Step13 ]           Set Flag Other Allowance
           [SQL          ] Set Flag Other Allowance

       [Step14 ]           Set FNGS = 'Neant'
           [PeopleCode   ] Update, set FNGS = 'Neant'

       [Step15 ]           Create Last Payment Receipt
       [Step15 ]           Create Last Payment Receipt        Inactive!
           [SQL          ] Insert into GPFR_LTR_PAYEE




Appl Engine (Section): GPFR_RPT_AE                      XML
              Description                      Application Package XML
              Market                           GBL
              DataBase                         Default
              EffDt                            1900-01-01
              Effective Status                 Active
              Section Type                     Prepare Only
              Auto Commit                      No
              Access                           Public

       Step/Action          Description                       Attributes

       [ . . . Description Unchanged . . . ]




Appl Engine (Section): GPGB_EDI_PRC                     EDIAcum
              Description                      Fetch Accumulator Data
              Market                           GBL
              DataBase                         Default
              EffDt                            1900-01-01
              Effective Status                 Active
              Section Type                     Prepare Only
              Auto Commit                      After Step
              Access                           Public

       Step/Action          Description                       Attributes

       [ . . . Description Unchanged . . . ]




Appl Engine (Section): GPGB_EDI_PRC                     EDIPrep
              Description                      Preparation Steps
              Market                           GBL
              DataBase                         Default
              EffDt                            1900-01-01
              Effective Status                    Active
              Section Type                        Prepare Only
              Auto Commit                         After Step
              Access                              Public

       Step/Action        Description                            Attributes
       [Step01 ]          Fetches Pin Num
           [Call Section]                                        Section: GPGB_EDI_PRC.EDIPins

       [Step02 ]           Select One Emplid
           [PeopleCode   ] One Emplid Check
           [SQL          ]

       [Step03 ]           Select Multiple Emplids
           [PeopleCode   ] Multiple Emplid Check
           [SQL          ]

       [Step04 ]             Select Emplids by Streams
           [Do Select    ]                                       Type: Select/Fetch
           [PeopleCode   ]
           [SQL          ]

       [Step05 ]             Select Emplids by Group List
           [PeopleCode   ]
           [SQL          ]

       [Step05A ]            UpdateStats(GPGB_EDIE_TMP)
           [SQL          ]

       [Step05A2]            EMPLID FROM & TO SELECTION
           [SQL          ]

       [Step06 ]          Fetch Accumulator Data
           [Call Section]                                        Section: GPGB_EDI_PRC.EDIAcum

       [Step07 ]          Update GPGB_P14E_TMP
           [Call Section]                                        Section: GPGB_EDI_PRC.EDIUpds




Appl Engine (Section): GPGB_P45                           CkPyPrc
              Description                         Check payroll processed for EE
              Market                              GBL
              DataBase                            Default
              EffDt                               1900-01-01
              Effective Status                    Active
              Section Type                        Prepare Only
              Auto Commit                         No

       Step/Action           Description                         Attributes
       [Step02 ]
       [Step03 ]             Step02 description
           [PeopleCode   ]
           [SQL          ]

       [Step04 ]
           [PeopleCode   ]
           [SQL          ]

       [Step01 ]
           [PeopleCode   ]
           [SQL          ]

       [Step02 ]             Step03 description
           [PeopleCode   ]
           [SQL          ]
Appl Engine (Section): GPGB_P45                        GtPrvSeg
              Description                     Get Previous Segments Rslts
              Market                          GBL
              DataBase                        Default
              EffDt                           1900-01-01
              Effective Status                Active
              Section Type                    Prepare Only
              Auto Commit                     No

       Step/Action          Description                      Attributes
       [Step01 ]
           [SQL         ]

       [Step02 ]
           [SQL         ]




Appl Engine (Section): GPGB_P45                        GtRsltDt
              Description                     Get Latest Results
              Market                          GBL
              DataBase                        Default
              EffDt                           1900-01-01
              Effective Status                Active
              Section Type                    Prepare Only
              Auto Commit                     No

       Step/Action          Description                      Attributes
       [Step01 ]
           [SQL         ]

       [Step02 ]
           [SQL         ]




Appl Engine (Section): GPMX_PMT_AE                     POPULATE
              Description                     POPULATE
              Market                          GBL
              DataBase                        Default
              EffDt                           1900-01-01
              Effective Status                Active
              Section Type                    Prepare Only
              Auto Commit                     No

       Step/Action          Description                      Attributes
       [Step01 ]            Insert GPBR_PAYMENT
       [Step01 ]            Insert GPMX_PAYMENT
           [SQL         ]

       [Step02 ]          INSERT GPMX_PAYMENT
           [Call Section]                                    Section: GPMX_PMT_AE.UPDATE
           [Do Select   ]                                    Type: Select/Fetch




Appl Engine (Section): GPUS_PPD_EFT                    GET-DTL
              Description                     Populate GPUS_EFT_DTL
              Market                          GBL
              DataBase                        Default
              EffDt                           1900-01-01
              Effective Status                Active
              Section Type                    Prepare Only
              Auto Commit                     No

       Step/Action          Description                      Attributes
       [Step01 ]            Get Data from GP_PAYMENT
         [PeopleCode   ] Generating Dynamic SQL

      [Step03 ]          Update GPUS_EFT_DTL              OnError: Ignore
          [SQL         ] Update Company Name

      [Step04 ]          Update GPUS_EFT_DTL              OnError: Ignore
          [SQL         ] Update FEDERAL_EIN

      [Step05 ]          Update GPUS_EFT_DTL
          [SQL         ] Update Payee BANK_CD

      [Step06 ]          Update GPUS_EFT_DTL
          [SQL         ] Update Payee Bank Accout ID

      [Step07 ]          Update GPUS_EFT_DTL
          [SQL         ] Update Payee Bank Accout Name

      [Step08 ]          Update GPUS_EFT_DTL
          [SQL         ] Update Payee Bank Accout Type

      [Step09 ]          Update GPUS_EFT_DTL
          [SQL         ] Update Payee Bank Acct IAT Ind




                               SQL Detail
SQL: GPAU_PSM_CREB1_Vals Gross_AmS                 ApplEng
             ApplEng                       GPAU_PSM_CRE
             Section                       B1_Vals
             Step                          Gross_Am
             Action                        SQL
             Market                        GBL

      SQL Statement
      UPDATE PS_GPAU_PSM_E1_TAO SET
            GPAU_PSM_GROSS_PAY = (SELECT A.GPAU_PSM_GROSS_PAY - B.GPAU_PSM_GROSS_PAY
            GPAU_PSM_GROSS_PAY = (SELECT A.GPAU_PSM_GROSS_PAY - B.GPAU_PSM_GROSS_PAY -
      D.GPAU_PSM_GROSS_PAY
            FROM PS_GPAU_PSM_AM_TAO A,
                  PS_GPAU_PSM_AM_TAO B
                  PS_GPAU_PSM_AM_TAO B,
                  PS_GPAU_PSM_AM_TAO D
            WHERE A.EMPLID = PS_GPAU_PSM_E1_TAO.EMPLID
              AND A.PAY_ENTITY = PS_GPAU_PSM_E1_TAO.PAY_ENTITY
              AND A.BALANCE_GRP_NUM = PS_GPAU_PSM_E1_TAO.BALANCE_GRP_NUM
              AND A.PROCESS_INSTANCE = PS_GPAU_PSM_E1_TAO.PROCESS_INSTANCE
              AND A.SOVR_VAL_CHAR = 'G'
              AND B.EMPLID = PS_GPAU_PSM_E1_TAO.EMPLID
              AND B.PAY_ENTITY = PS_GPAU_PSM_E1_TAO.PAY_ENTITY
              AND B.BALANCE_GRP_NUM = PS_GPAU_PSM_E1_TAO.BALANCE_GRP_NUM
              AND B.PROCESS_INSTANCE = PS_GPAU_PSM_E1_TAO.PROCESS_INSTANCE
              AND B.SOVR_VAL_CHAR = 'SS'),
              AND B.SOVR_VAL_CHAR = 'SS'
              AND D.EMPLID = PS_GPAU_PSM_E1_TAO.EMPLID
              AND D.PAY_ENTITY = PS_GPAU_PSM_E1_TAO.PAY_ENTITY
              AND D.BALANCE_GRP_NUM = PS_GPAU_PSM_E1_TAO.BALANCE_GRP_NUM
              AND D.PROCESS_INSTANCE = PS_GPAU_PSM_E1_TAO.PROCESS_INSTANCE
              AND D.SOVR_VAL_CHAR = 'PT'),
            GPAU_PSM_TAX_WHELD = (SELECT A.GPAU_PSM_GROSS_PAY
            FROM PS_GPAU_PSM_AM_TAO A
            WHERE A.EMPLID = PS_GPAU_PSM_E1_TAO.EMPLID
              AND A.PAY_ENTITY = PS_GPAU_PSM_E1_TAO.PAY_ENTITY
              AND A.BALANCE_GRP_NUM = PS_GPAU_PSM_E1_TAO.BALANCE_GRP_NUM
              AND A.PROCESS_INSTANCE = PS_GPAU_PSM_E1_TAO.PROCESS_INSTANCE
              AND A.SOVR_VAL_CHAR = 'T'),
            GPAU_PSM_CDEP_PAY = (SELECT A.GPAU_PSM_GROSS_PAY
            FROM PS_GPAU_PSM_AM_TAO A
            WHERE A.EMPLID = PS_GPAU_PSM_E1_TAO.EMPLID
              AND A.PAY_ENTITY = PS_GPAU_PSM_E1_TAO.PAY_ENTITY
              AND A.BALANCE_GRP_NUM = PS_GPAU_PSM_E1_TAO.BALANCE_GRP_NUM
              AND A.PROCESS_INSTANCE = PS_GPAU_PSM_E1_TAO.PROCESS_INSTANCE
              AND A.SOVR_VAL_CHAR = 'C'),
            GPAU_PSM_LUMPA = (SELECT A.GPAU_PSM_GROSS_PAY
            FROM PS_GPAU_PSM_AM_TAO A
            WHERE A.EMPLID = PS_GPAU_PSM_E1_TAO.EMPLID
              AND A.PAY_ENTITY = PS_GPAU_PSM_E1_TAO.PAY_ENTITY
              AND A.BALANCE_GRP_NUM = PS_GPAU_PSM_E1_TAO.BALANCE_GRP_NUM
              AND A.PROCESS_INSTANCE = PS_GPAU_PSM_E1_TAO.PROCESS_INSTANCE
              AND A.SOVR_VAL_CHAR = 'LA'),
            GPAU_PSM_LUMPB = (SELECT A.GPAU_PSM_GROSS_PAY
            FROM PS_GPAU_PSM_AM_TAO A
            WHERE A.EMPLID = PS_GPAU_PSM_E1_TAO.EMPLID
              AND A.PAY_ENTITY = PS_GPAU_PSM_E1_TAO.PAY_ENTITY
              AND A.BALANCE_GRP_NUM = PS_GPAU_PSM_E1_TAO.BALANCE_GRP_NUM
              AND A.PROCESS_INSTANCE = PS_GPAU_PSM_E1_TAO.PROCESS_INSTANCE
              AND A.SOVR_VAL_CHAR = 'LB'),
            GPAU_PSM_LUMPD = (SELECT A.GPAU_PSM_GROSS_PAY
            FROM PS_GPAU_PSM_AM_TAO A
            WHERE A.EMPLID = PS_GPAU_PSM_E1_TAO.EMPLID
              AND A.PAY_ENTITY = PS_GPAU_PSM_E1_TAO.PAY_ENTITY
              AND A.BALANCE_GRP_NUM = PS_GPAU_PSM_E1_TAO.BALANCE_GRP_NUM
              AND A.PROCESS_INSTANCE = PS_GPAU_PSM_E1_TAO.PROCESS_INSTANCE
              AND A.SOVR_VAL_CHAR = 'LD'),
            GPAU_PSM_LUMPE = (SELECT A.GPAU_PSM_GROSS_PAY
            FROM PS_GPAU_PSM_AM_TAO A
            WHERE A.EMPLID = PS_GPAU_PSM_E1_TAO.EMPLID
              AND A.PAY_ENTITY = PS_GPAU_PSM_E1_TAO.PAY_ENTITY
              AND A.BALANCE_GRP_NUM = PS_GPAU_PSM_E1_TAO.BALANCE_GRP_NUM
              AND A.PROCESS_INSTANCE = PS_GPAU_PSM_E1_TAO.PROCESS_INSTANCE
              AND A.SOVR_VAL_CHAR = 'LE'),
            GPAU_PSM_OTHER_PAY = (SELECT A.GPAU_PSM_GROSS_PAY
            FROM PS_GPAU_PSM_AM_TAO A
            WHERE A.EMPLID = PS_GPAU_PSM_E1_TAO.EMPLID
              AND A.PAY_ENTITY = PS_GPAU_PSM_E1_TAO.PAY_ENTITY
              AND A.BALANCE_GRP_NUM = PS_GPAU_PSM_E1_TAO.BALANCE_GRP_NUM
              AND A.PROCESS_INSTANCE = PS_GPAU_PSM_E1_TAO.PROCESS_INSTANCE
              AND A.SOVR_VAL_CHAR = 'O'),
            GPAU_PSM_ER_SC = (SELECT A.GPAU_PSM_GROSS_PAY
            FROM PS_GPAU_PSM_AM_TAO A
            GPAU_PSM_ER_SC = (SELECT A.GPAU_PSM_GROSS_PAY + B.GPAU_PSM_GROSS_PAY
            FROM PS_GPAU_PSM_AM_TAO A,
                  PS_GPAU_PSM_AM_TAO B
            WHERE A.EMPLID = PS_GPAU_PSM_E1_TAO.EMPLID
              AND A.PAY_ENTITY = PS_GPAU_PSM_E1_TAO.PAY_ENTITY
              AND A.BALANCE_GRP_NUM = PS_GPAU_PSM_E1_TAO.BALANCE_GRP_NUM
              AND A.PROCESS_INSTANCE = PS_GPAU_PSM_E1_TAO.PROCESS_INSTANCE
              AND A.SOVR_VAL_CHAR = 'SS')
              AND A.SOVR_VAL_CHAR = 'SS'
              AND B.EMPLID = PS_GPAU_PSM_E1_TAO.EMPLID
              AND B.PAY_ENTITY = PS_GPAU_PSM_E1_TAO.PAY_ENTITY
              AND B.BALANCE_GRP_NUM = PS_GPAU_PSM_E1_TAO.BALANCE_GRP_NUM
              AND B.PROCESS_INSTANCE = PS_GPAU_PSM_E1_TAO.PROCESS_INSTANCE
              AND B.SOVR_VAL_CHAR = 'RS')
      WHERE PS_GPAU_PSM_E1_TAO.PROCESS_INSTANCE = %Bind(PROCESS_INSTANCE)




SQL: GPAU_TFN_ELCB1_Data Delete S                  ApplEng
             ApplEng                       GPAU_TFN_ELC
             Section                       B1_Data
             Step                          Delete
             Action                        SQL
             Market                        GBL

      SQL Statement
     DELETE FROM PS_GPAU_TFN_EL_TAO
     WHERE PROCESS_INSTANCE = %Bind(PROCESS_INSTANCE)
       AND PAY_ENTITY = %Bind(PAY_ENTITY)
       AND EXISTS (SELECT A.EMPLID
           FROM PS_GPAU_EE_TAX_DTL A,
                 PS_GPAU_EE_TAX_TFN B,
                 PS_GPAU_TFN_EL_TAO T
           WHERE T.PROCESS_INSTANCE = PS_GPAU_TFN_EL_TAO.PROCESS_INSTANCE
             AND T.EMPLID = PS_GPAU_TFN_EL_TAO.EMPLID
             AND T.PAY_ENTITY = PS_GPAU_TFN_EL_TAO.PAY_ENTITY
             AND T.BALANCE_GRP_NUM = PS_GPAU_TFN_EL_TAO.BALANCE_GRP_NUM
             AND A.EMPLID = PS_GPAU_TFN_EL_TAO.EMPLID
             AND A.BALANCE_GRP_NUM = T.BALANCE_GRP_NUM
             AND A.PAY_ENTITY = T.PAY_ENTITY
             AND A.EMPLID = B.EMPLID
             AND A.EFFDT BETWEEN %Bind(GPAU_TFN_START_DT) AND %Bind(GPAU_TFN_END_DT)
             AND B.EFFDT BETWEEN %Bind(GPAU_TFN_START_DT) AND %Bind(GPAU_TFN_END_DT)
             AND (%DateDiff(A.EFFDT, %Bind(GPAU_TFN_END_DT)) > 28
                   AND B.GPAU_TFN_STATUS = '10')
             AND T.GPAU_TERM_EMP_YN <> 'T')




SQL: GPCH_IDENTIFY                                Normal
            Description                   Identify SQL
            Comments                      Identify SQL
            Owner ID                      Global Payroll Switzerland

     SQL Statement
     SELECT TX07.EMPLID,
           TX07.EMPL_RCD,
           TX07.NATIONAL_ID,
           TX07.GPCH_AH_NNSS,
           NM.LAST_NAME,
           NM.FIRST_NAME,
           TX07.SEX,
           %DateOut(TX07.BIRTHDATE),
           TX07.COUNTRY,
           TX07.COUNTRY_FROM,
           TX07.MAR_STATUS,
           TX07.GPCH_TX_CANTON,
           TX07.FTE,
           TX07.GPCH_TX_FAK_CANTON,
           TX07.ADDRESS_TYPE,
           RP01.STD_HOURS,
           RP01.GPCH_RP_LSEYOS,
           %DateOut(RP01.TERMINATION_DT),
           RP01.SETID_SALARY,
           RP01.SAL_ADMIN_PLAN,
           RP01.GRADE,
           RP01.VISA_PERMIT_TYPE
     FROM PS_GPCH_RP_TX07 TX07,
           PS_NAMES NM,
           PS_GPCH_RP_0001 RP01
     WHERE %Sql(GPCH_AE_INS_CRIT1)
       AND TX07.PRD_END_DT BETWEEN %DateIn(:2) AND %DateIn(:3)
       AND TX07.EMPLID = NM.EMPLID
       AND NM.EFFDT = (SELECT MAX(NM1.EFFDT)
           FROM PS_NAMES NM1
           WHERE NM.EMPLID = NM1.EMPLID
             AND NM.NAME_TYPE = 'PRI'
             AND NM1.NAME_TYPE = 'PRI'
             AND NM1.EFFDT <= TX07.PRD_END_DT)
       AND RP01.EMPLID = TX07.EMPLID
       AND RP01.CAL_RUN_ID = TX07.CAL_RUN_ID
       AND RP01.EMPL_RCD = TX07.EMPL_RCD
       AND RP01.GP_PAYGROUP = TX07.GP_PAYGROUP
       AND RP01.CAL_ID = TX07.CAL_ID
       AND RP01.ORIG_CAL_RUN_ID = TX07.ORIG_CAL_RUN_ID
       AND RP01.RSLT_SEG_NUM = TX07.RSLT_SEG_NUM
       AND TX07.GPCH_AL_CPAY_ENDDT = (SELECT MAX(A.PRD_END_DT)
           FROM PS_GPCH_RP_0001 A
           WHERE %Sql(GPCH_AE_INS_CRIT2)
             AND A.GPCH_RP_YEAR BETWEEN %DateIn(:2) AND %DateIn(:3)
             AND A.EMPLID = TX07.EMPLID
             AND A.EMPL_RCD = TX07.EMPL_RCD)
       AND RP01.CAL_RUN_ID = TX07.ORIG_CAL_RUN_ID
       AND NOT EXISTS (SELECT 'X'
           FROM PS_GPCH_IF_TX07 IFTX
           WHERE RP01.EMPLID = IFTX.EMPLID
             AND RP01.EMPL_RCD = IFTX.EMPL_RCD
             AND IFTX.BEGIN_DT BETWEEN %DateIn(:2) AND %DateIn(:3)
             AND RP01.COMPANY = IFTX.COMPANY
             AND IFTX.GPCH_IF_VER > 1)




SQL: GPDE_CT_ABS_DATE                             Normal
            Description                   Abscence begin and end date
            Comments                      Abscence begin and end date for Certificate
            Owner ID                      Global Payroll Germany

     SQL Statement
     SELECT %DateOut(ABS_BGN_DT),
           %DateOut(ABS_END_DT),
     SELECT %DateOut(MIN(ABS_BGN_DT)),
           %DateOut(MAX(ABS_END_DT)),
           DESCR,
           SUM(GPDE_RP_UNPD_CALDY)
     FROM PS_GPDE_UNPD_ABSVW
     WHERE EMPLID = :1
       AND EMPL_RCD = :2
       AND PAY_ENTITY = :3
       AND SEG_END_DT <= %DateIn(:4)
       AND SEG_END_DT >= %DateIn(:5)
     GROUP BY ABS_BGN_DT,
           ABS_END_DT,
           DESCR
     GROUP BY DESCR




SQL: GPDE_DV_MON EVENT13 FIND_TR2S                ApplEng
            ApplEng                       GPDE_DV_MON
            Section                       EVENT13
            Step                          FIND_TR2
            Action                        SQL
            Market                        GBL

     SQL Statement
     INSERT INTO %Bind(GPDE_DV_TRIG30, NOQUOTES)
           (EMPLID,
           EMPL_RCD,
           GPDE_DV_EVT_TYPE,
           GPDE_DV_EVT_EFFDT,
           GPDE_DV_EVT_DTTM,
           GPDE_DV_EE_STATUS,
           GPDE_AL_FREQUENCY,
           CAL_RUN_ID)
     SELECT DISTINCT
           ELG.EMPLID,
           ELG.EMPL_RCD,
           ' ',
           %Sql(GPDE_AL_TMPL_FUNC_DAYADD_U, PBO.SLICE_END_DT, 1),
           %CurrentDateTimeIn,
           ' ',
           ' ',
           %Bind(CAL_RUN_ID)
     FROM  %Bind(GPDE_DV_ELIG_MON, NOQUOTES) ELO,
           %Bind(GPDE_DV_ELIG_MON, NOQUOTES) ELG,
           %Bind(GPDE_DV_BAL_TBL, NOQUOTES) PBO,
           PS_GPDE_DV_SEG_STA S1
     WHERE ELG.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND ELG.EMPLID = ELO.EMPLID
       AND ELG.EMPL_RCD = ELO.EMPL_RCD
       AND ELG.GPDE_DV_SV_CODE <> '0000'
       AND ELG.GPDE_DV_ACTIVE IN ('2', '3')
       AND ELO.GPDE_AL_SEQNUM = ELG.GPDE_AL_SEQNUM - 1
       AND ELG.GPDE_DV_REGULR_PAY = 0.00
       AND ELO.GPDE_DV_REGULR_PAY > 0.00
       AND ELO.EMPLID = PBO.EMPLID
       AND ELO.EMPL_RCD = PBO.EMPL_RCD
       AND ELO.PRD_END_DT = PBO.PRD_END_DT
       AND PBO.GPDE_RP_SIGRS_ANLZ <> 0
       AND S1.EMPLID = PBO.EMPLID
       AND S1.EMPL_RCD = PBO.EMPL_RCD
       AND S1.CAL_RUN_ID = PBO.CAL_RUN_ID
       AND S1.GP_PAYGROUP = PBO.GP_PAYGROUP
       AND S1.CAL_ID = PBO.CAL_ID
       AND S1.RSLT_SEG_NUM = PBO.RSLT_SEG_NUM
       AND S1.RSLT_VER_NUM = (SELECT MAX(S2.RSLT_VER_NUM)
           FROM PS_GPDE_DV_SEG_STA S2
           WHERE S2.EMPLID = S1.EMPLID
             AND S2.EMPL_RCD = S1.EMPL_RCD
             AND S2.CAL_RUN_ID = S1.CAL_RUN_ID
             AND S2.GP_PAYGROUP = S1.GP_PAYGROUP
             AND S2.CAL_ID = S1.CAL_ID
             AND S2.RSLT_SEG_NUM = S1.RSLT_SEG_NUM)
       AND NOT EXISTS (SELECT 'X'
           FROM PS_GPDE_DV_FLT_ABS ABS1
           WHERE ABS1.EMPLID = ELG.EMPLID
             AND ABS1.EMPL_RCD = ELG.EMPL_RCD
             AND ABS1.CAL_RUN_ID = %Bind(CAL_RUN_ID)
             AND ABS1.ABS_END_DT >= %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U, ELG.PRD_END_DT)
             AND ABS1.ABS_BGN_DT <= ELG.PRD_END_DT
             AND ABS1.GPDE_DV_AB_CODE = 'AB')
       AND NOT EXISTS (SELECT 'X'
           FROM PS_GPDE_DV_STARTUP ST1
           WHERE ST1.EMPLID = ELG.EMPLID
             AND ST1.EMPL_RCD = ELG.EMPL_RCD
             AND ST1.GPDE_DV_ACTION = 'NOPAY'
             AND %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U, ELG.PRD_END_DT) =
     %Sql(GPDE_AL_TMPL_FUNC_DAYADD_U, ST1.GPDE_DV_EVT_EFFDT, 1))
             AND ST1.GPDE_DV_EVT_EFFDT < ELG.GPDE_AL_BGN_DT)




SQL: GPDE_DV_MON EVENT13 FIND_TRGS                 ApplEng
            ApplEng                       GPDE_DV_MON
            Section                       EVENT13
            Step                          FIND_TRG
            Action                        SQL
            Market                        GBL

     SQL Statement
     INSERT INTO %Bind(GPDE_DV_TRIG30, NOQUOTES)
           (EMPLID,
           EMPL_RCD,
           GPDE_DV_EVT_TYPE,
           GPDE_DV_EVT_EFFDT,
           GPDE_DV_EVT_DTTM,
           GPDE_DV_EE_STATUS,
           GPDE_AL_FREQUENCY,
           CAL_RUN_ID)
     SELECT DISTINCT
           ELG.EMPLID,
           ELG.EMPL_RCD,
           ' ',
           ABS1.EFFDT,
           %CurrentDateTimeIn,
           ' ',
           ' ',
           %Bind(CAL_RUN_ID)
     FROM %Bind(GPDE_DV_ELIG_MON, NOQUOTES) ELO,
           %Bind(GPDE_DV_ELIG_MON, NOQUOTES) ELG,
           PS_GPDE_DV_FLT_ABS ABS1
     WHERE ELG.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND ELO.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND ELG.EMPLID = ELO.EMPLID
       AND ELG.EMPL_RCD = ELO.EMPL_RCD
       AND ELG.GPDE_DV_SV_CODE <> '0000'
       AND ELG.GPDE_DV_ACTIVE IN ('2', '3')
       AND ELO.PRD_END_DT = %Sql(GPDE_AL_TMPL_FUNC_MONEND_U, %Sql(GPDE_AL_TMPL_FUNC_MONADD_U,
     ELG.PRD_END_DT, (- 1)))
       AND ABS1.EMPLID = ELG.EMPLID
       AND ABS1.EMPL_RCD = ELG.EMPL_RCD
       AND ABS1.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND ABS1.ABS_END_DT >= %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U, ELG.PRD_END_DT)
       AND ABS1.ABS_BGN_DT <= ELG.PRD_END_DT
       AND ABS1.GPDE_DV_AB_CODE = 'AB'
       AND (ELG.GPDE_RP_SIGRS_ANLZ = 0
             OR ELG.GPDE_RP_SIDAYS = 0)
       AND (ELO.GPDE_RP_SIGRS_ANLZ > 0
             OR ELO.GPDE_RP_SIDAYS > 0)
       AND NOT EXISTS (SELECT 'X'
           FROM PS_GPDE_DV_STARTUP ST1
           WHERE ST1.EMPLID = ELG.EMPLID
             AND ST1.EMPL_RCD = ELG.EMPL_RCD
             AND ST1.GPDE_DV_ACTION = 'NOPAY'
             AND %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U, ELG.PRD_END_DT) =
     %Sql(GPDE_AL_TMPL_FUNC_DAYADD_U, ST1.GPDE_DV_EVT_EFFDT, 1))
             AND ST1.GPDE_DV_EVT_EFFDT < ELG.GPDE_AL_BGN_DT)




SQL: GPDE_DV_MON EVENT17 FIND_TR2S                ApplEng
            ApplEng                       GPDE_DV_MON
            Section                       EVENT17
            Step                          FIND_TR2
            Action                        SQL
            Market                        GBL

     SQL Statement
     INSERT INTO %Bind(GPDE_DV_TRIG30, NOQUOTES)
           (EMPLID,
           EMPL_RCD,
           GPDE_DV_EVT_TYPE,
           GPDE_DV_EVT_EFFDT,
           GPDE_DV_EVT_DTTM,
           GPDE_DV_EE_STATUS,
           GPDE_AL_FREQUENCY,
           CAL_RUN_ID)
     SELECT DISTINCT
           ELG.EMPLID,
           ELG.EMPL_RCD,
           ' ',
           %Sql(GPDE_AL_TMPL_FUNC_DAYADD_U, PBO.SLICE_END_DT, 1),
           %CurrentDateTimeIn,
           ' ',
           ' ',
           %Bind(CAL_RUN_ID)
     FROM %Bind(GPDE_DV_ELIG_MON, NOQUOTES) ELO,
           %Bind(GPDE_DV_ELIG_MON, NOQUOTES) ELG,
           %Bind(GPDE_DV_BAL_TBL, NOQUOTES) PBO,
           PS_GPDE_DV_SEG_STA S1
     WHERE ELG.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND ELG.EMPLID = ELO.EMPLID
       AND ELG.EMPL_RCD = ELO.EMPL_RCD
       AND ELG.GPDE_DV_SV_CODE <> '0000'
       AND ELG.GPDE_DV_ACTIVE IN ('2', '3')
       AND ELO.GPDE_AL_SEQNUM = ELG.GPDE_AL_SEQNUM - 1
       AND ELO.GPDE_DV_REGULR_PAY > 0.00
       AND ELO.EMPLID = PBO.EMPLID
       AND ELO.EMPL_RCD = PBO.EMPL_RCD
       AND ELO.PRD_END_DT = PBO.PRD_END_DT
       AND PBO.GPDE_RP_SIGRS_ANLZ <> 0
       AND S1.EMPLID = PBO.EMPLID
       AND S1.EMPL_RCD = PBO.EMPL_RCD
       AND S1.CAL_RUN_ID = PBO.CAL_RUN_ID
       AND S1.GP_PAYGROUP = PBO.GP_PAYGROUP
       AND S1.CAL_ID = PBO.CAL_ID
       AND S1.RSLT_SEG_NUM = PBO.RSLT_SEG_NUM
       AND S1.RSLT_VER_NUM = (SELECT MAX(S2.RSLT_VER_NUM)
           FROM PS_GPDE_DV_SEG_STA S2
           WHERE S2.EMPLID = S1.EMPLID
             AND S2.EMPL_RCD = S1.EMPL_RCD
             AND S2.CAL_RUN_ID = S1.CAL_RUN_ID
             AND S2.GP_PAYGROUP = S1.GP_PAYGROUP
             AND S2.CAL_ID = S1.CAL_ID
             AND S2.RSLT_SEG_NUM = S1.RSLT_SEG_NUM)
       AND NOT EXISTS (SELECT 'X'
           FROM PS_GPDE_DV_FLT_ABS ABS1
           WHERE ABS1.EMPLID = ELG.EMPLID
             AND ABS1.EMPL_RCD = ELG.EMPL_RCD
             AND ABS1.CAL_RUN_ID = %Bind(CAL_RUN_ID)
             AND ABS1.ABS_END_DT >= %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U, ELG.PRD_END_DT)
             AND ABS1.ABS_BGN_DT <= ELG.PRD_END_DT
             AND ABS1.GPDE_DV_AB_CODE = 'AB')
       AND NOT EXISTS (SELECT 'X'
           FROM PS_GPDE_DV_STARTUP ST1
           WHERE ST1.EMPLID = ELG.EMPLID
             AND ST1.EMPL_RCD = ELG.EMPL_RCD
             AND ST1.GPDE_DV_ACTION = 'NOPAY'
             AND %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U, ELG.PRD_END_DT) =
     %Sql(GPDE_AL_TMPL_FUNC_DAYADD_U, ST1.GPDE_DV_EVT_EFFDT, 1))
             AND ST1.GPDE_DV_EVT_EFFDT < ELG.GPDE_AL_BGN_DT)




SQL: GPDE_DV_MON EVENT17 FIND_TRGS                  ApplEng
             ApplEng                      GPDE_DV_MON
             Section                      EVENT17
             Step                         FIND_TRG
             Action                       SQL
             Market                       GBL

     SQL Statement
     INSERT INTO %Bind(GPDE_DV_TRIG30, NOQUOTES)
           (EMPLID,
           EMPL_RCD,
           GPDE_DV_EVT_TYPE,
           GPDE_DV_EVT_EFFDT,
           GPDE_DV_EVT_DTTM,
           GPDE_DV_EE_STATUS,
           GPDE_AL_FREQUENCY,
           CAL_RUN_ID)
     SELECT DISTINCT
           ELG.EMPLID,
           ELG.EMPL_RCD,
           ' ',
           ABS1.EFFDT,
           %CurrentDateTimeIn,
           ' ',
           ' ',
           %Bind(CAL_RUN_ID)
     FROM %Bind(GPDE_DV_ELIG_MON, NOQUOTES) ELO,
           %Bind(GPDE_DV_ELIG_MON, NOQUOTES) ELG,
           PS_GPDE_DV_FLT_ABS ABS1
     WHERE ELG.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND ELO.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND ELG.EMPLID = ELO.EMPLID
       AND ELG.EMPL_RCD = ELO.EMPL_RCD
       AND ELG.GPDE_DV_SV_CODE <> '0000'
       AND ELG.GPDE_DV_ACTIVE IN ('2', '3')
       AND ELO.PRD_END_DT = %Sql(GPDE_AL_TMPL_FUNC_MONEND_U, %Sql(GPDE_AL_TMPL_FUNC_MONADD_U,
     ELG.PRD_END_DT, (- 1)))
       AND ABS1.EMPLID = ELG.EMPLID
       AND ABS1.EMPL_RCD = ELG.EMPL_RCD
       AND ABS1.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND ABS1.ABS_END_DT >= %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U, ELG.PRD_END_DT)
       AND ABS1.ABS_BGN_DT <= ELG.PRD_END_DT
       AND ABS1.GPDE_DV_AB_CODE = 'AB'
       AND NOT EXISTS (SELECT 'X'
           FROM PS_GPDE_DV_STARTUP ST1
           WHERE ST1.EMPLID = ELG.EMPLID
             AND ST1.EMPL_RCD = ELG.EMPL_RCD
             AND ST1.GPDE_DV_ACTION = 'NOPAY'
             AND %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U, ELG.PRD_END_DT) =
     %Sql(GPDE_AL_TMPL_FUNC_DAYADD_U, ST1.GPDE_DV_EVT_EFFDT, 1))
             AND ST1.GPDE_DV_EVT_EFFDT < ELG.GPDE_AL_BGN_DT)




SQL: GPDE_DV_MON EVENT3X FIND_TR1S                ApplEng
            ApplEng                       GPDE_DV_MON
            Section                       EVENT3X
            Step                          FIND_TR1
            Action                        SQL
            Market                        GBL

     SQL Statement
     INSERT INTO %Bind(GPDE_DV_TRIG30, NOQUOTES)
           (EMPLID,
           EMPL_RCD,
           GPDE_DV_EVT_TYPE,
           GPDE_DV_EVT_EFFDT,
           GPDE_DV_EVT_DTTM,
           GPDE_DV_EE_STATUS,
           GPDE_AL_FREQUENCY,
           CAL_RUN_ID)
     SELECT DISTINCT
           ELG.EMPLID,
           ELG.EMPL_RCD,
           ' ',
           %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U, ELG.PRD_END_DT),
           %CurrentDateTimeIn,
           ' ',
           ' ',
           %Bind(CAL_RUN_ID)
     FROM %Bind(GPDE_DV_ELIG_MON, NOQUOTES) ELO,
           %Bind(GPDE_DV_ELIG_MON, NOQUOTES) ELG,
           PS_GPDE_DV_FLT_ABS ABS1
     WHERE ELG.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND ELO.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND ELG.EMPLID = ELO.EMPLID
       AND ELG.EMPL_RCD = ELO.EMPL_RCD
       AND ELG.GPDE_DV_SV_CODE <> '0000'
       AND ELG.GPDE_DV_ACTIVE IN ('2', '3')
       AND ELO.PRD_END_DT = %Sql(GPDE_AL_TMPL_FUNC_MONEND_U, %Sql(GPDE_AL_TMPL_FUNC_MONADD_U,
     ELG.PRD_END_DT, (- 1)))
       AND ABS1.EMPLID = ELG.EMPLID
       AND ABS1.EMPL_RCD = ELG.EMPL_RCD
       AND ABS1.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND ABS1.ABS_BGN_DT <= ELG.PRD_END_DT
       AND ABS1.GPDE_DV_AB_CODE = 'AB'
       AND ELG.GPDE_RP_SIGRS_ANLZ = 0
       AND ELG.GPDE_RP_SIDAYS = 0
       AND (ELO.GPDE_RP_SIGRS_ANLZ > 0
             OR ELO.GPDE_RP_SIDAYS > 0)
       AND NOT EXISTS (SELECT 'X'
           FROM PS_GPDE_DV_STARTUP ST1
           WHERE ST1.EMPLID = ELG.EMPLID
             AND ST1.EMPL_RCD = ELG.EMPL_RCD
             AND ST1.GPDE_DV_ACTION = 'NOPAY'
             AND %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U, ELG.PRD_END_DT) =
     %Sql(GPDE_AL_TMPL_FUNC_DAYADD_U, ST1.GPDE_DV_EVT_EFFDT, 1))
             AND ST1.GPDE_DV_EVT_EFFDT < ELG.GPDE_AL_BGN_DT)
       AND %Sql(GPDE_DV_ABS_STILL_ACTIVE, ELG, ABS1, %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U,
     ELG.PRD_END_DT))
       AND ABS1.EFFDT < %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U, %Sql(GPDE_AL_TMPL_FUNC_DAYADD_U,
     %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U, ELG.PRD_END_DT), (- 1)))




SQL: GPDE_DV_MON EVENT3X FIND_TR2S                ApplEng
            ApplEng                       GPDE_DV_MON
            Section                       EVENT3X
            Step                          FIND_TR2
            Action                        SQL
            Market                        GBL

     SQL Statement
     INSERT INTO %Bind(GPDE_DV_TRIG30, NOQUOTES)
           (EMPLID,
           EMPL_RCD,
           GPDE_DV_EVT_TYPE,
           GPDE_DV_EVT_EFFDT,
           GPDE_DV_EVT_DTTM,
           GPDE_DV_EE_STATUS,
           GPDE_AL_FREQUENCY,
           CAL_RUN_ID)
     SELECT DISTINCT
           ELG.EMPLID,
           ELG.EMPL_RCD,
           ' ',
           %Sql(GPDE_AL_TMPL_FUNC_DAYADD_U, PBO.SLICE_END_DT, 1),
           %CurrentDateTimeIn,
           ' ',
           ' ',
           %Bind(CAL_RUN_ID)
     FROM %Bind(GPDE_DV_ELIG_MON, NOQUOTES) ELO,
           %Bind(GPDE_DV_ELIG_MON, NOQUOTES) ELG,
           %Bind(GPDE_DV_BAL_TBL, NOQUOTES) PBO,
           PS_GPDE_DV_SEG_STA S1
     WHERE ELG.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND ELG.EMPLID = ELO.EMPLID
       AND ELG.EMPL_RCD = ELO.EMPL_RCD
       AND ELG.GPDE_DV_SV_CODE <> '0000'
       AND ELG.GPDE_DV_ACTIVE IN ('2', '3')
       AND ELO.GPDE_AL_SEQNUM = ELG.GPDE_AL_SEQNUM - 1
       AND ELG.GPDE_RP_SIGRS_ANLZ = 0.00
       AND ELG.GPDE_RP_SIDAYS = 0
       AND ELO.GPDE_RP_SIGRS_ANLZ > 0.00
       AND ELO.EMPLID = PBO.EMPLID
       AND ELO.EMPL_RCD = PBO.EMPL_RCD
       AND ELO.PRD_END_DT = PBO.PRD_END_DT
       AND PBO.GPDE_RP_SIGRS_ANLZ <> 0
       AND S1.EMPLID = PBO.EMPLID
       AND S1.EMPL_RCD = PBO.EMPL_RCD
       AND S1.CAL_RUN_ID = PBO.CAL_RUN_ID
       AND S1.GP_PAYGROUP = PBO.GP_PAYGROUP
       AND S1.CAL_ID = PBO.CAL_ID
       AND S1.RSLT_SEG_NUM = PBO.RSLT_SEG_NUM
       AND S1.RSLT_VER_NUM = (SELECT MAX(S2.RSLT_VER_NUM)
           FROM PS_GPDE_DV_SEG_STA S2
           WHERE S2.EMPLID = S1.EMPLID
             AND S2.EMPL_RCD = S1.EMPL_RCD
             AND S2.CAL_RUN_ID = S1.CAL_RUN_ID
             AND S2.GP_PAYGROUP = S1.GP_PAYGROUP
             AND S2.CAL_ID = S1.CAL_ID)
       AND NOT EXISTS (SELECT 'X'
           FROM PS_GPDE_DV_FLT_ABS ABS1
           WHERE ABS1.EMPLID = ELG.EMPLID
             AND ABS1.EMPL_RCD = ELG.EMPL_RCD
             AND ABS1.CAL_RUN_ID = %Bind(CAL_RUN_ID)
             AND ABS1.ABS_BGN_DT <= ELG.PRD_END_DT
             AND ABS1.GPDE_DV_AB_CODE = 'AB'
             AND %Sql(GPDE_DV_ABS_STILL_ACTIVE, ELG, ABS1, %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U,
     ELG.PRD_END_DT)))
       AND NOT EXISTS (SELECT 'X'
           FROM PS_GPDE_DV_STARTUP ST1
           WHERE ST1.EMPLID = ELG.EMPLID
             AND ST1.EMPL_RCD = ELG.EMPL_RCD
             AND ST1.GPDE_DV_ACTION = 'NOPAY'
             AND %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U, ELG.PRD_END_DT) =
     %Sql(GPDE_AL_TMPL_FUNC_DAYADD_U, ST1.GPDE_DV_EVT_EFFDT, 1))
             AND ST1.GPDE_DV_EVT_EFFDT < ELG.GPDE_AL_BGN_DT)




SQL: GPDE_DV_MON EVENT3X FIND_TRGS                ApplEng
            ApplEng                       GPDE_DV_MON
            Section                       EVENT3X
            Step                          FIND_TRG
            Action                        SQL
            Market                        GBL

     SQL Statement
     INSERT INTO %Bind(GPDE_DV_TRIG30, NOQUOTES)
           (EMPLID,
           EMPL_RCD,
           GPDE_DV_EVT_TYPE,
           GPDE_DV_EVT_EFFDT,
           GPDE_DV_EVT_DTTM,
           GPDE_DV_EE_STATUS,
           GPDE_AL_FREQUENCY,
           CAL_RUN_ID)
     SELECT DISTINCT
           ELG.EMPLID,
           ELG.EMPL_RCD,
           ' ',
           ABS1.EFFDT,
           %CurrentDateTimeIn,
           ' ',
           ' ',
           %Bind(CAL_RUN_ID)
     FROM %Bind(GPDE_DV_ELIG_MON, NOQUOTES) ELO,
           %Bind(GPDE_DV_ELIG_MON, NOQUOTES) ELG,
           PS_GPDE_DV_FLT_ABS ABS1
     WHERE ELG.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND ELO.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND ELG.EMPLID = ELO.EMPLID
       AND ELG.EMPL_RCD = ELO.EMPL_RCD
       AND ELG.GPDE_DV_SV_CODE <> '0000'
       AND ELG.GPDE_DV_ACTIVE IN ('2', '3')
       AND ELO.PRD_END_DT = %Sql(GPDE_AL_TMPL_FUNC_MONEND_U, %Sql(GPDE_AL_TMPL_FUNC_MONADD_U,
     ELG.PRD_END_DT, (- 1)))
       AND ABS1.EMPLID = ELG.EMPLID
       AND ABS1.EMPL_RCD = ELG.EMPL_RCD
       AND ABS1.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND ABS1.ABS_BGN_DT <= ELG.PRD_END_DT
       AND ABS1.GPDE_DV_AB_CODE = 'AB'
       AND ELG.GPDE_RP_SIGRS_ANLZ = 0
       AND ELG.GPDE_RP_SIDAYS = 0
       AND (ELO.GPDE_RP_SIGRS_ANLZ > 0
             OR ELO.GPDE_RP_SIDAYS > 0)
       AND NOT EXISTS (SELECT 'X'
           FROM PS_GPDE_DV_STARTUP ST1
            WHERE ST1.EMPLID = ELG.EMPLID
              AND ST1.EMPL_RCD = ELG.EMPL_RCD
              AND ST1.GPDE_DV_ACTION = 'NOPAY'
              AND %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U, ELG.PRD_END_DT) =
      %Sql(GPDE_AL_TMPL_FUNC_DAYADD_U, ST1.GPDE_DV_EVT_EFFDT, 1))
              AND ST1.GPDE_DV_EVT_EFFDT < ELG.GPDE_AL_BGN_DT)
        AND %Sql(GPDE_DV_ABS_STILL_ACTIVE, ELG, ABS1, %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U,
      ELG.PRD_END_DT))
        AND ABS1.EFFDT >= %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U, %Sql(GPDE_AL_TMPL_FUNC_DAYADD_U,
      %Sql(GPDE_AL_TMPL_FUNC_MONBEG_U, ELG.PRD_END_DT), (- 1)))




SQL: GPDE_DV_REP DSME_PF Step01 S                  ApplEng
             ApplEng                        GPDE_DV_REP
             Section                        DSME_PF
             Step                           Step01
             Action                         SQL
             Market                         GBL

      SQL Statement
      DELETE FROM PS_GPDE_DV_DSME_PF
      WHERE EXISTS (SELECT 'X'
            FROM PS_GPDE_RP_SI01 B,
                  PS_GPDE_SI_PROV C,
                  PS_GPDE_DV_ELIG_MO D
            WHERE PS_GPDE_DV_DSME_PF.EMPLID = B.EMPLID
              AND PS_GPDE_DV_DSME_PF.EMPL_RCD = B.EMPL_RCD
              AND PS_GPDE_DV_DSME_PF.GPDE_DV_EVT_EFFDT >= TO_DATE ('2009-01-01', 'YYYY-MM-DD')
              AND B.EMPLID = D.EMPLID
              AND B.EMPL_RCD = D.EMPL_RCD
              AND B.CAL_ID = D.CAL_ID
              AND B.CAL_RUN_ID = D.ORIG_CAL_RUN_ID
              AND D.CAL_RUN_ID = %Bind(CAL_RUN_ID)
              AND B.SLICE_END_DT = D.SLICE_END_DT
              AND C.GPDE_SI_PROV = B.GPDE_SI_PROV_RV
              AND C.EFFDT = (SELECT MAX(X.EFFDT)
                  FROM PS_GPDE_SI_PROV X
                  WHERE X.GPDE_SI_PROV = B.GPDE_SI_PROV_RV)
              AND D.SLICE_BGN_DT = (SELECT MIN(D1.SLICE_BGN_DT)
                  FROM PS_GPDE_DV_ELIG_MO D1
                  WHERE D.EMPLID = D1.EMPLID
                    AND D.EMPL_RCD = D1.EMPL_RCD
                    AND D.PRD_END_DT = D1.PRD_END_DT
                    AND D.SEG_END_DT = D1.SEG_END_DT
                    AND D.SLICE_END_DT = D1.SLICE_END_DT
                    AND D.CAL_ID = D1.CAL_ID
                    AND D.GP_PAYGROUP = D1.GP_PAYGROUP)
              AND ((PS_GPDE_DV_DSME_PF.GPDE_DV_EVT_EFFDT >= D.SLICE_BGN_DT
                          AND PS_GPDE_DV_DSME_PF.GPDE_DV_REP_TYPE <> 'ABM')
                    OR (PS_GPDE_DV_DSME_PF.GPDE_DV_EVT_EFFDT > D.SLICE_BGN_DT
                          AND PS_GPDE_DV_DSME_PF.GPDE_DV_REP_TYPE = 'ABM')))




SQL: GPDE_DV_REP DSME_PF Step02 S                  ApplEng
             ApplEng                        GPDE_DV_REP
             Section                        DSME_PF
             Step                           Step02
             Action                         SQL
             Market                         GBL

      SQL Statement
      INSERT INTO PS_GPDE_DV_DSME_PF
            (%Sql(GPDE_DV_DEUV_DSME_FLD))
      SELECT DISTINCT
            SO.EMPLID,
            SO.EMPL_RCD,
            SO.GPDE_DV_EVT_EFFDT,
        SO.GPDE_DV_REP_RSN,
        SO.GPDE_DV_RUN,
        SO.GPDE_DV_CANCEL,
        SO.GPDE_DV_EVT_TYPE,
        SO.DTTM_CREATED,
        SO.GPDE_DV_RVNR,
        SO.GPDE_SI_BTNR,
        B.GPDE_SI_PROV_RV,
        C.GPDE_SI_PROV_ID,
        SO.GPDE_DV_EMPL_CAT,
        SO.NATION_CD,
        SO.GPDE_DV_DBME,
        SO.GPDE_DV_DBNA,
        SO.GPDE_DV_DBGB,
        SO.GPDE_DV_DBAN,
        SO.GPDE_DV_DBEU,
        SO.GPDE_DV_DBSO,
        'N',
        SO.GPDE_DV_REP,
        SO.GPDE_DV_REP_DATE,
        SO.GPDE_AL_FREQUENCY,
        SO.GPDE_DV_REP_TYPE,
        SO.GPDE_DV_REP_STATUS,
        SO.GPDE_DV_WORKED,
        SO.CAL_RUN_ID,
        SO.DTTM_STAMP,
        SO.ORIG_EFFDT,
        SO.GPDE_SI_BAEGV,
        B.GPDE_VW_MNRBV
FROM    %Bind(GPDE_DV_DSME_SO_TB, NOQUOTES) SO,
        PS_GPDE_RP_SI01 B,
        PS_GPDE_SI_PROV C,
        PS_GPDE_DV_ELIG_MO D
WHERE   SO.EMPLID = B.EMPLID
  AND   SO.EMPL_RCD = B.EMPL_RCD
  AND   SO.GPDE_DV_WORKED = 'N'
  AND   B.GPDE_RP_VW_ELIG <> 0
  AND   SO.GPDE_DV_EVT_EFFDT >= %DateIn('2009-01-01')
  AND   ((SO.GPDE_DV_EVT_EFFDT >= %DateIn('2009-01-01')
                AND SO.GPDE_DV_REP_TYPE <> 'ABM')
          OR (SO.GPDE_DV_EVT_EFFDT > %DateIn('2009-01-01')
                AND SO.GPDE_DV_REP_TYPE = 'ABM'))
 AND    C.GPDE_SI_PROV = B.GPDE_SI_PROV_RV
 AND    B.EMPLID = D.EMPLID
 AND    B.EMPL_RCD = D.EMPL_RCD
 AND    B.CAL_ID = D.CAL_ID
 AND    B.CAL_RUN_ID = D.ORIG_CAL_RUN_ID
 AND    B.SLICE_END_DT = D.SLICE_END_DT
 AND    D.CAL_RUN_ID = %Bind(CAL_RUN_ID)
 AND    C.EFFDT = (SELECT MAX(X.EFFDT)
        FROM PS_GPDE_SI_PROV X
        WHERE X.GPDE_SI_PROV = B.GPDE_SI_PROV_RV)
 AND    (B.SLICE_END_DT = (SELECT MAX(B2.SLICE_END_DT)
              FROM PS_GPDE_RP_SI01 B2
              WHERE B.EMPLID = B2.EMPLID
                AND B.CAL_RUN_ID = B2.CAL_RUN_ID
                AND B.EMPL_RCD = B2.EMPL_RCD
                AND B.GP_PAYGROUP = B2.GP_PAYGROUP
                AND B.CAL_ID = B2.CAL_ID
                AND B.ORIG_CAL_RUN_ID = B2.ORIG_CAL_RUN_ID
                AND B.RSLT_SEG_NUM = B2.RSLT_SEG_NUM
                AND B.SEG_END_DT = B2.SEG_END_DT
                AND B.SLICE_END_DT = B2.SLICE_END_DT
                AND SO.GPDE_DV_REP_TYPE = 'ABM'
                AND B2.SLICE_END_DT = %Sql(GPDE_AL_TMPL_FUNC_DAYADD_U, SO.GPDE_DV_EVT_EFFDT,
- 1))
         OR   B.SLICE_END_DT = (SELECT MIN(B2.SLICE_END_DT)
              FROM PS_GPDE_RP_SI01 B2
              WHERE B.EMPLID = B2.EMPLID
                AND B.CAL_RUN_ID = B2.CAL_RUN_ID
                AND B.EMPL_RCD = B2.EMPL_RCD
                    AND B.GP_PAYGROUP = B2.GP_PAYGROUP
                    AND B.CAL_ID = B2.CAL_ID
                    AND B.ORIG_CAL_RUN_ID = B2.ORIG_CAL_RUN_ID
                    AND B.RSLT_SEG_NUM = B2.RSLT_SEG_NUM
                    AND B.SEG_END_DT = B2.SEG_END_DT
                    AND B.SLICE_END_DT = B2.SLICE_END_DT
                    AND SO.GPDE_DV_REP_TYPE = 'UNT'
                    AND B2.SLICE_END_DT >= SO.GPDE_DV_EVT_EFFDT)
             OR   B.SLICE_BGN_DT = (SELECT MIN(B2.SLICE_BGN_DT)
                  FROM PS_GPDE_RP_SI01 B2
                  WHERE B.EMPLID = B2.EMPLID
                    AND B.CAL_RUN_ID = B2.CAL_RUN_ID
                    AND B.EMPL_RCD = B2.EMPL_RCD
                    AND B.GP_PAYGROUP = B2.GP_PAYGROUP
                    AND B.CAL_ID = B2.CAL_ID
                    AND B.ORIG_CAL_RUN_ID = B2.ORIG_CAL_RUN_ID
                    AND B.RSLT_SEG_NUM = B2.RSLT_SEG_NUM
                    AND B.SEG_END_DT = B2.SEG_END_DT
                    AND B.SLICE_END_DT = B2.SLICE_END_DT
                    AND SO.GPDE_DV_REP_TYPE IN ('ANM', 'SON', 'AEN')
                    AND B2.SLICE_BGN_DT = SO.GPDE_DV_EVT_EFFDT))




SQL: GPDE_DV_REP DSME_PF Step03 S                   ApplEng
             ApplEng                         GPDE_DV_REP
             Section                         DSME_PF
             Step                            Step03
             Action                          SQL
             Market                          GBL

      SQL Statement
      INSERT INTO PS_GPDE_DV_DSME_SO
            (%Sql(GPDE_DV_DEUV_DSME_FLD))
      SELECT
            %Sql(GPDE_DV_DEUV_DSME_FLD)
      FROM PS_GPDE_DV_DSME_PF
      WHERE CAL_RUN_ID = %Bind(CAL_RUN_ID)




SQL: GPDE_DV_REP DSME_PF Step04 S                   ApplEng
             ApplEng                         GPDE_DV_REP
             Section                         DSME_PF
             Step                            Step04
             Action                          SQL
             Market                          GBL

      SQL Statement

      UPDATE PS_GPDE_DV_DSME_PF SET
            CAL_RUN_ID = %Bind(CAL_RUN_ID)
      WHERE EXISTS (SELECT 'X'
            FROM PS_GPDE_DV_ELIG_MO D
            WHERE D.EMPLID = PS_GPDE_DV_DSME_PF.EMPLID
              AND D.EMPL_RCD = PS_GPDE_DV_DSME_PF.EMPL_RCD
              AND D.CAL_RUN_ID = %Bind(CAL_RUN_ID))




SQL: GPDE_DV_REP REP_XFERUPDWKDPFS                  ApplEng
             ApplEng                         GPDE_DV_REP
             Section                         REP_XFER
             Step                            UPDWKDPF
             Action                          SQL
             Market                          GBL

      SQL Statement
     UPDATE PS_GPDE_DV_DSME_PF SET
           GPDE_DV_WORKED = 'Y'
     WHERE CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND GPDE_DV_WORKED = 'N'




SQL: GPDE_DV_REP REP_XFERWRK_PF S                  ApplEng
            ApplEng                         GPDE_DV_REP
            Section                         REP_XFER
            Step                            WRK_PF
            Action                          SQL
            Market                          GBL

     SQL Statement

     UPDATE PS_GPDE_DV_DSME_PF SET
           GPDE_DV_WORKED = 'Y'
     WHERE EXISTS (SELECT 'X'
           FROM PS_GPDE_DV_DSME_SO SO
           WHERE SO.EMPLID = PS_GPDE_DV_DSME_PF.EMPLID
             AND SO.EMPL_RCD = PS_GPDE_DV_DSME_PF.EMPL_RCD
             AND SO.GPDE_DV_EVT_EFFDT = PS_GPDE_DV_DSME_PF.GPDE_DV_EVT_EFFDT
             AND SO.GPDE_DV_REP_RSN = PS_GPDE_DV_DSME_PF.GPDE_DV_REP_RSN
             AND SO.GPDE_DV_RUN = PS_GPDE_DV_DSME_PF.GPDE_DV_RUN
             AND SO.GPDE_DV_CANCEL = PS_GPDE_DV_DSME_PF.GPDE_DV_CANCEL
             AND SO.GPDE_DV_EVT_TYPE = PS_GPDE_DV_DSME_PF.GPDE_DV_EVT_TYPE
             AND SO.GPDE_SI_PROV = PS_GPDE_DV_DSME_PF.GPDE_SI_PROV
             AND GPDE_DV_WORKED = 'Y')




SQL: GPDE_DV_SNDR_VW                               View

     SQL Statement
     SELECT DISTINCT CR.CAL_RUN_ID,
           PL.GPDE_SI_BTNR,
           PE.PAY_ENTITY,
           PE.DESCR,
           PL.LOCATION,
           LO.DESCR,
           LO.COUNTRY,
           LO.ADDRESS1,
           LO.ADDRESS2,
           LO.ADDRESS3,
           LO.ADDRESS4,
           LO.POSTAL,
           LO.CITY,
           LO.SETID,
           LO.EFFDT
     FROM PS_GPDE_AL_PE_LOC PL,
           PS_GP_PYENT PE,
           PS_GP_CAL_RUN_DTL CR,
           PS_GP_CALENDAR CA,
           PS_GP_CAL_PRD CP,
           PS_LOCATION_TBL LO
     WHERE PL.PAY_ENTITY = CR.PAY_ENTITY
       AND PE.PAY_ENTITY = PL.PAY_ENTITY
       AND CA.GP_PAYGROUP = CR.GP_PAYGROUP
       AND CA.CAL_ID = CR.CAL_ID
       AND PL.GPDE_SI_REP_BTNR = 'Y'
       AND CP.CAL_PRD_ID = CA.CAL_PRD_ID
       AND PL.EFFDT = (SELECT MAX(EFFDT)
           FROM PS_GPDE_AL_PE_LOC PL1
           WHERE PL1.PAY_ENTITY = PL.PAY_ENTITY
             AND PL1.EFFDT <= CP.PRD_END_DT)
       AND LO.SETID = PL.SETID
       AND LO.LOCATION = PL.LOCATION
       AND LO.EFFDT = (SELECT MAX(EFFDT)
           FROM PS_LOCATION_TBL LO1
           WHERE LO1.SETID = PL.SETID
             AND LO1.LOCATION = PL.LOCATION
             AND LO1.EFFDT <= PL.EFFDT)
       AND LO.EFF_STATUS = 'A'




SQL: GPDE_UNPD_ABSVW                               View

     SQL Statement
     SELECT DISTINCT RP1.EMPLID,
           RP1.EMPL_RCD,
           FLD.ABS_BGN_DT,
           FLD.ABS_END_DT,
           PIN.DESCR,
           RP2.GPDE_RP_UNPD_CALDY,
           RP1.PAY_ENTITY,
           RP1.SEG_END_DT,
           RP1.PRD_BGN_DT
     FROM PS_GPDE_RP_0001 RP1,
           PS_GPDE_RP_0002 RP2,
           PS_GP_PI_GEN_DATA FLD,
           PS_GP_PIN PIN,
           PS_GP_CAL_RUN E
     WHERE RP1.CAL_RUN_ID = RP2.CAL_RUN_ID
       AND RP1.EMPLID = RP2.EMPLID
       AND RP1.EMPL_RCD = RP2.EMPL_RCD
       AND RP1.CAL_ID = RP2.CAL_ID
       AND RP1.ORIG_CAL_RUN_ID = RP2.ORIG_CAL_RUN_ID
       AND RP1.CAL_RUN_ID = FLD.SRC_CAL_RUN_ID
       AND RP1.EMPLID = FLD.EMPLID
       AND RP1.EMPL_RCD = FLD.EMPL_RCD
       AND RP1.CAL_ID = FLD.CAL_ID
       AND PIN.PIN_NUM = FLD.PIN_TK_NUM
       AND E.CAL_RUN_ID = RP1.CAL_RUN_ID
       AND FLD.ABS_BGN_DT < RP1.SEG_END_DT
       AND (((%DateDiff(FLD.ABS_BGN_DT, FLD.ABS_END_DT) >= %DateDiff(FLD.ABS_PRD_BGN_DT,
     FLD.ABS_PRD_END_DT) + 1)
                   OR (%DateDiff(FLD.ABS_BGN_DT, FLD.ABS_END_DT) = RP2.GPDE_RP_UNPD_CALDY - 1))
             AND ((FLD.ABS_END_DT = FLD.ABS_PRD_END_DT)
                   OR (FLD.ABS_BGN_DT = FLD.ABS_PRD_BGN_DT)
                   OR (%DateDiff(FLD.ABS_BGN_DT, FLD.ABS_END_DT) >= RP2.GPDE_RP_UNPD_CALDY)))




SQL: GPES_FNQ_DEV_VW                               View

     SQL Statement

     SELECT B.PIN_NUM,
           A.ACM_SIGN
     FROM PS_GP_ACM_MBR A,
           PS_GP_PIN B,
           PS_GP_PIN_CMPNT C
     WHERE A.PIN_NUM = (SELECT PIN_NUM
           FROM PS_GP_PIN
           WHERE PIN_CODE = 'SS AC BSE D S ESP')
       AND B.PIN_PARENT_NUM = A.PIN_MBR_NUM
       AND C.PIN_NUM = A.PIN_MBR_NUM
       AND C.PIN_AA_RATE_NUM = B.PIN_NUM




SQL: GPES_TAX_RS_VW                                View

     SQL Statement
     [ . . . Description Unchanged . . . ]




SQL: GPES_TER_EMP_VW                              View

     SQL Statement
     SELECT DISTINCT %Sql(SCRTY_SEL_PKEY, OPR, SEC),
           %DateAdd(J.EFFDT, - 1),
           %Sql(SCRTY_SEL_CORSBR, NM, SEC),
           %Sql(SCRTY_SEL_FLDSBR, SEC),
           %Sql(SCRTY_SEL_PAYSBR, SEC),
           J.ACTION,
           J.ACTION_REASON
     FROM %Sql(SCRTY_PER_NM_FROM),
           PS_JOB J
     WHERE J.ACTION IN (SELECT AC.ACTION
     WHERE (J.ACTION IN (SELECT AC.ACTION
                 FROM PS_GPES_TERM_AC_VW AC
                 WHERE AC.EFFDT = (SELECT MAX(EFFDT)
                       FROM PS_GPES_TERM_AC_VW
                       WHERE ACTION = AC.ACTION
                         AND EFFDT <= %CurrentDateIn))
             OR J.EMPL_STATUS = 'D')
       AND SEC.EMPLID = J.EMPLID
       AND SEC.EMPL_RCD = J.EMPL_RCD
       AND %Sql(SCRTY_NO_APPT1)
       AND %Sql(SCRTY_NAME)
       AND %Sql(SCRTY_WHERE, 'PPLJOB')




SQL: GPFR_AF_EXTR_VW                              View

     SQL Statement

     [ . . . Description Unchanged . . . ]




SQL: GPFR_AF_LREC_VW                              View

     SQL Statement

     [ . . . Description Unchanged . . . ]




SQL: GPFR_AF_LVLF_VW                              View

     SQL Statement

     [ . . . Description Unchanged . . . ]




SQL: GPFR_AF_ND_VW                                View

     SQL Statement

     [ . . . Description Unchanged . . . ]
SQL: GPFR_AF_RTRIM_LTRIM                             Normal
             Description                      Right and left trim
             Comments                         Right and Left trim a string
             Owner ID                         Global Payroll France

      SQL Statement

      [ . . . Description Unchanged . . . ]



      SQL Statement

      [ . . . Description Unchanged . . . ]



      SQL Statement

      [ . . . Description Unchanged . . . ]



      SQL Statement

      [ . . . Description Unchanged . . . ]



      SQL Statement

      [ . . . Description Unchanged . . . ]



      SQL Statement

      [ . . . Description Unchanged . . . ]



      SQL Statement

      [ . . . Description Unchanged . . . ]




SQL: GPFR_AF_XML                                     Normal
             Description                      XML data from GPFR_AF_EXTRACT
             Comments                         Select data in XML order from GPFR_AF_EXTRACT record
             Owner ID                         Global Payroll France

      SQL Statement

      [ . . . Description Unchanged . . . ]




SQL: GPFR_PMT_AE POPULATEInsert1 S                   ApplEng
             ApplEng                          GPFR_PMT_AE
       Section                  POPULATE
       Step                     Insert1
       Action                   SQL
       Market                   GBL

SQL Statement
INSERT INTO PS_GPFR_PAYMENT
      (CAL_RUN_ID,
      ORIG_CAL_RUN_ID,
      EMPLID,
      EMPL_RCD,
      INSTANCE,
      SRC_BANK_ID,
      CURRENCY_CD,
      RECIPIENT_ID,
      RECIPIENT_NAME,
      PAY_ENTITY,
      GP_PAYGROUP,
      CAL_ID,
      RUN_TYPE,
      PYMT_KEY1,
      PYMT_KEY2,
      PYMT_KEY3,
      PYMT_KEY4,
      PMT_TYPE,
      GP_PMT_AMT,
      PAYMENT_MTHD,
      DEBIT_DT,
      REVERSAL_IND,
      PMT_STATUS,
      GPFR_BANK_CD,
      GPFR_BRANCH_EC_CD,
      GPFR_ACCOUNT_EC_ID,
      BANK_CD,
      BRANCH_EC_CD,
      ACCOUNT_EC_ID,
      BANK_TRANSFER_ID,
      NAME,
      GPFR_BANK_NAME,
      GPFR_BANK_PAY_DT,
      GPFR_BANK_TOT_AMT)
SELECT
      A.CAL_RUN_ID,
      A.ORIG_CAL_RUN_ID,
      MAX(A.ORIG_CAL_RUN_ID),
      A.EMPLID,
      A.EMPL_RCD,
      A.INSTANCE,
      A.SRC_BANK_ID,
      A.CURRENCY_CD,
      A.RECIPIENT_ID,
      A.RECIPIENT_NAME,
      A.PAY_ENTITY,
      A.GP_PAYGROUP,
      A.CAL_ID,
      MAX(A.CAL_ID),
      B.RUN_TYPE,
      A.PYMT_KEY1,
      A.PYMT_KEY2,
      A.PYMT_KEY3,
      A.PYMT_KEY4,
      A.PMT_TYPE,
      SUM(A.GP_PMT_AMT),
      A.PAYMENT_MTHD,
      B.PYMT_DT,
      MAX(B.PYMT_DT),
      A.REVERSAL_IND,
      A.PMT_STATUS,
      ' ',
      ' ',
      ' ',
             ' ',
             ' ',
             ' ',
             ' ',
             ' ',
             ' ',
             ' ',
             0
     FROM    PS_GP_PAYMENT A,
             PS_GP_PYE_PRC_STAT B
     WHERE   A.EMPLID = B.EMPLID
       AND   A.CAL_RUN_ID = B.CAL_RUN_ID
       AND   A.EMPL_RCD = B.EMPL_RCD
       AND   A.GP_PAYGROUP = B.GP_PAYGROUP
       AND   A.CAL_ID = B.CAL_ID
       AND   A.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND   A.ORIG_CAL_RUN_ID = B.ORIG_CAL_RUN_ID
       AND   A.PMT_STATUS IN ('P', 'N', 'M')
       AND   A.PMT_TYPE IN ('01', '03')
       AND   EXISTS (SELECT 'X'
             FROM PS_EMPLMT_SRCH_GBL SEC
             WHERE SEC.OPRID = %Bind(OPRID)
               AND SEC.EMPLID = A.EMPLID
               AND SEC.EMPL_RCD = A.EMPL_RCD)
     GROUP   BY A.CAL_RUN_ID,
             A.ORIG_CAL_RUN_ID,
             A.EMPLID,
             A.EMPL_RCD,
             A.INSTANCE,
             A.SRC_BANK_ID,
             A.CURRENCY_CD,
             A.RECIPIENT_ID,
             A.RECIPIENT_NAME,
             A.PAY_ENTITY,
             A.GP_PAYGROUP,
             A.CAL_ID,
             B.RUN_TYPE,
             A.PYMT_KEY1,
             A.PYMT_KEY2,
             A.PYMT_KEY3,
             A.PYMT_KEY4,
             A.PMT_TYPE,
             A.PAYMENT_MTHD,
             B.PYMT_DT,
             A.REVERSAL_IND,
             A.PMT_STATUS




SQL: GPFR_RSLT_ER_VW                                 View

     SQL Statement
     SELECT 'RETRO',
           G.EMPLID,
           G.EMPL_RCD,
           G.CAL_RUN_ID,
           G.GP_PAYGROUP,
           G.CAL_ID,
           G.ORIG_CAL_RUN_ID,
           G.RSLT_SEG_NUM,
           G.PYMT_KEY1,
           G.PYMT_KEY2,
           G.PYMT_KEY3,
           G.PYMT_KEY4,
           G.CALC_ACTION,
           G.PRD_TYPE,
           G.CURRENCY_CD,
           C.CURRENCY_CD,
           B.CAL_RUN_ID,
           B.CAL_ID,
        B.RSLT_SEG_NUM,
        A.RSLT_VER_NUM,
        A.RSLT_REV_NUM,
        DL.PIN_RTO_ADJ_NUM,
        B.INSTANCE,
        B.SLICE_BGN_DT,
        B.SLICE_END_DT,
        B.CALC_RSLT_VAL,
        B.BASE_RSLT_VAL,
        B.RATE_RSLT_VAL,
        B.UNIT_RSLT_VAL,
        B.PCT_RSLT_VAL
FROM    PS_GP_PYE_SEG_STAT A,
        PS_GP_PYE_PRC_STAT C,
        PS_GP_RSLT_ERN_DED B,
        PS_GP_RSLT_DELTA DL,
        PS_GPFR_GUIDE_VW G
WHERE   A.EMPLID = B.EMPLID
  AND   A.EMPL_RCD = B.EMPL_RCD
  AND   A.CAL_RUN_ID = B.CAL_RUN_ID
  AND   A.GP_PAYGROUP = B.GP_PAYGROUP
  AND   A.CAL_ID = B.CAL_ID
  AND   A.ORIG_CAL_RUN_ID = B.ORIG_CAL_RUN_ID
  AND   A.RSLT_SEG_NUM = B.RSLT_SEG_NUM
  AND   A.EMPLID = C.EMPLID
  AND   A.EMPL_RCD = C.EMPL_RCD
  AND   A.GP_PAYGROUP = C.GP_PAYGROUP
  AND   A.CAL_ID = C.CAL_ID
  AND   A.CAL_RUN_ID = C.CAL_RUN_ID
  AND   A.ORIG_CAL_RUN_ID = C.ORIG_CAL_RUN_ID
  AND   A.CALC_ACTION <> 'V'
  AND   C.PRD_TYPE = 'R'
  AND   C.CALC_TYPE = 'P'
  AND   C.EMPLID = G.EMPLID
  AND   C.CAL_RUN_ID = G.CAL_RUN_ID
  AND   C.EMPL_RCD = G.EMPL_RCD
  AND   C.GP_PAYGROUP = G.GP_PAYGROUP
  AND   G.PYMT_KEY1 = A.PYMT_KEY1
  AND   G.PYMT_KEY2 = A.PYMT_KEY2
  AND   G.PYMT_KEY3 = A.PYMT_KEY3
  AND   G.PYMT_KEY4 = A.PYMT_KEY4
  AND   G.RSLT_SEG_NUM = (SELECT MIN(G2.RSLT_SEG_NUM)
        FROM PS_GPFR_GUIDE_VW G2
        WHERE G2.EMPLID = G.EMPLID
          AND G2.CAL_RUN_ID = G.CAL_RUN_ID
          AND G2.EMPL_RCD = G.EMPL_RCD
          AND G2.GP_PAYGROUP = G.GP_PAYGROUP
          AND G2.PYMT_KEY1 = G.PYMT_KEY1
          AND G2.PYMT_KEY2 = G.PYMT_KEY2
          AND G2.PYMT_KEY3 = G.PYMT_KEY3
          AND G2.PYMT_KEY4 = G.PYMT_KEY4)
 AND    DL.EMPLID = A.EMPLID
 AND    DL.EMPL_RCD = A.EMPL_RCD
 AND    DL.PYMT_KEY1 = A.PYMT_KEY1
 AND    DL.PYMT_KEY2 = A.PYMT_KEY2
 AND    DL.PYMT_KEY3 = A.PYMT_KEY3
 AND    DL.PYMT_KEY4 = A.PYMT_KEY4
 AND    DL.PIN_NUM = B.PIN_NUM
 AND    DL.RSLT_SEG_NUM = A.RSLT_SEG_NUM
 AND    ((DL.REPLACE_IND = 'Y'
                AND DL.CAL_RUN_ID = C.CAL_RUN_ID
                AND DL.GP_PAYGROUP = C.GP_PAYGROUP
                AND DL.CAL_ID = C.CAL_ID)
          OR (DL.FORWARD_IND = 'Y'
                AND DL.FWD2_CAL_RUN_ID = G.CAL_RUN_ID
                AND DL.FWD2_PAYGROUP = G.GP_PAYGROUP
                AND DL.FWD2_CAL_ID = G.CAL_ID
                AND DL.CAL_ID = A.CAL_ID))
 AND    DL.USER_FLD1 = B.USER_FLD1
 AND    DL.USER_FLD2 = B.USER_FLD2
 AND    DL.USER_FLD3 = B.USER_FLD3
        AND DL.USER_FLD4 = B.USER_FLD4
        AND DL.USER_FLD5 = B.USER_FLD5
        AND DL.USER_FLD6 = B.USER_FLD6




SQL: GPGB_EDIP451P451_EE EEs       D               ApplEng
             ApplEng                       GPGB_EDIP451
             Section                       P451_EE
             Step                          EEs
             Action                        Do Select
             Market                        GBL

      SQL Statement
      %SelectInit(EMPLID,
            CAL_RUN_ID,
            EMPL_RCD,
            GP_PAYGROUP,
            CAL_ID,
            TAXCODE_UK,
            TAX_BASIS_UK,
            GPGB_TAX_BGN_YR,
            HIRE_DT,
            RSLT_SEG_NUM,
            GPGB_SV_TAX_IND,
            GPGB_P45_CAL_RUN,
            EFFDT,
            GPGB_LEAVE_DT,
            GPGB_EDI_VALUE,
            GPGB_EDI_CODE,
            GPGB_EDI_CODE2,
            GPGB_EDI_DATE)
      SELECT B.EMPLID,
            B.CAL_RUN_ID,
            B.EMPL_RCD,
            B.GP_PAYGROUP,
            B.CAL_ID,
            B.TAX_CODE_UK,
            B.TAX_BASIS_UK,
            B.GPGB_TAX_BGN_YR,
            %DateOut(B.HIRE_DT),
            B.RSLT_SEG_NUM,
            A.GPGB_SV_TAX_IND,
            A.GPGB_P45_CAL_RUN,
            %DateOut(A.EFFDT),
            %DateOut(A.LEAVE_DT),
            ' ',
            ' ',
            ' ',
            %DateOut(%DateNull)
      FROM PS_GPGB_EE_TAX A,
            PS_GPGB_EE_RSLT B,
            PS_GP_PYE_PRC_STAT C
      WHERE %Sql(%BIND(GPGB_EDI_MOD_SQLID, NOQUOTES), A, B)
        AND %Sql(%Bind(GPGB_EDI_QTY_SQLID, NOQUOTES), A)
        AND A.EFFDT = (SELECT MAX(A1.EFFDT)
            FROM PS_GPGB_EE_TAX A1
            WHERE A1.EMPLID = A.EMPLID
              AND A1.EMPL_RCD = A.EMPL_RCD
              AND A1.EFFDT <= A.LEAVE_DT)
        AND A.EFFSEQ = (SELECT MAX(A2.EFFSEQ)
            FROM PS_GPGB_EE_TAX A2
            WHERE A2.EMPLID = A.EMPLID
              AND A2.EMPL_RCD = A.EMPL_RCD
              AND A2.EFFDT = A.EFFDT)
        AND A.GPGB_P45_CAL_RUN <> ' '
        AND (A.LEAVE_DT IS NOT NULL
              AND (A.LEAVE_DT >= %Bind(START_DT)
                    AND A.LEAVE_DT <= %Bind(END_DT)))
        AND B.CAL_RUN_ID = A.GPGB_P45_CAL_RUN
       AND  %Sql(%Bind(GPGB_EDI_REF_SQLID, NOQUOTES), A)
       AND  C.EMPLID = B.EMPLID
       AND  C.CAL_RUN_ID = B.CAL_RUN_ID
       AND  C.EMPL_RCD = B.EMPL_RCD
       AND  C.GP_PAYGROUP = B.GP_PAYGROUP
       AND  C.CAL_ID = B.CAL_ID
       AND  C.CALC_TYPE = 'P'
       AND  C.PAY_ENTITY = %Bind(PAY_ENTITY)
       AND  C.PRC_ORD_TS = (SELECT MAX(X.PRC_ORD_TS)
            FROM PS_GP_PYE_PRC_STAT X,
                  PS_GPGB_EE_RSLT Y
            WHERE X.EMPLID = C.EMPLID
              AND X.EMPL_RCD = C.EMPL_RCD
              AND X.GP_PAYGROUP = C.GP_PAYGROUP
              AND X.PAY_ENTITY = C.PAY_ENTITY
              AND X.CALC_TYPE = C.CALC_TYPE
              AND Y.EMPLID = X.EMPLID
              AND Y.EMPL_RCD = X.EMPL_RCD
              AND Y.PAY_ENTITY = X.PAY_ENTITY
              AND Y.GP_PAYGROUP = X.GP_PAYGROUP
              AND Y.CAL_RUN_ID = X.CAL_RUN_ID
              AND X.CAL_RUN_ID = C.CAL_RUN_ID
              AND Y.CAL_ID = X.CAL_ID
              AND Y.HIRE_DT = B.HIRE_DT)
        AND B.RSLT_SEG_NUM = (SELECT MAX(Y.RSLT_SEG_NUM)
            FROM PS_GP_PYE_PRC_STAT X,
                  PS_GPGB_EE_RSLT Y
            WHERE X.EMPLID = B.EMPLID
              AND X.EMPL_RCD = B.EMPL_RCD
              AND X.GP_PAYGROUP = B.GP_PAYGROUP
              AND X.PAY_ENTITY = B.PAY_ENTITY
              AND X.CALC_TYPE = C.CALC_TYPE
              AND X.PRC_ORD_TS = C.PRC_ORD_TS
              AND Y.EMPLID = X.EMPLID
              AND Y.EMPL_RCD = X.EMPL_RCD
              AND Y.PAY_ENTITY = X.PAY_ENTITY
              AND Y.GP_PAYGROUP = X.GP_PAYGROUP
              AND Y.CAL_RUN_ID = X.CAL_RUN_ID
              AND Y.CAL_RUN_ID = B.CAL_RUN_ID
              AND Y.CAL_ID = X.CAL_ID
              AND Y.HIRE_DT = B.HIRE_DT)
        AND (B.LEAVE_DT IS NOT NULL
              AND B.LEAVE_DT <= C.PRD_END_DT)
      ORDER BY B.GPGB_TAX_BGN_YR,
            B.PAY_ENTITY,
            B.EMPLID,
            B.EMPL_RCD,
            B.HIRE_DT,
            B.FREQUENCY_ID,
            B.GPGB_TAX_PERIOD




SQL: GPGB_EDI_PRCEDIAcum Step01 S                  ApplEng
             ApplEng                       GPGB_EDI_PRC
             Section                       EDIAcum
             Step                          Step01
             Action                        SQL
             Market                        GBL

      SQL Statement
      INSERT INTO %Table(GPGB_EDIA_TMP)
            (PROCESS_INSTANCE,
            EMPLID,
            CAL_RUN_ID,
            EMPL_RCD,
            GP_PAYGROUP,
            CAL_ID,
            ORIG_CAL_RUN_ID,
            RSLT_SEG_NUM,
            USER_KEY1,
            USER_KEY2,
            PIN_NUM,
            CALC_RSLT_VAL,
            USER_ADJ_VAL,
            BASE_RSLT_VAL)
      SELECT
            A.PROCESS_INSTANCE,
            A.EMPLID,
            A.CAL_RUN_ID,
            A.EMPL_RCD,
            A.GP_PAYGROUP,
            A.CAL_ID,
            A.ORIG_CAL_RUN_ID,
            A.RSLT_SEG_NUM,
            A.USER_KEY1,
            A.USER_KEY2,
            B.PIN_NUM,
            B.CALC_RSLT_VAL,
            B.USER_ADJ_VAL,
            0
      FROM %Table(GPGB_EDIE_TMP) A,
            PS_GP_RSLT_ACUM B
      WHERE A.EMPLID = B.EMPLID
        AND (A.EMPLID BETWEEN %Bind(EMPLID_FROM) AND %Bind(EMPLID_TO))
        AND (B.EMPLID BETWEEN %Bind(EMPLID_FROM) AND %Bind(EMPLID_TO))
        AND A.CAL_RUN_ID = B.CAL_RUN_ID
        AND A.EMPL_RCD = B.EMPL_RCD
        AND A.GP_PAYGROUP = B.GP_PAYGROUP
        AND A.CAL_ID = B.CAL_ID
        AND A.USER_KEY1 = B.USER_KEY1
        AND A.RSLT_SEG_NUM = B.RSLT_SEG_NUM
        AND B.EMPL_RCD_ACUM = A.EMPL_RCD
        AND B.ACM_FROM_DT >= %Bind(START_DT)
        AND B.ACM_THRU_DT <= %Bind(END_DT)
        AND B.PIN_NUM IN (SELECT PIN_NUM
            FROM %Table(GPGB_EDIP_TMP)
            WHERE PIN_TYPE = 'TY'
              AND PROCESS_INSTANCE = %Bind(PROCESS_INSTANCE))
        AND B.SEQ_NUM8 = (SELECT MAX(X.SEQ_NUM8)
            FROM PS_GP_RSLT_ACUM X
            WHERE X.EMPLID = B.EMPLID
              AND X.CAL_RUN_ID = B.CAL_RUN_ID
              AND X.EMPL_RCD = B.EMPL_RCD
              AND X.GP_PAYGROUP = B.GP_PAYGROUP
              AND X.CAL_ID = B.CAL_ID
              AND X.ORIG_CAL_RUN_ID = B.ORIG_CAL_RUN_ID
              AND X.RSLT_SEG_NUM = B.RSLT_SEG_NUM
              AND X.PIN_NUM = B.PIN_NUM
              AND X.USER_KEY1 = B.USER_KEY1
              AND X.ACM_FROM_DT >= %Bind(START_DT)
              AND X.ACM_THRU_DT <= %Bind(END_DT))
        AND A.PROCESS_INSTANCE = %Bind(PROCESS_INSTANCE)




SQL: GPGB_EDI_PRCEDIAcum Step02 S                 ApplEng
             ApplEng                       GPGB_EDI_PRC
             Section                       EDIAcum
             Step                          Step02
             Action                        SQL
             Market                        GBL

      SQL Statement
      INSERT INTO %Table(GPGB_EDIA_TMP)
            (PROCESS_INSTANCE,
            EMPLID,
            CAL_RUN_ID,
            EMPL_RCD,
            GP_PAYGROUP,
            CAL_ID,
            ORIG_CAL_RUN_ID,
            RSLT_SEG_NUM,
            USER_KEY1,
            USER_KEY2,
            PIN_NUM,
            CALC_RSLT_VAL,
            USER_ADJ_VAL,
            BASE_RSLT_VAL)
      SELECT
            A.PROCESS_INSTANCE,
            A.EMPLID,
            A.CAL_RUN_ID,
            A.EMPL_RCD,
            A.GP_PAYGROUP,
            A.CAL_ID,
            A.ORIG_CAL_RUN_ID,
            A.RSLT_SEG_NUM,
            A.USER_KEY1,
            A.USER_KEY2,
            B.PIN_NUM,
            B.CALC_RSLT_VAL,
            B.USER_ADJ_VAL,
            0
      FROM %Table(GPGB_EDIE_TMP) A,
            PS_GP_RSLT_ACUM B
      WHERE A.EMPLID = B.EMPLID
        AND (A.EMPLID BETWEEN %Bind(EMPLID_FROM) AND %Bind(EMPLID_TO))
        AND (B.EMPLID BETWEEN %Bind(EMPLID_FROM) AND %Bind(EMPLID_TO))
        AND A.CAL_RUN_ID = B.CAL_RUN_ID
        AND A.EMPL_RCD = B.EMPL_RCD
        AND A.GP_PAYGROUP = B.GP_PAYGROUP
        AND A.CAL_ID = B.CAL_ID
        AND A.USER_KEY1 = B.USER_KEY1
        AND A.RSLT_SEG_NUM = B.RSLT_SEG_NUM
        AND B.EMPL_RCD_ACUM = A.EMPL_RCD
        AND B.PIN_NUM IN (SELECT PIN_NUM
            FROM %Table(GPGB_EDIP_TMP)
            WHERE PIN_TYPE = 'TP'
              AND PROCESS_INSTANCE = %Bind(PROCESS_INSTANCE))
        AND B.SEQ_NUM8 = (SELECT MAX(X.SEQ_NUM8)
            FROM PS_GP_RSLT_ACUM X
            WHERE X.EMPLID = B.EMPLID
              AND X.CAL_RUN_ID = B.CAL_RUN_ID
              AND X.EMPL_RCD = B.EMPL_RCD
              AND X.GP_PAYGROUP = B.GP_PAYGROUP
              AND X.CAL_ID = B.CAL_ID
              AND X.ORIG_CAL_RUN_ID = B.ORIG_CAL_RUN_ID
              AND X.RSLT_SEG_NUM = B.RSLT_SEG_NUM
              AND X.PIN_NUM = B.PIN_NUM
              AND X.USER_KEY1 = B.USER_KEY1)
        AND A.PROCESS_INSTANCE = %Bind(PROCESS_INSTANCE)




SQL: GPGB_EDI_PRCEDIAcum Step03 S                  ApplEng
             ApplEng                       GPGB_EDI_PRC
             Section                       EDIAcum
             Step                          Step03
             Action                        SQL
             Market                        GBL

      SQL Statement
      INSERT INTO %Table(GPGB_EDIA_TMP)
            (PROCESS_INSTANCE,
            EMPLID,
            CAL_RUN_ID,
            EMPL_RCD,
            GP_PAYGROUP,
            CAL_ID,
            ORIG_CAL_RUN_ID,
            RSLT_SEG_NUM,
            USER_KEY1,
            USER_KEY2,
            PIN_NUM,
            CALC_RSLT_VAL,
            USER_ADJ_VAL,
            BASE_RSLT_VAL)
      SELECT
            A.PROCESS_INSTANCE,
            A.EMPLID,
            A.CAL_RUN_ID,
            A.EMPL_RCD,
            A.GP_PAYGROUP,
            A.CAL_ID,
            A.ORIG_CAL_RUN_ID,
            A.RSLT_SEG_NUM,
            A.USER_KEY1,
            A.USER_KEY2,
            B.PIN_NUM,
            B.CALC_RSLT_VAL,
            B.USER_ADJ_VAL,
            0
      FROM %Table(GPGB_EDIE_TMP) A,
            PS_GP_RSLT_ACUM B
      WHERE A.EMPLID = B.EMPLID
        AND (A.EMPLID BETWEEN %Bind(EMPLID_FROM) AND %Bind(EMPLID_TO))
        AND (B.EMPLID BETWEEN %Bind(EMPLID_FROM) AND %Bind(EMPLID_TO))
        AND A.CAL_RUN_ID = B.CAL_RUN_ID
        AND A.EMPL_RCD = B.EMPL_RCD
        AND A.GP_PAYGROUP = B.GP_PAYGROUP
        AND A.CAL_ID = B.CAL_ID
        AND A.RSLT_SEG_NUM = B.RSLT_SEG_NUM
        AND A.USER_KEY1 = B.USER_KEY1
        AND A.USER_KEY2 = B.USER_KEY2
        AND A.USER_KEY3 = B.USER_KEY3
        AND B.ACM_FROM_DT >= %Bind(START_DT)
        AND B.ACM_THRU_DT <= %Bind(END_DT)
        AND B.PIN_NUM IN (SELECT PIN_NUM
            FROM %Table(GPGB_EDIP_TMP)
            WHERE PIN_TYPE = 'NY'
              AND PROCESS_INSTANCE = %Bind(PROCESS_INSTANCE))
        AND B.SEQ_NUM8 = (SELECT MAX(X.SEQ_NUM8)
            FROM PS_GP_RSLT_ACUM X
            WHERE X.EMPLID = B.EMPLID
              AND X.CAL_RUN_ID = B.CAL_RUN_ID
              AND X.EMPL_RCD = B.EMPL_RCD
              AND X.GP_PAYGROUP = B.GP_PAYGROUP
              AND X.CAL_ID = B.CAL_ID
              AND X.ORIG_CAL_RUN_ID = B.ORIG_CAL_RUN_ID
              AND X.RSLT_SEG_NUM = B.RSLT_SEG_NUM
              AND X.PIN_NUM = B.PIN_NUM
              AND X.ACM_FROM_DT = B.ACM_FROM_DT
              AND X.ACM_THRU_DT = B.ACM_THRU_DT
              AND X.SLICE_BGN_DT = B.SLICE_BGN_DT
              AND X.SLICE_END_DT = B.SLICE_END_DT
              AND X.USER_KEY1 = B.USER_KEY1
              AND X.USER_KEY2 = B.USER_KEY2
              AND X.USER_KEY3 = B.USER_KEY3)
        AND A.PROCESS_INSTANCE = %Bind(PROCESS_INSTANCE)




SQL: GPGB_EDI_PRCEDIAcum Step04 S                  ApplEng
             ApplEng                       GPGB_EDI_PRC
             Section                       EDIAcum
             Step                          Step04
             Action                        SQL
             Market                        GBL
      SQL Statement
      INSERT INTO %Table(GPGB_EDIA_TMP)
            (PROCESS_INSTANCE,
            EMPLID,
            CAL_RUN_ID,
            EMPL_RCD,
            GP_PAYGROUP,
            CAL_ID,
            ORIG_CAL_RUN_ID,
            RSLT_SEG_NUM,
            USER_KEY1,
            USER_KEY2,
            PIN_NUM,
            CALC_RSLT_VAL,
            USER_ADJ_VAL,
            BASE_RSLT_VAL)
      SELECT
            A.PROCESS_INSTANCE,
            A.EMPLID,
            A.CAL_RUN_ID,
            A.EMPL_RCD,
            A.GP_PAYGROUP,
            A.CAL_ID,
            A.ORIG_CAL_RUN_ID,
            A.RSLT_SEG_NUM,
            A.USER_KEY1,
            A.USER_KEY2,
            B.PIN_NUM,
            B.CALC_RSLT_VAL,
            B.USER_ADJ_VAL,
            0
      FROM %Table(GPGB_EDIE_TMP) A,
            PS_GP_RSLT_ACUM B
      WHERE A.EMPLID = B.EMPLID
        AND (A.EMPLID BETWEEN %Bind(EMPLID_FROM) AND %Bind(EMPLID_TO))
        AND (B.EMPLID BETWEEN %Bind(EMPLID_FROM) AND %Bind(EMPLID_TO))
        AND A.CAL_RUN_ID = B.CAL_RUN_ID
        AND A.EMPL_RCD = B.EMPL_RCD
        AND A.GP_PAYGROUP = B.GP_PAYGROUP
        AND A.CAL_ID = B.CAL_ID
        AND A.RSLT_SEG_NUM = B.RSLT_SEG_NUM
        AND A.USER_KEY1 = B.USER_KEY1
        AND A.USER_KEY2 = B.USER_KEY2
        AND A.USER_KEY3 = B.USER_KEY3
        AND B.PIN_NUM IN (SELECT PIN_NUM
            FROM %Table(GPGB_EDIP_TMP)
            WHERE PIN_TYPE = 'NP'
              AND PROCESS_INSTANCE = %Bind(PROCESS_INSTANCE))
        AND B.SEQ_NUM8 = (SELECT MAX(X.SEQ_NUM8)
            FROM PS_GP_RSLT_ACUM X
            WHERE X.EMPLID = B.EMPLID
              AND X.CAL_RUN_ID = B.CAL_RUN_ID
              AND X.EMPL_RCD = B.EMPL_RCD
              AND X.GP_PAYGROUP = B.GP_PAYGROUP
              AND X.CAL_ID = B.CAL_ID
              AND X.ORIG_CAL_RUN_ID = B.ORIG_CAL_RUN_ID
              AND X.RSLT_SEG_NUM = B.RSLT_SEG_NUM
              AND X.PIN_NUM = B.PIN_NUM
              AND X.USER_KEY1 = B.USER_KEY1
              AND X.USER_KEY2 = B.USER_KEY2
              AND X.USER_KEY3 = B.USER_KEY3)
        AND A.PROCESS_INSTANCE = %Bind(PROCESS_INSTANCE)




SQL: GPGB_EDI_PRCEDIPrep Step05A2S                 ApplEng
             ApplEng                       GPGB_EDI_PRC
             Section                       EDIPrep
             Step                          Step05A2
             Action                        SQL
             Market                        GBL

      SQL Statement

      %Select(EMPLID_FROM,
            EMPLID_TO)
      SELECT MIN(A.EMPLID),
            MAX(A.EMPLID)
      FROM %Table(GPGB_EDIE_TMP) A
      WHERE A.PROCESS_INSTANCE = %Bind(PROCESS_INSTANCE)




SQL: GPGB_P45    CkPyPrc Step01 S                  ApplEng
             ApplEng                       GPGB_P45
             Section                       CkPyPrc
             Step                          Step01
             Action                        SQL
             Market                        GBL

      SQL Statement
      %SelectInit(LEAVE_DT,
            HIRE_DT,
            GPGB_P45_EFFDT,
            CAL_RUN_ID,
            CAL_ID,
            ORIG_CAL_RUN_ID,
            RSLT_SEG_NUM,
            RSLT_VER_NUM,
            TAX_CODE_UK,
            NATIONAL_ID,
            TAX_BASIS_UK,
            GPGB_TAX_PERIOD,
            FREQUENCY_ID,
            DEPTID,
            RUN_FINALIZED_IND,
            GPGB_TAX_BGN_YR)
      SELECT %DateOut(A.LEAVE_DT),
            %DateOut(A.HIRE_DT),
            %DateOut(A.GPGB_P45_EFFDT),
            A.CAL_RUN_ID,
            A.CAL_ID,
            A.ORIG_CAL_RUN_ID,
            A.RSLT_SEG_NUM,
            B.RSLT_VER_NUM,
            A.TAX_CODE_UK,
            A.NATIONAL_ID,
            A.TAX_BASIS_UK,
            A.GPGB_TAX_PERIOD,
            A.FREQUENCY_ID,
            A.DEPTID,
            C.RUN_FINALIZED_IND,
            A.GPGB_TAX_BGN_YR
      FROM PS_GPGB_EE_RSLT A,
            PS_GP_PYE_PRC_STAT B,
            PS_GP_CAL_RUN C
      WHERE A.EMPLID = %Bind(EMPLID)
        AND A.EMPL_RCD = %Bind(EMPL_RCD)
        AND A.GP_PAYGROUP = %Bind(GP_PAYGROUP)
        AND A.HIRE_DT <= %Bind(GPGB_JOB_EFFDT)
        AND A.EMPLID = B.EMPLID
        AND A.CAL_RUN_ID = B.CAL_RUN_ID
        AND A.CAL_RUN_ID = C.CAL_RUN_ID
        AND C.CAL_RUN_ID = B.CAL_RUN_ID
        AND A.EMPL_RCD = B.EMPL_RCD
        AND A.GP_PAYGROUP = B.GP_PAYGROUP
        AND A.CAL_ID = B.CAL_ID
        AND B.CALC_TYPE = 'P'
        AND B.PRC_ORD_TS = (SELECT MAX(X.PRC_ORD_TS)
            FROM PS_GP_PYE_PRC_STAT X,
                  PS_GPGB_EE_RSLT Y
            WHERE X.EMPLID = A.EMPLID
              AND X.EMPL_RCD = A.EMPL_RCD
              AND X.GP_PAYGROUP = A.GP_PAYGROUP
              AND X.PAY_ENTITY = A.PAY_ENTITY
              AND X.CALC_TYPE = B.CALC_TYPE
              AND Y.EMPLID = X.EMPLID
              AND Y.EMPL_RCD = X.EMPL_RCD
              AND Y.PAY_ENTITY = X.PAY_ENTITY
              AND Y.GP_PAYGROUP = X.GP_PAYGROUP
              AND Y.CAL_RUN_ID = X.CAL_RUN_ID
              AND Y.CAL_ID = X.CAL_ID
              AND Y.HIRE_DT = A.HIRE_DT)
      ORDER BY A.HIRE_DT DESC




SQL: GPGB_P45    CkPyPrc Step02 S                  ApplEng
             ApplEng                       GPGB_P45
             Section                       CkPyPrc
             Step                          Step02
             Action                        SQL
             Market                        GBL

      SQL Statement
      %SelectInit(LEAVE_DT,
            HIRE_DT,
            GPGB_P45_EFFDT,
            CAL_RUN_ID,
            CAL_ID,
            ORIG_CAL_RUN_ID,
            RSLT_SEG_NUM,
            RSLT_VER_NUM,
            TAX_CODE_UK,
            NATIONAL_ID,
            TAX_BASIS_UK,
            GPGB_TAX_PERIOD,
            FREQUENCY_ID,
            DEPTID,
            RUN_FINALIZED_IND,
            GPGB_TAX_BGN_YR)
      SELECT %DateOut(A.LEAVE_DT),
            %DateOut(A.HIRE_DT),
            %DateOut(A.GPGB_P45_EFFDT),
            A.CAL_RUN_ID,
            A.CAL_ID,
            A.ORIG_CAL_RUN_ID,
            A.RSLT_SEG_NUM,
            B.RSLT_VER_NUM,
            A.TAX_CODE_UK,
            A.NATIONAL_ID,
            A.TAX_BASIS_UK,
            A.GPGB_TAX_PERIOD,
            A.FREQUENCY_ID,
            A.DEPTID,
            C.RUN_FINALIZED_IND,
            A.GPGB_TAX_BGN_YR
      FROM PS_GPGB_EE_RSLT A,
            PS_GP_PYE_PRC_STAT B,
            PS_GP_CAL_RUN C
      WHERE A.EMPLID = %Bind(EMPLID)
        AND A.EMPL_RCD = %Bind(EMPL_RCD)
        AND A.GP_PAYGROUP = %Bind(GP_PAYGROUP)
        AND A.EMPLID = B.EMPLID
        AND A.CAL_RUN_ID = %Bind(SRC_CAL_RUN_ID)
        AND A.HIRE_DT <= %Bind(GPGB_JOB_EFFDT)
        AND A.CAL_RUN_ID = B.CAL_RUN_ID
        AND A.CAL_RUN_ID = C.CAL_RUN_ID
        AND C.CAL_RUN_ID = B.CAL_RUN_ID
        AND A.EMPL_RCD = B.EMPL_RCD
       AND  A.GP_PAYGROUP = B.GP_PAYGROUP
       AND  A.CAL_ID = B.CAL_ID
       AND  B.CALC_TYPE = 'P'
       AND  B.PRC_ORD_TS = (SELECT MAX(X.PRC_ORD_TS)
            FROM PS_GP_PYE_PRC_STAT X,
                  PS_GPGB_EE_RSLT Y
            WHERE X.EMPLID = A.EMPLID
              AND X.EMPL_RCD = A.EMPL_RCD
              AND X.GP_PAYGROUP = A.GP_PAYGROUP
              AND X.PAY_ENTITY = A.PAY_ENTITY
              AND X.CAL_RUN_ID = A.CAL_RUN_ID
              AND X.CALC_TYPE = B.CALC_TYPE
              AND Y.EMPLID = X.EMPLID
              AND Y.EMPL_RCD = X.EMPL_RCD
              AND Y.PAY_ENTITY = X.PAY_ENTITY
              AND Y.GP_PAYGROUP = X.GP_PAYGROUP
              AND Y.CAL_RUN_ID = X.CAL_RUN_ID
              AND Y.CAL_ID = X.CAL_ID
              AND Y.HIRE_DT = A.HIRE_DT)
      ORDER BY A.HIRE_DT DESC
      %SelectInit(NATIONAL_ID)
      SELECT NATIONAL_ID
      FROM %Table(PERS_NID) NID
      WHERE NID.EMPLID = %Bind(EMPLID)
        AND NID.COUNTRY = 'GBR'
        AND NID.NATIONAL_ID_TYPE = 'PR_9'
        AND EXISTS (SELECT NATIONAL_ID
            FROM %Table(PERS_NID) NIDS
            WHERE NIDS.EMPLID = %Bind(EMPLID)
              AND NIDS.COUNTRY = 'GBR'
              AND NIDS.NATIONAL_ID_TYPE = 'PR_9')




SQL: GPGB_P45    CkPyPrc Step03 S                  ApplEng
             ApplEng                       GPGB_P45
             Section                       CkPyPrc
             Step                          Step03
             Action                        SQL
             Market                        GBL

      SQL Statement

      %SelectInit(LEAVE_DT,
            HIRE_DT,
            GPGB_P45_EFFDT,
            CAL_RUN_ID,
            CAL_ID,
            ORIG_CAL_RUN_ID,
            RSLT_SEG_NUM,
            RSLT_VER_NUM,
            TAX_CODE_UK,
            TAX_BASIS_UK,
            GPGB_TAX_PERIOD,
            FREQUENCY_ID,
            DEPTID,
            RUN_FINALIZED_IND,
            GPGB_TAX_BGN_YR)
      SELECT %DateOut(A.LEAVE_DT),
            %DateOut(A.HIRE_DT),
            %DateOut(A.GPGB_P45_EFFDT),
            A.CAL_RUN_ID,
            A.CAL_ID,
            A.ORIG_CAL_RUN_ID,
            A.RSLT_SEG_NUM,
            B.RSLT_VER_NUM,
            A.TAX_CODE_UK,
            A.TAX_BASIS_UK,
            A.GPGB_TAX_PERIOD,
            A.FREQUENCY_ID,
              A.DEPTID,
              C.RUN_FINALIZED_IND,
              A.GPGB_TAX_BGN_YR
      FROM    PS_GPGB_EE_RSLT A,
              PS_GP_PYE_PRC_STAT B,
              PS_GP_CAL_RUN C
      WHERE   A.EMPLID = %Bind(EMPLID)
        AND   A.EMPL_RCD = %Bind(EMPL_RCD)
        AND   A.GP_PAYGROUP = %Bind(GP_PAYGROUP)
        AND   A.EMPLID = B.EMPLID
        AND   A.CAL_RUN_ID = %Bind(SRC_CAL_RUN_ID)
        AND   A.HIRE_DT <= %Bind(GPGB_JOB_EFFDT)
        AND   A.CAL_RUN_ID = B.CAL_RUN_ID
        AND   A.CAL_RUN_ID = C.CAL_RUN_ID
        AND   C.CAL_RUN_ID = B.CAL_RUN_ID
        AND   A.EMPL_RCD = B.EMPL_RCD
        AND   A.GP_PAYGROUP = B.GP_PAYGROUP
        AND   A.CAL_ID = B.CAL_ID
        AND   B.CALC_TYPE = 'P'
        AND   B.PRC_ORD_TS = (SELECT MAX(X.PRC_ORD_TS)
              FROM PS_GP_PYE_PRC_STAT X,
                    PS_GPGB_EE_RSLT Y
              WHERE X.EMPLID = A.EMPLID
                AND X.EMPL_RCD = A.EMPL_RCD
                AND X.GP_PAYGROUP = A.GP_PAYGROUP
                AND X.PAY_ENTITY = A.PAY_ENTITY
                AND X.CAL_RUN_ID = A.CAL_RUN_ID
                AND X.CALC_TYPE = B.CALC_TYPE
                AND Y.EMPLID = X.EMPLID
                AND Y.EMPL_RCD = X.EMPL_RCD
                AND Y.PAY_ENTITY = X.PAY_ENTITY
                AND Y.GP_PAYGROUP = X.GP_PAYGROUP
                AND Y.CAL_RUN_ID = X.CAL_RUN_ID
                AND Y.CAL_ID = X.CAL_ID
                AND Y.HIRE_DT = A.HIRE_DT)
      ORDER   BY A.HIRE_DT DESC




SQL: GPGB_P45      CkPyPrc Step04 S                  ApplEng
               ApplEng                       GPGB_P45
               Section                       CkPyPrc
               Step                          Step04
               Action                        SQL
               Market                        GBL

      SQL Statement

      %SelectInit(NATIONAL_ID)
      SELECT NATIONAL_ID
      FROM %Table(PERS_NID) NID
      WHERE NID.EMPLID = %Bind(EMPLID)
        AND NID.COUNTRY = 'GBR'
        AND NID.NATIONAL_ID_TYPE = 'PR_9'
        AND EXISTS (SELECT NATIONAL_ID
            FROM %Table(PERS_NID) NIDS
            WHERE NIDS.EMPLID = %Bind(EMPLID)
              AND NIDS.COUNTRY = 'GBR'
              AND NIDS.NATIONAL_ID_TYPE = 'PR_9')




SQL: GPGB_P45      GtPrvSegStep01 S                  ApplEng
               ApplEng                       GPGB_P45
               Section                       GtPrvSeg
               Step                          Step01
               Action                        SQL
               Market                        GBL
SQL Statement
%Select(LEAVE_DT,
      HIRE_DT,
      GPGB_P45_EFFDT,
      CAL_RUN_ID,
      CAL_ID,
      ORIG_CAL_RUN_ID,
      RSLT_SEG_NUM,
      RSLT_VER_NUM,
      TAX_CODE_UK,
      NATIONAL_ID,
      TAX_BASIS_UK,
      GPGB_TAX_PERIOD,
      FREQUENCY_ID,
      DEPTID)
SELECT %DateOut(A.LEAVE_DT),
      %DateOut(A.HIRE_DT),
      %DateOut(A.GPGB_P45_EFFDT),
      A.CAL_RUN_ID,
      A.CAL_ID,
      A.ORIG_CAL_RUN_ID,
      A.RSLT_SEG_NUM,
      B.RSLT_VER_NUM,
      A.TAX_CODE_UK,
      A.NATIONAL_ID,
      A.TAX_BASIS_UK,
      A.GPGB_TAX_PERIOD,
      A.FREQUENCY_ID,
      A.DEPTID
FROM PS_GPGB_EE_RSLT A,
      PS_GP_PYE_PRC_STAT B,
      PS_GP_PYE_SEG_STAT C
WHERE A.EMPLID = %Bind(EMPLID)
  AND A.EMPL_RCD = %Bind(EMPL_RCD)
  AND A.GP_PAYGROUP = %Bind(GP_PAYGROUP)
  AND A.EMPLID = B.EMPLID
  AND A.CAL_RUN_ID = B.CAL_RUN_ID
  AND A.EMPL_RCD = B.EMPL_RCD
  AND A.GP_PAYGROUP = B.GP_PAYGROUP
  AND A.CAL_ID = B.CAL_ID
  AND A.EMPLID = C.EMPLID
  AND A.CAL_RUN_ID = C.CAL_RUN_ID
  AND A.EMPL_RCD = C.EMPL_RCD
  AND A.GP_PAYGROUP = C.GP_PAYGROUP
  AND A.CAL_ID = C.CAL_ID
  AND A.RSLT_SEG_NUM = C.RSLT_SEG_NUM
  AND B.CALC_TYPE = 'P'
  AND B.PRC_ORD_TS = (SELECT MAX(X.PRC_ORD_TS)
      FROM PS_GP_PYE_PRC_STAT X,
            PS_GPGB_EE_RSLT Y,
            PS_GP_PYE_SEG_STAT Z
      WHERE X.EMPLID = A.EMPLID
        AND X.EMPL_RCD = A.EMPL_RCD
        AND X.GP_PAYGROUP = A.GP_PAYGROUP
        AND X.PAY_ENTITY = A.PAY_ENTITY
        AND X.CALC_TYPE = B.CALC_TYPE
        AND Y.EMPLID = X.EMPLID
        AND Y.EMPL_RCD = X.EMPL_RCD
        AND Y.PAY_ENTITY = X.PAY_ENTITY
        AND Y.GP_PAYGROUP = X.GP_PAYGROUP
        AND Y.CAL_RUN_ID = X.CAL_RUN_ID
        AND Y.CAL_ID = X.CAL_ID
        AND Y.EMPLID = Z.EMPLID
        AND Y.EMPL_RCD = Z.EMPL_RCD
        AND Y.GP_PAYGROUP = Z.GP_PAYGROUP
        AND Y.CAL_RUN_ID = Z.CAL_RUN_ID
        AND Y.CAL_ID = Z.CAL_ID
        AND Y.RSLT_SEG_NUM = Z.RSLT_SEG_NUM
        AND Y.HIRE_DT = A.HIRE_DT)
  AND C.SEG_END_DT = %Bind(GPGB_JOB_EFFDT)
SQL: GPGB_P45    GtPrvSegStep02 S                   ApplEng
             ApplEng                       GPGB_P45
             Section                       GtPrvSeg
             Step                          Step02
             Action                        SQL
             Market                        GBL

      SQL Statement

      %SelectInit(NATIONAL_ID)
      SELECT NATIONAL_ID
      FROM %Table(PERS_NID) NID
      WHERE NID.EMPLID = %Bind(EMPLID)
        AND NID.COUNTRY = 'GBR'
        AND NID.NATIONAL_ID_TYPE = 'PR_9'
        AND EXISTS (SELECT NATIONAL_ID
            FROM %Table(PERS_NID) NIDS
            WHERE NIDS.EMPLID = %Bind(EMPLID)
              AND NIDS.COUNTRY = 'GBR'
              AND NIDS.NATIONAL_ID_TYPE = 'PR_9')




SQL: GPGB_P45    GtRsltDtStep01 S                   ApplEng
             ApplEng                       GPGB_P45
             Section                       GtRsltDt
             Step                          Step01
             Action                        SQL
             Market                        GBL

      SQL Statement
      %SelectInit(ORIG_CAL_RUN_ID,
            RSLT_SEG_NUM,
            RSLT_VER_NUM,
            TAX_CODE_UK,
            NATIONAL_ID,
            TAX_BASIS_UK,
            GPGB_TAX_PERIOD,
            FREQUENCY_ID,
            GPGB_TAX_BGN_YR,
            DEPTID,
            HIRE_DT)
      SELECT A.ORIG_CAL_RUN_ID,
            A.RSLT_SEG_NUM,
            B.RSLT_VER_NUM,
            A.TAX_CODE_UK,
            A.NATIONAL_ID,
            A.TAX_BASIS_UK,
            A.GPGB_TAX_PERIOD,
            A.FREQUENCY_ID,
            A.GPGB_TAX_BGN_YR,
            A.DEPTID,
            %DateOut(A.HIRE_DT)
      FROM PS_GPGB_EE_RSLT A,
            PS_GP_PYE_PRC_STAT B
      WHERE A.EMPLID = %Bind(EMPLID)
        AND A.EMPL_RCD = %Bind(EMPL_RCD)
        AND A.GP_PAYGROUP = %Bind(GP_PAYGROUP)
        AND A.EMPLID = B.EMPLID
        AND A.CAL_RUN_ID = B.CAL_RUN_ID
        AND A.CAL_RUN_ID = %Bind(CAL_RUN_ID)
        AND A.CAL_ID = %Bind(CAL_ID)
        AND A.EMPL_RCD = B.EMPL_RCD
        AND A.GP_PAYGROUP = B.GP_PAYGROUP
        AND A.CAL_ID = B.CAL_ID
        AND A.RSLT_SEG_NUM = (SELECT MAX(AB.RSLT_SEG_NUM)
            FROM PS_GPGB_EE_RSLT AB
           WHERE AB.EMPLID = A.EMPLID
             AND AB.EMPL_RCD = A.EMPL_RCD
             AND AB.HIRE_DT = A.HIRE_DT
             AND AB.PAY_ENTITY = A.PAY_ENTITY
             AND AB.GPGB_TAX_BGN_YR = A.GPGB_TAX_BGN_YR
             AND AB.CAL_ID = A.CAL_ID
             AND AB.CAL_RUN_ID = A.CAL_RUN_ID)
       AND B.CALC_TYPE = 'P'




SQL: GPGB_P45    GtRsltDtStep02 S                   ApplEng
             ApplEng                       GPGB_P45
             Section                       GtRsltDt
             Step                          Step02
             Action                        SQL
             Market                        GBL

      SQL Statement

      %SelectInit(NATIONAL_ID)
      SELECT NATIONAL_ID
      FROM %Table(PERS_NID) NID
      WHERE NID.EMPLID = %Bind(EMPLID)
        AND NID.COUNTRY = 'GBR'
        AND NID.NATIONAL_ID_TYPE = 'PR_9'
        AND EXISTS (SELECT NATIONAL_ID
            FROM %Table(PERS_NID) NIDS
            WHERE NIDS.EMPLID = %Bind(EMPLID)
              AND NIDS.COUNTRY = 'GBR'
              AND NIDS.NATIONAL_ID_TYPE = 'PR_9')




SQL: GPGB_PSLIP_PU_H                                View

      SQL Statement
      SELECT A.EMPLID,
            A.CAL_RUN_ID,
            A.EMPL_RCD,
            A.GP_PAYGROUP,
            A.CAL_ID,
            A.RSLT_SEG_NUM,
            A.RSLT_VER_NUM,
            A.RSLT_REV_NUM,
            A.PYMT_KEY1,
            A.PYMT_KEY2,
            A.PYMT_KEY3,
            A.PYMT_KEY4,
            A.BUSINESS_UNIT,
            A.SEG_BGN_DT,
            A.SEG_END_DT,
            A.CALC_ACTION,
            A.PYE_CALC_STAT,
            A.GP_CALC_TS,
            A.SEG_STATUS,
            A.PIN_NET_NUM,
            A.PIN_NET_VAL,
            A.PIN_GROSS_NUM,
            A.PIN_GROSS_VAL,
            A.CUR_RT_TYPE,
            A.GP_ASOF_DT_EXG_RT,
            A.FRST_SEG_IND,
            A.LAST_SEG_IND,
            A.SEG_SRC_ID,
            B.SEL_ACTION,
            C.address1,
            C.address2,
            C.address3,
             C.address4,
             C.county,
             C.postal,
             C.deptid,
             C.location,
             C.jobcode,
             C.comprate,
             C.comp_frequency,
             C.tax_code_uk,
             C.national_id,
             C.gpgb_ni_category,
             C.tax_basis_uk,
             C.gpgb_tax_period,
             C.company,
             C.pay_entity,
             C.frequency_id,
             C.gpgb_tax_bgn_yr
     FROM    PS_GP_PYE_SEG_STAT A,
             PS_GP_PYE_PRC_STAT B,
             PS_GPGB_EE_RSLT C
             PS_GPGB_EE_RSLT C,
             PS_PERS_NID D
     WHERE   A.EMPLID = B.EMPLID
       AND   A.CAL_RUN_ID = B.CAL_RUN_ID
       AND   A.EMPL_RCD = B.EMPL_RCD
       AND   A.GP_PAYGROUP = B.GP_PAYGROUP
       AND   A.CAL_ID = B.CAL_ID
       AND   A.EMPLID = C.EMPLID
       AND   C.EMPLID = D.EMPLID
       AND   A.CAL_RUN_ID = C.CAL_RUN_ID
       AND   A.EMPL_RCD = C.EMPL_RCD
       AND   A.GP_PAYGROUP = C.GP_PAYGROUP
       AND   A.CAL_ID = C.CAL_ID
       AND   A.RSLT_SEG_NUM = C.RSLT_SEG_NUM
       AND   A.CALC_ACTION = 'C'
       AND   B.CALC_TYPE = 'P'
       AND   (D.NATIONAL_ID_TYPE = 'PR_9'
               OR D.NATIONAL_ID_TYPE = 'TEMP_9')




SQL: GPGB_SUPELM_SEL_RSLT                          Normal
            Description                    GPUK Supporting Element select
            Comments                       Common SQL for selecting a result value for a supprting
     element.
            Owner ID                       Global Payroll United Kingdom

     SQL Statement
     %SelectInit(CALC_RSLT_VAL)
     SELECT A.CALC_RSLT_VAL
     FROM PS_GP_RSLT_PIN A,
           PS_GP_PIN B,
           PS_GP_PYE_PRC_STAT C
     WHERE A.EMPLID = %Bind(EMPLID)
       AND A.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND A.EMPL_RCD = %Bind(EMPL_RCD)
       AND A.GP_PAYGROUP = %Bind(GP_PAYGROUP)
       AND A.CAL_ID = %Bind(CAL_ID)
       AND B.PIN_NUM = A.PIN_NUM
       AND C.EMPLID = %Bind(EMPLID)
       AND C.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND C.EMPL_RCD = %Bind(EMPL_RCD)
       AND C.CAL_ID = %Bind(CAL_ID)
       AND C.GP_PAYGROUP = %Bind(GP_PAYGROUP)
       AND C.CALC_TYPE = 'P'
       AND C.RSLT_VER_NUM = (SELECT MAX(X.RSLT_VER_NUM)
           FROM PS_GP_PYE_PRC_STAT X
           WHERE C.EMPLID = X.EMPLID
             AND C.EMPL_RCD = X.EMPL_RCD
             AND C.CAL_RUN_ID = X.CAL_RUN_ID
              AND C.CAL_ID = X.CAL_ID
              AND C.GP_PAYGROUP = X.GP_PAYGROUP
              AND C.CALC_TYPE = X.CALC_TYPE)
        AND C.RSLT_REV_NUM = (SELECT MAX(X.RSLT_REV_NUM)
            FROM PS_GP_PYE_PRC_STAT X
            WHERE C.EMPLID = X.EMPLID
              AND C.EMPL_RCD = X.EMPL_RCD
              AND C.CAL_RUN_ID = X.CAL_RUN_ID
              AND C.CAL_ID = X.CAL_ID
              AND C.GP_PAYGROUP = X.GP_PAYGROUP
              AND C.CALC_TYPE = X.CALC_TYPE)
        AND B.PIN_CODE = %P(1)




SQL: GPJP_LA03   ENRL_DTLStep05 S                   ApplEng
             ApplEng                       GPJP_LA03
             Section                       ENRL_DTL
             Step                          Step05
             Action                        SQL
             Market                        GBL

      SQL Statement
      INSERT INTO %Table(GPJP_LA_ENR_DTL)
            (JOBINSTANCE,
            EMPLID,
            EMPL_RCD,
            EFFDT,
            EFFSEQ,
            GPJP_LA_RPT_TYP,
            NAME_AC,
            GPJP_CHAR3,
            SEX,
            GPJP_DT_YYYYMMDD1,
            GPJP_LA_ESTAB_NO,
            GPJP_DT_YYYYMMDD3,
            GPJP_INSURED_DATE,
            GPJP_CHAR4_1,
            GPJP_LA_ENROLL_RSN,
            GPJP_CHAR9,
            GPJP_LA_MTH_WAGE,
            GPJP_CHAR4_2,
            GPJP_LA_EMPL_TYP,
            GPJP_CHAR4_3,
            GPJP_LA_JOB_TYP,
            GPJP_CHAR7,
            STD_HOURS,
            GPJP_CHAR22,
            GPJP_CHAR30,
            GPJP_CHAR15,
            GPJP_LA_TRM_CONTR,
            GPJP_START_DATE,
            GPJP_END_DATE,
            NAME)
      SELECT
            %JobInstance,
            A.EMPLID,
            A.EMPL_RCD,
            A.EFFDT,
            A.EFFSEQ,
            A.GPJP_LA_RPT_TYP,
            ' ',
            ' ',
            ' ',
            ' ',
            %TrimSubstr(B.GPJP_TAX_ESTAB, 1, 13),
            ' ',
            %Bind(GPJP_INSURED_DATE),
            ' ',
            A.GPJP_LA_ENROLL_RSN,
              A.GPJP_LA_WAGE_PMTH,
              A.GPJP_LA_MTH_WAGE,
              ' ',
              A. GPJP_LA_EMPL_TYP,
              ' ',
              A.GPJP_LA_JOB_TYP,
              ' ',
              C.STD_HOURS,
              ' ',
              ' ',
              A.GPJP_LA_TRM_CONTR,
              A.GPJP_START_DATE,
              A.GPJP_END_DATE,
              ' '
      FROM    %Table(GPJP_LA_PYE_RPT) A,
              %Table(GPJP_LA_PYE_DTA) B,
              %Table(JOB) C
      WHERE   A.EMPLID = B.EMPLID
        AND   A. EMPL_RCD = B.EMPL_RCD
        AND   A.EFFDT = %Bind(GPJP_INSURED_DATE)
        AND   A.GPJP_LA_RPT_TYP = '10'
        AND   (A.GPJP_LA_ENROLL_RSN = '1'
                OR A.GPJP_LA_ENROLL_RSN = '2')
        AND   A.EFFSEQ = (SELECT MAX(EFFSEQ)
              FROM %Table(GPJP_LA_PYE_RPT) D
              WHERE A.EMPLID = D.EMPLID
                AND A. EMPL_RCD = D.EMPL_RCD
                AND A.EFFDT = D.EFFDT)
        AND   A.GPJP_LA_EMPL_TYP = %Bind(GPJP_LA_EMPL_TYP)
        AND   A.GPJP_LA_TRM_CONTR = %Bind(GPJP_LA_TRM_CONTR)
        AND   A.GPJP_START_DATE = %Bind(GPJP_START_DATE)
        AND   A.GPJP_END_DATE = %Bind(GPJP_END_DATE)
        AND   B.GPJP_TAX_ESTAB = %Bind(GPJP_TAX_ESTAB)
        AND   B.EMPLID = A.EMPLID
        AND   B.EMPL_RCD = A.EMPL_RCD
        AND   B.EFFDT = (SELECT MAX(EFFDT)
              FROM %Table(GPJP_LA_PYE_DTA)
              WHERE EMPLID = A.EMPLID
                AND EMPL_RCD = A.EMPL_RCD
                AND EFFDT <= %Bind(GPJP_INSURED_DATE))
        AND   A.EMPLID = C.EMPLID
        AND   A.EMPL_RCD = C.EMPL_RCD
        AND   C.STD_HOURS = %Bind(STD_HOURS)
        AND   C.EFFDT = (SELECT MAX(EFFDT)
              FROM PS_JOB
              WHERE EMPLID = A.EMPLID
                AND EMPL_RCD = A.EMPL_RCD
                AND EFFDT <= A.EFFDT)
        AND   C.EFFSEQ = (SELECT MAX(EFFSEQ)
              FROM PS_JOB
              WHERE EMPLID = A.EMPLID
                AND EMPL_RCD = A.EMPL_RCD
                AND EFFDT = C.EFFDT)




SQL: GPJP_LA03     ENRL_DTLStep10 S                  ApplEng
               ApplEng                       GPJP_LA03
               Section                       ENRL_DTL
               Step                          Step10
               Action                        SQL
               Market                        GBL

      SQL Statement
      INSERT INTO %Table(GPJP_LA_ENR_DTL)
            (JOBINSTANCE,
            EMPLID,
            EMPL_RCD,
            EFFDT,
            EFFSEQ,
      GPJP_LA_RPT_TYP,
      NAME_AC,
      GPJP_CHAR3,
      SEX,
      GPJP_DT_YYYYMMDD1,
      GPJP_LA_ESTAB_NO,
      GPJP_DT_YYYYMMDD3,
      GPJP_INSURED_DATE,
      GPJP_CHAR4_1,
      GPJP_LA_ENROLL_RSN,
      GPJP_CHAR9,
      GPJP_LA_MTH_WAGE,
      GPJP_CHAR4_2,
      GPJP_LA_EMPL_TYP,
      GPJP_CHAR4_3,
      GPJP_LA_JOB_TYP,
      GPJP_CHAR7,
      STD_HOURS,
      GPJP_CHAR22,
      GPJP_CHAR30,
      GPJP_CHAR15,
      GPJP_LA_TRM_CONTR,
      GPJP_START_DATE,
      GPJP_END_DATE,
      NAME)
SELECT
      %JobInstance,
      A.EMPLID,
      A.EMPL_RCD,
      A.EFFDT,
      A.EFFSEQ,
      A.GPJP_LA_RPT_TYP,
      ' ',
      ' ',
      ' ',
      ' ',
      %TrimSubstr(B.GPJP_TAX_ESTAB, 1, 13),
      ' ',
      %Bind(GPJP_INSURED_DATE),
      ' ',
      A.GPJP_LA_ENROLL_RSN,
      A.GPJP_LA_WAGE_PMTH,
      A.GPJP_LA_MTH_WAGE,
      ' ',
      A.GPJP_LA_EMPL_TYP,
      ' ',
      A.GPJP_LA_JOB_TYP,
      ' ',
      C.STD_HOURS,
      ' ',
      B.GPJP_EI_NUM,
      A.GPJP_LA_TRM_CONTR,
      A.GPJP_START_DATE,
      A.GPJP_END_DATE,
      ' '
FROM %Table(GPJP_LA_PYE_RPT) A,
      %Table(GPJP_LA_PYE_DTA) B,
      %Table(JOB) C
WHERE A.EMPLID = B.EMPLID
  AND A.EMPL_RCD = B.EMPL_RCD
  AND A.EFFDT = %Bind(GPJP_INSURED_DATE)
  AND A.GPJP_LA_RPT_TYP = '10'
  AND (A.GPJP_LA_ENROLL_RSN = '1'
        OR A.GPJP_LA_ENROLL_RSN = '2')
  AND A.EFFSEQ = (SELECT MAX(EFFSEQ)
      FROM %Table(GPJP_LA_PYE_RPT) D
      WHERE A.EMPLID = D.EMPLID
        AND A.EMPL_RCD = D.EMPL_RCD
        AND A.EMPLID = D.EMPLID
        AND A.EFFDT = D.EFFDT)
  AND A.GPJP_LA_EMPL_TYP = %Bind(GPJP_LA_EMPL_TYP)
       AND A.GPJP_LA_TRM_CONTR = %Bind(GPJP_LA_TRM_CONTR)
       AND B.GPJP_TAX_ESTAB = %Bind(GPJP_TAX_ESTAB)
       AND B.EFFDT = (SELECT MAX(EFFDT)
           FROM %Table(GPJP_LA_PYE_DTA)
           WHERE EMPLID = A.EMPLID
             AND EMPL_RCD = A.EMPL_RCD
             AND EFFDT <= %Bind(GPJP_INSURED_DATE))
       AND A.EMPLID = C.EMPLID
       AND A.EMPL_RCD = C.EMPL_RCD
       AND C.STD_HOURS = %Bind(STD_HOURS)
       AND C.EFFDT = (SELECT MAX(EFFDT)
           FROM PS_JOB
           WHERE EMPLID = A.EMPLID
             AND EMPL_RCD = A.EMPL_RCD
             AND EFFDT <= A.EFFDT)
       AND C.EFFSEQ = (SELECT MAX(EFFSEQ)
           FROM PS_JOB
           WHERE EMPLID = A.EMPLID
             AND EMPL_RCD = A.EMPL_RCD
             AND EFFDT = C.EFFDT)




SQL: GPMX_PMT_AE POPULATEStep02 D                 ApplEng
            ApplEng                       GPMX_PMT_AE
            Section                       POPULATE
            Step                          Step02
            Action                        Do Select
            Market                        GBL

     SQL Statement
     %SelectInit(CAL_RUN_ID,
           EMPLID,
           INSTANCE,
           RECIPIENT_ID,
           SRC_BANK_ID)
           SRC_BANK_ID,
           CAL_ID,
           GP_PAYGROUP)
     SELECT B.CAL_RUN_ID,
           A.EMPLID,
           A.INSTANCE,
           A.RECIPIENT_ID,
           A.SRC_BANK_ID
           A.SRC_BANK_ID,
           A.CAL_ID,
           A.GP_PAYGROUP
     FROM PS_GPMX_PAYMENT A,
           PS_GPMX_RC_BANK B
     WHERE A.CAL_RUN_ID = B.CAL_RUN_ID
       AND B.OPRID = %Bind(OPRID)
       AND B.RUN_CNTL_ID = %Bind(RUN_CNTL_ID)
       AND A.PMT_STATUS = 'P'




SQL: GPMX_PMT_AE UPDATE Step01 S                  ApplEng
            ApplEng                       GPMX_PMT_AE
            Section                       UPDATE
            Step                          Step01
            Action                        SQL
            Market                        GBL

     SQL Statement
     %Select(NAME,
           BANK_CD,
           BRANCH_EC_CD,
           ACCOUNT_EC_ID,
           ACCOUNT_TYPE_PYE)
     SELECT C.ACCOUNT_NAME,
           C.BANK_CD,
           C.BRANCH_EC_CD,
           C.ACCOUNT_EC_ID,
           C.ACCOUNT_TYPE_PYE
     FROM PS_GP_NET_DIST_DTL B,
           PS_PYE_BANKACCT C
           PS_PYE_BANKACCT C,
           PS_GP_CALENDAR E
     WHERE B.EMPLID = %Bind(EMPLID)
       AND B.EMPLID = C.EMPLID
       AND B.INSTANCE = %Bind(INSTANCE)
       AND B.EFFDT = (SELECT MAX(D.EFFDT)
           FROM PS_GP_NET_DIST_DTL D
           WHERE B.EMPLID = D.EMPLID
             AND D.EFFDT <= %CurrentDateIn)
             AND D.EFFDT <= E.PYMT_DT)
       AND B.ACCOUNT_ID = C.ACCOUNT_ID
       AND C.EFF_STATUS = 'A'
       AND E.GP_PAYGROUP = %Bind(GP_PAYGROUP)
       AND E.CAL_ID = %Bind(CAL_ID)
       AND E.RUN_TYPE = B.RUN_TYPE




SQL: GPMX_PMT_AE UPDATE Step02 S                    ApplEng
            ApplEng                          GPMX_PMT_AE
            Section                          UPDATE
            Step                             Step02
            Action                           SQL
            Market                           GBL

     SQL Statement
     %Select(ACCOUNT_EC_ID,
     %Select(NAME,
           BANK_CD,
           BRANCH_EC_CD,
           BANK_CD)
     SELECT B.ACCOUNT_EC_ID,
           ACCOUNT_EC_ID)
     SELECT B.ACCOUNT_NAME,
           B.BANK_CD,
           B.BRANCH_EC_CD,
           B.BANK_CD
           B.ACCOUNT_EC_ID
     FROM PS_RECIPIENT B
     WHERE B.RECIPIENT_ID = %Bind(RECIPIENT_ID)




SQL: GPMX_PMT_AE UPDATE Step03 S                    ApplEng
            ApplEng                          GPMX_PMT_AE
            Section                          UPDATE
            Step                             Step03
            Action                           SQL
            Market                           GBL

     SQL Statement

     [ . . . Description Unchanged . . . ]




SQL: GPMX_PMT_AE UPDATE Step05 S                    ApplEng
            ApplEng                          GPMX_PMT_AE
            Section                          UPDATE
            Step                             Step05
            Action                          SQL
            Market                          GBL

     SQL Statement
     UPDATE PS_GPMX_PAYMENT SET
           NAME = (SELECT B.NAME
           FROM PS_PERSON_NAME B
           WHERE PS_GPMX_PAYMENT.EMPLID = B.EMPLID)
     WHERE CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND PMT_STATUS = 'P'
       AND NAME = ' '
       AND EXISTS (SELECT 'X'
           FROM PS_PERSON_NAME B
           WHERE PS_GPMX_PAYMENT.EMPLID = B.EMPLID)
     %Select(NAME)
     SELECT B.NAME
     FROM PS_GPMX_PAYMENT A,
           PS_PERSON_NAME B
     WHERE A.EMPLID = %Bind(EMPLID)
       AND A.EMPLID = B.EMPLID
       AND A.CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND A.PMT_STATUS = 'P'
       AND %Bind(NAME) = ' '
       AND RECIPIENT_ID = %Bind(RECIPIENT_ID)




SQL: GPMX_PMT_AE UPDATE Step07 S                    ApplEng
            ApplEng                         GPMX_PMT_AE
            Section                         UPDATE
            Step                            Step07
            Action                          SQL
            Market                          GBL

     SQL Statement
     UPDATE PS_GPMX_PAYMENT SET
           BANK_CD = %Bind(BANK_CD),
           BRANCH_EC_CD = %Bind(BRANCH_EC_CD),
           ACCOUNT_EC_ID = %Bind(ACCOUNT_EC_ID),
           ACCOUNT_TYPE_PYE = %Bind(ACCOUNT_TYPE_PYE),
           GPMX_BANK_CD = %Bind(GPMX_BANK_CD),
           GPMX_BRANCH_EC_CD = %Bind(GPMX_BRANCH_EC_CD),
           GPMX_ACCOUNT_EC_ID = %Bind(GPMX_ACCOUNT_EC_ID),
           BANK_TRANSFER_ID = %Bind(BANK_TRANSFER_ID),
           NAME = %Bind(NAME),
           GPMX_BANK_NAME = %Bind(GPMX_BANK_NAME)
     WHERE CAL_RUN_ID = %Bind(CAL_RUN_ID)
       AND EMPLID = %Bind(EMPLID)
       AND RECIPIENT_ID = %Bind(RECIPIENT_ID)
       AND PMT_STATUS = 'P'




SQL: GPUS_MMREFST_VW                                View

     SQL Statement
     SELECT A.STATE,
           A.NUMERIC_CD,
           A.DESCR
     FROM PS_STATE_NAMES_TBL A
     WHERE A.COUNTRY = 'USA'
       AND A.STATE IN ('AL', 'AR', 'AZ', 'CO', 'CT', 'DC',   'DE', 'GA', 'ID', 'IL', 'IN', 'KS', 'KY',
     'LA', 'MA', 'MD', 'ME', 'MI', 'MN', 'MO', 'MS', 'MT',   'NE', 'NC', 'ND', 'NJ', 'NM', 'OH', 'PA',
     'RI', 'SC', 'UT', 'VA', 'WI', 'WV')
       AND A.STATE IN ('AL', 'AR', 'AZ', 'CO', 'CT', 'DC',   'DE', 'GA', 'ID', 'IL', 'IN', 'KS', 'KY',
     'LA', 'MA', 'MD', 'ME', 'MI', 'MN', 'MO', 'MS', 'MT',   'NE', 'NC', 'ND', 'NJ', 'NM', 'OH', 'OR',
     'PA', 'RI', 'SC', 'UT', 'VA', 'VT', 'WI', 'WV')
SQL: GPUS_PPD_EFTGET-DTL Step03 S                  ApplEng
             ApplEng                       GPUS_PPD_EFT
             Section                       GET-DTL
             Step                          Step03
             Action                        SQL
             Market                        GBL

      SQL Statement
      UPDATE %Table(GPUS_EFT_DTL) SET
            COMPANY_DESCR = (SELECT A.DESCR
            COMPANY = (SELECT A.COMPANY
            FROM PS_COMPANY_TBL A,
                  PS_GP_PYE_SEG_STAT B
            WHERE PS_GPUS_EFT_DTL.PROCESS_INSTANCE = %ProcessInstance
              AND A.COMPANY = B.PYMT_KEY1
              AND A.EFF_STATUS = 'A'
              AND A.EFFDT = (SELECT MAX(C.EFFDT)
                  FROM PS_COMPANY_TBL C
                  WHERE A.COMPANY = C.COMPANY
                    AND C.EFFDT <= PS_GPUS_EFT_DTL.CHECK_DT)
              AND A.DESCR IS NOT NULL
              AND PS_GPUS_EFT_DTL.EMPLID = B.EMPLID
              AND PS_GPUS_EFT_DTL.CAL_RUN_ID = B.CAL_RUN_ID
              AND PS_GPUS_EFT_DTL.CAL_ID = B.CAL_ID
              AND PS_GPUS_EFT_DTL.EMPL_RCD = B.EMPL_RCD
              AND PS_GPUS_EFT_DTL.GP_PAYGROUP = B.GP_PAYGROUP
              AND PS_GPUS_EFT_DTL.ORIG_CAL_RUN_ID = B.ORIG_CAL_RUN_ID
              AND PS_GPUS_EFT_DTL.RSLT_SEG_NUM = B.RSLT_SEG_NUM)




SQL: GPUS_PPD_EFTGET-DTL Step09 S                  ApplEng
             ApplEng                       GPUS_PPD_EFT
             Section                       GET-DTL
             Step                          Step09
             Action                        SQL
             Market                        GBL

      SQL Statement

      UPDATE %Table(GPUS_EFT_DTL) SET
            GPUS_PYEACCT_IAT = (SELECT 'Y'
            FROM PS_PYE_BANKACCT A,
                  PS_GP_NET_DIST_DTL B,
                  PS_GP_CALENDAR C
            WHERE PS_GPUS_EFT_DTL.PROCESS_INSTANCE = %ProcessInstance
              AND A.EMPLID = B.EMPLID
              AND A.ACCOUNT_ID = B.ACCOUNT_ID
              AND PS_GPUS_EFT_DTL.EMPLID = B.EMPLID
              AND PS_GPUS_EFT_DTL.EMPL_RCD = B.EMPL_RCD
              AND PS_GPUS_EFT_DTL.INSTANCE = B.INSTANCE
              AND PS_GPUS_EFT_DTL.GP_PAYGROUP = C.GP_PAYGROUP
              AND PS_GPUS_EFT_DTL.CAL_ID = C.CAL_ID
              AND A.BANK_CD IS NOT NULL
              AND A.COUNTRY_CD = 'USA'
              AND A.IAT_IND = 'Y'
              AND B.PAYMENT_MTHD = 'T'
              AND B.RUN_TYPE = C.RUN_TYPE
              AND B.EFFDT = (SELECT MAX(M.EFFDT)
                  FROM PS_GP_NET_DIST_DTL M
                  WHERE B.EMPLID = M.EMPLID
                    AND B.EMPL_RCD = M.EMPL_RCD
                    AND B.RUN_TYPE = M.RUN_TYPE
                    AND B.INSTANCE = M.INSTANCE
                    AND M.EFFDT <= PS_GPUS_EFT_DTL.CHECK_DT))
      WHERE EXISTS (SELECT 'X'
            FROM PS_PYE_BANKACCT A,
                   PS_GP_NET_DIST_DTL B,
                   PS_GP_CALENDAR C
           WHERE   PS_GPUS_EFT_DTL.PROCESS_INSTANCE = %ProcessInstance
             AND   A.EMPLID = B.EMPLID
             AND   A.ACCOUNT_ID = B.ACCOUNT_ID
             AND   PS_GPUS_EFT_DTL.EMPLID = B.EMPLID
             AND   PS_GPUS_EFT_DTL.EMPL_RCD = B.EMPL_RCD
             AND   PS_GPUS_EFT_DTL.INSTANCE = B.INSTANCE
             AND   PS_GPUS_EFT_DTL.GP_PAYGROUP = C.GP_PAYGROUP
             AND   PS_GPUS_EFT_DTL.CAL_ID = C.CAL_ID
             AND   A.BANK_CD IS NOT NULL
             AND   A.COUNTRY_CD = 'USA'
             AND   A.IAT_IND = 'Y'
             AND   B.PAYMENT_MTHD = 'T'
             AND   B.RUN_TYPE = C.RUN_TYPE
             AND   B.EFFDT = (SELECT MAX(M.EFFDT)
                   FROM PS_GP_NET_DIST_DTL M
                   WHERE B.EMPLID = M.EMPLID
                     AND B.EMPL_RCD = M.EMPL_RCD
                     AND B.RUN_TYPE = M.RUN_TYPE
                     AND B.INSTANCE = M.INSTANCE
                     AND M.EFFDT <= PS_GPUS_EFT_DTL.CHECK_DT))




SQL: GP_PSLP_PRI_VW2                                View

      SQL Statement

      [ . . . Description Unchanged . . . ]




SQL: GP_SS_PSLP_1_VW                                View

      SQL Statement
      SELECT %subrec(GP_SS_PSLP_SBR, A),
            COUNTRY B
      FROM PS_GP_SS_PSLP_GDE A,
            PS_GP_SS_PSLP_OPT B
      WHERE (A.GP_SS_PSLP_STATUS <> 'VHID'
              AND A.GP_SS_PSLP_STATUS <> 'VDEL')
        AND %DateDiff(A.PYMT_DT, %CurrentDateIn) >= B.GP_PSLP_BGNSSDFLT
        AND NOT EXISTS (SELECT 'X'
            FROM PS_GP_SS_PSLP_OPT1 B2
            WHERE B2.COUNTRY = B.COUNTRY
              AND B2.RUN_TYPE = A.RUN_TYPE)
        AND (B.COUNTRY = (SELECT DISTINCT J.REG_REGION
        AND (B.COUNTRY IN (SELECT DISTINCT J.REG_REGION
                  FROM PS_GP_PYGRP P,
                        PS_JOB J,
                        PS_GP_CAL_RUN_DTL D
                  WHERE D.CAL_RUN_ID = A.CAL_RUN_ID
                    AND J.EMPLID = A.EMPLID
                    AND P.GP_PAYGROUP = J.GP_PAYGROUP
                    AND P.PAY_ENTITY = D.PAY_ENTITY
                    AND P.GP_PAYGROUP = D.GP_PAYGROUP)
              OR B.COUNTRY = (SELECT DISTINCT J1.REG_REGION
                    AND P.GP_PAYGROUP = D.GP_PAYGROUP
                    AND J.REG_REGION = D.COUNTRY)
              OR B.COUNTRY IN (SELECT DISTINCT J1.REG_REGION
                  FROM PS_GP_PYGRP P1,
                        PS_JOB J1,
                        PS_GP_CAL_RUN_OFF D1
                        PS_GP_CAL_RUN_OFF D1,
                        PS_GP_PYENT E1
                  WHERE D1.CAL_RUN_ID = A.CAL_RUN_ID
                    AND J1.EMPLID = A.EMPLID
                    AND   P1.GP_PAYGROUP = J1.GP_PAYGROUP
                    AND   P1.GP_PAYGROUP = D1.GP_PAYGROUP))
                    AND   P1.GP_PAYGROUP = D1.GP_PAYGROUP
                    AND   P1.PAY_ENTITY = E1.PAY_ENTITY
                    AND   E1.COUNTRY = J1.REG_REGION))




SQL: GP_SS_PSLP_2_VW                                 View

      SQL Statement
      SELECT %subrec(GP_SS_PSLP_SBR, A),
            COUNTRY B
      FROM PS_GP_SS_PSLP_GDE A,
            PS_GP_SS_PSLP_OPT1 B
      WHERE (A.GP_SS_PSLP_STATUS <> 'VHID'
              AND A.GP_SS_PSLP_STATUS <> 'VDEL')
        AND %DateDiff(A.PYMT_DT, %CurrentDateIn) >= B.GP_PSLP_BGNSSOVRD
        AND A.RUN_TYPE = B.RUN_TYPE
        AND (B.COUNTRY = (SELECT DISTINCT J.REG_REGION
        AND (B.COUNTRY IN (SELECT DISTINCT J.REG_REGION
                  FROM PS_GP_PYGRP P,
                        PS_JOB J,
                        PS_GP_CAL_RUN_DTL D
                  WHERE D.CAL_RUN_ID = A.CAL_RUN_ID
                    AND J.EMPLID = A.EMPLID
                    AND P.GP_PAYGROUP = J.GP_PAYGROUP
                    AND P.PAY_ENTITY = D.PAY_ENTITY
                    AND P.GP_PAYGROUP = D.GP_PAYGROUP)
              OR B.COUNTRY = (SELECT DISTINCT J1.REG_REGION
              OR B.COUNTRY IN (SELECT DISTINCT J1.REG_REGION
                  FROM PS_GP_PYGRP P1,
                        PS_JOB J1,
                        PS_GP_CAL_RUN_OFF D1
                  WHERE D1.CAL_RUN_ID = A.CAL_RUN_ID
                    AND J1.EMPLID = A.EMPLID
                    AND P1.GP_PAYGROUP = J1.GP_PAYGROUP
                    AND P1.GP_PAYGROUP = D1.GP_PAYGROUP))




                         PeopleCode Detail
PeopleCode (Record): DERIVED_GP.SELECT_PB.FieldFormula
      [ . . . Unchanged Code not Shown . . . ]

      Function Select_Manual_PI();

         ScrollFlush(Record.GP_PI_MNL_DATA);
         &where_clause = "where GP_PAYGROUP = " | Quote(GP_PI_CAL_VW.GP_PAYGROUP.Value) | " AND
      CAL_ID = " | Quote(GP_PI_CAL_VW.CAL_ID.Value) | " AND EXISTS (SELECT 1 FROM PS_EMPLMT_SRCH_GBL
      ES WHERE ES.EMPLID=PS_GP_PI_MNL_DATA.EMPLID AND ES.EMPL_RCD=PS_GP_PI_MNL_DATA.EMPL_RCD AND
      OPRID=" | Quote(%OperatorId) | " AND ES.ROWSECCLASS = " |
      Quote(%OperatorRowLevelSecurityClass) | ")";

         &quote = "'";
         &WHEREJOB = "";

         &where_clause   = "where GP_PAYGROUP = " | &quote | GP_PI_CAL_VW.GP_PAYGROUP | &quote;
         &where_clause   = &where_clause | " AND CAL_ID = " | &quote | GP_PI_CAL_VW.CAL_ID | &quote;
         &where_clause   = &where_clause | " AND EXISTS (SELECT " | &quote | "X" | &quote | " from
      PS_JOB WHERE ";
         &where_clause   = &where_clause | " EMPLID = PS_GP_PI_MNL_DATA.EMPLID";
         &where_clause   = &where_clause | " AND EMPL_RCD = PS_GP_PI_MNL_DATA.EMPL_RCD)";
         &where_clause =   &where_clause   | " AND EXISTS (SELECT " | &quote | "X" | &quote | " from
      PS_EMPLMT_SRCH_QRY   WHERE ";
         &where_clause =   &where_clause   | " OPRID = '" | %OperatorId | "'";
         &where_clause =   &where_clause   | " AND EMPLID = PS_GP_PI_MNL_DATA.EMPLID";
         &where_clause =   &where_clause   | " AND EMPL_RCD = PS_GP_PI_MNL_DATA.EMPL_RCD)";


         If All(DERIVED_GP.GP_BATCH_CD.Value) Then
            &where_clause = &where_clause | " AND GP_BATCH_CD = " | &quote |
      DERIVED_GP.GP_BATCH_CD.Value | &quote;
            &where_clause = &where_clause | " AND GP_BATCH_CD = " |
      Quote(DERIVED_GP.GP_BATCH_CD.Value);
         End-If;

         If All(GP_PI_MNL_D.COMPANY) Then
            &WHEREJOB = " COMPANY = '" | GP_PI_MNL_D.COMPANY | "'";
            &WHEREJOB = " COMPANY = " | Quote(GP_PI_MNL_D.COMPANY.Value);
         End-If;
         If All(GP_PI_MNL_D.DEPTID) Then
            If All(&WHEREJOB) Then
               &WHEREJOB = &WHEREJOB | " AND DEPTID = '" | GP_PI_MNL_D.DEPTID | "'";
            Else
               &WHEREJOB = " DEPTID = '" | GP_PI_MNL_D.DEPTID | "'";
            End-If;
         End-If;
         If All(GP_PI_MNL_D.LOCATION.Value) Then
            If All(&WHEREJOB) Then
               &WHEREJOB = &WHEREJOB | " AND LOCATION = '" | GP_PI_MNL_D.LOCATION | "'";
            Else
               &WHEREJOB = " LOCATION = '" | GP_PI_MNL_D.LOCATION | "'";
            End-If;
         End-If;
         If All(GP_PI_MNL_D.ESTABID) Then
            If All(&WHEREJOB) Then
               &WHEREJOB = &WHEREJOB | " AND ESTABID = '" | GP_PI_MNL_D.ESTABID | "'";
            Else
               &WHEREJOB = " ESTABID = '" | GP_PI_MNL_D.ESTABID | "'";
            End-If;
         End-If;

         If All(&WHEREJOB) Then
            &WHEREJOB = " AND EXISTS (SELECT J.EMPLID FROM PS_JOB J WHERE " | &WHEREJOB;
            &WHEREJOB = &WHEREJOB | " AND J.EMPLID = PS_GP_PI_MNL_DATA.EMPLID AND J.EMPL_RCD =
      PS_GP_PI_MNL_DATA.EMPL_RCD)";
         End-If;

         ScrollFlush(Record.GP_PI_MNL_DATA);
         ScrollSelect(1, Record.GP_PI_MNL_DATA, Record.GP_PI_MNL_DATA, &where_clause | &WHEREJOB);
      End-Function;




PeopleCode (Record): DERIVED_GPES.GPES_ADLN_CALC_PB.FieldChange
      [ . . . Unchanged Code not Shown . . . ]


      /*---------------------------------------------------------------------------------------
      --------------*/
      /*---------------------------------------------------------------------------------------
      --------------*/
      InitLoanSched();

      &NumXtrPds = ExtraPeriods(0);
      If GPES_ADV_LOAN.GPES_TAKE_XTRPD = "Y" Then
         &AnnualPayments = 12 + &NumXtrPds;
      Else
         &AnnualPayments = 12;
End-If;

If GPES_ADV_LOAN.GPES_INTEREST = 0 Then
   &IntRt = 0.0000001
Else
   &IntRt = GPES_ADV_LOAN.GPES_INTEREST / 100;
End-If;

/* L o a n   p r o c e s s i n g */
/*-------------------------------*/
If GPES_ADV_LOAN.GPES_CALC_TYPE = "1" Then
   /* Flat Amount Calc Type: Having the monthly payment amount, needs the number of periods
to pay the loan */

/*---------------------------------------------------------------------------------------
----------------*/
   &Interest2 = &IntRt / &AnnualPayments;
   &ElapsedPeriod = Round( - Log10(1 - GPES_ADV_LOAN.GPES_ADLN_AMT * (&Interest2 /
GPES_ADV_LOAN.GPES_DED_AMT)) / Log10(1 + &Interest2), 0);
   &DecRest = &ElapsedPeriod - Int(&ElapsedPeriod);
   &LastAmt = RoundCurrency(GPES_ADV_LOAN.GPES_DED_AMT * &DecRest,
GPES_ADV_LOAN.CURRENCY_CD, %Date);
   &MonthlyPayment = GPES_ADV_LOAN.GPES_DED_AMT;
Else
   /* End Date Calc Type: Having the number of periods to pay the loan, needs the monthly payment
amount */

/*---------------------------------------------------------------------------------------
-------------*/
   If GPES_ADV_LOAN.GPES_CALC_TYPE = "4" Then
      /* &ElapsedPeriod = GPES_ADV_LOAN.GPES_DED_END_DT - GPES_ADV_LOAN.GPES_DED_BEG_DT; */
      If Year(GPES_ADV_LOAN.GPES_DED_BEG_DT) <> Year(GPES_ADV_LOAN.GPES_DED_END_DT) Then
         &ElapsedPeriod = ((12 - Month(GPES_ADV_LOAN.GPES_DED_BEG_DT)) + 1) + (12 *
((Year(GPES_ADV_LOAN.GPES_DED_END_DT) - Year(GPES_ADV_LOAN.GPES_DED_BEG_DT)) - 1)) +
Month(GPES_ADV_LOAN.GPES_DED_END_DT);
      Else
         &ElapsedPeriod = (Month(GPES_ADV_LOAN.GPES_DED_END_DT) -
Month(GPES_ADV_LOAN.GPES_DED_BEG_DT)) + 1;
      End-If;
   Else
      &ElapsedPeriod = GPES_ADV_LOAN.GPES_ELPSED_PD;
   End-If;

   /*------------------------------------------------------------------------------*/
   /* Looks for all the extra periods in the elpapsed period                       */
   /*------------------------------------------------------------------------------*/
   &XtrPdCount = 0;
   If GPES_ADV_LOAN.GPES_TAKE_XTRPD = "Y" Then
      &FromDt = GPES_ADV_LOAN.GPES_DED_BEG_DT;
      For &Count = 1 To &ElapsedPeriod
         &FoundXtrPd = ExtraPeriods(Month(&FromDt));
         If &FoundXtrPd <> 0 Then
            &XtrPdCount = &XtrPdCount + 1;
         End-If;
         &FromDt = AddToDate(&FromDt, 0, 1, 0);
      End-For;
   End-If;

   &MonthlyPayment = CalcPdPymntAmt(&IntRt, GPES_ADV_LOAN.GPES_ADLN_AMT, &ElapsedPeriod +
&XtrPdCount);
End-If;


If GPES_ADV_LOAN.GPES_CALC_TYPE = "1" Then;

   &Num1 = Int(GPES_ADV_LOAN.GPES_ADLN_AMT / GPES_ADV_LOAN.GPES_DED_AMT);
   &Num2 = &Num1 * GPES_ADV_LOAN.GPES_DED_AMT;
   &Num3 = (GPES_ADV_LOAN.GPES_ADLN_AMT - &Num2);
   If Mod(GPES_ADV_LOAN.GPES_ADLN_AMT, GPES_ADV_LOAN.GPES_DED_AMT) <> 0 Then
      If &Num3 >= (GPES_ADV_LOAN.GPES_DED_AMT) / 2 Then
         If GPES_ADV_LOAN.GPES_LAST_REPAY_CB.Value = "Y" Then;
                  &ElapsedPeriod = &ElapsedPeriod - 1;
               End-If;
            Else
               If GPES_ADV_LOAN.GPES_LAST_REPAY_CB.Value = "N" Then;
                  &ElapsedPeriod = &ElapsedPeriod + 1;
               End-If;
            End-If;
         End-If;
      End-If;
      CreateSchedule(&MonthlyPayment, &ElapsedPeriod + &XtrPdCount);




PeopleCode (Record): DERIVED_GPFR_AF.VIEW_SQL.FieldChange
      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Record): FUNCLIB_GPES.EMPLID.FieldFormula
      [ . . . Unchanged Code not Shown . . . ]

      Function LoadEconomicalData(&Emplid As string, &EmplRCD As number, &EffDt As date, &Flag As
      string, &ContributionDaysTOT As integer, &CommonContingenciesTOT As number,
      &ContributionOvertimeTOT As number) Returns number;

         Local string &DateOptn, &PinCode;
         Local string &DateOptn, &Act_ContractType, &Unltd_Discntd;
         Local number &PreviousMonth, &Year, &Act_ContractNum, &ContractNum, &CommonContingencies,
      &ContributionDays, &OvertimeDays, &OvertimeDaysTOT, &ContributionOvertime;
         Local date &FirstDay, &FirstDay_PreviousYear, &FirstDay_PreviousMonth, &FirstDay_Month,
      &LastDay_PreviousMonth, &FirstDay_ThreeMonth, &EffDtWk;
         Local SQL &Sql;

         &PinCode = "CLI VR MET CLC BRD ESP";
         SQLExec("SELECT CHARACTER_VALUE FROM PS_GP_PIN A, PS_GP_VARIABLE B WHERE PIN_CODE = :1 AND
      A.PIN_NUM = B.PIN_NUM AND B.EFFDT = (SELECT MAX(EFFDT) FROM PS_GP_VARIABLE WHERE PIN_NUM =
      B.PIN_NUM AND EFFDT <= %DateIn(:2))", &PinCode, &LastDay_PreviousMonth, &DateOptn);
         &FirstDay_Month = Date3(Year(&EffDt), Month(&EffDt), 1);
         &LastDay_PreviousMonth = AddToDate(&FirstDay_Month, 0, 0, - 1);
         SQLExec("SELECT CHARACTER_VALUE FROM PS_GP_PIN A, PS_GP_VARIABLE B WHERE PIN_CODE = 'CLI
      VR MET CLC BRD ESP' AND A.PIN_NUM = B.PIN_NUM AND B.EFFDT = (SELECT MAX(EFFDT) FROM
      PS_GP_VARIABLE WHERE PIN_NUM = B.PIN_NUM AND EFFDT <= %DateIn(:2))", &PinCode,
      &LastDay_PreviousMonth, &DateOptn);

         &FirstDay_PreviousMonth = AddToDate(&EffDt, 0, - 1, 0);
         &PreviousMonth = Month(&FirstDay_PreviousMonth);
         &Year = Year(&FirstDay_PreviousMonth);
         &FirstDay_Month = Date3(Year(&EffDt), Month(&EffDt), 1);
         &LastDay_PreviousMonth = AddToDate(&FirstDay_Month, 0, 0, - 1);
         &FirstDay_PreviousMonth = Date3(&Year, &PreviousMonth, 1);
         &FirstDay_PreviousYear = AddToDate(&FirstDay_Month, - 1, 0, 0);
         &FirstDay_ThreeMonth = AddToDate(&FirstDay_PreviousMonth, 0, - 2, 0);


         SQLExec("SELECT CONTRACT_NUM FROM PS_JOB JOB WHERE JOB.EMPLID = :1 AND JOB.EMPL_RCD = :2
      AND JOB.EFFDT = (SELECT MAX(J_EFFDT.EFFDT) FROM PS_JOB J_EFFDT WHERE J_EFFDT.EMPLID =
      JOB.EMPLID AND J_EFFDT.EMPL_RCD = JOB.EMPL_RCD AND J_EFFDT.EFFDT <= %DateIn(:3))AND JOB.EFFSEQ
      = (SELECT MAX(J_EFFSEQ.EFFSEQ) FROM PS_JOB J_EFFSEQ WHERE J_EFFSEQ.EMPLID = JOB.EMPLID AND
      J_EFFSEQ.EMPL_RCD = JOB.EMPL_RCD AND J_EFFSEQ.EFFDT = JOB.EFFDT)", &Emplid, &EmplRCD,
      &LastDay_PreviousMonth, &Act_ContractNum);

         /* Detemines wether the employee is Undefined-Discontinued or not */
         SQLExec("SELECT CONTRACT_TYPE FROM PS_WKF_CNT_TYPE A WHERE A.EMPLID = :1 AND A.CONTRACT_NUM
      = :2 AND A.EFFDT = (SELECT MAX(EFFDT) FROM PS_WKF_CNT_TYPE WHERE EMPLID = A.EMPLID AND
      CONTRACT_NUM = A.CONTRACT_NUM AND EFFDT <= %DateIn(:3))", &Emplid, &Act_ContractNum,
      &LastDay_PreviousMonth, &Act_ContractType);
   SQLExec("SELECT 'X' FROM PS_GP_BRACKET_DTL A, PS_GP_PIN B WHERE B.PIN_CODE = 'SS BR TRATA
PRCIAL ESP' AND A.PIN_NUM = B.PIN_NUM AND A.EFFDT = (SELECT MAX(EFFDT) FROM PS_GP_BRACKET WHERE
PIN_NUM = A.PIN_NUM AND EFFDT <= %DateIn(:1)) AND A.DATA_KEY1 = :2 AND DATA_VAL2 = 'Y'",
&LastDay_PreviousMonth, &Act_ContractType, &Unltd_Discntd);
   /* Detemines wether the employee is Undefined-Discontinued or not */

   /*-----------*/
   /* Full Time */
   /*-----------*/
   /* Contribution Days + Common Contingency Base */
   If &Flag = "F" Then
   If &Flag = "F" And
         None(&Unltd_Discntd) Then
      &Sql = CreateSQL("SELECT %DateOut(CNTRB.EFFDT), RSLT.CHR_PIN_VAL,
CNTRB.CONTRIB_BASE_ESP, CNTRB.CONTRIB_DAYS_ESP FROM PS_GPES_CNTRB_RSLT CNTRB, PS_GP_RSLT_PIN
RSLT, PS_GP_PIN PIN WHERE CNTRB.EMPLID = :1 AND CNTRB.EFFDT BETWEEN %DateIn(:2) AND %DateIn(:3)
AND %SQL(GPES_MAX_VER_REV_NUM, PS_GPES_CNTRB_RSLT, CNTRB) AND CNTRB.EMPLID = RSLT.EMPLID AND
CNTRB.CAL_RUN_ID = RSLT.CAL_RUN_ID AND CNTRB.EMPL_RCD = RSLT.EMPL_RCD AND CNTRB.GP_PAYGROUP
= RSLT.GP_PAYGROUP AND CNTRB.CAL_ID = RSLT.CAL_ID AND CNTRB.ORIG_CAL_RUN_ID =
RSLT.ORIG_CAL_RUN_ID AND CNTRB.RSLT_SEG_NUM = RSLT.RSLT_SEG_NUM AND CNTRB.EFFDT =
RSLT.SLICE_END_DT AND PIN.PIN_CODE ='GEN VR NUM CONTR ESP' AND RSLT.PIN_NUM = PIN.PIN_NUM ORDER
BY CNTRB.EFFDT DESC", &Emplid, &FirstDay_PreviousMonth, &LastDay_PreviousMonth);
      While &Sql.Fetch(&EffDtWk, &ContractNum, &CommonContingencies, &ContributionDays)
         If (&Act_ContractNum = &ContractNum And
                   &DateOptn <> "1") Or
                &DateOptn = "1" Then
            &ContributionDaysTOT = &ContributionDaysTOT + &ContributionDays;
            &CommonContingenciesTOT = &CommonContingenciesTOT + &CommonContingencies;
         End-If;
      End-While;
   Else
      /*-----------*/
      /* Part Time */
      /*-----------*/
      /* Contribution Days + Common Contingency Base */
      If GP_ABS_TAKE.ABS_TYPE_OPTN = "MAT" Then
         &FirstDay = &FirstDay_PreviousYear;
      Else
         &FirstDay = &FirstDay_ThreeMonth;
      End-If;

       &Sql = CreateSQL("SELECT %DateOut(CNTRB.EFFDT), RSLT.CHR_PIN_VAL,
CNTRB.CONTRIB_BASE_ESP, CNTRB.CONTRIB_DAYS_ESP FROM PS_GPES_CNTRB_RSLT CNTRB, PS_GP_RSLT_PIN
RSLT, PS_GP_PIN PIN WHERE CNTRB.EMPLID = :1 AND CNTRB.EFFDT BETWEEN %DateIn(:2) AND %DateIn(:3)
AND " | "%SQL(GPES_MAX_VER_REV_NUM, PS_GPES_CNTRB_RSLT, CNTRB) AND CNTRB.EMPLID = RSLT.EMPLID
AND CNTRB.CAL_RUN_ID =RSLT.CAL_RUN_ID AND CNTRB.EMPL_RCD = RSLT.EMPL_RCD AND
CNTRB.GP_PAYGROUP = RSLT.GP_PAYGROUP AND CNTRB.CAL_ID = RSLT.CAL_ID AND CNTRB.ORIG_CAL_RUN_ID
= RSLT.ORIG_CAL_RUN_ID AND CNTRB.RSLT_SEG_NUM = RSLT.RSLT_SEG_NUM AND CNTRB.EFFDT =
RSLT.SLICE_END_DT AND PIN.PIN_CODE ='GEN VR NUM CONTR ESP' AND RSLT.PIN_NUM = PIN.PIN_NUM ORDER
BY CNTRB.EFFDT DESC", &Emplid, &FirstDay, &LastDay_PreviousMonth);
       While &Sql.Fetch(&EffDtWk, &ContractNum, &CommonContingencies, &ContributionDays)
          If (&Act_ContractNum = &ContractNum And
                   &DateOptn <> "1") Or
                &DateOptn = "1" Then
             &ContributionDaysTOT = &ContributionDaysTOT + &ContributionDays;
             &CommonContingenciesTOT = &CommonContingenciesTOT + &CommonContingencies;
          End-If;
       End-While;
   End-If;
   /*----------------*/
   /* Full/Part Time */
   /*----------------*/
   /* Contribution Overtime */
   &Sql = CreateSQL("SELECT %DateOut(CNTRB.EFFDT), RSLT.CHR_PIN_VAL, CNTRB.CONTRIB_OVER_ESP,
CNTRB.CONTRIB_DAYS_ESP FROM PS_GPES_CNTRB_RSLT CNTRB, PS_GP_RSLT_PIN RSLT, PS_GP_PIN PIN
WHERE CNTRB.EMPLID = :1 AND CNTRB.EFFDT BETWEEN %DateIn(:2) AND %DateIn(:3) AND " |
"%SQL(GPES_MAX_VER_REV_NUM, PS_GPES_CNTRB_RSLT, CNTRB) AND CNTRB.EMPLID = RSLT.EMPLID AND
CNTRB.CAL_RUN_ID =RSLT.CAL_RUN_ID AND CNTRB.EMPL_RCD = RSLT.EMPL_RCD AND CNTRB.GP_PAYGROUP
= RSLT.GP_PAYGROUP AND CNTRB.CAL_ID = RSLT.CAL_ID AND CNTRB.ORIG_CAL_RUN_ID =
RSLT.ORIG_CAL_RUN_ID AND CNTRB.RSLT_SEG_NUM = RSLT.RSLT_SEG_NUM AND CNTRB.EFFDT =
RSLT.SLICE_END_DT AND PIN.PIN_CODE ='GEN VR NUM CONTR ESP' AND RSLT.PIN_NUM = PIN.PIN_NUM ORDER
      BY CNTRB.EFFDT DESC", &Emplid, &FirstDay_PreviousYear, &LastDay_PreviousMonth);

         &OvertimeDaysTOT = 0;
         While &Sql.Fetch(&EffDtWk, &ContractNum, &ContributionOvertime, &OvertimeDays)
            If (&Act_ContractNum = &ContractNum And
                     &DateOptn <> "1") Or
                  &DateOptn = "1" Then
               If &ContributionOvertime <> 0 Then
                  /*&OvertimeDaysTOT = &OvertimeDaysTOT + &OvertimeDays;*/
                  &ContributionOvertimeTOT = &ContributionOvertimeTOT + &ContributionOvertime;
               End-If;
            End-If;
         End-While;
         If &ContributionOvertimeTOT > 0 Then
            &ContributionOvertimeTOT = Round(&ContributionOvertimeTOT / 365, 2);
         End-If;
      End-Function;

      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Record): FUNCLIB_GPGB.GPGB_PAYSLIP_FNS.FieldFormula
      [ . . . Unchanged Code not Shown . . . ]

      Function SelectList


      /*---------------------------------------------------------------------------------------
      -------
           Build where clause based on search criteria

      -----------------------------------------------------------------------------------------
      -----*/
         &PARAMETER2 = Date("");
         &PARAMETER3 = Date("");
         &PARAMETER4 = Date("");

           &WHERE_CLAUSE = "WHERE OPRID = :1";

         Evaluate DERIVED_GPGB.GPGB_PSLIP_PER_BTN
         When = "L" /* Latest */
            &WHERE_CLAUSE = &WHERE_CLAUSE | " AND PAYMENT_DT = (SELECT MAX(B.PAYMENT_DT) FROM
      PS_GPGB_PSLIP_SS_H B WHERE B.OPRID = :1)";

         When = "P" /* Period */
            &PARAMETER2 = DERIVED_GPGB.START_DT;
            If All(DERIVED_GPGB.END_DT) Then
               &PARAMETER3 = DERIVED_GPGB.END_DT;
            Else
               &PARAMETER3 = %Date;
            End-If;
            &WHERE_CLAUSE = &WHERE_CLAUSE | " AND PAYMENT_DT >= %datein(:2) AND PAYMENT_DT <=
      %datein(:3)";

           When = "T" /* Current Tax Year */
              &THIS_YR_TAX_YR_ST_DT = Date3(Year(%Date), 4, 5); /* This year's tax year start date
      */
             If %Date > &THIS_YR_TAX_YR_ST_DT Then
                &PARAMETER4 = &THIS_YR_TAX_YR_ST_DT;
             Else
                &PARAMETER4 = Date3(Year(%Date) - 1, 4, 5);
             End-If;
             &WHERE_CLAUSE = &WHERE_CLAUSE | " AND PAYMENT_DT > %datein(:4)";

           End-Evaluate;

           If All(DERIVED_GPGB.JOBCODE) Then
              &WHERE_CLAUSE = &WHERE_CLAUSE | " AND JOBCODE = :5";
   End-If;

   If All(DERIVED_GPGB.RUN_TYPE) Then
      &WHERE_CLAUSE = &WHERE_CLAUSE | " AND EXISTS (SELECT 'X' FROM PS_GP_CALENDAR B WHERE
B.GP_PAYGROUP = PS_GPGB_PSLIP_SS_H.GP_PAYGROUP AND B.CAL_ID = PS_GPGB_PSLIP_SS_H.CAL_ID AND
B.RUN_TYPE = :6)";
   End-If;


/*---------------------------------------------------------------------------------------
-------
     Populate grid

-----------------------------------------------------------------------------------------
-----*/
   &LEVEL1.Select(Record.GPGB_PSLIP_SS_H, &WHERE_CLAUSE, %OperatorId, &PARAMETER2,
&PARAMETER3, &PARAMETER4, DERIVED_GPGB.JOBCODE, DERIVED_GPGB.RUN_TYPE);

   /* Note, level 2 grids are selected via GPGB_PSLIP_SS_H RowInit at this stage */

   If &LEVEL1.ActiveRowCount = 1 And
         &LEVEL1(1).IsNew Then
      Return;
   End-If;


/*---------------------------------------------------------------------------------------
-------
     Process each payslip. Select level 2 data (earnings, deductions, etc).

-----------------------------------------------------------------------------------------
-----*/
   For &LOOP = 1 To &LEVEL1.ActiveRowCount

      &EMPLID = &LEVEL1(&LOOP).GPGB_PSLIP_SS_H.EMPLID.Value;
      &CAL_RUN_ID = &LEVEL1(&LOOP).GPGB_PSLIP_SS_H.CAL_RUN_ID.Value;
      &EMPL_RCD = &LEVEL1(&LOOP).GPGB_PSLIP_SS_H.EMPL_RCD.Value;
      &GP_PAYGROUP = &LEVEL1(&LOOP).GPGB_PSLIP_SS_H.GP_PAYGROUP.Value;
      &CAL_ID = &LEVEL1(&LOOP).GPGB_PSLIP_SS_H.CAL_ID.Value;
      &RSLT_SEG_NUM = &LEVEL1(&LOOP).GPGB_PSLIP_SS_H.RSLT_SEG_NUM.Value;


/*---------------------------------------------------------------------------------------
-
        Earnings

----------------------------------------------------------------------------------------*
/
      &LEVEL2_ERN = &LEVEL1(&LOOP).GetRowset(Scroll.GPGB_RSLT_ERN_W);

      For &LOOP2 = 1 To &LEVEL2_ERN.ActiveRowCount

         &GPGB_PIN_NUM_CUR = &LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.GPGB_PIN_NUM_CUR.Value;
         &GPGB_PIN_NUM_YTD = &LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.GPGB_PIN_NUM_YTD.Value;

         /* Get the segment end date */
         SQLExec("select %DATEOUT(SEG_END_DT) from PS_GP_PYE_SEG_STAT where EMPLID = :1 and
CAL_RUN_ID = :2 and EMPL_RCD = :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6",
&EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM, &SEG_END_DT);

         /* Get the payslip definition details for the Earning */
         SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD,
GPGB_PSLIP_DETAIL from PS_GPGB_PSLIP_ERNS A, PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID =
GPGB_PSLIP_ID_SS and B.GP_PAYGROUP = :1 and GPGB_PIN_NUM_CUR = :2 and B.EFFDT < %datein(:3)
and A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_ERNS A_ED WHERE A.GPGB_PSLIP_ID =
A_ED.GPGB_PSLIP_ID AND A_ED.EFFDT <= B.EFFDT )", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR,
&SEG_END_DT, &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER, &GPGB_PIN_NUM_YTD, &GPGB_PSLIP_DETAIL);

         SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD,
GPGB_PSLIP_DETAIL from PS_GPGB_PSLIP_ERNS A, PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID =
GPGB_PSLIP_ID_PU and B.GP_PAYGROUP = :1 and GPGB_PIN_NUM_CUR = :2 and B.EFFDT = (SELECT
MAX(B_GRP.EFFDT)FROM PS_GPGB_PSLIP_GRP B_GRP WHERE B_GRP.GP_PAYGROUP = B.GP_PAYGROUP and
B_GRP.EFFDT <= %datein(:3))and A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_ERNS A_ED
WHERE A.GPGB_PSLIP_ID = A_ED.GPGB_PSLIP_ID AND A_ED.EFFDT <= %datein(:3))", &GP_PAYGROUP,
&GPGB_PIN_NUM_CUR, &SEG_END_DT, &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER, &GPGB_PIN_NUM_YTD,
&GPGB_PSLIP_DETAIL);
         &LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.GPGB_PSLIP_DESCR.Value = &GPGB_PSLIP_DESCR;
         &LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.GPGB_ELE_ORDER.Value = &GPGB_ELE_ORDER;
         &LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.GPGB_PIN_NUM_YTD.Value = &GPGB_PIN_NUM_YTD;
         &LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.GPGB_PSLIP_DETAIL.Value = &GPGB_PSLIP_DETAIL;

          If &GPGB_PIN_NUM_YTD > 0 Then
             /* Get the acummulator rows */
             &GP_RSLT_ACUM = CreateRowset(Record.GP_RSLT_ACUM);
             &ACUM_ROWS = &GP_RSLT_ACUM.Fill("where EMPLID = :1 and CAL_RUN_ID = :2 and EMPL_RCD
= :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6 and PIN_NUM = :7 and ACM_FROM_DT
= (SELECT MAX(B.ACM_FROM_DT) FROM PS_GP_RSLT_ACUM B WHERE B.EMPLID = :1 and B.CAL_RUN_ID =
:2 and B.EMPL_RCD = :3 and B.GP_PAYGROUP = :4 and B.CAL_ID = :5 and B.RSLT_SEG_NUM = :6 and
B.PIN_NUM = :7)", &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM,
&GPGB_PIN_NUM_YTD);
             /* Get the apprpriate row */
             /*
             If &LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.INSTANCE.Value > 0 Then
                &ROW = &LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.INSTANCE.Value;
             Else
                &ROW = 1;
             End-If;
             */
             &ROW = get_accum_row(&GP_RSLT_ACUM,
&LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.USER_FLD1.Value,
&LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.USER_FLD2.Value,
&LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.USER_FLD3.Value,
&LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.USER_FLD4.Value, &EMPLID, &CAL_RUN_ID, &EMPL_RCD,
&GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM);
             If &ROW > 0 Then
                &LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.GPGB_RSLT_VAL_YTD.Value =
&GP_RSLT_ACUM(&ROW).GP_RSLT_ACUM.CALC_RSLT_VAL.Value;
             End-If;


            If &LOOP2 < &LEVEL2_ERN.ActiveRowCount And
                  &LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.INSTANCE.Value > 0 And
                  &LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.INSTANCE.Value <= &ACUM_ROWS And
                  &LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.GPGB_RATE_CUR.Value <> 0 Then
               &LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.GPGB_RSLT_VAL_YTD.Visible = False;
            End-If;

         End-If;

         If &GPGB_PSLIP_DETAIL > 0 Then
            &LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.GPGB_PSLIP_D_TXT.Value =
get_pin_value(&GPGB_PSLIP_DETAIL, &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID,
&RSLT_SEG_NUM);
         End-If;

         /* Set hyperlinks */
         &LEVEL2_ERN(&LOOP2).DERIVED_GPGB.GPGB_L2_LINK1_ERN.Label =
&LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.GPGB_PSLIP_DESCR.Value;
         If None(&LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.GPGB_BASE_VAL.Value,
&LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.GPGB_PCT_RSLT_VAL.Value,
&LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.GPGB_ADJ_VAL.Value,
&LEVEL2_ERN(&LOOP2).GPGB_RSLT_ERN_W.GPGB_PSLIP_D_TXT.Value) Then
            &LEVEL2_ERN(&LOOP2).DERIVED_GPGB.GPGB_L2_LINK1_ERN.Enabled = False;
         Else
            &LEVEL2_ERN(&LOOP2).DERIVED_GPGB.GPGB_L2_LINK1_ERN.Enabled = True;
         End-If;

      End-For;


/*---------------------------------------------------------------------------------------
-
        The following 4 sections consolidate Before Tax, Tax, After Tax and NI into a single
        deductions grid.

----------------------------------------------------------------------------------------*
/
      &LEVEL2_DEDS = &LEVEL1(&LOOP).GetRowset(Scroll.GPGB_PS_DED_VW);
      &COUNT = 0;


/*---------------------------------------------------------------------------------------
-
        1. Before Tax Deductions

----------------------------------------------------------------------------------------*
/
      &LEVEL2_BTX = &LEVEL1(&LOOP).GetRowset(Scroll.GPGB_RSLT_BTX_W);

      For &LOOP2 = 1 To &LEVEL2_BTX.ActiveRowCount

         If Not &LEVEL2_BTX(&LOOP2).IsNew Then

            /* Get details */
            &GPGB_PIN_NUM_CUR =
&LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.GPGB_PIN_NUM_CUR.Value;
            &GPGB_PIN_NUM_YTD =
&LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.GPGB_PIN_NUM_YTD.Value;

            /* Get the segment end date */
            SQLExec("select %DATEOUT(SEG_END_DT) from PS_GP_PYE_SEG_STAT where EMPLID = :1
and CAL_RUN_ID = :2 and EMPL_RCD = :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM
= :6", &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM, &SEG_END_DT);

            /* Get the payslip definition details for the deduction */
            SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD,
GPGB_PSLIP_DETAIL from PS_GPGB_PSLIP_PTXD A, PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID =
GPGB_PSLIP_ID_SS and B.GP_PAYGROUP = :1 and GPGB_PIN_NUM_CUR = :2 and B.EFFDT < %datein(:3)
and A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_PTXD A_ED WHERE A.GPGB_PSLIP_ID =
A_ED.GPGB_PSLIP_ID AND A_ED.EFFDT <= B.EFFDT )", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR,
&SEG_END_DT, &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER, &GPGB_PIN_NUM_YTD, &GPGB_PSLIP_DETAIL);

            SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD,
GPGB_PSLIP_DETAIL from PS_GPGB_PSLIP_PTXD A, PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID =
GPGB_PSLIP_ID_SS and B.GP_PAYGROUP = :1 and GPGB_PIN_NUM_CUR = :2 and B.EFFDT <= ( select
MAX(GRP.EFFDT) from PS_GPGB_PSLIP_GRP GRP where GRP.GP_PAYGROUP = B.GP_PAYGROUP and GRP.EFFDT
<= %datein(:3)) and A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_PTXD A_ED WHERE
A.GPGB_PSLIP_ID = A_ED.GPGB_PSLIP_ID AND A_ED.EFFDT <= %datein(:3) )", &GP_PAYGROUP,
&GPGB_PIN_NUM_CUR, &SEG_END_DT, &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER, &GPGB_PIN_NUM_YTD,
&GPGB_PSLIP_DETAIL);
            &LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.GPGB_PSLIP_DESCR.Value =
&GPGB_PSLIP_DESCR;
            &LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.GPGB_ELE_ORDER.Value = &GPGB_ELE_ORDER;
            &LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.GPGB_PIN_NUM_YTD.Value =
&GPGB_PIN_NUM_YTD;
            &LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.GPGB_PSLIP_DETAIL.Value =
&GPGB_PSLIP_DETAIL;

            If &GPGB_PIN_NUM_YTD > 0 Then

                /* Get the acummulator rows */
                &GP_RSLT_ACUM = CreateRowset(Record.GP_RSLT_ACUM);
                &ACUM_ROWS = &GP_RSLT_ACUM.Fill("where EMPLID = :1 and CAL_RUN_ID = :2 and
EMPL_RCD = :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6 and PIN_NUM = :7 and
ACM_FROM_DT = (SELECT MAX(B.ACM_FROM_DT) FROM PS_GP_RSLT_ACUM B WHERE B.EMPLID = :1 and
B.CAL_RUN_ID = :2 and B.EMPL_RCD = :3 and B.GP_PAYGROUP = :4 and B.CAL_ID = :5 and B.RSLT_SEG_NUM
= :6 and B.PIN_NUM = :7)", &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID,
&RSLT_SEG_NUM, &GPGB_PIN_NUM_YTD);

                /* Get the appropriate row */
                /*If &LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.INSTANCE.Value > 0 Then
                   &ROW = &LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.INSTANCE.Value;
                Else
                  &ROW = 1;
               End-If;*/
               &ROW = get_accum_row(&GP_RSLT_ACUM,
&LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.USER_FLD1.Value,
&LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.USER_FLD2.Value,
&LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.USER_FLD3.Value,
&LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.USER_FLD4.Value, &EMPLID, &CAL_RUN_ID, &EMPL_RCD,
&GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM);
               If &ROW > 0 Then
                  &LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.GPGB_RSLT_VAL_YTD.Value =
&GP_RSLT_ACUM(&ROW).GP_RSLT_ACUM.CALC_RSLT_VAL.Value;
               End-If;

                 If &LOOP2 < &LEVEL2_BTX.ActiveRowCount And
                       &LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.INSTANCE.Value > 0 And
                       &LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.INSTANCE.Value <= &ACUM_ROWS And
                       &LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.GPGB_RATE_CUR.Value <> 0 Then
                    &LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.GPGB_RSLT_VAL_YTD.Value = 0;
                 End-If;

            End-If;

            If &GPGB_PSLIP_DETAIL > 0 Then
               &LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.GPGB_PSLIP_D_TXT.Value =
get_pin_value(&GPGB_PSLIP_DETAIL, &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID,
&RSLT_SEG_NUM);
            End-If;

            /* Consolidate Before Tax row into Deductions grid */
            If &COUNT > 0 Then
               &LEVEL2_DEDS.InsertRow(&COUNT);
            End-If;
            &COUNT = &COUNT + 1;

&LEVEL2_BTX(&LOOP2).GPGB_RSLT_BTX_W.CopyFieldsTo(&LEVEL2_DEDS(&COUNT).GPGB_PS_DED_VW);
            &LEVEL2_DEDS(&COUNT).GPGB_PS_DED_VW.GPGB_PSLIP_DED_TYP.Value = 1;

         End-If;

      End-For;


/*---------------------------------------------------------------------------------------
-
        2. Tax

----------------------------------------------------------------------------------------*
/
      &LEVEL2_TAX = &LEVEL1(&LOOP).GetRowset(Scroll.GPGB_RSLT_TAX_W);

      For &LOOP2 = 1 To &LEVEL2_TAX.ActiveRowCount

         If Not &LEVEL2_TAX(&LOOP2).IsNew Then

            /* Get details */
            &GPGB_PIN_NUM_CUR =
&LEVEL2_TAX(&LOOP2).GPGB_RSLT_TAX_W.GPGB_PIN_NUM_CUR.Value;
            &GPGB_PIN_NUM_YTD =
&LEVEL2_TAX(&LOOP2).GPGB_RSLT_TAX_W.GPGB_PIN_NUM_YTD.Value;

            /* Get the segment end date */
            SQLExec("select %DATEOUT(SEG_END_DT) from PS_GP_PYE_SEG_STAT where EMPLID = :1
and CAL_RUN_ID = :2 and EMPL_RCD = :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM
= :6", &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM, &SEG_END_DT);

            /* Get the payslip definition details for the deduction */
            SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD from
PS_GPGB_PSLIP_TAX A, PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_SS and
B.GP_PAYGROUP = :1 and GPGB_PIN_NUM_CUR = :2 and B.EFFDT < %datein(:3) and A.EFFDT = ( SELECT
MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_TAX A_ED WHERE A.GPGB_PSLIP_ID = A_ED.GPGB_PSLIP_ID AND
A_ED.EFFDT <= B.EFFDT )", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR, &SEG_END_DT, &GPGB_PSLIP_DESCR,
&GPGB_ELE_ORDER, &GPGB_PIN_NUM_YTD);

            SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD from
PS_GPGB_PSLIP_TAX A, PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_SS and
B.GP_PAYGROUP = :1 and GPGB_PIN_NUM_CUR = :2 and B.EFFDT = ( select MAX(GRP.EFFDT) from
PS_GPGB_PSLIP_GRP GRP where GRP.GP_PAYGROUP = B.GP_PAYGROUP and GRP.EFFDT <= %datein(:3)) and
A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_TAX A_ED WHERE A.GPGB_PSLIP_ID =
A_ED.GPGB_PSLIP_ID AND A_ED.EFFDT <= %datein(:3) )", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR,
&SEG_END_DT, &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER, &GPGB_PIN_NUM_YTD);
            &LEVEL2_TAX(&LOOP2).GPGB_RSLT_TAX_W.GPGB_PSLIP_DESCR.Value =
&GPGB_PSLIP_DESCR;
            &LEVEL2_TAX(&LOOP2).GPGB_RSLT_TAX_W.GPGB_ELE_ORDER.Value = &GPGB_ELE_ORDER;
            &LEVEL2_TAX(&LOOP2).GPGB_RSLT_TAX_W.GPGB_PIN_NUM_YTD.Value =
&GPGB_PIN_NUM_YTD;

            /* Get the user keys for the accumulator */
            If Not None(&GPGB_PIN_NUM_YTD) Then
                /* Get the acummulator rows */
                &GP_RSLT_ACUM = CreateRowset(Record.GP_RSLT_ACUM);
                &ACUM_ROWS = &GP_RSLT_ACUM.Fill("where EMPLID = :1 and CAL_RUN_ID = :2 and
EMPL_RCD = :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6 and PIN_NUM = :7 and
ACM_FROM_DT = (SELECT MAX(B.ACM_FROM_DT) FROM PS_GP_RSLT_ACUM B WHERE B.EMPLID = :1 and
B.CAL_RUN_ID = :2 and B.EMPL_RCD = :3 and B.GP_PAYGROUP = :4 and B.CAL_ID = :5 and B.RSLT_SEG_NUM
= :6 and B.PIN_NUM = :7)", &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID,
&RSLT_SEG_NUM, &GPGB_PIN_NUM_YTD);
                /* Get the apprpriate row */
                /*If &LEVEL2_TAX(&LOOP2).GPGB_RSLT_TAX_W.INSTANCE.Value > 0 Then
                   &ROW = &LEVEL2_TAX(&LOOP2).GPGB_RSLT_TAX_W.INSTANCE.Value;
                Else
                   &ROW = 1;
                End-If;*/
                &ROW = get_accum_row(&GP_RSLT_ACUM,
&LEVEL2_TAX(&LOOP2).GPGB_RSLT_TAX_W.USER_FLD1.Value,
&LEVEL2_TAX(&LOOP2).GPGB_RSLT_TAX_W.USER_FLD2.Value,
&LEVEL2_TAX(&LOOP2).GPGB_RSLT_TAX_W.USER_FLD3.Value,
&LEVEL2_TAX(&LOOP2).GPGB_RSLT_TAX_W.USER_FLD4.Value, &EMPLID, &CAL_RUN_ID, &EMPL_RCD,
&GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM);
                If &ROW > 0 Then
                   &LEVEL2_TAX(&LOOP2).GPGB_RSLT_TAX_W.GPGB_RSLT_VAL_YTD.Value =
&GP_RSLT_ACUM(&ROW).GP_RSLT_ACUM.CALC_RSLT_VAL.Value;
                End-If;
            End-If;

            /* Consolidate Tax row into Deductions grid */
            If &COUNT > 0 Then
               &LEVEL2_DEDS.InsertRow(&COUNT);
            End-If;
            &COUNT = &COUNT + 1;

&LEVEL2_TAX(&LOOP2).GPGB_RSLT_TAX_W.CopyFieldsTo(&LEVEL2_DEDS(&COUNT).GPGB_PS_DED_VW);
            &LEVEL2_DEDS(&COUNT).GPGB_PS_DED_VW.GPGB_PSLIP_DED_TYP.Value = 2;

         End-If;

      End-For;


/*---------------------------------------------------------------------------------------
-
        3. After Tax Deductions

----------------------------------------------------------------------------------------*
/
      &LEVEL2_ATX = &LEVEL1(&LOOP).GetRowset(Scroll.GPGB_RSLT_ATX_W);

      For &LOOP2 = 1 To &LEVEL2_ATX.ActiveRowCount

         If Not &LEVEL2_ATX(&LOOP2).IsNew Then

            /* Get details */
            &GPGB_PIN_NUM_CUR =
&LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.GPGB_PIN_NUM_CUR.Value;
            &GPGB_PIN_NUM_YTD =
&LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.GPGB_PIN_NUM_YTD.Value;

            /* Get the segment end date */
            SQLExec("select %DATEOUT(SEG_END_DT) from PS_GP_PYE_SEG_STAT where EMPLID = :1
and CAL_RUN_ID = :2 and EMPL_RCD = :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM
= :6", &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM, &SEG_END_DT);

            /* Get the payslip definition details for the deduction */
            SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD,
GPGB_PSLIP_DETAIL from PS_GPGB_PSLIP_ATXD A, PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID =
GPGB_PSLIP_ID_SS and B.GP_PAYGROUP = :1 and GPGB_PIN_NUM_CUR = :2 and B.EFFDT < %datein(:3)
and A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_ATXD A_ED WHERE A.GPGB_PSLIP_ID =
A_ED.GPGB_PSLIP_ID AND A_ED.EFFDT <= B.EFFDT )", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR,
&SEG_END_DT, &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER, &GPGB_PIN_NUM_YTD, &GPGB_PSLIP_DETAIL);

            SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD,
GPGB_PSLIP_DETAIL from PS_GPGB_PSLIP_ATXD A, PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID =
GPGB_PSLIP_ID_SS and B.GP_PAYGROUP = :1 and GPGB_PIN_NUM_CUR = :2 and B.EFFDT = ( select
MAX(GRP.EFFDT) from PS_GPGB_PSLIP_GRP GRP where GRP.GP_PAYGROUP = B.GP_PAYGROUP and GRP.EFFDT
<= %datein(:3)) and A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_ATXD A_ED WHERE
A.GPGB_PSLIP_ID = A_ED.GPGB_PSLIP_ID AND A_ED.EFFDT <= %datein(:3) )", &GP_PAYGROUP,
&GPGB_PIN_NUM_CUR, &SEG_END_DT, &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER, &GPGB_PIN_NUM_YTD,
&GPGB_PSLIP_DETAIL);
            &LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.GPGB_PSLIP_DESCR.Value =
&GPGB_PSLIP_DESCR;
            &LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.GPGB_ELE_ORDER.Value = &GPGB_ELE_ORDER;
            &LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.GPGB_PIN_NUM_YTD.Value =
&GPGB_PIN_NUM_YTD;
            &LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.GPGB_PSLIP_DETAIL.Value =
&GPGB_PSLIP_DETAIL;

            If &GPGB_PIN_NUM_YTD > 0 Then

                /* Get the acummulator rows */
                &GP_RSLT_ACUM = CreateRowset(Record.GP_RSLT_ACUM);
                &ACUM_ROWS = &GP_RSLT_ACUM.Fill("where EMPLID = :1 and CAL_RUN_ID = :2 and
EMPL_RCD = :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6 and PIN_NUM = :7 and
ACM_FROM_DT = (SELECT MAX(B.ACM_FROM_DT) FROM PS_GP_RSLT_ACUM B WHERE B.EMPLID = :1 and
B.CAL_RUN_ID = :2 and B.EMPL_RCD = :3 and B.GP_PAYGROUP = :4 and B.CAL_ID = :5 and B.RSLT_SEG_NUM
= :6 and B.PIN_NUM = :7)", &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID,
&RSLT_SEG_NUM, &GPGB_PIN_NUM_YTD);

               /* Get the apprpriate row */
               /*If &LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.INSTANCE.Value > 0 Then
                  &ROW = &LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.INSTANCE.Value;
               Else
                  &ROW = 1;
               End-If;*/
               &ROW = get_accum_row(&GP_RSLT_ACUM,
&LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.USER_FLD1.Value,
&LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.USER_FLD2.Value,
&LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.USER_FLD3.Value,
&LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.USER_FLD4.Value, &EMPLID, &CAL_RUN_ID, &EMPL_RCD,
&GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM);
               If &ROW > 0 Then
                  &LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.GPGB_RSLT_VAL_YTD.Value =
&GP_RSLT_ACUM(&ROW).GP_RSLT_ACUM.CALC_RSLT_VAL.Value;
               End-If;
               If &LOOP2 < &LEVEL2_ATX.ActiveRowCount And
                     &LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.INSTANCE.Value > 0 And
                     &LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.INSTANCE.Value <= &ACUM_ROWS And
                     &LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.GPGB_RATE_CUR.Value <> 0 Then
                  &LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.GPGB_RSLT_VAL_YTD.Value = 0;
               End-If;

            End-If;

            If &GPGB_PSLIP_DETAIL > 0 Then
               &LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.GPGB_PSLIP_D_TXT.Value =
get_pin_value(&GPGB_PSLIP_DETAIL, &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID,
&RSLT_SEG_NUM);
            End-If;

            /* Consolidate After Tax row into Deductions grid */
            If &COUNT > 0 Then
               &LEVEL2_DEDS.InsertRow(&COUNT);
            End-If;
            &COUNT = &COUNT + 1;

&LEVEL2_ATX(&LOOP2).GPGB_RSLT_ATX_W.CopyFieldsTo(&LEVEL2_DEDS(&COUNT).GPGB_PS_DED_VW);
            &LEVEL2_DEDS(&COUNT).GPGB_PS_DED_VW.GPGB_PSLIP_DED_TYP.Value = 3;

         End-If;

      End-For;


/*---------------------------------------------------------------------------------------
-
        4. NI

----------------------------------------------------------------------------------------*
/
      &LEVEL2_NI = &LEVEL1(&LOOP).GetRowset(Scroll.GPGB_RSLT_NI_W);

      For &LOOP2 = 1 To &LEVEL2_NI.ActiveRowCount

         If Not &LEVEL2_NI(&LOOP2).IsNew Then

            /* Get details */
            &GPGB_PIN_NUM_CUR = &LEVEL2_NI(&LOOP2).GPGB_RSLT_NI_W.GPGB_PIN_NUM_CUR.Value;
            &GPGB_PIN_NUM_YTD = &LEVEL2_NI(&LOOP2).GPGB_RSLT_NI_W.GPGB_PIN_NUM_YTD.Value;

            /* Get the segment end date */
            SQLExec("select %DATEOUT(SEG_END_DT) from PS_GP_PYE_SEG_STAT where EMPLID = :1
and CAL_RUN_ID = :2 and EMPL_RCD = :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM
= :6", &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM, &SEG_END_DT);

            /* Get the payslip definition details for the deduction */
            SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD from
PS_GPGB_PSLIP_NI A,PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_SS and
B.GP_PAYGROUP = :1 and GPGB_PIN_NUM_CUR = :2 and B.EFFDT < %datein(:3) and A.EFFDT = ( SELECT
MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_NI A_ED WHERE A.GPGB_PSLIP_ID = A_ED.GPGB_PSLIP_ID AND
A_ED.EFFDT <= B.EFFDT )", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR, &SEG_END_DT, &GPGB_PSLIP_DESCR,
&GPGB_ELE_ORDER, &GPGB_PIN_NUM_YTD);
            SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD from
PS_GPGB_PSLIP_NI A,PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_SS and
B.GP_PAYGROUP = :1 and GPGB_PIN_NUM_CUR = :2 and B.EFFDT = ( select MAX(GRP.EFFDT) from
PS_GPGB_PSLIP_GRP GRP where GRP.GP_PAYGROUP = B.GP_PAYGROUP and GRP.EFFDT <= %datein(:3)) and
A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_NI A_ED WHERE A.GPGB_PSLIP_ID =
A_ED.GPGB_PSLIP_ID AND A_ED.EFFDT <= %datein(:3) )", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR,
&SEG_END_DT, &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER, &GPGB_PIN_NUM_YTD);

            &LEVEL2_NI(&LOOP2).GPGB_RSLT_NI_W.GPGB_PSLIP_DESCR.Value = &GPGB_PSLIP_DESCR;
            &LEVEL2_NI(&LOOP2).GPGB_RSLT_NI_W.GPGB_ELE_ORDER.Value = &GPGB_ELE_ORDER;
            &LEVEL2_NI(&LOOP2).GPGB_RSLT_NI_W.GPGB_PIN_NUM_YTD.Value = &GPGB_PIN_NUM_YTD;

            If &GPGB_PIN_NUM_YTD > 0 Then
                /* Get the acummulator rows */
                &GP_RSLT_ACUM = CreateRowset(Record.GP_RSLT_ACUM);
                &ACUM_ROWS = &GP_RSLT_ACUM.Fill("where EMPLID = :1 and CAL_RUN_ID = :2 and
EMPL_RCD = :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6 and PIN_NUM = :7 and
ACM_FROM_DT = (SELECT MAX(B.ACM_FROM_DT) FROM PS_GP_RSLT_ACUM B WHERE B.EMPLID = :1 and
B.CAL_RUN_ID = :2 and B.EMPL_RCD = :3 and B.GP_PAYGROUP = :4 and B.CAL_ID = :5 and B.RSLT_SEG_NUM
= :6 and B.PIN_NUM = :7)", &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID,
&RSLT_SEG_NUM, &GPGB_PIN_NUM_YTD);
                /* Get the apprpriate row */
                /*If &LEVEL2_NI(&LOOP2).GPGB_RSLT_NI_W.INSTANCE.Value > 0 Then
                   &ROW = &LEVEL2_NI(&LOOP2).GPGB_RSLT_NI_W.INSTANCE.Value;
                Else
                  &ROW = 1;
               End-If;*/
               &ROW = get_accum_row(&GP_RSLT_ACUM,
&LEVEL2_NI(&LOOP2).GPGB_RSLT_NI_W.USER_FLD1.Value,
&LEVEL2_NI(&LOOP2).GPGB_RSLT_NI_W.USER_FLD2.Value,
&LEVEL2_NI(&LOOP2).GPGB_RSLT_NI_W.USER_FLD3.Value,
&LEVEL2_NI(&LOOP2).GPGB_RSLT_NI_W.USER_FLD4.Value, &EMPLID, &CAL_RUN_ID, &EMPL_RCD,
&GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM);
               If &ROW > 0 Then
                  &LEVEL2_NI(&LOOP2).GPGB_RSLT_NI_W.GPGB_RSLT_VAL_YTD.Value =
&GP_RSLT_ACUM(&ROW).GP_RSLT_ACUM.CALC_RSLT_VAL.Value;
               End-If;
            End-If;

           /* Consolidate NI row into Deductions grid */
           If &COUNT > 0 Then
              &LEVEL2_DEDS.InsertRow(&COUNT);
           End-If;
           &COUNT = &COUNT + 1;

&LEVEL2_NI(&LOOP2).GPGB_RSLT_NI_W.CopyFieldsTo(&LEVEL2_DEDS(&COUNT).GPGB_PS_DED_VW);
            &LEVEL2_DEDS(&COUNT).GPGB_PS_DED_VW.GPGB_PSLIP_DED_TYP.Value = 4;

        End-If;

     End-For;


/*---------------------------------------------------------------------------------------
-
        Deductions (consolidated grid)

----------------------------------------------------------------------------------------*
/
      &LEVEL2_DEDS.Sort(GPGB_PS_DED_VW.GPGB_PSLIP_DED_TYP, "A",
GPGB_PS_DED_VW.GPGB_ELE_ORDER, "A");

     /* Set hyperlinks */
     For &LOOP2 = 1 To &LEVEL2_DEDS.ActiveRowCount

         &LEVEL2_DEDS(&LOOP2).DERIVED_GPGB.GPGB_L2_LINK1_DED.Label =
&LEVEL2_DEDS(&LOOP2).GPGB_PS_DED_VW.GPGB_PSLIP_DESCR.Value;
         If None(&LEVEL2_DEDS(&LOOP2).GPGB_PS_DED_VW.GPGB_BASE_VAL.Value,
&LEVEL2_DEDS(&LOOP2).GPGB_PS_DED_VW.GPGB_PCT_RSLT_VAL.Value,
&LEVEL2_DEDS(&LOOP2).GPGB_PS_DED_VW.GPGB_ADJ_VAL.Value,
&LEVEL2_DEDS(&LOOP2).GPGB_PS_DED_VW.GPGB_PSLIP_D_TXT.Value) Then
            &LEVEL2_DEDS(&LOOP2).DERIVED_GPGB.GPGB_L2_LINK1_DED.Enabled = False;
         Else
            &LEVEL2_DEDS(&LOOP2).DERIVED_GPGB.GPGB_L2_LINK1_DED.Enabled = True;
         End-If;

        If &LEVEL2_DEDS(&LOOP2).GPGB_PS_DED_VW.GPGB_RSLT_VAL_YTD.Value = 0 Then
           &LEVEL2_DEDS(&LOOP2).GPGB_PS_DED_VW.GPGB_RSLT_VAL_YTD.Visible = False;
        End-If;

     End-For;


/*---------------------------------------------------------------------------------------
-
        Balances

----------------------------------------------------------------------------------------*
/
      &LEVEL2_BAL = &LEVEL1(&LOOP).GetRowset(Scroll.GPGB_RSLT_BAL_W);

     For &LOOP2 = 1 To &LEVEL2_BAL.ActiveRowCount

        /* Get details */
        &GPGB_PIN_NUM_CUR = &LEVEL2_BAL(&LOOP2).GPGB_RSLT_BAL_W.GPGB_PIN_NUM_CUR.Value;
        &GPGB_PIN_NUM_YTD = &LEVEL2_BAL(&LOOP2).GPGB_RSLT_BAL_W.GPGB_PIN_NUM_YTD.Value;
         &GPGB_RSLT_VAL_YTD = &LEVEL2_BAL(&LOOP2).GPGB_RSLT_BAL_W.GPGB_RSLT_VAL_YTD.Value;
         &GPGB_USER_KEY1 = &LEVEL2_BAL(&LOOP2).GPGB_RSLT_BAL_W.GPGB_USER_KEY1.Value;
         &GPGB_USER_KEY2 = &LEVEL2_BAL(&LOOP2).GPGB_RSLT_BAL_W.GPGB_USER_KEY2.Value;
         &GPGB_USER_KEY3 = &LEVEL2_BAL(&LOOP2).GPGB_RSLT_BAL_W.GPGB_USER_KEY3.Value;
         &GPGB_USER_KEY4 = &LEVEL2_BAL(&LOOP2).GPGB_RSLT_BAL_W.GPGB_USER_KEY4.Value;
         &GPGB_PSLIP_DETAIL = &LEVEL2_BAL(&LOOP2).GPGB_RSLT_BAL_W.GPGB_PSLIP_DETAIL.Value;

         If Not None(&GPGB_PIN_NUM_YTD) And
               None(&GPGB_RSLT_VAL_YTD) Then

             /* Get the acummulator rows */
             &GP_RSLT_ACUM = CreateRowset(Record.GP_RSLT_ACUM);
             &ACUM_ROWS = &GP_RSLT_ACUM.Fill("where EMPLID = :1 and CAL_RUN_ID = :2 and EMPL_RCD
= :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6 and PIN_NUM = :7 and ACM_FROM_DT
= (SELECT MAX(B.ACM_FROM_DT) FROM PS_GP_RSLT_ACUM B WHERE B.EMPLID = :1 and B.CAL_RUN_ID =
:2 and B.EMPL_RCD = :3 and B.GP_PAYGROUP = :4 and B.CAL_ID = :5 and B.RSLT_SEG_NUM = :6 and
B.PIN_NUM = :7)", &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM,
&GPGB_PIN_NUM_YTD);

            /* Get the appropriate row */
            /*&ROW = 1;*/
            &ROW = get_accum_row(&GP_RSLT_ACUM, &GPGB_USER_KEY1, &GPGB_USER_KEY2,
&GPGB_USER_KEY3, &GPGB_USER_KEY4, &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID,
&RSLT_SEG_NUM);

            If &ROW > 0 Then
               &LEVEL2_BAL(&LOOP2).GPGB_RSLT_BAL_W.GPGB_RSLT_VAL_YTD.Value =
&GP_RSLT_ACUM(&ROW).GP_RSLT_ACUM.CALC_RSLT_VAL.Value;
            End-If;

         End-If;

         If &GPGB_PSLIP_DETAIL > 0 Then
            &LEVEL2_BAL(&LOOP2).GPGB_RSLT_BAL_W.GPGB_PSLIP_D_TXT.Value =
get_pin_value(&GPGB_PSLIP_DETAIL, &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID,
&RSLT_SEG_NUM);
         End-If;

         /* Set hyperlinks */
         &LEVEL2_BAL(&LOOP2).DERIVED_GPGB.GPGB_L2_LINK1_BAL.Label =
&LEVEL2_BAL(&LOOP2).GPGB_RSLT_BAL_W.GPGB_PSLIP_DESCR.Value;
         If None(&LEVEL2_BAL(&LOOP2).GPGB_RSLT_BAL_W.GPGB_ADJ_VAL.Value,
&LEVEL2_BAL(&LOOP2).GPGB_RSLT_BAL_W.GPGB_ADJ_VAL_YTD.Value,
&LEVEL2_BAL(&LOOP2).GPGB_RSLT_BAL_W.GPGB_PSLIP_D_TXT.Value) Then
            &LEVEL2_BAL(&LOOP2).DERIVED_GPGB.GPGB_L2_LINK1_BAL.Enabled = False;
         Else
            &LEVEL2_BAL(&LOOP2).DERIVED_GPGB.GPGB_L2_LINK1_BAL.Enabled = True;
         End-If;

      End-For;


/*---------------------------------------------------------------------------------------
-
        The following 2 sections consolidate Employee and Paygroup payslip messages
        into a single grid.

----------------------------------------------------------------------------------------*
/
      &LEVEL2_ALL_MSG = &LEVEL1(&LOOP).GetRowset(Scroll.GPGB_PS_MSG_VW);
      &COUNT = 0;


/*---------------------------------------------------------------------------------------
-
        1. Employee Messages

----------------------------------------------------------------------------------------*
/
      &LEVEL2_EE_MSG = &LEVEL1(&LOOP).GetRowset(Scroll.GPGB_EE_M_VW);
      For &LOOP2 = 1 To &LEVEL2_EE_MSG.ActiveRowCount
        If Not &LEVEL2_EE_MSG(&LOOP2).IsNew Then
           If &COUNT > 0 Then
              &LEVEL2_ALL_MSG.InsertRow(&COUNT);
           End-If;
           &COUNT = &COUNT + 1;

&LEVEL2_EE_MSG(&LOOP2).GPGB_EE_M_VW.CopyFieldsTo(&LEVEL2_ALL_MSG(&COUNT).GPGB_PS_MSG_VW);
         End-If;
      End-For;


/*---------------------------------------------------------------------------------------
-
        2. Paygroup Messages

----------------------------------------------------------------------------------------*
/
      &LEVEL2_PGRP_MSG = &LEVEL1(&LOOP).GetRowset(Scroll.GPGB_PGRP_M_VW);
      For &LOOP2 = 1 To &LEVEL2_PGRP_MSG.ActiveRowCount
         If Not &LEVEL2_PGRP_MSG(&LOOP2).IsNew Then
            If &COUNT > 0 Then
               &LEVEL2_ALL_MSG.InsertRow(&COUNT);
            End-If;
            &COUNT = &COUNT + 1;

&LEVEL2_PGRP_MSG(&LOOP2).GPGB_PGRP_M_VW.CopyFieldsTo(&LEVEL2_ALL_MSG(&COUNT).GPGB_PS_MSG_
VW);
         End-If;
      End-For;


/*---------------------------------------------------------------------------------------
-
        Set hyperlink labels

----------------------------------------------------------------------------------------*
/
      &LEVEL1(&LOOP).DERIVED_GPGB.GPGB_L1_LINK1.Label =
&LEVEL1(&LOOP).GPGB_PSLIP_SS_H.PAYMENT_DT.Value;
      &LEVEL1(&LOOP).DERIVED_GPGB.GPGB_L1_LINK2.Label =
&LEVEL1(&LOOP).JOBCODE_TBL.DESCR.Value;
      &LEVEL1(&LOOP).DERIVED_GPGB.GPGB_L1_LINK3.Label =
&LEVEL1(&LOOP).GPGB_PSLIP_SS_H.PIN_NET_VAL.Value;
      &LEVEL1(&LOOP).DERIVED_GPGB.GPGB_L1_LINK4.Label =
&LEVEL1(&LOOP).GP_RUN_TYPE_VW.DESCR.Value;


/*---------------------------------------------------------------------------------------
-
        Sort level 2 scrolls

----------------------------------------------------------------------------------------*
/
      &LEVEL2_ERN.Sort(GPGB_RSLT_ERN_W.EMPLID, "A", GPGB_RSLT_ERN_W.CAL_RUN_ID, "A",
GPGB_RSLT_ERN_W.EMPL_RCD, "A", GPGB_RSLT_ERN_W.GP_PAYGROUP, "A", GPGB_RSLT_ERN_W.CAL_ID,
"A", GPGB_RSLT_ERN_W.RSLT_SEG_NUM, "A", GPGB_RSLT_ERN_W.GPGB_ELE_ORDER, "A");

      &LEVEL2_BAL.Sort(GPGB_RSLT_BAL_W.EMPLID, "A", GPGB_RSLT_BAL_W.CAL_RUN_ID, "A",
GPGB_RSLT_BAL_W.EMPL_RCD, "A", GPGB_RSLT_BAL_W.GP_PAYGROUP, "A", GPGB_RSLT_BAL_W.CAL_ID,
"A", GPGB_RSLT_BAL_W.RSLT_SEG_NUM, "A", GPGB_RSLT_BAL_W.GPGB_ELE_ORDER, "A");

      &LEVEL2_BTX.Sort(GPGB_RSLT_BTX_W.EMPLID, "A", GPGB_RSLT_BTX_W.CAL_RUN_ID, "A",
GPGB_RSLT_BTX_W.EMPL_RCD, "A", GPGB_RSLT_BTX_W.GP_PAYGROUP, "A", GPGB_RSLT_BTX_W.CAL_ID,
"A", GPGB_RSLT_BTX_W.RSLT_SEG_NUM, "A", GPGB_RSLT_BTX_W.GPGB_ELE_ORDER, "A");

      &LEVEL2_ATX.Sort(GPGB_RSLT_ATX_W.EMPLID, "A", GPGB_RSLT_ATX_W.CAL_RUN_ID, "A",
GPGB_RSLT_ATX_W.EMPL_RCD, "A", GPGB_RSLT_ATX_W.GP_PAYGROUP, "A", GPGB_RSLT_ATX_W.CAL_ID,
"A", GPGB_RSLT_ATX_W.RSLT_SEG_NUM, "A", GPGB_RSLT_ATX_W.GPGB_ELE_ORDER, "A");

      &LEVEL2_TAX.Sort(GPGB_RSLT_TAX_W.EMPLID, "A", GPGB_RSLT_TAX_W.CAL_RUN_ID, "A",
GPGB_RSLT_TAX_W.EMPL_RCD, "A", GPGB_RSLT_TAX_W.GP_PAYGROUP, "A", GPGB_RSLT_TAX_W.CAL_ID,
      "A", GPGB_RSLT_TAX_W.RSLT_SEG_NUM, "A", GPGB_RSLT_TAX_W.GPGB_ELE_ORDER, "A");

            &LEVEL2_NI.Sort(GPGB_RSLT_NI_W.EMPLID, "A", GPGB_RSLT_NI_W.CAL_RUN_ID, "A",
      GPGB_RSLT_NI_W.EMPL_RCD, "A", GPGB_RSLT_NI_W.GP_PAYGROUP, "A", GPGB_RSLT_NI_W.CAL_ID, "A",
      GPGB_RSLT_NI_W.RSLT_SEG_NUM, "A", GPGB_RSLT_NI_W.GPGB_ELE_ORDER, "A");

              FormatAddress();

           End-For;

           &LEVEL1.Sort(GPGB_PSLIP_SS_H.PAYMENT_DT, "D");

      End-Function;

      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Record): GPCH_EG_INS_DW.GPCH_EG_PRSN_XML.FieldFormula
      [ . . . Unchanged Code not Shown . . . ]

      Function Get_Address()

      /*************************************************************************************/

         SQLExec("Select ADDRESS1,ADDRESS2,POSTAL,CITY,STATE,ADDRESS4,COUNTRY from PS_ADDRESSES
      where EMPLID = :1 AND ADDRESS_TYPE = :2 AND EFFDT = (Select MAX(EFFDT) from PS_ADDRESSES WHERE
      EMPLID = :1 AND ADDRESS_TYPE = :2 AND EFFDT <= %Datein(:3))", &Emplid, &Addr_Type,
      GPCHINS_AET.GPCH_RC_TO_DT, &Addr1, &Addr2, &Postal, &City, &State, &Postbox, &RCountry);

         SQLExec("Select ADDRESS1,ADDRESS2,POSTAL,CITY,ADDRESS4 from PS_ADDRESSES where EMPLID =
      :1 AND ADDRESS_TYPE = :2 AND EFFDT = (Select MAX(EFFDT) from PS_ADDRESSES WHERE EMPLID = :1
      AND ADDRESS_TYPE = :2 )", &Emplid, &Addr_Type, &Addr1, &Addr2, &Postal, &City, &Postbox);
         &Addr_xml = AddCreateElement(&Particulars_xml, "Address");
         If &Addr2 <> "" And
               &Addr2 <> " " Then
            &Addr = AddNodeandText(&Addr_xml, "ComplementaryLine", &Addr2);
         End-If;

           &Addr = AddNodeandText(&Addr_xml, "Street", &Addr1);
           rem &Addr = AddNodeandText(&Addr_xml, "Postbox", "");
           If &Postbox <> "" And
                 &Postbox <> " " Then
              &Addr = AddNodeandText(&Addr_xml, "Postbox", &Postbox);
           End-If;
           &Addr = AddNodeandText(&Addr_xml, "ZIP-Code", &Postal);
           &Addr = AddNodeandText(&Addr_xml, "City", &City);
           /* For non Swiss addresses read country_tbl to convert into 2 Char and create country TAG
      */
         If &RCountry <> Null And
               &RCountry <> "CHE" Then
            SQLExec("Select COUNTRY_2CHAR from PS_COUNTRY_TBL where COUNTRY = :1 ", &RCountry,
      &2ChrCountry);
            &Addr = AddNodeandText(&Addr_xml, "Country", &2ChrCountry);
         End-If;

           If &State = "" Or
                 &RCountry <> "CHE" Then
              &State = "EX";
           End-If;

           &ResCan_Xml = AddNodeandText(&Particulars_xml, "ResidenceCanton", &State);

      End-Function;

      [ . . . Unchanged Code not Shown . . . ]

      Function Run_Identify()
/*************************************************************************************/

   Criteria_Classic();
   &SQL1 = GetSQL(SQL.GPCH_IDENTIFY, GPCHINS_AET.COMPANY,
GPCHINS_AET.GPCH_RC_FROM_DT.Value, GPCHINS_AET.GPCH_RC_TO_DT.Value);

   While &SQL1.Fetch(&Emplid, &Empl_Rcd, &N_Id, &SI_Id, &L_Name, &F_Name, &Sex, &B_Date,
&Country, &M_Status, &State, &FTE, &FAK_Can, &Addr_Type, &STD_HOURS, &YOS, &TermDt, &SETID_S,
&SAL_PLAN, &GRADE, &Permit);
   While &SQL1.Fetch(&Emplid, &Empl_Rcd, &N_Id, &SI_Id, &L_Name, &F_Name, &Sex, &B_Date,
&Country, &RCountry, &M_Status, &State, &FTE, &FAK_Can, &Addr_Type, &STD_HOURS, &YOS, &TermDt,
&SETID_S, &SAL_PLAN, &GRADE, &Permit);
      REM &FTE = &FTE * 100;
      &FTE = String(Round(&FTE * 100, 0));
      Evaluate &M_Status
      When = "C"
         &M_Status = "unknown";
         Break;
      When = "D"
         &M_Status = "divorced";
         Break;
      When = "E"
         &M_Status = "separated";
         Break;
      When = "H"
         &M_Status = "unknown";
         Break;
      When = "M"
         &M_Status = "married";
         Break;
      When = "P"
         &M_Status = "unknown";
         Break;
      When = "S"
         &M_Status = "single";
         Break;
      When = "U"
         &M_Status = "unknown";
         Break;
      When = "W"
         &M_Status = "widowed";
         Break;
      When-Other
         &M_Status = "unknown";
         Break;
      End-Evaluate;
      If All(&N_Id) Then
         &National_id = Substring(&N_Id, 1, 3) | "." | Substring(&N_Id, 4, 2) | "." |
Substring(&N_Id, 6, 3) | "." | Substring(&N_Id, 9, 3);
      Else
         &National_id = "";
      End-If;
      REM &SI_Id = RTrim(&SI_Id);
      rem If &SI_Id = "0" Then
      rem   &SI_Id = "";
      rem End-If;

      If All(&SI_Id) Then
         &SI_Id = Substring(&SI_Id, 1, 3) | "." | Substring(&SI_Id, 4, 4) | "." |
Substring(&SI_Id, 8, 4) | "." | Substring(&SI_Id, 12, 2);
      Else
         REM         &National_id = "";
         &SI_Id = "";
      End-If;

      &xmldoc1 = GetBiDoc("");
      &root1 = &xmldoc1.CreateElement("ROOT");
      &Particulars_xml = &xmldoc1.GetNode("ROOT").CreateElement("Particulars");

      &SocialInsIdn = AddCreateElement(&Particulars_xml, "Social-InsuranceIdentification");
      If (&National_id = "" Or
               &National_id = " ") And
            (&SI_Id = "" Or
               &SI_Id = " ") Then
         &unknown = AddNodeandText(&SocialInsIdn, "unknown", "");
      End-If;
      If &National_id <> "" And
            &National_id <> " " And
            &SI_Id <> "" And
            &SI_Id <> " " Then
         &SocialInsBoth = AddCreateElement(&SocialInsIdn, "SV-AS-AHV-AVS-Number");
         &SocialInsBoth = AddNodeandText(&SocialInsBoth, "SV-AS-Number", &SI_Id);
         &SocialInsBoth = AddNodeandText(&SocialInsBoth, "AHV-AVS-Number", &National_id);
      Else
         /* die naechsten beiden If's nur in der Reihenfolge verdreht - cosmetic */
         If &SI_Id <> "" And
               &SI_Id <> " " Then
            &SocialInsIdn = AddNodeandText(&SocialInsIdn, "SV-AS-Number", &SI_Id);
         End-If;
         If &National_id <> "" And
               &National_id <> " " Then
            &SocialInsIdn = AddNodeandText(&SocialInsIdn, "AHV-AVS-Number", &National_id);
         End-If;
      End-If;

      &Empl_Num = AddNodeandText(&Particulars_xml, "EmployeeNumber", &Emplid);
      &Empl_Num = AddNodeandText(&Particulars_xml, "Lastname", &L_Name);
      &Empl_Num = AddNodeandText(&Particulars_xml, "Firstname", &F_Name);
      &Empl_Num = AddNodeandText(&Particulars_xml, "Sex", &Sex);
      &Empl_Num = AddNodeandText(&Particulars_xml, "DateOfBirth", &B_Date);
      &Empl_Num = AddNodeandText(&Particulars_xml, "Nationality", &Country);
      &Empl_Num = AddNodeandText(&Particulars_xml, "CivilStatus", &M_Status);
      /* <SingleParent> not supported for now (only available in GPCH_CA_DATA1 not in any write
array) */

      Get_Address();

      &Permit = RTrim(&Permit, " ");
      /* Read mapping for Permit */
      SQLExec("Select LSENM.GPCH_RP_LSETVAL from PS_GPCH_RP_LSENM LSENM where LSENM.COUNTRY
= :1 and LSENM.VISA_PERMIT_TYPE =:2", "CHE", &Permit, &PermitVal);

      Evaluate &PermitVal
      When "1"
         &ResCat = "";
         Break;
      When "2"
         &ResCat = "shortTerm";
         Break;
      When "3"
         &ResCat = "annual";
         Break;
      When "4"
         &ResCat = "settled";
         Break;
      When "5"
         &ResCat = "crossBorder";
         Break;
      When "6"
         &ResCat = "othersNotSwiss";
         Break;
      When-Other
         &ResCat = " ";
         Break;
      End-Evaluate;

      If &ResCat <> "" Then
         &ResCat_Xml = AddNodeandText(&Particulars_xml, "ResidenceCategory", &ResCat);
      End-If;

      /* <DegreeOfRelationship> not supported in this system */
            /* End of Particulars */
            /* Begin of Work */
            &SETID_S = RTrim(&SETID_S, " ");
            &SAL_PLAN = RTrim(&SAL_PLAN, " ");
            &GRADE = RTrim(&GRADE, " ");
            &Agricultural = "";
            &Apprentice = "";
            /* Read mapping for Agricultural */
            SQLExec("Select LSEAG.GPCH_RP_LSETVAL from PS_GPCH_RP_LSEAG LSEAG where LSEAG.SETID =
      :1 and LSEAG.SAL_ADMIN_PLAN =:2 and LSEAG.GPCH_RP_LSESVAL =:3", &SETID_S, &SAL_PLAN, &GRADE,
      &Agricultural);
            /* Read mapping for Apprentice */
            SQLExec("Select LSEAP.GPCH_RP_LSETVAL from PS_GPCH_RP_LSEAP LSEAP where LSEAP.SETID =
      :1 and LSEAP.SAL_ADMIN_PLAN =:2 and LSEAP.GPCH_RP_LSESVAL =:3", &SETID_S, &SAL_PLAN, &GRADE,
      &Apprentice);

            &Agricultural = RTrim(&Agricultural, " ");
            &Apprentice = RTrim(&Apprentice, " ");

            &Work_xml = &xmldoc1.GetNode("ROOT").CreateElement("Work");

            &STD_HOURS = String(Round(&STD_HOURS, 2));

            &num1 = Value(&STD_HOURS);
            If &num1 > 0 Then
               &WorkTime_xml = AddCreateElement(&Work_xml, "WorkingTime");
               &Work = AddNodeandText(&WorkTime_xml, "WeeklyHours", &STD_HOURS);
            End-If;
            &Work = AddNodeandText(&Work_xml, "ActivityRate", &FTE);
            &Work = AddNodeandText(&Work_xml, "YearsOfService", &YOS);
            If &TermDt <> "" Then
               &Work = AddNodeandText(&Work_xml, "WithdrawalDate", &TermDt);
            End-If;
            &Work = AddNodeandText(&Work_xml, "WorkplaceCanton", &FAK_Can);
            If &Agricultural = "1" Then
               &Work = AddNodeandText(&Work_xml, "AgriculturalEmployee", "");
            End-If;
            If &Apprentice = "1" Then
               &Work = AddNodeandText(&Work_xml, "Apprentice", "");
            End-If;

            &xmldata1 = &xmldoc1.GenXmlString();

            &Pos1 = Find("<ROOT>", &xmldata1);
            &Pos2 = Find("</ROOT>", &xmldata1);
            &xmldata1 = Substring(&xmldata1, &Pos1 + 6, &Pos2 - (&Pos1 + 6));

            Insert_EG_PERSON();

         End-While;
      End-Function;

      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Record): GPCH_EG_PRO_DW.PRINT_BTN.FieldChange
      [ . . . Unchanged Code not Shown . . . ]

      Function NoNameSpaceFile() Returns string

         Local string &sTempVarA;
         Local number &linecount;

         &FileDetails = CreateArray(" ", 0);

         &FileDetails = GetFileName();
  &ElmFile = &FileDetails [1]| "/" | &FileDetails [2];

  &TempPath = GetEnv("PS_SERVDIR");

  &TempxmlFile = &TempPath | "/files/TempElm.xml";
  &TempPath = &TempPath | "/files/NoNameSpace" | &FileDetails [2];

  &resultfile = GetFile(&ElmFile, "R", "UTF-8", %FilePath_Absolute);


  &linecount = 0;
  &WriteMode = "W";
  &Set = 1;

  If GPCH_EG_PRO_DW.GPCH_SI_PROV_TYPE <> "A" Then
     If GPCH_EG_PRO_DW.GPCH_SI_PROV_TYPE = "5" And
           &ReportType = "M" Then
        &setLine1 = 0;
        While &resultfile.ReadLine(&sTempVarA);
           &linecount = &linecount + 1;
           &sTempVarB = &sTempVarB | &sTempVarA;
           &subFlag = 0;
           If &linecount = 500 Then
              If &setLine1 = 0 Then

                  &strtpos = Find("<tnsb:FAK-CAF-BenefitDeclaration", &sTempVarB);
                  &endpos = Find(""">", &sTempVarB);
                  &endpos = &endpos + 1;
                  &endpos = &endpos - &strtpos + 1;
                  &sTempVarB = Replace(&sTempVarB, &strtpos, &endpos,
"<FAK-CAF-BenefitDeclaration>");
                  &setLine1 = 1;
               End-If;

              &sTempVarB = Substitute(&sTempVarB, "tnsb:", "");
              LogIt(&sTempVarB, &TempPath, &WriteMode);
              &linecount = 0;
              &sTempVarB = "";
              &sTempVarC = "";
              &WriteMode = "A";
              &subFlag = 1;
           End-If;

         End-While;
         If &subFlag = 0 Then
            If &setLine1 = 0 Then
               &strtpos = Find("<tnsb:FAK-CAF-BenefitDeclaration", &sTempVarB);
               &endpos = Find(""">", &sTempVarB);
               &endpos = &endpos + 1;
               &endpos = &endpos - &strtpos + 1;
               &sTempVarB = Replace(&sTempVarB, &strtpos, &endpos,
"<FAK-CAF-BenefitDeclaration>");
               &setLine1 = 1;
            End-If;
            &sTempVarB = Substitute(&sTempVarB, "tnsb:", "");
            LogIt(&sTempVarB, &TempPath, &WriteMode);
            &linecount = 0;
            &sTempVarB = "";
            &sTempVarC = "";
            &WriteMode = "A";
         End-If;


     Else
        While &resultfile.ReadLine(&sTempVarA)

           &linecount = &linecount + 1;
           &sTempVarB = &sTempVarB | &sTempVarA;
           &subFlag = 0;
           If &linecount = 500 Then
              &sTempVarC = SubstituteforALLDomains(&sTempVarB, &Set);
               LogIt(&sTempVarC, &TempPath, &WriteMode);
               &linecount = 0;
               &sTempVarB = "";
               &sTempVarC = "";
               &WriteMode = "A";
               &Set = 0;
               &subFlag = 1;
            End-If;

         End-While;
         If &subFlag = 0 Then
            &Set = 1;
            &sTempVarC = &sTempVarB;
            &sTempVarC = SubstituteforALLDomains(&sTempVarB, &Set);
            LogIt(&sTempVarC, &TempPath, &WriteMode);
            &linecount = 0;
            &sTempVarB = "";
            &sTempVarC = "";
            &WriteMode = "A";
         End-If;

      End-If;
   Else
      /* if Source tax then Add the Additional tags in the file */
      If GPCH_EG_PRO_DW.GPCH_TX_CANTON = "VD" Then

         &sTempVarB = "";
         While &resultfile.ReadLine(&sTempVarA)
            &sTempVarB = &sTempVarB | &sTempVarA;
         End-While;

         SQLExec("SELECT GPCH_EG_HDR_XML FROM PS_GPCH_EG_FHEADER WHERE COMPANY = :1 AND
GPCH_RC_PAY_YEAR =:2 AND GPCH_EG_DOMAINID= :3 AND GPCH_EG_REQUEST_ID=:4",
GPCH_EG_FSTATUS.COMPANY, GPCH_EG_FSTATUS.GPCH_RC_PAY_YEAR,
GPCH_EG_FSTATUS.GPCH_EG_DOMAINID, GPCH_EG_FSTATUS.GPCH_EG_REQUEST_ID, &FHeaderTag);
         &TempXml = CreateXmlDoc("");
         &TempXmlString = &TempXml.ParseXMLString("<?xml version=""1.0"" ?>" | &FHeaderTag);
         &TempNode1 = &TempXml.DocumentElement.FindNode("CompanyDescription");
         &TempNode2 =
&TempXml.DocumentElement.FindNode("GeneralSalaryDeclarationDescription");
         &xml = CreateXmlDoc("");
         &XmlString = &xml.ParseXMLString(&sTempVarB);
         &xml.DocumentElement.InsertNode(&TempNode1, 3);
         &xml.DocumentElement.InsertNode(&TempNode2, 4);
         &ChildNode1 = &xml.DocumentElement.GetChildNode(3);
         &RemovedNode = &ChildNode1.RemoveChildNode(3);
         &RemovedNode = &ChildNode1.RemoveChildNode(3);
         &ChildNode2 = &xml.DocumentElement.GetChildNode(4);
         &RemovedNode = &ChildNode2.RemoveChildNode(2);
         &RemovedNode = &ChildNode2.RemoveChildNode(3);
         &XmlString = &xml.GenFormattedXmlString();
         &CompanyDescription = "<CompanyDescription
xmlns=""http://www.swissdec.ch/schema/sd/20051002/SalaryDeclarationServiceTypes"">";
         &GeneralSalDec = "<GeneralSalaryDeclarationDescription
xmlns=""http://www.swissdec.ch/schema/sd/20051002/SalaryDeclarationServiceTypes"">";
         &XmlString = Substitute(&XmlString, &CompanyDescription, "<CompanyDescription>");
         &XmlString = Substitute(&XmlString, &GeneralSalDec,
"<GeneralSalaryDeclarationDescription>");

      End-If;


      &XML_FILE = GetFile(&TempPath, "W", "UTF-8", %FilePath_Absolute);
      &XML_FILE.WriteLine(&XmlString);
      &XML_FILE.Close();

   End-If;
   &FileName = &TempPath;

   Return &FileName;
End-Function;
      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Record): GPCH_EG_PRO_DW.SAVE_PB.FieldChange
      [ . . . Unchanged Code not Shown . . . ]




      /*****************************************************Start of Main
      Code***************************/
      Local array of string &FileDetails;
      Local string &ELMFile, &InternalFile;


      /*Populate the Derived record*/
      PopulateDerivedRecord();
      &fileDir = GPCH_EG_PRO_DW.FILE_OUTPUT_DIR;



      /* "ELMTRANSMIT" is the group under which all the properties are listed in the ELM online Setup*/
      &sConfigFile = getSetup("ELMTransmit", 3); /* call for Interoperability*/
      If (&sConfigFile <> "N") Then
         &SendResult = SendFile(&sConfigFile);

         &fileOutputDir = &fileDir | "/" | GPCH_EG_FSTATUS.GPCH_EG_REQUEST_ID;

         &ReturnStr = ReadReturnXml(&SendResult, 2);

         /*commenting this If condition to satisfy the condition that save should be allowed even
      if validation fails */
         rem If Upper(&ReturnStr) = "SUCCESS" Then ;

         If Upper(&ReturnStr) = "SUCCESS" Then
         /*******************Code for saving the File*********************** */

            /*******************Code for saving the File*************************/
         &FileDetails = CreateArray(" ", 0);

         &FileDetails = GetFileName();

         &ELMLocation = &FileDetails [1]| "/" | GPCH_EG_FSTATUS.GPCH_EG_REQUEST_ID;
         &ELMFile = &FileDetails [1]| "/" | GPCH_EG_FSTATUS.GPCH_EG_REQUEST_ID | "/secured" |
      &FileDetails [2];
         &FileSent = "secured" | &FileDetails [2];
         If Not FileExists(&ELMFile, %FilePath_Absolute) Then
            &ELMFile = &FileDetails [1]| "/" | GPCH_EG_FSTATUS.GPCH_EG_REQUEST_ID | "/sent" |
      &FileDetails [2];
            &FileSent = "sent" | &FileDetails [2];
         End-If;
         If IsUnix() Then
            DownloadFile(&FileSent, &ELMLocation);
         Else
            &InternalFile = Substitute(&ELMFile, "/", "\");
            &InternalFile = Substitute(&InternalFile, "\", "\\");

            If FileExists(&ELMFile, %FilePath_Absolute) Then
               DownloadFile(&FileSent, &ELMLocation);
            Else
               Error (MsgGetText(17051, 131, "No Message Found"));
            End-If;
         End-If;
         rem End-If;
      End-If;
      End-If;
      GetLevel0().Refresh();




PeopleCode (Record): GPCH_EG_STAT_DW.FUNCLIB.FieldFormula
      [ . . . Unchanged Code not Shown . . . ]


      Function SetRunStatus()
         &rstatus_Stats = GetLevel0().GetRow(1).GetRowset(Scroll.GPCH_EG_RSTATUS);

         &SetBreakFlag = False;
         For &k = 1 To &rstatus_Stats.ActiveRowCount

            &Rstatus_Providr_type =
      &rstatus_Stats.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.value;
            rem SQLExec("Select GPCH_EG_RPT_TYPE from PS_GPCH_EG_REPORTS where RUN_CNTL_ID=:1 and
      GPCH_EG_DOMAINID=:2 and GPCH_RC_PAY_YEAR=:3 and GPCH_SI_PROV_TYPE=:4 and OPRID=:5",
      GPCH_RC_PAYROLL.RUN_CNTL_ID, GPCH_RC_PAYROLL.GPCH_EG_DOMAINID,
      GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR, &Rstatus_Prov_type_1, GPCH_RC_PAYROLL.OPRID,
      &Report_Type_M);

            Evaluate Upper(&rstatus_Stats.GetRow(&k).GPCH_EG_RSTATUS.GPCH_REPORT_STATUS.Value)
            When "0004"
               &rstatus_Stats.GetRow(&k).GPCH_EG_STAT_DW.GPCH_RUN_OPTIONS.Value = "Y";

               For &i = &k - 1 To 1 Step - 1;
                  &Rstatus_Providr_type1 =
      &rstatus_Stats.GetRow(&i).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.value;
                  &Rstatus_CalPayEndDt =
      &rstatus_Stats.GetRow(&i).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.value;

                  &rstatus_Stats.GetRow(&i).GPCH_EG_STAT_DW.GPCH_RUN_OPTIONS.Value = "Y";
                  &rstatus_Stats.GetRow(&i).GPCH_EG_RSTATUS.GPCH_REPORT_STATUS.Value = "0004"
               End-For;
               &SetBreakFlag = True;
               Break;
            When "0001"

               If &rstatus_Stats.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.value = "B" Then
                  &rstatus_Stats.GetRow(&k).GPCH_EG_STAT_DW.GPCH_RUN_OPTIONS.Value = "Y";
               Else
                  &rstatus_Stats.GetRow(&k).GPCH_EG_STAT_DW.GPCH_RUN_OPTIONS.Value = "N";
               End-If;

               &SetBreakFlag = False;
               Break;

            When "0008"
               Break;
            When-Other
               Break;
            End-Evaluate;

            If (&SetBreakFlag) Then
               Break;
            End-If;
         End-For;
      End-Function;

      Function GetAdditional_Data_Status()
         &rc_payroll = CreateRowset(Record.GPCH_RC_PAYROLL);
         &rc_payroll.Fill("WHERE OPRID =:1 AND RUN_CNTL_ID =:2 ", %OperatorId,
      GPCH_RC_PAYROLL.RUN_CNTL_ID);
         SQLExec("select COMPANY from PS_GPCH_RC_COMPANY Where OPRID = :1 AND RUN_CNTL_ID = :2",
      %OperatorId, GPCH_RC_PAYROLL.RUN_CNTL_ID, &RC_COMP);
         rem SQLExec("Select GPCH_TX_CANTON from PS_GPCH_RC_CANTON Where OPRID = :1 AND RUN_CNTL_ID
      = :2", %OperatorId, &RunControl, &RC_Canton);
   SQLExec("Select EMPLID from PS_GPCH_RC_EMPLID Where OPRID = :1 AND RUN_CNTL_ID = :2",
%OperatorId, GPCH_RC_PAYROLL.RUN_CNTL_ID, &RC_Emplid);

  &RS1 = GetLevel0();
  &RS2 = &RS1(1).GetRowset(Scroll.GPCH_EG_RSTATUS);

   For &k = 1 To &RS2.ActiveRowCount;
      &Row1 = &RS2.GetRow(&k);
      /*--------------------For Identify
------------------------------------------------*/
      If &Row1.GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value = "0" Then

        rem &Row1.GPCH_EG_STAT_DW.DETAILS_LINK.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = False;

     End-If;

     /*--------------------For AHV ------------------------------------------------*/
     If &Row1.GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value = "7" Then
        /* If &rc_payroll.GetRow(1).GPCH_RC_PAYROLL.GPCH_TX_CANTON.Value <> "" Or
              &rc_payroll.GetRow(1).GPCH_RC_PAYROLL.GPCH_RC_AHV_AMNT.Value <> "" Or
              &rc_payroll.GetRow(1).GPCH_RC_PAYROLL.GPCH_RC_ALV1_AMNT.Value <> "" Or
              &rc_payroll.GetRow(1).GPCH_RC_PAYROLL.GPCH_RC_ALV2_AMNT.Value <> "" Then
           &Row1.GPCH_EG_STAT_DW.GPCH_EG_ADD_DTA.Value = "Y";
        Else
           &Row1.GPCH_EG_STAT_DW.GPCH_EG_ADD_DTA.Value = "N";
        End-If;*/

        &Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = False;
     End-If;
     /*------------------------------------------------------------------------------*/

      /*------------------For FAK Yearly
-----------------------------------------------------*/
      If &Row1.GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value = "5" Then
         SQLExec("Select GPCH_EG_RPT_TYPE from PS_GPCH_EG_REPORTS where RUN_CNTL_ID=:1 and
GPCH_EG_DOMAINID=:2 and GPCH_RC_PAY_YEAR=:3 and GPCH_SI_PROV_TYPE=:4 and OPRID=:5",
GPCH_RC_PAYROLL.RUN_CNTL_ID, GPCH_RC_PAYROLL.GPCH_EG_DOMAINID,
GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR, "5", GPCH_RC_PAYROLL.OPRID, &Report_FAK_Type);
         /*If &rc_payroll.GetRow(1).GPCH_RC_PAYROLL.DEPTID.Value <> "" Or
               &rc_payroll.GetRow(1).GPCH_RC_PAYROLL.GPCH_TX_CANTON.Value <> "" Or
               &RC_Emplid <> "" Then

           &Row1.GPCH_EG_STAT_DW.GPCH_EG_ADD_DTA.Value = "Y";
        Else

           &Row1.GPCH_EG_STAT_DW.GPCH_EG_ADD_DTA.Value = "N";
        End-If;*/
        &Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Visible = True;
        rem &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = False;
        rem &Row1.GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = False;
        rem &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = False;

        If ((&Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Value = "M" And
                    &Row1.GPCH_EG_RSTATUS.GPCH_REPORT_STATUS.Value = "0001") Or
                 (&Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Value = "M" And
                    &Report_FAK_Type = "")) Then
           &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = True;
        Else
           &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = False;
        End-If;
        If &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Value = "Y" Then
           rem &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Value = "N";
           &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = False;
           &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Value = "";
           &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Enabled = True;
           &Row1.GPCH_EG_RSTATUS.GPCH_REPORT_STATUS.Value = "0008";
           &Row1.GPCH_EG_STAT_DW.GPCH_RUN_OPTIONS.Value = "Y";
           &Row1.GPCH_EG_STAT_DW.GPCH_RUN_OPTIONS.Enabled = True;
        End-If;
     End-If;
     /*--------UVG-LAA------------*/
     If &Row1.GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value = "2" Then
        /* If &rc_payroll.GetRow(1).GPCH_RC_PAYROLL.PAY_ENTITY.Value <> "" Then
           &Row1.GPCH_EG_STAT_DW.GPCH_EG_ADD_DTA.Value = "Y";
        Else
           &Row1.GPCH_EG_STAT_DW.GPCH_EG_ADD_DTA.Value = "N";
        End-If;*/

        &Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = False;
     End-If;
     /*------------KTG-AMC-------------*/

     If &Row1.GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value = "3" Then

        rem &Row1.GPCH_EG_STAT_DW.DETAILS_LINK.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = False;
     End-If;
     /*------------UVGZ-LAAC-------------*/

     If &Row1.GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value = "4" Then

        rem &Row1.GPCH_EG_STAT_DW.DETAILS_LINK.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = False;
     End-If;

     /*------------BVG-LPP-------------*/

     If &Row1.GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value = "6" Then

        rem &Row1.GPCH_EG_STAT_DW.DETAILS_LINK.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = False;
        &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = False;
     End-If;

     /*------------------For SalaryStructure -----------------------------------------*/
     If &Row1.GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value = "9" Then
        /* If &rc_payroll.GetRow(1).GPCH_RC_PAYROLL.GPCH_AL_CPAY_ENDDT.Value <> "" Or
              &rc_payroll.GetRow(1).GPCH_RC_PAYROLL.GPCH_RC_COUNT_METH.Value <> "" Then
           &Row1.GPCH_EG_STAT_DW.GPCH_EG_ADD_DTA.Value = "Y";
        Else
           &Row1.GPCH_EG_STAT_DW.GPCH_EG_ADD_DTA.Value = "N";
        End-If;*/

         &Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Visible = False;
         &Row1.GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = False;
         &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = False;
         &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = False;
      End-If;
      /*-------------------------------------------------------------------------------*/
      /*------------------For Tax Statement -------------------------------------------*/
      If &Row1.GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value = "8" Then
         /* SQLExec("select DEPTID,GPCH_RC_APLY_SPLIT,GPCH_RC_INC_P_CALC from
PS_GPCH_RC_TX07 Where OPRID = :1 AND RUN_CNTL_ID = :2", %OperatorId,
GPCH_RC_PAYROLL.RUN_CNTL_ID, &Deptid, &Split, &Pending_cal);
   If &Deptid <> "" Or
         &Split <> "" Or
         &Pending_cal <> "" Or
         &RC_COMP <> "" Or
         &RC_Canton <> "" Or
         &RC_Emplid <> "" Then
      &Row1.GPCH_EG_STAT_DW.GPCH_EG_ADD_DTA.Value = "Y";
   Else
      &Row1.GPCH_EG_STAT_DW.GPCH_EG_ADD_DTA.Value = "N";
   End-If;*/
   &Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Visible = False;
   &Row1.GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = False;
   &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = False;
   &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = False;
End-If;

/*-------------------------------------------------------------------------------*/
/**********************Source Tax**************************************************/
If &Row1.GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value = "A" Then
   &Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Visible = True;
   rem &Row1.GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = False;
   rem &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = False;
   If &Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Value = "M" And
   &Row1.GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = False;
   &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = False;
   If (&Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Value = "M" Or
            &Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Value = "Q") And
         &Row1.GPCH_EG_RSTATUS.GPCH_REPORT_STATUS.Value = "0001" Then
      &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = True;
   Else
      &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = False;
   End-If;
   If &Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Value = "M" Then
      &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = True;
   End-If;

   If &Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Value = "Q" Then
      &Row1.GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = True;
      &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = True;
   End-If;
   If &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Value = "Y" Then
      rem &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Value = "N";
      &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = False;
      &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Value = "";
      &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Enabled = True;
      &Row1.GPCH_EG_RSTATUS.GPCH_REPORT_STATUS.Value = "0008";
      &Row1.GPCH_EG_STAT_DW.GPCH_RUN_OPTIONS.Value = "Y";
      &Row1.GPCH_EG_STAT_DW.GPCH_RUN_OPTIONS.Enabled = True;
      If &Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Value = "Q" Then
         &Row1.GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Value = " ";
         &Row1.GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = True;
         &Row1.GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Enabled = True;
         &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = False;
      End-If;
      If &Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Value = "M" Then
         &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Value = "";
         &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = True;
         &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Enabled = True;
      End-If;
   End-If;
End-If;

/******************************Generate File**************************************/
If &Row1.GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value = "B" Then
   rem &Row1.GPCH_EG_STAT_DW.DETAILS_LINK.Visible = False;
   &Row1.GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Visible = False;
   &Row1.GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = False;
   &Row1.GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = False;
   &Row1.GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = False;
End-If;
      /*********************************************************************************/

   End-For;

End-Function;


Function Get_status()
   &stheader = GetLevel0().GetRow(1).GetRowset(Scroll.GPCH_EG_ST_HDR);
   &rstaus = GetLevel0().GetRow(1).GetRowset(Scroll.GPCH_EG_RSTATUS);
   &fstaus = GetLevel0().GetRow(1).GetRowset(Scroll.GPCH_EG_FSTATUS);
   &pstaus = GetLevel0().GetRow(1).GetRowset(Scroll.GPCH_EG_PSTATUS);
   &pstaus_view = CreateRowset(Record.GPCH_EG_PSTA_VW);

   &stheader.GetRow(1).DeleteEnabled = False;

   For &k = 1 To &rstaus.ActiveRowCount
      Local boolean &status_flag = False;
      &pstaus_view.Fill("WHERE COMPANY =:1 AND GPCH_EG_DOMAINID= :2 AND GPCH_SI_PROV_TYPE =:3
and GPCH_RC_PAY_YEAR=:4   ", GPCH_RC_PAYROLL.COMPANY, GPCH_RC_PAYROLL.GPCH_EG_DOMAINID,
&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value,
GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR);
      &pstaus_view.Fill("WHERE COMPANY =:1 AND GPCH_EG_DOMAINID= :2 AND GPCH_SI_PROV_TYPE =:3
and GPCH_RC_PAY_YEAR=:4 order by COMPANY ,GPCH_RC_PAY_YEAR
,GPCH_EG_DOMAINID,GPCH_EG_REQUEST_ID ", GPCH_RC_PAYROLL.COMPANY,
GPCH_RC_PAYROLL.GPCH_EG_DOMAINID,
&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value,
GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR);
      SQLExec("select %DateOut(GPCH_AL_CPAY_ENDDT),GPCH_FK_QUARTER from PS_GPCH_RC_PAYROLL
where RUN_CNTL_ID=:1 and OPRID=:2", GPCH_RC_PAYROLL.RUN_CNTL_ID, GPCH_RC_PAYROLL.OPRID,
&CalEndDate, &FkQuarter);

      &Rstatus_Prov_type_1 = &rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.value;
      SQLExec("Select GPCH_EG_RPT_TYPE from PS_GPCH_EG_REPORTS where RUN_CNTL_ID=:1 and
GPCH_EG_DOMAINID=:2 and GPCH_RC_PAY_YEAR=:3 and GPCH_SI_PROV_TYPE=:4 and OPRID=:5",
GPCH_RC_PAYROLL.RUN_CNTL_ID, GPCH_RC_PAYROLL.GPCH_EG_DOMAINID,
GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR, &Rstatus_Prov_type_1, GPCH_RC_PAYROLL.OPRID,
&Report_Type_M);

      /* If the user is a Power user then Dashboard Delete should be enabled*/
      SQLExec("select GPCH_EG_PROP_LONG from PS_GPCH_EG_VAL_PRS where GPCH_EG_PRCS_NM=:1 and
GPCH_EG_PROP_NM =:2", "ELMTransmit", "PowerUser", &PowerUser);

      If &PowerUser = "Y" Then
         &stheader.GetRow(1).DeleteEnabled = True;
      Else
         &stheader.GetRow(1).DeleteEnabled = False;
      End-If;

      &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.value = &Report_Type_M;
      &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.enabled = False;
      &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = False;
      Evaluate Upper(&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_REPORT_STATUS.Value)
      When "0008"

         &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_CANCEL_OPTION.enabled = False;

         &SetNoRowsflag = False;
         For &i = 1 To &fstaus.ActiveRowCount
            If &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_SI_PROV_TYPE.value =
&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value Then
            &fstaus.GetRow(&i).DeleteEnabled = False;
            If &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_SI_PROV_TYPE.value =
&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value Or
                  None(&fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_SI_PROV_TYPE.value) Then
               &fstaus.GetRow(&i).GPCH_EG_PRO_DW.SAVE_PB.enabled = False;
               &fstaus.GetRow(&i).GPCH_EG_PRO_DW.PRINT_BTN.enabled = False;
               &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_PING.enabled = False;
               &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_SEND.enabled = False;
               &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_VALIDATE.enabled = False;
               &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_RESEND.enabled = False;
               &fstaus.GetRow(&i).DeleteEnabled = False;
               If &fstaus.ActiveRowCount = 1 And
                     None(&fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_SI_PROV_TYPE.value) Then
                  &SetNoRowsflag = True;
               End-If;
            End-If;
         End-For;
         For &j = 1 To &pstaus.ActiveRowCount
            If &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_SI_PROV_TYPE.Value =
&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value Then
            If &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_SI_PROV_TYPE.Value =
&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value Or
                  None(&pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_SI_PROV_TYPE.Value) Then
               &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.GPCH_EG_ILOG.enabled = False;
               &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.GPCH_EG_ELOG.enabled = False;
               &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.COMPLETE.enabled = False;
               &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_EG_COMPLETE.enabled = False;
            End-If;
         End-For;
         &Rstatus_Prov_type = &rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value;

         SQLExec("Select GPCH_EG_RPT_TYPE from PS_GPCH_EG_REPORTS where RUN_CNTL_ID=:1 and
GPCH_EG_DOMAINID=:2 and GPCH_RC_PAY_YEAR=:3 and GPCH_SI_PROV_TYPE=:4 and OPRID=:5",
GPCH_RC_PAYROLL.RUN_CNTL_ID, GPCH_RC_PAYROLL.GPCH_EG_DOMAINID,
GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR, &Rstatus_Prov_type, GPCH_RC_PAYROLL.OPRID, &Report_Type);
         If &Report_Type = "" Then
            &Report_Type = "M";
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.value = &Report_Type;
            rem &Report_Type = "M";
            rem &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.value = &Report_Type;
            &rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_REPORT_STATUS.Value = "0008";
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.enabled = False;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.enabled = True;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = True;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.enabled = True;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.enabled = False;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = False;
            &CalEndDate = "";
         Else
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.value = &Report_Type;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.enabled = False;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = False;
         End-If;

         If &Report_Type = "Q" Then
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.value = &FkQuarter;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.value = &FkQuarter;;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = True;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = False;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Enabled = False;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Enabled = False;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Enabled = False;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = True;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.value = &CalEndDate;
         End-If;

         If &Report_Type = "M" Then
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.value = &CalEndDate;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = False;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = True;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Enabled = False;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Enabled = False;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Enabled = False;

         End-If;
      When "0001"

         &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_CANCEL_OPTION.Enabled = True;

         &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = True;
         For &m = 1 To &pstaus_view.ActiveRowCount
            &internal_status =
Upper(&pstaus_view.getrow(&m).GPCH_EG_PSTA_VW.GPCH_REPORT_STATUS.value);
            &extrnal_status =
Upper(&pstaus_view.getrow(&m).GPCH_EG_PSTA_VW.GPCH_RPT_E_STATUS.value);
            &Transmode =
Upper(&pstaus_view.getrow(&m).GPCH_EG_PSTA_VW.GPCH_EG_TRANS_MODE.value);


            For &j = 1 To &pstaus.ActiveRowCount
               If &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_SI_PROV_TYPE.Value =
&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value And
                     &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_EG_REQUEST_ID.value =
&pstaus_view.getrow(&m).GPCH_EG_PSTA_VW.GPCH_EG_REQUEST_ID.value Then
                  &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.COMPLETE.enabled = False;
                  &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_EG_COMPLETE.enabled = False;
               End-If;
            End-For;
            If &extrnal_status = "0002" Then
               &extrnal_status = "0001"
            End-If;
            If (&internal_status = "0004" Or
                     &internal_status = "0010") And
                  &extrnal_status = "0008" Then
               If &internal_status = "0010" Then
                  For &i = 1 To &fstaus.ActiveRowCount
                     &fstaus.GetRow(&i).DeleteEnabled = False;
                     If &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_SI_PROV_TYPE.value =
&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value And
                           &fstaus.GetRow(&i).GPCH_EG_FSTATUS.GPCH_EG_REQUEST_ID.value =
&pstaus_view.getrow(&m).GPCH_EG_PSTA_VW.GPCH_EG_REQUEST_ID.value Then;
                        If &Report_Type_M = "M" Then
                           &fstaus.GetRow(&i).GPCH_EG_FSTATUS.GPCH_EG_REQUEST_ID.value =
&pstaus_view.getrow(&m).GPCH_EG_PSTA_VW.GPCH_EG_REQUEST_ID.value Then
                        If (&Report_Type_M = "M" Or
                                 &Report_Type_M = "Q") And
                              &i = &fstaus.ActiveRowCount Then
                           &fstaus.GetRow(&i).DeleteEnabled = True;
                        Else

                           &fstaus.GetRow(&i).DeleteEnabled = False;

                        End-If;
                        &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_SEND.enabled = True;
                        &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_RESEND.enabled = False;
                     End-If;
                  End-For;
               Else
                  For &i = 1 To &fstaus.ActiveRowCount
                     &fstaus.GetRow(&i).DeleteEnabled = False;
                     If &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_SI_PROV_TYPE.value =
&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value And
                           &fstaus.GetRow(&i).GPCH_EG_FSTATUS.GPCH_EG_REQUEST_ID.value =
&pstaus_view.getrow(&m).GPCH_EG_PSTA_VW.GPCH_EG_REQUEST_ID.value Then;

                       &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_SEND.enabled = False;
                       &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_RESEND.enabled = True;
                    End-If;
                 End-For;
              End-If;

               For &j = 1 To &pstaus.ActiveRowCount
                  If &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_SI_PROV_TYPE.Value =
&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value And
                        &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_EG_REQUEST_ID.value =
&pstaus_view.getrow(&m).GPCH_EG_PSTA_VW.GPCH_EG_REQUEST_ID.value Then
                     &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.GPCH_EG_ILOG.enabled = True;
                     &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.GPCH_EG_ELOG.enabled = False;
                     &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.COMPLETE.enabled = False;
                     &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_EG_COMPLETE.enabled = False;
                  End-If;
               End-For;
           End-If;
           If &internal_status = "0008" And
                 &extrnal_status = "0008" Then
              &status_flag = True;

              For &i = 1 To &fstaus.ActiveRowCount

                  &fstaus.GetRow(&i).DeleteEnabled = False;
                  If &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_SI_PROV_TYPE.value =
&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value And
                        &fstaus.GetRow(&i).GPCH_EG_FSTATUS.GPCH_EG_REQUEST_ID.value =
&pstaus_view.getrow(&m).GPCH_EG_PSTA_VW.GPCH_EG_REQUEST_ID.value Then

                     &fstaus.GetRow(&i).GPCH_EG_PRO_DW.SAVE_PB.enabled = True;
                     &fstaus.GetRow(&i).GPCH_EG_PRO_DW.PRINT_BTN.enabled = True;
                     &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_PING.enabled = True;
                     &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_SEND.enabled = True;
                     &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_RESEND.enabled = False;
                     &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_VALIDATE.enabled = True;
                     If &Report_Type_M = "M" Then

                    If (&Report_Type_M = "M" Or
                             &Report_Type_M = "Q") And
                          &i = &fstaus.ActiveRowCount Then
                       &fstaus.GetRow(&i).DeleteEnabled = True;
                    Else
                       &fstaus.GetRow(&i).DeleteEnabled = False;
                    End-If;
                 End-If;
              End-For;

               For &j = 1 To &pstaus.ActiveRowCount
                  If &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_SI_PROV_TYPE.Value =
&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value And
                        &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_EG_REQUEST_ID.value =
&pstaus_view.getrow(&m).GPCH_EG_PSTA_VW.GPCH_EG_REQUEST_ID.value Then
                     &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.GPCH_EG_ILOG.enabled = False;
                     &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.GPCH_EG_ELOG.enabled = False;
                     &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.COMPLETE.enabled = True;
                     &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.COMPLETE.enabled = False;
                     &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_EG_COMPLETE.enabled = False;
                  End-If;
               End-For;
            End-If;

           If (&internal_status = "0001" And
                    &extrnal_status = "0008") Or
                 (&internal_status = "0001" And
                    &extrnal_status = "0005") Then
              &status_flag = True;

               For &i = 1 To &fstaus.ActiveRowCount
                  &fstaus.GetRow(&i).DeleteEnabled = False;
                  If &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_SI_PROV_TYPE.value =
&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value And
                        &fstaus.GetRow(&i).GPCH_EG_FSTATUS.GPCH_EG_REQUEST_ID.value =
&pstaus_view.getrow(&m).GPCH_EG_PSTA_VW.GPCH_EG_REQUEST_ID.value Then

                     &Temp_FRequest_ID =
&fstaus.GetRow(&i).GPCH_EG_FSTATUS.GPCH_EG_REQUEST_ID.value;
                     &fstaus.GetRow(&i).GPCH_EG_PRO_DW.SAVE_PB.enabled = True;
                     &fstaus.GetRow(&i).GPCH_EG_PRO_DW.PRINT_BTN.enabled = True;
                     &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_PING.enabled = True;
                     If &extrnal_status = "0005" Then
                        &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_SEND.enabled = False;
                        &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_RESEND.enabled = True;
                     Else
                        &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_SEND.enabled = True;
                        &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_RESEND.enabled = False;
                     End-If;
                     &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_VALIDATE.enabled = True;
                     If &Report_Type_M = "M" Then
                     If (&Report_Type_M = "M" Or
                              &Report_Type_M = "Q") And
                           &i = &fstaus.ActiveRowCount Then
                        &fstaus.GetRow(&i).DeleteEnabled = True;
                     Else
                        &fstaus.GetRow(&i).DeleteEnabled = False;
                     End-If;
                     SQLExec("Select GPCH_EG_COMPLETE from PS_GPCH_EG_PSTATUS where
GPCH_EG_REQUEST_ID=:1", &Temp_FRequest_ID, &Complete_Flag);
                     If &Transmode = 1 And
                           &Complete_Flag = "Y" Then
                        &fstaus.GetRow(&i).GPCH_EG_PRO_DW.SAVE_PB.enabled = False;
                        &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_VALIDATE.enabled =
False;
                        &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_RESEND.enabled = True;
                        &fstaus.GetRow(&i).DeleteEnabled = False;
                     End-If;


                  End-If;
               End-For;
               For &j = 1 To &pstaus.ActiveRowCount

                  If &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_SI_PROV_TYPE.Value =
&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value And
                        &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_EG_REQUEST_ID.value =
&pstaus_view.getrow(&m).GPCH_EG_PSTA_VW.GPCH_EG_REQUEST_ID.value Then

                     If &extrnal_status <> "0005" Then
                        &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.GPCH_EG_ILOG.enabled = True;
                        &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.GPCH_EG_ELOG.enabled = False;
                     Else

                        &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.GPCH_EG_ILOG.enabled = True;
                        &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.GPCH_EG_ELOG.enabled = True;
                     End-If;
                     If &Transmode = 1 Then
                        &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.COMPLETE.enabled = False;
                        &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_EG_COMPLETE.enabled =
True;
                     Else

                        &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.COMPLETE.enabled = False;
                        &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_EG_COMPLETE.enabled =
False;
                     End-If;
                  End-If;
               End-For;
            End-If;


            If (&internal_status = "0001" And
                     &extrnal_status = "0001") Or
                  (&internal_status = "0001" And
                     &extrnal_status = "0006") Then

               &status_flag = True;
               For &i = 1 To &fstaus.ActiveRowCount
                  &fstaus.GetRow(&i).DeleteEnabled = False;
                  If &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_SI_PROV_TYPE.value =
&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value And
                        &fstaus.GetRow(&i).GPCH_EG_FSTATUS.GPCH_EG_REQUEST_ID.value =
&pstaus_view.getrow(&m).GPCH_EG_PSTA_VW.GPCH_EG_REQUEST_ID.value Then
                     &fstaus.GetRow(&i).GPCH_EG_PRO_DW.SAVE_PB.enabled = True;
                     &fstaus.GetRow(&i).GPCH_EG_PRO_DW.PRINT_BTN.enabled = True;
                     &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_PING.enabled = True;
                     Rem If &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_SEND.enabled <> False
And
                           &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_RESEND.enabled =
False Then;
                     &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_SEND.enabled = False;
                     &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_RESEND.enabled = True;
                     rem End-If;
                     &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_VALIDATE.enabled = True;
                     If &Report_Type_M = "M" Then
                     If &Report_Type_M = "M" Or
                           &Report_Type_M = "Q" Then
                        &fstaus.GetRow(&i).DeleteEnabled = False;
                     End-If;
                  End-If;
               End-For;
               For &j = 1 To &pstaus.ActiveRowCount
                  If &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_SI_PROV_TYPE.Value =
&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value And
                        &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_EG_REQUEST_ID.value =
&pstaus_view.getrow(&m).GPCH_EG_PSTA_VW.GPCH_EG_REQUEST_ID.value Then
                     &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.GPCH_EG_ILOG.enabled = True;
                     &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.GPCH_EG_ELOG.enabled = True;
                     If &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_EG_COMPLETE.Value = "Y"
Then
                        &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.COMPLETE.enabled = False;
                        &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_EG_COMPLETE.enabled =
True;
                     Else
                        If &extrnal_status <> "0006" Then
                           &pstaus.GetRow(&j).GPCH_EG_PSTA_DW.COMPLETE.enabled = True;
                           &pstaus.GetRow(&j).GPCH_EG_PSTATUS.GPCH_EG_COMPLETE.enabled =
True;
                        End-If;
                     End-If;
                  End-If;
               End-For;
               &stheader.GetRow(1).DeleteEnabled = False;

           End-If;
        End-For;

        If &internal_status = "0001" And
              (&extrnal_status = "0004" Or
                 &extrnal_status = "0006") Then

           &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_CANCEL_OPTIONS.value = "Y";
           &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_CANCEL_OPTIONS.enabled = True;
           &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_RUN_OPTIONS.value = "N";
           &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_RUN_OPTIONS.enabled = False;

           For &i = 1 To &fstaus.ActiveRowCount
              &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_SEND.enabled = False;
              &fstaus.GetRow(&i).GPCH_EG_PRO_DW.GPCH_EG_RESEND.enabled = True;
              If &Report_Type_M = "Y" Then
                 &fstaus.GetRow(&i).DeleteEnabled = False;
              End-If;
           End-For;


        End-If;


         If &status_flag = True Then
            REM   &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_CANCEL_OPTION.value = "N";
            REM    &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_CANCEL_OPTION.Enabled = False;
            &Rstatus_Prov_type =
&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.value;
            If (&Rstatus_Prov_type = 0 Or
                     &Rstatus_Prov_type = "B") Then
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.enabled = False;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.visible = False;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.visible = False;
            End-If;
            SQLExec("Select GPCH_EG_RPT_TYPE from PS_GPCH_EG_REPORTS where RUN_CNTL_ID=:1
and GPCH_EG_DOMAINID=:2 and GPCH_RC_PAY_YEAR=:3 and GPCH_SI_PROV_TYPE=:4 and OPRID=:5",
GPCH_RC_PAYROLL.RUN_CNTL_ID, GPCH_RC_PAYROLL.GPCH_EG_DOMAINID,
GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR, &Rstatus_Prov_type, GPCH_RC_PAYROLL.OPRID, &Report_Type);
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_RUN_OPTIONS.value = "N";
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_RUN_OPTIONS.enabled = False;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.value = &Report_Type;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.enabled = False;

            If &Report_Type = "Q" Then
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.value =
GPCH_RC_PAYROLL.GPCH_FK_QUARTER;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.value =
GPCH_RC_PAYROLL.GPCH_AL_CPAY_ENDDT;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = True;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.ENABLED = False;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = False;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.enabled = False;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = True;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Enabled = False;
               REM &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.enabled = False;

            End-If;

            If &Report_Type = "M" Then
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.value =
GPCH_RC_PAYROLL.GPCH_AL_CPAY_ENDDT;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = False;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = True;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Enabled = False;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Enabled = False;
            End-If;
         Else
            &Rstatus_Prov_type =
&rstaus.GetRow(&k).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.value;
            If (&Rstatus_Prov_type = 0 Or
                     &Rstatus_Prov_type = "B") Then
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.enabled = False;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.visible = False;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.visible = False;
            End-If;
            SQLExec("Select GPCH_EG_RPT_TYPE from PS_GPCH_EG_REPORTS where RUN_CNTL_ID=:1
and GPCH_EG_DOMAINID=:2 and GPCH_RC_PAY_YEAR=:3 and GPCH_SI_PROV_TYPE=:4 and OPRID=:5",
GPCH_RC_PAYROLL.RUN_CNTL_ID, GPCH_RC_PAYROLL.GPCH_EG_DOMAINID,
GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR, &Rstatus_Prov_type, GPCH_RC_PAYROLL.OPRID, &Report_Type);
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.value = &Report_Type;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.enabled = False;
            &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Value = &CalEndDate;


            If &Report_Type = "Q" Then
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.value =
GPCH_RC_PAYROLL.GPCH_FK_QUARTER;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.value = &FkQuarter;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = True;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.ENABLED = False;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = False;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.enabled = False;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = True;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Enabled = False;
               rem &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.enabled = False;

            End-If;

            If &Report_Type = "M" Then
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.value =
GPCH_RC_PAYROLL.GPCH_AL_CPAY_ENDDT;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.value = &CalEndDate;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Visible = False;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Visible = True;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Enabled = False;
               &rstaus.GetRow(&k).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Enabled = False;
            End-If;
        End-If;
     End-Evaluate;

  End-For;

End-Function;

[ . . . Unchanged Code not Shown . . . ]

Function GetCalDates(&sRequestId As string) Returns array of string

  Local array of string &ReturnDates;
  &ReturnDates = CreateArray(" ", 3);
  &ReturnDates = CreateArray(" ", 4);
  &array = Split(&sRequestId, "-");
  &Year = &array [1];
  &reportType = &array [4];
  &Month = &array [5];
  &Month = Value(&Month);
  &Quarter = 0;
  If &reportType = "Q" Then
     &Quarter = Value(&Month);
     &Month = Value(&Month) + 2;
  End-If;

  If &Month = "01" Or
        &Month = "03" Or
        &Month = "05" Or
        &Month = "07" Or
        &Month = "08" Or
  If &Month = "1" Or
        &Month = "3" Or
        &Month = "5" Or
        &Month = "7" Or
        &Month = "8" Or
        &Month = "10" Or
        &Month = "12" Then
     &Day = 31
  End-If;

  If &Month = "04" Or
        &Month = "06" Or
        &Month = "09" Or
  If &Month = "4" Or
        &Month = "6" Or
        &Month = "9" Or
        &Month = "11" Then
     &Day = 30
  End-If;

  If &Month = "02" Then
  If &Month = "2" Then
     If (((Mod(Value(&Year), 4) = 0) And
                 (Mod(Value(&Year), 100) <> 0)) Or
              (Mod(Value(&Year), 400) = 0)) Then
        &Day = 29;
     Else
        &Day = 28;
     End-If;
  End-If;

  &EndDate = Date3(Value(&Year), Value(&Month), Value(&Day));
  &BeginDt = Date3(Value(&Year), Value(&Month), 1);

  &ReturnDates [1] = &BeginDt;
  &ReturnDates [2] = &EndDate;

  &ReturnDates [3] = &Quarter;
  Return &ReturnDates;
      End-Function;

      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Record): GPCH_EG_STAT_DW.GPCH_FK_QUARTER.FieldChange
      If GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE = "Q" And
            Not None(GPCH_EG_STAT_DW.GPCH_FK_QUARTER) And
            GPCH_EG_STAT_DW.GPCH_CANCEL_OPTION <> "Y" Then
         SQLExec("select %dateout(GPCH_AL_CPAY_ENDDT) from PS_GPCH_EG_REPORTS where
      OPRID=%OperatorId and RUN_CNTL_ID=:1 and GPCH_EG_DOMAINID=:2 and GPCH_RC_PAY_YEAR=:3 and
      COMPANY=:4 and GPCH_SI_PROV_TYPE=:5 and GPCH_EG_RPT_TYPE=:6 and GPCH_FK_QUARTER = :7",
      GPCH_RC_PAYROLL.RUN_CNTL_ID, GPCH_EG_RSTATUS.GPCH_EG_DOMAINID,
      GPCH_EG_RSTATUS.GPCH_RC_PAY_YEAR, GPCH_EG_RSTATUS.COMPANY,
      GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE, GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE,
      GPCH_EG_STAT_DW.GPCH_FK_QUARTER, &CalEndDt);

         If Not None(&CalEndDt) Then
            Error MsgGet(17051, 182, "Message not found");
         End-If;

      End-If;




PeopleCode (Record): GPCH_EG_STAT_DW.GPCH_FK_QUARTER.FieldEdit
      If GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE = "Q" And
            Not None(GPCH_EG_STAT_DW.GPCH_FK_QUARTER) And
            GPCH_EG_STAT_DW.GPCH_CANCEL_OPTION <> "Y" Then
         SQLExec("select %dateout(GPCH_AL_CPAY_ENDDT) from PS_GPCH_EG_REPORTS where
      OPRID=%OperatorId and RUN_CNTL_ID=:1 and GPCH_EG_DOMAINID=:2 and GPCH_RC_PAY_YEAR=:3 and
      COMPANY=:4 and GPCH_SI_PROV_TYPE=:5 and GPCH_EG_RPT_TYPE=:6 and GPCH_FK_QUARTER = :7",
      GPCH_RC_PAYROLL.RUN_CNTL_ID, GPCH_EG_RSTATUS.GPCH_EG_DOMAINID,
      GPCH_EG_RSTATUS.GPCH_RC_PAY_YEAR, GPCH_EG_RSTATUS.COMPANY,
      GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE, GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE,
      GPCH_EG_STAT_DW.GPCH_FK_QUARTER, &CalEndDt);

         If Not None(&CalEndDt) Then
            Error MsgGet(17051, 182, "Message not found");
         End-If;

      End-If;




PeopleCode (Record): GPCH_EG_ST_HDR.GPCH_EG_DOMAINID.SavePostChange
      &ParamSetup = GetLevel0().GetRow(1).GetRowset(Scroll.GPCH_EG_ST_HDR);

      If (&ParamSetup.GetRow(1).ISDELETED) Then
         SQLExec("DELETE FROM PS_GPCH_EG_FHEADER WHERE COMPANY =:1 AND GPCH_RC_PAY_YEAR=:2 AND
      GPCH_EG_DOMAINID=:3", GPCH_RC_PAYROLL.COMPANY, GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR,
      GPCH_RC_PAYROLL.GPCH_EG_DOMAINID);
         SQLExec("DELETE FROM PS_GPCH_EG_PHEADER WHERE COMPANY =:1 AND GPCH_RC_PAY_YEAR=:2 AND
      GPCH_EG_DOMAINID=:3", GPCH_RC_PAYROLL.COMPANY, GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR,
      GPCH_RC_PAYROLL.GPCH_EG_DOMAINID);
         SQLExec("DELETE FROM PS_GPCH_EG_PERSON WHERE COMPANY =:1 AND GPCH_RC_PAY_YEAR=:2 AND
      GPCH_EG_DOMAINID=:3", GPCH_RC_PAYROLL.COMPANY, GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR,
      GPCH_RC_PAYROLL.GPCH_EG_DOMAINID);
         &temp_YEAR_BEGIN = Date3(GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR, 1, 1);
         &temp_YEAR_END = Date3(GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR, 12, 31);
         SQLExec("DELETE FROM PS_GPCH_IF_TX07_1 WHERE COMPANY = :1 AND BEGIN_DT >= %Datein(:3) and
      BEGIN_DT <= %Datein(:4) AND exists ( select 'X' from PS_GPCH_IF_TX07 A WHERE A.COMPANY =
      PS_GPCH_IF_TX07_1.COMPANY AND A.BEGIN_DT = PS_GPCH_IF_TX07_1.BEGIN_DT and A.END_DT =
      PS_GPCH_IF_TX07_1.END_DT AND A.GPCH_EG_DOMAINID=:2 )", GPCH_RC_PAYROLL.COMPANY,
      GPCH_RC_PAYROLL.GPCH_EG_DOMAINID, &temp_YEAR_BEGIN, &temp_YEAR_END);
         SQLExec("DELETE FROM PS_GPCH_IF_TX07 WHERE COMPANY =:1 AND BEGIN_DT >= %Datein(:3) and
      BEGIN_DT <= %Datein(:4) AND GPCH_EG_DOMAINID=:2", GPCH_RC_PAYROLL.COMPANY,
      GPCH_RC_PAYROLL.GPCH_EG_DOMAINID, &temp_YEAR_BEGIN, &temp_YEAR_END);
         SQLExec("DELETE FROM PS_GPCH_EG_PTOTALS WHERE COMPANY =:1 AND GPCH_RC_PAY_YEAR=:2 AND
      GPCH_EG_DOMAINID=:3", GPCH_RC_PAYROLL.COMPANY, GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR,
      GPCH_RC_PAYROLL.GPCH_EG_DOMAINID);
         SQLExec("DELETE FROM PS_GPCH_EG_FSTATUS WHERE COMPANY =:1 AND GPCH_RC_PAY_YEAR=:2 AND
      GPCH_EG_DOMAINID=:3", GPCH_RC_PAYROLL.COMPANY, GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR,
      GPCH_RC_PAYROLL.GPCH_EG_DOMAINID);
         SQLExec("DELETE FROM PS_GPCH_EG_REPORTS WHERE COMPANY =:1 AND GPCH_RC_PAY_YEAR=:2 AND
      GPCH_EG_DOMAINID=:3", GPCH_RC_PAYROLL.COMPANY, GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR,
      GPCH_RC_PAYROLL.GPCH_EG_DOMAINID);
         SQLExec("update PS_GPCH_RC_PAYROLL SET GPCH_EG_DOMAINID = 0 WHERE OPRID=:1 AND RUN_CNTL_ID
      =:2", %OperatorId, GPCH_RC_PAYROLL.RUN_CNTL_ID);
         GPCH_RC_PAYROLL.GPCH_EG_DOMAINID = 0;
      End-If;




PeopleCode (Record): GPCH_FM_FUNCLIB.GPCH_FM_FORM_ID.FieldFormula
      [ . . . Unchanged Code not Shown . . . ]

      Function PrepareAddrFooter();

         If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "F_REMARK" Then
            &Remark_Overflow = RTrim(&TagArray [&i].NodeValue);
         End-If;

         rem concat First name and last name;
         If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "F_FNAME" Then
            &ADDR1_TMP = LTrim(&TagArray [&i].NodeValue);
         End-If;
         rem !!! from now on we rely on order of the mapping table;
         If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "F_LNAME" Then
            &ADDR1_TMP = RTrim(&ADDR1_TMP) | " " | LTrim(&TagArray [&i].NodeValue);
         End-If;
         rem find F_STREET !!! from now on we rely on order of the mapping table;
         If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "F_STREET" Then
            &ADDR2_TMP = LTrim(&TagArray [&i].NodeValue);
         End-If;
         /* FMB 20090225 */
         If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "F_ComplementaryLine" Then
            &ComplementaryLine = LTrim(&TagArray [&i].NodeValue);
            If (LTrim(&ADDR2_TMP) = "" Or
                     LTrim(&ADDR2_TMP) = " ") Then
               &ADDR2_TMP = LTrim(&ComplementaryLine);
               &RememberLine = "&ADDR2_TMP";
            Else
               &ADDR3_TMP = LTrim(&ComplementaryLine);
               &RememberLine = "&ADDR3_TMP";
            End-If;
         End-If;

         rem find F_POSTB;
         If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "F_POSTB" Then
            If (&RememberLine = " " Or
                     &RememberLine = "") Then

               If (LTrim(&ADDR2_TMP) = "" Or
                        LTrim(&ADDR2_TMP) = " ") Then
                  &ADDR2_TMP = LTrim(&TagArray [&i].NodeValue);
               Else
                  &ADDR3_TMP = LTrim(&TagArray [&i].NodeValue);
               End-If;
            Else
               If &RememberLine = "&ADDR2_TMP" Then
                  &ADDR2_TMP = &ADDR2_TMP | " " | LTrim(&TagArray [&i].NodeValue);
               Else
           &ADDR3_TMP = &ADDR3_TMP | " " | LTrim(&TagArray [&i].NodeValue);
        End-If;
     End-If;

  End-If;
  rem find F_ZIPCODE and CITY ;
  If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "F_ZIPCODE" Then
     &ADDR5_TMP = LTrim(&TagArray [&i].NodeValue);
  End-If;
  rem concat F_ZIPCODE and CITY ;
  If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "F_CITY" Then
     &ADDR5_TMP = LTrim(&ADDR5_TMP) | " " | RTrim(&TagArray [&i].NodeValue);
     If LTrim(&ADDR2_TMP) = "" Then
        &ADDR2_TMP = &ADDR5_TMP;
     Else
        If LTrim(&ADDR3_TMP) = "" Then
           &ADDR3_TMP = &ADDR5_TMP;
        Else
           &ADDR4_TMP = &ADDR5_TMP;
        End-If;
     End-If;
     &ADDR5_TMP = " ";
  End-If;
  If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "OrtDatum" Then
     &OrtDatum = LTrim(&TagArray [&i].NodeValue);



     REM FMB 20080103;
     &Unterschrift1_3 = &OrtDatum;

   End-If;
   If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "F_PLACE2" Then
      &DateTmp = Substring(LTrim(&TagArray [&i].NodeValue), 1, 10);
      &DateTmp = Substring(&DateTmp, 9, 2) | "." | Substring(&DateTmp, 6, 2) | "." |
Substring(&DateTmp, 1, 4);

     If %Component <> Component.GPCH_IF_TX07 Then

         If All(GPCHTX07_AET.GPCH_RC_ADJUST_DT) Then
            &OrtDatum = &OrtDatum | ", " |
DateTimeToLocalizedString(GPCHTX07_AET.GPCH_RC_ADJUST_DT, "dd.MM.yyyy");

        Else
           &OrtDatum = &OrtDatum | ", " | &DateTmp;
        End-If;
     Else
        &OrtDatum = &OrtDatum | ", " | &DateTmp;
     End-If;
  End-If;

  If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "F_CZIPCODE" Then
     &F_CZIPCODE = LTrim(&TagArray [&i].NodeValue);
  End-If;
  REM FMB 20080801 - Reset Company Sender to Standard;
  If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "Unterschrift1.3" Then
     &Unterschrift1_3 = &F_CZIPCODE | " " | &Unterschrift1_3;
  End-If;
  REM Override 20080908 Resolution xxxx - Begin;
  REM Collect Overrides;
  If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "Unterschrift1.0_Ovrd"   Then
     &Unterschrift1_0_Ovrd = LTrim(&TagArray [&i].NodeValue);
  End-If;
  If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "Unterschrift1.1_Ovrd"   Then
     &Unterschrift1_1_Ovrd = LTrim(&TagArray [&i].NodeValue);
  End-If;
  If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "Unterschrift1.2_Ovrd"   Then
     &Unterschrift1_2_Ovrd = LTrim(&TagArray [&i].NodeValue);
  End-If;
  If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "Unterschrift1.3_Ovrd"   Then
     &Unterschrift1_3_Ovrd = LTrim(&TagArray [&i].NodeValue);
   End-If;
   If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "Unterschrift1.4_Ovrd" Then
      &Unterschrift1_4_Ovrd = LTrim(&TagArray [&i].NodeValue);
   End-If;
   If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "OrtDatum_Ovrd" Then
      &OrtDatum_Ovrd = LTrim(&TagArray [&i].NodeValue);
      REM FMB 20080916-Begin;
      If %Component <> Component.GPCH_IF_TX07 Then

         If All(GPCHTX07_AET.GPCH_RC_ADJUST_DT) Then
            &OrtDatum_Ovrd = &OrtDatum_Ovrd | ", " |
DateTimeToLocalizedString(GPCHTX07_AET.GPCH_RC_ADJUST_DT, "dd.MM.yyyy");
         End-If;
      End-If;
      REM FMB 20080916-End;

   End-If;

   REM Override 20080908 - End;
   REM Collect FTE (to create a message if < 100 );
   If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "FTE" Then
      &FTE = LTrim(&TagArray [&i].NodeValue);
   End-If;
   If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "FTE_STRG" Then
      &FTE_STRG = LTrim(&TagArray [&i].NodeValue);
   End-If;
   If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value) = "15-1" Then
      &Remark = LTrim(&TagArray [&i].NodeValue);
      If Substring(&FTE, 3, 1) <> "0" Then;
         &Remark = &Remark | " " | &FTE | "%-" | &FTE_STRG | ";";
         &TagArray [&i].NodeValue = &Remark;
      End-If;
   End-If;


   rem collect Addresslines to do nice Address format - End;
End-Function;

[ . . . Unchanged Code not Shown . . . ]

Function XMLStringToForm(&n_XMLString As string, &n_form As JavaObject, &n_FormID As string,
&n_StartDate As date, &n_LanguageCD As string) Returns JavaObject;

   &n_rs = CreateRowset(Record.GPCH_FM_FLD);

   &n_rs.Fill("WHERE GPCH_FM_FORM_ID = :1 AND EFFDT =%DateIn(:2) AND GPCH_FM_LANG_CD = :3 order
by GPCH_FM_FLD_NBR2 ASC, GPCH_FM_FLD_NT_ID ASC,GPCH_FM_FLD_NBR ASC", &n_FormID, &n_StartDate,
&n_LanguageCD);

   ParseXML(&n_XMLString);

   &old_lang = %Language;
   If Find("<Language>", &n_XMLString) <> 0 Then
      &lang = Substring(&n_XMLString, Find("<Language>", &n_XMLString) + 10, 3);
   Else
      &lang = &n_LanguageCD;
   End-If;

   &amountoverflow = 0;
   /*SYD*/
   &ADDR0_TMP = "";
   &ADDR1_TMP = "";
   &ADDR2_TMP = "";
   &ADDR3_TMP = "";
   &ADDR4_TMP = "";
   &ADDR5_TMP = ""; /*SYD*/

   For &y = 1 To &n_rs.ActiveRowCount
      If All(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_XML_TAG.Value) Then
         For &i = 1 To &Tagindex
              If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_XML_TAG.Value, " ") = &cmpltTagNmArray
[&i] Then
                PrepareAddrFooter();
                For &u = 1 To &OvrFlwAmtField.Len
                   If Substring(&n_FormID, 1, 6) = "LAW-P1" Then

                     If (&OvrFlwAmtField [&u] =
&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NBR.Value) And
                           All(&OvrFlwAmtField [&u]) Then
                        rem don't need to print it, beacuse it will be printed in overflow
page;
                        &OverflowAmount [&u] = &TagArray [&i].NodeValue;
                        &amountoverflow = 1;
                        &Amount_TMP = &TagArray [&i].NodeValue;
                        &Text_TMP = String(Round(&Amount_TMP, 0));

                          FormatSeparator();
                          &form.setField(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value,
&Text_TMP);
                      End-If;
                   End-If;
                End-For;

               If (&amountoverflow = 0) Then
                  &Text_TMP = &TagArray [&i].NodeValue;
                  If (Len(&TagArray [&i].NodeValue) <=
&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_LEN.Value) Or
                        (&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_LEN.Value = 0) Then
                     If (&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_LEN.Value <> 0) Then

                          SeparatorIfNumeric();

                          &Text_TMP = Substring(&TagArray [&i].NodeValue, 1, Len(&TagArray
[&i].NodeValue) - 1);
                        rem shant &Text_TMP = Substring(&TagArray [&i].NodeValue, 1,
Len(&TagArray [&i].NodeValue) - 1);
                        &Text_TMP = Substring(&TagArray [&i].NodeValue, 1, Len(&TagArray
[&i].NodeValue));
                     Else
                        rem prepare amounts to show without decimals and with separator -
begin;
                        &Text_TMP = &TagArray [&i].NodeValue;

                          SeparatorIfNumeric();

                          CheckBoxAndDate();

                        End-If;
                        &form.setField(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value,
&Text_TMP);
                  Else
                     REM STARTING ACQUIRING OVERFLOW DATA;
                     &old_lang = %Language;
                     SetLanguage(&lang);
                     rem &MsgText = MsgGetText(17052, 247, "Message not found",
LTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NT_ID.Value, "0"));
                     &MsgText = &Remark_Overflow | " " |
LTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NT_ID.Value, "0");
                     SetLanguage(&old_lang);
                     &form.setField(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value,
&MsgText);

                        &OverflowNote.Push(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NT_ID.Value);
                        &OverflowValue.Push(&TagArray [&i].NodeValue);
                        &OverflowAmount.Push("");
                        &OvrFlwAmtField.Push(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NBR2.Value);

                   End-If;
                End-If;

              End-If;
         End-For;
         NicePrint();
         &amountoverflow = 0;


      End-If;
   End-For;

   If Substring(&n_FormID, 1, 6) = "LAW-P1" And
         &OvrFlwAmtField.Len > 0 Then

      rem page number estimate;

      &OverflowFormID = "LAW-P2";
      &n_rs_o = CreateRowset(Record.GPCH_FM_FLD);

      &n_rs_o.Fill("WHERE GPCH_FM_FORM_ID = :1 AND EFFDT =%DATEIN(:2) AND GPCH_FM_LANG_CD =
:3 and GPCH_FM_FLD_NAME LIKE 'L%' ORDER BY GPCH_FM_FLD_NAME", &OverflowFormID, &n_StartDate,
&n_LanguageCD);

      &h = 1;
      For &u = 1 To &OvrFlwAmtField.Len

         &OverflowFNote.Push(&OverflowNote [&u]);

         rem &OverflowFValue calculation;

         &index = 1;
         &start = 1;
         &exit = 0;
         &forcedexit = 0;
         &Rvalue = &OverflowValue [&u]; /*FMB 20080103;*/
         While (&start <= Len(&OverflowValue [&u])) And
            (&exit = 0) And
            (&forcedexit < 50);

            &forcedexit = &forcedexit + 1;

            /* If ((&start + &n_rs_o(&index).GPCH_FM_FLD.GPCH_FM_FLD_LEN.Value - 1) >=
Len(&OverflowValue [&u])) Then

                &value = Substring(&OverflowValue [&u], &start, Len(&OverflowValue [&u]) -
&start + 1);
               &exit = 1;
            Else

               &value = Substring(&OverflowValue [&u], &start,
&n_rs_o(&index).GPCH_FM_FLD.GPCH_FM_FLD_LEN.Value + 1);

               If 0 <> Find(" ", &value) Then
                  While Substring(&value, Len(&value), 1) <> " "
                     &value = Substring(&value, 1, Len(&value) - 1);
                  End-While;
               Else
                  &value = Substring(&OverflowValue [&u], &start,
&n_rs_o(&index).GPCH_FM_FLD.GPCH_FM_FLD_LEN.Value);
               End-If;
            End-If; */
            &Pos1 = Find(";", &Rvalue);
            If &Pos1 > 1 Then
               &value = Substring(&Rvalue, 1, &Pos1 - 1);
               &Rvalue = Substring(&Rvalue, Len(&value) + 2, Len(&OverflowValue [&u]) -
&start);

               /*FMB 20080904         &start = &start + Len(&value) - 1;   */
               &start = &start + Len(&value) + 2;
            Else
               &exit = 1;
            End-If;
           &OverflowFValue.Push(&value);
           &OverflowFAmount.Push("");

           If &index <> 1 Then
              rem &OverflowFNote.Push(&OverflowNote[&u]);
              &OverflowFNote.Push("");
           End-If;

           /* syed If Len(&value) > 1 Then
              &start = &start + Len(&value) - 1;
           Else
              &exit = 1;
           End-If; */

           If &index < &n_rs_o.ActiveRowCount Then
              &index = &index + 1;
           Else
              &index = 1;
           End-If;

        End-While;

        &OverflowFAmount [&OverflowFAmount.Len] = &OverflowAmount [&u];

     End-For;
  End-If;


  &totalpages = 0;
  If Substring(&n_FormID, 1, 6) = "LAW-P1" And
        (&OverflowFAmount.Len > 0) Then
     &totalpages = Round(&OverflowFAmount.Len / 29, 0);
     If Round(&OverflowFAmount.Len / 29, 0) <= (&OverflowFAmount.Len / 29) Then
        &totalpages = &totalpages + 1;
     End-If;
  End-If;

  &totalpagenumber = &totalpagenumber + &totalpages;
  &pagenumber = &pagenumber + &NumberOfPages;

   For &y = 1 To &n_rs.ActiveRowCount
      If (Substring(RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_XML_TAG.Value, " "), 1, 11) =
"%PageNumber") And
            (&totalpagenumber > 1) Then

         &TEMPPAGE = &pagenumber +
Value(Substring(RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_XML_TAG.Value, " "), 13,
Len(RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_XML_TAG.Value)) - 13));
         &old_lang = %Language;
         SetLanguage(&lang);
         &MsgText = MsgGetText(17052, 248, "Message not found", String(&pagenumber),
String(&totalpagenumber));
         SetLanguage(&old_lang);
         &form.setField(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value, &MsgText);
      End-If;
      /*syed*/
      If Substring(&n_FormID, 1, 6) = "LAW-P2" Then

        NicePrint();

        If &y = &n_rs.ActiveRowCount Then
           &ADDR0_TMP = " ";
           &ADDR1_TMP = " ";
           &ADDR2_TMP = " ";
           &ADDR3_TMP = " ";
           &ADDR4_TMP = " ";
        End-If;
     End-If; /*syed*/
  End-For;
         Return &n_form;
      End-Function;

      [ . . . Unchanged Code not Shown . . . ]

      Function XMLStringToFormEdit(&n_XMLString As string, &n_form As JavaObject, &n_FormID As
      string, &n_StartDate As date, &n_LanguageCD As string) Returns JavaObject;

         &n_rs = CreateRowset(Record.GPCH_FM_FLD);

         &n_rs.Fill("WHERE GPCH_FM_FORM_ID = :1 AND EFFDT =%DateIn(:2) AND GPCH_FM_LANG_CD = :3",
      &n_FormID, &n_StartDate, &n_LanguageCD);

         /*FMB 20090118
         &FMB_lenght = Len(&n_XMLString);
         &show_len = Min(&FMB_lenght, 1800);
         &show_XMLString = Substring(&n_XMLString, &FMB_lenght - &show_len, &show_len);
         Warning ("String before Parse 0 " | &show_XMLString); */

         /*&A = "B";
         &b = &A * 13;    */

         /* FMB 20090115 */
         &n_XMLString = Substitute(&n_XMLString,
      "<ChildAllowancePerAHV-AVS></ChildAllowancePerAHV-AVS>",
      "<ChildAllowancePerAHV-AVS>Yes</ChildAllowancePerAHV-AVS>");
         &n_XMLString = Substitute(&n_XMLString, "<FreeTransport></FreeTransport>",
      "<FreeTransport>X</FreeTransport>");
         &n_XMLString = Substitute(&n_XMLString, "<FreeTransport/>",
      "<FreeTransport>X</FreeTransport>");
         &n_XMLString = Substitute(&n_XMLString, "<CanteenLunchCheck></CanteenLunchCheck>",
      "<CanteenLunchCheck>X</CanteenLunchCheck>");
         &n_XMLString = Substitute(&n_XMLString, "<CanteenLunchCheck/>",
      "<CanteenLunchCheck>X</CanteenLunchCheck>");
         &n_XMLString = Substitute(&n_XMLString, "<Guidance></Guidance>",
      "<Guidance>X</Guidance>");
         &n_XMLString = Substitute(&n_XMLString, "<Guidance/>", "<Guidance>X</Guidance>");


         ParseXML(&n_XMLString);

         For &y = 1 To &n_rs.ActiveRowCount
            If All(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_XML_TAG.Value) Then

               For &i = 1 To &Tagindex
                  If RTrim(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_XML_TAG.Value, " ") = &cmpltTagNmArray
      [&i] Then

                     &form.setField(&n_rs(&y).GPCH_FM_FLD.GPCH_FM_FLD_NAME.Value, &TagArray
      [&i].NodeValue);
                  End-If;
               End-For;
            End-If;

         End-For;


         Return &n_form;
      End-Function;

      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Record): GPCH_TX_DATA.COMMENTS.FieldChange
      Local Rowset &RS;


      &RS = CreateRowset(Record.GPCH_TX_DATA);
      &NUM_READ = &RS.Fill("Where EMPLID=:1 and EMPL_RCD=:2", GPCH_TX_DATA.EMPLID,
      GPCH_TX_DATA.EMPL_RCD);

      If &NUM_READ = 1 Then

         SQLExec("DELETE FROM PS_GPCH_TX_DATA where EMPLID=:1 and EMPL_RCD=:2",
      GPCH_TX_DATA.EMPLID, GPCH_TX_DATA.EMPL_RCD);
         CommitWork();
      End-If;




PeopleCode (Record): GPCH_TX_DATA.GPCH_TX_SEX_OVRD.FieldChange
      If GPCH_TX_DATA.GPCH_TX_SEX_OVRD = "M" Then
         DERIVED.RECNAME_EDIT = "GPCH_TX_STAR_VW";
      Else
         DERIVED.RECNAME_EDIT = "GPCH_TX_STAF_VW";
      End-If;




PeopleCode (Record): GPCH_TX_DATA.GPCH_TX_TRF_CD.FieldDefault
      Declare Function GPCH_Get_Tariff_Descr PeopleCode GPCH_TX_DATA.GPCH_TX_TRF_CD FieldFormula;

      If %Component = Component.GPCH_TX_DATA Then
         GPCH_Get_Tariff_Descr();
         &find = Find(GPCH_TX_DATA.GPCH_TX_TRF_CD, GPCH_AL_PAY_DW.GPCH_RC_DESCR1);

         If &find = "0" And
               GPCH_TX_DATA.GPCH_TX_TRF_CD <> "" Then
            SetCursorPos(%Page, Record.GPCH_TX_DATA, CurrentRowNumber(),
      GPCH_TX_DATA.GPCH_TX_TRF_CD);
            Warning MsgGet(17051, 143, "");
         End-If;
      End-If;




PeopleCode (Record): GPCH_TX_DATA.GPCH_TX_TRF_CD.RowInit
      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Record): GPCH_TX_DATA.GPCH_TX_VILLAGE_CD.FieldDefault
      Declare Function GPCH_Get_Municipality_Descr PeopleCode GPCH_TX_DATA.GPCH_TX_VILLAGE_CD
      FieldFormula;

      If %Component = Component.GPCH_TX_DATA Then
         GPCH_Get_Municipality_Descr(&x, &x);
      End-If;




PeopleCode (Record): GPCH_TX_DATA.GPCH_TX_VILLAGE_CD.RowInit
      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Record): GPDE_AB_MATERN.GPDE_AB_BEGIN_DT1.FieldEdit
      If All(GPDE_AB_MATERN.GPDE_AB_BEGIN_DT1) Then
         If (GPDE_AB_MATERN.GPDE_AB_BEGIN_DT1 < PER_ORG_ASGN_VW.HIRE_DT) And
               All(PER_ORG_ASGN_VW.HIRE_DT) Then
            REM Begin or End Date may not be earlier than Hire Date;
            Error (MsgGet(17021, 1, ""));
         Else
            If (GPDE_AB_MATERN.GPDE_AB_BEGIN_DT1 >= PER_ORG_ASGN_VW.TERMINATION_DT) And
            If (GPDE_AB_MATERN.GPDE_AB_BEGIN_DT1 > PER_ORG_ASGN_VW.TERMINATION_DT) And
                  All(PER_ORG_ASGN_VW.TERMINATION_DT) Then
               REM Begin or End Date may not be later than Termination Date;
               Error (MsgGet(17021, 2, ""));
            End-If;
         End-If;
      End-If;

      If All(GPDE_AB_MATERN.GPDE_AB_END_DT1) And
            All(GPDE_AB_MATERN.GPDE_AB_BEGIN_DT1) Then
         If GPDE_AB_MATERN.GPDE_AB_END_DT1 < GPDE_AB_MATERN.GPDE_AB_BEGIN_DT1 Then
            REM End Date may not be less than Begin Date;
            Error MsgGet(17021, 3, "");
         End-If;
      End-If;




PeopleCode (Record): GPDE_AB_MATERN.GPDE_AB_END_DT1.FieldEdit
      If All(GPDE_AB_MATERN.GPDE_AB_END_DT1, PER_ORG_ASGN_VW.TERMINATION_DT) Then
         If GPDE_AB_MATERN.GPDE_AB_END_DT1 >= PER_ORG_ASGN_VW.TERMINATION_DT Then
         If GPDE_AB_MATERN.GPDE_AB_END_DT1 > PER_ORG_ASGN_VW.TERMINATION_DT Then
            REM Begin or End Date may not be later than Termination Date;
            Error (MsgGet(17021, 2, ""));
         End-If;
      End-If;

      If All(GPDE_AB_MATERN.GPDE_AB_END_DT1) And
            All(GPDE_AB_MATERN.GPDE_AB_BEGIN_DT1) Then
         If GPDE_AB_MATERN.GPDE_AB_END_DT1 < GPDE_AB_MATERN.GPDE_AB_BEGIN_DT1 Then
            REM End Date may not be less than Begin Date;
            Error MsgGet(17021, 3, "");
         End-If;
      End-If;




PeopleCode (Record): GPDE_AB_MATERN.GPDE_AB_EXPECT_DT1.FieldEdit
      Local number &MultipleBirth;

      If All(GPDE_AB_MATERN.GPDE_AB_EXPECT_DT1) Then
         If (GPDE_AB_MATERN.GPDE_AB_EXPECT_DT1 < PER_ORG_ASGN_VW.HIRE_DT) And
               All(PER_ORG_ASGN_VW.HIRE_DT) Then
            /* Begin or End Date may not be earlier than Hire Date; */
            Error (MsgGet(17021, 1, ""));
         Else
            If (GPDE_AB_MATERN.GPDE_AB_EXPECT_DT1 >= PER_ORG_ASGN_VW.TERMINATION_DT) And
            If (GPDE_AB_MATERN.GPDE_AB_EXPECT_DT1 > PER_ORG_ASGN_VW.TERMINATION_DT) And
                  All(PER_ORG_ASGN_VW.TERMINATION_DT) Then
               /* Begin or End Date may not be later than Termination Date; */
               Error (MsgGet(17021, 2, ""));
            End-If;
         End-If;

         /* If a multiple (e.g. Twins) or/and premature birth happen, the materity is extended to
      18 months. */
         If GPDE_AB_MATERN.GPDE_AB_EE_EXTNSMT = "N" Then
            &MultipleBirth = 56;
         Else
            &MultipleBirth = 84;
         End-If;
         GPDE_AB_MATERN.GPDE_AB_BEGIN_DT1 = GPDE_AB_MATERN.GPDE_AB_EXPECT_DT1 - 42;
         GPDE_AB_MATERN.GPDE_AB_END_DT1 = GPDE_AB_MATERN.GPDE_AB_EXPECT_DT1 + &MultipleBirth;
      End-If;




PeopleCode (Record): GPDE_AB_MAT_EL.GPDE_MT_PIN_EL_NUM.SaveEdit
      Local Rowset &rs1 = GetLevel0()(1).GetRowset(Scroll.GPDE_AB_MATERN);
      Local Rowset &rs2 = &rs1.GetRow(CurrentRowNumber(1)).GetRowset(Scroll.GPDE_AB_MAT_EL);


      If &rs2(CurrentRowNumber()).GetRecord(1).IsChanged Then
         If (GPDE_AB_MAT_EL.END_DT >= EMPLOYMENT.TERMINATION_DT) And
         If (GPDE_AB_MAT_EL.END_DT > EMPLOYMENT.TERMINATION_DT) And
               All(EMPLOYMENT.TERMINATION_DT) Then
            REM Begin or End Date may not be later than Termination Date;
            Error (MsgGet(17021, 2, ""));
         End-If;

         If All(GPDE_AB_MAT_EL.END_DT) And
               All(GPDE_AB_MAT_EL.BGN_DT) Then
            If GPDE_AB_MAT_EL.END_DT < GPDE_AB_MAT_EL.BGN_DT Then
               &rs2(CurrentRowNumber()).GPDE_AB_MAT_EL.BGN_DT.SetCursorPos(%Page);
               REM End Date may not be less than Begin Date;
               Error MsgGet(17021, 3, "");
            End-If;
         End-If;

         If All(&rs1.GetRow(CurrentRowNumber(1)).GPDE_AB_MATERN.GPDE_AB_END_DT1.Value) Then
            If &rs1.GetRow(CurrentRowNumber(1)).GPDE_AB_MATERN.GPDE_AB_END_DT1.Value >=
      GPDE_AB_MAT_EL.BGN_DT Then
               &rs2(CurrentRowNumber()).GPDE_AB_MAT_EL.BGN_DT.SetCursorPos(%Page);
               REM The parental leave do not start accordingly to the maternity leave;
               Error (MsgGet(17021, 209, ""));
            End-If;
         End-If;

         Local date &bgn_dt = GPDE_AB_MAT_EL.BGN_DT;

         For &i = 1 To &rs2.ActiveRowCount
            If &i <> CurrentRowNumber() Then
               If &bgn_dt >= &rs2(&i).GPDE_AB_MAT_EL.BGN_DT.Value And
                     &bgn_dt <= &rs2(&i).GPDE_AB_MAT_EL.END_DT.Value Then
                  &rs2(CurrentRowNumber()).GPDE_AB_MAT_EL.BGN_DT.SetCursorPos(%Page);
                  Error (MsgGet(17021, 117, ""));
               End-If;
            End-If;
         End-For;
      End-If;




PeopleCode (Record): GPES_DERIVED.SRCH_BTN.FieldChange
      Declare Function Get_TermDt_AbsEvents PeopleCode GPES_RC_FNQ1_EE.TERMINATION_DT FieldChange;

      Local   Rowset &Rs_EmpDtl, &Rs_EmpDtlSQL;
      Local   Record &Rec;
      Local   date &BGNDT, &ENDDT, &REF, &ORIG_BGNDT;
      Local   SQL &EE_Abs_Events;


      If %Component = Component.GPES_RC_FNQ2 Then
         /* Delete Employee Details grid*/
         &Rs_EmpDtl = GetRowset(Scroll.GPES_RC_FNQ2_EE);

         For &i = &Rs_EmpDtl.ActiveRowCount To 1 Step - 1
      &Rs_EmpDtl.DeleteRow(&i);
   End-For;


   &Rs_EmpDtlSQL = CreateRowset(Record.GPES_EE_TERM_VW);
   &Rs_EmpDtlSQL.Fill(" WHERE FILL.OPRID = :1 AND FILL.EFFDT BETWEEN %DateIn(:2) AND
%DateIn(:3) AND FILL.EMPL_STATUS_FILTR IN (SELECT DISTINCT AC.EMPL_STATUS FROM
PS_GPES_TERM_AC_VW AC WHERE AC.EFFDT = (SELECT MAX(EFFDT) FROM PS_GPES_TERM_AC_VW WHERE ACTION
= AC.ACTION AND EFFDT <= %DateIn(:3))) AND FILL.REG_REGION = 'ESP' ORDER BY FILL.EMPLID",
%OperatorId, GPES_RC_FNQ2.GPES_FROM_DT.Value, GPES_RC_FNQ2.GPES_TO_DT.Value);
   &Rs_EmpDtlSQL.Fill(" WHERE FILL.OPRID = :1 AND FILL.EFFDT BETWEEN %DateIn(:2) AND
%DateIn(:3) AND (FILL.EMPL_STATUS_FILTR IN (SELECT DISTINCT AC.EMPL_STATUS FROM
PS_GPES_TERM_AC_VW AC WHERE AC.EFFDT = (SELECT MAX(EFFDT) FROM PS_GPES_TERM_AC_VW WHERE ACTION
= AC.ACTION AND EFFDT <= %DateIn(:3))) OR FILL.EMPL_STATUS_FILTR = 'D') AND FILL.REG_REGION
= 'ESP' ORDER BY FILL.EMPLID", %OperatorId, GPES_RC_FNQ2.GPES_FROM_DT.Value,
GPES_RC_FNQ2.GPES_TO_DT.Value);

   /*Populate the grid with all terminated employees*/
   For &i = 1 To &Rs_EmpDtlSQL.ActiveRowCount
      If &i > 1 Then
         &Rs_EmpDtl.InsertRow(&i - 1);
      End-If;
      &Rs_EmpDtl(&i).GPES_RC_FNQ2_EE.EMPLID.Value =
&Rs_EmpDtlSQL(&i).GPES_EE_TERM_VW.EMPLID.Value;

      &Rs_EmpDtl(&i).GPES_RC_FNQ2_EE.EMPL_RCD.Value =
&Rs_EmpDtlSQL(&i).GPES_EE_TERM_VW.EMPL_RCD.Value;
      &Rs_EmpDtl(&i).GPES_RC_FNQ2_EE.EFFDT_L1.Value =
Date(&Rs_EmpDtlSQL(&i).GPES_EE_TERM_VW.EFFDT.Value);
      If &Rs_EmpDtlSQL(&i).GPES_EE_TERM_VW.EMPL_STATUS_FILTR.Value <> "A" Then
         &Rs_EmpDtl(&i).GPES_RC_FNQ2_EE.TERMINATION_DT.Value =
&Rs_EmpDtlSQL(&i).GPES_EE_TERM_VW.TERMINATION_DT.Value;
      End-If;
   End-For;
End-If;


If %Component = Component.GPES_RC_FNQ1 Then
   /*If search is clicked without selecting even one of the check box, an error would be thrown*/
   If GPES_DERIVED.GPES_REASON_IT = "N" And
         GPES_DERIVED.GPES_REASON_MT = "N" And
         GPES_DERIVED.GPES_REASON_RE = "N" And
         GPES_DERIVED.GPES_REASON_BAJA = "N" Then
      Error MsgGet(17170, 76, "");
   End-If;

   /* Delete Employee Details grid*/
   &Rs_EmpDtl = GetRowset(Scroll.GPES_RC_FNQ1_EE);

   For &i = &Rs_EmpDtl.ActiveRowCount To 1 Step - 1
      &Rs_EmpDtl.DeleteRow(&i);
   End-For;

   &Rs_EmpDtlSQL = CreateRowset(Record.GPES_EE_TERM_VW);

   If GPES_RC_FNQ1.GPES_EMPLOYEE_TYPE = "I" Then
      &Rs_EmpDtlSQL.Fill(" WHERE FILL.OPRID = :1 AND FILL.EFFDT BETWEEN %DateIn(:2) AND
%DateIn(:3) AND FILL.EMPL_STATUS_FILTR IN (SELECT DISTINCT AC.EMPL_STATUS FROM
PS_GPES_TERM_AC_VW AC WHERE AC.EFFDT = (SELECT MAX(EFFDT) FROM PS_GPES_TERM_AC_VW WHERE ACTION
= AC.ACTION AND EFFDT <= %DateIn(:3))) AND FILL.REG_REGION = 'ESP' ORDER BY FILL.EMPLID,
FILL.TERMINATION_DT DESC", %OperatorId, GPES_RC_FNQ1.GPES_FROM_DT.Value,
GPES_RC_FNQ1.GPES_TO_DT.Value);
      &Rs_EmpDtlSQL.Fill(" WHERE FILL.OPRID = :1 AND FILL.EFFDT BETWEEN %DateIn(:2) AND
%DateIn(:3) AND (FILL.EMPL_STATUS_FILTR IN (SELECT DISTINCT AC.EMPL_STATUS FROM
PS_GPES_TERM_AC_VW AC WHERE AC.EFFDT = (SELECT MAX(EFFDT) FROM PS_GPES_TERM_AC_VW WHERE ACTION
= AC.ACTION AND EFFDT <= %DateIn(:3))) OR FILL.EMPL_STATUS_FILTR = 'D') AND FILL.REG_REGION
= 'ESP' ORDER BY FILL.EMPLID, FILL.TERMINATION_DT DESC", %OperatorId,
GPES_RC_FNQ1.GPES_FROM_DT.Value, GPES_RC_FNQ1.GPES_TO_DT.Value);
   Else
      &Rs_EmpDtlSQL.Fill(" WHERE FILL.OPRID = :1 AND FILL.EFFDT = (SELECT MAX(EFFDT) FROM
PS_JOB WHERE EMPLID = FILL.EMPLID AND EMPL_RCD = FILL.EMPL_RCD AND EFFDT <= %DateIn(:2)) AND
FILL.EMPL_STATUS_FILTR IN ('A') AND FILL.REG_REGION = 'ESP' ORDER BY FILL.EMPLID",
%OperatorId, GPES_RC_FNQ1.GPES_FROM_DT);
   End-If;

   /*Populate the grid with all terminated employees*/
   For &i = 1 To &Rs_EmpDtlSQL.ActiveRowCount
      If &i > 1 Then
         &Rs_EmpDtl.InsertRow(&i - 1);
      End-If;
      &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.EMPLID.Value =
&Rs_EmpDtlSQL(&i).GPES_EE_TERM_VW.EMPLID.Value;
      &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.EMPL_RCD.Value =
&Rs_EmpDtlSQL(&i).GPES_EE_TERM_VW.EMPL_RCD.Value;
      &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.EFFDT_L1.Value =
&Rs_EmpDtlSQL(&i).GPES_EE_TERM_VW.EFFDT.Value;
      &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.ASOFDATE.Value = GPES_RC_FNQ1.GPES_FROM_DT.Value;
      If &Rs_EmpDtlSQL(&i).GPES_EE_TERM_VW.EMPL_STATUS_FILTR.Value <> "A" Then
         &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.TERMINATION_DT.Value =
&Rs_EmpDtlSQL(&i).GPES_EE_TERM_VW.TERMINATION_DT.Value;
      End-If;
   End-For;

   &i = 1;
   &RC = &Rs_EmpDtl.ActiveRowCount;
   While &i <= &RC /*Using 'while' instead of for as 'for' does not take in account changes
in to variable (&RC)*/
      /*For &i = 1 To &RC*/
      &EMPLID = &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.EMPLID.Value;
      &EMPL_RCD = &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.EMPL_RCD.Value;
      &EFFDT = &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.EFFDT_L1.Value;
      If GPES_RC_FNQ1.GPES_EMPLOYEE_TYPE = "I" Then
         &REF = &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.EFFDT_L1.Value;
      Else
         &REF = GPES_RC_FNQ1.GPES_FROM_DT;
      End-If;
      &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.EMPLID.DisplayOnly = True;
      &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.EMPL_RCD.DisplayOnly = True;
      &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.ASOFDATE.DisplayOnly = True;
      &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.GPES_REASON.DisplayOnly = True;
      &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.TERMINATION_DT.DisplayOnly = True;
      &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.GPES_DISPLAY_ONLY.Value = "Y";

      &EE_Abs_Events = CreateSQL("SELECT ABS_TYPE_OPTN, %DATEOUT(BGN_DT), %DATEOUT(END_DT),
%DATEOUT(ORIG_BEGIN_DT) FROM PS_GPES_CERTF_VW WHERE EMPLID = :1 AND EMPL_RCD = :2 AND
%DateIn(:3) BETWEEN BGN_DT AND END_DT ", &EMPLID, &EMPL_RCD, &REF);
      &EE_Abs_Events_Count = 1;
      While &EE_Abs_Events.Fetch(&RESABSOPTN, &BGNDT, &ENDDT, &ORIG_BGNDT)
         If &EE_Abs_Events_Count <> 1 Then
            &Rs_EmpDtl.InsertRow(&i);
            &i = &i + 1;
            &RC = &RC + 1;
            &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.EMPLID.Value = &Rs_EmpDtl(&i -
1).GPES_RC_FNQ1_EE.EMPLID.Value;
            &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.EMPL_RCD.Value = &Rs_EmpDtl(&i -
1).GPES_RC_FNQ1_EE.EMPL_RCD.Value;
            &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.ASOFDATE.Value =
GPES_RC_FNQ1.GPES_FROM_DT.Value;
            &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.EFFDT_L1.Value = &Rs_EmpDtl(&i -
1).GPES_RC_FNQ1_EE.EFFDT_L1.Value;
            &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.TERMINATION_DT.Value = &Rs_EmpDtl(&i -
1).GPES_RC_FNQ1_EE.TERMINATION_DT.Value;
            &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.EMPLID.DisplayOnly = True;
            &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.EMPL_RCD.DisplayOnly = True;
            &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.ASOFDATE.DisplayOnly = True;
            &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.GPES_REASON.DisplayOnly = True;
            &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.TERMINATION_DT.DisplayOnly = True;
            &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.GPES_DISPLAY_ONLY.Value = "Y";
         End-If;
         &EE_Abs_Events_Count = &EE_Abs_Events_Count + 1;

         Evaluate &RESABSOPTN
         When "DIS";
            &reason = "IT";
         When "ACC";
            &reason = "AT";
         When "MAT";
            &reason = "MT";
         When "RSK";
            &reason = "RE";
         When-Other;
            If GPES_RC_FNQ1.GPES_EMPLOYEE_TYPE = "A" Then
               &reason = "INS";
            Else
               &reason = "INE";
            End-If;
         End-Evaluate;
         &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.GPES_REASON.Value = &reason;

         If (&reason <> "INE" And
                  &reason <> "INS") Then
            &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.BGN_DT.Value = &BGNDT;
            &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.END_DT.Value = &ENDDT;
            &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.ORIG_BEGIN_DT.Value = &ORIG_BGNDT;
         Else
            &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.BGN_DT.SetDefault();
            &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.END_DT.SetDefault();
            &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.ORIG_BEGIN_DT.SetDefault();
         End-If;
      End-While;

      /*End-For;*/
      &i = &i + 1;
   End-While;

   If Not (&Rs_EmpDtl.ActiveRowCount = 1 And
            None(&Rs_EmpDtl(1).GPES_RC_FNQ1_EE.EMPLID.Value)) Then
      /*Delete all the invalid rows from the grid, based on the filter condition */
      &RC = &Rs_EmpDtl.ActiveRowCount;
      For &i = &RC To 1 Step - 1
         If None(&Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.GPES_REASON.Value) Then
            If GPES_RC_FNQ1.GPES_EMPLOYEE_TYPE = "A" Then
               &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.GPES_REASON.Value = "INS";
            Else
               &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.GPES_REASON.Value = "INE";
            End-If;
         End-If;
         &RESABSOPTN = &Rs_EmpDtl(&i).GPES_RC_FNQ1_EE.GPES_REASON.Value;

         /*If 'In sickness' was not selected and if the fetched employee has IT/AT absence,
then delete that row */
         If GPES_DERIVED.GPES_REASON_IT = "N" And
               (&RESABSOPTN = "AT" Or
                  &RESABSOPTN = "IT") Then
            &Rs_EmpDtl.DeleteRow(&i);
         End-If;

         /*If 'In Maternity' was not selected and if the fetched employee has Maternity absence,
then delete that row */
         If GPES_DERIVED.GPES_REASON_MT = "N" And
               &RESABSOPTN = "MT" Then
            &Rs_EmpDtl.DeleteRow(&i);
         End-If;

         /*If 'In Pregnancy Risk' was not selected and if the fetched employee has Pregnancy
Risk absence, then delete that row */
         If GPES_DERIVED.GPES_REASON_RE = "N" And
               &RESABSOPTN = "RE" Then
            &Rs_EmpDtl.DeleteRow(&i);
         End-If;

         /*If 'Not in absence' was not selected and if the fetched employee does not have
IT/AT/MAT/RSK absence, then delete that row */
                If GPES_DERIVED.GPES_REASON_BAJA = "N" And
                      (&RESABSOPTN = "INE" Or
                         &RESABSOPTN = "INS") Then
                   &Rs_EmpDtl.DeleteRow(&i);
                End-If;

               If Not &Rs_EmpDtl(&i).IsDeleted Then
                  &Rec =
      GetLevel0()(1).GetRowset(Scroll.GPES_RC_FNQ1_EE).GetRow(&i).GetRecord(Record.GPES_RC_FNQ1
      _EE);
                  Get_TermDt_AbsEvents(&Rec, "Fch");
               End-If;
            End-For;
         End-If;
      End-If;




PeopleCode (Record): GPES_RC_FNQ1_EE.EMPLID.FieldChange
      Declare Function Get_TermDt_AbsEvents PeopleCode GPES_RC_FNQ1_EE.TERMINATION_DT FieldChange;

      Local   Record &Rec;
      Local   date &EFFDT, &TERMDT;
      Local   string &DATE;
      Local   number &COUNT;


      If %Component = Component.GPES_RC_FNQ1 Then
         /*The termination date and absence type can be defaulted only when empl rcd is also known.
      So it'll be
                                                    done in empl rcd field change event. But the
      below defaulting is done only if empl rcd=0 is valid */

         GPES_RC_FNQ1_EE.EMPL_RCD.SetDefault();
         GPES_RC_FNQ1_EE.TERMINATION_DT.SetDefault();
         GPES_RC_FNQ1_EE.GPES_REASON.SetDefault();
         GPES_RC_FNQ1_EE.BGN_DT.SetDefault();
         GPES_RC_FNQ1_EE.END_DT.SetDefault();
         GPES_RC_FNQ1_EE.ORIG_BEGIN_DT.SetDefault();

         If GPES_RC_FNQ1.GPES_EMPLOYEE_TYPE = "I" Then
            SQLExec("SELECT COUNT(*) FROM PS_GPES_EE_TERM_VW TERM WHERE OPRID = :1 AND EMPLID = :2
      AND EMPL_RCD = :3 AND EFFDT BETWEEN %DateIn(:4) AND %DateIn(:5) AND EMPL_STATUS_FILTR IN (SELECT
      DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE AC.EFFDT = (SELECT MAX(EFFDT) FROM
      PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <= %DateIn(:5))) AND REG_REGION = 'ESP'",
      %OperatorId, GPES_RC_FNQ1_EE.EMPLID, GPES_RC_FNQ1_EE.EMPL_RCD, GPES_RC_FNQ1.GPES_FROM_DT,
      GPES_RC_FNQ1.GPES_TO_DT, &COUNT);
            SQLExec("SELECT %Dateout(EFFDT), %Dateout(TERMINATION_DT) FROM PS_GPES_EE_TERM_VW TERM
      WHERE OPRID = :1 AND EMPLID = :2 AND EMPL_RCD = :3 AND EFFDT BETWEEN %DateIn(:4) AND %DateIn(:5)
      AND EMPL_STATUS_FILTR IN (SELECT DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE
      AC.EFFDT = (SELECT MAX(EFFDT) FROM PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <=
      %DateIn(:5))) AND REG_REGION = 'ESP' ORDER BY EFFDT DESC", %OperatorId,
      GPES_RC_FNQ1_EE.EMPLID, GPES_RC_FNQ1_EE.EMPL_RCD, GPES_RC_FNQ1.GPES_FROM_DT,
      GPES_RC_FNQ1.GPES_TO_DT, &EFFDT, &TERMDT);
            SQLExec("SELECT COUNT(*) FROM PS_GPES_EE_TERM_VW TERM WHERE OPRID = :1 AND EMPLID = :2
      AND EMPL_RCD = :3 AND EFFDT BETWEEN %DateIn(:4) AND %DateIn(:5) AND (EMPL_STATUS_FILTR IN
      (SELECT DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE AC.EFFDT = (SELECT MAX(EFFDT)
      FROM PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <= %DateIn(:5))) OR
      EMPL_STATUS_FILTR = 'D') AND REG_REGION = 'ESP'", %OperatorId, GPES_RC_FNQ1_EE.EMPLID,
      GPES_RC_FNQ1_EE.EMPL_RCD, GPES_RC_FNQ1.GPES_FROM_DT, GPES_RC_FNQ1.GPES_TO_DT, &COUNT);
            SQLExec("SELECT %Dateout(EFFDT), %Dateout(TERMINATION_DT) FROM PS_GPES_EE_TERM_VW TERM
      WHERE OPRID = :1 AND EMPLID = :2 AND EMPL_RCD = :3 AND EFFDT BETWEEN %DateIn(:4) AND %DateIn(:5)
      AND (EMPL_STATUS_FILTR IN (SELECT DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE
      AC.EFFDT = (SELECT MAX(EFFDT) FROM PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <=
      %DateIn(:5))) OR EMPL_STATUS_FILTR = 'D') AND REG_REGION = 'ESP' ORDER BY EFFDT DESC",
      %OperatorId, GPES_RC_FNQ1_EE.EMPLID, GPES_RC_FNQ1_EE.EMPL_RCD, GPES_RC_FNQ1.GPES_FROM_DT,
      GPES_RC_FNQ1.GPES_TO_DT, &EFFDT, &TERMDT);
            If &COUNT = 1 Then
               GPES_RC_FNQ1_EE.TERMINATION_DT.Enabled = False;
            Else
               GPES_RC_FNQ1_EE.TERMINATION_DT.Enabled = True;
            End-If;
            GPES_RC_FNQ1_EE.TERMINATION_DT = &TERMDT;
            GPES_RC_FNQ1_EE.EFFDT_L1 = &EFFDT;
            &Rec =
      GetLevel0()(1).GetRowset(Scroll.GPES_RC_FNQ1_EE).GetRow(CurrentRowNumber()).GetRecord(Rec
      ord.GPES_RC_FNQ1_EE);
            Get_TermDt_AbsEvents(&Rec, "FDe");
         Else
            SQLExec("SELECT %DateOut(EFFDT), %Dateout(TERMINATION_DT) FROM PS_GPES_EE_TERM_VW TERM
      WHERE OPRID = :1 AND EMPLID = :2 AND EMPL_RCD = :3 AND EFFDT = (SELECT MAX(EFFDT) FROM PS_JOB
      WHERE EMPLID = TERM.EMPLID AND EMPL_RCD = TERM.EMPL_RCD AND EFFDT <= %DateIn(:4)) AND
      EMPL_STATUS_FILTR IN ('A') AND REG_REGION = 'ESP'", %OperatorId, GPES_RC_FNQ1_EE.EMPLID,
      GPES_RC_FNQ1_EE.EMPL_RCD, GPES_RC_FNQ1.GPES_FROM_DT, &EFFDT, &TERMDT);

            GPES_RC_FNQ1_EE.TERMINATION_DT.Enabled = False;
            GPES_RC_FNQ1_EE.EFFDT_L1 = &EFFDT;
            GPES_RC_FNQ1_EE.TERMINATION_DT.SetDefault();
            &Rec =
      GetLevel0()(1).GetRowset(Scroll.GPES_RC_FNQ1_EE).GetRow(CurrentRowNumber()).GetRecord(Rec
      ord.GPES_RC_FNQ1_EE);
            Get_TermDt_AbsEvents(&Rec, "FDe");
         End-If;
      End-If;




PeopleCode (Record): GPES_RC_FNQ1_EE.EMPLID.RowInit
      Local SQL &Sql;
      Local Rowset &Rs_EmpDtlSQL;

      Function Init_Emplid_Dyn_Prmpt()

         /* The prompt record for the emplid field is a dynamic view.
      The sql of that dynamic view is initialized here through SQLTEXT*/
         If %Component = Component.GPES_RC_FNQ1 Then
            If GPES_RC_FNQ1.GPES_EMPLOYEE_TYPE = "I" Then
               &DATE = "BETWEEN %DateIn('" | GetLevel0()(1).GPES_RC_FNQ1.GPES_FROM_DT.Value | "')
      AND " | "%DateIn('" | GetLevel0()(1).GPES_RC_FNQ1.GPES_TO_DT.Value | "') ";

      GetLevel0()(1).GetRowset(Scroll.GPES_RC_FNQ1_EE).GetRow(CurrentRowNumber()).GPES_RC_FNQ1_
      EE.EMPLID.SqlText = "SELECT DISTINCT EMPLID,
      NAME,LAST_NAME_SRCH,SECOND_LAST_SRCH,NAME_AC,MIDDLE_NAME FROM PS_GPES_EE_TERM_VW TERM WHERE
      TERM.OPRID = '" | %OperatorId | "' AND TERM.EFFDT " | &DATE | " AND EMPL_STATUS_FILTR IN (SELECT
      DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE AC.EFFDT = (SELECT MAX(EFFDT) FROM
      PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <= %DateIn('" |
      GetLevel0()(1).GPES_RC_FNQ1.GPES_TO_DT.Value | "'))) AND TERM.REG_REGION = 'ESP'";

      GetLevel0()(1).GetRowset(Scroll.GPES_RC_FNQ1_EE).GetRow(CurrentRowNumber()).GPES_RC_FNQ1_
      EE.EMPLID.SqlText = "SELECT DISTINCT EMPLID,
      NAME,LAST_NAME_SRCH,SECOND_LAST_SRCH,NAME_AC,MIDDLE_NAME FROM PS_GPES_EE_TERM_VW TERM WHERE
      TERM.OPRID = '" | %OperatorId | "' AND TERM.EFFDT " | &DATE | " AND (EMPL_STATUS_FILTR IN (SELECT
      DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE AC.EFFDT = (SELECT MAX(EFFDT) FROM
      PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <= %DateIn('" |
      GetLevel0()(1).GPES_RC_FNQ1.GPES_TO_DT.Value | "'))) OR EMPL_STATUS_FILTR = 'D') AND
      TERM.REG_REGION = 'ESP'";
            Else

      GetLevel0()(1).GetRowset(Scroll.GPES_RC_FNQ1_EE).GetRow(CurrentRowNumber()).GPES_RC_FNQ1_
      EE.EMPLID.SqlText = "SELECT DISTINCT EMPLID,
      NAME,LAST_NAME_SRCH,SECOND_LAST_SRCH,NAME_AC,MIDDLE_NAME FROM PS_GPES_EE_TERM_VW TERM WHERE
      TERM.OPRID = '" | %OperatorId | "' AND TERM.EFFDT = (SELECT MAX(EFFDT) FROM PS_JOB WHERE OPRID
      = '" | %OperatorId | "' AND EMPLID = TERM.EMPLID AND EMPL_RCD = TERM.EMPL_RCD AND EFFDT <=
      %DateIn('" | GetLevel0()(1).GPES_RC_FNQ1.GPES_FROM_DT.Value | "')) AND EMPL_STATUS_FILTR IN
      ('A') AND TERM.REG_REGION = 'ESP'";

            End-If;
         End-If;
      End-Function;



      Init_Emplid_Dyn_Prmpt();

      If %Component = Component.GPES_RC_FNQ1 Then
         /*The termination date and absence type can be defaulted only when empl rcd is also known.
      So it'll be
                                                       done in empl rcd field change event. But the
      below defaulting is done only if empl rcd=0 is valid */
         If GPES_RC_FNQ1.GPES_EMPLOYEE_TYPE = "I" Then
            SQLExec("SELECT COUNT(*) FROM PS_GPES_EE_TERM_VW TERM WHERE OPRID = :1 AND EMPLID = :2
      AND EMPL_RCD = :3 AND EFFDT BETWEEN %DateIn(:4) AND %DateIn(:5) AND EMPL_STATUS_FILTR IN (SELECT
      DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE AC.EFFDT = (SELECT MAX(EFFDT) FROM
      PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <= %DateIn(:5))) AND REG_REGION = 'ESP'",
      %OperatorId, GPES_RC_FNQ1_EE.EMPLID, GPES_RC_FNQ1_EE.EMPL_RCD, GPES_RC_FNQ1.GPES_FROM_DT,
      GPES_RC_FNQ1.GPES_TO_DT, &COUNT);
            SQLExec("SELECT COUNT(*) FROM PS_GPES_EE_TERM_VW TERM WHERE OPRID = :1 AND EMPLID = :2
      AND EMPL_RCD = :3 AND EFFDT BETWEEN %DateIn(:4) AND %DateIn(:5) AND (EMPL_STATUS_FILTR IN
      (SELECT DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE AC.EFFDT = (SELECT MAX(EFFDT)
      FROM PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <= %DateIn(:5))) OR
      EMPL_STATUS_FILTR = 'D') AND REG_REGION = 'ESP'", %OperatorId, GPES_RC_FNQ1_EE.EMPLID,
      GPES_RC_FNQ1_EE.EMPL_RCD, GPES_RC_FNQ1.GPES_FROM_DT, GPES_RC_FNQ1.GPES_TO_DT, &COUNT);
            If &COUNT = 1 Then
               SQLExec("SELECT %Dateout(EFFDT), %Dateout(TERMINATION_DT) FROM PS_GPES_EE_TERM_VW
      TERM WHERE OPRID = :1 AND EMPLID = :2 AND EMPL_RCD = :3 AND EFFDT BETWEEN %DateIn(:4) AND
      %DateIn(:5) AND EMPL_STATUS_FILTR IN (SELECT DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW
      AC WHERE AC.EFFDT = (SELECT MAX(EFFDT) FROM PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND
      EFFDT <= %DateIn(:5))) AND REG_REGION = 'ESP'", %OperatorId, GPES_RC_FNQ1_EE.EMPLID,
      GPES_RC_FNQ1_EE.EMPL_RCD, GPES_RC_FNQ1.GPES_FROM_DT, GPES_RC_FNQ1.GPES_TO_DT, &EFFDT,
      &TERMDT);
               SQLExec("SELECT %Dateout(EFFDT), %Dateout(TERMINATION_DT) FROM PS_GPES_EE_TERM_VW
      WHERE OPRID = :1 AND EMPLID = :2 AND EMPL_RCD = :3 AND EFFDT BETWEEN %DateIn(:4) AND %DateIn(:5)
      AND (EMPL_STATUS_FILTR IN (SELECT DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE
      AC.EFFDT = (SELECT MAX(EFFDT) FROM PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <=
      %DateIn(:5))) OR EMPL_STATUS_FILTR = 'D') AND REG_REGION = 'ESP'", %OperatorId,
      GPES_RC_FNQ1_EE.EMPLID, GPES_RC_FNQ1_EE.EMPL_RCD, GPES_RC_FNQ1.GPES_FROM_DT,
      GPES_RC_FNQ1.GPES_TO_DT, &EFFDT, &TERMDT);
               GPES_RC_FNQ1_EE.TERMINATION_DT.Enabled = False;
               GPES_RC_FNQ1_EE.EFFDT_L1 = &EFFDT;
               GPES_RC_FNQ1_EE.TERMINATION_DT = &TERMDT;
            Else
               GPES_RC_FNQ1_EE.TERMINATION_DT.Enabled = True;
            End-If;
         End-If;
      End-If;




PeopleCode (Record): GPES_RC_FNQ1_EE.EMPL_RCD.FieldChange
      Declare Function Get_TermDt_AbsEvents PeopleCode GPES_RC_FNQ1_EE.TERMINATION_DT FieldChange;

      Local   Record &Rec;
      Local   date &EFFDT, &TERMDT;
      Local   string &DATE;
      Local   number &COUNT;


      If %Component = Component.GPES_RC_FNQ1 Then

         GPES_RC_FNQ1_EE.EMPL_RCD.SetDefault();
         GPES_RC_FNQ1_EE.TERMINATION_DT.SetDefault();
         GPES_RC_FNQ1_EE.GPES_REASON.SetDefault();
         GPES_RC_FNQ1_EE.BGN_DT.SetDefault();
         GPES_RC_FNQ1_EE.END_DT.SetDefault();
         GPES_RC_FNQ1_EE.ORIG_BEGIN_DT.SetDefault();
         If GPES_RC_FNQ1.GPES_EMPLOYEE_TYPE = "I" Then
            &EXISTS = "";
            SQLExec("SELECT 'X', %Dateout(EFFDT), %Dateout(TERMINATION_DT) FROM PS_GPES_EE_TERM_VW
      TERM WHERE OPRID = :1 AND EMPLID = :2 AND EMPL_RCD = :3 AND EFFDT BETWEEN %DateIn(:4) AND
      %DateIn(:5) AND EMPL_STATUS_FILTR IN (SELECT DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW
      AC WHERE AC.EFFDT = (SELECT MAX(EFFDT) FROM PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND
      EFFDT <= %DateIn(:5))) AND REG_REGION = 'ESP'", %OperatorId, GPES_RC_FNQ1_EE.EMPLID,
      GPES_RC_FNQ1_EE.EMPL_RCD, GPES_RC_FNQ1.GPES_FROM_DT, GPES_RC_FNQ1.GPES_TO_DT, &EXISTS,
      &EFFDT, &TERMDT);
            SQLExec("SELECT 'X', %Dateout(EFFDT), %Dateout(TERMINATION_DT) FROM PS_GPES_EE_TERM_VW
      TERM WHERE OPRID = :1 AND EMPLID = :2 AND EMPL_RCD = :3 AND EFFDT BETWEEN %DateIn(:4) AND
      %DateIn(:5) AND (EMPL_STATUS_FILTR IN (SELECT DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW
      AC WHERE AC.EFFDT = (SELECT MAX(EFFDT) FROM PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND
      EFFDT <= %DateIn(:5))) OR EMPL_STATUS_FILTR = 'D') AND REG_REGION = 'ESP'", %OperatorId,
      GPES_RC_FNQ1_EE.EMPLID, GPES_RC_FNQ1_EE.EMPL_RCD, GPES_RC_FNQ1.GPES_FROM_DT,
      GPES_RC_FNQ1.GPES_TO_DT, &EXISTS, &EFFDT, &TERMDT);
            If All(&EXISTS) Then
               GPES_RC_FNQ1_EE.TERMINATION_DT.Enabled = False;
               GPES_RC_FNQ1_EE.EFFDT_L1 = &EFFDT;
               GPES_RC_FNQ1_EE.TERMINATION_DT = &TERMDT;
               &Rec =
      GetLevel0()(1).GetRowset(Scroll.GPES_RC_FNQ1_EE).GetRow(CurrentRowNumber()).GetRecord(Rec
      ord.GPES_RC_FNQ1_EE);
               Get_TermDt_AbsEvents(&Rec, "FDe");
            Else
               GPES_RC_FNQ1_EE.TERMINATION_DT.Enabled = True;
            End-If;
         Else
            SQLExec("SELECT %DATEOUT(EFFDT), %DATEOUT(TERMINATION_DT) FROM PS_GPES_EE_TERM_VW TERM
      WHERE OPRID = :1 AND EMPLID = :2 AND EMPL_RCD = :3 AND EFFDT = (SELECT MAX(EFFDT) FROM PS_JOB
      WHERE EMPLID = TERM.EMPLID AND EMPL_RCD = TERM.EMPL_RCD AND EFFDT <= %DateIn(:4)) AND
      EMPL_STATUS_FILTR IN ('A') AND REG_REGION = 'ESP'", %OperatorId, GPES_RC_FNQ1_EE.EMPLID,
      GPES_RC_FNQ1_EE.EMPL_RCD, GPES_RC_FNQ1.GPES_FROM_DT, &EFFDT, &TERMDT);

            GPES_RC_FNQ1_EE.TERMINATION_DT.Enabled = False;
            GPES_RC_FNQ1_EE.EFFDT_L1 = &EFFDT;
            GPES_RC_FNQ1_EE.TERMINATION_DT.SetDefault();
            &Rec =
      GetLevel0()(1).GetRowset(Scroll.GPES_RC_FNQ1_EE).GetRow(CurrentRowNumber()).GetRecord(Rec
      ord.GPES_RC_FNQ1_EE);
            Get_TermDt_AbsEvents(&Rec, "FDe");
         End-If;
      End-If;




PeopleCode (Record): GPES_RC_FNQ1_EE.EMPL_RCD.RowInit
      Function Init_Empl_Rcd_Dyn_Prmpt()
         /*The empl rcd prompt is initialised, so that on launch of page, the empl rcd prompt will
                                                    be populated for the existing value in the
      grid*/
         If %Component = Component.GPES_RC_FNQ1 Then
            If GPES_RC_FNQ1.GPES_EMPLOYEE_TYPE = "I" Then
               &DATE = "BETWEEN %DateIn('" | GetLevel0()(1).GPES_RC_FNQ1.GPES_FROM_DT.Value | "')
      AND %DateIn('" | GetLevel0()(1).GPES_RC_FNQ1.GPES_TO_DT.Value | "') ";

      GetLevel0()(1).GetRowset(Scroll.GPES_RC_FNQ1_EE).GetRow(CurrentRowNumber()).GPES_RC_FNQ1_
      EE.EMPL_RCD.SqlText = "SELECT DISTINCT EMPLID, EMPL_RCD,
      NAME,LAST_NAME_SRCH,SECOND_LAST_SRCH,NAME_AC,MIDDLE_NAME FROM PS_GPES_EE_TERM_VW TERM WHERE
      TERM.OPRID = '" | %OperatorId | "' AND TERM.EFFDT " | &DATE | " AND EMPL_STATUS_FILTR IN (SELECT
      DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE AC.EFFDT = (SELECT MAX(EFFDT) FROM
      PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <= %DateIn('" |
      GetLevel0()(1).GPES_RC_FNQ1.GPES_TO_DT.Value | "'))) AND TERM.REG_REGION = 'ESP'";

      GetLevel0()(1).GetRowset(Scroll.GPES_RC_FNQ1_EE).GetRow(CurrentRowNumber()).GPES_RC_FNQ1_
      EE.EMPL_RCD.SqlText = "SELECT DISTINCT EMPLID, EMPL_RCD,
      NAME,LAST_NAME_SRCH,SECOND_LAST_SRCH,NAME_AC,MIDDLE_NAME FROM PS_GPES_EE_TERM_VW TERM WHERE
      TERM.OPRID = '" | %OperatorId | "' AND TERM.EFFDT " | &DATE | " AND (EMPL_STATUS_FILTR IN (SELECT
      DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE AC.EFFDT = (SELECT MAX(EFFDT) FROM
      PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <= %DateIn('" |
      GetLevel0()(1).GPES_RC_FNQ1.GPES_TO_DT.Value | "'))) OR EMPL_STATUS_FILTR = 'D') AND
      TERM.REG_REGION = 'ESP'";
            Else

      GetLevel0()(1).GetRowset(Scroll.GPES_RC_FNQ1_EE).GetRow(CurrentRowNumber()).GPES_RC_FNQ1_
      EE.EMPL_RCD.SqlText = "SELECT DISTINCT EMPLID, EMPL_RCD,
      NAME,LAST_NAME_SRCH,SECOND_LAST_SRCH,NAME_AC,MIDDLE_NAME FROM PS_GPES_EE_TERM_VW TERM WHERE
      TERM.OPRID = '" | %OperatorId | "' AND TERM.EFFDT = (SELECT MAX(EFFDT) FROM PS_JOB WHERE OPRID
      = '" | %OperatorId | "' AND EMPLID = TERM.EMPLID AND EMPL_RCD = TERM.EMPL_RCD AND EFFDT <=
      %DateIn('" | GetLevel0()(1).GPES_RC_FNQ1.GPES_TO_DT.Value | "')) AND EMPL_STATUS_FILTR IN
      ('A') AND TERM.REG_REGION = 'ESP'";
            End-If;
         End-If;

      End-Function;


      Init_Empl_Rcd_Dyn_Prmpt();




PeopleCode (Record): GPES_RC_FNQ1_EE.TERMINATION_DT.RowInit
      Function Init_Trmntn_Dt_Dyn_Prompt()
         /* The prompt record for the termination_dt field is a dynamic view.
      The sql of that dynamic view is initialized here through SQLTEXT*/
         If %Component = Component.GPES_RC_FNQ1 Then
            If GPES_RC_FNQ1.GPES_EMPLOYEE_TYPE = "I" Then
               &DATE = "BETWEEN %DateIn('" | GetLevel0()(1).GPES_RC_FNQ1.GPES_FROM_DT.Value | "')
      AND %DateIn('" | GetLevel0()(1).GPES_RC_FNQ1.GPES_TO_DT.Value | "') ";

      GetLevel0()(1).GetRowset(Scroll.GPES_RC_FNQ1_EE).GetRow(CurrentRowNumber()).GPES_RC_FNQ1_
      EE.TERMINATION_DT.SqlText = "SELECT DISTINCT EMPLID, EMPL_RCD, %DateOut(TERMINATION_DT),
      NAME,LAST_NAME_SRCH,SECOND_LAST_SRCH,NAME_AC,MIDDLE_NAME FROM PS_GPES_EE_TERM_VW TERM WHERE
      TERM.OPRID = '" | %OperatorId | "' AND TERM.EFFDT " | &DATE | " AND TERM.EMPL_STATUS_FILTR
      IN (SELECT DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE AC.EFFDT = (SELECT
      MAX(EFFDT) FROM PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <= %DateIn('" |
      GetLevel0()(1).GPES_RC_FNQ1.GPES_TO_DT.Value | "'))) AND TERM.REG_REGION = 'ESP'";

      GetLevel0()(1).GetRowset(Scroll.GPES_RC_FNQ1_EE).GetRow(CurrentRowNumber()).GPES_RC_FNQ1_
      EE.TERMINATION_DT.SqlText = "SELECT DISTINCT EMPLID, EMPL_RCD, %DateOut(TERMINATION_DT),
      NAME,LAST_NAME_SRCH,SECOND_LAST_SRCH,NAME_AC,MIDDLE_NAME FROM PS_GPES_EE_TERM_VW TERM WHERE
      TERM.OPRID = '" | %OperatorId | "' AND TERM.EFFDT " | &DATE | " AND (TERM.EMPL_STATUS_FILTR
      IN (SELECT DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE AC.EFFDT = (SELECT
      MAX(EFFDT) FROM PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <= %DateIn('" |
      GetLevel0()(1).GPES_RC_FNQ1.GPES_TO_DT.Value | "'))) OR TERM.EMPL_STATUS_FILTR = 'D') AND
      TERM.REG_REGION = 'ESP'";
            End-If;
         End-If;
      End-Function;


      Init_Trmntn_Dt_Dyn_Prompt();




PeopleCode (Record): GPES_RC_FNQ2.GPES_FROM_DT.FieldChange
      Local Rowset &Rs_EmpDtl;

      /*When the date value is changed, all the values in the employee grid would be deleted*/
      If %Component = Component.GPES_RC_FNQ2 Then
         &Rs_EmpDtl = GetRowset(Scroll.GPES_RC_FNQ2_EE);
         For &I = &Rs_EmpDtl.ActiveRowCount To 1 Step - 1
            &Rs_EmpDtl.DeleteRow(&I);
         End-For;
         /*populating the employee prompt as per the new end date value*/
         &DATE = "BETWEEN %DateIn('" | GPES_RC_FNQ2.GPES_FROM_DT | "') AND %DateIn('" |
      GPES_RC_FNQ2.GPES_TO_DT | "') ";
          GetLevel0()(1).GetRowset(Scroll.GPES_RC_FNQ2_EE)(1).GPES_RC_FNQ2_EE.EMPLID.SqlText =
      "SELECT DISTINCT EMPLID, NAME,LAST_NAME_SRCH,SECOND_LAST_SRCH,NAME_AC,MIDDLE_NAME FROM
      PS_GPES_EE_TERM_VW TERM WHERE TERM.OPRID = '" | %OperatorId | "' AND TERM.EFFDT " | &DATE
      | " AND EMPL_STATUS_FILTR IN (SELECT DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE
      AC.EFFDT = (SELECT MAX(EFFDT) FROM PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <=
      %DateIn('" | GPES_RC_FNQ2.GPES_TO_DT | "'))) AND TERM.REG_REGION = 'ESP'";
          GetLevel0()(1).GetRowset(Scroll.GPES_RC_FNQ2_EE)(1).GPES_RC_FNQ2_EE.EMPLID.SqlText =
      "SELECT DISTINCT EMPLID, NAME,LAST_NAME_SRCH,SECOND_LAST_SRCH,NAME_AC,MIDDLE_NAME FROM
      PS_GPES_EE_TERM_VW TERM WHERE TERM.OPRID = '" | %OperatorId | "' AND TERM.EFFDT " | &DATE
      | " AND (EMPL_STATUS_FILTR IN (SELECT DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE
      AC.EFFDT = (SELECT MAX(EFFDT) FROM PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <=
      %DateIn('" | GPES_RC_FNQ2.GPES_TO_DT | "'))) OR EMPL_STATUS_FILTR = 'D') AND TERM.REG_REGION
      = 'ESP'";
      End-If;




PeopleCode (Record): GPES_RC_FNQ2.GPES_TO_DT.FieldChange
      Local Rowset &Rs_EmpDtl;

      /*When the date value is changed, all the values in the employee grid would be deleted*/
      If %Component = Component.GPES_RC_FNQ2 Then
          &Rs_EmpDtl = GetRowset(Scroll.GPES_RC_FNQ2_EE);
          For &I = &Rs_EmpDtl.ActiveRowCount To 1 Step - 1
             &Rs_EmpDtl.DeleteRow(&I);
          End-For;
          /*populating the employee prompt as per the new begin date value*/
          &DATE = "BETWEEN %DateIn('" | GPES_RC_FNQ2.GPES_FROM_DT | "') AND %DateIn('" |
      GPES_RC_FNQ2.GPES_TO_DT | "') ";
          GetLevel0()(1).GetRowset(Scroll.GPES_RC_FNQ2_EE)(1).GPES_RC_FNQ2_EE.EMPLID.SqlText =
      "SELECT DISTINCT EMPLID, NAME,LAST_NAME_SRCH,SECOND_LAST_SRCH,NAME_AC,MIDDLE_NAME FROM
      PS_GPES_EE_TERM_VW TERM WHERE TERM.OPRID = '" | %OperatorId | "' AND TERM.EFFDT " | &DATE
      | " AND EMPL_STATUS_FILTR IN (SELECT DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE
      AC.EFFDT = (SELECT MAX(EFFDT) FROM PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <=
      %DateIn('" | GPES_RC_FNQ2.GPES_TO_DT | "'))) AND TERM.REG_REGION = 'ESP'";
          GetLevel0()(1).GetRowset(Scroll.GPES_RC_FNQ2_EE)(1).GPES_RC_FNQ2_EE.EMPLID.SqlText =
      "SELECT DISTINCT EMPLID, NAME,LAST_NAME_SRCH,SECOND_LAST_SRCH,NAME_AC,MIDDLE_NAME FROM
      PS_GPES_EE_TERM_VW TERM WHERE TERM.OPRID = '" | %OperatorId | "' AND TERM.EFFDT " | &DATE
      | " AND (EMPL_STATUS_FILTR IN (SELECT DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE
      AC.EFFDT = (SELECT MAX(EFFDT) FROM PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <=
      %DateIn('" | GPES_RC_FNQ2.GPES_TO_DT | "'))) OR EMPL_STATUS_FILTR = 'D') AND TERM.REG_REGION
      = 'ESP'";
      End-If;




PeopleCode (Record): GPES_RC_FNQ2_EE.EMPLID.RowInit
      /* The prompt record for the emplid field is a dynamic view.
      The sql of that dynamic view is initialized here through SQLTEXT*/
      If %Component = Component.GPES_RC_FNQ2 Then
         &DATE = "BETWEEN %DateIn('" | GPES_RC_FNQ2.GPES_FROM_DT | "') AND %DateIn('" |
      GPES_RC_FNQ2.GPES_TO_DT | "') ";
         GPES_RC_FNQ2_EE.EMPLID.SqlText = "SELECT DISTINCT EMPLID,
      NAME,LAST_NAME_SRCH,SECOND_LAST_SRCH,NAME_AC,MIDDLE_NAME FROM PS_GPES_EE_TERM_VW TERM WHERE
      TERM.OPRID = '" | %OperatorId | "' AND TERM.EFFDT " | &DATE | " AND EMPL_STATUS_FILTR IN (SELECT
      DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE AC.EFFDT = (SELECT MAX(EFFDT) FROM
      PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <= %DateIn('" | GPES_RC_FNQ2.GPES_TO_DT
      | "'))) AND TERM.REG_REGION = ' ESP'";
         GPES_RC_FNQ2_EE.EMPLID.SqlText = "SELECT DISTINCT EMPLID,
      NAME,LAST_NAME_SRCH,SECOND_LAST_SRCH,NAME_AC,MIDDLE_NAME FROM PS_GPES_EE_TERM_VW TERM WHERE
      TERM.OPRID = '" | %OperatorId | "' AND TERM.EFFDT " | &DATE | " AND (EMPL_STATUS_FILTR IN (SELECT
      DISTINCT AC.EMPL_STATUS FROM PS_GPES_TERM_AC_VW AC WHERE AC.EFFDT = (SELECT MAX(EFFDT) FROM
      PS_GPES_TERM_AC_VW WHERE ACTION = AC.ACTION AND EFFDT <= %DateIn('" | GPES_RC_FNQ2.GPES_TO_DT
      | "'))) OR EMPL_STATUS_FILTR = 'D') AND TERM.REG_REGION = ' ESP'";
      End-If;
PeopleCode (Record): GPES_TERM_MNG.SENIORITY_PAY_DT.FieldDefault
      /* If Seniority Pay Calc Date is null, show the field Company Seniority Date */
      If None(GPES_TERM_MNG.SENIORITY_PAY_DT.Value) Then
         If None(PER_ORG_ASGN.SENIORITY_PAY_DT.Value) Then
            GPES_TERM_MNG.SENIORITY_PAY_DT.Value = PER_ORG_ASGN.CMPNY_SENIORITY_DT.Value;
         Else
            GPES_TERM_MNG.SENIORITY_PAY_DT.Value = PER_ORG_ASGN.SENIORITY_PAY_DT.Value;
         End-If;
      End-If;




PeopleCode (Record): GPFR_AF_NODE.GPFR_AF_LEVEL.SavePreChange
      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Record): GPFR_AF_NODE.GPFR_AF_LVLKEY_REC.FieldChange
      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Record): GPFR_AF_NODE.GPFR_AF_LVLKEY_REC.RowInit
      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Record): GPFR_AF_NODE.GPFR_AF_LVLKEY_REC.SaveEdit
      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Record): GPFR_AF_NODE.GPFR_AF_LVLREC_ALS.FieldChange
      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Record): GPFR_AF_NODE.GPFR_AF_LVLREC_ALS.RowInit
      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Record): GPFR_ONPAY_WRK.GPFR_RESULTS_PB.FieldFormula
      [ . . . Unchanged Code not Shown . . . ]

      Function RefreshAbsences(&seg);

         /**************/
         /* Daily data */
         /**************/

         &RowSet = &RowSetSeg(&seg).GetRowset(Scroll.GPFR_ONPAY_8_VW);
         &RowSet.Flush();
         &line = 0;
   &line_rec = 1;

   /* Retrieve results */
   &SQL = CreateSQL("%SelectAll(:1 R) where %KeyEqual(:2 R)" | ANDClause("PIN_TAKE_NUM",
"N"));
   &SQL = CreateSQL("%SelectAll(:1 R) where %KeyEqual(:2 R)" | ANDClause("PIN_TAKE_NUM", "N")
| " ORDER BY R.ABS_BGN_DT, R.PIN_TAKE_NUM, R.ABSENCE_DATE");

   For &k = 1 To 3
      Evaluate &k
      When 1
         &RecResult = CreateRecord(Record.GPFR_RSLT_DC_VW);
         Break;
      When 2
         &RecResult = CreateRecord(Record.GPFR_RSLT_DR_VW);
         Break;
      When 3
         &RecResult = CreateRecord(Record.GPFR_RSLT_DO_VW);
         Break;
      End-Evaluate;

      &SQL.Execute(&RecResult, &RecSeg, &EMPLID, &EMPL_RCD, &CAL_RUN_ID, &GP_PAYGROUP,
&CAL_ID, &ORIG_CAL_RUN_ID, &RSLT_SEG_NUM);
      While &SQL.Fetch(&RecResult)
         If &line <> 0 Then
            &RowSet.InsertRow(&line);
         End-If;
         &RecGrid = &RowSet.GetRow(&line + 1).GetRecord(Record.GPFR_ONPAY_8_VW);
         &RecResult.CopyFieldsTo(&RecGrid);
         &RecGrid.GPFR_SKIP.Value = "N";
         &line = &line + 1;
      End-While;

       /* Aggregate data */
       If &line <> 0 Then
          For &i = &line_rec To &line
             &RecGrid_i = &RowSet.GetRow(&i).GetRecord(Record.GPFR_ONPAY_8_VW);
             If &RecGrid_i.GPFR_SKIP.Value = "N" Then
                For &j = &line_rec To &line
                   If &i <> &j Then
                      &RecGrid_j = &RowSet.GetRow(&j).GetRecord(Record.GPFR_ONPAY_8_VW);
                      If &RecGrid_j.GPFR_SKIP.Value = "N" Then
                          If &RecGrid_i.PIN_TAKE_NUM.Value = &RecGrid_j.PIN_TAKE_NUM.Value
And
                                &RecGrid_i.ABS_BGN_DT.Value = &RecGrid_j.ABS_BGN_DT.Value
Then
                              &RecGrid_i.DAY_COUNT.Value = &RecGrid_i.DAY_COUNT.Value +
&RecGrid_j.DAY_COUNT.Value;
                           &RecGrid_i.DAY_COUNT_PAID.Value =
&RecGrid_i.DAY_COUNT_PAID.Value + &RecGrid_j.DAY_COUNT_PAID.Value;
                           If &RecGrid_j.ABSENCE_DATE.Value < &RecGrid_i.ABSENCE_DATE.Value
Then
                               If &RecGrid_j.BEGIN_ENTL_BAL.Value <> 0 Then
                                  &RecGrid_i.BEGIN_ENTL_BAL.Value =
&RecGrid_j.BEGIN_ENTL_BAL.Value;
                               End-If;
                           End-If;
                           If &RecGrid_j.ABSENCE_DATE.Value > &RecGrid_i.ABSENCE_DATE.Value
Then
                               If &RecGrid_j.DAY_COUNT_PAID.Value <> 0 Or
                                     &RecGrid_j.END_ENTL_BAL.Value <> 0 Then
                                  &RecGrid_i.END_ENTL_BAL.Value =
&RecGrid_j.END_ENTL_BAL.Value;
                               End-If;
                           End-If;
                           &RecGrid_i.ABSENCE_DATE.Value = &RecGrid_j.ABSENCE_DATE.Value;
                           &RecGrid_j.GPFR_SKIP.Value = "Y";
                        End-If;
                     End-If;
                  End-If;
               End-For;
            End-If;
         End-For;
      End-If;

   End-For;

   /* Delete skipped rows */
   For &i = &line To 1 Step - 1
      &RecGrid_i = &RowSet.GetRow(&i).GetRecord(Record.GPFR_ONPAY_8_VW);
      If &RecGrid_i.GPFR_SKIP.Value = "Y" Then
         &RowSet.DeleteRow(&i);
      End-If;
   End-For;

   /* Sort */
   &RowSet.Sort(GPFR_ONPAY_8_VW.ABS_BGN_DT, "A", GPFR_ONPAY_8_VW.DESCR15, "A",
GP_PIN_NM_VW.PIN_NM, "A");

   /****************************/
   /* Generated Positive Input */
   /****************************/
   &RowSet = &RowSetSeg(&seg).GetRowset(Scroll.GPFR_ONPAY_9_VW);
   &RowSet.Flush();
   &line = 0;
   &line_rec = 1;

   /* Retrieve results */
   &SQL = CreateSQL("%SelectAll(:1 R) where %KeyEqual(:2 R)" | ANDClause("PIN_TK_NUM", "N"));

   For &m = 1 To 3
      Evaluate &m
      When 1
         &RecResult = CreateRecord(Record.GPFR_RSLT_GC_VW);
         Break;
      When 2
         &RecResult = CreateRecord(Record.GPFR_RSLT_GR_VW);
         Break;
      When 3
         &RecResult = CreateRecord(Record.GPFR_RSLT_GO_VW);
         Break;
      End-Evaluate;

      &SQL.Execute(&RecResult, &RecSeg, &EMPLID, &EMPL_RCD, &CAL_RUN_ID, &GP_PAYGROUP,
&CAL_ID, &ORIG_CAL_RUN_ID, &RSLT_SEG_NUM);
      While &SQL.Fetch(&RecResult)
         If &line <> 0 Then
            &RowSet.InsertRow(&line);
         End-If;
         &RecGrid = &RowSet.GetRow(&line + 1).GetRecord(Record.GPFR_ONPAY_9_VW);
         &RecResult.CopyFieldsTo(&RecGrid);
         &RecGrid.GPFR_SKIP.Value = "N";
         &line = &line + 1;
      End-While;
      /* Aggregate rows */
      If &line <> 0 Then
         For &i = &line_rec To &line
            &RecGrid_i = &RowSet.GetRow(&i).GetRecord(Record.GPFR_ONPAY_9_VW);
            If &RecGrid_i.GPFR_SKIP.Value = "N" Then
               For &j = &line_rec To &line
                  If &i <> &j Then
                     &RecGrid_j = &RowSet.GetRow(&j).GetRecord(Record.GPFR_ONPAY_9_VW);
                     If &RecGrid_j.GPFR_SKIP.Value = "N" Then
                         If &RecGrid_i.PIN_NUM.Value = &RecGrid_j.PIN_NUM.Value And
                               &RecGrid_i.PIN_TK_NUM.Value = &RecGrid_j.PIN_TK_NUM.Value And
                               &RecGrid_i.ABS_BGN_DT.Value = &RecGrid_j.ABS_BGN_DT.Value And
                               &RecGrid_i.GP_PCT.Value = &RecGrid_j.GP_PCT.Value Then
                            &RecGrid_i.GP_UNIT.Value = &RecGrid_i.GP_UNIT.Value +
&RecGrid_j.GP_UNIT.Value;
                            &RecGrid_j.GPFR_SKIP.Value = "Y";
                         End-If;
                     End-If;
                        End-If;
                     End-For;
                  End-If;
               End-For;
               &line_rec = &line + 1;
            End-If;
         End-For;

         /* Delete skipped rows */
         For &i = &line To 1 Step - 1
            &RecGrid_i = &RowSet.GetRow(&i).GetRecord(Record.GPFR_ONPAY_9_VW);
            If &RecGrid_i.GPFR_SKIP.Value = "Y" Then
               &RowSet.DeleteRow(&i);
            End-If;
         End-For;
         /* Sort */
         &RowSet.Sort(GPFR_ONPAY_9_VW.ABS_BGN_DT, "A", GPFR_ONPAY_9_VW.DESCR15, "A",
      GP_PIN_NM_VW.PIN_NM, "A");
      End-Function;

      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Record): GPGB_ABS_EVT_JR.GPGB_ABS_LINK_DUR.FieldFormula
      Component Rowset &level1, &level2;
      Component number &pin_take_num_ssp;

      Function Update_Abs(&emplid As string, &empl_rcd As number, &first_bgn_dt As date, &end_dt
      As date, &pin_take_num As number, &prev_duration As number)


         For &abc = &level1.ActiveRowCount To 1 Step - 1
            &level2 = &level1.GetRow(&abc).GetRowset(Scroll.GPGB_ABS_EVT_JR);
            &pin_take_num2 = &level1(&abc).GP_ABS_EVENT.PIN_TAKE_NUM.Value;


           If (&pin_take_num_ssp = &pin_take_num2) Then

              For &abcd = &level2.ActiveRowCount To 1 Step - 1

                  &emplid_jr = &level2(&abcd).GPGB_ABS_EVT_JR.EMPLID.Value;
                  &empl_rcd_jr = &level2(&abcd).GPGB_ABS_EVT_JR.EMPL_RCD.Value;
                  &bgn_dt_jr = Date(&level2(&abcd).GPGB_ABS_EVT_JR.BGN_DT.Value);
                  &end_dt_jr = Date(&level2(&abcd).GPGB_ABS_EVT_JR.END_DT.Value);
                  &pin_take_num_jr = &level2(&abcd).GPGB_ABS_EVT_JR.PIN_TAKE_NUM.Value;
                  &gpgb_abs_link_dur_jr =
      &level2(&abcd).GPGB_ABS_EVT_JR.GPGB_ABS_LINK_DUR.Value;



                 If (&emplid_jr = &emplid And
                          &empl_rcd_jr = &empl_rcd And
                          &bgn_dt_jr >= &first_bgn_dt And
                          &end_dt_jr <= &end_dt And

                           &gpgb_abs_link_dur_jr <> &prev_duration) Then

                    If (&prev_duration > 999) Then
                       &prev_duration = 999;
                    End-If;
                    &level2(&abcd).GPGB_ABS_EVT_JR.GPGB_ABS_LINK_DUR.Value = &prev_duration;
                    &level2(&abcd).GPGB_ABS_EVT_JR.Update();

                 End-If;

               End-For; /* level2 for ends*/
            End-If;
         End-For; /* level1 for ends*/
         /* update the ABS_DUR ends */
      End-Function;




      Function Calculate_Half_Days(&begin_day_half_ind As string, &end_day_half_ind As string,
      &prev_duration As number) Returns number;

         If (&begin_day_half_ind = "Y" Or
                  &end_day_half_ind = "Y") Then
            &number_of_half_days = 1;
            If (&begin_day_half_ind = "Y" And
                     &end_day_half_ind = "Y") Then
               &number_of_half_days = 2;
            End-If;

           If (&prev_duration >= &number_of_half_days) Then

              &prev_duration = &prev_duration - &number_of_half_days;

           End-If;

         End-If;

         Return &prev_duration;
      End-Function;




PeopleCode (Record): GPGB_ABS_EVT_JR.GPGB_ABS_LINK_DUR.SavePostChange
      Local Rowset &level1, &level2;
      Declare Function Update_Abs PeopleCode GPGB_ABS_EVT_JR.GPGB_ABS_LINK_DUR FieldFormula;
      Declare Function Calculate_Half_Days PeopleCode GPGB_ABS_EVT_JR.GPGB_ABS_LINK_DUR
      FieldFormula;

      Component Rowset &level1, &level2;
      Local date &first_bgn_dt, &bgn_dt;
      Local number &prev_duration;
      Component number &pin_take_num_ssp;
      Local boolean &link_flag;


      &gp_abs_take = CreateRowset(Record.GP_ABS_TAKE);
      &num_read = &gp_abs_take.Fill("where PIN_NUM=:1", GPGB_ABS_EVT_JR.PIN_TAKE_NUM);

      If GP_PIN.PIN_CODE = "SSP AT1 GBR" Then
         &pin_take_num_ssp = GPGB_ABS_EVT_JR.PIN_TAKE_NUM;
      End-If;

      &level1_row = CreateRowset(Record.GP_ABS_EVENT);

      &level0 = GetLevel0();
      &level1 = &level0.GetRow(1).GetRowset(Scroll.GP_ABS_EVENT);
      &level1.Sort(GP_ABS_EVENT.END_DT, "A");
      &level1.CopyTo(&level1_row);
      &level1_row.Sort(GP_ABS_EVENT.END_DT, "D");
      &level2 = &level1.GetRow(1).GetRowset(Scroll.GPGB_ABS_EVT_JR);


      &i = 1; /* to check it is not the first event */
      &j = 0; /* to link the first event date */
      &prev_end_day_half_ind = "";
      &prev_all_days_ind = "";
      &prev_pin_take_num = 0;
For &z = 1 To &level1.ActiveRowCount
   &emplid = &level1(&z).GP_ABS_EVENT.EMPLID.Value;
   &empl_rcd = &level1(&z).GP_ABS_EVENT.EMPL_RCD.Value;
   &bgn_dt = Date(&level1(&z).GP_ABS_EVENT.BGN_DT.Value);
   &end_dt = Date(&level1(&z).GP_ABS_EVENT.END_DT.Value);
   &begin_day_half_ind = Upper(&level1(&z).GP_ABS_EVENT.BEGIN_DAY_HALF_IND.Value);
   &end_day_half_ind = Upper(&level1(&z).GP_ABS_EVENT.END_DAY_HALF_IND.Value);
   &begin_day_hrs = &level1(&z).GP_ABS_EVENT.BEGIN_DAY_HRS.Value;
   &end_day_hrs = &level1(&z).GP_ABS_EVENT.END_DAY_HRS.Value;
   &all_days_ind = Upper(&level1(&z).GP_ABS_EVENT.ALL_DAYS_IND.Value);
   &pin_take_num = &level1(&z).GP_ABS_EVENT.PIN_TAKE_NUM.Value;


For &z = &level1_row.ActiveRowCount To 1 Step - 1
   &emplid = &level1_row.getRow(&z).GP_ABS_EVENT.EMPLID.Value;
   &empl_rcd = &level1_row.getRow(&z).GP_ABS_EVENT.EMPL_RCD.Value;
   &bgn_dt = Date(&level1_row.getRow(&z).GP_ABS_EVENT.BGN_DT.Value);
   &end_dt = Date(&level1_row.getRow(&z).GP_ABS_EVENT.END_DT.Value);
   &begin_day_half_ind =
Upper(&level1_row.getRow(&z).GP_ABS_EVENT.BEGIN_DAY_HALF_IND.Value);
   &end_day_half_ind = Upper(&level1_row.getRow(&z).GP_ABS_EVENT.END_DAY_HALF_IND.Value);
   &begin_day_hrs = &level1_row.getRow(&z).GP_ABS_EVENT.BEGIN_DAY_HRS.Value;
   &end_day_hrs = &level1_row.getRow(&z).GP_ABS_EVENT.END_DAY_HRS.Value;
   &all_days_ind = Upper(&level1_row.getRow(&z).GP_ABS_EVENT.ALL_DAYS_IND.Value);
   &pin_take_num = &level1_row.getRow(&z).GP_ABS_EVENT.PIN_TAKE_NUM.Value;
   If (&pin_take_num = &pin_take_num_ssp) Then

     &a = Date(&bgn_dt);
     &b = Date(&end_dt);


     If All(&a, &b) Then
        &c = AddToDate(&a, 0, 0, - 1);
        &current_duration = &b - &c;
     End-If;
     /*   &current_duration = &end_dt - (&bgn_dt - 1); */


     /* Check for Partial Hours - starts   */
     If (&begin_day_hrs > 0) Then
        &begin_day_half_ind = "Y";
     End-If;

     If (&end_day_hrs > 0) Then
        &end_day_half_ind = "Y";
     End-If;

     /* Check for Partial Hours - ends   */

  /* Check for All days indicator="Y" - starts */
     /* Check for All days indicator="Y" - starts */

  If (&all_days_ind = "Y") Then

     If (&all_days_ind = "Y" And
              Not (&link_flag)) Then
        &first_bgn_dt = &bgn_dt;
        &prev_duration = 0;

     Else
        /* &all_days_ind ="N" */

        /* &i Checks - it is not the first event    */
        If (&i > 1) Then

           &compare_dt = Date(&bgn_dt) - Date(&prev_end_dt);

           If (&compare_dt = 1 And
                    &prev_end_day_half_ind = "N" And
                    &begin_day_half_ind = "N" And
                      &prev_all_days_ind = "N" And
                   &prev_pin_take_num = &pin_take_num) Then
                      &prev_pin_take_num = &pin_take_num And
                      &all_days_ind = "N") Then

               /* And &all_days_ind = "N"          */
               /* link the absence events */

               &current_duration = &current_duration + &prev_duration;

               &prev_duration = Calculate_Half_Days(&begin_day_half_ind, &end_day_half_ind,
&current_duration);


               If (&j = 0) Then
                  &first_bgn_dt = &prev_bgn_dt;
                  &first_end_dt = &prevenddate;
               End-If;

               &j = &j + 1;
               &link_flag = True;


            Else /* Not linked reset &j       */

               If (&j >= 1 And
                        &link_flag
                        /* And            &level1.ActiveRowCount <> &i */
                        ) Then

                  Update_Abs(&emplid, &empl_rcd, &first_bgn_dt, &prev_end_dt,
&pin_take_num, &last_prev_duration);
                  &link_flag = False;

               End-If;


               &prev_duration = Calculate_Half_Days(&begin_day_half_ind, &end_day_half_ind,
&current_duration);


               &link_flag = False;
               &j = 0;
               &first_bgn_dt = &bgn_dt;


            End-If; /*compare_dt     */

         Else /* if i = 1 */
            &first_bgn_dt = &bgn_dt;
         End-If; /* & i > 1 */
   End-If; /* Check for All days indicator="Y" - ends       */


      End-If; /*   Check for All days indicator="Y" - ends       */


      &prev_bgn_dt = &bgn_dt;
      &prev_end_dt = &end_dt;
      &prev_duration = &current_duration;


      If (&i = 1 And
               &level1.ActiveRowCount = 1) Then

   /* Calculate Half days and deduct it from &prev_duration - starts */
         &prev_duration = Calculate_Half_Days(&begin_day_half_ind, &end_day_half_ind,
&current_duration);
         Update_Abs(&emplid, &empl_rcd, &first_bgn_dt, &end_dt, &pin_take_num,
&prev_duration);
  If (&begin_day_half_ind = "Y" Or
           &end_day_half_ind = "Y") Then
     &number_of_half_days = 1;
     If (&begin_day_half_ind = "Y" And
              &end_day_half_ind = "Y") Then
        &number_of_half_days = 2;
     End-If;




     If (&j >= 1 And
              &link_flag And
              &level1.ActiveRowCount = &i) Or
           (&all_days_ind = "Y") Then

        If (&all_days_ind = "Y") Then
           &prev_duration = 0;
           &link_flag = False;
        End-If;

  /* Calculate Half days and deduct it from &prev_duration - ends */

   If (&prev_duration >= &number_of_half_days) Then
      &prev_duration = &prev_duration - &number_of_half_days;
         Update_Abs(&emplid, &empl_rcd, &first_bgn_dt, &end_dt, &pin_take_num,
&prev_duration);

     End-If;

  /* update the ABS_Dur -starts */

  For &abc = 1 To &level1.ActiveRowCount

     &level2 = &level1.GetRow(&abc).GetRowset(Scroll.GPGB_ABS_EVT_JR);
     If (&j = 0 And
              Not (&link_flag) And
              &i <> 1) Then

     For &abcd = 1 To &level2.ActiveRowCount

        &emplid_jr = &level2(&abcd).GPGB_ABS_EVT_JR.EMPLID.Value;
        &empl_rcd_jr = &level2(&abcd).GPGB_ABS_EVT_JR.EMPL_RCD.Value;
        &bgn_dt_jr = Date(&level2(&abcd).GPGB_ABS_EVT_JR.BGN_DT.Value);
        &end_dt_jr = Date(&level2(&abcd).GPGB_ABS_EVT_JR.END_DT.Value);
        &pin_take_num_jr = &level2(&abcd).GPGB_ABS_EVT_JR.PIN_TAKE_NUM.Value;
        If (&z <> 1) Then
           &k = &z - 1;

            &next_emplid = &level1_row.getRow(&k).GP_ABS_EVENT.EMPLID.Value;
            &next_empl_rcd = &level1_row.getRow(&k).GP_ABS_EVENT.EMPL_RCD.Value;
            &next_bgn_dt = Date(&level1_row.getRow(&k).GP_ABS_EVENT.BGN_DT.Value);
            &next_end_dt = Date(&level1_row.getRow(&k).GP_ABS_EVENT.END_DT.Value);
            &next_begin_day_half_ind =
Upper(&level1_row.getRow(&k).GP_ABS_EVENT.BEGIN_DAY_HALF_IND.Value);
            &next_end_day_half_ind =
Upper(&level1_row.getRow(&k).GP_ABS_EVENT.END_DAY_HALF_IND.Value);
            &next_begin_day_hrs = &level1_row.getRow(&k).GP_ABS_EVENT.BEGIN_DAY_HRS.Value;
            &next_end_day_hrs = &level1_row.getRow(&k).GP_ABS_EVENT.END_DAY_HRS.Value;
            &next_all_days_ind =
Upper(&level1_row.getRow(&k).GP_ABS_EVENT.ALL_DAYS_IND.Value);
            &next_pin_take_num = &level1_row.getRow(&k).GP_ABS_EVENT.PIN_TAKE_NUM.Value;

        If (&emplid_jr = &emplid And
                 &empl_rcd_jr = &empl_rcd And
                 &bgn_dt_jr >= &first_bgn_dt And
                 &end_dt_jr <= &end_dt And
                 &pin_take_num_jr = &pin_take_num) Then
           If (&prev_duration > 999) Then
              &prev_duration = 999;
                 End-If;
                 &level2(&abcd).GPGB_ABS_EVT_JR.GPGB_ABS_LINK_DUR.Value = &prev_duration;
                 &level2(&abcd).GPGB_ABS_EVT_JR.Update();
              End-If;

           End-For; /* level2 for ends*/
                 &compare_dt2 = Date(&next_bgn_dt) - Date(&end_dt);

         End-For; /* level1 for ends*/
         /* update the ABS_DUR ends */
                  If (&next_emplid = GPGB_ABS_EVT_JR.EMPLID And
                           &next_empl_rcd = GPGB_ABS_EVT_JR.EMPL_RCD And
                           &compare_dt2 = 1 And
                           &end_day_half_ind = "N" And
                           &next_begin_day_half_ind = "N" And
                           &all_days_ind = "N" And
                           &next_pin_take_num = &pin_take_num_ssp) Then


                  Else
                     Update_Abs(&emplid, &empl_rcd, &first_bgn_dt, &end_dt, &pin_take_num,
      &prev_duration);
                  End-If; /* 3 C */
               Else /* k = 0 */

                  Update_Abs(&emplid, &empl_rcd, &first_bgn_dt, &end_dt, &pin_take_num,
      &prev_duration);
               End-If; /* relocate this 2 C */



           End-If; /* 1C &j = 0 And
              Not (&link_flag) */
           &last_prev_duration = &prev_duration;

         End-If; /* ssp type only   */


         &prev_end_day_half_ind = &end_day_half_ind;
         &prev_all_days_ind = &all_days_ind;
         &prev_pin_take_num = &pin_take_num;
         &number_of_half_days = 0;
         &i = &i + 1;


         &i = &i + 1;
      End-For;




PeopleCode (Record): GPGB_EDIFUNCLIB.GPGB_EDI_WORKS_ID.FieldFormula
      Declare Function ParseTaxCodeUK PeopleCode GPGB_FUNCLIB.TAXCODE_UK FieldFormula;
      Global boolean &EdiP6P9Copy; /*Declare a Boolean variable */

      /*
      Local string &sWorksId, &sRet, &sSql, &sEmplId1, &sTrans, &sSurname, &sNationalId;
      Local number &iReps, &iRet, &iEmplRcd1, &iCount, &iSeqNum, &iC;
      Local Record &Rec, &Rec2;
      Local SQL &sql;
      Local boolean &bGotMatch, &bOk, &bUpdReq, &bMsg, &bDefEmplRcd, &bStillCanDo;
      Local boolean &bGotWorksIdMatch, &bGotNIMatch, &bGotSurnameMatch;
      Local string &sTitle, &sMsg, &sParam1, &sParam2, &sParam3, &sParam4, &sWhere, &sTaxMsg,
      &sNotes;
      Local number &iMessCat, &iMessNum, &iNIMatchLen;
      Local string &sPathSep;
      */
      Global boolean &EdiP6P9Copy; /*Declare a Boolean variable */

      /*-------------------*/
[ . . . Unchanged Code not Shown . . . ]

Function SetStatDetails Returns boolean
   /*On entry to this function, the following information should be in GPGB_EDILIB_AET...
     1.National Id
     2.Works Id (may be blank)
     3.Last Name*/

  /*
  Local string &sWorksId, &sTrans;
  Local number &iReps, &iRet, &iSeqNum, &iC;


  Local   boolean &bUpdReq
  Local   string &sTitle, &sParam1, &sParam2, , &sParam4, &sWhere, &sTaxMsg, &sNotes;
  Local   number &iMessNum, &iNIMatchLen;
  Local   string &sPathSep;
  */

   Local boolean &bGotWorksIdMatch, &bGotNIMatch, &bGotSurnameMatch, &bStillCanDo,
&bGotMatch;
   Local boolean &bOk, &bDefEmplRcd, &bMsg;
   Local number &iCount, &iEmplRcd1, &iMessCat, &iMessNum;
   Local number &iCount, &iEmplRcd1, &iMessCat, &iMessNum, &getemplrcd;
   Local string &sSurname, &sNationalId, &sEmplId1, &sMsg, &sSql, &sRet;
   Local string &sParam1, &sParam2, &sParam3, &sParam4, &sTaxMsg;
   Local SQL &sql;
   Local Record &Rec, &Rec2;

  &bStillCanDo = True;
  &bGotWorksIdMatch = False;
  &bGotNIMatch = False;
  &bGotSurnameMatch = False;
  &bDefEmplRcd = False;
  &bGotMatch = False;
  &iCount = 0;
  &bOk = False;
  &sSurname = RTrim(GPGB_EDILIB_AET.LAST_NAME);
  &sNationalId = RTrim(GPGB_EDILIB_AET.NATIONAL_ID);

  /*No Works Id specified - so try and match on National Id*/

  If None(GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID) And
        All(&sNationalId) Then

      &sEmplId1 = NIMatch(&sNationalId, &sSurname, True);
      If All(&sEmplId1) Then
         GPGB_EDILIB_AET.EMPLID = &sEmplId1;
         GPGB_EDILIB_AET.EMPL_RCD = 0;
         GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID = GetWorksId(&sEmplId1, 0);
         /*   GPGB_EDILIB_AET.EMPL_RCD = 0; */
         /*
we have found the emplid. Now lets find the least(emplrcd)
which is active and belonging to uk payroll */

         &sSql = "SELECT MIN(A.EMPL_RCD) FROM PS_PER_ORG_ASGN_VW A, PS_GPGB_EE_TAX B WHERE
A.EMPLID= B.EMPLID AND A.EMPL_RCD = B.EMPL_RCD AND A.EMPLID = :1";
         SQLExec(&sSql, GPGB_EDILIB_AET.EMPLID, &getemplrcd);
         If All(&getemplrcd) Then
            GPGB_EDILIB_AET.EMPL_RCD = &getemplrcd;
         End-If;
         /* GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID = GetWorksId(&sEmplId1, 0); */
         GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID = GetWorksId(&sEmplId1, &getemplrcd);

        &bDefEmplRcd = True;
        &bGotNIMatch = True;
     Else
        GPGB_EDILIB_AET.EMPLID = "";
     End-If;
   End-If;

   /*Either have a works id specified in the file - or -
     have matched on NI number.
     If matched on NI number then &bDefEmplRcd will be true because we have matched
     person not job - so have defaulted empl rcd to 0 and set works id based on that*/

   If All(GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID) And
         Not &bDefEmplRcd Then

      /*Works Id specified in file*/

      GPGB_EDILIB_AET.EMPLID = GetEmplId(GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID);
      &iEmplRcd1 = GetEmplRcd(GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID);

      If &iEmplRcd1 = - 1 Then

           /*If return from GetEmplRcd is -1 then no empl rcd has been supplied
             so default to 0 and set works id*/

         GPGB_EDILIB_AET.EMPL_RCD = 0;
         /* GPGB_EDILIB_AET.EMPL_RCD = 0; */
         &sSql = "SELECT MIN(A.EMPL_RCD) FROM PS_PER_ORG_ASGN_VW A, PS_GPGB_EE_TAX B WHERE
A.EMPLID= B.EMPLID AND A.EMPL_RCD = B.EMPL_RCD AND A.EMPLID = :1";
         SQLExec(&sSql, GPGB_EDILIB_AET.EMPLID, &getemplrcd);

           If All(&getemplrcd) Then
              GPGB_EDILIB_AET.EMPL_RCD = &getemplrcd;
           End-If;

         GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID = GetWorksId(GPGB_EDILIB_AET.EMPLID,
GPGB_EDILIB_AET.EMPL_RCD);

           /*set log that no empl rcd was found in the works id.*/
           &sMsg = "P6/P9 Warning : no empl rcd provided in works id for employee %1 - defaulting
to 0";
         &bMsg = SetDtlMessage2(17135, 367, "WARNING", &sMsg, &sSurname, "", "", "");
         &sMsg = "P6/P9 Warning : no empl rcd provided in works id for employee %1 - defaulting
to " | &getemplrcd;

           &bMsg = SetDtlMessage2(17135, 367, "WARNING", &sMsg, &sSurname, String(&getemplrcd),
"", "");


           &bDefEmplRcd = True;

      Else

           GPGB_EDILIB_AET.EMPL_RCD = &iEmplRcd1;

      End-If;

   End-If;

   /*Either have emplid from a national id match or from a correct works id.
     Emplrcd will either be defaulted to 0 (from an NI match only) or will have
     been retrieved from works id or defaulted to 0 if not set in works id.*/

   If All(GPGB_EDILIB_AET.EMPLID) Then

      /* Make sure have a job for the emplid,emplrcd combination.*/

      &sSql = "SELECT COUNT(DISTINCT EMPLID) FROM PS_EMPLOYMENT WHERE EMPLID = :1 AND EMPL_RCD
= :2";
      SQLExec(&sSql, GPGB_EDILIB_AET.EMPLID, GPGB_EDILIB_AET.EMPL_RCD, &iCount);

      If &iCount = 0 Then

         &bGotMatch = False;
         &sMsg = "P6/P9 Error : could not find employee %1 (%2) employment information - no
update possible";
         &bMsg = SetDtlMessage2(17135, 348, "ERROR", &sMsg, &sSurname,
GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID, "", "");
         &bStillCanDo = False;

      Else

          &bGotMatch = True;

          If GPGB_EDILIB_AET.EMPL_RCD = 0 And
          /*   If GPGB_EDILIB_AET.EMPL_RCD = 0 And */
          If GPGB_EDILIB_AET.EMPL_RCD = &getemplrcd And

                &bDefEmplRcd Then

             /*Empld rcd has been defaulted (either because only NI number was provided)
               or because it wasn't found in the works id.
               Check to see if got multiple jobs for this ee*/

             &sSql = "SELECT COUNT(DISTINCT EMPL_RCD) FROM PS_EMPLOYMENT WHERE EMPLID = :1";
             SQLExec(&sSql, GPGB_EDILIB_AET.EMPLID, &iCount);

             If &iCount > 1 Then

                /*multiple job ee - set warning that updating job 0 of multiple jobs*/
                &sMsg = "P6/P9 Warning : employee %1 has multiple jobs - will only update empl
rcd 0";
               &bMsg = SetDtlMessage2(17135, 366, "WARNING", &sMsg, &sSurname, "", "", "");
               rem need to modify this message such that o is replaxced by getemplrcd value;
               &sMsg = "P6/P9 Warning : employee %1 has multiple jobs - will only update empl
rcd " | &getemplrcd;
               &bMsg = SetDtlMessage2(17135, 366, "WARNING", &sMsg, &sSurname,
String(&getemplrcd), "", "");


             End-If;

         Else
            /*indicates got a worksid match straight from file - without any defaulting etc*/
            &bGotWorksIdMatch = True;
            &sMsg = "P6/P9 Info : employee %1 (%2) has a works id match";
            &bMsg = SetDtlMessage2(17135, 380, "INFO", &sMsg, &sSurname,
(GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID), "", "");
         End-If;

      End-If;

   End-If;

   /*
   Need to have a 2 out of 3 match ie (in order of pref) WorksId,NI,Surname.
   At this point either have and NI and WorksId or just WorksId.
   If just WorksId (because was supplied) then try and match NI.
   */
   If Not &bGotNIMatch And
         All(GPGB_EDILIB_AET.EMPLID) Then
      &sEmplId1 = NIMatch(&sNationalId, &sSurname, True);
      If &sEmplId1 <> GPGB_EDILIB_AET.EMPLID Then
         If All(&sEmplId1, &sNationalId) Then
            GPGB_EDILIB_AET.EMPLID = &sEmplId1;
         End-If;
         &sSql = "SELECT NATIONAL_ID FROM PS_PERS_NID WHERE EMPLID = :1";
         SQLExec(&sSql, GPGB_EDILIB_AET.EMPLID, &sRet);
         If &sRet <> &sNationalId Then
            &sMsg = "P6/P9 Error : employee %1 (%2) NI numbers don't match %3 - no update
possible";
            &sParam3 = MsgGetText(17135, 377, "(%1 in system versus %2 in transaction)", &sRet,
&sNationalId);
            &bMsg = SetDtlMessage2(17135, 376, "ERROR", &sMsg, &sSurname,
(GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID), &sParam3, "");
            &bGotMatch = False;
         Else
            &bGotNIMatch = True;
            &bGotWorksIdMatch = True;
         End-If;
      Else
         &bGotNIMatch = True;
         &bGotWorksIdMatch = True
      End-If;
   End-If;

   /*
   Check on surname
   */
   If All(GPGB_EDILIB_AET.EMPLID) Then
      &sSql = "SELECT LAST_NAME FROM PS_PERSON_NAME WHERE EMPLID = :1";
      SQLExec(&sSql, GPGB_EDILIB_AET.EMPLID, &sRet);
      &sRet = Upper(&sRet);
      If &sRet <> &sSurname Then
         If &bGotWorksIdMatch And
               &bGotNIMatch Then
            /*Got 2 out of 3 - display a warning and continue*/
            &sMsg = "P6/P9 Warning : employee %1 (%2) surname doesn't match %3 - processing
continues";
            &sRet = "(" | &sRet | " in system versus " | &sSurname | " in transaction)";
            &sParam3 = MsgGetText(17135, 377, "(%1 in system versus %2 in transaction)", &sRet,
&sSurname);
            &bMsg = SetDtlMessage2(17135, 378, "WARNING", &sMsg, &sSurname,
(GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID), &sRet, "");
         Else
            /*Only got 1 out of 3 - so error*/
            &sMsg = "P6/P9 Error : employee %1 (%2) surname doesn't match %3 - no update
possible";
            &sRet = "(" | &sRet | " in system versus " | &sSurname | " in transaction)";
            &sParam3 = MsgGetText(17135, 377, "(%1 in system versus %2 in transaction)", &sRet,
&sSurname);
            &bMsg = SetDtlMessage2(17135, 379, "ERROR", &sMsg, &sSurname,
(GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID), &sRet, "");
            &bGotMatch = False;
         End-If;
      Else
         &sMsg = "P6/P9 Info : employee %1 (%2) has a surname match";
         &bMsg = SetDtlMessage2(17135, 381, "INFO", &sMsg, &sSurname,
(GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID), "", "");
         &bGotMatch = True;
      End-If;
   End-If;

   If &bGotMatch Then

      &bOk = True;
      /*&bUpdReq = False;    VK: Variable is no longer used*/

      /*Check for future rows*/

      SQLExec("SELECT COUNT(DISTINCT EMPLID) FROM PS_GPGB_EE_TAX WHERE EMPLID = :1 AND
EMPL_RCD = :2 AND EFFDT > %DateIn(:3)", GPGB_EDILIB_AET.EMPLID, GPGB_EDILIB_AET.EMPL_RCD,
GPGB_EDILIB_AET.EFFDT, &iCount);

      If &iCount > 0 Then

         &bOk = False;
         &sMsg = "P6/P9 Error : employee %1 (%2) has future dated rows - no update possible";
         &bMsg = SetDtlMessage2(17135, 351, "ERROR", &sMsg, &sSurname,
GetWorksId(GPGB_EDILIB_AET.EMPLID, GPGB_EDILIB_AET.EMPL_RCD), "", "");

         &bMsg = P6AdditionalInfo(&sSurname);

      End-If;

      /*The following code has been commented out as the checking for current row is no
        longer required. A new record is inserted irrespective of the notification source
        in the current row in the tax record.
      If &bOk Then
         &sTrans = "";
         SQLExec("SELECT GPGB_TAX_CD_SRC FROM PS_GPGB_EE_TAX WHERE EMPLID = :1 AND EMPL_RCD
= :2 AND EFFDT = %DateIn(:3)", GPGB_EDILIB_AET.EMPLID, GPGB_EDILIB_AET.EMPL_RCD,
GPGB_EDILIB_AET.EFFDT, &sTrans);
         If All(&sTrans) Then
            &bOk = (RTrim(&sTrans) = RTrim(GPGB_EDILIB_AET.GPGB_EDI_TRANS));
            &bUpdReq = &bOk;
         End-If;
      End-If;
      */
      /* ADDITIONAL; LOGIC FOR PROCESSING */
      SQLExec("SELECT COUNT(DISTINCT EMPLID) FROM PS_GPGB_EE_TAX WHERE EMPLID = :1 AND
EMPL_RCD = :2 ", GPGB_EDILIB_AET.EMPLID, GPGB_EDILIB_AET.EMPL_RCD, &iCount);
      If &iCount = 0 Then

         &bOk = False;
         &sMsg = "P6/P9 Error : No Employment Record Available For Update";
         &bMsg = SetDtlMessage2(17135, 536, "ERROR", &sMsg, &sSurname,
GetWorksId(GPGB_EDILIB_AET.EMPLID, GPGB_EDILIB_AET.EMPL_RCD), "", "");
      End-If;

      If &bOk Then

         &Rec = CreateRecord(Record.GPGB_EE_TAX);

         &Rec.EMPLID.Value = GPGB_EDILIB_AET.EMPLID;
         &Rec.EMPL_RCD.Value = GPGB_EDILIB_AET.EMPL_RCD;
         &sql = CreateSQL("%SelectAll(:1 A) WHERE A.EMPLID = :2 AND A.EMPL_RCD = :3 AND A.EFFDT
= (SELECT MAX(B.EFFDT) FROM PS_GPGB_EE_TAX B WHERE A.EMPLID = B.EMPLID AND A.EMPL_RCD =
B.EMPL_RCD AND B.EFFDT <= %datein(:4)) AND A.EFFSEQ = (SELECT MAX(C.EFFSEQ) FROM PS_GPGB_EE_TAX
C WHERE C.EMPLID = A.EMPLID AND C.EMPL_RCD = A.EMPL_RCD AND C.EFFDT = A.EFFDT)",
Record.GPGB_EE_TAX, GPGB_EDILIB_AET.EMPLID, GPGB_EDILIB_AET.EMPL_RCD,
GPGB_EDILIB_AET.GPGB_EDI_DATE);

         If &sql.Fetch(&Rec) Then

            /*set effdt and effseq*/
            If &Rec.EFFDT.Value = GPGB_EDILIB_AET.EFFDT Then
               &Rec.EFFSEQ.Value = &Rec.EFFSEQ.Value + 1;
            Else
               &Rec.EFFSEQ.Value = 0;
               &Rec.EFFDT.Value = GPGB_EDILIB_AET.EFFDT;
            End-If;

            /*set Notification source*/
            Evaluate GPGB_EDILIB_AET.GPGB_EDI_TRANS
            When "P6"
               &Rec.GPGB_TAX_CD_SRC.Value = "P6T";
            When "P9"
               &Rec.GPGB_TAX_CD_SRC.Value = "P9T";
            When-Other
               &Rec.GPGB_TAX_CD_SRC.Value = GPGB_EDILIB_AET.GPGB_EDI_TRANS;
            End-Evaluate;

            /*set taxcode*/
            &Rec.TAXCODE_UK.Value = GPGB_EDILIB_AET.TAXCODE_UK;
            If GPGB_EDILIB_AET.GPGB_SV_TAX_IND = "Y" Then
               /*We need to see Scottish Variable as an S prefix in the tax code*/
               If Left(&Rec.TAXCODE_UK.Value, 1) <> "S" Then
                  &Rec.TAXCODE_UK.Value = "S" | &Rec.TAXCODE_UK.Value;
               End-If;
            End-If;

            /*set tax basis*/
            If GPGB_EDILIB_AET.TAX_BASIS_UK = "1" Then
               &Rec.TAX_BASIS_UK.Value = "1";
            Else
               &Rec.TAX_BASIS_UK.Value = "0";
            End-If;
            /*set other fields*/
            &Rec.GPGB_SV_TAX_IND.Value = GPGB_EDILIB_AET.GPGB_SV_TAX_IND;
            /*GPGB_TAX_CD_ALPHA, GPGB_TAX_CD_NUM get set by parsetaxcode function below*/
            &Rec.GPGB_TAX_CD_ISSUE.Value = GPGB_EDILIB_AET.GPGB_TAX_CD_ISSUE;
            GPGB_EDILIB_AET.GPGB_TAX_YR_END = String(GPGB_EDILIB_AET.GPGB_P45_TXYR + 1);
            &Rec.GPGB_TAX_YR_END.Value = GPGB_EDILIB_AET.GPGB_TAX_YR_END;
            &Rec.GPGB_P46_STATMNTA.Value = " ";
            &Rec.GPGB_P46_STATMNTB.Value = " ";
            &Rec.GPGB_P46_STATMNTC.Value = " ";
            &Rec.GPGB_PREV_ER_PAYE.Value = " ";
            &Rec.GPGB_ER_TAXNUM.Value = 0;
            &Rec.GPGB_LEAVE_DT.SetDefault();
            &Rec.GPGB_PREV_PERIOD.Value = 0;
            &Rec.GPGB_PREV_WKMTH.Value = " ";

            &Rec.GPGB_P45_TXYR.Value = GPGB_EDILIB_AET.GPGB_P45_TXYR;
            &Rec.GPGB_PREV_TX_BASIS.Value = " ";
            &Rec.GPGB_PREV_TAX_CD.Value = " ";
            &Rec.GPGB_PREV_SVTAXIND.Value = " ";
            &sSql = "SELECT MAX(GPGB_P45_TXYR) FROM PS_GPGB_EE_TAX WHERE EMPLID = :1 AND
GPGB_TAX_CD_SRC = 'P45' ";
            &sSql = "SELECT MAX(GPGB_P45_TXYR) FROM PS_GPGB_EE_TAX WHERE EMPLID = :1 AND
GPGB_TAX_CD_SRC IN ('P45','P6','P6T','P6B')";

            SQLExec(&sSql, GPGB_EDILIB_AET.EMPLID, &TEMP);
            &ssql45 = "SELECT GPGB_P45_PAY_TD,GPGB_P45_TAX_TD FROM PS_GPGB_EE_TAX WHERE
EMPLID = :1 AND GPGB_TAX_CD_SRC = 'P45' AND GPGB_P45_TXYR =:2";
            /*NEW CODE ADDED 1830162001
*/
            &ssql45 = "SELECT GPGB_P45_PAY_TD,GPGB_P45_TAX_TD FROM PS_GPGB_EE_TAX WHERE
EMPLID = :1 AND GPGB_TAX_CD_SRC IN('P45','P6','P6T','P6B') AND GPGB_P45_TXYR =:2";
            SQLExec(&ssql45, GPGB_EDILIB_AET.EMPLID, &TEMP, &t1, &t2);

            If GPGB_EDILIB_AET.GPGB_P45_PAY_TD <> 0 Then
               &Rec.GPGB_P45_PAY_TD.Value = GPGB_EDILIB_AET.GPGB_P45_PAY_TD;
            Else
               If GPGB_EDILIB_AET.GPGB_P45_TXYR <> &TEMP Then
                  &Rec.GPGB_P45_PAY_TD.Value = 0;
               Else
                  /*Remark the Boolean variable is used and checked because irrespective of
the tax1 getting specified as 00 or "" the value returned is 0 and the multiple cases will
fail if we just check for none or spaces.*/
                  /*Remark the Boolean variable is used and checked because irrespective of
the tax1 getting specified as 00 or __ the value returned is 0 and the multiple cases will
fail if we just check for none or spaces.*/
                  If &EdiP6P9Copy And
                        None(GPGB_EDILIB_AET.GPGB_P45_PAY_TD) Then
                     &Rec.GPGB_P45_PAY_TD.Value = 0;

                  Else
                     If None(GPGB_EDILIB_AET.GPGB_P45_PAY_TD) Then
                        &Rec.GPGB_P45_PAY_TD.Value = &t1;
                     End-If;
                  End-If;

               End-If;
            End-If;
            If GPGB_EDILIB_AET.GPGB_P45_TAX_TD <> 0 Then
               &Rec.GPGB_P45_TAX_TD.Value = GPGB_EDILIB_AET.GPGB_P45_TAX_TD;
            Else
               If GPGB_EDILIB_AET.GPGB_P45_TXYR <> &TEMP Then
                  &Rec.GPGB_P45_TAX_TD.Value = 0;
               Else
                  If &EdiP6P9Copy And
                        None(GPGB_EDILIB_AET.GPGB_P45_PAY_TD) Then
                     &Rec.GPGB_P45_TAX_TD.Value = 0;

                  Else
                     If None(GPGB_EDILIB_AET.GPGB_P45_PAY_TD) Then
                        &Rec.GPGB_P45_TAX_TD.Value = &t2;
                       End-If;
                    End-If;
                 End-If;

               /*NEW CODE ENDED 1830162001*/
            End-If;

            &Rec.GPGB_P45_STLOAN.Value = " ";
            &Rec.GPGB_P45_CAL_RUN.Value = " ";
            &Rec.GPGB_EDI_REF.Value = 0;
            &Rec.LEAVE_DT.Value = Date(0);
            &Rec.LASTUPDDTTM.Value = %Datetime;
            &Rec.LASTUPDOPRID.Value = GPGB_EDILIB_AET.OPRID;

            /* ADDED to replicate defaulting */
            Local string &P45CALRUN;
            Local date &LEAVDT;
            Local number &ediref;

            &sSql = "SELECT A.GPGB_P45_CAL_RUN,%dateout(A.LEAVE_DT),A.GPGB_EDI_REF FROM
PS_GPGB_EE_TAX A WHERE A.EMPLID = :1 AND A.EMPL_RCD = :2 and A.EFFDT = (SELECT MAX(B.EFFDT)
FROM PS_GPGB_EE_TAX B WHERE A.EMPLID = B.EMPLID AND A.EMPL_RCD = B.EMPL_RCD AND B.EFFDT <=
%datein(:3))AND A.EFFSEQ = (SELECT MAX(C.EFFSEQ) FROM PS_GPGB_EE_TAX C WHERE C.EMPLID =
A.EMPLID AND C.EMPL_RCD = A.EMPL_RCD AND C.EFFDT = A.EFFDT)";

            SQLExec(&sSql, GPGB_EDILIB_AET.EMPLID, GPGB_EDILIB_AET.EMPL_RCD,
GPGB_EDILIB_AET.GPGB_EDI_DATE, &P45CALRUN, &LEAVDT, &ediref);



            If All(&LEAVDT, &P45CALRUN) Then
               &Rec.LEAVE_DT.Value = &LEAVDT;

               &Rec.GPGB_P45_CAL_RUN.Value = &P45CALRUN;
            End-If;

            If All(&ediref) Then
               &Rec.GPGB_EDI_REF.Value = &ediref;
            End-If;
            /*Note field is handled differently depending on insert or update*/
            /*Message will be the same - but if this is an insert then existing notes*/
            /*will not be maintained*/
            &sMsg = "Provided by EDI file %1 (reference %2) on %3";
            &iMessNum = 390;
            &sParam1 = GPGB_EDILIB_AET.GPGB_EDI_FILENAME;
            &sParam2 = String(GPGB_EDILIB_AET.GPGB_EDI_REF);
            &sParam3 = String(%AsOfDate);
            GPGB_EDILIB_AET.GPGB_EDI_MESSAGE = MsgGetText(&iMessCat, &iMessNum, &sMsg,
&sParam1, &sParam2, &sParam3, &sParam4);

            /*
                                                                                              The foll
                                                                                              to a dif

            &sNotes = &Rec.NOTES.Value;
            If &bUpdReq Then
               If All(&sNotes) Then
                  &sNotes = &sNotes | Char(13);
               End-If;
               &sNotes = &sNotes | GPGB_EDILIB_AET.GPGB_EDI_MESSAGE;
            Else
               &sNotes = GPGB_EDILIB_AET.GPGB_EDI_MESSAGE;
            End-If;
            &Rec.NOTES.Value = &sNotes;
                                                                                              */

            /*updating notes*/
            &Rec2 = CreateRecord(Record.GPGB_EE_TAX_NTS);
            &Rec2.EMPLID.Value = &Rec.EMPLID.Value;
            &Rec2.EMPL_RCD.Value = &Rec.EMPL_RCD.Value;
            &Rec2.EFFDT.Value = &Rec.EFFDT.Value;
             &Rec2.EFFSEQ.Value = &Rec.EFFSEQ.Value;
             &Rec2.GPGB_NOTES.Value = GPGB_EDILIB_AET.GPGB_EDI_MESSAGE;
             /****************/



            &sTaxMsg = ParseTaxCodeUK(&Rec.TAXCODE_UK, &Rec.GPGB_SV_TAX_IND,
&Rec.GPGB_TAX_CD_NUM, &Rec.GPGB_TAX_CD_ALPHA, &Rec.TAX_BASIS_UK);

             If Len(&sTaxMsg) > 0 Then

               &bOk = False;
               &sMsg = "P6/P9 Error : employee %1 (%2) tax code error of: %3 - no update
possible";
               &bMsg = SetDtlMessage2(17135, 352, "ERROR", &sMsg, &sSurname,
GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID, &sTaxMsg, "");
               &bMsg = P6AdditionalInfo(&sSurname);

             End-If;

             If &bOk Then

               If GPGB_EDILIB_AET.GPGB_EDI_RUN_TYPE = "0" Then /*Final Run*/

                   /*A   new row is always inserted since EFFSEQ is availabe. Therefore this



                     &bOk = &Rec.Update();
                     &sMsg = "P6/P9 Status : updated employee %1 (%2) current P6/P9 details";
                     &bMsg = SetDtlMessage2(17135, 365, "STATUS", &sMsg, &sSurname,
GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID, "", "");
                  Else*/

                   &bOk = &Rec.Insert();
                   If &bOk Then
                      &bOk = &Rec2.Insert();
                   End-If;

                  /*write message saying ee inserted*/
                  &sMsg = "P6/P9 Status : added employee %1 (%2) P6/P9 details";
                  &bMsg = SetDtlMessage2(17135, 364, "STATUS", &sMsg, &sSurname,
GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID, "", "");
                  /*End-If;*/

               End-If; /*Final Run Check*/

             End-If; /*bOk - taxcode parses*/


          End-If; /*sql fetch*/

      Else

         &sMsg = "P6/P9 Error : employee %1 (%2) has an existing row on the same date - no
update possible";
         &bMsg = SetDtlMessage2(17135, 350, "ERROR", &sMsg, &sSurname,
GetWorksId(GPGB_EDILIB_AET.EMPLID, GPGB_EDILIB_AET.EMPL_RCD), "", "");

          &bMsg = P6AdditionalInfo(&sSurname);

      End-If; /*data conflict checks*/

   Else

      &bMsg = P6AdditionalInfo(&sSurname);

   End-If; /*got match*/
   /*Clear down discretionary ee fields - might not be read for next ee in file*/
   GPGB_EDILIB_AET.GPGB_P45_PAY_TD = 0;
   GPGB_EDILIB_AET.GPGB_P45_TAX_TD = 0;
         GPGB_EDILIB_AET.GPGB_P45_TXYR = 0;
         GPGB_EDILIB_AET.GPGB_SV_TAX_IND = " ";
         GPGB_EDILIB_AET.TAX_BASIS_UK = " ";

         Return &bOk;
      End-Function;

      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Record): GPGB_EE_CO_HDR.EMPLID.SaveEdit
      [ . . . Unchanged Code not Shown . . . ]



      If All(GPGB_EE_CO_HDR.GPGB_CO_LEG) Then;

         &EMP_SCROLL = GetLevel0();
         &HDR_SCROLL = &EMP_SCROLL.GetRow(1).GetRowset(Scroll.GPGB_EE_CO_HDR);
         &DTL_SCROLL = &HDR_SCROLL.GetRow(CurrentRowNumber(1)).GetRowset(Scroll.GPGB_EE_CO_DTL);
         &OLD_DATE = "";
         &NEW_DATE = "";
         &RWNUM = "";
         &Blank = False;
         &ACTROWS = ActiveRowCount(Record.GPGB_EE_CO_HDR, CurrentRowNumber(1),
      Record.GPGB_EE_CO_DTL);

         /* check to see that there isn't more than one hdr row */
         &COUNTER = 0;
         For &I = 1 To &HDR_SCROLL.ActiveRowCount;
            &DTL_SCROLL2 = &HDR_SCROLL.GetRow(&I).GetRowset(Scroll.GPGB_EE_CO_DTL);
            &COUNTER1 = 0;
            For &J = 1 To &DTL_SCROLL2.ActiveRowCount;
               If (&DTL_SCROLL2(&J).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value = "A") Then
                  &COUNTER1 = &COUNTER1 + 1;
               End-If;
            End-For;
            If &COUNTER1 >= 1 Then
               &COUNTER = &COUNTER + 1;
            End-If;
         End-For;

         If &COUNTER > 1 Then
            Error MsgGet(17130, 67, "Message Not Found");
         End-If;

         /*If manual sequencing chosen, just number rows in the sequence in which they occur*/

         /* test the indicator here*/
         If GPGB_EE_CO_HDR.GPGB_CO_SEQ_IND = "M" Then
            Warning MsgGet(17130, 70, "Message Not Found");
            For &I = 1 To &ACTROWS;
               If None(&DTL_SCROLL(&I).GPGB_EE_CO_DTL.SEQNUM.Value) And
                     (&DTL_SCROLL(&I).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value = "A") Then
                  Error MsgGet(17130, 86, "You must specify a sequence number for all active court
      orders");
                  Break;
               End-If;
            End-For;
         End-If;


         For &I = 1 To &ACTROWS;
            &DATE = Sdate(&I);
            &ORDER = Sorder(&I);
            &LEG = Sleg(&I);

            If &DTL_SCROLL(&I).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value = "I" Then
        &DTL_SCROLL(&I).GPGB_EE_CO_DTL.GPGB_CO_ORD_NUM.Value = 0;
        &DTL_SCROLL(&I).GPGB_EE_CO_DTL.SEQNUM.Value = 0;
     Else

        Evaluate &ORDER
        When = "AEN"
           &AEN_COUNT =   &AEN_COUNT + 1;
        When "AEF";
           &AEF_COUNT =   &AEF_COUNT + 1;
        When = "AEP"
           &AEP_COUNT =   &AEP_COUNT + 1;
        When = "CAO"
           &CAO_COUNT =   &CAO_COUNT + 1;
        When = "CCA"
           &CCA_COUNT =   &CCA_COUNT + 1;
        When = "CMA"
           &CMA_COUNT =   &CMA_COUNT + 1;
        When = "CTA"
           &CTA_COUNT =   &CTA_COUNT + 1;
        When = "DEO"
           &DEO_COUNT =   &DEO_COUNT + 1;
        When "DPP"
           &DPP_COUNT =   &DPP_COUNT + 1;
        When = "EAO"
           &EAO_COUNT =   &EAO_COUNT + 1;
        End-Evaluate;

        /*Test to limit the number of each type of order here - */
        If &AEN_COUNT > 3 Or
              &AEF_COUNT > 3 Or
              &EAO_COUNT > 3 Or
              &AEP_COUNT > 3 Or
              &CCA_COUNT > 3 Or
              &CMA_COUNT > 3 Or
              &CTA_COUNT > 3 Or
              /*&CTA_COUNT > 3 Or* removed checking for ice 1838907000*/


              &DEO_COUNT > 3 Or
              &CAO_COUNT > 3 Then
           Error MsgGet(17130, 66, "Message Not Found");
        End-If;
        If &CTA_COUNT > 2 Then
           Warning MsgGet(17130, 249, "Message Not Found");

        End-If;
        /* For Order is not a CAO type then reset CAO_IND */
        If &ORDER <> "CAO" Then
           &DTL_SCROLL(&I).GPGB_EE_CO_DTL.GPGB_CO_CAO_IND.SetDefault();
        End-If;
        /* For Order is not a CAO type then reset CAO_IND */


        /*Allocate court order number*/
        If &DTL_SCROLL(&I).GPGB_EE_CO_DTL.GPGB_CO_ORD_NUM.Value = "" And
              &DTL_SCROLL(&I).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value = "A" Then

           &CO_ORDER_TOT = 0;
           &SUM_CO_ORD_NUM = 0;

           For &RC = 1 To &DTL_SCROLL.ActiveRowCount;

              &CO_STOP_DT = &DTL_SCROLL(&RC).GPGB_EE_CO_DTL.STOP_DATE.Value;

               If &DTL_SCROLL(&RC).GPGB_EE_CO_DTL.GPGB_CO_ORDER.Value = &ORDER And
                     All(&DTL_SCROLL(&RC).GPGB_EE_CO_DTL.GPGB_CO_ORD_NUM.Value) And
                     &DTL_SCROLL(&RC).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value = "A" Then
                  &SUM_CO_ORD_NUM = &SUM_CO_ORD_NUM +
&DTL_SCROLL(&RC).GPGB_EE_CO_DTL.GPGB_CO_ORD_NUM.Value;
                  &CO_ORDER_TOT = &CO_ORDER_TOT + 1;
               End-If;
        End-For;

        If &CO_ORDER_TOT < 3 Then
           &CO_NUM = (3 * &CO_ORDER_TOT) - &SUM_CO_ORD_NUM;
           If &CO_NUM = 0 Then
              &CO_NUM = 1
           End-If;
        Else
           &CO_NUM = 1;
        End-If;

        &DTL_SCROLL(&I).GPGB_EE_CO_DTL.GPGB_CO_ORD_NUM.Value = &CO_NUM;

     End-If;

   End-If;
End-For;

If &ACTROWS = 1 And
      &DTL_SCROLL(1).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value = "A" Then
   &DTL_SCROLL(1).GPGB_EE_CO_DTL.SEQNUM.Value = 1;
   &I = 1;
   /*&AepAmountBlank = CheckAepAmountPayable(&I);
   If &AepAmountBlank = True Then
      Warning MsgGet(17130, 206, "Message Not Found");
   End-If;*/
End-If;

/*now check we have more than 1 row and act accordingly*/
If &ACTROWS > 1 Then

  /*CHECK WHICH LEGISLATION AREA WE'RE IN - PRIORITY IS DIFFERENT FOR EACH ONE*/
  If &LEG = "SC" And
        GPGB_EE_CO_HDR.GPGB_CO_SEQ_IND = "S" Then
     /*Check for invalid numbers of orders*/
     If &CAO_COUNT > 1 Then
        Error MsgGet(17130, 71, "Message Not Found");
     End-If;
     If &EAO_COUNT > 1 Then
        Error MsgGet(17130, 54, "Message Not Found");
     End-If;
     If &CMA_COUNT > 1 Then
        Error MsgGet(17130, 68, "Message Not Found");
     End-If;
     If &DPP_COUNT > 1 Then
        Error MsgGet(17130, 201, "Message Not Found");
     End-If;

     /*Check for invalid combinations of orders*/
     If &CAO_COUNT > 0 And
           (&EAO_COUNT > 0 Or
              &CMA_COUNT > 0) Then
        Error MsgGet(17130, 69, "Message Not Found");
     End-If;

     If &DPP_COUNT = 1 And
           (&EAO_COUNT = 1 Or
              &CMA_COUNT = 1) Then
        For &I = 1 To &ACTROWS;
           If &DTL_SCROLL(&I).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value = "A" Then
              &ORDER = Sorder(&I);
              &DATE = Sdate(&I);
              If &ORDER = "EAO" Or
                    &ORDER = "CMA" Then
                 &OrderDate = &DATE
              End-If;
              If &ORDER = "DPP" Then
                 &DPPDate = &DATE
              End-If;
           End-If;
     End-For;
     If String(&DPPDate) = "" Or
           (&DPPDate > &OrderDate) Then
        Error MsgGet(17130, 205, "Message Not Found");
     Else
        Error MsgGet(17130, 204, "Message Not Found");
     End-If;
  End-If;

  If &CAO_COUNT = 1 And
        &DPP_COUNT = 1 Then
     For &I = 1 To &ACTROWS;
        If &DTL_SCROLL(&I).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value = "A" Then
           &ORDER = Sorder(&I);
           &DATE = Sdate(&I);
           Evaluate &ORDER
           When "CAO"
              &CAODate = &DATE
           When "DPP"
              &DPPDate = &DATE
           End-Evaluate;
        End-If;
     End-For;
     If &CAODate < &DPPDate Then
        Error MsgGet(17130, 202, "Message Not Found");
     Else
        Error MsgGet(17130, 203, "Message Not Found");
     End-If;
  End-If;

  &StartSequence = 1;

  If &DEO_COUNT > 0 Then
     &DEO_Array = CreateArrayRept(CreateArrayRept(0, 0), 0);
     &J = 1;
     For &I = 1 To &ACTROWS;
        If &DTL_SCROLL(&I).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value = "A" Then
           &DATE = Sdate(&I);
           &ORDER = Sorder(&I);
           &RWNUM = Srow(&I);
           &JDATE = Days(&DATE);
           If &ORDER = "DEO" Then
              &DEO_Array.Push(&JDATE);
              &DEO_Array [&J].Push(&RWNUM);
              &J = &J + 1;
           End-If;
        End-If;
     End-For;
     &DEO_Array.Sort("A");
     &LEN = &DEO_Array.Len;
     For &J = 1 To &LEN;
        &ITEM = &DEO_Array [&J][2];
        &DTL_SCROLL(&ITEM).GPGB_EE_CO_DTL.SEQNUM.Value = &StartSequence;
        &StartSequence = &StartSequence + 1;
     End-For;
  End-If;

   If &CAO_COUNT = 1 Or
         &DPP_COUNT = 1 Then
      For &I = 1 To &ACTROWS;
         If &DTL_SCROLL(&I).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value = "A" Then
            &ORDER = Sorder(&I);
            If &ORDER <> "DEO" Then
               &DTL_SCROLL(&I).GPGB_EE_CO_DTL.SEQNUM.Value = &StartSequence;
               &StartSequence = &StartSequence + 1;
            End-If;
         End-If;
      End-For;
   End-If;
End-If;
If &EAO_COUNT = 1 Then
   For &I = 1 To &ACTROWS;
      If &DTL_SCROLL(&I).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value = "A" Then
         &ORDER = Sorder(&I);
         Evaluate &ORDER
         When "EAO"
            &DTL_SCROLL(&I).GPGB_EE_CO_DTL.SEQNUM.Value = &StartSequence;
         When "CMA"
            &DTL_SCROLL(&I).GPGB_EE_CO_DTL.SEQNUM.Value = &StartSequence + 1;
         End-Evaluate;


      End-If;
   End-For;
Else
   If &CMA_COUNT = 1 Then
      For &I = 1 To &ACTROWS;
         If &DTL_SCROLL(&I).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value = "A" Then
             &ORDER = Sorder(&I);
             If &ORDER = "CMA" Then
                &DTL_SCROLL(&I).GPGB_EE_CO_DTL.SEQNUM.Value = &StartSequence;
             End-If;
         End-If;
      End-For;
   End-If;
End-If;
If &LEG = "EW" And
      GPGB_EE_CO_HDR.GPGB_CO_SEQ_IND = "S" Then
   &OLD_DATE = "";
   &NEW_DATE = "";
   &RWNUM = "";
   &DONE = "";
   For &I = 1 To &ACTROWS;
      If &DTL_SCROLL(&I).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value = "A" Then
         &EW_DATE = "1993-04-01";
         &DATE = Sdate(&I);
         &ORDER = Sorder(&I);
         &RWNUM = Srow(&I);
         If &DATE < &EW_DATE And
                &CCA_COUNT > 1 Then
             Error MsgGet(17130, 55, "Message Not Found");
         End-If;
         /* Check for blank Total Amount Payable for AEP and warn */
         /*&AepAmountBlank = CheckAepAmountPayable(&I);*/
      End-If;
   End-For;
   /*If &AepAmountBlank = True Then
      Warning MsgGet(17130, 206, "Message Not Found");
   End-If;*/
   If &AEN_COUNT > 0 Then
      &PORDERS1 = CreateArrayRept(0, 0);
      &PORDERS = CreateArrayRept(&PORDERS1, 0);
      &NORDERS1 = CreateArrayRept(0, 0);
      &NORDERS = CreateArrayRept(&NORDERS1, 0);
      &J = 1;
      For &I = 1 To &ACTROWS;
         If &DTL_SCROLL(&I).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value = "A" Then
             &DATE = Sdate(&I);
             &ORDER = Sorder(&I);
             &RWNUM = Srow(&I);
             &JDATE = Days(&DATE);
             If &ORDER <> "AEN" Then
                &PORDERS.Push(&JDATE);
                &PORDERS [&J].Push(&RWNUM);
                &J = &J + 1;
             End-If;
         End-If;
      End-For;
      &K = 1;
      For &I = 1 To &ACTROWS;
         If &DTL_SCROLL(&I).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value = "A" Then
            &DATE = Sdate(&I);
            &ORDER = Sorder(&I);
            &RWNUM = Srow(&I);
            &JDATE = Days(&DATE);
            If &ORDER = "AEN" Then
                &NORDERS.Push(&JDATE);
                &NORDERS [&K].Push(&RWNUM);
                &K = &K + 1;
            End-If;
         End-If;
      End-For;
      &PORDERS.Sort("A");
      &LEN = &PORDERS.Len;
      For &J = 1 To &LEN;
         &ITEM = &PORDERS [&J][2];
         &DTL_SCROLL(&ITEM).GPGB_EE_CO_DTL.SEQNUM.Value = &SEQ + 1;
         &SEQ = &SEQ + 1;
      End-For;
      &NORDERS.Sort("A");
      &LEN = &NORDERS.Len;
      For &K = 1 To &LEN;
         &ITEM = &NORDERS [&K][2];
         &DTL_SCROLL(&ITEM).GPGB_EE_CO_DTL.SEQNUM.Value = &SEQ + 1;
         &SEQ = &SEQ + 1;
      End-For;
   Else
      &PORDERS1 = CreateArrayRept(0, 0);
      &PORDERS = CreateArrayRept(&PORDERS1, 0);
      &J = 1;
      For &I = 1 To &ACTROWS;
         If &DTL_SCROLL(&I).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value = "A" Then
            &DATE = Sdate(&I);
            &ORDER = Sorder(&I);
            &RWNUM = Srow(&I);
            &JDATE = Days(&DATE);
            &PORDERS.Push(&JDATE);
            &PORDERS [&J].Push(&RWNUM);
            &J = &J + 1;
         End-If;
      End-For;
      &PORDERS.Sort("A");
      &LEN = &PORDERS.Len;
      For &J = 1 To &LEN;
         &ITEM = &PORDERS [&J][2];
         &DTL_SCROLL(&ITEM).GPGB_EE_CO_DTL.SEQNUM.Value = &SEQ + 1;
         &SEQ = &SEQ + 1;
      End-For;
   End-If;
End-If;
If &LEG = "NI" And
      GPGB_EE_CO_HDR.GPGB_CO_SEQ_IND = "S" Then
   &OLD_DATE = "";
   &NEW_DATE = "";
   &RWNUM = "";
   &DONE = "";
   For &I = 1 To &ACTROWS;
      If &DTL_SCROLL(&I).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value = "A" Then
         &EW_DATE = "1993-04-01";
         &DATE = Sdate(&I);
         &ORDER = Sorder(&I);
         &RWNUM = Srow(&I);
         If &DATE < &EW_DATE And
                &CCA_COUNT > 1 Then
            &TESTVAR = "Error";
         End-If;
      End-If;
   End-For;
   If &AEN_COUNT > 0 Then
      &PORDERS1 = CreateArrayRept(0, 0);
      &PORDERS = CreateArrayRept(&PORDERS1, 0);
      &NORDERS1 = CreateArrayRept(0, 0);
     &NORDERS = CreateArrayRept(&NORDERS1, 0);
     &J = 1;
     For &I = 1 To &ACTROWS;
        If &DTL_SCROLL(&I).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value =   "A" Then
           &DATE = Sdate(&I);
           &ORDER = Sorder(&I);
           &RWNUM = Srow(&I);
           &JDATE = Days(&DATE);
           If &ORDER <> "AEN" Then
              &PORDERS.Push(&JDATE);
              &PORDERS [&J].Push(&RWNUM);
              &J = &J + 1;
           End-If;
        End-If;
     End-For;
     &K = 1;
     For &I = 1 To &ACTROWS;
        If &DTL_SCROLL(&I).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value =   "A" Then
           &DATE = Sdate(&I);
           &ORDER = Sorder(&I);
           &RWNUM = Srow(&I);
           &JDATE = Days(&DATE);
           If &ORDER = "AEN" Then
              &NORDERS.Push(&JDATE);
              &NORDERS [&K].Push(&RWNUM);
              &K = &K + 1;
           End-If;
        End-If;
     End-For;
     &PORDERS.Sort("A");
     &LEN = &PORDERS.Len;
     For &J = 1 To &LEN;
        &ITEM = &PORDERS [&J][2];
        &DTL_SCROLL(&ITEM).GPGB_EE_CO_DTL.SEQNUM.Value = &SEQ   + 1;
        &SEQ = &SEQ + 1;
     End-For;
     &NORDERS.Sort("A");
     &LEN = &NORDERS.Len;
     For &K = 1 To &LEN;
        &ITEM = &NORDERS [&K][2];
        &DTL_SCROLL(&ITEM).GPGB_EE_CO_DTL.SEQNUM.Value = &SEQ   + 1;
        &SEQ = &SEQ + 1;
     End-For;
  Else
     &PORDERS1 = CreateArrayRept(0, 0);
     &PORDERS = CreateArrayRept(&PORDERS1, 0);
     &J = 1;
     For &I = 1 To &ACTROWS;
        If &DTL_SCROLL(&I).GPGB_EE_CO_DTL.ACTIVE_FLAG.Value =   "A" Then
           &DATE = Sdate(&I);
           &ORDER = Sorder(&I);
           &RWNUM = Srow(&I);
           &JDATE = Days(&DATE);
           &PORDERS.Push(&JDATE);
           &PORDERS [&J].Push(&RWNUM);
           &J = &J + 1;
        End-If;
     End-For;
     &PORDERS.Sort("A");
     &LEN = &PORDERS.Len;
     For &J = 1 To &LEN;
        &ITEM = &PORDERS [&J][2];
        &DTL_SCROLL(&ITEM).GPGB_EE_CO_DTL.SEQNUM.Value = &SEQ   + 1;
        &SEQ = &SEQ + 1;
     End-For;

  End-If;
  /*end of the if statement testing if there is an AEN*/

End-If;
/*end of the legislation if statement testing if NI*/
         End-If;
      End-If;




PeopleCode (Record): GPGB_EE_TAX.GPGB_TAX_CD_SRC.FieldChange
      If GetRow().IsNew Then
         Evaluate GPGB_EE_TAX.GPGB_TAX_CD_SRC
         When "P6"
            &sSql = "SELECT MAX(GPGB_TAX_YR_END) FROM PS_GPGB_EE_TAX WHERE EMPLID = :1 AND
      GPGB_TAX_CD_SRC IN('P45','P6','P6T','P6B')";

            SQLExec(&sSql, GPGB_EE_TAX.EMPLID, &TEMP);
            &ssql45 = "SELECT GPGB_P45_PAY_TD,GPGB_P45_TAX_TD FROM PS_GPGB_EE_TAX WHERE EMPLID =
      :1 AND GPGB_TAX_CD_SRC IN('P45','P6','P6T','P6B') AND GPGB_TAX_YR_END =:2";
            SQLExec(&ssql45, GPGB_EE_TAX.EMPLID, &TEMP, &t1, &t2);

            If GPGB_EE_TAX.GPGB_P45_PAY_TD = 0 Then
               GPGB_EE_TAX.GPGB_P45_PAY_TD.Value = &t1;
               GPGB_EE_TAX.GPGB_TAX_YR_END.Value = &TEMP;
            End-If;
            If GPGB_EE_TAX.GPGB_P45_TAX_TD = 0 Then
               GPGB_EE_TAX.GPGB_P45_TAX_TD.Value = &t2;
            End-If;
         When "P6T"
            &sSql = "SELECT MAX(GPGB_TAX_YR_END) FROM PS_GPGB_EE_TAX WHERE EMPLID = :1 AND
      GPGB_TAX_CD_SRC IN('P45','P6','P6T','P6B')";

            SQLExec(&sSql, GPGB_EE_TAX.EMPLID, &TEMP);
            &ssql45 = "SELECT GPGB_P45_PAY_TD,GPGB_P45_TAX_TD FROM PS_GPGB_EE_TAX WHERE EMPLID =
      :1 AND GPGB_TAX_CD_SRC IN('P45','P6','P6T','P6B') AND GPGB_TAX_YR_END =:2";
            SQLExec(&ssql45, GPGB_EE_TAX.EMPLID, &TEMP, &t1, &t2);

            If GPGB_EE_TAX.GPGB_P45_PAY_TD = 0 Then
               GPGB_EE_TAX.GPGB_P45_PAY_TD.Value = &t1;
               GPGB_EE_TAX.GPGB_TAX_YR_END.Value = &TEMP;
            End-If;
            If GPGB_EE_TAX.GPGB_P45_TAX_TD = 0 Then
               GPGB_EE_TAX.GPGB_P45_TAX_TD.Value = &t2;
            End-If;
         When "P6B"
            &sSql = "SELECT MAX(GPGB_TAX_YR_END) FROM PS_GPGB_EE_TAX WHERE EMPLID = :1 AND
      GPGB_TAX_CD_SRC IN('P45','P6','P6T','P6B')";

            SQLExec(&sSql, GPGB_EE_TAX.EMPLID, &TEMP);
            &ssql45 = "SELECT GPGB_P45_PAY_TD,GPGB_P45_TAX_TD FROM PS_GPGB_EE_TAX WHERE EMPLID =
      :1 AND GPGB_TAX_CD_SRC IN('P45','P6','P6T','P6B') AND GPGB_TAX_YR_END =:2";
            SQLExec(&ssql45, GPGB_EE_TAX.EMPLID, &TEMP, &t1, &t2);

            If GPGB_EE_TAX.GPGB_P45_PAY_TD = 0 Then
               GPGB_EE_TAX.GPGB_P45_PAY_TD.Value = &t1;
               GPGB_EE_TAX.GPGB_TAX_YR_END.Value = &TEMP;
            End-If;
            If GPGB_EE_TAX.GPGB_P45_TAX_TD = 0 Then
               GPGB_EE_TAX.GPGB_P45_TAX_TD.Value = &t2;
            End-If;
         End-Evaluate;
      End-If;




PeopleCode (Record): GPGB_RSLT_ARR_W.RSLT_SEG_NUM.RowInit
      Local   Rowset   &LEVEL0;
      Local   string   &EMPLID;
      Local   string   &CAL_RUN_ID;
      Local   string   &GP_PAYGROUP;
      Local   string &CAL_ID;
      Local   string &GPGB_PSLIP_DESCR;
      Local   number &EMPL_RCD;
      Local   number &RSLT_SEG_NUM;
      Local   number &GPGB_ELE_ORDER;
      Local   number &GPGB_PIN_NUM_CUR;
      Local   date &SEG_END_DT;

      If %Component = Component.GPGB_PSLIP_PU_PNLG Then

         &LEVEL0 = GetLevel0();
         &EMPLID = &LEVEL0(1).GPGB_PSLIP_PU_H.EMPLID.Value;
         &CAL_RUN_ID = &LEVEL0(1).GPGB_PSLIP_PU_H.CAL_RUN_ID.Value;
         &EMPL_RCD = &LEVEL0(1).GPGB_PSLIP_PU_H.EMPL_RCD.Value;
         &GP_PAYGROUP = &LEVEL0(1).GPGB_PSLIP_PU_H.GP_PAYGROUP.Value;
         &CAL_ID = &LEVEL0(1).GPGB_PSLIP_PU_H.CAL_ID.Value;
         &RSLT_SEG_NUM = &LEVEL0(1).GPGB_PSLIP_PU_H.RSLT_SEG_NUM.Value;

         &GPGB_PIN_NUM_CUR = GPGB_RSLT_ARR_W.GPGB_PIN_NUM_CUR.Value;

         /* Get the segment end date */
         SQLExec("select %DATEOUT(SEG_END_DT) from PS_GP_PYE_SEG_STAT where EMPLID = :1 and
      CAL_RUN_ID = :2 and EMPL_RCD = :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6",
      &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM, &SEG_END_DT);

         /* Get the payslip definition details for the Balance */
         SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER from PS_GPGB_PSLIP_ARR A,
      PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_PU and B.GP_PAYGROUP = :1 and
      GPGB_PIN_NUM_CUR = :2 and B.EFFDT < %datein(:3) and A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM
      PS_GPGB_PSLIP_ARR A_ED WHERE A.GPGB_PSLIP_ID = A_ED.GPGB_PSLIP_ID AND A_ED.EFFDT <= B.EFFDT
      )", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR, &SEG_END_DT, &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER);

         SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER from PS_GPGB_PSLIP_ARR A,
      PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_PU and B.GP_PAYGROUP = :1 and
      GPGB_PIN_NUM_CUR = :2 and B.EFFDT = ( select MAX(GRP.EFFDT) from PS_GPGB_PSLIP_GRP GRP where
      GRP.GP_PAYGROUP = B.GP_PAYGROUP and GRP.EFFDT <= %datein(:3)) and A.EFFDT = ( SELECT
      MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_ARR A_ED WHERE A.GPGB_PSLIP_ID = A_ED.GPGB_PSLIP_ID AND
      A_ED.EFFDT <= %datein(:3))", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR, &SEG_END_DT,
      &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER);
         GPGB_RSLT_ARR_W.GPGB_PSLIP_DESCR = &GPGB_PSLIP_DESCR;
         GPGB_RSLT_ARR_W.GPGB_ELE_ORDER = &GPGB_ELE_ORDER;

      End-If;




PeopleCode (Record): GPGB_RSLT_ATX_W.RSLT_SEG_NUM.RowInit
      Declare Function get_accum_row PeopleCode FUNCLIB_GPGB.GPGB_PAYSLIP_FNS FieldFormula;
      Declare Function get_pin_value PeopleCode FUNCLIB_GPGB.GPGB_PAYSLIP_FNS FieldFormula;

      Local   Rowset &GP_RSLT_ACUM;
      Local   Rowset &LEVEL0;
      Local   string &EMPLID;
      Local   string &CAL_RUN_ID;
      Local   string &GP_PAYGROUP;
      Local   string &CAL_ID;
      Local   string &GPGB_PSLIP_DESCR;
      Local   number &EMPL_RCD;
      Local   number &RSLT_SEG_NUM;
      Local   number &GPGB_PSLIP_DETAIL;
      Local   number &GPGB_ELE_ORDER;
      Local   number &GPGB_PIN_NUM_CUR;
      Local   number &GPGB_PIN_NUM_YTD;
      Local   number &ROW;
      Local   number &ACUM_ROWS;
      Local   number &PIN_NUM;
      Local   date &SEG_END_DT;

      If %Component = Component.GPGB_PSLIP_PU_PNLG Then
   &LEVEL0 = GetLevel0();
   &EMPLID = &LEVEL0(1).GPGB_PSLIP_PU_H.EMPLID.Value;
   &CAL_RUN_ID = &LEVEL0(1).GPGB_PSLIP_PU_H.CAL_RUN_ID.Value;
   &EMPL_RCD = &LEVEL0(1).GPGB_PSLIP_PU_H.EMPL_RCD.Value;
   &GP_PAYGROUP = &LEVEL0(1).GPGB_PSLIP_PU_H.GP_PAYGROUP.Value;
   &CAL_ID = &LEVEL0(1).GPGB_PSLIP_PU_H.CAL_ID.Value;
   &RSLT_SEG_NUM = &LEVEL0(1).GPGB_PSLIP_PU_H.RSLT_SEG_NUM.Value;

   &GPGB_PIN_NUM_CUR = GPGB_RSLT_ATX_W.GPGB_PIN_NUM_CUR.Value;

   /* Get the segment end date */
   SQLExec("select %DATEOUT(SEG_END_DT) from PS_GP_PYE_SEG_STAT where EMPLID = :1 and
CAL_RUN_ID = :2 and EMPL_RCD = :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6",
&EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM, &SEG_END_DT);

   /* Get the payslip definition details for the deduction */
   SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD, GPGB_PSLIP_DETAIL
from PS_GPGB_PSLIP_ATXD A, PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_PU and
B.GP_PAYGROUP = :1 and GPGB_PIN_NUM_CUR = :2 and B.EFFDT < %datein(:3) and A.EFFDT = ( SELECT
MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_ATXD A_ED WHERE A.GPGB_PSLIP_ID = A_ED.GPGB_PSLIP_ID AND
A_ED.EFFDT <= B.EFFDT )", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR, &SEG_END_DT, &GPGB_PSLIP_DESCR,
&GPGB_ELE_ORDER, &GPGB_PIN_NUM_YTD, &GPGB_PSLIP_DETAIL);
   SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD, GPGB_PSLIP_DETAIL
from PS_GPGB_PSLIP_ATXD A, PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_PU and
B.GP_PAYGROUP = :1 and GPGB_PIN_NUM_CUR = :2 and B.EFFDT = ( select MAX(GRP.EFFDT) from
PS_GPGB_PSLIP_GRP GRP where GRP.GP_PAYGROUP = B.GP_PAYGROUP and GRP.EFFDT <= %datein(:3)) and
A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_ATXD A_ED WHERE A.GPGB_PSLIP_ID =
A_ED.GPGB_PSLIP_ID AND A_ED.EFFDT <= %datein(:3))", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR,
&SEG_END_DT, &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER, &GPGB_PIN_NUM_YTD, &GPGB_PSLIP_DETAIL);


   GPGB_RSLT_ATX_W.GPGB_PSLIP_DESCR = &GPGB_PSLIP_DESCR;
   GPGB_RSLT_ATX_W.GPGB_ELE_ORDER = &GPGB_ELE_ORDER;
   GPGB_RSLT_ATX_W.GPGB_PIN_NUM_YTD = &GPGB_PIN_NUM_YTD;
   GPGB_RSLT_ATX_W.GPGB_PSLIP_DETAIL = &GPGB_PSLIP_DETAIL;

   If GPGB_RSLT_ATX_W.GPGB_PIN_NUM_YTD > 0 Then

      &PIN_NUM = GPGB_RSLT_ATX_W.GPGB_PIN_NUM_YTD;

      /* Get the acummulator rows */
      &GP_RSLT_ACUM = CreateRowset(Record.GP_RSLT_ACUM);
      &ACUM_ROWS = &GP_RSLT_ACUM.Fill("where EMPLID = :1 and CAL_RUN_ID = :2 and EMPL_RCD =
:3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6 and PIN_NUM = :7 and ACM_FROM_DT
= (SELECT MAX(B.ACM_FROM_DT) FROM PS_GP_RSLT_ACUM B WHERE B.EMPLID = :1 and B.CAL_RUN_ID =
:2 and B.EMPL_RCD = :3 and B.GP_PAYGROUP = :4 and B.CAL_ID = :5 and B.RSLT_SEG_NUM = :6 and
B.PIN_NUM = :7)", &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM,
&PIN_NUM);

      /* Get the appropriate row */
      &ROW = get_accum_row(&GP_RSLT_ACUM, GPGB_RSLT_ATX_W.USER_FLD1,
GPGB_RSLT_ATX_W.USER_FLD2, GPGB_RSLT_ATX_W.USER_FLD3, GPGB_RSLT_ATX_W.USER_FLD4, &EMPLID,
&CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM);

      If &ROW > 0 Then
         GPGB_RSLT_ATX_W.GPGB_RSLT_VAL_YTD =
&GP_RSLT_ACUM(&ROW).GP_RSLT_ACUM.CALC_RSLT_VAL.Value;
      End-If;

      If GPGB_RSLT_ATX_W.INSTANCE.Value > 0 And
            GPGB_RSLT_ATX_W.INSTANCE.Value <= &ACUM_ROWS And
            GPGB_RSLT_ATX_W.GPGB_RATE_CUR.Value <> 0 Then
         GPGB_RSLT_ATX_W.GPGB_RSLT_VAL_YTD.Visible = False;
      End-If;

   End-If;

   If &GPGB_PSLIP_DETAIL > 0 Then
      GPGB_RSLT_ATX_W.GPGB_PSLIP_D_TXT = get_pin_value(&GPGB_PSLIP_DETAIL, &EMPLID,
&CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM);
         End-If;

      End-If;




PeopleCode (Record): GPGB_RSLT_BTX_W.RSLT_SEG_NUM.RowInit
      Declare Function get_accum_row PeopleCode FUNCLIB_GPGB.GPGB_PAYSLIP_FNS FieldFormula;
      Declare Function get_pin_value PeopleCode FUNCLIB_GPGB.GPGB_PAYSLIP_FNS FieldFormula;

      Local   Rowset &GP_RSLT_ACUM;
      Local   Rowset &LEVEL0;
      Local   string &EMPLID;
      Local   string &CAL_RUN_ID;
      Local   string &GP_PAYGROUP;
      Local   string &CAL_ID;
      Local   string &GPGB_PSLIP_DESCR;
      Local   number &EMPL_RCD;
      Local   number &RSLT_SEG_NUM;
      Local   number &GPGB_PSLIP_DETAIL;
      Local   number &GPGB_ELE_ORDER;
      Local   number &GPGB_PIN_NUM_CUR;
      Local   number &GPGB_PIN_NUM_YTD;
      Local   number &ROW;
      Local   number &ACUM_ROWS;
      Local   number &PIN_NUM;
      Local   date &SEG_END_DT;

      If %Component = Component.GPGB_PSLIP_PU_PNLG Then

         &LEVEL0 = GetLevel0();
         &EMPLID = &LEVEL0(1).GPGB_PSLIP_PU_H.EMPLID.Value;
         &CAL_RUN_ID = &LEVEL0(1).GPGB_PSLIP_PU_H.CAL_RUN_ID.Value;
         &EMPL_RCD = &LEVEL0(1).GPGB_PSLIP_PU_H.EMPL_RCD.Value;
         &GP_PAYGROUP = &LEVEL0(1).GPGB_PSLIP_PU_H.GP_PAYGROUP.Value;
         &CAL_ID = &LEVEL0(1).GPGB_PSLIP_PU_H.CAL_ID.Value;
         &RSLT_SEG_NUM = &LEVEL0(1).GPGB_PSLIP_PU_H.RSLT_SEG_NUM.Value;

         &GPGB_PIN_NUM_CUR = GPGB_RSLT_BTX_W.GPGB_PIN_NUM_CUR.Value;

         /* Get the segment end date */
         SQLExec("select %DATEOUT(SEG_END_DT) from PS_GP_PYE_SEG_STAT where EMPLID = :1 and
      CAL_RUN_ID = :2 and EMPL_RCD = :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6",
      &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM, &SEG_END_DT);

         /* Get the payslip definition details for the deduction */
         SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD, GPGB_PSLIP_DETAIL
      from PS_GPGB_PSLIP_PTXD A, PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_PU and
      B.GP_PAYGROUP = :1 and GPGB_PIN_NUM_CUR = :2 and B.EFFDT < %datein(:3) and A.EFFDT = ( SELECT
      MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_PTXD A_ED WHERE A.GPGB_PSLIP_ID = A_ED.GPGB_PSLIP_ID AND
      A_ED.EFFDT <= B.EFFDT )", &GP_PAYGROUP, GPGB_RSLT_BTX_W.GPGB_PIN_NUM_CUR, &SEG_END_DT,
      &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER, &GPGB_PIN_NUM_YTD, &GPGB_PSLIP_DETAIL);

         SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD, GPGB_PSLIP_DETAIL
      from PS_GPGB_PSLIP_PTXD A, PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_PU and
      B.GP_PAYGROUP = :1 and GPGB_PIN_NUM_CUR = :2 and B.EFFDT = ( select MAX(GRP.EFFDT) from
      PS_GPGB_PSLIP_GRP GRP where GRP.GP_PAYGROUP = B.GP_PAYGROUP and GRP.EFFDT <= %datein(:3)) and
      A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_PTXD A_ED WHERE A.GPGB_PSLIP_ID =
      A_ED.GPGB_PSLIP_ID AND A_ED.EFFDT <= %datein(:3) )", &GP_PAYGROUP,
      GPGB_RSLT_BTX_W.GPGB_PIN_NUM_CUR, &SEG_END_DT, &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER,
      &GPGB_PIN_NUM_YTD, &GPGB_PSLIP_DETAIL);
         GPGB_RSLT_BTX_W.GPGB_PSLIP_DESCR = &GPGB_PSLIP_DESCR;
         GPGB_RSLT_BTX_W.GPGB_ELE_ORDER = &GPGB_ELE_ORDER;
         GPGB_RSLT_BTX_W.GPGB_PIN_NUM_YTD = &GPGB_PIN_NUM_YTD;
         GPGB_RSLT_BTX_W.GPGB_PSLIP_DETAIL = &GPGB_PSLIP_DETAIL;

         If GPGB_RSLT_BTX_W.GPGB_PIN_NUM_YTD > 0 Then

              &PIN_NUM = GPGB_RSLT_BTX_W.GPGB_PIN_NUM_YTD;
            /* Get the acummulator rows */
            &GP_RSLT_ACUM = CreateRowset(Record.GP_RSLT_ACUM);
            &ACUM_ROWS = &GP_RSLT_ACUM.Fill("where EMPLID = :1 and CAL_RUN_ID = :2 and EMPL_RCD =
      :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6 and PIN_NUM = :7 and ACM_FROM_DT
      = (SELECT MAX(B.ACM_FROM_DT) FROM PS_GP_RSLT_ACUM B WHERE B.EMPLID = :1 and B.CAL_RUN_ID =
      :2 and B.EMPL_RCD = :3 and B.GP_PAYGROUP = :4 and B.CAL_ID = :5 and B.RSLT_SEG_NUM = :6 and
      B.PIN_NUM = :7)", &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM,
      &PIN_NUM);

            /* Get the appropriate row */
            &ROW = get_accum_row(&GP_RSLT_ACUM, GPGB_RSLT_BTX_W.USER_FLD1,
      GPGB_RSLT_BTX_W.USER_FLD2, GPGB_RSLT_BTX_W.USER_FLD3, GPGB_RSLT_BTX_W.USER_FLD4, &EMPLID,
      &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM);

            If &ROW > 0 Then
               GPGB_RSLT_BTX_W.GPGB_RSLT_VAL_YTD =
      &GP_RSLT_ACUM(&ROW).GP_RSLT_ACUM.CALC_RSLT_VAL.Value;
            End-If;
            If GPGB_RSLT_BTX_W.INSTANCE.Value > 0 And
                  GPGB_RSLT_BTX_W.INSTANCE.Value <= &ACUM_ROWS And
                  GPGB_RSLT_BTX_W.GPGB_RATE_CUR.Value <> 0 Then
               GPGB_RSLT_BTX_W.GPGB_RSLT_VAL_YTD.Visible = False;
            End-If;

         End-If;

         If &GPGB_PSLIP_DETAIL > 0 Then
            GPGB_RSLT_BTX_W.GPGB_PSLIP_D_TXT = get_pin_value(&GPGB_PSLIP_DETAIL, &EMPLID,
      &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM);
         End-If;

      End-If;




PeopleCode (Record): GPGB_RSLT_ERN_W.RSLT_SEG_NUM.RowInit
      Declare Function get_accum_row PeopleCode FUNCLIB_GPGB.GPGB_PAYSLIP_FNS FieldFormula;
      Declare Function get_pin_value PeopleCode FUNCLIB_GPGB.GPGB_PAYSLIP_FNS FieldFormula;

      Local   Rowset &GP_RSLT_ACUM;
      Local   Rowset &LEVEL0;
      Local   string &EMPLID;
      Local   string &CAL_RUN_ID;
      Local   string &GP_PAYGROUP;
      Local   string &CAL_ID;
      Local   string &GPGB_PSLIP_DESCR;
      Local   number &EMPL_RCD;
      Local   number &RSLT_SEG_NUM;
      Local   number &GPGB_PSLIP_DETAIL;
      Local   number &GPGB_ELE_ORDER;
      Local   number &GPGB_PIN_NUM_CUR;
      Local   number &GPGB_PIN_NUM_YTD;
      Local   number &ROW;
      Local   number &ACUM_ROWS;
      Local   date &SEG_END_DT;

      If %Component = Component.GPGB_PSLIP_PU_PNLG Then

         &LEVEL0 = GetLevel0();
         &EMPLID = &LEVEL0(1).GPGB_PSLIP_PU_H.EMPLID.Value;
         &CAL_RUN_ID = &LEVEL0(1).GPGB_PSLIP_PU_H.CAL_RUN_ID.Value;
         &EMPL_RCD = &LEVEL0(1).GPGB_PSLIP_PU_H.EMPL_RCD.Value;
         &GP_PAYGROUP = &LEVEL0(1).GPGB_PSLIP_PU_H.GP_PAYGROUP.Value;
         &CAL_ID = &LEVEL0(1).GPGB_PSLIP_PU_H.CAL_ID.Value;
         &RSLT_SEG_NUM = &LEVEL0(1).GPGB_PSLIP_PU_H.RSLT_SEG_NUM.Value;

         &GPGB_PIN_NUM_CUR = GPGB_RSLT_ERN_W.GPGB_PIN_NUM_CUR.Value;
         &GPGB_PIN_NUM_YTD = GPGB_RSLT_ERN_W.GPGB_PIN_NUM_YTD.Value;
         /* Get the segment end date */
         SQLExec("select %DATEOUT(SEG_END_DT) from PS_GP_PYE_SEG_STAT where EMPLID = :1 and
      CAL_RUN_ID = :2 and EMPL_RCD = :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6",
      &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM, &SEG_END_DT);

         /* Get the payslip definition details for the Earning */
         SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD, GPGB_PSLIP_DETAIL
      from PS_GPGB_PSLIP_ERNS A, PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_PU and
      B.GP_PAYGROUP = :1 and GPGB_PIN_NUM_CUR = :2 and B.EFFDT < %datein(:3) and A.EFFDT = ( SELECT
      MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_ERNS A_ED WHERE A.GPGB_PSLIP_ID = A_ED.GPGB_PSLIP_ID AND
      A_ED.EFFDT <= B.EFFDT)", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR, &SEG_END_DT, &GPGB_PSLIP_DESCR,
      &GPGB_ELE_ORDER, &GPGB_PIN_NUM_YTD, &GPGB_PSLIP_DETAIL);

         SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD, GPGB_PSLIP_DETAIL
      from PS_GPGB_PSLIP_ERNS A, PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_PU and
      B.GP_PAYGROUP = :1 and GPGB_PIN_NUM_CUR = :2 and B.EFFDT = ( select MAX(GRP.EFFDT) from
      PS_GPGB_PSLIP_GRP GRP where GRP.GP_PAYGROUP = B.GP_PAYGROUP and GRP.EFFDT <= %datein(:3)) and
      A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_ERNS A_ED WHERE A.GPGB_PSLIP_ID =
      A_ED.GPGB_PSLIP_ID AND A_ED.EFFDT <= %datein(:3))", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR,
      &SEG_END_DT, &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER, &GPGB_PIN_NUM_YTD, &GPGB_PSLIP_DETAIL);
         GPGB_RSLT_ERN_W.GPGB_PSLIP_DESCR.Value = &GPGB_PSLIP_DESCR;
         GPGB_RSLT_ERN_W.GPGB_ELE_ORDER.Value = &GPGB_ELE_ORDER;
         GPGB_RSLT_ERN_W.GPGB_PIN_NUM_YTD.Value = &GPGB_PIN_NUM_YTD;
         GPGB_RSLT_ERN_W.GPGB_PSLIP_DETAIL.Value = &GPGB_PSLIP_DETAIL;

         If &GPGB_PIN_NUM_YTD > 0 Then

            /* Get the acummulator rows */
            &GP_RSLT_ACUM = CreateRowset(Record.GP_RSLT_ACUM);
            &ACUM_ROWS = &GP_RSLT_ACUM.Fill("where EMPLID = :1 and CAL_RUN_ID = :2 and EMPL_RCD =
      :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6 and PIN_NUM = :7 and ACM_FROM_DT
      = (SELECT MAX(B.ACM_FROM_DT) FROM PS_GP_RSLT_ACUM B WHERE B.EMPLID = :1 and B.CAL_RUN_ID =
      :2 and B.EMPL_RCD = :3 and B.GP_PAYGROUP = :4 and B.CAL_ID = :5 and B.RSLT_SEG_NUM = :6 and
      B.PIN_NUM = :7)", &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM,
      &GPGB_PIN_NUM_YTD);

            /* get the apprpriate row */
            &ROW = get_accum_row(&GP_RSLT_ACUM, GPGB_RSLT_ERN_W.USER_FLD1,
      GPGB_RSLT_ERN_W.USER_FLD2, GPGB_RSLT_ERN_W.USER_FLD3, GPGB_RSLT_ERN_W.USER_FLD4, &EMPLID,
      &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM);

            If &ROW > 0 Then
               GPGB_RSLT_ERN_W.GPGB_RSLT_VAL_YTD.Value =
      &GP_RSLT_ACUM(&ROW).GP_RSLT_ACUM.CALC_RSLT_VAL.Value;
            End-If;

            If GPGB_RSLT_ERN_W.INSTANCE.Value > 0 And
                  GPGB_RSLT_ERN_W.INSTANCE.Value <= &ACUM_ROWS And
                  GPGB_RSLT_ERN_W.GPGB_RATE_CUR.Value <> 0 Then
               GPGB_RSLT_ERN_W.GPGB_RSLT_VAL_YTD.Visible = False;
            End-If;

         End-If;

         If &GPGB_PSLIP_DETAIL > 0 Then
            GPGB_RSLT_ERN_W.GPGB_PSLIP_D_TXT.Value = get_pin_value(&GPGB_PSLIP_DETAIL, &EMPLID,
      &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM);
         End-If;

      End-If;




PeopleCode (Record): GPGB_RSLT_NI_W.RSLT_SEG_NUM.RowInit
      Declare Function get_accum_row PeopleCode FUNCLIB_GPGB.GPGB_PAYSLIP_FNS FieldFormula;
      Declare Function get_pin_value PeopleCode FUNCLIB_GPGB.GPGB_PAYSLIP_FNS FieldFormula;

      Local Rowset &GP_RSLT_ACUM;
Local   Rowset &LEVEL0;
Local   string &EMPLID;
Local   string &CAL_RUN_ID;
Local   string &GP_PAYGROUP;
Local   string &CAL_ID;
Local   string &GPGB_PSLIP_DESCR;
Local   number &EMPL_RCD;
Local   number &RSLT_SEG_NUM;
Local   number &GPGB_PSLIP_DETAIL;
Local   number &GPGB_ELE_ORDER;
Local   number &GPGB_PIN_NUM_CUR;
Local   number &GPGB_PIN_NUM_YTD;
Local   number &ROW;
Local   number &ACUM_ROWS;
Local   date &SEG_END_DT;

If %Component = Component.GPGB_PSLIP_PU_PNLG Then

   &LEVEL0 = GetLevel0();
   &EMPLID = &LEVEL0(1).GPGB_PSLIP_PU_H.EMPLID.Value;
   &CAL_RUN_ID = &LEVEL0(1).GPGB_PSLIP_PU_H.CAL_RUN_ID.Value;
   &EMPL_RCD = &LEVEL0(1).GPGB_PSLIP_PU_H.EMPL_RCD.Value;
   &GP_PAYGROUP = &LEVEL0(1).GPGB_PSLIP_PU_H.GP_PAYGROUP.Value;
   &CAL_ID = &LEVEL0(1).GPGB_PSLIP_PU_H.CAL_ID.Value;
   &RSLT_SEG_NUM = &LEVEL0(1).GPGB_PSLIP_PU_H.RSLT_SEG_NUM.Value;

   &GPGB_PIN_NUM_CUR = GPGB_RSLT_NI_W.GPGB_PIN_NUM_CUR.Value;
   &GPGB_PIN_NUM_YTD = GPGB_RSLT_NI_W.GPGB_PIN_NUM_YTD.Value;

   /* Get the segment end date */
   SQLExec("select %DATEOUT(SEG_END_DT) from PS_GP_PYE_SEG_STAT where EMPLID = :1 and
CAL_RUN_ID = :2 and EMPL_RCD = :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6",
&EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM, &SEG_END_DT);

   /* Get the payslip definition details for the deduction */
   SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD from PS_GPGB_PSLIP_NI
A,PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_PU and B.GP_PAYGROUP = :1 and
GPGB_PIN_NUM_CUR = :2 and B.EFFDT < %datein(:3) and A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM
PS_GPGB_PSLIP_NI A_ED WHERE A.GPGB_PSLIP_ID = A_ED.GPGB_PSLIP_ID AND A_ED.EFFDT <= B.EFFDT
)", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR, &SEG_END_DT, &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER,
&GPGB_PIN_NUM_YTD);

   SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD from PS_GPGB_PSLIP_NI
A,PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_PU and B.GP_PAYGROUP = :1 and
GPGB_PIN_NUM_CUR = :2 and B.EFFDT = ( select MAX(GRP.EFFDT) from PS_GPGB_PSLIP_GRP GRP where
GRP.GP_PAYGROUP = B.GP_PAYGROUP and GRP.EFFDT <= %datein(:3)) and A.EFFDT = ( SELECT
MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_NI A_ED WHERE A.GPGB_PSLIP_ID = A_ED.GPGB_PSLIP_ID AND
A_ED.EFFDT <= %datein(:3) )", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR, &SEG_END_DT,
&GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER, &GPGB_PIN_NUM_YTD);
   GPGB_RSLT_NI_W.GPGB_PSLIP_DESCR.Value = &GPGB_PSLIP_DESCR;
   GPGB_RSLT_NI_W.GPGB_ELE_ORDER.Value = &GPGB_ELE_ORDER;
   GPGB_RSLT_NI_W.GPGB_PIN_NUM_YTD.Value = &GPGB_PIN_NUM_YTD;

   If &GPGB_PIN_NUM_YTD > 0 Then

      /* Get the acummulator rows */
      &GP_RSLT_ACUM = CreateRowset(Record.GP_RSLT_ACUM);
      &ACUM_ROWS = &GP_RSLT_ACUM.Fill("where EMPLID = :1 and CAL_RUN_ID = :2 and EMPL_RCD =
:3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6 and PIN_NUM = :7 and ACM_FROM_DT
= (SELECT MAX(B.ACM_FROM_DT) FROM PS_GP_RSLT_ACUM B WHERE B.EMPLID = :1 and B.CAL_RUN_ID =
:2 and B.EMPL_RCD = :3 and B.GP_PAYGROUP = :4 and B.CAL_ID = :5 and B.RSLT_SEG_NUM = :6 and
B.PIN_NUM = :7)", &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM,
&GPGB_PIN_NUM_YTD);

      /* Get the apprpriate row */
      &ROW = get_accum_row(&GP_RSLT_ACUM, GPGB_RSLT_NI_W.USER_FLD1,
GPGB_RSLT_NI_W.USER_FLD2, GPGB_RSLT_NI_W.USER_FLD3, GPGB_RSLT_NI_W.USER_FLD4, &EMPLID,
&CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM);


        If &ROW > 0 Then
               GPGB_RSLT_NI_W.GPGB_RSLT_VAL_YTD.Value =
      &GP_RSLT_ACUM(&ROW).GP_RSLT_ACUM.CALC_RSLT_VAL.Value;
            End-If;

         End-If;

      End-If;




PeopleCode (Record): GPGB_RSLT_PI_W.RSLT_SEG_NUM.RowInit
      Local   Rowset &LEVEL0;
      Local   string &EMPLID;
      Local   string &CAL_RUN_ID;
      Local   string &GP_PAYGROUP;
      Local   string &CAL_ID;
      Local   string &GPGB_PSLIP_DESCR;
      Local   number &EMPL_RCD;
      Local   number &RSLT_SEG_NUM;
      Local   number &GPGB_ELE_ORDER;
      Local   number &GPGB_PIN_NUM_CUR;
      Local   date &SEG_END_DT;

      If %Component = Component.GPGB_PSLIP_PU_PNLG Then

         &LEVEL0 = GetLevel0();
         &EMPLID = &LEVEL0(1).GPGB_PSLIP_PU_H.EMPLID.Value;
         &CAL_RUN_ID = &LEVEL0(1).GPGB_PSLIP_PU_H.CAL_RUN_ID.Value;
         &EMPL_RCD = &LEVEL0(1).GPGB_PSLIP_PU_H.EMPL_RCD.Value;
         &GP_PAYGROUP = &LEVEL0(1).GPGB_PSLIP_PU_H.GP_PAYGROUP.Value;
         &CAL_ID = &LEVEL0(1).GPGB_PSLIP_PU_H.CAL_ID.Value;
         &RSLT_SEG_NUM = &LEVEL0(1).GPGB_PSLIP_PU_H.RSLT_SEG_NUM.Value;

         &GPGB_PIN_NUM_CUR = GPGB_RSLT_PI_W.GPGB_PIN_NUM_CUR.Value;

         /* Get the segment end date */
         SQLExec("select %DATEOUT(SEG_END_DT) from PS_GP_PYE_SEG_STAT where EMPLID = :1 and
      CAL_RUN_ID = :2 and EMPL_RCD = :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6",
      &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM, &SEG_END_DT);

         /* Get the payslip definition details for the Balance */
         SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER from PS_GPGB_PSLIP_POSI A,
      PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_PU and B.GP_PAYGROUP = :1 and
      GPGB_PIN_NUM_CUR = :2 and B.EFFDT < %datein(:3) and A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM
      PS_GPGB_PSLIP_POSI A_ED WHERE A.GPGB_PSLIP_ID = A_ED.GPGB_PSLIP_ID AND A_ED.EFFDT <= B.EFFDT
      )", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR, &SEG_END_DT, &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER);

         SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER from PS_GPGB_PSLIP_POSI A,
      PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_PU and B.GP_PAYGROUP = :1 and
      GPGB_PIN_NUM_CUR = :2 and B.EFFDT = ( select MAX(GRP.EFFDT) from PS_GPGB_PSLIP_GRP GRP where
      GRP.GP_PAYGROUP = B.GP_PAYGROUP and GRP.EFFDT <= %datein(:3)) and A.EFFDT = ( SELECT
      MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_POSI A_ED WHERE A.GPGB_PSLIP_ID = A_ED.GPGB_PSLIP_ID AND
      A_ED.EFFDT <= %datein(:3) )", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR, &SEG_END_DT,
      &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER);
         GPGB_RSLT_PI_W.GPGB_PSLIP_DESCR = &GPGB_PSLIP_DESCR;
         GPGB_RSLT_PI_W.GPGB_ELE_ORDER = &GPGB_ELE_ORDER;

      End-If;




PeopleCode (Record): GPGB_RSLT_RTO_W.RSLT_SEG_NUM.RowInit
      Local   Rowset   &LEVEL0;
      Local   string   &EMPLID;
      Local   string   &CAL_RUN_ID;
      Local   string   &GP_PAYGROUP;
      Local   string   &CAL_ID;
      Local   string &GPGB_PSLIP_DESCR;
      Local   number &EMPL_RCD;
      Local   number &RSLT_SEG_NUM;
      Local   number &GPGB_ELE_ORDER;
      Local   number &GPGB_PIN_NUM_CUR;
      Local   date &SEG_END_DT;

      If %Component = Component.GPGB_PSLIP_PU_PNLG Then

         &LEVEL0 = GetLevel0();
         &EMPLID = &LEVEL0(1).GPGB_PSLIP_PU_H.EMPLID.Value;
         &CAL_RUN_ID = &LEVEL0(1).GPGB_PSLIP_PU_H.CAL_RUN_ID.Value;
         &EMPL_RCD = &LEVEL0(1).GPGB_PSLIP_PU_H.EMPL_RCD.Value;
         &GP_PAYGROUP = &LEVEL0(1).GPGB_PSLIP_PU_H.GP_PAYGROUP.Value;
         &CAL_ID = &LEVEL0(1).GPGB_PSLIP_PU_H.CAL_ID.Value;
         &RSLT_SEG_NUM = &LEVEL0(1).GPGB_PSLIP_PU_H.RSLT_SEG_NUM.Value;

         &GPGB_PIN_NUM_CUR = GPGB_RSLT_RTO_W.GPGB_PIN_NUM_CUR.Value;

         /* Get the segment end date */
         SQLExec("select %DATEOUT(SEG_END_DT) from PS_GP_PYE_SEG_STAT where EMPLID = :1 and
      CAL_RUN_ID = :2 and EMPL_RCD = :3 and GP_PAYGROUP = :4 and CAL_ID=:5 and RSLT_SEG_NUM = :6",
      &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM, &SEG_END_DT);

         /* Get the payslip definition details for the Balance */
         SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER from PS_GPGB_PSLIP_RTO A,
      PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_PU and B.GP_PAYGROUP = :1 and
      GPGB_PIN_NUM_CUR = :2 and B.EFFDT < %datein(:3) and A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM
      PS_GPGB_PSLIP_RTO A_ED WHERE A.GPGB_PSLIP_ID = A_ED.GPGB_PSLIP_ID AND A_ED.EFFDT <= B.EFFDT
      )", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR, &SEG_END_DT, &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER);
         SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER from PS_GPGB_PSLIP_RTO A,
      PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_PU and B.GP_PAYGROUP = :1 and
      GPGB_PIN_NUM_CUR = :2 and B.EFFDT = ( select MAX(GRP.EFFDT) from PS_GPGB_PSLIP_GRP GRP where
      GRP.GP_PAYGROUP = B.GP_PAYGROUP and GRP.EFFDT <= %datein(:3)) and A.EFFDT = ( SELECT
      MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_RTO A_ED WHERE A.GPGB_PSLIP_ID = A_ED.GPGB_PSLIP_ID AND
      A_ED.EFFDT <= %datein(:3) )", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR, &SEG_END_DT,
      &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER);


         GPGB_RSLT_RTO_W.GPGB_PSLIP_DESCR = &GPGB_PSLIP_DESCR;
         GPGB_RSLT_RTO_W.GPGB_ELE_ORDER = &GPGB_ELE_ORDER;

      End-If;




PeopleCode (Record): GPGB_RSLT_TAX_W.RSLT_SEG_NUM.RowInit
      Declare Function get_accum_row PeopleCode FUNCLIB_GPGB.GPGB_PAYSLIP_FNS FieldFormula;
      Declare Function get_pin_value PeopleCode FUNCLIB_GPGB.GPGB_PAYSLIP_FNS FieldFormula;

      Local   Rowset &GP_RSLT_ACUM;
      Local   Rowset &LEVEL0;
      Local   string &EMPLID;
      Local   string &CAL_RUN_ID;
      Local   string &GP_PAYGROUP;
      Local   string &CAL_ID;
      Local   string &GPGB_PSLIP_DESCR;
      Local   number &EMPL_RCD;
      Local   number &RSLT_SEG_NUM;
      Local   number &GPGB_PSLIP_DETAIL;
      Local   number &GPGB_ELE_ORDER;
      Local   number &GPGB_PIN_NUM_CUR;
      Local   number &GPGB_PIN_NUM_YTD;
      Local   number &ROW;
      Local   number &ACUM_ROWS;
      Local   date &SEG_END_DT;

      If %Component = Component.GPGB_PSLIP_PU_PNLG Then
         &LEVEL0 = GetLevel0();
         &EMPLID = &LEVEL0(1).GPGB_PSLIP_PU_H.EMPLID.Value;
         &CAL_RUN_ID = &LEVEL0(1).GPGB_PSLIP_PU_H.CAL_RUN_ID.Value;
         &EMPL_RCD = &LEVEL0(1).GPGB_PSLIP_PU_H.EMPL_RCD.Value;
         &GP_PAYGROUP = &LEVEL0(1).GPGB_PSLIP_PU_H.GP_PAYGROUP.Value;
         &CAL_ID = &LEVEL0(1).GPGB_PSLIP_PU_H.CAL_ID.Value;
         &RSLT_SEG_NUM = &LEVEL0(1).GPGB_PSLIP_PU_H.RSLT_SEG_NUM.Value;

         &GPGB_PIN_NUM_CUR = GPGB_RSLT_TAX_W.GPGB_PIN_NUM_CUR.Value;
         &GPGB_PIN_NUM_YTD = GPGB_RSLT_TAX_W.GPGB_PIN_NUM_YTD.Value;

         /* Get the segment end date */
         SQLExec("select %DATEOUT(SEG_END_DT) from PS_GP_PYE_SEG_STAT where EMPLID = :1 and
      CAL_RUN_ID = :2 and EMPL_RCD = :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6",
      &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM, &SEG_END_DT);

         /* Get the payslip definition details for the deduction */
         SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD from PS_GPGB_PSLIP_TAX
      A, PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_PU and B.GP_PAYGROUP = :1 and
      GPGB_PIN_NUM_CUR = :2 and B.EFFDT < %datein(:3) and A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM
      PS_GPGB_PSLIP_TAX A_ED WHERE A.GPGB_PSLIP_ID = A_ED.GPGB_PSLIP_ID AND A_ED.EFFDT <= B.EFFDT
      )", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR, &SEG_END_DT, &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER,
      &GPGB_PIN_NUM_YTD);

         SQLExec("select GPGB_PSLIP_DESCR, GPGB_ELE_ORDER, GPGB_PIN_NUM_YTD from PS_GPGB_PSLIP_TAX
      A, PS_GPGB_PSLIP_GRP B where GPGB_PSLIP_ID = GPGB_PSLIP_ID_PU and B.GP_PAYGROUP = :1 and
      GPGB_PIN_NUM_CUR = :2 and B.EFFDT <= ( select MAX(GRP.EFFDT) from PS_GPGB_PSLIP_GRP GRP where
      GRP.GP_PAYGROUP = B.GP_PAYGROUP and GRP.EFFDT <= %datein(:3)) and A.EFFDT = ( SELECT
      MAX(A_ED.EFFDT) FROM PS_GPGB_PSLIP_TAX A_ED WHERE A.GPGB_PSLIP_ID = A_ED.GPGB_PSLIP_ID AND
      A_ED.EFFDT <= %datein(:3))", &GP_PAYGROUP, &GPGB_PIN_NUM_CUR, &SEG_END_DT,
      &GPGB_PSLIP_DESCR, &GPGB_ELE_ORDER, &GPGB_PIN_NUM_YTD);
         GPGB_RSLT_TAX_W.GPGB_PSLIP_DESCR.Value = &GPGB_PSLIP_DESCR;
         GPGB_RSLT_TAX_W.GPGB_ELE_ORDER.Value = &GPGB_ELE_ORDER;
         GPGB_RSLT_TAX_W.GPGB_PIN_NUM_YTD.Value = &GPGB_PIN_NUM_YTD;

         /* Get the user keys for the accumulator */
         If Not None(&GPGB_PIN_NUM_YTD) Then

            /* Get the acummulator rows */
            &GP_RSLT_ACUM = CreateRowset(Record.GP_RSLT_ACUM);
            &ACUM_ROWS = &GP_RSLT_ACUM.Fill("where EMPLID = :1 and CAL_RUN_ID = :2 and EMPL_RCD =
      :3 and GP_PAYGROUP = :4 and CAL_ID = :5 and RSLT_SEG_NUM = :6 and PIN_NUM = :7 and ACM_FROM_DT
      = (SELECT MAX(B.ACM_FROM_DT) FROM PS_GP_RSLT_ACUM B WHERE B.EMPLID = :1 and B.CAL_RUN_ID =
      :2 and B.EMPL_RCD = :3 and B.GP_PAYGROUP = :4 and B.CAL_ID = :5 and B.RSLT_SEG_NUM = :6 and
      B.PIN_NUM = :7)", &EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM,
      &GPGB_PIN_NUM_YTD);

            /* Get the apprpriate row */
            &ROW = get_accum_row(&GP_RSLT_ACUM, GPGB_RSLT_TAX_W.USER_FLD1,
      GPGB_RSLT_TAX_W.USER_FLD2, GPGB_RSLT_TAX_W.USER_FLD3, GPGB_RSLT_TAX_W.USER_FLD4, &EMPLID,
      &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID, &RSLT_SEG_NUM);


            If &ROW > 0 Then
               GPGB_RSLT_TAX_W.GPGB_RSLT_VAL_YTD.Value =
      &GP_RSLT_ACUM(&ROW).GP_RSLT_ACUM.CALC_RSLT_VAL.Value;
            End-If;

         End-If;

      End-If;




PeopleCode (Record): GPJP_UC_HEADER.EMPLID.RowInit
      If %Component = Component.GPJP_UC_MAINTAIN Then

         &FLD1 = GetRecord(Record.GPJP_UC_HEADER).GetField(Field.GPJP_UC_CON_RENEW);
         &FLD1.ClearDropDownList();
         &Xlat1 = CreateRowset(Record.PSXLATITEM);
         &Xlat1.Fill("WHERE FILL.FIELDNAME = 'GPJP_UC_CON_RENEW' AND %EFFDTCHECK(PSXLATITEM, FILL,
      :1) AND EFF_STATUS = 'A'", GPJP_UC_HEADER.GPJP_UC_TERM_DATE);
         For &i = 1 To &Xlat1.ActiveRowCount
            &CodeIn = &Xlat1.GetRow(&i).GetRecord(Record.PSXLATITEM).FIELDVALUE.Value;
            &DescIn = &Xlat1.GetRow(&i).GetRecord(Record.PSXLATITEM).XLATLONGNAME.Value;
            &FLD1.AddDropDownItem(&CodeIn, &DescIn);
         End-For;

         If GPJP_UC_HEADER.GPJP_UC_TERM_DATE >= Date(20090401) Then
            GPJP_UC_HEADER.GPJP_UC_TERM_BY.Label =
      GPJP_UC_HEADER.GPJP_UC_TERM_BY.GetLongLabel("EMPLOYEE"); /* Employee */
         End-If;

         &FLD2 = GetRecord(Record.GPJP_UC_HEADER).GetField(Field.GPJP_UC_TERM_BY);
         &FLD2.ClearDropDownList();
         &Xlat2 = CreateRowset(Record.PSXLATITEM);
         &Xlat2.Fill("WHERE FILL.FIELDNAME = 'GPJP_UC_TERM_BY' AND %EFFDTCHECK(PSXLATITEM, FILL,
      :1) AND EFF_STATUS = 'A'", GPJP_UC_HEADER.GPJP_UC_TERM_DATE);
         For &i = 1 To &Xlat2.ActiveRowCount
            &CodeIn = &Xlat2.GetRow(&i).GetRecord(Record.PSXLATITEM).FIELDVALUE.Value;
            &DescIn = &Xlat2.GetRow(&i).GetRecord(Record.PSXLATITEM).XLATLONGNAME.Value;
            &FLD2.AddDropDownItem(&CodeIn, &DescIn);
         End-For;

      End-If;




PeopleCode (Record): GPJP_UC_HEADER.GPJP_UC_CON_RENEW.RowInit
      Local Rowset &rs;

      &rs = GetLevel0()(1).GetRowset(Scroll.GPJP_UC_HEADER);

      For &i = 1 To &rs.ActiveRowCount
         &MsgText = MsgGetText(17271, 319, "");
         SetLabel(GPJP_UC_HEADER.GPJP_UC_CON_RENEW, &MsgText);
      End-For;




PeopleCode (Record): GP_PYE_OVR_SOVR.PIN_SOVR_NUM.SaveEdit
      /****************************************************
      * Make sure child also inherits this "non-key" field
      ****************************************************/

      If Not IsModal() Then
         If GP_PYE_OVR_SOVR.PIN_SOVR_NUM.Value <> 0 Then
            GP_PYE_OVR_SOVR.BGN_DT.Value = GP_PYE_OVRD.BGN_DT.Value;
            GP_PYE_OVR_SOVR.END_DT.Value = GP_PYE_OVRD.END_DT.Value;
            /* ICE 1878894000 - Ensure child inherits PIN_NUM */
            GP_PYE_OVR_SOVR.PIN_NUM.Value = GP_PYE_OVRD.PIN_NUM.Value;
         End-If;
      Else

         If None(GP_PYE_OVR_SOVR.PIN_SOVR_NUM) And
               (All(GP_PYE_OVR_SOVR.SOVR_VAL_CHAR) Or
                  All(GP_PYE_OVR_SOVR.SOVR_VAL_DT) Or
                  All(GP_PYE_OVR_SOVR.SOVR_VAL_NUM)) Then

            SetCursorPos(%Page, GP_PYE_OVR_SOVR.SOVR_VAL_CHAR, CurrentRowNumber());
            Error MsgGet(17000, 255, "",
      GP_PYE_OVR_SOVR.PIN_SOVR_NUM.GetRelated(GP_PIN_NM_VW.PIN_NM).GetShortLabel("VARIABLE"));
         End-If;
         /* ICE 1885741000 - If existing SOVR data is cleared and user selects "OK" button,    */
         /* display error message instructing user to enter SOVR data, or delete the row using */
         /* "-" button on the grid.                                                            */
         If None(GP_PYE_OVR_SOVR.PIN_SOVR_NUM) And
               (GP_PYE_OVR_SOVR.PIN_SOVR_NUM.Value <>
      GP_PYE_OVR_SOVR.PIN_SOVR_NUM.OriginalValue) And
               (None(GP_PYE_OVR_SOVR.SOVR_VAL_CHAR) And
                  None(GP_PYE_OVR_SOVR.SOVR_VAL_DT) And
                  None(GP_PYE_OVR_SOVR.SOVR_VAL_NUM)) Then
            SetCursorPos(%Page, GP_PYE_OVR_SOVR.SOVR_VAL_CHAR, CurrentRowNumber());
            Error MsgGet(17000, 256, "",
      GP_PYE_OVR_SOVR.PIN_SOVR_NUM.GetRelated(GP_PIN_NM_VW.PIN_NM).GetShortLabel("VARIABLE"));
         End-If;
      End-If;




PeopleCode (Record): GP_RCP_PYE_DTL.RECIPIENT_ID.FieldChange
      Declare Function enable_bank_acct_fields PeopleCode GP_RCP_PYE_DTL.RECIPIENT_ID
      FieldFormula;

      /**************************************************
      * Enable and show fields as appropriate dependent
      * on whether RECIPIENT ID is entered
      **************************************************/
      &FIELD_CHG = 3;
      enable_bank_acct_fields(&FIELD_CHG);

      SQLExec("SELECT COUNTRY_CD,BANK_CD,BRANCH_EC_CD
      ,ACCOUNT_EC_ID,CHECK_DIGIT,CURRENCY_CD,ACCOUNT_NAME, RECIPIENT_CATEGORY   FROM
      PS_RECIPIENT A WHERE A.RECIPIENT_ID = :1", GP_RCP_PYE_DTL.RECIPIENT_ID, &COUNTRY_CD,
      &BANK_CD, &BRANCH_EC_CD, &ACCOUNT_EC_ID, &CHECK_DIGIT, &CURRENCY_CD, &ACCOUNT_NAME,
      &RECIPIENT_CATEGORY);

      GP_RCP_PYE_DTL.COUNTRY_CD = &COUNTRY_CD;
      GP_RCP_PYE_DTL.BANK_CD = &BANK_CD;
      GP_RCP_PYE_DTL.BRANCH_EC_CD = &BRANCH_EC_CD;
      GP_RCP_PYE_DTL.ACCOUNT_EC_ID = &ACCOUNT_EC_ID;
      GP_RCP_PYE_DTL.CHECK_DIGIT = &CHECK_DIGIT;
      GP_RCP_PYE_DTL.CURRENCY_CD = &CURRENCY_CD;
      GP_RCP_PYE_DTL.ACCOUNT_NAME = &ACCOUNT_NAME;

      If &RECIPIENT_CATEGORY = "I" And
      If (&RECIPIENT_CATEGORY = "I" Or
               All(GP_RCP_PYE_DTL.DESCR)) And
            GP_RCP_PYE.RECIPIENT_TAG = 0 And
            %Component = "GP_RCP_PYE" Then
         Error MsgGet(17000, 482, "");

      End-If;




PeopleCode (Record): GP_RCP_PYE_DTL.RECIPIENT_ID.SaveEdit
      If None(GP_RCP_PYE_DTL.RECIPIENT_ID) And
            None(GP_RCP_PYE_DTL.DESCR) And
            All(GP_RCP_PYE_DTL.PIN_NUM) Then
         SetCursorPos(Panel.GP_RCP_PYE, GP_RCP_PYE_DTL.RECIPIENT_ID);
         Error (MsgGet(17000, 4056, ""));
      End-If;

      SQLExec("SELECT RECIPIENT_CATEGORY FROM PS_RECIPIENT A WHERE A.RECIPIENT_ID = :1",
      GP_RCP_PYE_DTL.RECIPIENT_ID, &RECIPIENT_CATEGORY);

      If &RECIPIENT_CATEGORY = "I" And
      If (&RECIPIENT_CATEGORY = "I" Or
               All(GP_RCP_PYE_DTL.DESCR)) And
            GP_RCP_PYE.RECIPIENT_TAG = 0 And
            %Component = "GP_RCP_PYE" Then
         Error MsgGet(17000, 482, "");
       End-If;




PeopleCode (ApplEng): GPAU_PSM_CRE.A2_Data GBLdefault 1900-01-01.Cat_Val.OnExecute
       /* SQLExec("DELETE FROM PS_GPAU_PSM_CT_TAO"); */
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'A')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'C')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'G')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'O')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'T')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'U')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'W')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'LA')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'LB')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'LD')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'LE')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'E1')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'E2')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'E3')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'E4')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'ET')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'E7')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'E8')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'TR')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'SS')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'PT')",
       GPAU_PSM_AET.PROCESS_INSTANCE);
       SQLExec("INSERT INTO PS_GPAU_PSM_CT_TAO (PROCESS_INSTANCE, SOVR_VAL_CHAR) VALUES(:1, 'RS')",
       GPAU_PSM_AET.PROCESS_INSTANCE);




PeopleCode (ApplEng): GPCH_AE_ELM.STAX_XMLGBLdefault 1900-01-01.Step01.OnExecute
       [ . . . Unchanged Code not Shown . . . ]


       /**************Start of Main Code for Source Tax File creation
       *******************************************/
       SQLExec("select FILENAME from PS_GPCH_EG_FSTATUS WHERE GPCH_EG_DOMAINID = :1 and
       GPCH_RC_PAY_YEAR =:2 and COMPANY=:3 and GPCH_EG_REQUEST_ID = :4 ",
       GPCHELM_AET.GPCH_EG_DOMAINID, GPCHELM_AET.GPCH_RC_PAY_YEAR, GPCHELM_AET.COMPANY,
       GPCHELM_AET.GPCH_EG_REQUEST_ID, &FileName_Stax);

       If Not None(&FileName_Stax) Then
   Exit 1;
End-If;

&SourctaxXML = CreateXmlDoc("");
&TempXML = CreateXmlDoc("");

&numSeq = 1;
SQLExec("select GPCH_EG_PROP_LONG from PS_GPCH_EG_VAL_PRS Where GPCH_EG_PRCS_NM = 'ELM' AND
GPCH_EG_PROP_NM = 'XML_Version'", &XML_Version);

/* This is the peice of code that need to be there. currently commenting it since the url is
wrong from VDL. change this once the URL is recified*/
rem &RootTag = "<DecomptePeriodique xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xsi:noNamespaceSchemaLocation=""http://ressources.etat-de-vaud.ch/Impots/XML/Schemas/EMPI
S/1/SchemaXmlSrc.xsd"" schemaVersion=""1.0"">";

/* remove this statement when the above Statement is Uncommented*/
&RootTag = "<DecomptePeriodique xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xsi:noNamespaceSchemaLocation=""SchemaXmlSrc.xsd"" schemaVersion=""1.0"">";

&DocumentTag = &XML_Version | &RootTag | "</DecomptePeriodique>";

&ret = &SourctaxXML.ParseXmlString(&DocumentTag);

/* Creation of the EnteteFichier Tag*/
&EnteteFichier = &SourctaxXML.DocumentElement.AddElement("EnteteFichier");
&NodeTmp = &EnteteFichier.AddElement("NumSequence");
&NodeTmp.NodeValue = &numSeq;
&NodeTmp = &EnteteFichier.AddElement("CodTypContenu");
&NodeTmp.NodeValue = "EMP";
&NodeTmp = &EnteteFichier.AddElement("DatHreCre");
&dateValue = DateTimeToLocalizedString(%Datetime, "yyyy-MM-dd'T'hh:mm:ss");
&NodeTmp.NodeValue = &dateValue;
&NodeNumTiers = &EnteteFichier.AddElement("NumTiers");
&NodeNumTiers.NodeValue = "1"; /*Default Initialization to 1. This node is later
reinitialized*/
&NodeEnregistrements = &EnteteFichier.AddElement("NbrEnregistrements");
&NodeEnregistrements.NodeValue = "";
&NodeTmp = &EnteteFichier.AddElement("TypEnvironnement");
&NodeTmp.NodeValue = "T";

&numSeq = &numSeq + 1;
&DecomptePaiementNumSeq = &numSeq;

&numSeq = &numSeq + 1;
/* End of EnteteFichier Tag Creation*/

&DecomptePaiement = &SourctaxXML.DocumentElement.AddElement("DecomptePaiement");




/* Check what mode the Source tax Report is Run
Modes -> Y= Yearly ,M=Monthly, Q= Quarterly */

&rs0 = CreateRowset(Record.GPCH_EG_REPORTS);
&rs0.Fill("WHERE GPCH_EG_DOMAINID = :1 and GPCH_RC_PAY_YEAR =:2 and COMPANY=:3 and
GPCH_SI_PROV_TYPE = :4 " | &Employeecrit, GPCHELM_AET.GPCH_EG_DOMAINID,
GPCHELM_AET.GPCH_RC_PAY_YEAR, GPCHELM_AET.COMPANY, "A");
&rs0.Fill("WHERE GPCH_EG_DOMAINID = :1 and GPCH_RC_PAY_YEAR =:2 and COMPANY=:3 and
GPCH_SI_PROV_TYPE = :4 and %Datein(GPCH_AL_CPAY_ENDDT) = ( select
%Datein(R1.GPCH_AL_CPAY_ENDDT) from PS_GPCH_RC_PAYROLL R1 where R1.GPCH_EG_DOMAINID = :1 and
R1.GPCH_RC_PAY_YEAR =:2 and R1.COMPANY=:3 and OPRID=%OperatorId and RUN_CNTL_ID=:5) " |
&Employeecrit, GPCHELM_AET.GPCH_EG_DOMAINID, GPCHELM_AET.GPCH_RC_PAY_YEAR,
GPCHELM_AET.COMPANY, "A", GPCHELM_AET.RUN_CNTL_ID);


If &rs0.ActiveRowCount <> 0 Then
   &Report_type =
&rs0.GetRow(1).GetRecord(Record.GPCH_EG_REPORTS).GetField(Field.GPCH_EG_RPT_TYPE).Value;
End-If;
&rs = CreateRowset(Record.GPCH_EG_PERSON);

&rs2 = CreateRowset(Record.GPCH_EG_PHEADER);

&rs3 = CreateRowset(Record.GPCH_EG_PTOTALS);

&rs2.Fill("WHERE GPCH_EG_DOMAINID = :1 and GPCH_RC_PAY_YEAR =:2 and COMPANY=:3 and
GPCH_EG_REQUEST_ID = :4 ", GPCHELM_AET.GPCH_EG_DOMAINID, GPCHELM_AET.GPCH_RC_PAY_YEAR,
GPCHELM_AET.COMPANY, GPCHELM_AET.GPCH_EG_REQUEST_ID);
&Provider_type =
&rs2.GetRow(1).GetRecord(Record.GPCH_EG_PHEADER).GetField(Field.GPCH_SI_PROV_CD).Value;

&rs3.Fill("WHERE GPCH_EG_DOMAINID = :1 and GPCH_RC_PAY_YEAR =:2 and COMPANY=:3 and
GPCH_EG_REQUEST_ID = :4 and GPCH_SI_PROV_TYPE = :5 and GPCH_SI_PROV_CD= :6 ",
GPCHELM_AET.GPCH_EG_DOMAINID, GPCHELM_AET.GPCH_RC_PAY_YEAR, GPCHELM_AET.COMPANY,
GPCHELM_AET.GPCH_EG_REQUEST_ID, "A", &Provider_type);
&Totals =
&rs3.GetRow(1).GetRecord(Record.GPCH_EG_PTOTALS).GetField(Field.GPCH_EG_CMP_XML).Value;

&DummyTotals = &XML_Version | "<Root>" | &Totals | "</Root>";

&DummyXml = &XML_Version | "<Root xmlns:ct=""http://www.w3.org/Temp"">" |
&rs2.GetRow(1).GetRecord(Record.GPCH_EG_PHEADER).GetField(Field.FILE_DATA_CHAR).Value |
"</Root>";
&CustomerId = GetCustomerNumber(&DummyXml);
&Employeecrit = "Order by EMPLID";

Evaluate &Report_type
When "Y"
   &Begindt = GPCHELM_AET.GPCH_RC_PAY_YEAR | "-01-01";
   &Enddt = GPCHELM_AET.GPCH_RC_PAY_YEAR | "-12-31";

   &rs.Fill("WHERE GPCH_EG_DOMAINID = :1 and GPCH_RC_PAY_YEAR =:2 and COMPANY=:3 and
GPCH_SI_PROV_TYPE = :4 and BEGIN_DT =%Datein(:5) and END_DT=%Datein(:6) " | &Employeecrit,
GPCHELM_AET.GPCH_EG_DOMAINID, GPCHELM_AET.GPCH_RC_PAY_YEAR, GPCHELM_AET.COMPANY, "A",
&Begindt, &Enddt);
   Break;
When "M"

   &Enddt =
&rs0.GetRow(1).GetRecord(Record.GPCH_EG_REPORTS).GetField(Field.GPCH_AL_CPAY_ENDDT).Value
;
   &Month = Month(&Enddt);

   If Len(&Month) = 1 Then
      &Month = "0" | &Month;
   End-If;

   &Begindt = GPCHELM_AET.GPCH_RC_PAY_YEAR | "-" | &Month | "-01";

   &rs.Fill("WHERE GPCH_EG_DOMAINID = :1 and GPCH_RC_PAY_YEAR =:2 and COMPANY=:3 and
GPCH_SI_PROV_TYPE = :4 and BEGIN_DT =%Datein(:5) and END_DT=%Datein(:6) " | &Employeecrit,
GPCHELM_AET.GPCH_EG_DOMAINID, GPCHELM_AET.GPCH_RC_PAY_YEAR, GPCHELM_AET.COMPANY, "A",
&Begindt, &Enddt);
   Break;

When "Q"

   &QuaterType =
&rs0.GetRow(1).GetRecord(Record.GPCH_EG_REPORTS).GetField(Field.GPCH_FK_QUARTER).Value;

   Evaluate &QuaterType
   When "1"
      &Begindt = GPCHELM_AET.GPCH_RC_PAY_YEAR | "-01-01";
      &Enddt = GPCHELM_AET.GPCH_RC_PAY_YEAR | "-03-31";
      Break;

   When "2"
      &Begindt = GPCHELM_AET.GPCH_RC_PAY_YEAR | "-04-01";
      &Enddt = GPCHELM_AET.GPCH_RC_PAY_YEAR | "-06-30";
      Break;

   When "3"
      &Begindt = GPCHELM_AET.GPCH_RC_PAY_YEAR | "-07-01";
      &Enddt = GPCHELM_AET.GPCH_RC_PAY_YEAR | "-09-30";
      Break;

   When "4"
      &Begindt = GPCHELM_AET.GPCH_RC_PAY_YEAR | "-10-01";
      &Enddt = GPCHELM_AET.GPCH_RC_PAY_YEAR | "-12-31";
      Break;


   End-Evaluate;
   &rs.Fill("WHERE GPCH_EG_DOMAINID = :1 and GPCH_RC_PAY_YEAR =:2 and COMPANY=:3 and
GPCH_SI_PROV_TYPE = :4 and BEGIN_DT =%Datein(:5) and END_DT=%Datein(:6) " | &Employeecrit,
GPCHELM_AET.GPCH_EG_DOMAINID, GPCHELM_AET.GPCH_RC_PAY_YEAR, GPCHELM_AET.COMPANY, "A",
&Begindt, &Enddt);

   Break;
End-Evaluate;


If &rs.ActiveRowCount = 0 Then
   /*LogIt("No Employees ");*/
Else

   For &i = 1 To &rs.ActiveRowCount

      &Emplid =
&rs.GetRow(&i).GetRecord(Record.GPCH_EG_PERSON).GetField(Field.EMPLID).Value;
      &CreatePerson_FLAG = "N"; /*This Flag decides if the Person tag needs to be created or
not */
      /*This For-Loop sets the &CreatePerson_FLAG */
      &rs1 = CreateRowset(Record.GPCH_EG_PERSON);

      &NumOfRows_1 = &rs1.Fill("WHERE GPCH_EG_DOMAINID = :1 and GPCH_RC_PAY_YEAR =:2 and
COMPANY=:3 and EMPLID= :4 and GPCH_SI_PROV_TYPE = :5 and GPCH_SI_PROV_CD=:6 ",
GPCHELM_AET.GPCH_EG_DOMAINID, GPCHELM_AET.GPCH_RC_PAY_YEAR, GPCHELM_AET.COMPANY, &Emplid,
"A", &Provider_type);

      If &NumOfRows_1 <> 0 Then
         &CreatePerson_FLAG = "Y";
      End-If;


      If &CreatePerson_FLAG = "Y" Then

         &Pers_XML = &XML_Version | "<Root>" |
&rs.GetRow(&i).GetRecord(Record.GPCH_EG_PERSON).GetField(Field.GPCH_EG_PRSN_XML).Value |
"</Root>";
         &ret = &TempXML.ParseXmlString(&Pers_XML);
         &TempInstanceNodes = &TempXML.DocumentElement.FindNodes("Instance");
         If &TempInstanceNodes.Len <> 0 Then
            For &s = 1 To &TempInstanceNodes.Len
               /*Creation of the EveSourcier tag*/
               &EveSourcier = &SourctaxXML.DocumentElement.AddElement("EveSourcier");
               &TemNode = &EveSourcier.AddElement("NumSequence");
               &TemNode.NodeValue = &numSeq;
               Rem &Pers_XML = &XML_Version | "<Root>" |
&rs.GetRow(&i).GetRecord(Record.GPCH_EG_PERSON).GetField(Field.GPCH_EG_PRSN_XML).Value |
"</Root>";

               rem &ret = &TempXML.ParseXmlString(&Pers_XML);
               rem &TempNode1 = &TempXML.DocumentElement.FindNode("Identification"); /*Get
the <Particulars tag*/
               rem &TempNode2 = &TempXML.DocumentElement.FindNode("InfActivite");
               &TempNode1 = &TempInstanceNodes.Get(&s).FindNode("Identification");
               &TempNode2 = &TempInstanceNodes.Get(&s).FindNode("InfActivite");
               &TempNode3 = &TempInstanceNodes.Get(&s).FindNode("DatFinActivite");
                     &EveSourcier.AddNode(&TempNode1);
                     If Not &TempNode2.IsNull Then
                        &EveSourcier.AddNode(&TempNode2);
                     End-If;
                     If Not &TempNode3.IsNull Then
                        &EveSourcier.AddNode(&TempNode3);
                     End-If;
                     /* end-of EveSourcier*/
                     &numSeq = &numSeq + 1;
                  End-For;
               End-If;
            End-If;
         End-For;

         /* Creation of the DecomptePaiement Tag*/

         &tXMLDoc = CreateXmlDoc("");
         &ret = &tXMLDoc.ParseXmlString(&DummyTotals);

         &NodeTmp = &DecomptePaiement.AddElement("NumSequence");
         &NodeTmp.NodeValue = &DecomptePaiementNumSeq;
         &NodeTmp = &DecomptePaiement.AddElement("NumEmployeur");
         &NodeTmp.NodeValue = &CustomerId;
         &NodeTmp = &DecomptePaiement.AddElement("DatDebPeriode");
         &NodeTmp.NodeValue = &Begindt;
         &NodeTmp = &DecomptePaiement.AddElement("DatFinPeriode");
         &NodeTmp.NodeValue = &Enddt;
         &NodeTmp = &DecomptePaiement.AddElement("TotalBrutImpotDu");
         &NodeTmp.NodeValue = &tXMLDoc.DocumentElement.GetChildNode(1).NodeValue;
         &NodeTmp = &DecomptePaiement.AddElement("CommissionPerception");
         &NodeTmp.NodeValue = &tXMLDoc.DocumentElement.GetChildNode(2).NodeValue;
         &NodeTmp = &DecomptePaiement.AddElement("TotalNetDu");
         &NodeTmp.NodeValue = &tXMLDoc.DocumentElement.GetChildNode(3).NodeValue;
         &NodeEnregistrements.NodeValue = &numSeq - 1;
         /* End of DecomptePaiement Tag Creation*/

          &NodeNumTiers.NodeValue = "1" | &CustomerId;
       End-If;

       /**********************************Write to the File *************************/
       &ElmFile = &SourctaxXML.GenFormattedXmlString();

       /*****************************************************************************/


       /*****************File Creation ****************/
       &File_Output_Dir = GPCHELM_AET.FILE_OUTPUT_DIR;

       &FileName = "ELM_" | GPCHELM_AET.GPCH_EG_REQUEST_ID;
       &FileName = Substitute(&FileName, "-", "_");
       &FilePath = &File_Output_Dir | "/" | &FileName | ".xml";

       CreateFile(&ElmFile, &FilePath);
       GPCHELM_AET.FILENAME = &FileName | ".xml";




PeopleCode (ApplEng): GPDE_CT_ARBS.2.3.2_1BGBLdefault 1900-01-01.Step03.OnExecute
       Local SQL &mysql_fld, &mysql;
       Local number &seq_num = 1;
       Local date &seven_year;
       Local string &fld_name1 = "ARBS1B_ABS%";
       Local string &fld_name1 = "ARBS1B%";
       Local string &find_name = "ARBS1B_ABS";
       Local string &unpdFlag = "ARBS1B";
       &FmFldAry = CreateArrayRept("", 12);

       &mysql_fld = GetSQL(SQL.GPDE_CT_FLD_NAME, GPDE_CT_ARB_AET.GPDE_FM_FORM_ID,
       GPDE_CT_AET.EFFDT, GPDE_CT_AET.GPDE_FM_LANG_CD, &fld_name1, &fld_nbr, &fld_name);
       While &mysql_fld.Fetch(&fld_nbr, &fld_name)
          &FmFldAry [&fld_nbr] = &fld_name;
       End-While;
       &seven_year = AddToDate(GPDE_CT_AET.GPDE_CT_REFDT, - 7, 0, 0);
       &mysql = GetSQL(SQL.GPDE_CT_ABS_DATE, GPDE_CT_AET.EMPLID, GPDE_CT_AET.EMPL_RCD,
       GPDE_CT_AET.PAY_ENTITY, GPDE_CT_AET.GPDE_CT_REFDT, &seven_year);

       While &mysql.Fetch(&bgn_date, &end_date, &reason, &unpaid_days)
          /*Find Number of days in month.*/
          &temp1 = AddToDate(&bgn_date, 0, 1, 0);
          &year = Substring(&temp1, 1, 4);
          &month = Substring(&temp1, 6, 2);
          &temp2 = Date3(&year, &month, 1);
          &last_day = AddToDate(&temp2, 0, 0, - 1);
          &day_cnt = Substring(&last_day, 9, 2);

          If (&unpaid_days >= &day_cnt) Then
          If (&unpaid_days > &day_cnt) Then
             /*Update unpaid vaccation flag*/
             &index = &FmFldAry.Find(&unpdFlag);
             If &index > 0 Then
                SQLExec(SQL.GPDE_CT_UPDATETMP_PC, "S", "0", "Y", GPDE_CT_AET.DATE_VAL, 0,
       GPDE_CT_ARB_AET.PROCESS_INSTANCE, &index);
             End-If;

             &fld_bgn = &find_name | "_BGN" | &seq_num;
             &index = &FmFldAry.Find(&fld_bgn);
             If &index > 0 Then
                SQLExec(SQL.GPDE_CT_UPDATETMP_PC, "S", "4", "", &bgn_date, 0,
       GPDE_CT_ARB_AET.PROCESS_INSTANCE, &index);
             End-If;

            &fld_end = &find_name | "_END" | &seq_num;
            &index = &FmFldAry.Find(&fld_end);

             If &index > 0 Then
                SQLExec(SQL.GPDE_CT_UPDATETMP_PC, "S", "4", "", &end_date, 0,
       GPDE_CT_ARB_AET.PROCESS_INSTANCE, &index);
             End-If;

            &fld_rsn = &find_name | "_RSN" | &seq_num;
            &index = &FmFldAry.Find(&fld_rsn);

             If &index > 0 Then
                SQLExec(SQL.GPDE_CT_UPDATETMP_PC, "S", "0", &reason, &eff_date, 0,
       GPDE_CT_ARB_AET.PROCESS_INSTANCE, &index);
             End-If;
             &seq_num = &seq_num + 1;
          End-If;
       End-While;




PeopleCode (ApplEng): GPDE_CT_ARBS.2.3.6_4AGBLdefault 1900-01-01.Step05.OnExecute
       Local SQL &mysql;
       Local date &begndate;
       Local string &fld_name1 = "ARBS4_TIME%";
       Local string &find_name = "ARBS4_TIME";
       Local string &FTE, &old_fte;
       Local number &seq_num = 1;
       Local number &cntr = 0;
       &begndate = AddToDate(GPDE_CT_AET.GPDE_CT_REFDT, 0, - 42, 0);

       &mysql = CreateSQL("SELECT A.STD_HOURS,%DATEOUT(A.EFFDT),%DATEOUT(B.EFFDT) FROM PS_JOB
       A,PS_JOB B WHERE A.EMPLID =:1 AND A.EMPL_RCD = :2 AND A.EFFDT >= %DATEIN(:3) AND A.EFFDT <
       %DATEIN(:4) AND A.EMPLID = B.EMPLID AND A.EFFDT < B.EFFDT AND A.FTE <> B.FTE GROUP BY
       A.STD_HOURS,A.EFFDT,B.EFFDT ORDER BY A.EFFDT DESC", GPDE_CT_AET.EMPLID,
       GPDE_CT_AET.EMPL_RCD, &begndate, GPDE_CT_AET.GPDE_CT_REFDT);
       &mysql = CreateSQL("SELECT A.STD_HOURS,%DATEOUT(A.EFFDT),%DATEOUT(B.EFFDT) FROM PS_JOB
A,PS_JOB B WHERE A.EMPLID =:1 AND A.EMPL_RCD = :2 AND A.EFFDT >= %DATEIN(:3) AND A.EFFDT <
%DATEIN(:4) AND A.EMPLID = B.EMPLID AND A.EFFDT < B.EFFDT AND A.FTE <> B.FTE GROUP BY
A.STD_HOURS,A.EFFDT,B.EFFDT ORDER BY A.EFFDT DESC, B.EFFDT ", GPDE_CT_AET.EMPLID,
GPDE_CT_AET.EMPL_RCD, &begndate, GPDE_CT_AET.GPDE_CT_REFDT);

&FmFldAry = CreateArrayRept("", 4);
&mysql_fld = GetSQL(SQL.GPDE_CT_FLD_NAME, GPDE_CT_ARB_AET.GPDE_FM_FORM_ID,
GPDE_CT_AET.EFFDT, GPDE_CT_AET.GPDE_FM_LANG_CD, &fld_name1, &fld_nbr, &fld_name);
While &mysql_fld.Fetch(&fld_nbr, &fld_name)
   &FmFldAry [&fld_nbr] = &fld_name;
End-While;

While &mysql.Fetch(&FTE, &eff_date, &eff_enddate1)

   If &FTE <> &old_fte Then
      &eff_enddate = AddToDate(&eff_enddate1, 0, 0, - 1);
      &cntr = &cntr + 1;
      &eff_datebk = &eff_date;
      &eff_enddate1bk = &eff_enddate1;
      &FTEbk = &FTE;
      &fld_hir = &find_name | "_CHNG_FROM" | &seq_num;
      &index = &FmFldAry.Find(&fld_hir);

      REM No change in FTE ;
      If &eff_date <> &eff_enddate Then
         If &index > 0 Then
            SQLExec(SQL.GPDE_CT_UPDATETMP_PC, "S", "4", "", &eff_date, 0,
GPDE_CT_ARB_AET.PROCESS_INSTANCE, &index);
         End-If;

         &fld_der = &find_name | "_CHNG_TO" | &seq_num;
         &index = &FmFldAry.Find(&fld_der);

         If &index > 0 Then
            SQLExec(SQL.GPDE_CT_UPDATETMP_PC, "S", "4", "", &eff_enddate, 0,
GPDE_CT_ARB_AET.PROCESS_INSTANCE, &index);
         End-If;

         &fld_HRS = &find_name | "_CHNG_HRS" | &seq_num;
         &index = &FmFldAry.Find(&fld_HRS);

         If &index > 0 Then
            SQLExec(SQL.GPDE_CT_UPDATETMP_PC, "S", "0", &FTE, &eff_enddate, 0,
GPDE_CT_ARB_AET.PROCESS_INSTANCE, &index);
         End-If;
         &seq_num = &seq_num + 1;
      End-If;
      &old_fte = &FTE;
   End-If;
End-While;

If ((&cntr < 2) And
         (All(&FTEbk))) Then
   &cntr = &cntr + 1;
   SQLExec("Select %Dateout(A.EFFDT),A.STD_HOURS FROM PS_JOB A Where A.EMPLID = :1 AND
A.EMPL_RCD = :2 AND A.STD_HOURS <> :3 AND A.EFFDT = ( SELECT MAX(B.EFFDT) FROM PS_JOB B WHERE
B.EMPLID = A.EMPLID AND B.EMPL_RCD = A.EMPL_RCD AND B.EFFDT < %DATEIN(:4))",
GPDE_CT_AET.EMPLID, GPDE_CT_AET.EMPL_RCD, &FTEbk, &eff_datebk, &Effdt2, &fte2);
   &eff_enddatebk1 = AddToDate(&eff_datebk, 0, 0, - 1);
   &fld_hir = &find_name | "_CHNG_FROM" | &cntr;
   &index = &FmFldAry.Find(&fld_hir);

   If &fte2 <> 0 Then
      If &index > 0 Then
         SQLExec(SQL.GPDE_CT_UPDATETMP_PC, "S", "4", "", &Effdt2, 0,
GPDE_CT_ARB_AET.PROCESS_INSTANCE, &index);
      End-If;

      &fld_der = &find_name | "_CHNG_TO" | &cntr;
      &index = &FmFldAry.Find(&fld_der);
            If &index > 0 Then
               SQLExec(SQL.GPDE_CT_UPDATETMP_PC, "S", "4", "", &eff_enddatebk1, 0,
      GPDE_CT_ARB_AET.PROCESS_INSTANCE, &index);
            End-If;

              &fld_HRS = &find_name | "_CHNG_HRS" | &cntr;
              &index = &FmFldAry.Find(&fld_HRS);

            If &index > 0 Then
               SQLExec(SQL.GPDE_CT_UPDATETMP_PC, "S", "0", &fte2, &eff_enddatebk1, 0,
      GPDE_CT_ARB_AET.PROCESS_INSTANCE, &index);
            End-If;

         End-If;
      End-If;

      If ((&cntr < 2) And
               (None(&FTEbk))) Then
         &cntr = &cntr + 1;
         &mysql2 = CreateSQL("SELECT A.STD_HOURS,%DATEOUT(A.EFFDT),%DATEOUT(B.EFFDT) FROM PS_JOB
      A,PS_JOB B WHERE A.EMPLID =:1 AND A.EMPL_RCD = :2 AND A.EFFDT < %DATEIN(:3) AND A.EMPLID =
      B.EMPLID AND A.EFFDT < B.EFFDT AND A.FTE <> B.FTE GROUP BY A.STD_HOURS,A.EFFDT,B.EFFDT ORDER
      BY A.EFFDT DESC", GPDE_CT_AET.EMPLID, GPDE_CT_AET.EMPL_RCD, &begndate);
         While &mysql2.Fetch(&FTE3, &eff_date3, &eff_enddate3)

              If ((&FTE3 <> &old_fte3) And
                       (&eff_enddate3 > &begndate) And
                       (&cntr <= 2)) Then
                 If &FTE3 <> 0 Then
                    &eff_enddate3 = AddToDate(&eff_enddate3, 0, 0, - 1);
                    &fld_hir = &find_name | "_CHNG_FROM" | &cntr;
                    &index = &FmFldAry.Find(&fld_hir);

                  If &index > 0 Then
                     SQLExec(SQL.GPDE_CT_UPDATETMP_PC, "S", "4", "", &eff_date3, 0,
      GPDE_CT_ARB_AET.PROCESS_INSTANCE, &index);
                  End-If;

                    &fld_der = &find_name | "_CHNG_TO" | &cntr;
                    &index = &FmFldAry.Find(&fld_der);

                  If &index > 0 Then
                     SQLExec(SQL.GPDE_CT_UPDATETMP_PC, "S", "4", "", &eff_enddate3, 0,
      GPDE_CT_ARB_AET.PROCESS_INSTANCE, &index);
                  End-If;

                    &fld_HRS = &find_name | "_CHNG_HRS" | &cntr;
                    &index = &FmFldAry.Find(&fld_HRS);

                  If &index > 0 Then
                     SQLExec(SQL.GPDE_CT_UPDATETMP_PC, "S", "0", &FTE3, &eff_enddate3, 0,
      GPDE_CT_ARB_AET.PROCESS_INSTANCE, &index);
                  End-If;
               End-If;
               &old_fte3 = &FTE3;
            End-If;
         End-While;
      End-If;




PeopleCode (ApplEng): GPDE_DV_REP.REP_XFERGBLdefault 1900-01-01.XFER_DS4.OnExecute
      Local SQL &sql;

      /*   sg09-89B17 1890237000:
      1.   select the employee membership number from DSME record GPDE_DV_DSME.GPDE_VW_MNRBV.
      2.   compare 3 char of the employee membership nbr with 3 char the dummy membership nbr defined
      in   Pension fund provider id table GPDE_PF_PROV_ID.GPDE_PF_DUM_MNRBV.
      3.   if it's different, update GPDE_DV_DSME.GPDE_VW_MNRBV with
      GPDE_PF_PROV_ID.GPDE_PF_DUM_MNRBV. */

      rem 1. select the employee membership number from DSME record GPDE_DV_DSME.GPDE_VW_MNRBV.;
      &sql = CreateSQL("Select EMPLID, EMPL_RCD, %Dateout(GPDE_DV_EVT_EFFDT), GPDE_DV_REP_RSN,
      GPDE_DV_RUN, GPDE_DV_CANCEL, GPDE_SI_PROV_ID, GPDE_VW_MNRBV from PS_GPDE_DV_DSME where
      CAL_RUN_ID = :1 AND GPDE_DV_EVT_EFFDT >= %Datein('2009-01-01')",
      GPDE_DV_ALL_AET.CAL_RUN_ID.Value);
      &sql = CreateSQL("Select EMPLID, EMPL_RCD, %Dateout(GPDE_DV_EVT_EFFDT), GPDE_DV_REP_RSN,
      GPDE_DV_RUN, GPDE_DV_CANCEL, GPDE_SI_PROV_ID, GPDE_VW_MNRBV, GPDE_DV_DBNA, GPDE_DV_DBGB from
      PS_GPDE_DV_DSME where CAL_RUN_ID = :1 AND GPDE_DV_EVT_EFFDT >= %Datein('2009-01-01')",
      GPDE_DV_ALL_AET.CAL_RUN_ID.Value);

      While &sql.Fetch(&emplid, &empl_rcd, &evt_effdt, &rep_rsn, &dv_run, &dv_cancel, &prov_id,
      &mnrbv)
      While &sql.Fetch(&emplid, &empl_rcd, &evt_effdt, &rep_rsn, &dv_run, &dv_cancel, &prov_id,
      &mnrbv, &DBNA, &DBGB)
         rem 2. compare 3 char of the employee membership nbr with 3 char the dummy membership nbr
      defined in Pension fund provider id table GPDE_PF_PROV_ID.GPDE_PF_DUM_MNRBV.;
         SQLExec("Select PFPROV.GPDE_PF_DUM_MNRBV from PS_GPDE_PF_PROV_ID PFPROV where
      PFPROV.GPDE_SI_PROV_ID = :1 AND PFPROV.EFFDT = (select max(PF2.EFFDT) from PS_GPDE_PF_PROV_ID
      PF2 where PF2.GPDE_SI_PROV_ID = PFPROV.GPDE_SI_PROV_ID)", &prov_id, &dummy_MNRBV);

         &Length_dummy_MNRBV = Len(&dummy_MNRBV);
         &Length_MNRBV = Len(&mnrbv);

         &dummy_compare = Substring(&dummy_MNRBV, &Length_dummy_MNRBV - 3, 3);
         &original_compare = Substring(&mnrbv, &Length_MNRBV - 3, 3);

         rem 3. if it's different, update GPDE_DV_DSME.GPDE_VW_MNRBV with
      GPDE_PF_PROV_ID.GPDE_PF_DUM_MNRBV. ;
         If &dummy_compare <> &original_compare Then
             SQLExec("UPDATE PS_GPDE_DV_DSME SET GPDE_VW_MNRBV = :1 where EMPLID = :2 AND EMPL_RCD
      = :3 AND GPDE_DV_EVT_EFFDT = %Datein(:4) AND GPDE_DV_REP_RSN = :5 AND GPDE_DV_RUN = :6 AND
      GPDE_DV_CANCEL = :7 AND GPDE_SI_PROV_ID = :8 AND CAL_RUN_ID = :9 ", &dummy_MNRBV, &emplid,
      &empl_rcd, &evt_effdt, &rep_rsn, &dv_run, &dv_cancel, &prov_id,
      GPDE_DV_ALL_AET.CAL_RUN_ID.Value);
             /* sg09-89B18 - ice 1909382000 When the Pension Fund has a dummy membership number, the
      blocks DBNA and DBGB have to be resported for notifications 10, 12, 30, 32 and 33 */
             If &rep_rsn = "10" Or
                   &rep_rsn = "12" Or
                   &rep_rsn = "30" Or
                   &rep_rsn = "32" Or
                   &rep_rsn = "33" Then
                &DBNA = "Y";
                &DBGB = "Y";
             Else
                /* sg09-89B18 - ice 1909382000 When the Pension Fund has a dummy membership number,
      the blocks DBGB has to be resported for notifications 13 */
                If &rep_rsn = "13" Then
                   &DBGB = "Y";
                End-If;
             End-If;
             /* Final Update */
             SQLExec("UPDATE PS_GPDE_DV_DSME SET GPDE_VW_MNRBV = :1, GPDE_DV_DBNA = :10, GPDE_DV_DBGB
      = :11 where EMPLID = :2 AND EMPL_RCD = :3 AND GPDE_DV_EVT_EFFDT = %Datein(:4) AND GPDE_DV_REP_RSN
      = :5 AND GPDE_DV_RUN = :6 AND GPDE_DV_CANCEL = :7 AND GPDE_SI_PROV_ID = :8 AND CAL_RUN_ID =
      :9 ", &dummy_MNRBV, &emplid, &empl_rcd, &evt_effdt, &rep_rsn, &dv_run, &dv_cancel, &prov_id,
      GPDE_DV_ALL_AET.CAL_RUN_ID.Value, &DBNA, &DBGB);
         End-If;
      End-While;




PeopleCode (ApplEng): GPES_SS_TC2.MAIN        GBLdefault 1900-01-01.Step02.OnExecute
      [ . . . Unchanged Code not Shown . . . ]

      Function Period_Liquidation();
         Local SQL &SQL1, &SQL;
         Local number &POS, &PRE_RANGE;
         Local boolean &result;
         Local string &val;

         If All(&PAYMENT) Then
             &SQL1 = CreateSQL("SELECT DISTINCT GPES_YEAR_RECALC, GPES_MONTH_RECALC FROM
      PS_GPES_SSTC_RSLT WHERE " | Substitute(&SQL_Population, "FILL.", "") | " AND GPES_SSTC_PAYMNT
      =:4 " | Substitute(&VAC_WHERE, "FILL.", "") | " AND GPES_YEAR_RECALC = :5 AND GPES_SSTC_EXCL_FAN
      = '00' ORDER BY GPES_YEAR_RECALC, GPES_MONTH_RECALC", &CCC, &YEAR, &MONTH, &PAYMENT,
      &CALC_YEAR);
             &I_RANGE = 1;
             &POS = 1;
             &result = True;
             While &SQL1.Fetch(&YEAR_RECALC, &MONTH_RECALC)
                If &PAYMENT = "L03" Or
                      &PAYMENT = "L09" Then
                   &SQL = CreateSQL("SELECT DISTINCT 'X' FROM PS_GPES_SSTC_RSLT WHERE " |
      Substitute(&SQL_Population, "FILL.", "") | " AND GPES_SSTC_PAYMNT =:4 " |
      Substitute(&VAC_WHERE, "FILL.", "") | " GPES_YEAR_RECALC = :5 AND GPES_MONTH_RECALC = :6 AND
      GPES_SSTC_ELEMENT IN
      ('BA01','BA02','BA09','BA10','BA11','BA21','BA22','BA42','CA31','CA32') AND
      (GPES_SSTC_AMOUNT < 0 OR GPES_SSTC_CT_ER <0 OR GPES_SSTC_CT_EE < 0)", &CCC, &YEAR, &MONTH,
      &PAYMENT, &CALC_YEAR, &MONTH_RECALC);
                   &SQL = CreateSQL("SELECT DISTINCT 'X' FROM PS_GPES_SSTC_RSLT WHERE " |
      Substitute(&SQL_Population, "FILL.", "") | " AND GPES_SSTC_PAYMNT =:4 " |
      Substitute(&VAC_WHERE, "FILL.", "") | " AND GPES_YEAR_RECALC = :5 AND GPES_MONTH_RECALC = :6
      AND GPES_SSTC_ELEMENT IN
      ('BA01','BA02','BA09','BA10','BA11','BA21','BA22','BA42','CA31','CA32') AND
      (GPES_SSTC_AMOUNT < 0 OR GPES_SSTC_CT_ER <0 OR GPES_SSTC_CT_EE < 0)", &CCC, &YEAR, &MONTH,
      &PAYMENT, &CALC_YEAR, &MONTH_RECALC);
                   If &SQL.Fetch(&val) Then
                      &result = ValidateMonth();
                   End-If;
                End-If;
                If &result = True Then
                   If &POS > 1 Then
                      &PRE_RANGE = &RANG_MAX [&I_RANGE];
                      If Abs(&MONTH_RECALC - &PRE_RANGE) > 1 Or
                             &PAYMENT = "L13" Or
                             &PAYMENT = "L09" Or
                             (&SPLIT_RTR_PMT = "Y" And
                                &PAYMENT = "L03") Then
                         &I_RANGE = &I_RANGE + 1;
                         &RANG_MAX [&I_RANGE] = &MONTH_RECALC;
                         &RANG_MAX_YR [&I_RANGE] = &YEAR_RECALC;
                         &RANG_MIN [&I_RANGE] = &MONTH_RECALC;
                      Else
                         &RANG_MAX [&I_RANGE] = &MONTH_RECALC;
                         &RANG_MAX_YR [&I_RANGE] = &YEAR_RECALC;
                      End-If;
                   Else
                      &RANG_MAX [&I_RANGE] = &MONTH_RECALC;
                      &RANG_MAX_YR [&I_RANGE] = &YEAR_RECALC;
                      &RANG_MIN [&I_RANGE] = &MONTH_RECALC;
                   End-If;
                   &POS = &POS + 1;
                End-If;
                &result = True;
             End-While;
         End-If;
      End-Function;

      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (ApplEng): GPFR_AF_AE.ADDPARM GBLdefault 1900-01-01.Step10.OnExecute
      [ . . . Unchanged Code not Shown . . . ]
PeopleCode (ApplEng): GPFR_ASS_AE.LPR         GBLdefault 1900-01-01.Step01.OnExecute
      Local   SQL &FetchSegments, &FetchResult, &InsertLPR;
      Local   number &NetPaid;
      Local   Record &LPR_PAYEE;
      Local   string &PayslipData;

      &LPR_PAYEE = CreateRecord(Record.GPFR_LPR_PAYEE);
      &PayslipData = "N";
      SQLExec("SELECT 'Y' FROM PS_GPFR_ONPAY_S_VW SVW WHERE SVW.EMPLID = :1 AND SVW.CAL_RUN_ID =
      :2 AND SVW.EMPL_RCD = :3 AND %datein(:4) BETWEEN SVW.SEG_BGN_DT AND SVW.SEG_END_DT",
      GPFR_ASS_AET.EMPLID.Value, GPFR_ASS_AET.CAL_RUN_ID.Value, GPFR_ASS_AET.EMPL_RCD.Value,
      GPFR_ASS_AET.LAST_DATE_WORKED.Value, &PayslipData);
      If &PayslipData = "Y" Then
         &FetchSegments = CreateSQL("SELECT
      SVW.EMPLID,SVW.CAL_RUN_ID,SVW.EMPL_RCD,SVW.GP_PAYGROUP,SVW.CAL_ID,SVW.ORIG_CAL_RUN_ID,SVW
      .RSLT_SEG_NUM,PIN_NET_NUM FROM PS_GPFR_ONPAY_S_VW SVW WHERE SVW.EMPLID = :1 AND SVW.CAL_RUN_ID
      = :2 AND SVW.EMPL_RCD = :3 AND %datein(:4) BETWEEN SVW.SEG_BGN_DT AND SVW.SEG_END_DT",
      GPFR_ASS_AET.EMPLID.Value, GPFR_ASS_AET.CAL_RUN_ID.Value, GPFR_ASS_AET.EMPL_RCD.Value,
      GPFR_ASS_AET.LAST_DATE_WORKED.Value);
      Else
         &FetchSegments = CreateSQL("SELECT
      SVW.EMPLID,SVW.CAL_RUN_ID,SVW.EMPL_RCD,SVW.GP_PAYGROUP,SVW.CAL_ID,SVW.ORIG_CAL_RUN_ID,SVW
      .RSLT_SEG_NUM,PIN_NET_NUM FROM PS_GPFR_ONPAY_S_VW SVW WHERE SVW.EMPLID = :1 AND SVW.CAL_RUN_ID
      = :2 AND SVW.EMPL_RCD = :3 ", GPFR_ASS_AET.EMPLID.Value, GPFR_ASS_AET.CAL_RUN_ID.Value,
      GPFR_ASS_AET.EMPL_RCD.Value, GPFR_ASS_AET.LAST_DATE_WORKED.Value);
      End-If;
      &NetPaid = 0;
      MessageBox(0, "", 142, 1, "", GPFR_ASS_AET.CAL_RUN_ID.Value);
      While &FetchSegments.Fetch(&EMPLID, &CAL_RUN_ID, &EMPL_RCD, &GP_PAYGROUP, &CAL_ID,
      &ORIG_CAL_RUN_ID, &RSLT_SEG_NUM, &PIN_NET_NUM)
         For &i = 1 To 3
            Evaluate &i
            When 1
               &View = "GPFR_RSLT_AC_VW";
               Break;
            When 2
               &View = "GPFR_RSLT_AO_VW";
               Break;
            When 3
               &View = "GPFR_RSLT_AR_VW";
               Break;
            End-Evaluate;

             &FetchResult = CreateSQL("select R.CALC_RSLT_VAL, R.CURRENCY_CD, R.CURRENCY_CD2 from
      PS_" | &View | " R where R.EMPLID = :1 and R.EMPL_RCD = :2 and R.CAL_RUN_ID = :3 and GP_PAYGROUP
      = :4 and CAL_ID = :5 and ORIG_CAL_RUN_ID = :6 and RSLT_SEG_NUM = :7 and PIN_NUM = :8", &EMPLID,
      &EMPL_RCD, &CAL_RUN_ID, &GP_PAYGROUP, &CAL_ID, &ORIG_CAL_RUN_ID, &RSLT_SEG_NUM,
      &PIN_NET_NUM);
             While &FetchResult.Fetch(&PIN_NET_VAL, &CURRENCY_CD, &CURRENCY_CD2)
                If &CURRENCY_CD <> &CURRENCY_CD2 Then
                   ConvertCurrency(&PIN_NET_VAL, &CURRENCY_CD2, &CURRENCY_CD, "OFFIC", %Date,
      &PIN_NET_VAL);
                End-If;
                &NetPaid = &NetPaid + Round(&PIN_NET_VAL, 2);
             End-While;
             &FetchResult.Close();
         End-For;
      End-While;
      &FetchSegments.Close();
      If &NetPaid < 0 Then
         MessageBox(0, "", 17145, 355, "", &NetPaid);
         &NetPaid = 0;
      End-If;
      &Exists = "N";
      SQLExec("Select 'Y' from PS_GPFR_LPR_PAYEE LP WHERE LP.CAL_RUN_ID = :1 AND LP.EMPLID = :2 AND
      LP.EMPL_RCD = :3 AND LP.LAST_DATE_WORKED = %datein(:4)", GPFR_ASS_AET.CAL_RUN_ID.Value,
      GPFR_ASS_AET.EMPLID.Value, GPFR_ASS_AET.EMPL_RCD.Value,
      GPFR_ASS_AET.LAST_DATE_WORKED.Value, &Exists);
       If &Exists = "Y" Then
          SQLExec("Update PS_GPFR_LPR_PAYEE SET GPFR_LAST_PAYMENT = :1,CURRENCY_CD = :2 WHERE
       CAL_RUN_ID = :3 AND EMPLID = :4 AND EMPL_RCD = :5 AND LAST_DATE_WORKED = %datein(:6)", &NetPaid,
       GPFR_ASS_AET.CURRENCY_CD.Value, GPFR_ASS_AET.CAL_RUN_ID.Value, GPFR_ASS_AET.EMPLID.Value,
       GPFR_ASS_AET.EMPL_RCD.Value, GPFR_ASS_AET.LAST_DATE_WORKED.Value);
       Else
          &InsertLPR = CreateSQL("%Insert(:1)");
          &LPR_PAYEE.CAL_RUN_ID.Value = GPFR_ASS_AET.CAL_RUN_ID.Value;
          &LPR_PAYEE.EMPLID.Value = GPFR_ASS_AET.EMPLID.Value;
          &LPR_PAYEE.EMPL_RCD.Value = GPFR_ASS_AET.EMPL_RCD.Value;
          &LPR_PAYEE.LAST_DATE_WORKED.Value = GPFR_ASS_AET.LAST_DATE_WORKED.Value;
          &LPR_PAYEE.GPFR_LAST_PAYMENT.Value = &NetPaid;
          &LPR_PAYEE.CURRENCY_CD.Value = GPFR_ASS_AET.CURRENCY_CD.Value;
          &InsertLPR.Execute(&LPR_PAYEE);
          &InsertLPR.Close();
       End-If;




PeopleCode (ApplEng): GPFR_RPT_AE.RPTFRA GBLdefault 1900-01-01.StepM10.OnExecute
       [ . . . Unchanged Code not Shown . . . ]




PeopleCode (ApplEng): GPFR_RPT_AE.XML            GBLdefault 1900-01-01.Step01.OnExecute
       [ . . . Unchanged Code not Shown . . . ]




PeopleCode (ApplEng): GPGB_EDIP453.P45(3) GBLdefault 1900-01-01.ATT1.1.OnExecute
       Declare Function EDI_ATT1 PeopleCode GPGB_EDIFUNCLIB.GPGB_EDI_ATT1 FieldFormula;
       Declare Function validate_charset_a PeopleCode GPGB_EDIFUNCLIB.GPGB_VAL_CHAR_SET
       FieldFormula;

       Global File &EDIFile;
       Global Rowset &RS_Rec1;
       Local Record &Rec;
       Local boolean &bOk;

       /**********************************/
       /* Write ATT1 details to EDI file */
       /**********************************/

       GPGB_EDILIB_AET.GPGB_EDI_CODE = "7";
       validate_charset_a(GPGB_EDILIB_AET.GPGB_ER_PAYE_REF);

       GPGB_EDILIB_AET.GPGB_EDI_VALUE = (GPGB_EDILIB_AET.GPGB_ER_PAYE_REF);
       &Rec = &RS_Rec1.GetRow(1).GetRecord(Record.ATT1);
       &bOk = EDI_ATT1(&EDIFile, &Rec, True);




PeopleCode (ApplEng): GPGB_EDIP6P9.P6P9          GBLdefault 1900-01-01.Step01.OnExecute
       Declare   Function   LoadEDIRecord PeopleCode GPGB_EDIFUNCLIB.GPGB_EDI_TRANS FieldFormula;
       Declare   Function   EDI_ReadRecord PeopleCode GPGB_EDIFUNCLIB.GPGB_EDI_TRANS FieldFormula;
       Declare   Function   GetEmplId PeopleCode GPGB_EDIFUNCLIB.GPGB_EDI_WORKS_ID FieldFormula;
       Declare   Function   GetEmplRcd PeopleCode GPGB_EDIFUNCLIB.GPGB_EDI_WORKS_ID FieldFormula;
       Declare   Function   SetStatDetails PeopleCode GPGB_EDIFUNCLIB.GPGB_EDI_WORKS_ID FieldFormula;
       Declare   Function   SetDtlMessage2 PeopleCode GPGB_EDIFUNCLIB.GPGB_EDI_WORKS_ID FieldFormula;
       Declare   Function   SetHdrMessage2 PeopleCode GPGB_EDIFUNCLIB.GPGB_EDI_WORKS_ID FieldFormula;

       Global File &EDIFile;
       Global boolean &EdiP6P9Copy; /*New Boolean variable defined to track the TAX1 value*/
       Global boolean &EdiP6P9Copy; /*New Boolean variable defined to track the TAX1 value
ICE-1830162001 */
Local string &sLine, &sRec, &sMsg, &sMode, &sMatchSeg, &sParam1, &sParam2, &sParam3;
Local Rowset &RS_Rec1;
Local Record &Rec;
Local boolean &bOk, &bEEDetails, &bPrevPay, &bPrevTax, &bGotCNT1, &bMsg;
Local number &iCount, &iOk, &iError, &iNotFound, &iStatus, &iTotal;
Local number &iMessCat, &iMessNum;

&RS_Rec1 = &EDIFile.CreateRowset();

/*P6 notification
  Read the header info for use in log file reporting
  Match the employee information (NI number/works number/surname)
  If matched - check no data collision (have record >= effective date in file)
  If no match - write the problem to the log
  If no collision - insert into GPGB_EE_STDTLS
  If collision - write the problem to the log (unless it is this kind of transaction)
*/

&bGotCNT1 = False;
&EdiP6P9Copy = False;
&EdiP6P9Copy = False; /*ICE-1830162001 */

While &EDIFile.ReadLine(&sLine);

   If All(&sLine) Then

      If Left(&sLine, 4) = "****" Then
         /*Header*/
         &sRec = "HEADER"
      Else
         &sRec = RTrim(Left(&sLine, 5));
         /*ICE-1830162001 START*/
         If &sRec = "TAX1" Then

            &EdiP6P9Copy = True;
         End-If;
         /*ICE-1830162001 END*/

      End-If;

      &bOk = SQLExec(SQL.GPGB_EDI_FIELDSEGDEFN, "GPGB_EDI_MOVDED", &sRec, &sMatchSeg);

      If All(&sMatchSeg) Then

         &Rec = &RS_Rec1.GetRow(1).GetRecord(@("Record." | &sRec));
         &bOk = LoadEDIRecord("GPGB_EDI_MOVDED", &Rec, &sLine, &sRec);

         If &bOk Then

            Evaluate &sRec
            When "HEADER"
               &sMode = GPGB_EDILIB_AET.GPGB_EDI_RUN_TYPE;
               &bOk = EDI_ReadRecord(&EDIFile, &Rec, &sRec);
               &iCount = 0;
               &iOk = 0;
               If &bOk Then
                  /* Check if the file has a test flag set
                     If so then don't update any stat details info
                     just post a note in the log.
                  */
                  If GPGB_EDILIB_AET.GPGB_EDI_RUN_TYPE = "1" Then
                     &sMsg = "P6/P9 Warning: The EDI file is flagged as a test file - no updates
will be made";
                     &bMsg = SetDtlMessage2(17135, 370, "WARNING", &sMsg, "", "", "", "");
                     If &sMode = "0" Then
                         /*User has specified a final run - need to ovveride because only got
a test file*/
                         &sMsg = "P6/P9 Warning: Over-riding run type to Trial Run instead of
Final Run";
                         &bMsg = SetDtlMessage2(17135, 369, "WARNING", &sMsg, "", "", "", "");
                      End-If;
                   Else
                      /* Reset the run type to the original value (from the run control)
                         since this gets overridden when the header record is read
                      */
                      GPGB_EDILIB_AET.GPGB_EDI_RUN_TYPE = &sMode;
                   End-If;

                   /*Write header information and transaction information to log files*/
                   &iMessCat = 17135;
                   &sParam1 = GPGB_EDILIB_AET.GPGB_EDI_TRANS;
                   &sParam2 = "";
                   &sParam3 = "";
                   If GPGB_EDILIB_AET.GPGB_EDI_RUN_TYPE = "0" Then
                      /*Final Run*/
                      &sMsg = "Final %1 process initiated.";
                      &iMessNum = 393;
                   Else
                      /*Trial Run*/
                      &sMsg = "Trial %1 process initiated.";
                      &iMessNum = 394;
                   End-If;
                   &bMsg = SetHdrMessage2(&iMessCat, &iMessNum, &sMsg, &sParam1, &sParam2,
&sParam3);

                   &sParam1 = RTrim(GPGB_EDILIB_AET.RUN_CNTL_ID);
                   &sParam2 = RTrim(GPGB_EDILIB_AET.OPRID);
                   &sParam3 = String(GPGB_EDILIB_AET.PROCESS_INSTANCE);
                   &sMsg = "EDI Transaction Information : Run Control=%1, Operator=%2,
Instance=%3";
                   &bMsg = SetHdrMessage2(17135, 334, &sMsg, &sParam1, &sParam2, &sParam3);

                   &sParam1 = RTrim(GPGB_EDILIB_AET.GPGB_EDI_TRANS);
                   &sParam2 = String(GPGB_EDILIB_AET.GPGB_EDI_REF);
                   &sParam3 = RTrim(GPGB_EDILIB_AET.GPGB_EDI_FILENAME);
                   &sMsg = "EDI Transaction Information : Type=%1, Reference=%2, FileName=%3";
                   &bMsg = SetHdrMessage2(17135, 335, &sMsg, &sParam1, &sParam2, &sParam3);

                End-If;
                Break;

            When "BGM1"
               &bOk = EDI_ReadRecord(&EDIFile, &Rec, &sRec);
               If &bOk Then
                  Evaluate RTrim(GPGB_EDILIB_AET.GPGB_EDI_CODE)
                  When "1" /*P6 - individual in-year code changes*/
                     If GPGB_EDILIB_AET.GPGB_EDI_TRANS <> "P6" Then
                         &sMsg = "Warning: Run control transaction type of %1 doesn't match
file transaction of %2";
                         &bMsg = SetDtlMessage2(17135, 373, "WARNING", &sMsg,
GPGB_EDILIB_AET.GPGB_EDI_TRANS, "P6", "", "");
                         &sMsg = "Warning: Transaction types are compatible - processing
continues";
                         &bMsg = SetDtlMessage2(17135, 374, "WARNING", &sMsg, "", "", "", "");
                         GPGB_EDILIB_AET.GPGB_EDI_TRANS = "P6";
                     End-If;
                     Break;
                  When "2" /*P6B - individual Budget code changes*/
                     If GPGB_EDILIB_AET.GPGB_EDI_TRANS <> "P6B" Then
                         &sMsg = "Warning: Run control transaction type of %1 doesn't match
file transaction of %2";
                         &bMsg = SetDtlMessage2(17135, 373, "WARNING", &sMsg,
GPGB_EDILIB_AET.GPGB_EDI_TRANS, "P6", "", "");
                         &sMsg = "Warning: Transaction types are compatible - processing
continues";
                         &bMsg = SetDtlMessage2(17135, 374, "WARNING", &sMsg, "", "", "", "");
                         GPGB_EDILIB_AET.GPGB_EDI_TRANS = "P6B";
                     End-If;
                     Break;
                  When "3" /*P9 - invidual code changes for next tax year*/
                     If GPGB_EDILIB_AET.GPGB_EDI_TRANS <> "P9" Then
                           &sMsg = "Warning: Run control transaction type of %1 doesn't match
file transaction of %2";
                         &bMsg = SetDtlMessage2(17135, 373, "WARNING", &sMsg,
GPGB_EDILIB_AET.GPGB_EDI_TRANS, "P6", "", "");
                         &sMsg = "Warning: Transaction types are compatible - processing
continues";
                         &bMsg = SetDtlMessage2(17135, 374, "WARNING", &sMsg, "", "", "", "");
                         GPGB_EDILIB_AET.GPGB_EDI_TRANS = "P9";
                      End-If;
                      Break;
                  When-Other
                      /*Incorrect transaction - write to log then abort*/
                      &sMsg = "Error: EDI transaction type (%1) is not a %2 - processing
cancelled";
                      &bMsg = SetHdrMessage2(17135, 338, &sMsg,
GPGB_EDILIB_AET.GPGB_EDI_CODE, GPGB_EDILIB_AET.GPGB_EDI_TRANS, "");
                      &bOk = False;
                      Break;
                  End-Evaluate;
               End-If;
               Break;

            When "NAD1A"
               &bOk = True; /*Don't need to process employer/tax office name*/
               Break;

            When "ATT1"
               &bOk = EDI_ReadRecord(&EDIFile, &Rec, &sRec);
               If &bOk Then
                  Evaluate RTrim(GPGB_EDILIB_AET.GPGB_EDI_CODE)
                  When "7" /*Employer PAYE Ref*/
                      /*Validate got correct PAYE Ref - if not then abort*/;
                      If RTrim(GPGB_EDILIB_AET.GPGB_EDI_VALUE) <>
RTrim(GPGB_EDILIB_AET.GPGB_ER_PAYE_REF) Then
                         &bOk = False;
                         &sMsg = "Error: File PAYE ref (%1) mismatch with pay entity PAYE ref
(%2) - processing cancelled";
                         &bMsg = SetHdrMessage2(17135, 340, &sMsg,
RTrim(GPGB_EDILIB_AET.GPGB_EDI_VALUE), GPGB_EDILIB_AET.GPGB_ER_PAYE_REF, "");
                      End-If;
                      Break;
                  When "17" /*Tax Office Reference*/
                      /*Validate got correct Tax Office Reference - if not then abort*/;
                      If Value(RTrim(GPGB_EDILIB_AET.GPGB_EDI_VALUE)) <>
GPGB_EDILIB_AET.GPGB_ER_TAXNUM Then
                         &bOk = False;
                         &sMsg = "Error: File tax office ref (%1) mismatch with pay entity tax
office ref (%2) - processing cancelled";
                         &bMsg = SetHdrMessage2(17135, 343, &sMsg,
RTrim(GPGB_EDILIB_AET.GPGB_EDI_VALUE), RTrim(String(GPGB_EDILIB_AET.GPGB_ER_TAXNUM)), "");
                      End-If;
                      Break;
                  End-Evaluate;
               End-If;
               Break;

            When "DTM1"
               &bOk = EDI_ReadRecord(&EDIFile, &Rec, &sRec);
               If &bOk Then
                  /*Write transaction date to log*/

               End-If;
               Break;

            When "UNS1";
               &bOk = True;
               Break;

            When "LIN1"
               &bEEDetails = False;
               &bOk = EDI_ReadRecord(&EDIFile, &Rec, &sRec);
                 If &bOk Then
                    &iCount = &iCount + 1;

                    If &iCount > 1 Then
                       /*Hit next employee - so try and do an insert/update for the previous
ee*/
                       &bOk = SetStatDetails();
                       If &bOk Then
                          &iOk = &iOk + 1;
                       End-If;
                       /*Set &bOk = True to contiue processing*/
                       &bOk = True;
                    End-If;

                  If &iCount <> GPGB_EDILIB_AET.COUNTER_GLOB Then
                      /*Write a sequence mismatch warning to the log*/
                      &sMsg = "P6/P9 Error: LIN record count (%1) does not match internal count
(%2) - processing cancelled";
                      &bMsg = SetDtlMessage2(17135, 354, "ERROR", &sMsg,
String(GPGB_EDILIB_AET.COUNTER_GLOB), String(&iCount), "", "");
                      &bOk = False;
                  End-If;
               End-If;
               Break;

              When "NAD2A"
                 &bOk = EDI_ReadRecord(&EDIFile, &Rec, &sRec);
                 If &bOk Then
                    If RTrim(GPGB_EDILIB_AET.GPGB_EDI_CODE) = "BV" Then /*Employee details*/
                        &bEEDetails = True;
                    Else
                        &bEEDetails = False;
                    End-If;
                 End-If;
                 Break;

              When "NAD2B"
                 &bOk = EDI_ReadRecord(&EDIFile, &Rec, &sRec);
                 If &bOk Then
                    If &bEEDetails Then
                       /*This process gets Surname, FirstName, Middlename & Title
                    */
                    Else
                       /*Write a warning - unknown record type - to the log*/
                       &sMsg = "P6/P9 Error: Unexpected NAD2B record encountered - processing
cancelled";
                      &bMsg = SetDtlMessage2(17135, 360, "ERROR", &sMsg,
String(GPGB_EDILIB_AET.COUNTER_GLOB), String(&iCount), "", "");
                      &bOk = False;
                  End-If;
               End-If;
               Break;

            When "ATT2"
               GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID.SetDefault();
               &bOk = EDI_ReadRecord(&EDIFile, &Rec, &sRec);
               If &bOk Then
                  If &bEEDetails Then
                     Evaluate RTrim(GPGB_EDILIB_AET.GPGB_EDI_CODE)
                     When "11" /*NI Number*/
                        GPGB_EDILIB_AET.NATIONAL_ID =
RTrim(GPGB_EDILIB_AET.GPGB_EDI_VALUE);
                        Break;
                     When "19" /*Works Id*/
                        GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID =
RTrim(GPGB_EDILIB_AET.GPGB_EDI_VALUE);
                        &chk_emplid = GetEmplId(GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID);
                        /*finding empl_rcd */
                        &x = Find(",", GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID);
                        &y = &x;
                        While &x > 0
                           &x = Find(",", GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID, &y + 1);
                           If &x > 0 Then
                              &y = &x;
                           End-If
                        End-While;
                        If &y > 0 Then

                           &z =
Value(LTrim(RTrim(Substring(GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID, &y + 1, Len(&sWorksId) -
&y))));
                           &z1 = Find(".", &z);
                           &z = Value(Substring(&z, 1, &z1));
                        End-If;

                        If (Len(&chk_emplid) > 11) Or
                              (Len(&z) > 3) Then
                           Warning MsgGetText(17135, 535, "incorrect emplid,empl_rcd derived
from wrksid ", GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID);

                           GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID = "";

                        End-If;

                         Break;
                      When "20" /*Employee liable to Scottish Variable Rate SVR*/
                         GPGB_EDILIB_AET.GPGB_SV_TAX_IND = "Y";
                      When-Other
                         /*Unknown - write warning to log*/
                         &sMsg = "P6/P9 Warning: Unhandled ATT2 record encountered (%1) -
processing continues";
                         &bMsg = SetDtlMessage2(17135, 371, "WARNING", &sMsg,
GPGB_EDILIB_AET.GPGB_EDI_CODE, "", "", "");
                      End-Evaluate;
                  Else
                      /*Write a warning - unknown record type - to the log*/
                      &sMsg = "P6/P9 Error: Unexpected ATT2 record encountered (%1) -
processing cancelled";
                      &bMsg = SetDtlMessage2(17135, 356, "ERROR", &sMsg,
GPGB_EDILIB_AET.GPGB_EDI_CODE, "", "", "");
                      &bOk = False;
                  End-If;
               End-If;
               Break;

            When "TAX1"
               &bOk = EDI_ReadRecord(&EDIFile, &Rec, &sRec);
               If &bOk Then
                  If &bEEDetails Then
                      &bPrevPay = (RTrim(GPGB_EDILIB_AET.GPGB_EDI_CODE) = "77");
                      &bPrevTax = (RTrim(GPGB_EDILIB_AET.GPGB_EDI_CODE) = "81");
                  Else
                      /*Write a warning - unknown record type - to the log*/
                      &sMsg = "P6/P9 Error: Unexpected TAX1 record encountered (%1) -
processing cancelled";
                      &bMsg = SetDtlMessage2(17135, 361, "ERROR", &sMsg,
GPGB_EDILIB_AET.GPGB_EDI_CODE, "", "", "");
                      &bOk = False;
                  End-If;
               End-If;
               Break;

            When "MOA1"
               &bOk = EDI_ReadRecord(&EDIFile, &Rec, &sRec);
               If &bOk Then
                  If &bEEDetails Then
                     &bOk = False;
                     If &bPrevPay Then
                        GPGB_EDILIB_AET.GPGB_P45_PAY_TD =
Value(GPGB_EDILIB_AET.GPGB_EDI_VALUE);
                        &bPrevPay = False;
                        &bOk = True;
                      End-If;
                      If &bPrevTax Then
                         GPGB_EDILIB_AET.GPGB_P45_TAX_TD =
Value(GPGB_EDILIB_AET.GPGB_EDI_VALUE);
                         &bPrevTax = False;
                         &bOk = True;
                      End-If;
                      If Not &bOk Then
                         /*Write a warning - unknown record type - to the log*/
                         &sMsg = "P6/P9 Error: Unknown MOA1 record value encountered -
processing cancelled";
                         &bMsg = SetDtlMessage2(17135, 362, "ERROR", &sMsg, "", "", "", "");
                      End-If;
                  Else
                      /*Write a warning - unknown record type - to the log*/
                      &sMsg = "P6/P9 Error: Unexpected MOA1 record encountered (%1) -
processing cancelled";
                      &bMsg = SetDtlMessage2(17135, 359, "ERROR", &sMsg,
GPGB_EDILIB_AET.GPGB_EDI_CODE, "", "", "");
                      &bOk = False;
                  End-If;
               End-If;
               Break;

            When "DTM2"
               &bOk = EDI_ReadRecord(&EDIFile, &Rec, &sRec);
               If &bOk Then
                  If &bEEDetails Then
                     Evaluate RTrim(GPGB_EDILIB_AET.GPGB_EDI_CODE)
                     When "182" /*Issue Date*/
                        GPGB_EDILIB_AET.GPGB_TAX_CD_ISSUE = GPGB_EDILIB_AET.GPGB_EDI_DATE;
                        Break;
                     When "7" /*Effective Date*/
                        GPGB_EDILIB_AET.EFFDT = GPGB_EDILIB_AET.GPGB_EDI_DATE;
                        Break;
                     When "166" /*P6 Tax Year - reuse P45 fields*/
                        GPGB_EDILIB_AET.GPGB_P45_TXYR =
Value(GPGB_EDILIB_AET.GPGB_EDI_VALUE) - 1;
                        Break;
                     End-Evaluate;
                  Else
                     /*Write a warning - unknown record type - to the log*/
                     &sMsg = "P6/P9 Error: Unexpected DTM2 record encountered (%1) -
processing cancelled";
                     &bMsg = SetDtlMessage2(17135, 358, "ERROR", &sMsg,
GPGB_EDILIB_AET.GPGB_EDI_CODE, "", "", "");
                     &bOk = False;
                  End-If;
               End-If;

            When "ALC1"
               &bOk = EDI_ReadRecord(&EDIFile, &Rec, &sRec);
               If &bOk Then
                  If &bEEDetails Then
                      GPGB_EDILIB_AET.TAXCODE_UK = RTrim(GPGB_EDILIB_AET.GPGB_EDI_VALUE);
                  Else
                      /*Write a warning - unknown record type - to the log*/
                      &sMsg = "P6/P9 Error: Unexpected ALC1 record encountered (%1) -
processing cancelled";
                      &bMsg = SetDtlMessage2(17135, 355, "ERROR", &sMsg,
GPGB_EDILIB_AET.GPGB_EDI_CODE, "", "", "");
                      &bOk = False;
                  End-If;
               End-If;
               Break;

            When "ATT3"
               &bOk = EDI_ReadRecord(&EDIFile, &Rec, &sRec);
               If &bOk Then
                  If &bEEDetails Then
                     Evaluate RTrim(GPGB_EDILIB_AET.GPGB_EDI_CODE)
                      When "2"
                         /*Tax Basis*/
                         GPGB_EDILIB_AET.TAX_BASIS_UK = "1";
                         Break;
                      When "1"
                         /*Scottish Variable Indicator*/
                         GPGB_EDILIB_AET.GPGB_SV_TAX_IND = "Y";
                         Break;
                      End-Evaluate;
                  Else
                      /*Write a warning - unknown record type - to the log*/
                      &sMsg = "P6/P9 Error: Unexpected ATT3 record encountered (%1) -
processing cancelled";
                      &bMsg = SetDtlMessage2(17135, 357, "ERROR", &sMsg,
GPGB_EDILIB_AET.GPGB_EDI_CODE, "", "", "");
                      &bOk = False;
                  End-If;
               End-If;
               Break;

            When "UNS2";
               &bOk = True;

               /*Last separator in file - got last employee - so try and do an insert/update*/
               If &iCount >= 1 Then
                  &bOk = SetStatDetails();
                  If &bOk Then
                      &iOk = &iOk + 1;
                  End-If;
                  /*Set &bOk = True to continue processing*/
                  &bOk = True;
               End-If;
               Break;

            When "CNT1";
               &bGotCNT1 = True;
               &bOk = EDI_ReadRecord(&EDIFile, &Rec, &sRec);
               &iTotal = 0;
               If &bOk Then
                   &iTotal = GPGB_EDILIB_AET.COUNTER_GLOB;
                   &sMsg = "%1 P6/P9 update(s) appplied (%2 of %3 processed)";
                   &bMsg = SetHdrMessage2(17135, 332, &sMsg, String(&iOk), String(&iCount),
String(&iTotal));
               Else
                   /*write a detail log info that can't read the total transaction count.*/
                   GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID = "";
                   &sMsg = "P6/P9 Warning: could not read total updates count (CNT1) record
in EDI file";
                   &bMsg = SetDtlMessage2(17135, 368, "WARNING", &sMsg, "", "", "", "");
                   &sMsg = "%1 P6/P9 update(s) appplied (%2 processed)";
                   &bMsg = SetHdrMessage2(17135, 333, &sMsg, String(&iOk), String(&iCount),
String(&iTotal));
               End-If;
               If GPGB_EDILIB_AET.GPGB_EDI_RUN_TYPE = "0" And
                      GPGB_EDILIB_AET.GPGB_EDI_AUDIT = "Y" Then
                   /*Final Run - ensure audit transaction types are consistent!*/
                   SQLExec("UPDATE PS_GPGB_EDI_AUDHDR SET GPGB_EDI_TRANS = :1 WHERE
GPGB_EDI_REF = :2 AND PAY_ENTITY = :3 AND GPGB_EDI_FILENAME = :4 AND ASOFDATE = %DateIn(:5)",
GPGB_EDILIB_AET.GPGB_EDI_TRANS, GPGB_EDILIB_AET.GPGB_EDI_REF, GPGB_EDILIB_AET.PAY_ENTITY,
GPGB_EDILIB_AET.GPGB_EDI_FILENAME, %AsOfDate);
               End-If;


            End-Evaluate;

            If Not &bOk Then
               Break;
            End-If;

         Else
            &sMsg = "Error: Problem loading %1 structure definition - processing cancelled";
                     &bMsg = SetHdrMessage2(17135, 341, &sMsg, &sRec, "", "");
                     Break;
                  End-If;
               Else
                  &sMsg = "Error: No structure definition available for %1 - processing cancelled";
                  &bMsg = SetHdrMessage2(17135, 339, &sMsg, &sRec, "", "");
                  Break;
               End-If;

          End-If;

       End-While;

       If Not &bGotCNT1 Then
          /*write a detail log info that can't read the total transaction count.*/
          GPGB_EDILIB_AET.GPGB_EDI_WORKS_ID = "";
          &sMsg = "P6/P9 Warning: could not read total updates count (CNT1) record in EDI file";
          &bMsg = SetDtlMessage2(17135, 368, "WARNING", &sMsg, "", "", "", "");
          &sMsg = "%1 P6/P9 update(s) appplied (%2 processed)";
          &bMsg = SetHdrMessage2(17135, 333, &sMsg, String(&iOk), String(&iCount), String(&iTotal));
       End-If;




PeopleCode (ApplEng): GPGB_P45.CkPyPrc GBLdefault 1900-01-01.Step01.OnExecute
       [ . . . Unchanged Code not Shown . . . ]




PeopleCode (ApplEng): GPGB_P45.CkPyPrc GBLdefault 1900-01-01.Step02.OnExecute
       If All(GPGB_P45_AET.SRC_CAL_RUN_ID) Then
       If None(GPGB_P45_AET.SRC_CAL_RUN_ID) Then
          Exit(0); /* Do not skip */
       Else
          Exit(1); /* Skip step */
       End-If;




PeopleCode (ApplEng): GPGB_P45.CkPyPrc GBLdefault 1900-01-01.Step03.OnExecute
       If All(GPGB_P45_AET.SRC_CAL_RUN_ID) Then
          Exit(0); /* Do not skip */
       Else
          Exit(1); /* Skip step */
       End-If;




PeopleCode (ApplEng): GPGB_P45.CkPyPrc GBLdefault 1900-01-01.Step04.OnExecute
       If All(GPGB_P45_AET.SRC_CAL_RUN_ID) Then
          Exit(0); /* Do not skip */
       Else
          Exit(1); /* Skip step */
       End-If;




PeopleCode (ApplEng): GPJP_LA03.GEN_FIL GBLdefault 1900-01-01.Step05.OnExecute
       Local   File &File;
       Local   string &FILE_NAME, &CHARSET, &SRC_FLG_VAL;
       Local   string &TRANSACTION_REC_NAME, &TRANSACTION_REC_ERR_FLG;
       Local   Record &HEADER_REC, &REPORT_TYP, &TRANSACTION_REC;
Local SQL &HEADER_SQL, &TRANSACTION_SQL;
Local string &Hours, &Minutes;
Local number &Check_Space_Error_Flg;
Declare Function Convert_to_Imperial_date PeopleCode FUNCLIB_GPJP.GPJP_FUNCTIONS
FieldFormula;
Declare Function Get_Hour_Minute PeopleCode FUNCLIB_GPJP.GPJP_FUNCTIONS FieldFormula;
Declare Function Create_Error_Detail_rec PeopleCode FUNCLIB_GPJP.GPJP_FUNCTIONS
FieldFormula;
Declare Function Invalid_Char PeopleCode FUNCLIB_GPJP.GPJP_FUNCTIONS FieldFormula;
Declare Function Check_Comma_Error PeopleCode FUNCLIB_GPJP.GPJP_FUNCTIONS FieldFormula;
Declare Function Check_Space_Error PeopleCode FUNCLIB_GPJP.GPJP_FUNCTIONS FieldFormula;

&HEADER_REC = CreateRecord(Record.GPJP_LA_EN_HD);
&REPORT_TYP = CreateRecord(Record.INSTALLATION);
&TRANSACTION_REC = CreateRecord(Record.GPJP_LA_ENR_DTL);

&Invalid_char1 = MsgGetText(17275, 322, ""); /* Invalid Character */
&Invalid_char2 = MsgGetText(17275, 323, ""); /* is included in this field*/
&Field_empty = MsgGetText(17275, 328, ""); /* The Field is empty */
&Field_Too_Long = MsgGetText(17275, 329, ""); /* The Value is too long */
&Field_Name = MsgGetText(17275, 356, ""); /*_Name(Katana)_ */
&Field_Gender = MsgGetText(17275, 357, ""); /* _Gender_*/
&Field_Birthdate = MsgGetText(17275, 332, ""); /* _BIRTHDATE_*/
&Field_Estab_num = MsgGetText(17275, 358, ""); /* __Establishment Number_*/
&Field_Insured_date = MsgGetText(17275, 359, ""); /* _Insured date_,*/
&Field_Wage = MsgGetText(17275, 360, ""); /* _Wage Payment Mth _ Amt wage_,*/
&Field_Type_Emp = MsgGetText(17275, 361, ""); /* _Type of Employment_,*/
&Field_Job_Type = MsgGetText(17275, 362, ""); /* Job Type */
&Field_Work_Hour = MsgGetText(17275, 363, ""); /* Weekly Fix working Hour */
&Field_Term = MsgGetText(17275, 364, ""); /* Predefined Term of Contract */
&Field_Name_Kanji = MsgGetText(17275, 365, ""); /* _Name _ Kanji   */
&Suffix_1 = MsgGetText(17275, 366, ""); /* _Term of contract suffix 1*/
&Suffix_2 = MsgGetText(17275, 367, ""); /* _Term of contract suffix 2*/

&SRC_FLG_VAL = "LA";

SQLExec("Select FILE_NAME, CHARSET from PS_GPJP_FILE_HANDL Where FILE_HANDLE = :1",
GPJP_LA03_AET.FILE_NAME, &FILE_NAME, &CHARSET);
GPJP_LA03_AET.FILE_NAME = &FILE_NAME;
GPJP_LA03_AET.CHARSET = &CHARSET;

/* SETTING &CHARTYPE = 4 FOR NAME_AC */
&CHARTYPE = "4";
&FILE_NAME = "shutoku" | GPJP_LA03_AET.JOBINSTANCE | ".csv";

&File = GetFile(&FILE_NAME, "W", &CHARSET);
If &File.IsOpen Then
   If &File.SetFileLayout(FILELAYOUT.GPJP_LA_ENROLL) Then
      /*Writer File Header Row*/
      &HEADER_SQL = CreateSQL("%Selectall(:1) Where JOBINSTANCE=:2", &HEADER_REC,
GPJP_LA03_AET.JOBINSTANCE);
      While &HEADER_SQL.Fetch(&HEADER_REC)

         &HEADER_REC.GetField(Field.GPJP_CHRDT_YYMMDD1).Value =
Convert_to_Imperial_date(GPJP_LA03_AET.GPJP_CREATED_DT, 1);
         &LINE = &HEADER_REC.GetField(Field.DESCR).Value | "," |
&HEADER_REC.GetField(Field.GPJP_CHRDT_YYMMDD1).Value;
         &File.WriteLine(&LINE);
      End-While;

      /*Writer Report type*/
      &File.WriteRecord(&REPORT_TYP);

      /*Writer File Transaction Rows*/
      &TRANSACTION_SQL = CreateSQL("%Selectall(:1) Where JOBINSTANCE=:2", &TRANSACTION_REC,
GPJP_LA03_AET.JOBINSTANCE);

      &Row_cnt = 0;

      While &TRANSACTION_SQL.Fetch(&TRANSACTION_REC)
         &Row_cnt = &Row_cnt + 1;

         &TRANSACTION_REC_NAME = Substitute(&TRANSACTION_REC.GetField(Field.NAME).Value,
",", " ");
         &TRANSACTION_REC.GetField(Field.NAME).Value =
Substitute(&TRANSACTION_REC.GetField(Field.NAME).Value, ",", " ");

         /* NAME_AC */
         If None(&TRANSACTION_REC.GetField(Field.NAME_AC).Value) Then

            GPJP_LA03_AET.GPJP_ERR_CNT = GPJP_LA03_AET.GPJP_ERR_CNT + 1;

            Create_Error_Detail_rec(GPJP_LA03_AET.JOBINSTANCE, GPJP_LA03_AET.GPJP_ERR_CNT,
&Row_cnt, &TRANSACTION_REC.GetField(Field.EMPLID).Value,
&TRANSACTION_REC.GetField(Field.EMPL_RCD).Value, 0, &TRANSACTION_REC_NAME, "Newly Enrolled
Employees List", 1, &Field_Name /*_Name(Katana)_ */, &Field_empty); /*(_The Field is empty_)*/

         Else

            &TRANSACTION_REC_ERR_FLG = "NOERR";

            &Check_Space_Error_Flg =
Check_Space_Error(&TRANSACTION_REC.GetField(Field.NAME_AC).Value, 1);

            If &Check_Space_Error_Flg > 0 Then

               For &I = &Check_Space_Error_Flg To
Len(&TRANSACTION_REC.GetField(Field.NAME_AC).Value)

                  If
Check_Space_Error(Substring(&TRANSACTION_REC.GetField(Field.NAME_AC).Value, &I, 1), 2) > 0
Then

                     GPJP_LA03_AET.GPJP_ERR_CNT = GPJP_LA03_AET.GPJP_ERR_CNT + 1;
                     Create_Error_Detail_rec(GPJP_LA03_AET.JOBINSTANCE,
GPJP_LA03_AET.GPJP_ERR_CNT, &Row_cnt, &TRANSACTION_REC.GetField(Field.EMPLID).Value,
&TRANSACTION_REC.GetField(Field.EMPL_RCD).Value, 0, &TRANSACTION_REC_NAME, "Newly Enrolled
Employees List", 1, &Field_Name, """" | &Invalid_char1 | " '" |
Substring(&TRANSACTION_REC.GetField(Field.NAME_AC).Value, &I, 1) | "' " | &Invalid_char2 |
""""); /*Invalid Character _xxx_ is included in this field_)*/

                   End-If;

               End-For;
               &TRANSACTION_REC_ERR_FLG = "ERR";
            End-If;

            If Check_Comma_Error(&TRANSACTION_REC.GetField(Field.NAME_AC).Value,
&SRC_FLG_VAL) Then

                For &I = 1 To Len(&TRANSACTION_REC.GetField(Field.NAME_AC).Value)

                   If
Check_Comma_Error(Substring(&TRANSACTION_REC.GetField(Field.NAME_AC).Value, &I, 1),
&SRC_FLG_VAL) Then
                      GPJP_LA03_AET.GPJP_ERR_CNT = GPJP_LA03_AET.GPJP_ERR_CNT + 1;
                      Create_Error_Detail_rec(GPJP_LA03_AET.JOBINSTANCE,
GPJP_LA03_AET.GPJP_ERR_CNT, &Row_cnt, &TRANSACTION_REC.GetField(Field.EMPLID).Value,
&TRANSACTION_REC.GetField(Field.EMPL_RCD).Value, 0, &TRANSACTION_REC_NAME, "Newly Enrolled
Employees List", 1, &Field_Name, """" | &Invalid_char1 | " '" |
Substring(&TRANSACTION_REC.GetField(Field.NAME_AC).Value, &I, 1) | "' " | &Invalid_char2 |
""""); /*Invalid Character _xxx_ is included in this field_)*/
                   End-If;

               End-For;
               &TRANSACTION_REC_ERR_FLG = "ERR";
            End-If;

            If Invalid_Char(&TRANSACTION_REC.GetField(Field.NAME_AC).Value, &CHARTYPE) Then

                For &I = 1 To Len(&TRANSACTION_REC.GetField(Field.NAME_AC).Value)
                  If
Invalid_Char(Substring(&TRANSACTION_REC.GetField(Field.NAME_AC).Value, &I, 1), &CHARTYPE)
Then
                     GPJP_LA03_AET.GPJP_ERR_CNT = GPJP_LA03_AET.GPJP_ERR_CNT + 1;
                     Create_Error_Detail_rec(GPJP_LA03_AET.JOBINSTANCE,
GPJP_LA03_AET.GPJP_ERR_CNT, &Row_cnt, &TRANSACTION_REC.GetField(Field.EMPLID).Value,
&TRANSACTION_REC.GetField(Field.EMPL_RCD).Value, 0, &TRANSACTION_REC_NAME, "Newly Enrolled
Employees List", 1, &Field_Name, """" | &Invalid_char1 | " '" |
Substring(&TRANSACTION_REC.GetField(Field.NAME_AC).Value, &I, 1) | "' " | &Invalid_char2 |
""""); /*Invalid Character _xxx_ is included in this field_)*/
                  End-If;

              End-For;
              &TRANSACTION_REC_ERR_FLG = "ERR";
           End-If;

            If &TRANSACTION_REC_ERR_FLG = "ERR" Then
               &TRANSACTION_REC.GetField(Field.NAME_AC).Value = " ";
            Else
               &TRANSACTION_REC.GetField(Field.NAME_AC).Value = "4-" |
&TRANSACTION_REC.GetField(Field.NAME_AC).Value;
            End-If;
         End-If;

         /* Gender */
         If None(&TRANSACTION_REC.GetField(Field.SEX).Value) Then
            GPJP_LA03_AET.GPJP_ERR_CNT = GPJP_LA03_AET.GPJP_ERR_CNT + 1;
            Create_Error_Detail_rec(GPJP_LA03_AET.JOBINSTANCE, GPJP_LA03_AET.GPJP_ERR_CNT,
&Row_cnt, &TRANSACTION_REC.GetField(Field.EMPLID).Value,
&TRANSACTION_REC.GetField(Field.EMPL_RCD).Value, 0, &TRANSACTION_REC_NAME, "Newly Enrolled
Employees List", 1, &Field_Gender, &Field_empty);
         End-If;


        If (&TRANSACTION_REC.GetField(Field.SEX).Value = "M") Then
           &TRANSACTION_REC.GetField(Field.GPJP_CHAR3).Value = "6-1";

        Else
           &TRANSACTION_REC.GetField(Field.GPJP_CHAR3).Value = "6-2";

        End-If;

         /* Birthdate    */
         If None(&TRANSACTION_REC.GetField(Field.BIRTHDATE).Value) Then
            GPJP_LA03_AET.GPJP_ERR_CNT = GPJP_LA03_AET.GPJP_ERR_CNT + 1;
            Create_Error_Detail_rec(GPJP_LA03_AET.JOBINSTANCE, GPJP_LA03_AET.GPJP_ERR_CNT,
&Row_cnt, &TRANSACTION_REC.GetField(Field.EMPLID).Value,
&TRANSACTION_REC.GetField(Field.EMPL_RCD).Value, 0, &TRANSACTION_REC_NAME, "Newly Enrolled
Employees List", 1, &Field_Birthdate, &Field_empty);
         Else
            &tempdate =
Convert_to_Imperial_date(&TRANSACTION_REC.GetField(Field.BIRTHDATE).Value, 2);
            &TRANSACTION_REC.GetField(Field.GPJP_DT_YYYYMMDD3).Value = "7-" |
Substring(&tempdate, 1, 1) | "-" | Substring(&tempdate, 2, 6);

        End-If;




         /* Establishment Number */
         If None(GPJP_LA03_AET.GPJP_LA_ESTAB_NO) Then
            GPJP_LA03_AET.GPJP_ERR_CNT = GPJP_LA03_AET.GPJP_ERR_CNT + 1;
            Create_Error_Detail_rec(GPJP_LA03_AET.JOBINSTANCE, GPJP_LA03_AET.GPJP_ERR_CNT,
&Row_cnt, &TRANSACTION_REC.GetField(Field.EMPLID).Value,
&TRANSACTION_REC.GetField(Field.EMPL_RCD).Value, 0, &TRANSACTION_REC_NAME, "Newly Enrolled
Employees List", 1, &Field_Estab_num, &Field_empty);
         Else
            &TRANSACTION_REC.GetField(Field.GPJP_CHAR15).Value = "8-" |
GPJP_LA03_AET.GPJP_LA_ESTAB_NO;
         End-If;

         /*   Insured Date   */

         &TRANSACTION_REC.GetField(Field.GPJP_DT_YYYYMMDD1).Value = "9-" |
Convert_to_Imperial_date(&TRANSACTION_REC.GetField(Field.GPJP_INSURED_DATE).Value, 1);

         /* Enrollment Reason */
         &TRANSACTION_REC.GetField(Field.GPJP_CHAR4_1).Value = "10-" |
&TRANSACTION_REC.GetField(Field.GPJP_LA_ENROLL_RSN).Value;

         /* Wage Payment Mth, Monthly wage */
         If None(&TRANSACTION_REC.GetField(Field.GPJP_LA_MTH_WAGE).Value) Then
            GPJP_LA03_AET.GPJP_ERR_CNT = GPJP_LA03_AET.GPJP_ERR_CNT + 1;
            Create_Error_Detail_rec(GPJP_LA03_AET.JOBINSTANCE, GPJP_LA03_AET.GPJP_ERR_CNT,
&Row_cnt, &TRANSACTION_REC.GetField(Field.EMPLID).Value,
&TRANSACTION_REC.GetField(Field.EMPL_RCD).Value, 0, &TRANSACTION_REC_NAME, "Newly Enrolled
Employees List", 1, &Field_Wage, &Field_empty);
         Else
            &Wage =
String(Integer(Round(&TRANSACTION_REC.GetField(Field.GPJP_LA_MTH_WAGE).Value / 1000, 8)));
/* convert to Char */
            If &TRANSACTION_REC.GetField(Field.GPJP_LA_MTH_WAGE).Value >= 10000000 Then
               &TRANSACTION_REC.GetField(Field.GPJP_CHAR9).Value = "11-" |
&TRANSACTION_REC.GetField(Field.GPJP_CHAR9).Value | "-9999";
            Else

               &TRANSACTION_REC.GetField(Field.GPJP_CHAR9).Value = "11-" |
&TRANSACTION_REC.GetField(Field.GPJP_CHAR9).Value | "-" | &Wage;
            End-If;
         End-If;

         /*   Type of Employment   */

         If None(&TRANSACTION_REC.GetField(Field.GPJP_LA_EMPL_TYP).Value) Then
            GPJP_LA03_AET.GPJP_ERR_CNT = GPJP_LA03_AET.GPJP_ERR_CNT + 1;
            Create_Error_Detail_rec(GPJP_LA03_AET.JOBINSTANCE, GPJP_LA03_AET.GPJP_ERR_CNT,
&Row_cnt, &TRANSACTION_REC.GetField(Field.EMPLID).Value,
&TRANSACTION_REC.GetField(Field.EMPL_RCD).Value, 0, &TRANSACTION_REC_NAME, "Newly Enrolled
Employees List", 1, &Field_Type_Emp, &Field_empty);
         Else
            If &TRANSACTION_REC.GetField(Field.GPJP_INSURED_DATE).Value < Date(20090401) Or
                  /* Daily Laborer */
                  &TRANSACTION_REC.GetField(Field.GPJP_LA_EMPL_TYP).Value = "1" Then
               &TRANSACTION_REC.GetField(Field.GPJP_CHAR4_2).Value = "12-" |
&TRANSACTION_REC.GetField(Field.GPJP_LA_EMPL_TYP).Value;
            Else
               /* Other */
               If &TRANSACTION_REC.GetField(Field.GPJP_LA_EMPL_TYP).Value = "4" Then
                  &TRANSACTION_REC.GetField(Field.GPJP_CHAR4_2).Value = "12-7"
               Else
                  /* Part Time Laborer */
                  If &TRANSACTION_REC.GetField(Field.GPJP_LA_EMPL_TYP).Value = "2" Then
                     &TRANSACTION_REC.GetField(Field.GPJP_CHAR4_2).Value = "12-3"
                  Else
                     /* Seasonal Employment */
                     If &TRANSACTION_REC.GetField(Field.GPJP_LA_EMPL_TYP).Value = "3" Then
                        &TRANSACTION_REC.GetField(Field.GPJP_CHAR4_2).Value = "12-5"
                     Else
                        /* Dispatched Laborer */
                        If &TRANSACTION_REC.GetField(Field.GPJP_LA_EMPL_TYP).Value = "5"
Then
                           &TRANSACTION_REC.GetField(Field.GPJP_CHAR4_2).Value = "12-2"
                           /* Laborer with Predefined Term of Contract */
                        Else
                           &TRANSACTION_REC.GetField(Field.GPJP_CHAR4_2).Value = "12-4"
                        End-If;
                     End-If;
                  End-If;
               End-If;
            End-If;
         End-If;

         /*   Job Type    */
         If None(&TRANSACTION_REC.GetField(Field.GPJP_LA_JOB_TYP).Value) Then
            GPJP_LA03_AET.GPJP_ERR_CNT = GPJP_LA03_AET.GPJP_ERR_CNT + 1;
            Create_Error_Detail_rec(GPJP_LA03_AET.JOBINSTANCE, GPJP_LA03_AET.GPJP_ERR_CNT,
&Row_cnt, &TRANSACTION_REC.GetField(Field.EMPLID).Value,
&TRANSACTION_REC.GetField(Field.EMPL_RCD).Value, 0, &TRANSACTION_REC_NAME, "Newly Enrolled
Employees List", 1, &Field_Job_Type, &Field_empty); /*__The Field is empty_)*/
         Else
            &TRANSACTION_REC.GetField(Field.GPJP_CHAR4_3).Value = "13-" |
&TRANSACTION_REC.GetField(Field.GPJP_LA_JOB_TYP).Value;
         End-If;

         /*   Weekly Fix working Hour    */
         If None(&TRANSACTION_REC.GetField(Field.STD_HOURS).Value) Then
            GPJP_LA03_AET.GPJP_ERR_CNT = GPJP_LA03_AET.GPJP_ERR_CNT + 1;
            Create_Error_Detail_rec(GPJP_LA03_AET.JOBINSTANCE, GPJP_LA03_AET.GPJP_ERR_CNT,
&Row_cnt, &TRANSACTION_REC.GetField(Field.EMPLID).Value,
&TRANSACTION_REC.GetField(Field.EMPL_RCD).Value, 0, &TRANSACTION_REC_NAME, "Newly Enrolled
Employees List", 1, &Field_Work_Hour, &Field_empty); /*__The Field is empty_)*/
         Else
            &STD_HRS_STRING = String(&TRANSACTION_REC.GetField(Field.STD_HOURS).Value);
            If Find(".", &STD_HRS_STRING) <> 0 Then
               &Hours = Substring(&STD_HRS_STRING, 1, (Find(".", &STD_HRS_STRING) - 1));
               &Minutes = Substring(&STD_HRS_STRING, (Find(".", &STD_HRS_STRING) + 1),
Len(&STD_HRS_STRING));
            Else
               &Hours = &STD_HRS_STRING;
               &Minutes = "00";
            End-If;

            &TRANSACTION_REC.GetField(Field.GPJP_CHAR7).Value = "16-" | &Hours | &Minutes;
         End-If;

         /*   Dates dates, prefix and suffix Term of Contract */
         If None(&TRANSACTION_REC.GetField(Field.GPJP_START_DATE).Value) Or
               None(&TRANSACTION_REC.GetField(Field.GPJP_END_DATE).Value) Or
               None(&TRANSACTION_REC.GetField(Field.GPJP_LA_TRM_CONTR).Value) Then
            GPJP_LA03_AET.GPJP_ERR_CNT = GPJP_LA03_AET.GPJP_ERR_CNT + 1;
            Create_Error_Detail_rec(GPJP_LA03_AET.JOBINSTANCE, GPJP_LA03_AET.GPJP_ERR_CNT,
&Row_cnt, &TRANSACTION_REC.GetField(Field.EMPLID).Value,
&TRANSACTION_REC.GetField(Field.EMPL_RCD).Value, 0, &TRANSACTION_REC_NAME, "Newly Enrolled
Employees List", 1, &Field_Term, &Field_empty); /*__The Field is empty_)*/
         Else
            &Startdate =
Convert_to_Imperial_date(&TRANSACTION_REC.GetField(Field.GPJP_START_DATE).Value, 1);
            &Enddate =
Convert_to_Imperial_date(&TRANSACTION_REC.GetField(Field.GPJP_END_DATE).Value, 1);
         End-If;




         /* No contract term specified */
         If &TRANSACTION_REC.GetField(Field.GPJP_LA_TRM_CONTR).Value = "22" Then
            &TRANSACTION_REC.GetField(Field.GPJP_CHAR22).Value = "17-" | "2"
            &TRANSACTION_REC.GetField(Field.GPJP_CHAR30).Value = "17-" | "2"
         Else
            /* Contract term specified with renewal condition, expected service years >= 1
*/
            If &TRANSACTION_REC.GetField(Field.GPJP_LA_TRM_CONTR).Value = "12" Then
               &TRANSACTION_REC.GetField(Field.GPJP_CHAR22).Value = "17-" | "1-" |
&Startdate | "-" | &Enddate | "-" | &Suffix_1 | "-" | &Suffix_1;
               &TRANSACTION_REC.GetField(Field.GPJP_CHAR30).Value = "17-" | "1-" |
&Startdate | "-" | &Enddate | "-" | &Suffix_1 | "-" | &Suffix_1 | "-" | &Suffix_1;
            Else
               /* Contract term specified with renewal condition, expected service years <
1 */
               /* Contract term specified with renewal condition, 0.5 <= expected service years
< 1 */
               If &TRANSACTION_REC.GetField(Field.GPJP_LA_TRM_CONTR).Value = "13" Then
                  &TRANSACTION_REC.GetField(Field.GPJP_CHAR22).Value = "17-" | "1-" |
&Startdate | "-" | &Enddate | "-" | &Suffix_1 | "-" | &Suffix_2;
                  &TRANSACTION_REC.GetField(Field.GPJP_CHAR30).Value = "17-" | "1-" |
&Startdate | "-" | &Enddate | "-" | &Suffix_1 | "-" | &Suffix_1 | "-" | &Suffix_2;
               Else
                  /* Contract term specified without renewal condition, expected service years
>= 1 */
                  If &TRANSACTION_REC.GetField(Field.GPJP_LA_TRM_CONTR).Value = "14" Then
                     &TRANSACTION_REC.GetField(Field.GPJP_CHAR22).Value = "17-" | "1-" |
&Startdate | "-" | &Enddate | "-" | &Suffix_2 | "-" | &Suffix_1;
                     &TRANSACTION_REC.GetField(Field.GPJP_CHAR30).Value = "17-" | "1-" |
&Startdate | "-" | &Enddate | "-" | &Suffix_2 | "-" | &Suffix_1 | "-" | &Suffix_1;
                  Else
                     /* Contract term specified without renewal condition, expected service
years < 1 */
                     /* Contract term specified without renewal condition, 0.5 <= expected
service years < 1 */
                     If &TRANSACTION_REC.GetField(Field.GPJP_LA_TRM_CONTR).Value = "15"
Then
                        &TRANSACTION_REC.GetField(Field.GPJP_CHAR22).Value = "17-" | "1-" |
&Startdate | "-" | &Enddate | "-" | &Suffix_2 | "-" | &Suffix_2;
                        &TRANSACTION_REC.GetField(Field.GPJP_CHAR30).Value = "17-" | "1-" |
&Startdate | "-" | &Enddate | "-" | &Suffix_2 | "-" | &Suffix_1 | "-" | &Suffix_2;
                     Else
                        /* Contract term specified without renewal condition, expected
service years < 0.5 */
                        If &TRANSACTION_REC.GetField(Field.GPJP_LA_TRM_CONTR).Value = "16"
Then
                           &TRANSACTION_REC.GetField(Field.GPJP_CHAR30).Value = "17-" |
"1-" | &Startdate | "-" | &Enddate | "-" | &Suffix_2 | "-" | &Suffix_2;
                        Else
                           /* Contract term specified with renewal condition, expected
service years < 0.5 */
                           If &TRANSACTION_REC.GetField(Field.GPJP_LA_TRM_CONTR).Value =
"17" Then
                               &TRANSACTION_REC.GetField(Field.GPJP_CHAR30).Value = "17-" |
"1-" | &Startdate | "-" | &Enddate | "-" | &Suffix_1 | "-" | &Suffix_2;
                           End-If;
                        End-If;
                     End-If;
                  End-If;
               End-If;
            End-If;
         End-If;


         /*   Name _ Kanji   */
         If Len(&TRANSACTION_REC_NAME) > 12 Then

            GPJP_LA03_AET.GPJP_ERR_CNT = GPJP_LA03_AET.GPJP_ERR_CNT + 1;

            Create_Error_Detail_rec(GPJP_LA03_AET.PROCESS_INSTANCE,
GPJP_LA03_AET.GPJP_ERR_CNT, &Row_cnt, &TRANSACTION_REC.GetField(Field.EMPLID).Value,
&TRANSACTION_REC.GetField(Field.EMPL_RCD).Value, 0, &TRANSACTION_REC_NAME, "Newly Enrolled
Employees List", 1, &Field_Name_Kanji, &Field_Too_Long); /* FIELD VALUE TOO LONG */

            &TRANSACTION_REC.GetField(Field.NAME).Value = " ";

         Else

            &TRANSACTION_REC_ERR_FLG = "NOERR";

            &Check_Space_Error_Flg =
Check_Space_Error(&TRANSACTION_REC.GetField(Field.NAME).Value, 1);

            If &Check_Space_Error_Flg > 0 Then

               For &I = &Check_Space_Error_Flg To
Len(&TRANSACTION_REC.GetField(Field.NAME).Value)
                        If
      Check_Space_Error(Substring(&TRANSACTION_REC.GetField(Field.NAME).Value, &I, 1), 2) > 0 Then

                           GPJP_LA03_AET.GPJP_ERR_CNT = GPJP_LA03_AET.GPJP_ERR_CNT + 1;
                           Create_Error_Detail_rec(GPJP_LA03_AET.PROCESS_INSTANCE,
      GPJP_LA03_AET.GPJP_ERR_CNT, &Row_cnt, &TRANSACTION_REC.GetField(Field.EMPLID).Value,
      &TRANSACTION_REC.GetField(Field.EMPL_RCD).Value, 0, &TRANSACTION_REC_NAME, "Newly Enrolled
      Employees List", 1, &Field_Name_Kanji, """" | &Invalid_char1 | " '" |
      Substring(&TRANSACTION_REC.GetField(Field.NAME).Value, &I, 1) | "' " | &Invalid_char2 | """");
      /* Invalid Character _xxx_ is included in this field_)*/

                        End-If;
                     End-For;
                     &TRANSACTION_REC_ERR_FLG = "ERR";
                  End-If;

                  If Check_Comma_Error(&TRANSACTION_REC.GetField(Field.NAME).Value,
      &SRC_FLG_VAL) Then

                     For &I = 1 To Len(&TRANSACTION_REC.GetField(Field.NAME).Value)
                         If
      Check_Comma_Error(Substring(&TRANSACTION_REC.GetField(Field.NAME).Value, &I, 1),
      &SRC_FLG_VAL) Then
                            GPJP_LA03_AET.GPJP_ERR_CNT = GPJP_LA03_AET.GPJP_ERR_CNT + 1;
                            Create_Error_Detail_rec(GPJP_LA03_AET.PROCESS_INSTANCE,
      GPJP_LA03_AET.GPJP_ERR_CNT, &Row_cnt, &TRANSACTION_REC.GetField(Field.EMPLID).Value,
      &TRANSACTION_REC.GetField(Field.EMPL_RCD).Value, 0, &TRANSACTION_REC_NAME, "Newly Enrolled
      Employees List", 1, &Field_Name_Kanji, """" | &Invalid_char1 | " '" |
      Substring(&TRANSACTION_REC.GetField(Field.NAME).Value, &I, 1) | "' " | &Invalid_char2 | """");
      /* Invalid Character _xxx_ is included in this field_)*/
                         End-If;
                     End-For;
                     &TRANSACTION_REC_ERR_FLG = "ERR";
                  End-If;

                  If &TRANSACTION_REC_ERR_FLG = "ERR" Then
                     &TRANSACTION_REC.GetField(Field.NAME).Value = " ";
                  Else
                     &TRANSACTION_REC.GetField(Field.NAME).Value = "30-" |
      &TRANSACTION_REC.GetField(Field.NAME).Value;
                  End-If;
               End-If;

               &File.WriteRecord(&TRANSACTION_REC);

            End-While;


         Else
            GPJP_LA03_AET.ERROR_TYPE = "1"; /*Error Accessing FileLayout*/
         End-If;
      Else
         GPJP_LA03_AET.ERROR_TYPE = "2"; /*Error Writing to File*/
      End-If;

      &File.Close();

      GPJP_LA03_AET.GPJP_FILE_NAME = &FILE_NAME; /*This will be reported in Summary Log file*/
      SQLExec("SELECT COUNT(*) FROM PS_GPJP_LA_ERR_DTL WHERE JOBINSTANCE = :1",
      GPJP_LA03_AET.JOBINSTANCE, &ERR_COUNT); /*This will be reported in Summary Log file*/
      GPJP_LA03_AET.GPJP_ERR_CNT = &ERR_COUNT; /*This will be reported in Summary log File*/




PeopleCode (ApplEng): GPUS_CTX_EFT.GEN-FILEGBLdefault 1900-01-01.Step01.OnExecute
      [ . . . Unchanged Code not Shown . . . ]
/***************************************************/
/* Create Records for CTX File Format              */
/***************************************************/
&SRCBANK_REC = CreateRecord(Record.GPUS_EFT_SBNK);
&COMPANY_REC = CreateRecord(Record.GPUS_EFT_COMPNY);
&RCPT_REC = CreateRecord(Record.GPUS_EFT_RCPT);
&TYPE_1_REC = CreateRecord(Record.GPUS_EFT_1REC);
&TYPE_5_REC = CreateRecord(Record.GPUS_EFT_5REC);
&TYPE_6_REC = CreateRecord(Record.GPUS_EFT_6REC);
&TYPE_7_REC = CreateRecord(Record.GPUS_EFT_7REC);
&TYPE_8_REC = CreateRecord(Record.GPUS_EFT_8REC);
&TYPE_9_REC = CreateRecord(Record.GPUS_EFT_9REC);
&DETAIL_REC = CreateRecord(Record.GPUS_EFT_DTL);
&FILLER_REC = CreateRecord(Record.GPUS_EFT_FILR);

/***************************************************/
/* New SQLs for GPUS EFT File Format               */
/***************************************************/
&DETAIL_SQL = CreateSQL("%Selectall(:1) WHERE PROCESS_INSTANCE=:2", &DETAIL_REC,
GPUS_CTX_AET.PROCESS_INSTANCE.Value);
&SRCBANK_SQL = CreateSQL("%Selectall(:1) WHERE PROCESS_INSTANCE=:2", &SRCBANK_REC,
GPUS_CTX_AET.PROCESS_INSTANCE.Value);

/***************************************************/
/* Get System Date in YYMMDD Format                */
/***************************************************/
&FileCreationDate = DateToYYMMDD(%Date, 2);
&Date8 = DateToYYMMDD(%Date, 4);

/***************************************************/
/* Get System Time in HH:MM Format                 */
/***************************************************/
&FileCreationTime = LTrim(RTrim(String(Time(%Time))));
&HH = Substring(&FileCreationTime, 1, 2);
&MM = Substring(&FileCreationTime, 4, 2);
&FileCreationTime = &HH | &MM;

/***************************************************/
/* Initialize control parameters for CTX File      */
/***************************************************/
rem &EIGHTY_ZERO =
"00000000000000000000000000000000000000000000000000000000000000000000000000000000";
rem &NINETYFOUR_NINE =
"9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
999999";

&EIGHTY_ZERO = Rept("0", 80);
&NINETYFOUR_NINE = Rept("9", 94);

&DataExist = "N";

&FILLER_REC.GPUS_FILLER_94.Value = &NINETYFOUR_NINE;
&FileCounter = 0;
&deposit_amt_file = 0;
&entry_dtl_count_9rec = 0;
&batch_count = 0;
&num_of_blocks = 0;

/************************************************************************/
/* Loop Through Header Record. Each individual Header entry creates a   */
/* separate file in the format of CTX999.TXT (999 is from 001)          */
/************************************************************************/
While &SRCBANK_SQL.Fetch(&SRCBANK_REC)

  &DataExist = "Y";
  &FileCounter = &FileCounter + 1;
  &TYPE_1_REC.GPUS_EFT_CREATE_DT.Value = &FileCreationDate;
  &TYPE_1_REC.GPUS_EFT_CREATE_TM.Value = &FileCreationTime;
  /*******************************************/
  /* Get Source Bank ID and Source Bank Name */
  /*******************************************/
   SQLExec("Select BANK_CD, BANK_NM from PS_GPUS_SRCBANK_VW where SRC_BANK_ID = :1",
&SRCBANK_REC.SRC_BANK_ID.Value, &Src_Bank_CD, &Src_Bank_Name);
   &TYPE_1_REC.GPUS_BANK_CD.Value = &Src_Bank_CD;
   &TYPE_1_REC.GPUS_DEST_BANK_NM.Value = Upper(&Src_Bank_Name);
   /*******************************************/
   /* Get Company Header Info from Run Control*/
   /*******************************************/
   SQLExec("Select DESCR from PS_COMPANY_TBL where COMPANY = :1", GPUS_CTX_AET.COMPANY.Value,
&Company_Name);
   &TYPE_1_REC.GPUS_ORIGIN_NAME.Value = Upper(&Company_Name);
   &TYPE_1_REC.FEDERAL_EIN.Value = GPUS_CTX_AET.FEDERAL_EIN.Value;
   /*******************************************/
   /* Construct File Name format CTX999         */
   /*******************************************/
   Evaluate &FileCounter
   When < 10
      &EFT_FILE_NAME = "CTX" | "00" | &FileCounter | ".TXT";
      Break;
   When < 100
      &EFT_FILE_NAME = "CTX" | "0" | &FileCounter | ".TXT";
      Break;
   When-Other
      &EFT_FILE_NAME = "CTX" | &FileCounter | ".TXT";
   End-Evaluate;

   &File = GetFile(&EFT_FILE_NAME, "W");
   /*******************************************/
   /* Open File CTX999 for Writing            */
   /*******************************************/
   If &File.IsOpen Then
      If GPUS_CTX_AET.EFT_NAME.Value = "CTX" Then
         If &File.SetFileLayout(FILELAYOUT.GPUS_EFT_CTX) Then

            &deposit_amt_batch = 0;
            &file_entry_hash = 0;
            &company_batch = 0;
            &block_count = 0;
            /*******************************************/
            /* Writing Out File Header Record          */
            /*******************************************/
            &File.WriteRecord(&TYPE_1_REC);
            &block_count = &block_count + 1;
            If Mod(&block_count, 10) = 0 Then
               &num_of_blocks = &num_of_blocks + 1;
            End-If;

            /*******************************************/
            /* Processing Company Header Record         */
            /*******************************************/
            /* Find all companies with this SRC_BANK_ID and put them into GPUS_EFT_COMPNY */
            &clean_sql = "DELETE FROM %Table(GPUS_EFT_COMPNY) ";
            &clean_sql = &clean_sql | " WHERE PROCESS_INSTANCE = " |
GPUS_CTX_AET.PROCESS_INSTANCE.Value;
            SQLExec(&clean_sql);

            Local string &com_sql;
            &com_sql = "INSERT INTO %Table(GPUS_EFT_COMPNY)( PROCESS_INSTANCE, COMPANY_DESCR
) ";
            &com_sql = &com_sql | " SELECT DISTINCT A.PROCESS_INSTANCE, A.COMPANY_DESCR ";
            &com_sql = "INSERT INTO %Table(GPUS_EFT_COMPNY)( PROCESS_INSTANCE, COMPANY ) ";
            &com_sql = &com_sql | " SELECT DISTINCT A.PROCESS_INSTANCE, A.COMPANY ";
            &com_sql = &com_sql | " FROM %Table(GPUS_EFT_DTL) A ";
            &com_sql = &com_sql | " WHERE A.PROCESS_INSTANCE = " |
GPUS_CTX_AET.PROCESS_INSTANCE.Value;
            &com_sql = &com_sql | " AND A.SRC_BANK_ID = '" | &SRCBANK_REC.SRC_BANK_ID.Value
| "'";
            SQLExec(&com_sql);

            &COMPANY_SQL = CreateSQL("%Selectall(:1) WHERE PROCESS_INSTANCE=:2",
&COMPANY_REC, GPUS_CTX_AET.PROCESS_INSTANCE.Value);
            While &COMPANY_SQL.Fetch(&COMPANY_REC)

               &company_batch = &company_batch + 1;
               Local string &FEIN, &SrcBankCD, &SrcBankAcct, &Company_nm;
               Local date &PayEndDate, &CheckDate;
               Local number &TransSetCtrlNbr;

               SQLExec("Select DISTINCT FEDERAL_EIN, %DateOut(PAY_END_DT),
%DateOut(CHECK_DT), GPUS_BANK_CD, ACCOUNT_EC_ID from %Table(GPUS_EFT_DTL) where
COMPANY_DESCR = :1 AND SRC_BANK_ID = :2", &COMPANY_REC.COMPANY_DESCR.Value,
&SRCBANK_REC.SRC_BANK_ID.Value, &FEIN, &PayEndDate, &CheckDate, &SrcBankCD, &SrcBankAcct);
               SQLExec("Select DISTINCT FEDERAL_EIN, %DateOut(PAY_END_DT),
%DateOut(CHECK_DT), GPUS_BANK_CD, ACCOUNT_EC_ID from %Table(GPUS_EFT_DTL) where COMPANY = :1
AND SRC_BANK_ID = :2", &COMPANY_REC.COMPANY.Value, &SRCBANK_REC.SRC_BANK_ID.Value, &FEIN,
&PayEndDate, &CheckDate, &SrcBankCD, &SrcBankAcct);

               &Company_nm = Upper(Substring(&COMPANY_REC.COMPANY_DESCR.Value, 1, 16));
               SQLExec("Select DESCR from PS_COMPANY_TBL where COMPANY = :1",
&COMPANY_REC.COMPANY.Value, &Company_Name);

               &Company_nm = Upper(Substring(&Company_Name, 1, 16));
               &Payment_DT6 = DateToYYMMDD(Date(&CheckDate), 2);
               &Payment_DT8 = DateToYYMMDD(Date(&CheckDate), 4);
               &TYPE_5_REC.GPUS_BATCH_NBR.Value = Left_Zero(&company_batch, 7);
               REM &TYPE_5_REC.GPUS_BATCH_NBR.Value = Left_Zero(&company_batch, 7);
               &TYPE_5_REC.GPUS_BATCH_NBR.Value = Right(Rept("0", 7) | &company_batch, 7);
               &TYPE_5_REC.GPUS_COMPANY_NM.Value = &Company_nm;
               &TYPE_5_REC.FEDERAL_EIN.Value = &FEIN;
               &TYPE_5_REC.GPUS_PAY_END_DT.Value = DateToYYMMDD(Date(&PayEndDate), 2);
               &TYPE_5_REC.GPUS_CHECK_DT.Value = &Payment_DT6;
               &TYPE_5_REC.GPUS_SETTLE_DT.Value = "000";
               &TYPE_5_REC.GPUS_ORIGIN_DFI_ID.Value = &SrcBankCD;
               /*******************************************************/
               /* Write Company Header Record (5 type record)         */
               /*******************************************************/
               &File.WriteRecord(&TYPE_5_REC);
               &block_count = &block_count + 1;
               If Mod(&block_count, 10) = 0 Then
                  &num_of_blocks = &num_of_blocks + 1;
               End-If;

               /*******************************************************/
               /* Populate Entry Detail Record from GPUS_EFT_DTL      */
               /*******************************************************/
               &clean_sql = "DELETE FROM %Table(GPUS_EFT_RCPT) ";
               &clean_sql = &clean_sql | " WHERE PROCESS_INSTANCE = " |
GPUS_CTX_AET.PROCESS_INSTANCE.Value;
               SQLExec(&clean_sql);

               Local string &rcp_sql;
               &rcp_sql = "INSERT INTO %Table(GPUS_EFT_RCPT)( PROCESS_INSTANCE,
RECIPIENT_ID, RECIPIENT_NAME ) ";
               &rcp_sql = &rcp_sql | " SELECT DISTINCT A.PROCESS_INSTANCE, A.RECIPIENT_ID,
A.RECIPIENT_NAME ";
               &rcp_sql = &rcp_sql | " FROM %Table(GPUS_EFT_DTL) A ";
               &rcp_sql = &rcp_sql | " WHERE A.PROCESS_INSTANCE = " |
GPUS_CTX_AET.PROCESS_INSTANCE.Value;
               &rcp_sql = &rcp_sql | " AND A.SRC_BANK_ID = '" | &SRCBANK_REC.SRC_BANK_ID.Value
| "'";
               &rcp_sql = &rcp_sql | " AND A.COMPANY_DESCR = '" |
&COMPANY_REC.COMPANY_DESCR.Value | "'";
               &rcp_sql = &rcp_sql | " AND A.COMPANY = '" | &COMPANY_REC.COMPANY.Value | "'";
               SQLExec(&rcp_sql);
               &RCPT_SQL = CreateSQL("%Selectall(:1) WHERE PROCESS_INSTANCE=:2", &RCPT_REC,
GPUS_CTX_AET.PROCESS_INSTANCE.Value);

               /***********************************/
               &detail_trace_nbr = 0;
               &batch_entry_hash = 0;
               &entry_dtl_count_8rec = 0;
               &TransSetCtrlNbr = 0;
               While &RCPT_SQL.Fetch(&RCPT_REC)

                   Local string &RCPTBankCD, &RCPTBankCheckDigit, &RCPTBankAcctNbr,
&RCPTCompanyName, &Grn_State, &GPUSTRACENBR;
                   Local number &RCPTPmtAmount;
                   SQLExec("Select DISTINCT
%Substring(GPUS_PYEBANK_CD,1,8),%Substring(GPUS_PYEBANK_CD,9,1),GPUS_PYEACCT_ID,
%Substring(GPUS_PYEACCT_NM,1,16), %Substring(GPUS_BANK_CD,1,8), GPUS_STATE from
%Table(GPUS_EFT_DTL) where PROCESS_INSTANCE = :1 AND SRC_BANK_ID = :2 AND COMPANY_DESCR = :3
AND RECIPIENT_ID = :4", GPUS_CTX_AET.PROCESS_INSTANCE.Value, &SRCBANK_REC.SRC_BANK_ID.Value,
&COMPANY_REC.COMPANY_DESCR.Value, &RCPT_REC.RECIPIENT_ID.Value, &RCPTBankCD,
&RCPTBankCheckDigit, &RCPTBankAcctNbr, &RCPTCompanyName, &GPUSTRACENBR, &Grn_State);
                   SQLExec("Select %DecDiv(%DecMult((SUM(GP_PMT_AMT)),1000000),10000) from
%Table(GPUS_EFT_DTL) where PROCESS_INSTANCE = :1 AND SRC_BANK_ID = :2 AND COMPANY_DESCR = :3
AND RECIPIENT_ID = :4 GROUP BY RECIPIENT_ID", GPUS_CTX_AET.PROCESS_INSTANCE.Value,
&SRCBANK_REC.SRC_BANK_ID.Value, &COMPANY_REC.COMPANY_DESCR.Value,
&RCPT_REC.RECIPIENT_ID.Value, &RCPTPmtAmount);
                   SQLExec("Select DISTINCT
%Substring(GPUS_PYEBANK_CD,1,8),%Substring(GPUS_PYEBANK_CD,9,1),GPUS_PYEACCT_ID,
%Substring(GPUS_PYEACCT_NM,1,16), %Substring(GPUS_BANK_CD,1,8), GPUS_STATE from
%Table(GPUS_EFT_DTL) where PROCESS_INSTANCE = :1 AND SRC_BANK_ID = :2 AND COMPANY = :3 AND
RECIPIENT_ID = :4", GPUS_CTX_AET.PROCESS_INSTANCE.Value, &SRCBANK_REC.SRC_BANK_ID.Value,
&COMPANY_REC.COMPANY.Value, &RCPT_REC.RECIPIENT_ID.Value, &RCPTBankCD, &RCPTBankCheckDigit,
&RCPTBankAcctNbr, &RCPTCompanyName, &GPUSTRACENBR, &Grn_State);
                   SQLExec("Select %DecDiv(%DecMult((SUM(GP_PMT_AMT)),1000000),10000) from
%Table(GPUS_EFT_DTL) where PROCESS_INSTANCE = :1 AND SRC_BANK_ID = :2 AND COMPANY = :3 AND
RECIPIENT_ID = :4 GROUP BY RECIPIENT_ID", GPUS_CTX_AET.PROCESS_INSTANCE.Value,
&SRCBANK_REC.SRC_BANK_ID.Value, &COMPANY_REC.COMPANY.Value, &RCPT_REC.RECIPIENT_ID.Value,
&RCPTPmtAmount);

                  &detail_trace_nbr = &detail_trace_nbr + 1;
                  &entry_dtl_count_8rec = &entry_dtl_count_8rec + 1;
                  &entry_dtl_count_9rec = &entry_dtl_count_9rec + 1;
                  &TransSetCtrlNbr = &TransSetCtrlNbr + 1;
                  /*******************************************************/
                  /* Preparing the 6 Type Record for Recipient           */
                  /*                                                     */
                  /* TRANS_CD = "22" (for DDA Automatic Credit Account) */
                  /* TRANS_CD = "27" (for DDA Automatic Debit Account)   */
                  /* "27" will be used for Offset Record                 */
                  /*******************************************************/
                  &TYPE_6_REC.GPUS_COMPANY_NM.Value = Upper(&RCPTCompanyName);
                  &TYPE_6_REC.GPUS_TRANS_CD.Value = "22"; /* Garnishment Recipient SDU */
                  &TYPE_6_REC.GPUS_PMT_AMT.Value = Left_Zero(&RCPTPmtAmount, 10);
                  &TYPE_6_REC.GPUS_PAYEE_ID.Value = &RCPT_REC.RECIPIENT_ID.Value;
                  &TYPE_6_REC.GPUS_RCV_DFI_ID.Value = &RCPTBankCD;
                  &TYPE_6_REC.GPUS_CHECK_DIGIT.Value = &RCPTBankCheckDigit;
                  &TYPE_6_REC.ACCOUNT_NUM.Value = &RCPTBankAcctNbr;
                  &TYPE_6_REC.GPUS_TRACE_NBR.Value = &GPUSTRACENBR |
Left_Zero(&detail_trace_nbr, 7);

                  &block_count = &block_count + 1;
                  If Mod(&block_count, 10) = 0 Then
                     &num_of_blocks = &num_of_blocks + 1;
                  End-If;

                  &deposit_amt_batch = &deposit_amt_batch +
Int(&TYPE_6_REC.GPUS_PMT_AMT.Value);
                  &deposit_amt_file = &deposit_amt_file +
Int(&TYPE_6_REC.GPUS_PMT_AMT.Value);
                  If IsNumber(&TYPE_6_REC.GPUS_RCV_DFI_ID.Value) Then
                     &batch_entry_hash = &batch_entry_hash +
Int(&TYPE_6_REC.GPUS_RCV_DFI_ID.Value);
                     &file_entry_hash = &file_entry_hash +
Int(&TYPE_6_REC.GPUS_RCV_DFI_ID.Value);
                  Else
                     MessageBox(0, " ", 0, 0, "*** Warning *** Error BANK_CD for US Bank :
" | &TYPE_6_REC.GPUS_RCV_DFI_ID.Value);
                  End-If;
                  /*****************************************************/
                  /* START PROCESSING ADDENDA RECORD                   */
                  /*****************************************************/
                  Local number &Addenda_Seq, &DEDSegCnt, &NumofAddenda, &d;
                  Local string &Payment_amt7, &ReceiverID, &ReceiverName, &NID, &FIPS,
&CASEID, &FamilySuppInd, &DEDName, &EmplStatus;
                  Local array of string &CTX820Array = CreateArray("");

                    &DEDSegStr = "";
                    &DEDSegCnt = 0;
                    &Addenda_Seq = 0;

                    &ReceiverID = GetReceiverID(&Grn_State);
                    &ReceiverName = &RCPT_REC.RECIPIENT_NAME.Value;
                    /*&ReceiverName = GetReceiverName(&Grn_State);*/

                   &ISASegStr = "ISA*00*" | "             " | "*00*" | "            " | "*ZZ*" |
"000000000000000" | "*ZZ*" | Right_Space(&ReceiverID, 15) | "*" | &FileCreationDate | "*" |
&FileCreationTime | "*U*00401*" | "000000000*0*P*>\";
                   REM &ISASegStr = "ISA*00*" | "            " | "*00*" | "           " | "*ZZ*"
| "000000000000000" | "*ZZ*" | Right_Space(&ReceiverID, 15) | "*" | &FileCreationDate | "*"
| &FileCreationTime | "*U*00401*" | "000000000*0*P*>\";
                   &ISASegStr = "ISA*00*" | "             " | "*00*" | "            " | "*ZZ*" |
"000000000000000" | "*ZZ*" | Left(&ReceiverID | Rept(" ", 16), 16) | "*" | &FileCreationDate
| "*" | &FileCreationTime | "*U*00401*" | "000000000*0*P*>\";
                   &GSSegStr = "GS*RA*1" | &FEIN | "*" | &ReceiverName | "*" | &Date8 | "*"
| &FileCreationTime | "*0*X*004010\";
                   &STSegStr = "ST*820*" | &TransSetCtrlNbr | "\";
                   &BPRSegStr = "BPR*C*" | &RCPTPmtAmount | "*" | "C*ACH*CTX*01*" | &SrcBankCD
| "*DA*" | &SrcBankAcct | "*01*" | &RCPTBankCD | &RCPTBankCheckDigit | "*DA*" | &RCPTBankAcctNbr
| "*" | &Payment_DT8 | "*PCS\";

                  &CTX_7_SQL = CreateSQL("%Selectall(:1) WHERE PROCESS_INSTANCE = :2 AND
SRC_BANK_ID = :3 AND COMPANY_DESCR = :4 AND RECIPIENT_ID = :5", &DETAIL_REC,
GPUS_CTX_AET.PROCESS_INSTANCE.Value, &SRCBANK_REC.SRC_BANK_ID.Value,
&COMPANY_REC.COMPANY_DESCR.Value, &RCPT_REC.RECIPIENT_ID.Value);
                  &CTX_7_SQL = CreateSQL("%Selectall(:1) WHERE PROCESS_INSTANCE = :2 AND
SRC_BANK_ID = :3 AND COMPANY = :4 AND RECIPIENT_ID = :5", &DETAIL_REC,
GPUS_CTX_AET.PROCESS_INSTANCE.Value, &SRCBANK_REC.SRC_BANK_ID.Value,
&COMPANY_REC.COMPANY.Value, &RCPT_REC.RECIPIENT_ID.Value);
                  /*************************************************************/
                  /* Loop to Get All DED Segments for &RCPT_REC.RECIPIENT_NAME */
                  /*************************************************************/
                  While &CTX_7_SQL.Fetch(&DETAIL_REC)

                       &DEDSegCnt = &DEDSegCnt + 1;
                       &Addenda_Seq = &Addenda_Seq + 1;

                     rem &Payment_amt7 = &DETAIL_REC.GP_PMT_AMT.Value;
                     &Payment_amt7 = NumToStr(&DETAIL_REC.GP_PMT_AMT.Value);
                     MessageBox(0, "", 17295, 3, "", &Payment_amt7);
                     &NID = &DETAIL_REC.NATIONAL_ID.Value;
                     &FIPS = &DETAIL_REC.GPUS_FIPS.Value;
                     &CASEID = &DETAIL_REC.GPUS_GRN_CASEID.Value;
                     &FamilySuppInd = &DETAIL_REC.GPUS_FAM_MED_IND.Value;
                     &DEDName = GetNameDED(&DETAIL_REC.FIRST_NAME.Value,
&DETAIL_REC.LAST_NAME.Value);
                     &EmplStatus = GetEmplStatus(&DETAIL_REC.GPUS_EMPL_STATUS.Value);

                     &DEDSegStr = &DEDSegStr | "DED*CS*" | &CASEID | "*" | &Payment_DT8 | "*"
| &Payment_amt7 | "*" | &NID | "*" | &FamilySuppInd | "*" | &DEDName | "*" | &FIPS | "*" |
&EmplStatus | "\";

                    End-While; /* DED Segment in Addenda Record */

                    &SESegStr = "SE*" | String(&DEDSegCnt) | "*" | Left_Zero(&TransSetCtrlNbr,
9) | "\";
                    &GESegStr = "GE*1*0\";
                    &IEASegStr = "IEA*1*000000000\"; /* ISA13:"000000000" will be filled by
NACHA Oparator */
                    &TYPE_7_REC.GPUS_REC_TYPE.Value = "7";
                  &TYPE_7_REC.GPUS_ADDENDA_TYPE.Value = "05";
                  &TYPE_7_REC.GPUS_ENTRY_DTL_SEQ.Value = Left_Zero(&detail_trace_nbr, 7);

                  /* Process Addenda Record */
                  &CTX820Str = &ISASegStr | &GSSegStr | &STSegStr | &BPRSegStr | &DEDSegStr
| &SESegStr | &GESegStr | &IEASegStr;

                  If (Mod(Len(String(&CTX820Str)), 80) = 0) Then
                     &NumofAddenda = Int(Len(String(&CTX820Str)) / 80);
                  Else
                     &NumofAddenda = Int(Len(String(&CTX820Str)) / 80) + 1;
                  End-If;

                  For &d = 1 To &NumofAddenda
                     &CTX820Array [&d] = Substring(&CTX820Str, (&d - 1) * 80 + 1, &d * 80);
                  End-For;


/**************************************************************************/
                  /* Got the number of addenda records for 6 Type Record, time to write out
*/
                  /* 6 Type Record just before writing out its addenda records.          */

/**************************************************************************/
                  &TYPE_6_REC.GPUS_ADDENDA_CNT.Value = Left_Zero(&NumofAddenda, 4);
                  /*******************************************************/
                  /* Write CTX Entry Detail Record (6 type record)       */
                  /*******************************************************/
                  &File.WriteRecord(&TYPE_6_REC);

                  /***************************************************************/
                  /* Write out Addenda Record one by one from Array &CTX820Array */
                  /***************************************************************/
                  For &NumofAddenda = 1 To &CTX820Array.Len
                     &TYPE_7_REC.GPUS_EFT_CTX820.Value = &CTX820Array [&NumofAddenda];
                     &TYPE_7_REC.GPUS_ADDENDA_SEQ.Value = Left_Zero(&NumofAddenda, 4);
                     &File.WriteRecord(&TYPE_7_REC);
                     &block_count = &block_count + 1;
                     &entry_dtl_count_8rec = &entry_dtl_count_8rec + 1;
                     &entry_dtl_count_9rec = &entry_dtl_count_9rec + 1;
                  End-For;

               End-While; /* Entry Detail Record 6 type record */
               /******************************************************************/
               /* Make Sure To Write Out Offset Record (6 type, TRANS_CD = '27') */
               /******************************************************************/
               &detail_trace_nbr = &detail_trace_nbr + 1;
               &TYPE_6_REC.GPUS_TRANS_CD.Value = "27";
               &TYPE_6_REC.GPUS_RCV_DFI_ID.Value = Substring(&SrcBankCD, 1, 8); /* Employers
Bank ID */
               &TYPE_6_REC.GPUS_CHECK_DIGIT.Value = Substring(&SrcBankCD, 9, 1); /* Check
Digit */
               &TYPE_6_REC.ACCOUNT_NUM.Value = &SrcBankAcct; /* Employers Bank Account */
               &TYPE_6_REC.GPUS_PAYEE_ID.Value = "1" | &FEIN; /* 1 + Employer's FEIN */
               &TYPE_6_REC.GPUS_PMT_AMT.Value = Left_Zero(&deposit_amt_batch, 10);
               &TYPE_6_REC.GPUS_ADDENDA_CNT.Value = "0000"; /* 0 Addenda for Offset Record
*/
               &TYPE_6_REC.GPUS_ADDENDA_IND.Value = "0"; /* No Addenda for Offset Record */
               &TYPE_6_REC.GPUS_COMPANY_NM.Value = &Company_nm; /* Employer's Name */
               &TYPE_6_REC.GPUS_TRACE_NBR.Value = &TYPE_6_REC.GPUS_RCV_DFI_ID.Value |
Left_Zero(&detail_trace_nbr, 7);
               &File.WriteRecord(&TYPE_6_REC);

               &entry_dtl_count_8rec = &entry_dtl_count_8rec + 1;
               &entry_dtl_count_9rec = &entry_dtl_count_9rec + 1;
               &block_count = &block_count + 1;

               If Mod(&block_count, 10) = 0 Then
                  &num_of_blocks = &num_of_blocks + 1;
               End-If;
               /*******************************************************/
                /* Write COMAPNY/BATCH CONTROL Record (8 type record) */
                /*******************************************************/
                &TYPE_8_REC.GPUS_ENTRY_COUNT6.Value = Left_Zero(&entry_dtl_count_8rec, 6);
                &TYPE_8_REC.GPUS_ENTRY_HASH.Value = Left_Zero(&batch_entry_hash, 10);
                &TYPE_8_REC.GPUS_TOTAL_DEBIT.Value = Left_Zero(&deposit_amt_batch, 12);
                &TYPE_8_REC.GPUS_TOTAL_CREDIT.Value = Left_Zero(&deposit_amt_batch, 12);
                &TYPE_8_REC.FEDERAL_EIN.Value = &FEIN;
                &TYPE_8_REC.GPUS_ORIGIN_DFI_ID.Value = Substring(&SrcBankCD, 1, 8);
                &TYPE_8_REC.GPUS_BATCH_NBR.Value = Left_Zero(&company_batch, 7);
                &File.WriteRecord(&TYPE_8_REC);

                &batch_count = &batch_count + 1;
                &block_count = &block_count + 1;
                If Mod(&block_count, 10) = 0 Then
                   &num_of_blocks = &num_of_blocks + 1;
                End-If;

              End-While; /* Company Batch Control */
              /*******************************************************/
              /* Write FILE CONTROL RECORD (9 type record)           */
              /*******************************************************/
              &num_of_blocks = &num_of_blocks + 1; /* need to be increased 1 due to the type
9 record */
           &TYPE_9_REC.GPUS_BATCH_COUNT.Value = Left_Zero(&batch_count, 6);
           &TYPE_9_REC.GPUS_BLOCK_COUNT.Value = Left_Zero(&num_of_blocks, 6);
           &TYPE_9_REC.GPUS_ENTRY_COUNT8.Value = Left_Zero(&entry_dtl_count_9rec, 8);
           &TYPE_9_REC.GPUS_ENTRY_HASH.Value = Left_Zero(&file_entry_hash, 10);
           &TYPE_9_REC.GPUS_TOTAL_DEBIT.Value = Left_Zero(&deposit_amt_file, 12);
           &TYPE_9_REC.GPUS_TOTAL_CREDIT.Value = Left_Zero(&deposit_amt_file, 12);
           &File.WriteRecord(&TYPE_9_REC);
           &block_count = &block_count + 1;
           /**************************************************************/
           /* Write out GPUS_EFT_FILR record (94 9's) to make total      */
           /* number of record in CTX file being the factor of 10.        */
           /* This is required by Both PPD and CTX banking file format! */
           /**************************************************************/
           If Mod(&block_count, 10) <> 0 Then
              For &p = 1 To 10 - Mod(&block_count, 10)
                 &File.WriteRecord(&FILLER_REC);
              End-For;
           End-If;
        Else
           GPUS_CTX_AET.ERROR_TYPE = "55"; /*Error Accessing FileLayout*/
        End-If;
     End-If;
  Else
     GPUS_CTX_AET.ERROR_TYPE = "56"; /*Error Opening File to Write*/
  End-If;

  &File.Close();

   /********************************************************/
   /* Clean Table for generating next CTX File             */
   /********************************************************/
   &clean_sql = "DELETE FROM %Table(GPUS_EFT_COMPNY) ";
   &clean_sql = &clean_sql | " WHERE PROCESS_INSTANCE = " |
GPUS_CTX_AET.PROCESS_INSTANCE.Value;
   SQLExec(&clean_sql);
   &clean_sql = "DELETE FROM %Table(GPUS_EFT_RCPT) ";
   &clean_sql = &clean_sql | " WHERE PROCESS_INSTANCE = " |
GPUS_CTX_AET.PROCESS_INSTANCE.Value;
   SQLExec(&clean_sql);
End-While;

/***********************************************************/
/* IF No data selected for the EFT due to the parameters */
/* from run control page, a blank file CTX001.TXT          */
/* need to be generated.                                   */
/***********************************************************/
If &DataExist = "N" Then
   &File = GetFile("CTX001.TXT", "W");

   If &File.IsOpen Then
      If &File.SetFileLayout(FILELAYOUT.GPUS_EFT_CTX) Then
         MessageBox(0, " ", 0, 0, "No Data Selected. Processing Blank CTX File: CTX001.TXT");
         /*******************************************/
         /* Processing File Header Record             */
         /*******************************************/
         &TYPE_1_REC.GPUS_EFT_CREATE_DT.Value = &FileCreationDate;
         &TYPE_1_REC.GPUS_EFT_CREATE_TM.Value = &FileCreationTime;
         &TYPE_1_REC.GPUS_BANK_CD.Value = "#NO DATA#";
         &TYPE_1_REC.GPUS_DEST_BANK_NM.Value = "#### NO DATA####";
         SQLExec("Select DESCR from PS_COMPANY_TBL where COMPANY = :1",
GPUS_CTX_AET.COMPANY.Value, &Company_Name);
         &TYPE_1_REC.GPUS_ORIGIN_NAME.Value = Upper(&Company_Name);
         &TYPE_1_REC.FEDERAL_EIN.Value = GPUS_CTX_AET.FEDERAL_EIN.Value;
         &File.WriteRecord(&TYPE_1_REC);

         /*******************************************/
         /* Processing Company Header Record        */
         /*******************************************/
         &TYPE_5_REC.GPUS_SVC_CLASS_CD.Value = "000";
         &TYPE_5_REC.GPUS_COMPANY_NM.Value = "0000000000000000";
         &TYPE_5_REC.FEDERAL_EIN.Value = "000000000";
         &TYPE_5_REC.GPUS_PAY_END_DT.Value = "0000";
         &TYPE_5_REC.GPUS_CHECK_DT.Value = "0000";
         &TYPE_5_REC.GPUS_SETTLE_DT.Value = "000";
         &TYPE_5_REC.GPUS_ORIGIN_DFI_ID.Value = "000000000";
         &TYPE_5_REC.GPUS_BATCH_NBR.Value = "0000000";
         &File.WriteRecord(&TYPE_5_REC);

         /*******************************************/
         /* Processing Entry Detail Record          */
         /*******************************************/
         &TYPE_6_REC.GPUS_TRANS_CD.Value = "00";
         &TYPE_6_REC.GPUS_RCV_DFI_ID.Value = "00000000";
         &TYPE_6_REC.GPUS_CHECK_DIGIT.Value = "0";
         &TYPE_6_REC.ACCOUNT_NUM.Value = "00000000000000000000";
         &TYPE_6_REC.GPUS_PAYEE_ID.Value = "000000000";
         &TYPE_6_REC.GPUS_PMT_AMT.Value = "0000000000";
         &TYPE_6_REC.GPUS_PAYEE_NAME.Value = "0000000000000000";
         &TYPE_6_REC.GPUS_TRACE_NBR.Value = "000000000000000";
         &File.WriteRecord(&TYPE_6_REC);

         /*******************************************/
         /* Processing Addenda Record               */
         /*******************************************/
         &TYPE_7_REC.GPUS_EFT_CTX820.Value = &EIGHTY_ZERO;
         &TYPE_7_REC.GPUS_ADDENDA_SEQ.Value = "0000";
         &TYPE_7_REC.GPUS_ENTRY_DTL_SEQ.Value = "0000000";
         &File.WriteRecord(&TYPE_7_REC);

         /************************************************************/
         /* Processing COMAPNY/BATCH CONTROL Record (8 type record) */
         /************************************************************/
         &TYPE_8_REC.GPUS_SVC_CLASS_CD.Value = "000";
         &TYPE_8_REC.GPUS_ENTRY_COUNT6.Value = "000000";
         &TYPE_8_REC.GPUS_ENTRY_HASH.Value = "0000000000";
         &TYPE_8_REC.GPUS_TOTAL_DEBIT.Value = "000000000000";
         &TYPE_8_REC.GPUS_TOTAL_CREDIT.Value = "000000000000";
         &TYPE_8_REC.FEDERAL_EIN.Value = "000000000";
         &TYPE_8_REC.GPUS_ORIGIN_DFI_ID.Value = "00000000";
         &TYPE_8_REC.GPUS_BATCH_NBR.Value = "0000000";
         &File.WriteRecord(&TYPE_8_REC);

         /************************************************************/
         /* Processing FILE CONTROL RECORD (9 type record)           */
         /************************************************************/
         &TYPE_9_REC.GPUS_BATCH_COUNT.Value = "000000";
         &TYPE_9_REC.GPUS_BLOCK_COUNT.Value = "000000";
         &TYPE_9_REC.GPUS_ENTRY_COUNT8.Value = "00000000";
               &TYPE_9_REC.GPUS_ENTRY_HASH.Value = "0000000000";
               &TYPE_9_REC.GPUS_TOTAL_DEBIT.Value = "000000000000";
               &TYPE_9_REC.GPUS_TOTAL_CREDIT.Value = "000000000000";
               &File.WriteRecord(&TYPE_9_REC);
               For &p = 1 To 4
                  &File.WriteRecord(&FILLER_REC);
               End-For;
               &File.Close();
            End-If;
         End-If;
      End-If;
      /*********************************/
      /* END OF PEOPLE CODE PROCESS    */
      /*********************************/




PeopleCode (ApplEng): GPUS_CTX_EFT.GET-DTL GBLdefault 1900-01-01.Step01.OnExecute
      /****************************************************************************/
      /* Constructing SQL for populating Detail Record GPUS_EFT_DTL               */
      /* from GP_PAYMENT based on the parameters on run control page              */
      /****************************************************************************/
      Local string &sql_str = "INSERT INTO %Table(GPUS_EFT_DTL)( PROCESS_INSTANCE,";
      &sql_str = &sql_str |
      "SRC_BANK_ID,COMPANY_DESCR,EMPLID,EMPL_RCD,PAY_ENTITY,CAL_RUN_ID,GP_PAYGROUP,";
      &sql_str = &sql_str |
      "SRC_BANK_ID,COMPANY,EMPLID,EMPL_RCD,PAY_ENTITY,CAL_RUN_ID,GP_PAYGROUP,";
      &sql_str = &sql_str |
      "CAL_ID,ORIG_CAL_RUN_ID,RSLT_SEG_NUM,PIN_NUM,INSTANCE,RECIPIENT_TAG,RECIPIENT_ID,";
      &sql_str = &sql_str |
      "RECIPIENT_NAME,DEBIT_DT,PMT_TYPE,GP_PMT_AMT,PYMT_ID,GPUS_BANK_CD,ACCOUNT_EC_ID,";
      &sql_str = &sql_str |
      "ACCOUNT_NAME,FEDERAL_EIN,GPUS_DEST_BANK_NM,PAY_END_DT,CHECK_DT,GPUS_PYEBANK_CD,";
      &sql_str = &sql_str |
      "GPUS_PYEACCT_ID,GPUS_PYEACCT_NM,ACCOUNT_TYPE_PYE,GPUS_PMT_AMT,GPUS_PAYEE_NAME,";
      &sql_str = &sql_str |
      "GPUS_PYEACCT_ID,GPUS_PYEACCT_NM,GPUS_PYEACCT_IAT,ACCOUNT_TYPE_PYE,GPUS_PMT_AMT,GPUS_PAYE
      E_NAME,";
      &sql_str = &sql_str | "FIRST_NAME,LAST_NAME,GPUS_EMPL_STATUS,GPUS_FAM_MED_IND,";
      &sql_str = &sql_str | "GPUS_STATE,GPUS_GRN_CASEID,GPUS_FIPS,NATIONAL_ID )";

      &sql_str = &sql_str | " SELECT DISTINCT " | GPUS_CTX_AET.PROCESS_INSTANCE.Value;
      &sql_str = &sql_str |
      ",A.SRC_BANK_ID,B.DESCR,A.EMPLID,A.EMPL_RCD,A.PAY_ENTITY,A.CAL_RUN_ID,A.GP_PAYGROUP,";
      &sql_str = &sql_str |
      ",A.SRC_BANK_ID,B.COMPANY,A.EMPLID,A.EMPL_RCD,A.PAY_ENTITY,A.CAL_RUN_ID,A.GP_PAYGROUP,";
      &sql_str = &sql_str |
      "A.CAL_ID,A.ORIG_CAL_RUN_ID,A.RSLT_SEG_NUM,A.PIN_NUM,A.INSTANCE,A.RECIPIENT_TAG,A.RECIPIE
      NT_ID,";
      &sql_str = &sql_str |
      "A.RECIPIENT_NAME,A.DEBIT_DT,A.PMT_TYPE,A.GP_PMT_AMT,A.PYMT_ID,D.BANK_CD,D.ACCOUNT_EC_ID,
      ";
      &sql_str = &sql_str |
      "D.ACCOUNT_NAME,B.FEDERAL_EIN,D.BANK_NM,C.CALC_THRU_DT,C.PYMT_DT,R.BANK_CD,R.ACCOUNT_EC_I
      D,";
      &sql_str = &sql_str |
      "R.ACCOUNT_NAME,'C','0',%SubString(N1.NAME,1,22),N2.FIRST_NAME,N2.LAST_NAME,J.EMPL_STATUS
      ,M.GPUS_FAM_MED_IND,";
      &sql_str = &sql_str |
      "R.ACCOUNT_NAME,'N','C','0',%SubString(N1.NAME,1,22),N2.FIRST_NAME,N2.LAST_NAME,J.EMPL_ST
      ATUS,M.GPUS_FAM_MED_IND,";
      &sql_str = &sql_str | "G.GPUS_STATE,G.GPUS_GRN_CASEID,G.GPUS_FIPS, P.NATIONAL_ID ";

      &sql_str = &sql_str | " FROM PS_GP_PAYMENT A, PS_COMPANY_TBL B, PS_GP_CALENDAR C, PS_JOB J,
      PS_GPUS_RCP_VW R, PS_GPUS_SRCBANK_VW D, ";
      &sql_str = &sql_str | " PS_PERSONAL_DATA N1, PS_NAMES_VW N2, PS_PERS_NID P, PS_GPUS_GRNEFT_VW
      G, PS_GPUS_COMPANY M ";

      &sql_str = &sql_str | " WHERE A.SRC_BANK_ID = D.SRC_BANK_ID ";
&sql_str =   &sql_str | " AND A.PYMT_KEY1 = B.COMPANY ";
&sql_str =   &sql_str | " AND A.EMPLID = N1.EMPLID ";
&sql_str =   &sql_str | " AND A.EMPLID = N2.EMPLID ";
&sql_str =   &sql_str | " AND N2.NAME_TYPE = 'PRI' ";
&sql_str =   &sql_str | " AND A.EMPLID = J.EMPLID ";
&sql_str =   &sql_str | " AND A.EMPL_RCD = J.EMPL_RCD ";
&sql_str =   &sql_str | " AND J.EFFDT = (SELECT MAX(JJ.EFFDT) FROM PS_JOB JJ WHERE JJ.EMPLID
= A.EMPLID   AND JJ.EMPL_RCD = A.EMPL_RCD AND JJ.EFFDT <= C.PYMT_DT) ";
&sql_str =   &sql_str | " AND A.EMPLID = P.EMPLID ";
&sql_str =   &sql_str | " AND A.GP_PAYGROUP = C.GP_PAYGROUP ";
&sql_str =   &sql_str | " AND A.RECIPIENT_ID = R.RECIPIENT_ID ";
&sql_str =   &sql_str | " AND A.CAL_ID = C.CAL_ID ";
&sql_str =   &sql_str | " AND (A.PMT_TYPE = '02' OR A.PMT_TYPE = '03') ";
&sql_str =   &sql_str | " AND A.PAYMENT_MTHD = 'T' ";
&sql_str =   &sql_str | " AND A.PMT_STATUS = 'F' ";

&sql_str = &sql_str | " AND A.EMPLID = G.EMPLID ";
&sql_str = &sql_str | " AND A.EMPL_RCD = G.EMPL_RCD ";
&sql_str = &sql_str | " AND A.PIN_NUM = G.PIN_NUM ";
&sql_str = &sql_str | " AND A.RECIPIENT_TAG = G.RECIPIENT_TAG ";
&sql_str = &sql_str | " AND G.SOVR_VAL_NUM = 10 ";
&sql_str = &sql_str | " AND G.EFFDT = (SELECT MAX(G1.EFFDT) FROM PS_GPUS_GRNEFT_VW G1 WHERE
G.EMPLID = G1.EMPLID AND G.EMPL_RCD = G1.EMPL_RCD AND G.PIN_NUM = G1.PIN_NUM AND
G.RECIPIENT_TAG = G1.RECIPIENT_TAG AND G1.EFFDT <= C.PYMT_DT)";
&sql_str = &sql_str | " AND M.COMPANY = A.PYMT_KEY1 ";
&sql_str = &sql_str | " AND M.EFFDT = ( SELECT MAX(MM.EFFDT) FROM PS_GPUS_COMPANY MM WHERE
MM.COMPANY = A.PYMT_KEY1 ";

/************************************************************/
/* Construct SQL String Based on Run Control Parameters:    */
/* PAY_ENTITY/DEBIT_DT/PAYMENT_DT/GPUS_RCP_OPTN             */
/************************************************************/

If All(GPUS_CTX_AET.DEBIT_DT.Value) Then
   &sql_str = &sql_str | " AND MM.EFFDT <= %DateIn('" | GPUS_CTX_AET.DEBIT_DT.Value | "') )";
   &sql_str = &sql_str | " AND A.DEBIT_DT = %DateIn('" | GPUS_CTX_AET.DEBIT_DT.Value | "')";
End-If;
If All(GPUS_CTX_AET.PAYMENT_DT.Value) Then
   &sql_str = &sql_str | " AND MM.EFFDT <= %DateIn('" | GPUS_CTX_AET.PAYMENT_DT.Value | "')
)";
   &sql_str = &sql_str | " AND C.PYMT_DT = %DateIn('" | GPUS_CTX_AET.PAYMENT_DT.Value | "')";
End-If;
If All(GPUS_CTX_AET.PAY_ENTITY.Value) Then
   &sql_str = &sql_str | " AND A.PAY_ENTITY = '" | GPUS_CTX_AET.PAY_ENTITY.Value | "'";
End-If;
/****************************************************************/
/* Filter the SDU information to put into Banking EFT File        */
/****************************************************************/
Evaluate GPUS_CTX_AET.GPUS_RCP_OPTN.Value
When = 10
   &sql_str = &sql_str | " AND G.GPUS_STATE IN ('IN', 'IL', 'MA', 'CA') ";
   Break;
When = 20
   &sql_str = &sql_str | " AND G.GPUS_STATE = 'IN'";
   Break;
When = 30
   &sql_str = &sql_str | " AND G.GPUS_STATE = 'IL'";
   Break;
When = 40
   &sql_str = &sql_str | " AND G.GPUS_STATE = 'MA'";
   Break;
When = 50
   &sql_str = &sql_str | " AND G.GPUS_STATE = 'CA'";
   Break;
When-Other
   Break;
End-Evaluate;
/****************************************************************************/
/* Execute SQL to Populate the Record GPUS_EFT_DTL                            */
/****************************************************************************/
SQLExec(&sql_str);
PeopleCode (ApplEng): GPUS_PPD_EFT.GEN-FILEGBLdefault 1900-01-01.Step01.OnExecute
      /***************************************************/
      /* Generating PPD Format Payroll File for GP US CE */
      /* Prenote Info will be included in the PPD file   */
      /*                                                 */
      /* Change Log:                                     */
      /*                                                 */
      /* 06/2004
      /* Initial creation
      /*                                                 */
      /*       HCMS 8.90    06/2004                    XZ*/
      /*                                           08/2009
      /*                                           Added logic to create IAT transactions.
      */
      /* Also performed some general cleanup.            */
      /***************************************************/
      Local File &File;
      Local string &FileCreationDate, &FileCreationTime, &HHMM, &HH, &MM, &DataExist;
      Local string &Company_Name, &Src_Bank_CD, &Src_Bank_Name, &EFT_FILE_NAME, &PAY_ENTITY,
      &FILE_LAYOUT, &TEMP;
      Local number &FileCounter, &employee_hash, &batch_entry_hash, &file_entry_hash,
      &company_batch, &batch_count, &block_count;
      Local number &deposit_amt_file, &deposit_amt_batch, &entry_dtl_count_8rec,
      &entry_dtl_count_9rec, &num_of_blocks, &detail_trace_nbr;
      Local number &i, &p;
      Local Record &TYPE_1_REC, &TYPE_5_REC, &TYPE_6_REC, &TYPE_7_REC, &TYPE_8_REC, &TYPE_9_REC,
      &DETAIL_REC, &FILLER_REC, &SRCBANK_REC, &COMPANY_REC;
      Local Record &TYPE_710_ADD, &TYPE_711_ADD, &TYPE_712_ADD, &TYPE_713_ADD, &TYPE_714_ADD,
      &TYPE_715_ADD, &TYPE_716_ADD;
      Local SQL &SRCBANK_SQL, &COMPANY_SQL, &TYPE_6_SQL, &TYPE_9_SQL, &DETAIL_SQL, &PMTDT_SQL;
      Local string &clean_sql;
      Local string &1ZERO, &2ZERO, &3ZERO, &4ZERO, &6ZERO, &8ZERO, &10ZERO, &12ZERO, &20ZERO,
      &99ZERO;


      /****************************************************************/
      /* Function Left_Zero(&in, &total_length)                       */
      /* Add Leading ZEROs to a number &in, making a string with      */
      /* total length of &total_length                                */
      /****************************************************************/
      /************************************************/
      /* Function DoSetFileLayout(&iat)               */
      /* Set the appropriate file layout (PPD or IAT) */
      /* based on the IAT indicator                   */
      /************************************************/
      Function DoSetFileLayout(&iat);
         If &iat = "N" Then
            /* PPD */
            If &File.SetFileLayout(FILELAYOUT.GPUS_EFT_PPD) Then
            Else
               GPUS_PPD_AET.ERROR_TYPE = "55"; /*Error Accessing FileLayout*/
            End-If;
         Else
            /* IAT */
            If &File.SetFileLayout(FILELAYOUT.GPUS_EFT_IAT) Then
            Else
               GPUS_PPD_AET.ERROR_TYPE = "55"; /*Error Accessing FileLayout*/
            End-If;
         End-If;
      End-Function;

      /*********************************************/
      /* Function FormatCityState(&city, &state)   */
      /* Returns IAT formatted city and state data */
      /*********************************************/
      Function FormatCityState(&city, &state) Returns string;
   If (&city = "") And
         (&state = "") Then
      Return "\";
   Else
      If (&city = "") Then
         Return "*" | &state | "\";
      Else
         If (&state = "") Then
            Return &city | "\";
         Else
            Return &city | "*" | &state | "\";
         End-If;
      End-If;
   End-If;
End-Function;

/***************************************************/
/* Function FormatCountryPostal(&country, &postal) */
/* Returns IAT formatted country and postal data   */
/***************************************************/
Function FormatCountryPostal(&country, &postal) Returns string;
   If (&country = "") And
         (&postal = "") Then
      Return "\";
   Else
      If (&country = "") Then
         Return "*" | &postal | "\";
      Else
         If (&postal = "") Then
            Return &country | "\";
         Else
            Return &country | "*" | &postal | "\";
         End-If;
      End-If;
   End-If;
End-Function;

/***********************************************/
/* Function Left_Zero(&in, &total_length)      */
/* Add Leading ZEROs to a number &in, making a */
/* string with total length of &total_length   */
/***********************************************/

[ . . . Unchanged Code not Shown . . . ]


/*************************************************************/
/* Function: DateToYYMMDD(&date, &format_code)               */
/* IF &format_code = 2 : Return date format YYMMDD           */
/* IF &format_code = 4 : Return date format YYYYMMDD         */
/*************************************************************/
/*****************************************************/
/* Function DateToYYMMDD(&date, &format_code)        */
/* IF &format_code = 2 : Return date format YYMMDD   */
/* IF &format_code = 4 : Return date format YYYYMMDD */
/*****************************************************/

[ . . . Unchanged Code not Shown . . . ]


/***************************************************/
/* Constant Values for PPD File Format             */
/***************************************************/
&99ZERO =
"9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
999999";

/***************************************************/
/* New Records for GPUS EFT PPD File Format        */
/***************************************************/
/***************************************/
/* Constant Values for PPD File Format */
/***************************************/
&99ZERO = Rept("9", 94);
/********************************************/
/* New Records for GPUS EFT PPD File Format */
/********************************************/
&SRCBANK_REC = CreateRecord(Record.GPUS_EFT_SBNK);
&COMPANY_REC = CreateRecord(Record.GPUS_EFT_COMPNY);
&COMPANY_REC = CreateRecord(Record.GPUS_PPD_COMPNY);
&TYPE_1_REC = CreateRecord(Record.GPUS_EFT_1REC);
&TYPE_5_REC = CreateRecord(Record.GPUS_EFT_5REC);
&TYPE_6_REC = CreateRecord(Record.GPUS_EFT_6REC);
&TYPE_7_REC = CreateRecord(Record.GPUS_EFT_7REC);
&TYPE_710_ADD = CreateRecord(Record.GPUS_IAT_710);
&TYPE_711_ADD = CreateRecord(Record.GPUS_IAT_711);
&TYPE_712_ADD = CreateRecord(Record.GPUS_IAT_712);
&TYPE_713_ADD = CreateRecord(Record.GPUS_IAT_713);
&TYPE_714_ADD = CreateRecord(Record.GPUS_IAT_714);
&TYPE_715_ADD = CreateRecord(Record.GPUS_IAT_715);
&TYPE_716_ADD = CreateRecord(Record.GPUS_IAT_716);
&TYPE_8_REC = CreateRecord(Record.GPUS_EFT_8REC);
&TYPE_9_REC = CreateRecord(Record.GPUS_EFT_9REC);
&DETAIL_REC = CreateRecord(Record.GPUS_EFT_DTL);
&FILLER_REC = CreateRecord(Record.GPUS_EFT_FILR);

/***************************************************/
/* New SQLs for GPUS EFT File Format               */
/***************************************************/
/*************************************/
/* New SQLs for GPUS EFT File Format */
/*************************************/
&DETAIL_SQL = CreateSQL("%Selectall(:1) WHERE PROCESS_INSTANCE=:2", &DETAIL_REC,
GPUS_PPD_AET.PROCESS_INSTANCE.Value);
&SRCBANK_SQL = CreateSQL("%Selectall(:1) WHERE PROCESS_INSTANCE=:2", &SRCBANK_REC,
GPUS_PPD_AET.PROCESS_INSTANCE.Value);

/***************************************************/
/* Get System Date in YYMMDD Format                */
/***************************************************/
/************************************/
/* Get System Date in YYMMDD Format */
/************************************/
&FileCreationDate = DateToYYMMDD(%Date, 2);

/***************************************************/
/* Get System Time in HH:MM Format                 */
/***************************************************/
/***********************************/
/* Get System Time in HH:MM Format */
/***********************************/
&FileCreationTime = LTrim(RTrim(String(Time(%Time))));
&HH = Substring(&FileCreationTime, 1, 2);
&MM = Substring(&FileCreationTime, 4, 2);
&FileCreationTime = &HH | &MM;

/***************************************************/
/* Initialize control parameters for EFT File      */
/***************************************************/
/**********************************************/
/* Initialize control parameters for EFT File */
/**********************************************/
&FILLER_REC.GPUS_FILLER_94.Value = &99ZERO;

&FileCounter = 0;
&deposit_amt_file = 0;
&entry_dtl_count_9rec = 0;
&batch_count = 0;
&num_of_blocks = 0;
&DataExist = "N";

/************************************************************************/
/* Loop Through Header Record. Each individual Header entry creates a   */
/* separate file in the format PPDxxx.TXT (xxx is from 001)             */
/************************************************************************/
/********************************************************************/
/* Loop Through Header Record. Each individual Header entry creates */
/* a separate file in the format PPDxxx.TXT (xxx is from 001)       */
/********************************************************************/

While &SRCBANK_SQL.Fetch(&SRCBANK_REC)

   &DataExist = "Y";

   &FileCounter = &FileCounter + 1;
   &TYPE_1_REC.GPUS_EFT_CREATE_DT.Value = &FileCreationDate;
   &TYPE_1_REC.GPUS_EFT_CREATE_TM.Value = &FileCreationTime;
   /*******************************************/
   /* Get Source Bank ID and Source Bank Name */
   /*******************************************/
   SQLExec("Select BANK_CD, BANK_NM from PS_GPUS_SRCBANK_VW where SRC_BANK_ID = :1",
&SRCBANK_REC.SRC_BANK_ID.Value, &Src_Bank_CD, &Src_Bank_Name);
   &TYPE_1_REC.GPUS_BANK_CD.Value = &Src_Bank_CD;
   &TYPE_1_REC.GPUS_DEST_BANK_NM.Value = Upper(&Src_Bank_Name);
   /*******************************************/
   /* Get Company Header Info from Run Control*/
   /*******************************************/
   /********************************************/
   /* Get Company Header Info from Run Control */
   /********************************************/
   SQLExec("Select DESCR from PS_COMPANY_TBL where COMPANY = :1", GPUS_PPD_AET.COMPANY.Value,
&Company_Name);
   &TYPE_1_REC.GPUS_ORIGIN_NAME.Value = Upper(&Company_Name);
   &TYPE_1_REC.FEDERAL_EIN.Value = GPUS_PPD_AET.FEDERAL_EIN.Value;
   /*******************************************/
   /* Constructing File Name in format PPD999 */
   /*******************************************/
   Evaluate &FileCounter
   When < 10
      &EFT_FILE_NAME = "PPD" | "00" | &FileCounter | ".TXT";
      Break;
   When < 100
      &EFT_FILE_NAME = "PPD" | "0" | &FileCounter | ".TXT";
      Break;
   When-Other
      &EFT_FILE_NAME = "PPD" | &FileCounter | ".TXT";
   End-Evaluate;

   &File = GetFile(&EFT_FILE_NAME, "W");

   /*******************************************/
   /* Open File PPD999 for Writing            */
   /*******************************************/
   /********************************/
   /* Open File PPD999 for Writing */
   /********************************/
   If &File.IsOpen Then

      If GPUS_PPD_AET.EFT_NAME.Value = "PPD" Then
         If &File.SetFileLayout(FILELAYOUT.GPUS_EFT_PPD) Then

            &file_entry_hash = 0;
            &company_batch = 0;
            &block_count = 0;
            &deposit_amt_batch = 0;
            /*******************************************/
            /* Writing Out File Header Record          */
            /*******************************************/
            /**********************************/
            /* Writing Out File Header Record */
            /**********************************/
            &File.WriteRecord(&TYPE_1_REC);
            &block_count = &block_count + 1;
            If Mod(&block_count, 10) = 0 Then
               &num_of_blocks = &num_of_blocks + 1;
            End-If;

            /*******************************************/
            /* Processing Company Header Record         */
            /*******************************************/
            /* Get all companies with this SRC_BANK_ID and put them into GPUS_EFT_COMPNY */
            &clean_sql = "DELETE FROM %Table(GPUS_EFT_COMPNY) ";
            /************************************/
            /* Processing Company Header Record */
            /************************************/
            /* Get all companies with this SRC_BANK_ID and put them into GPUS_PPD_COMPNY */
            &clean_sql = "DELETE FROM %Table(GPUS_PPD_COMPNY) ";
            &clean_sql = &clean_sql | " WHERE PROCESS_INSTANCE = " |
GPUS_PPD_AET.PROCESS_INSTANCE.Value;
            SQLExec(&clean_sql);

            Local string &com_sql;
            &com_sql = "INSERT INTO %Table(GPUS_EFT_COMPNY)( PROCESS_INSTANCE, COMPANY_DESCR
) ";
            &com_sql = &com_sql | " SELECT DISTINCT A.PROCESS_INSTANCE, A.COMPANY_DESCR ";
            &com_sql = "INSERT INTO %Table(GPUS_PPD_COMPNY)( PROCESS_INSTANCE, COMPANY,
GPUS_PYEACCT_IAT ) ";
            &com_sql = &com_sql | " SELECT DISTINCT A.PROCESS_INSTANCE, A.COMPANY,
A.GPUS_PYEACCT_IAT ";
            &com_sql = &com_sql | " FROM %Table(GPUS_EFT_DTL) A ";
            &com_sql = &com_sql | " WHERE A.PROCESS_INSTANCE = " |
GPUS_PPD_AET.PROCESS_INSTANCE.Value;
            &com_sql = &com_sql | " AND A.SRC_BANK_ID = '" | &SRCBANK_REC.SRC_BANK_ID.Value
| "'";
            &com_sql = &com_sql | " ORDER BY PROCESS_INSTANCE, COMPANY, GPUS_PYEACCT_IAT ";

            SQLExec(&com_sql);

            &COMPANY_SQL = CreateSQL("%Selectall(:1) WHERE PROCESS_INSTANCE=:2",
&COMPANY_REC, GPUS_PPD_AET.PROCESS_INSTANCE.Value);

            While &COMPANY_SQL.Fetch(&COMPANY_REC)

                Local string &FEIN, &SrcBankCD, &SrcBankAcct, &Company_nm;
                Local date &PayEndDate, &CheckDate;

               &PMTDT_SQL = CreateSQL("Select DISTINCT FEDERAL_EIN, %DateOut(PAY_END_DT),
%DateOut(CHECK_DT), GPUS_BANK_CD, ACCOUNT_EC_ID from %Table(GPUS_EFT_DTL) where
COMPANY_DESCR = :1 AND SRC_BANK_ID = :2", &COMPANY_REC.COMPANY_DESCR.Value,
&SRCBANK_REC.SRC_BANK_ID.Value, &FEIN, &PayEndDate, &CheckDate, &SrcBankCD, &SrcBankAcct);
               &PMTDT_SQL = CreateSQL("Select DISTINCT FEDERAL_EIN, %DateOut(PAY_END_DT),
%DateOut(CHECK_DT), GPUS_BANK_CD, ACCOUNT_EC_ID from %Table(GPUS_EFT_DTL) where COMPANY = :1
AND SRC_BANK_ID = :2", &COMPANY_REC.COMPANY.Value, &SRCBANK_REC.SRC_BANK_ID.Value, &FEIN,
&PayEndDate, &CheckDate, &SrcBankCD, &SrcBankAcct);
               SQLExec("Select DESCR from PS_COMPANY_TBL where COMPANY = :1",
&COMPANY_REC.COMPANY.Value, &Company_Name);

                While &PMTDT_SQL.Fetch(&FEIN, &PayEndDate, &CheckDate, &SrcBankCD,
&SrcBankAcct)

                   /******************************************************************/
                   /* Pouplate and write Company/Batch Header Record (5 record type) */
                   /******************************************************************/
                   &company_batch = &company_batch + 1;

                   &Company_nm = Upper(Substring(&COMPANY_REC.COMPANY_DESCR.Value, 1, 16));
                   &TYPE_5_REC.GPUS_BATCH_NBR.Value = Left_Zero(&company_batch, 7);
                   DoSetFileLayout(&COMPANY_REC.GPUS_PYEACCT_IAT.Value);

                   If &COMPANY_REC.GPUS_PYEACCT_IAT.Value = "N" Then
                      /* PPD */
                      &TYPE_5_REC = CreateRecord(Record.GPUS_EFT_5REC);
                      &Company_nm = Upper(Substring(&Company_Name, 1, 16));
                      &TYPE_5_REC.GPUS_COMPANY_NM.Value = &Company_nm;
                  &TYPE_5_REC.FEDERAL_EIN.Value = &FEIN;
                     &TYPE_5_REC.GPUS_PAY_END_DT.Value = DateToYYMMDD(Date(&PayEndDate),
2);
                  Else
                     /* IAT */
                     &TYPE_5_REC = CreateRecord(Record.GPUS_IAT_5REC);
                  End-If;

                  &TYPE_5_REC.GPUS_BATCH_NBR.Value = Right(Rept("0", 7) | &company_batch,
7);
                  &TYPE_5_REC.FEDERAL_EIN.Value = &FEIN;
                  &TYPE_5_REC.GPUS_CHECK_DT.Value = DateToYYMMDD(Date(&CheckDate), 2);
                  &TYPE_5_REC.GPUS_SETTLE_DT.Value = "000";
                  &TYPE_5_REC.GPUS_ORIGIN_DFI_ID.Value = &SrcBankCD;
                  /*******************************************************/
                  /* Write Company Header Record (5 type record)         */
                  /*******************************************************/

                  &File.WriteRecord(&TYPE_5_REC);

                  &block_count = &block_count + 1;
                  If Mod(&block_count, 10) = 0 Then
                     &num_of_blocks = &num_of_blocks + 1;
                  End-If;

                  /*******************************************************/
                  /* SQL: Populate Entry Detail Record from GPUS_EFT_DTL */
                  /*******************************************************/
                  &clean_sql = "DELETE FROM %Table(GPUS_EFT_6REC) ";
                  &clean_sql = &clean_sql | " WHERE PROCESS_INSTANCE = " |
GPUS_PPD_AET.PROCESS_INSTANCE.Value;
                  Local string &rec6_sql;

                  DoSetFileLayout(&COMPANY_REC.GPUS_PYEACCT_IAT.Value);

                  If &COMPANY_REC.GPUS_PYEACCT_IAT.Value = "N" Then
                     /* PPD */
                     &TYPE_6_REC = CreateRecord(Record.GPUS_EFT_6REC);

                     &clean_sql = "DELETE FROM %Table(GPUS_EFT_6REC) WHERE PROCESS_INSTANCE
= " | GPUS_PPD_AET.PROCESS_INSTANCE.Value;
                     SQLExec(&clean_sql);

                  Local string &rec6_sql;
                     &rec6_sql = "INSERT INTO %Table(GPUS_EFT_6REC)( PROCESS_INSTANCE,";
                     &rec6_sql = &rec6_sql | "
GPUS_REC_TYPE,GPUS_TRANS_CD,GPUS_RCV_DFI_ID,GPUS_CHECK_DIGIT,ACCOUNT_NUM,";
                     &rec6_sql = &rec6_sql | "
GPUS_PMT_AMT,GP_PMT_AMT,PYMT_ID,GPUS_PAYEE_ID,GPUS_ADDENDA_CNT,GPUS_COMPANY_NM,GPUS_RESER
VED_2,";
                     &rec6_sql = &rec6_sql | "
GPUS_PAYEE_NAME,GPUS_FILLER_2,GPUS_ADDENDA_IND,GPUS_TRACE_NBR) ";
                  &rec6_sql = &rec6_sql | " SELECT DISTINCT
A.PROCESS_INSTANCE,'6',A.ACCOUNT_TYPE_PYE,%Substring(A.GPUS_PYEBANK_CD,1,8),%Substring(A.
GPUS_PYEBANK_CD,9,1), A.GPUS_PYEACCT_ID,";
                  &rec6_sql = &rec6_sql | " ' ',
(A.GP_PMT_AMT*1000000)/10000,A.PYMT_ID,A.EMPLID,'0000','COMPANY_NAME','XX',A.GPUS_PAYEE_N
AME,' ','0',%Substring(A.GPUS_BANK_CD,1,8) ";
                     &rec6_sql = &rec6_sql | " SELECT DISTINCT
A.PROCESS_INSTANCE,'6',A.ACCOUNT_TYPE_PYE,%Substring(A.GPUS_PYEBANK_CD,1,8),%COALESCE(%Su
bstring(A.GPUS_PYEBANK_CD,9,1),'0'),A.GPUS_PYEACCT_ID,";
                     &rec6_sql = &rec6_sql | " '
',A.GP_PMT_AMT*100,A.PYMT_ID,A.EMPLID,'0000','COMPANY_NAME','
',%Upper(A.GPUS_PAYEE_NAME),' ','0',%Substring(A.GPUS_BANK_CD,1,8) ";
                     &rec6_sql = &rec6_sql | " FROM %Table(GPUS_EFT_DTL) A ";
                     &rec6_sql = &rec6_sql | " WHERE A.PROCESS_INSTANCE = " |
GPUS_PPD_AET.PROCESS_INSTANCE.Value;
                     &rec6_sql = &rec6_sql | " AND A.SRC_BANK_ID = '" |
&SRCBANK_REC.SRC_BANK_ID.Value | "'";
                  &rec6_sql = &rec6_sql | " AND A.COMPANY_DESCR = '" |
&COMPANY_REC.COMPANY_DESCR.Value | "'";
                      &rec6_sql = &rec6_sql | " AND A.COMPANY = '" | &COMPANY_REC.COMPANY.Value
| "'";
                      &rec6_sql = &rec6_sql | " AND A.GPUS_PYEACCT_IAT = 'N'";
                      &rec6_sql = &rec6_sql | " AND A.CHECK_DT = %DateIn('" | &CheckDate | "')";
                      &rec6_sql = &rec6_sql | " AND A.PAY_END_DT = %DateIn('" | &PayEndDate
| "')";
                      SQLExec(&rec6_sql);

                     &TYPE_6_SQL = CreateSQL("%Selectall(:1) WHERE PROCESS_INSTANCE = :2",
&TYPE_6_REC, GPUS_PPD_AET.PROCESS_INSTANCE.Value);
                  Else
                     /* IAT */
                     &TYPE_6_REC = CreateRecord(Record.GPUS_IAT_6REC);

                     &clean_sql = "DELETE FROM %Table(GPUS_IAT_6REC) WHERE PROCESS_INSTANCE
= " | GPUS_PPD_AET.PROCESS_INSTANCE.Value;
                     SQLExec(&clean_sql);

                     &rec6_sql = "INSERT INTO %Table(GPUS_IAT_6REC)( PROCESS_INSTANCE,";
                     &rec6_sql = &rec6_sql | "
GPUS_PYEBANK_CD,ACCOUNT_NUM,GP_PMT_AMT,GPUS_PAYEE_ID,GPUS_PAYEE_NAME,GPUS_RCV_DFI_ID,";
                     &rec6_sql = &rec6_sql | "
PYMT_ID,GPUS_REC_TYPE,GPUS_TRANS_CD,GPUS_CHECK_DIGIT,GPUS_ADDENDA_CNT,GPUS_RESERVED_13,GP
US_PMT_AMT,";
                     &rec6_sql = &rec6_sql | "
GPUS_RESERVED_2,GPUS_FILLER_2,GPUS_ADDENDA_IND,GPUS_TRACE_NBR) ";
                     &rec6_sql = &rec6_sql | " SELECT DISTINCT
A.PROCESS_INSTANCE,A.GPUS_PYEBANK_CD,A.GPUS_PYEACCT_ID,A.GP_PMT_AMT*100,A.EMPLID,%Upper(A
.GPUS_PAYEE_NAME),%Substring(A.GPUS_PYEBANK_CD,1,8),";
                     &rec6_sql = &rec6_sql | "
A.PYMT_ID,'6',A.ACCOUNT_TYPE_PYE,%Substring(A.GPUS_PYEBANK_CD,9,1),'0007',' ',' ',";
                     &rec6_sql = &rec6_sql | " ' ',' ','1',%Substring(A.GPUS_BANK_CD,1,8) ";
                     &rec6_sql = &rec6_sql | " FROM %Table(GPUS_EFT_DTL) A ";
                     &rec6_sql = &rec6_sql | " WHERE A.PROCESS_INSTANCE = " |
GPUS_PPD_AET.PROCESS_INSTANCE.Value;
                     &rec6_sql = &rec6_sql | " AND A.SRC_BANK_ID = '" |
&SRCBANK_REC.SRC_BANK_ID.Value | "'";
                     &rec6_sql = &rec6_sql | " AND A.COMPANY = '" | &COMPANY_REC.COMPANY.Value
| "'";
                     &rec6_sql = &rec6_sql | " AND A.GPUS_PYEACCT_IAT = 'Y'";
                     &rec6_sql = &rec6_sql | " AND A.CHECK_DT = %DateIn('" | &CheckDate | "')";
                     &rec6_sql = &rec6_sql | " AND A.PAY_END_DT = %DateIn('" | &PayEndDate
| "')";
                     SQLExec(&rec6_sql);

                     &TYPE_6_SQL = CreateSQL("%Selectall(:1) WHERE PROCESS_INSTANCE = :2",
&TYPE_6_REC, GPUS_PPD_AET.PROCESS_INSTANCE.Value);
                  End-If;

                   &detail_trace_nbr = 0;
                   &batch_entry_hash = 0;
                   &entry_dtl_count_8rec = 0;

                   While &TYPE_6_SQL.Fetch(&TYPE_6_REC)
                      &detail_trace_nbr = &detail_trace_nbr + 1;
                      &entry_dtl_count_8rec = &entry_dtl_count_8rec + 1;
                      &entry_dtl_count_9rec = &entry_dtl_count_9rec + 1;
                      /***************************************************************/
                      /* (1) Determine the Transaction Code for 6 record             */
                      /* (2) Hundle Prenote for payee bank account in PPD File       */
                      /*     IF (PMT_AMT = 0) AND (PYMT_ID = 'PRENOT') THEN          */
                      /*         TRANS_CD = "23" (Prenote for Checking Account)      */
                      /*         TRANS_CD = "33" (Prenote for Saving Account)        */
                      /***************************************************************/

                      /**********************************************************/
                      /* (1) Determine the Transaction Code for 6 record type   */
                      /* (2) Hundle Prenote for payee bank account              */
                      /*     IF (PMT_AMT = 0) AND (PYMT_ID = 'PRENOT') THEN     */
                      /*         TRANS_CD = "23" (Prenote for Checking Account) */
                      /*         TRANS_CD = "33" (Prenote for Saving Account)   */
                     /**********************************************************/
                     Evaluate &TYPE_6_REC.GPUS_TRANS_CD.Value
                     When = "C"
                        &TYPE_6_REC.GPUS_TRANS_CD.Value = "22";
                        If (&TYPE_6_REC.GP_PMT_AMT.Value = 0) And
                               (&TYPE_6_REC.PYMT_ID.Value = "PRENOT") Then
                           &TYPE_6_REC.GPUS_TRANS_CD.Value = "23";
                        End-If;
                        Break;
                     When = "S"
                        &TYPE_6_REC.GPUS_TRANS_CD.Value = "32";
                        If (&TYPE_6_REC.GP_PMT_AMT.Value = 0) And
                               (&TYPE_6_REC.PYMT_ID.Value = "PRENOT") Then
                           &TYPE_6_REC.GPUS_TRANS_CD.Value = "33";
                        End-If;
                        Break;
                     When-Other
                        &TYPE_6_REC.GPUS_TRANS_CD.Value = "22"; /* Set TRANS_CD to 22 for
others - example 'R' or 'C' */
                        If (&TYPE_6_REC.GP_PMT_AMT.Value = 0) And
                               (&TYPE_6_REC.PYMT_ID.Value = "PRENOT") Then
                           &TYPE_6_REC.GPUS_TRANS_CD.Value = "23";
                        End-If;
                        Break;
                     End-Evaluate;

                     &TYPE_6_REC.GPUS_TRACE_NBR.Value = &TYPE_6_REC.GPUS_TRACE_NBR.Value |
Left_Zero(&detail_trace_nbr, 7);
                     &TYPE_6_REC.GPUS_PMT_AMT.Value =
Left_Zero(&TYPE_6_REC.GP_PMT_AMT.Value, 10);
                     /*******************************************************/
                     /* Write Entry Detail Record (6 type record)           */
                     /*******************************************************/

                     /*********************************************/
                     /* Write Entry Detail Record (6 record type) */
                     /*********************************************/
                     DoSetFileLayout(&COMPANY_REC.GPUS_PYEACCT_IAT.Value);
                     &File.WriteRecord(&TYPE_6_REC);

                     &block_count = &block_count + 1;
                     If Mod(&block_count, 10) = 0 Then
                        &num_of_blocks = &num_of_blocks + 1;
                     End-If;

                     &deposit_amt_batch = &deposit_amt_batch +
Int(&TYPE_6_REC.GPUS_PMT_AMT.Value);

                     If IsNumber(&TYPE_6_REC.GPUS_RCV_DFI_ID.Value) Then
                        &batch_entry_hash = &batch_entry_hash +
Int(&TYPE_6_REC.GPUS_RCV_DFI_ID.Value);
                        &file_entry_hash = &file_entry_hash +
Int(&TYPE_6_REC.GPUS_RCV_DFI_ID.Value);
                     Else
                        MessageBox(0, " ", 0, 0, "*** Warning *** Error BANK_CD for US Bank
: " | &TYPE_6_REC.GPUS_RCV_DFI_ID.Value);
                     End-If;

                     /************************************************************/
                     /* Write IAT Addenda Records (7 record type) - ONLY FOR IAT */
                     /************************************************************/
                     If &COMPANY_REC.GPUS_PYEACCT_IAT.Value = "Y" Then
                        DoSetFileLayout("Y");

                        /**************************/
                        /* 10 addenda type record */
                        /**************************/
                        &TYPE_710_ADD.PROCESS_INSTANCE.Value =
&TYPE_6_REC.PROCESS_INSTANCE.Value;
                        &TYPE_710_ADD.GPUS_REC_TYPE.Value = "7";
                        &TYPE_710_ADD.GPUS_ADDENDA_TYPE.Value = "10";
                        &TYPE_710_ADD.GPUS_TXN_TYPE.Value = "SAL";
                        &TYPE_710_ADD.GPUS_FOREIGN_PMT.Value =
Left_Zero(&TYPE_6_REC.GP_PMT_AMT.Value, 18);
                        &TYPE_710_ADD.GPUS_FOREIGN_TRC.Value = " ";
                        &TYPE_710_ADD.GPUS_RCVR_NAME.Value =
&TYPE_6_REC.GPUS_PAYEE_NAME.Value;
                        &TYPE_710_ADD.GPUS_RESERVED_6.Value = " ";
                        &TYPE_710_ADD.GPUS_TRACE_NBR7.Value = Left_Zero(&detail_trace_nbr,
7);

                        &File.WriteRecord(&TYPE_710_ADD);

                        &block_count = &block_count + 1;
                        If Mod(&block_count, 10) = 0 Then
                           &num_of_blocks = &num_of_blocks + 1;
                        End-If;

                        /**************************/
                        /* 11 addenda type record */
                        /**************************/

                        /* Retrieve company data for 11 and 12 addenda records */
                        Local string &coAddr, &coCity, &coState, &coPostal, &coCountry;
                        SQLExec("SELECT ADDRESS1,CITY,STATE,POSTAL,COUNTRY FROM
PS_COMPANY_TBL WHERE COMPANY = :1", &COMPANY_REC.COMPANY.Value, &coAddr, &coCity, &coState,
&coPostal, &coCountry);

                        &TYPE_711_ADD.PROCESS_INSTANCE.Value =
&TYPE_6_REC.PROCESS_INSTANCE.Value;
                        &TYPE_711_ADD.GPUS_REC_TYPE.Value = "7";
                        &TYPE_711_ADD.GPUS_ADDENDA_TYPE.Value = "11";
                        &TYPE_711_ADD.GPUS_ORIG_NAME.Value = Upper(&Company_Name);
                        &TYPE_711_ADD.GPUS_ORIG_ADDR.Value = Upper(&coAddr);
                        &TYPE_711_ADD.GPUS_RESERVED_14.Value = " ";
                        &TYPE_711_ADD.GPUS_TRACE_NBR7.Value = Left_Zero(&detail_trace_nbr,
7);

                        &File.WriteRecord(&TYPE_711_ADD);

                        &block_count = &block_count + 1;
                        If Mod(&block_count, 10) = 0 Then
                           &num_of_blocks = &num_of_blocks + 1;
                        End-If;

                        /**************************/
                        /* 12 addenda type record */
                        /**************************/
                        &TYPE_712_ADD.PROCESS_INSTANCE.Value =
&TYPE_6_REC.PROCESS_INSTANCE.Value;
                        &TYPE_712_ADD.GPUS_REC_TYPE.Value = "7";
                        &TYPE_712_ADD.GPUS_ADDENDA_TYPE.Value = "12";
                        &TYPE_712_ADD.GPUS_ORIG_CITY_ST.Value =
Upper(FormatCityState(&coCity, &coState));
                        &TYPE_712_ADD.GPUS_ORIG_CNTRY_PC.Value =
Upper(FormatCountryPostal(&coCountry, &coPostal));
                        &TYPE_712_ADD.GPUS_RESERVED_14.Value = " ";
                        &TYPE_712_ADD.GPUS_TRACE_NBR7.Value = Left_Zero(&detail_trace_nbr,
7);

                        &File.WriteRecord(&TYPE_712_ADD);

                        &block_count = &block_count + 1;
                        If Mod(&block_count, 10) = 0 Then
                           &num_of_blocks = &num_of_blocks + 1;
                        End-If;

                        /**************************/
                        /* 13 addenda type record */
                        /**************************/
                        &TYPE_713_ADD.PROCESS_INSTANCE.Value =
&TYPE_6_REC.PROCESS_INSTANCE.Value;
                        &TYPE_713_ADD.GPUS_REC_TYPE.Value = "7";
                        &TYPE_713_ADD.GPUS_ADDENDA_TYPE.Value = "13";
                        &TYPE_713_ADD.GPUS_ODFI_NAME.Value = Upper(&Src_Bank_Name);
                        &TYPE_713_ADD.GPUS_ODFI_ID_QUAL.Value = "01";
                        &TYPE_713_ADD.GPUS_ODFI_ID.Value = &Src_Bank_CD;
                        &TYPE_713_ADD.GPUS_ODFI_BR_CNTRY.Value = "US ";
                        &TYPE_713_ADD.GPUS_RESERVED_10.Value = " ";
                        &TYPE_713_ADD.GPUS_TRACE_NBR7.Value = Left_Zero(&detail_trace_nbr,
7);

                        &File.WriteRecord(&TYPE_713_ADD);

                        &block_count = &block_count + 1;
                        If Mod(&block_count, 10) = 0 Then
                           &num_of_blocks = &num_of_blocks + 1;
                        End-If;

                        /**************************/
                        /* 14 addenda type record */
                        /**************************/

                        /* Retrieve payee bank name */
                        Local string &pyeBankName;
                        SQLExec("SELECT BANK_NM FROM PS_BANK_EC_TBL WHERE BANK_CD = :1 AND
COUNTRY_CD = 'USA'", &TYPE_6_REC.GPUS_PYEBANK_CD.Value, &pyeBankName);

                        &TYPE_714_ADD.PROCESS_INSTANCE.Value =
&TYPE_6_REC.PROCESS_INSTANCE.Value;
                        &TYPE_714_ADD.GPUS_REC_TYPE.Value = "7";
                        &TYPE_714_ADD.GPUS_ADDENDA_TYPE.Value = "14";
                        &TYPE_714_ADD.GPUS_RDFI_NAME.Value = Upper(&pyeBankName);
                        &TYPE_714_ADD.GPUS_RDFI_ID_QUAL.Value = "01";
                        &TYPE_714_ADD.GPUS_RDFI_ID.Value =
&TYPE_6_REC.GPUS_PYEBANK_CD.Value;
                        &TYPE_714_ADD.GPUS_RDFI_BR_CNTRY.Value = "US ";
                        &TYPE_714_ADD.GPUS_RESERVED_10.Value = " ";
                        &TYPE_714_ADD.GPUS_TRACE_NBR7.Value = Left_Zero(&detail_trace_nbr,
7);

                        &File.WriteRecord(&TYPE_714_ADD);

                        &block_count = &block_count + 1;
                        If Mod(&block_count, 10) = 0 Then
                           &num_of_blocks = &num_of_blocks + 1;
                        End-If;

                        /**************************/
                        /* 15 addenda type record */
                        /**************************/

                        /* Retrieve payee home address data for 15 and 16 addenda records */
                        Local string &pyeAddr, &pyeCity, &pyeState, &pyePostal, &pyeCountry;
                        SQLExec("SELECT ADDRESS1,CITY,STATE,POSTAL,COUNTRY FROM
PS_PERSON_ADDRESS WHERE EMPLID = :1 AND ADDRESS_TYPE = 'HOME' AND EFF_STATUS = 'A'",
&TYPE_6_REC.GPUS_PAYEE_ID.Value, &pyeAddr, &pyeCity, &pyeState, &pyePostal, &pyeCountry);

                        &TYPE_715_ADD.PROCESS_INSTANCE.Value =
&TYPE_6_REC.PROCESS_INSTANCE.Value;
                        &TYPE_715_ADD.GPUS_REC_TYPE.Value = "7";
                        &TYPE_715_ADD.GPUS_ADDENDA_TYPE.Value = "15";
                        &TYPE_715_ADD.GPUS_RCVR_ID.Value =
&TYPE_6_REC.GPUS_PAYEE_ID.Value;
                        &TYPE_715_ADD.GPUS_RCVR_ADDR.Value = Upper(&pyeAddr);
                        &TYPE_715_ADD.GPUS_RESERVED_34.Value = " ";
                        &TYPE_715_ADD.GPUS_TRACE_NBR7.Value = Left_Zero(&detail_trace_nbr,
7);

                        &File.WriteRecord(&TYPE_715_ADD);

                        &block_count = &block_count + 1;
                        If Mod(&block_count, 10) = 0 Then
                           &num_of_blocks = &num_of_blocks + 1;
                        End-If;

                        /**************************/
                        /* 16 addenda type record */
                        /**************************/
                        &TYPE_716_ADD.PROCESS_INSTANCE.Value =
&TYPE_6_REC.PROCESS_INSTANCE.Value;
                        &TYPE_716_ADD.GPUS_REC_TYPE.Value = "7";
                        &TYPE_716_ADD.GPUS_ADDENDA_TYPE.Value = "16";
                        &TYPE_716_ADD.GPUS_RCVR_CITY_ST.Value =
Upper(FormatCityState(&pyeCity, &pyeState));
                        &TYPE_716_ADD.GPUS_RCVR_CNTRY_PC.Value =
Upper(FormatCountryPostal(&pyeCountry, &pyePostal));
                        &TYPE_716_ADD.GPUS_RESERVED_14.Value = " ";
                        &TYPE_716_ADD.GPUS_TRACE_NBR7.Value = Left_Zero(&detail_trace_nbr,
7);

                        &File.WriteRecord(&TYPE_716_ADD);

                        &block_count = &block_count + 1;
                        If Mod(&block_count, 10) = 0 Then
                           &num_of_blocks = &num_of_blocks + 1;
                        End-If;

                     End-If;

                  End-While; /* Entry Detail Record */

                  /*****************************************************************/
                  /* Make sure Write Out Offset Record (6 type, TRANS_CD = '27')   */
                  /*****************************************************************/

/***********************************************************************/
                  /* Write Offset Record (6 record type, TRANS_CD = '27') - ONLY FOR PPD */

/***********************************************************************/
                  If &COMPANY_REC.GPUS_PYEACCT_IAT.Value = "N" Then
                     DoSetFileLayout("N");
                     &detail_trace_nbr = &detail_trace_nbr + 1;
                     &TYPE_6_REC.GPUS_TRANS_CD.Value = "27";
                     &TYPE_6_REC.GPUS_RCV_DFI_ID.Value = Substring(&SrcBankCD, 1, 8);
                     &TYPE_6_REC.GPUS_CHECK_DIGIT.Value = Substring(&SrcBankCD, 9, 1);
                     &TYPE_6_REC.ACCOUNT_NUM.Value = &SrcBankAcct; /* borrow the field for
Offset record */
                     &TYPE_6_REC.GPUS_PAYEE_ID.Value = "1" | &FEIN; /* borrow the field for
Offset record */
                     &TYPE_6_REC.GPUS_PMT_AMT.Value = Left_Zero(&deposit_amt_batch, 10);;
                     &TYPE_6_REC.GPUS_PAYEE_NAME.Value = &Company_nm; /* borrow the field for
Offset record */
                     &TYPE_6_REC.GPUS_TRACE_NBR.Value = &TYPE_6_REC.GPUS_RCV_DFI_ID.Value |
Left_Zero(&detail_trace_nbr, 7);
                     &File.WriteRecord(&TYPE_6_REC);

                     &entry_dtl_count_8rec = &entry_dtl_count_8rec + 1;
                     &entry_dtl_count_9rec = &entry_dtl_count_9rec + 1;
                     &block_count = &block_count + 1;
                     If Mod(&block_count, 10) = 0 Then
                        &num_of_blocks = &num_of_blocks + 1;
                     End-If;
                  /*******************************************************/
                  /* Write COMAPNY/BATCH CONTROL Record (8 type record) */
                  /*******************************************************/
                  End-If;

                  &TYPE_6_SQL.Close();

                  /******************************************************/
                  /* Write COMAPNY/BATCH CONTROL Record (8 type record) */
                  /******************************************************/
                  &TYPE_8_REC.GPUS_ENTRY_COUNT6.Value = Left_Zero(&entry_dtl_count_8rec,
6);
                    &TYPE_8_REC.GPUS_ENTRY_HASH.Value = Left_Zero(&batch_entry_hash, 10);
                    &TYPE_8_REC.GPUS_TOTAL_DEBIT.Value = Left_Zero(&deposit_amt_batch, 12);
                    &TYPE_8_REC.GPUS_TOTAL_CREDIT.Value = Left_Zero(&deposit_amt_batch, 12);
                    &TYPE_8_REC.FEDERAL_EIN.Value = &FEIN;
                    &TYPE_8_REC.GPUS_ORIGIN_DFI_ID.Value = Substring(&SrcBankCD, 1, 8);
                    &TYPE_8_REC.GPUS_BATCH_NBR.Value = Left_Zero(&company_batch, 7);
                    &File.WriteRecord(&TYPE_8_REC);

                    &batch_count = &batch_count + 1;
                    &block_count = &block_count + 1;
                    If Mod(&block_count, 10) = 0 Then
                       &num_of_blocks = &num_of_blocks + 1;
                    End-If;

                   &deposit_amt_file = &deposit_amt_file + &deposit_amt_batch;
                   &deposit_amt_batch = 0;
                End-While; /* BY PAYMENT DATE */

              End-While; /* Company Batch Control */

              /*******************************************************/
              /* Write FILE CONTROL RECORD (9 type record)           */
              /*******************************************************/
              /*********************************************/
              /* Write FILE CONTROL RECORD (9 type record) */
              /*********************************************/
              &num_of_blocks = &num_of_blocks + 1; /* need to be increased 1 due to the type
9 record */
           &TYPE_9_REC.GPUS_BATCH_COUNT.Value = Left_Zero(&batch_count, 6);
           &TYPE_9_REC.GPUS_BLOCK_COUNT.Value = Left_Zero(&num_of_blocks, 6);
           &TYPE_9_REC.GPUS_ENTRY_COUNT8.Value = Left_Zero(&entry_dtl_count_9rec, 8);
           &TYPE_9_REC.GPUS_ENTRY_HASH.Value = Left_Zero(&file_entry_hash, 10);
           &TYPE_9_REC.GPUS_TOTAL_DEBIT.Value = Left_Zero(&deposit_amt_file, 12);
           &TYPE_9_REC.GPUS_TOTAL_CREDIT.Value = Left_Zero(&deposit_amt_file, 12);
           &File.WriteRecord(&TYPE_9_REC);
           &block_count = &block_count + 1;
           /**************************************************************/
           /* Write out GPUS_EFT_FILR record (94 9's) to make the total */
           /* number of record in PPD file being the factor of 10.       */
           /* This is required by Both PPD and CTX banking file format! */
           /**************************************************************/
           /*************************************************************/
           /* Write out GPUS_EFT_FILR record (94 9's) to make the total */
           /* number of record in PPD file being the factor of 10.      */
           /* This is required by Both PPD and CTX banking file format! */
           /*************************************************************/
           If Mod(&block_count, 10) <> 0 Then
              For &p = 1 To 10 - Mod(&block_count, 10)
                 &File.WriteRecord(&FILLER_REC);
              End-For;
           End-If;
        Else
           GPUS_PPD_AET.ERROR_TYPE = "55"; /*Error Accessing FileLayout*/
        End-If;
     End-If;
  Else
     GPUS_PPD_AET.ERROR_TYPE = "56"; /*Error Opening File to Write*/
  End-If;

  &File.Close();

  /********************************************************/
  /* Clean Temp Table for generating next PPD File        */
  /********************************************************/
  &clean_sql = "DELETE FROM %Table(GPUS_EFT_COMPNY) ";
  /*************************************************/
  /* Clean Temp Table for generating next PPD File */
  /*************************************************/
  &clean_sql = "DELETE FROM %Table(GPUS_PPD_COMPNY) ";
  &clean_sql = &clean_sql | " WHERE PROCESS_INSTANCE = " |
GPUS_PPD_AET.PROCESS_INSTANCE.Value;
   SQLExec(&clean_sql);
   &clean_sql = "DELETE FROM %Table(GPUS_EFT_6REC) ";
   &clean_sql = &clean_sql | " WHERE PROCESS_INSTANCE = " |
GPUS_PPD_AET.PROCESS_INSTANCE.Value;
   SQLExec(&clean_sql);

End-While;

/***********************************************************/
/* IF No data selected for the EFT due to the parameters */
/* input from run control page, a blank file PPD001.TXT      */
/* need to be write out.                                     */
/***********************************************************/
/*********************************************************/
/* If No data selected for the EFT due to the parameters */
/* input from run control page, a blank file PPD001.TXT */
/* need to be write out.                                   */
/*********************************************************/
If &DataExist = "N" Then
   &File = GetFile("PPD001.TXT", "W");
   If &File.IsOpen Then
      If &File.SetFileLayout(FILELAYOUT.GPUS_EFT_PPD) Then
         MessageBox(0, " ", 0, 0, "No Data Selected. Processing Blank PPD File: PPD001.TXT");
         /*******************************************/
         /* Processing File Header Record             */
         /*******************************************/
         /*********************************/
         /* Processing File Header Record */
         /*********************************/
         &TYPE_1_REC.GPUS_EFT_CREATE_DT.Value = &FileCreationDate;
         &TYPE_1_REC.GPUS_EFT_CREATE_TM.Value = &FileCreationTime;
         &TYPE_1_REC.GPUS_BANK_CD.Value = "[NO DATA]";
         &TYPE_1_REC.GPUS_DEST_BANK_NM.Value = "[===NO DATA===]";
         SQLExec("Select DESCR from PS_COMPANY_TBL where COMPANY = :1",
GPUS_PPD_AET.COMPANY.Value, &Company_Name);
         &TYPE_1_REC.GPUS_ORIGIN_NAME.Value = Upper(&Company_Name);
         &TYPE_1_REC.FEDERAL_EIN.Value = GPUS_PPD_AET.FEDERAL_EIN.Value;
         &File.WriteRecord(&TYPE_1_REC);

         /*******************************************/
         /* Processing Company Header Record        */
         /*******************************************/
         /************************************/
         /* Processing Company Header Record */
         /************************************/
         &TYPE_5_REC.GPUS_SVC_CLASS_CD.Value = "000";
         &TYPE_5_REC.GPUS_COMPANY_NM.Value = "0000000000000000";
         &TYPE_5_REC.FEDERAL_EIN.Value = "000000000";
         &TYPE_5_REC.GPUS_PAY_END_DT.Value = "0000";
         &TYPE_5_REC.GPUS_CHECK_DT.Value = "0000";
         &TYPE_5_REC.GPUS_SETTLE_DT.Value = "000";
         &TYPE_5_REC.GPUS_ORIGIN_DFI_ID.Value = "000000000";
         &TYPE_5_REC.GPUS_BATCH_NBR.Value = "0000000";
         &File.WriteRecord(&TYPE_5_REC);

         /*******************************************/
         /* Processing Entry Detail Record          */
         /*******************************************/
         /**********************************/
         /* Processing Entry Detail Record */
         /**********************************/
         &TYPE_6_REC.GPUS_TRANS_CD.Value = "00";
         &TYPE_6_REC.GPUS_RCV_DFI_ID.Value = "00000000";
         &TYPE_6_REC.GPUS_CHECK_DIGIT.Value = "0";
         &TYPE_6_REC.ACCOUNT_NUM.Value = "00000000000000000000";
         &TYPE_6_REC.GPUS_PAYEE_ID.Value = "000000000";
         &TYPE_6_REC.GPUS_PMT_AMT.Value = "0000000000";
         &TYPE_6_REC.GPUS_PAYEE_NAME.Value = "0000000000000000";
         &TYPE_6_REC.GPUS_TRACE_NBR.Value = "000000000000000";
         &File.WriteRecord(&TYPE_6_REC);
               /*******************************************************/
               /* Write COMAPNY/BATCH CONTROL Record (8 type record) */
               /*******************************************************/
               /******************************************************/
               /* Write COMAPNY/BATCH CONTROL Record (8 type record) */
               /******************************************************/
               &TYPE_8_REC.GPUS_SVC_CLASS_CD.Value = "000";
               &TYPE_8_REC.GPUS_ENTRY_COUNT6.Value = "000000";
               &TYPE_8_REC.GPUS_ENTRY_HASH.Value = "0000000000";
               &TYPE_8_REC.GPUS_TOTAL_DEBIT.Value = "000000000000";
               &TYPE_8_REC.GPUS_TOTAL_CREDIT.Value = "000000000000";
               &TYPE_8_REC.FEDERAL_EIN.Value = "000000000";
               &TYPE_8_REC.GPUS_ORIGIN_DFI_ID.Value = "00000000";
               &TYPE_8_REC.GPUS_BATCH_NBR.Value = "0000000";
               &File.WriteRecord(&TYPE_8_REC);

               /*******************************************************/
               /* Write FILE CONTROL RECORD (9 type record)           */
               /*******************************************************/
               /*********************************************/
               /* Write FILE CONTROL RECORD (9 type record) */
               /*********************************************/
               &TYPE_9_REC.GPUS_BATCH_COUNT.Value = "000000";
               &TYPE_9_REC.GPUS_BLOCK_COUNT.Value = "000000";
               &TYPE_9_REC.GPUS_ENTRY_COUNT8.Value = "00000000";
               &TYPE_9_REC.GPUS_ENTRY_HASH.Value = "0000000000";
               &TYPE_9_REC.GPUS_TOTAL_DEBIT.Value = "000000000000";
               &TYPE_9_REC.GPUS_TOTAL_CREDIT.Value = "000000000000";
               &File.WriteRecord(&TYPE_9_REC);
               For &p = 1 To 5
                  &File.WriteRecord(&FILLER_REC);
               End-For;
               &File.Close();
            End-If;
         End-If;
      End-If;
      MessageBox(0, " ", 0, 0, "PPD File Generated Successfully!");
      /*********************************/
      /* END OF PEOPLE CODE PROCESS    */
      /*********************************/
      /*****************************/
      /* END OF PEOPLECODE PROCESS */
      /*****************************/




PeopleCode (ApplEng): GPUS_PPD_EFT.GET-DTL GBLdefault 1900-01-01.Step01.OnExecute
      /****************************************************************************/
      /* Construct SQL String for populating Detail Record GPUS_EFT_DTL           */
      /* from GP_PAYMENT and GP_PYMT_BNK_TBL                                      */
      /****************************************************************************/
      Local string &sql_str = "INSERT INTO %Table(GPUS_EFT_DTL)( PROCESS_INSTANCE,";
      &sql_str = &sql_str |
      "SRC_BANK_ID,COMPANY_DESCR,EMPLID,EMPL_RCD,PAY_ENTITY,CAL_RUN_ID,GP_PAYGROUP,";
      &sql_str = &sql_str |
      "SRC_BANK_ID,COMPANY,EMPLID,EMPL_RCD,PAY_ENTITY,CAL_RUN_ID,GP_PAYGROUP,";
      &sql_str = &sql_str |
      "CAL_ID,ORIG_CAL_RUN_ID,RSLT_SEG_NUM,PIN_NUM,INSTANCE,RECIPIENT_TAG,RECIPIENT_ID,";
      &sql_str = &sql_str |
      "RECIPIENT_NAME,DEBIT_DT,PMT_TYPE,GP_PMT_AMT,PYMT_ID,GPUS_BANK_CD,ACCOUNT_EC_ID,";
      &sql_str = &sql_str |
      "ACCOUNT_NAME,FEDERAL_EIN,GPUS_DEST_BANK_NM,PAY_END_DT,CHECK_DT,GPUS_PYEBANK_CD,";
      &sql_str = &sql_str |
      "GPUS_PYEACCT_ID,GPUS_PYEACCT_NM,ACCOUNT_TYPE_PYE,GPUS_PMT_AMT,GPUS_PAYEE_NAME,";
      &sql_str = &sql_str |
      "GPUS_PYEACCT_ID,GPUS_PYEACCT_NM,GPUS_PYEACCT_IAT,ACCOUNT_TYPE_PYE,GPUS_PMT_AMT,GPUS_PAYE
      E_NAME,";
      &sql_str = &sql_str | "FIRST_NAME,LAST_NAME,GPUS_EMPL_STATUS,GPUS_FAM_MED_IND,";
&sql_str = &sql_str | "GPUS_STATE,GPUS_GRN_CASEID,GPUS_FIPS,NATIONAL_ID )";

&sql_str = &sql_str | " SELECT DISTINCT " | GPUS_PPD_AET.PROCESS_INSTANCE.Value;
&sql_str = &sql_str |
",A.SRC_BANK_ID,'COMPANY_NAME',B.EMPLID,B.EMPL_RCD,A.PAY_ENTITY,B.CAL_RUN_ID,B.GP_PAYGROU
P,";
&sql_str = &sql_str |
",A.SRC_BANK_ID,'CMP',B.EMPLID,B.EMPL_RCD,A.PAY_ENTITY,B.CAL_RUN_ID,B.GP_PAYGROUP,";
&sql_str = &sql_str |
"B.CAL_ID,B.ORIG_CAL_RUN_ID,B.RSLT_SEG_NUM,B.PIN_NUM,B.INSTANCE,B.RECIPIENT_TAG,A.RECIPIE
NT_ID,";
&sql_str = &sql_str |
"A.RECIPIENT_NAME,A.DEBIT_DT,A.PMT_TYPE,B.GP_PMT_AMT,B.PYMT_ID,D.BANK_CD,D.ACCOUNT_EC_ID,
";
&sql_str = &sql_str |
"D.ACCOUNT_NAME,123456789,D.BANK_NM,A.SEG_END_DT,B.PYMT_DT,'BANK_CD','ACCOUNT_EC_ID',";
&sql_str = &sql_str |
"'ACCOUNT_NAME','C','0',%SubString(N1.NAME,1,22),N2.FIRST_NAME,N2.LAST_NAME,'N','Y',";
&sql_str = &sql_str |
"'ACCOUNT_NAME','N','C','0',%SubString(N1.NAME,1,22),N2.FIRST_NAME,N2.LAST_NAME,'N','Y',"
;
&sql_str = &sql_str | "'STATE','GRN_CASEID','FIPS_CD','555668888' ";

&sql_str = &sql_str | " FROM PS_GP_PYMT_BNK_TBL B, PS_GP_PAYMENT A, PS_GPUS_SRCBANK_VW D,
PS_PERSONAL_DATA N1, PS_NAMES_VW N2 ";

&sql_str   =   &sql_str   |   "   WHERE A.SRC_BANK_ID = D.SRC_BANK_ID";
&sql_str   =   &sql_str   |   "   AND A.CAL_RUN_ID = '" | GPUS_PPD_AET.CAL_RUN_ID.Value | "'";
&sql_str   =   &sql_str   |   "   AND A.CAL_RUN_ID = B.CAL_RUN_ID ";
&sql_str   =   &sql_str   |   "   AND A.EMPLID = B.EMPLID ";
&sql_str   =   &sql_str   |   "   AND A.EMPL_RCD = B.EMPL_RCD ";

&sql_str   =   &sql_str | "       AND A.EMPLID NOT IN ";
&sql_str   =   &sql_str | "           (SELECT SS.EMPLID FROM PS_GP_PAYMENT SS ";
&sql_str   =   &sql_str | "           WHERE SS.CAL_RUN_ID = '" | GPUS_PPD_AET.CAL_RUN_ID.Value | "'";
&sql_str   =   &sql_str | "              AND (SS.PMT_STATUS = 'V' OR SS.PMT_STATUS = 'W') ";
&sql_str   =   &sql_str | "              AND SS.PMT_TYPE = '01') ";
&sql_str   =   &sql_str | "       AND A.GP_PAYGROUP = B.GP_PAYGROUP ";
&sql_str   =   &sql_str | "       AND A.CAL_ID = B.CAL_ID ";
&sql_str   =   &sql_str | "       AND A.ORIG_CAL_RUN_ID = B.ORIG_CAL_RUN_ID ";
&sql_str   =   &sql_str | "       AND A.RSLT_SEG_NUM = B.RSLT_SEG_NUM ";
&sql_str   =   &sql_str | "       AND A.PIN_NUM = B.PIN_NUM ";
&sql_str   =   &sql_str | "       AND A.INSTANCE = B.INSTANCE ";
&sql_str   =   &sql_str | "       AND A.RECIPIENT_TAG = B.RECIPIENT_TAG ";
&sql_str   =   &sql_str | "       AND A.PYMT_ID = B.PYMT_ID ";
&sql_str   =   &sql_str | "       AND A.PYMT_NBR = B.PYMT_NBR ";
&sql_str   =   &sql_str | "       AND A.EMPLID = N1.EMPLID ";
&sql_str   =   &sql_str | "       AND A.EMPLID = N2.EMPLID ";
&sql_str   =   &sql_str | "       AND N2.NAME_TYPE = 'PRI' ";
&sql_str   =   &sql_str | "       AND A.PMT_TYPE = '01' ";
&sql_str   =   &sql_str | "       AND B.PAYMENT_MTHD1 = 'T' ";
&sql_str   =   &sql_str | "       AND A.PMT_STATUS = 'F' ";

/*********************************************************************************/
/* Construct SQL String Based on Run Control Parameters (PAY_ENTITY/SRC_BANK_ID) */
/*********************************************************************************/
If All(GPUS_PPD_AET.PAY_ENTITY.Value) Then
   &sql_str = &sql_str | " AND A.PAY_ENTITY = '" | GPUS_PPD_AET.PAY_ENTITY.Value | "'";
End-If;
If All(GPUS_PPD_AET.SRC_BANK_ID.Value) Then
   &sql_str = &sql_str | " AND A.SRC_BANK_ID = '" | GPUS_PPD_AET.SRC_BANK_ID.Value | "'";
End-If;

/****************************************************************************/
/* Execute SQL to Populate the Record GPUS_EFT_DTL                          */
/****************************************************************************/
SQLExec(&sql_str);
PeopleCode (ApplEng): GPUS_SM1_C.PROCESS GBLdefault 1900-01-01.Step30.OnExecute
      [ . . . Unchanged Code not Shown . . . ]


      Local File &ST_File;
      Local Record &RA_REC, &RE_REC, &RW_REC, &RO_REC, &RT_REC, &RU_REC, &RS_REC, &RV_REC,
      &REMD_REC, &MW508_REC, &RF_REC, &EE1_REC, &EE5_REC;
      Local SQL &SQL0, &SQL1, &SQL2, &SQL3, &SQL4, &SQL5, &SQL6, &SQL7, &SQL8, &SQL9, &SQL10, &SQL11,
      &SQL12, &SQL13, &SQL15;
      Local number &Count_U, &Third_party_tax, &Fed_Wages, &Fed_Wages_TY, &Fed_Tax, &Fed_Tax_TY,
      &SS_Wages, &SS_Tax, &Med_Wages, &Med_Tax, &SS_Tips, &Adv_EIC, &Dep_Care, &Non_Qual_457_N,
      &Non_Qual_457_Y, &Uncoll_Tax_On_Tips, &Group_Term_ER_Cost, &Ind_Adv_EIC;
      Local number &401K, &403B, &Roth_401K, &Roth_403B, &408K6, &457B, &501C18, &Uncoll_SS_Tax_GTL,
      &Uncoll_Med_Tax_GTL, &Nontaxable_Combat_Pay, &Nontaxable_Combat_Pay_T,
      &Basic_Qtrs_and_Subsist, &Med_Svgs_Acct, &HSA, &408P_Simple_Retirement, &Adoption_Exp,
      &Nonstatutory_Stock_Options, &Alloc_TIPS, &Spouse_SSN_PR, &Fed_Wages_T, &Fed_Tax_T,
      &SS_Wages_T, &SS_Tax_T;
      Local number &Med_Wages_T, &Med_Tax_T, &SS_Tips_T, &Adv_EIC_T, &Dep_Care_T,
      &Non_Qual_457_Y_T, &Non_Qual_457_N_T, &Group_Term_ER_Cost_T, &401K_T, &403B_T, &Roth_401K_T,
      &Roth_403B_T, &408K6_T, &457B_T, &501C18_T, &Nonstatutory_Stock_Options_T, &HSA_T;
      Local number &Fed_Wages_PR, &Commissions_PR, &Allow_Subj_Tax_PR, &Tips_Subj_Tax_PR,
      &Total_Comp_PR, &Fed_Tax_PR, &Retire_Fund_Contrib_PR, &Alloc_TIPS_U, &Uncoll_Tax_On_Tips_U,
      &NonQual_Def_Comp, &NonQual_Def_Comp_T, &Income_NonQual_Def_Comp,
      &Income_NonQual_Def_Comp_T, &Med_Svgs_Acct_U, &408P_Simple_Retirement_U, &Adoption_Exp_U,
      &Fed_Wages_PR_U, &Commissions_PR_U, &Allow_Subj_Tax_PR_U, &Tips_Subj_Tax_PR_U,
      &Total_Comp_PR_U, &Total_Comm_Allow_Tips, &Fed_Tax_PR_U;
      Local number &RV_State_Tax, &RV_State_Wages, &RV_EIC, &fwt_allow;
      Local number &Income_NonQual_Def_Comp_U, &Retire_Fund_Contrib_PR_U, &Fed_Wages_TY_U,
      &Fed_Tax_TY_U, &Uncoll_SS_Tax_GTL_U, &Uncoll_Med_Tax_GTL_U;
      Local number &Local_Wages, &Local_Tax, &State_Wages_T, &State_Tax_T, &Local_Wages_T,
      &Local_Tax_T, &Cost_Pension_Annuity_T, &CODA_Plans_T, &Reimbursed_Expense_T, &state_tax,
      &state_wages, &state_eic;
      Local number &MW508_LN2, &MW508_LN3, &MW508_LN3A, &MW508_LN4, &MW508_LN5, &MW508_LN6,
      &MW508_LN7, &MW508_LN8, &MW508_LN9, &MD_Emplr_Gross_Payroll, &State_Wages_F, &State_Tax_F;
      Local number &ID967_LN2, &ID967_LN3, &ID967_LN3A, &ID967_LN3B, &ID967_LN3C, &ID967_LN3D,
      &ID967_LN4, &ID967_LN5, &ID967_LN6, &ID967_LN7, &ID967_LN8, &ID967_LN9, &ID967_LN10,
      &ID967_LN11, &ID967_LN12;
      Local string &ID967_LN4_STR, &ID967_LN5_STR, &ID967_LN6_STR, &ID967_LN7_STR, &ID967_LN8_STR,
      &ID967_LN9_STR, &ID967_LN10_STR, &ID967_LN11_STR, &ID967_LN12_STR, &TotalPayments;
      Local string &State_Descr, &Country_2char, &Country, &Tax_Jurisdiction, &WriteORec,
      &TaxForm_Box, &trans_ein, &STATE_CD, &STATE_NUM_CD;
      Local integer &Count_F, &Count_C, &count_rt, &count_rs, &I, &L1, &L2, &L3;
      Local string &RW_Found, &RA_Found, &Write_RV, &Filename, &State_Wages_T1, &State_Tax_T1, &CH,
      &STR, &xmitterid, &WriteRE;
      Local string &v1, &v2, &v3, &v4, &v5, &v6, &RS_Count_Str, &fwt_allow_str, &Local_Wages_Str,
      &Local_Tax_Str, &RS_StateCode, &Address1, &Address2;
      Local date &cal_year;
      Local array &RE_ARRAY;
      Local string &YearStr, &MonthStr, &DayStr, &HourStr, &MinuteStr, &SecondStr;

      /* Temp Tables */
      &RA_REC = CreateRecord(Record.GPUS_RA_TMP);
      &RE_REC = CreateRecord(Record.GPUS_RE_TMP);
      &RW_REC = CreateRecord(Record.GPUS_RW_TMP);
      &RO_REC = CreateRecord(Record.GPUS_RO_TMP);
      &RS_REC = CreateRecord(Record.GPUS_RS_TMP);
      &RT_REC = CreateRecord(Record.GPUS_RT_TMP);
      &RU_REC = CreateRecord(Record.GPUS_RU_TMP);
      &RV_REC = CreateRecord(Record.GPUS_RV_S_TMP);
      &RF_REC = CreateRecord(Record.GPUS_RF_TMP);
      &EE5_REC = CreateRecord(Record.GPUS_YE_EE5_VW);
      &EE1_REC = CreateRecord(Record.GPUS_YE_EE1_VW);
      &IL_REC = CreateRecord(Record.GPUS_IL_TMP);
      &RE_ARRAY = CreateArrayAny();

      &Filename = "GPUS_SM1_C" | GPUS_SM1C_AET.GPUS_YE_STATE.Value;
      &ST_File = GetFile(&Filename, "W", %FilePath_Relative);
      &RA_Found = "N";
&RW_Found = "N";
&Write_RV = "N";
&cal_year = Date(GPUS_SM1C_AET.CALENDAR_YEAR.Value | "-12-31");
&OPRID = GPUS_SM1C_AET.OPRID.Value;
&RUN_CNTL_ID = GPUS_SM1C_AET.RUN_CNTL_ID.Value;

/*---RA and RE writing---*/
If &ST_File.IsOpen Then
   If &ST_File.SetFileLayout(FILELAYOUT.GPUS_SM1_C) Then

      Evaluate GPUS_SM1C_AET.GPUS_YE_STATE.Value
      When = "NC"
         SQLExec("SELECT 'Y' FROM PS_GPUS_YE_MMREFPA", &RA_Found);
         Break;
      When-Other
         &SQL0 = CreateSQL("%selectall(:1) WHERE PROCESS_INSTANCE = :2", &RA_REC,
GPUS_SM1C_AET.PROCESS_INSTANCE.Value);
         While &SQL0.Fetch(&RA_REC)
            &RA_Found = "Y";
            If GPUS_SM1C_AET.GPUS_YE_STATE.Value = "IL" Then
               &IL_REC.GPUS_BLNK_12.VALUE = "***HEADER***";
               &IL_REC.GPUS_BLNK_9.VALUE = "ILEFW2***";
               &IL_REC.GPUS_BLNK_491.VALUE = " ";
               &ST_File.WriteRecord(&IL_REC);
            End-If;
            &SQL2 = CreateSQL("SELECT COUNTRY,ADDRESS1,ADDRESS2,CITY,STATE,POSTAL FROM
PS_GPUS_YE_CO_TBL WHERE GPUS_TAX_EIN = :1 AND EFFDT = (SELECT MAX(EFFDT) FROM PS_GPUS_YE_CO_TBL
WHERE GPUS_TAX_EIN = :1 AND EFFDT <= %datein(:2))", &RA_REC.GPUS_TAX_EIN.Value, &cal_year);
            While &SQL2.Fetch(&v1, &v2, &v3, &v4, &v5, &v6)
               &RA_REC.COUNTRY.Value = &v1;
               &Address1 = Upper(&v2);
               &Address2 = Upper(&v3);
               &RA_REC.CITY.Value = Upper(&v4);
               &RA_REC.GPUS_CITY_1.Value = Upper(&v4);
               &RA_REC.STATE.Value = &v5;
               &RA_REC.GPUS_STATE_1.Value = &v5;
               &RA_REC.GPUS_BLNK_15.Value = &v6;
            End-While;

             &RA_REC.GPUS_COMPANY.Value = Upper(RTrim(LTrim(&RA_REC.GPUS_COMPANY.Value, "
"), " "));
            /* On the EFW2 layout, Address 1 is at the Location address offset and Address
2 is at
the Delivery address offset. If both address lines are populated then line 1 is typically the
Location address and line 2 is the Delivery address. if only line 1 is populated then typically
this will be the Delivery address. */

             If All(&Address1) And
                   All(&Address2) Then
                &RA_REC.ADDRESS1.Value = &Address1;
                &RA_REC.ADDRESS2.Value = &Address2;
                &RA_REC.GPUS_ADDRESS1_1.Value = &Address1;
                &RA_REC.GPUS_ADDRESS2_1.Value = &Address2;
             Else
                &RA_REC.ADDRESS1.Value = &Address2;
                &RA_REC.ADDRESS2.Value = &Address1;
                &RA_REC.GPUS_ADDRESS1_1.Value = &Address2;
                &RA_REC.GPUS_ADDRESS2_1.Value = &Address1;
             End-If;
             &RA_REC.CITY.Value = Upper(RTrim(LTrim(&RA_REC.CITY.Value, " "), " "));
             &trans_ein = &RA_REC.GPUS_TAX_EIN.Value;
             &RA_REC.CONTACT_NAME.Value = &RA_REC.GPUS_COMPANY.Value;

             &RA_REC.GPUS_CONTCT_NM_1.Value = Upper(&RA_REC.GPUS_CONTCT_NM_1.Value);


             /* To do for foreign Address */
             If &RA_REC.COUNTRY.Value = "USA" Then
                If &RA_REC.GPUS_BLNK_15.Value <> "" Then
                   &RA_REC.ZIP.Value = Substring(&RA_REC.GPUS_BLNK_15.Value, 1, 5);
                   &RA_REC.GPUS_ZIPEXTN.Value = Substring(&RA_REC.GPUS_BLNK_15.Value, 7,
10);
                   &RA_REC.GPUS_ZIP_1.Value = Substring(&RA_REC.GPUS_BLNK_15.Value, 1, 5);
                   &RA_REC.GPUS_ZIPEXTN_1.Value = Substring(&RA_REC.GPUS_BLNK_15.Value, 7,
10);
               End-If;
               &RA_REC.COUNTRY.Value = "";
               &RA_REC.GPUS_BLNK_2.Value = "";
               &RA_REC.GPUS_BLNK_15.Value = "";
               &RA_REC.GPUS_BLNK_15_1.Value = " ";
               &RA_REC.GPUS_BLNK_23.Value = "";
            Else
               If &RA_REC.STATE.Value <> "" Then
                  &SQL1 = CreateSQL("SELECT DESCR FROM %Table(STATE_NAMES_TBL) WHERE COUNTRY
= :1 AND STATE = :2", &RA_REC.COUNTRY.Value, &RA_REC.STATE.Value, &State_Descr);
                  While &SQL1.Fetch(&State_Descr)
                     &RA_REC.GPUS_BLNK_23.Value = Upper(&State_Descr);
                     &RA_REC.GPUS_BLNK_23_1.Value = Upper(&State_Descr);
                  End-While;
               End-If;
               &SQL2 = CreateSQL("SELECT COUNTRY_2CHAR FROM %Table(COUNTRY_TBL) WHERE COUNTRY
= :1", &RA_REC.COUNTRY.Value, &Country);
               While &SQL2.Fetch(&Country)
                  &RA_REC.COUNTRY.Value = &Country;
                  &RA_REC.GPUS_BLNK_2.Value = &Country;
               End-While;
               &RA_REC.STATE.Value = "";
               &RA_REC.ZIP.Value = "";
               &RA_REC.GPUS_ZIP_1.Value = "";
               &RA_REC.GPUS_STATE_1.Value = "";
               &RA_REC.GPUS_BLNK_15_1.Value = &RA_REC.GPUS_BLNK_15.Value;
            End-If;

             If &RA_REC.GPUS_RESUB_IND.Value <> "1" Then
                &RA_REC.GPUS_RESUB_WFID.Value = " ";
             End-If;
             &RA_REC.GPUS_SWCODE.Value = "99";
             Evaluate GPUS_SM1C_AET.GPUS_YE_STATE.Value
             When "MA"
                &RA_REC.GPUS_VENDOR_CODE.Value = " ";
                &RA_REC.GPUS_NOTIFY_METHOD.Value = " ";
                &RA_REC.GPUS_PREPCODE.Value = " ";
                &RA_REC.GPUS_EMPLR_PIN.Value = " ";
                &RA_REC.GPUS_RESUB_WFID.Value = " ";
                &RA_REC.GPUS_SWCODE.Value = " ";
                Break;
             End-Evaluate;
             &ST_File.WriteRecord(&RA_REC);
          End-While;
          Break;
       End-Evaluate;

       If &RA_Found = "N" Then
          MessageBox(0, "", 17290, 95, "Message not found."); /* MMREF Parameters not Setup
*/
      End-If;
   Else
      MessageBox(0, "", 17295, 7, "Message not found."); /* file layout not correct */
   End-If;
Else
   MessageBox(0, "", 17295, 8, "Message not found.", &Filename); /* file not open */
End-If;


If &RA_Found = "Y" Then

   &SQL3 = CreateSQL("SELECT
A.GPUS_TAX_EIN,PA.EMPLR_PIN,%DateOut(A.GPUS_BUS_TERM_DT),A.GPUS_OTHER_EIN,A.DESCR,A.ADDRE
SS1,A.ADDRESS2,A.COUNTRY,A.CITY,A.STATE ,A.POSTAL ,PA.GPUS_EMPLYMNT_TYPE,A.GPUS_YE_RPT_CO
FROM PS_GPUS_YE_MMREFCO EIN,PS_GPUS_YE_MMREFPA PA,PS_GPUS_YE_CO_TBL A WHERE A.GPUS_YE_RPT_CO
= EIN.GPUS_YE_RPT_CO AND A.EFFDT = (SELECT MAX(EFFDT) FROM PS_GPUS_YE_CO_TBL WHERE
GPUS_YE_RPT_CO = A.GPUS_YE_RPT_CO AND EFFDT <= %DateIn(:1)) ORDER BY A.GPUS_TAX_EIN",
&cal_year, &RE_ARRAY);
   While &SQL3.Fetch(&RE_ARRAY)
      &federal_ein = &RE_ARRAY [1];
      /* Assign values to RE */
      &RE_REC.GPUS_REC_ID.Value = "RE";
      &RE_REC.CALENDAR_YEAR.Value = GPUS_SM1C_AET.CALENDAR_YEAR.Value;
      &RE_REC.GPUS_AGENT_IND.Value = "";
      &RE_REC.EMPLR_PIN.Value = Substring(&federal_ein, 1, 9);
      &RE_REC.GPUS_BLNK_9.Value = "";
      If &RE_ARRAY [4] = "" Then
         &RE_REC.BUSI_TERM_IND.Value = "0";
      Else
         &RE_REC.BUSI_TERM_IND.Value = "1";
      End-If;
      &RE_REC.GPUS_EST_NUM.Value = "";
      &RE_REC.GPUS_OTHER_EIN.Value = &RE_ARRAY [3];
      &RE_REC.DESCR.Value = Upper(&RE_ARRAY [5]);
      &Address1 = Upper(&RE_ARRAY [6]);
      &Address2 = Upper(&RE_ARRAY [7]);
      /* On the EFW2 layout, Address 1 is at the Location address offset and Address 2 is
at
the Delivery address offset. If both address lines are populated then line 1 is typically the
Location address and line 2 is the Delivery address. if only line 1 is populated then typically
this will be the Delivery address. */
      If All(&Address1) And
            All(&Address2) Then
         &RE_REC.ADDRESS1.Value = &Address1;
         &RE_REC.ADDRESS2.Value = &Address2;
      Else
         &RE_REC.ADDRESS1.Value = &Address2;
         &RE_REC.ADDRESS2.Value = &Address1;
      End-If;

      &RE_REC.CITY.Value = Upper(&RE_ARRAY [9]);
      &RE_REC.STATE.Value = &RE_ARRAY [10];

      /* Foreign Address */
      If &RE_ARRAY [8] = "USA" Then
         If &RE_ARRAY [11] <> "" Then
            &RE_REC.ZIP.Value = Substring(&RE_ARRAY [11], 1, 5);
            &RE_REC.GPUS_ZIPEXTN.Value = Substring(&RE_ARRAY [11], 7, 10);
            &RE_ARRAY [11] = " ";
         End-If;
      Else
         If None(&RE_ARRAY [10]) Then
            &SQL4 = CreateSQL("SELECT DESCR FROM %Table(STATE_NAMES_TBL) WHERE COUNTRY = :1
AND STATE = :2", &RE_ARRAY [8], &RE_ARRAY [10], &State_Descr);
            While &SQL4.Fetch(&State_Descr)
               &RE_REC.GPUS_BLNK_23.Value = &State_Descr;
            End-While;
         End-If;

         &SQL5 = CreateSQL("SELECT COUNTRY_2CHAR FROM %Table(COUNTRY_TBL) WHERE COUNTRY = :1",
&RE_ARRAY [8], &Country);
         While &SQL5.Fetch(&Country)
            &RE_REC.GPUS_BLNK_2.Value = &Country;
         End-While;

         &RE_REC.ZIP.Value = " ";
         &RE_REC.GPUS_ZIPEXTN.Value = " ";
      End-If; /* End of Foreign Address */


      &RE_REC.GPUS_BLNK_15.Value = " ";
      &RE_REC.GPUS_BLNK_15.Value = &RE_ARRAY [11];
      &RE_REC.GPUS_EMPLYMNT_TYPE.Value = &RE_ARRAY [12];

      Evaluate GPUS_SM1C_AET.GPUS_YE_STATE.Value
      When = "AS"
         &RE_REC.GPUS_TAX_JURISDCTN.Value = "20";
         Break;
      When = "GU"
         &RE_REC.GPUS_TAX_JURISDCTN.Value   = "30";
         Break;
      When = "PR"
         &RE_REC.GPUS_TAX_JURISDCTN.Value   = "40";
         Break;
      When = "VI"
         &RE_REC.GPUS_TAX_JURISDCTN.Value   = "50";
         Break;
      When-Other
         &RE_REC.GPUS_TAX_JURISDCTN.Value   = " ";
      End-Evaluate;

      If None(&RE_ARRAY [3]) Then
         &RE_REC.GPUS_OTHER_EIN.Value = " ";
      End-If;

      &RPT_COMPANY = &RE_ARRAY [13];

      &SQL3_STEIN = CreateSQL("SELECT GPUS_SWT_EIN FROM %TABLE(GPUS_CO_ST_TAX) WHERE COMPANY
= :1 AND STATE = :2 AND EFFDT = (SELECT MAX(EFFDT) FROM %TABLE(GPUS_CO_ST_TAX) WHERE COMPANY
= :1 AND STATE = :2 AND EFFDT <= %datein(:3))", &RPT_COMPANY,
GPUS_SM1C_AET.GPUS_YE_STATE.Value, &cal_year, &swt_ein);

      While &SQL3_STEIN.FETCH(&swt_ein)
         &state_ein = &swt_ein;
      End-While;

      &RE_REC.GPUS_THRDPRTY_IND.Value = "0";
      If GPUS_SM1C_AET.GPUS_YE_STATE.Value = "MA" Or
            GPUS_SM1C_AET.GPUS_YE_STATE.Value = "PA" Then
         &RE_REC.GPUS_THRDPRTY_IND.Value = " ";
      End-If;

      Evaluate GPUS_SM1C_AET.GPUS_YE_STATE.Value
      When "MD"
         &YearStr = NumberToString("%04t", Year(%Date));
         &MonthStr = NumberToString("%02t", Month(%Date));
         &DayStr = NumberToString("%02t", Day(%Date));
         &HourStr = NumberToString("%02t", Hour(%Datetime));
         &MinuteStr = NumberToString("%02t", Minute(%Datetime));
         &SecondStr = NumberToString("%02t", Second(%Datetime));
         &RE_REC.GPUS_BLNK_291.Value = &state_ein | Rept(" ", 267) | &YearStr | &MonthStr |
&DayStr | &HourStr | &MinuteStr | &SecondStr | "00";
         Break;
      When "PA"
         &RE_REC.GPUS_BLNK_291.Value = Rept(" ", 283) | Left(&state_ein, 8);
         Break;
      When-Other
         &RE_REC.GPUS_BLNK_291.Value = " ";
      End-Evaluate;

      &WriteRE = "Y";
      /* FETCH ALL RW AND PRINT */
      &SQL6 = CreateSQL("%selectall(:1) WHERE GPUS_TAX_EIN = :2 AND GPUS_YE_STATE = :3 AND
GPUS_TAXFORM_ID = '10' AND GPUS_YE_STATUS = '10' AND GPUS_CAL_YEAR = :4", &EE5_REC, &RE_ARRAY
[1], GPUS_SM1C_AET.GPUS_YE_STATE.Value, GPUS_SM1C_AET.CALENDAR_YEAR.Value);
      While &SQL6.Fetch(&EE5_REC)
         /* Write RE Record */
         If &WriteRE = "Y" Then
            &ST_File.WriteRecord(&RE_REC);
            &Write_RV = "Y";
            &WriteRE = "N";
         End-If;
         &RW_Found = "Y";
         &WriteORec = "N";
         &SQL7 = CreateSQL("%selectall(:1) WHERE EMPLID=:2 AND GPUS_CAL_YEAR = :3 AND
GPUS_TAX_EIN = :4 AND GPUS_SEQ_NBR = :5", &EE1_REC, &EE5_REC.EMPLID.Value,
&EE5_REC.GPUS_CAL_YEAR.Value, &EE5_REC.GPUS_TAX_EIN.Value, &EE5_REC.GPUS_SEQ_NBR.Value);
         While &SQL7.Fetch(&EE1_REC)
            Evaluate &EE1_REC.GPUS_TAXFORM_BOX.Value
When = "01"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &Fed_Wages = &EE1_REC.GPUS_YE_AMOUNT.Value;
   Else
      &Fed_Wages_TY = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "02"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &Fed_Tax = &EE1_REC.GPUS_YE_AMOUNT.Value;
   Else
      &Fed_Tax_TY = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "03"
   &SS_Wages = &EE1_REC.GPUS_YE_AMOUNT.Value;
   Break;
When = "04"
   &SS_Tax = &EE1_REC.GPUS_YE_AMOUNT.Value;
   Break;
When = "05"
   &Med_Wages = &EE1_REC.GPUS_YE_AMOUNT.Value;
   Break;
When = "06"
   &Med_Tax = &EE1_REC.GPUS_YE_AMOUNT.Value;
   Break;
When = "07"
   &SS_Tips = &EE1_REC.GPUS_YE_AMOUNT.Value;
   Break;
When = "08"
   &WriteORec = "Y";
   &Alloc_TIPS = &EE1_REC.GPUS_YE_AMOUNT.Value;
   Break;
When = "09"
   &Adv_EIC = &EE1_REC.GPUS_YE_AMOUNT.Value;
   Break;
When = "10"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &Dep_Care = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "11A"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &Non_Qual_457_Y = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "11B"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &Non_Qual_457_N = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "12A"
When = "12B"
   &WriteORec = "Y";
   &Uncoll_Tax_On_Tips = &Uncoll_Tax_On_Tips + &EE1_REC.GPUS_YE_AMOUNT.Value;
   Break;
When = "12C"
   &Group_Term_ER_Cost = &EE1_REC.GPUS_YE_AMOUNT.Value;
   Break;
When = "12D"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &401K = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "12E"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &403B = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "12F"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &408K6 = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "12G"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &457B = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "12H"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &501C18 = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "12N"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &WriteORec = "Y";
      &Uncoll_Med_Tax_GTL = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "12M"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &WriteORec = "Y";
      &Uncoll_SS_Tax_GTL = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "12Q"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &Nontaxable_Combat_Pay = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "12R"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &WriteORec = "Y";
      &Med_Svgs_Acct = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "12S"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &WriteORec = "Y";
      &408P_Simple_Retirement = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "12T"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &WriteORec = "Y";
      &Adoption_Exp = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "12V"
   &Nonstatutory_Stock_Options = &EE1_REC.GPUS_YE_AMOUNT.Value;
   Break;
When = "12W"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &HSA = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "12Y"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &WriteORec = "Y";
      &NonQual_Def_Comp = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "12Z"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &WriteORec = "Y";
      &Income_NonQual_Def_Comp = &EE1_REC.GPUS_YE_AMOUNT.Value;
   End-If;
   Break;
When = "12AA"
   If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
      &Roth_401K = &EE1_REC.GPUS_YE_AMOUNT.Value;
               End-If;
               Break;
            When = "12BB"
               If &EE1_REC.GPUS_TAXFORM_ID.Value = "10" Then
                  &Roth_403B = &EE1_REC.GPUS_YE_AMOUNT.Value;
               End-If;
               Break;
            When "16"
               &state_wages = &EE1_REC.GPUS_YE_AMOUNT.Value;
               Break;
            When "17"
               &state_tax = &EE1_REC.GPUS_YE_AMOUNT.Value;
               Break;
            When "18"
               &Local_Wages = &EE1_REC.GPUS_YE_AMOUNT.Value;
               Break;
            When "19"
               &Local_Tax = &EE1_REC.GPUS_YE_AMOUNT.Value;
               Break;
            When "19B"
               &state_eic = &EE1_REC.GPUS_YE_AMOUNT.Value;
               Break;
            End-Evaluate;
         End-While;

         &SQL15 = CreateSQL("SELECT NUMERIC_CD FROM %Table(STATE_TBL) WHERE COUNTRY = 'USA'
AND STATE = :1", &EE5_REC.GPUS_YE_STATE.Value, &STATE_NUM_CD);
         While &SQL15.Fetch(&STATE_NUM_CD)
            &RS_StateCode = &STATE_NUM_CD
         End-While;

         /* RW RECORD */
         &RW_REC.GPUS_BLNK_15.Value = &EE5_REC.POSTAL.Value;
         /* Foreign Address */
         If &EE5_REC.COUNTRY.Value = "USA" Then
            If &EE5_REC.POSTAL.Value <> "" Then
               &RW_REC.ZIP.Value = Substring(&EE5_REC.POSTAL.Value, 1, 5);
               &RW_REC.GPUS_ZIPEXTN.Value = Substring(&EE5_REC.POSTAL.Value, 7, 10);
               &RW_REC.GPUS_BLNK_15.Value = " ";
            End-If;
         Else
            If None(&EE5_REC.STATE.Value) Then
               &SQL9 = CreateSQL("SELECT DESCR FROM %Table(STATE_NAMES_TBL) WHERE COUNTRY =
:1 AND STATE = :2", &EE5_REC.COUNTRY.Value, &EE5_REC.STATE.Value, &State_Descr);
               While &SQL9.Fetch(&State_Descr)
                  &RW_REC.GPUS_BLNK_23.Value = &State_Descr;
               End-While;
            End-If;
            &SQL10 = CreateSQL("SELECT COUNTRY_2CHAR FROM %Table(COUNTRY_TBL) WHERE COUNTRY
= :1", &EE5_REC.COUNTRY.Value, &Country_2char);
            While &SQL10.Fetch(&Country_2char)
               &RW_REC.GPUS_BLNK_2.Value = &Country_2char;
            End-While;
            &RW_REC.ZIP.Value = " ";
            &RW_REC.GPUS_ZIPEXTN.Value = " ";
         End-If; /* End of Foreign Address */

         If &EE5_REC.GPUS_YE_STATUS.Value = "Y" Then
            &RW_REC.GPUS_YE_STATUS.Value = "1";
         Else
            &RW_REC.GPUS_YE_STATUS.Value = "0";
         End-If;
         If &EE5_REC.GPUS_PENSION_FLAG.Value = "Y" Then
            &RW_REC.GPUS_RET_IND.Value = "1";
         Else
            &RW_REC.GPUS_RET_IND.Value = "0";
         End-If;

         If &EE5_REC.GPUS_3SICKPAY_FLAG.Value = "Y" Then
            &RW_REC.GPUS_THRDPRTY_IND.Value = "1";
         Else
            &RW_REC.GPUS_THRDPRTY_IND.Value = "0";
         End-If;
         &RW_REC.GPUS_REC_ID.Value = "RW";
         &RW_REC.SSN.Value = &EE5_REC.SSN.Value;
         &RW_REC.GPUS_YE_FNAME.Value = Upper(&EE5_REC.GPUS_YE_FNAME.Value);
         &RW_REC.GPUS_YE_MNAME.Value = Upper(&EE5_REC.GPUS_YE_MNAME.Value);
         &RW_REC.GPUS_YE_LNAME.Value = Upper(&EE5_REC.GPUS_YE_LNAME.Value);
         &RW_REC.GPUS_YE_SUFFIX.Value = Upper(&EE5_REC.GPUS_YE_SUFFIX.Value);
         &Address1 = Upper(&EE5_REC.ADDRESS1.Value);
         &Address2 = Upper(&EE5_REC.ADDRESS2.Value);
         /* On the EFW2 layout, Address 1 is at the Location address offset and Address 2
is at
the Delivery address offset. If both address lines are populated then line 1 is typically the
Location address and line 2 is the Delivery address. if only line 1 is populated then typically
this will be the Delivery address. */
         If All(&Address1) And
               All(&Address2) Then
            &RW_REC.ADDRESS1.Value = &Address1;
            &RW_REC.ADDRESS2.Value = &Address2;
         Else
            &RW_REC.ADDRESS1.Value = &Address2;
            &RW_REC.ADDRESS2.Value = &Address1;
         End-If;

         &RW_REC.CITY.Value = Upper(&EE5_REC.CITY.Value);
         &RW_REC.STATE.Value = &EE5_REC.STATE.Value;
         &RW_REC.GPUS_BLNK_5.Value = " ";
         &RW_REC.GPUS_WAGES.Value = FLFormat(&Fed_Wages, 11, "0");
         &RW_REC.GPUS_FWT.Value = FLFormat(&Fed_Tax, 11, "0");
         &RW_REC.GPUS_SSWAGES.Value = FLFormat(&SS_Wages, 11, "0");
         &RW_REC.GPUS_SSTX_WHLD.Value = FLFormat(&SS_Tax, 11, "0");
         &RW_REC.GPUS_MEDCR_WG.Value = FLFormat(&Med_Wages, 11, "0");
         &RW_REC.GPUS_MEDCR_WHLD.Value = FLFormat(&Med_Tax, 11, "0");
         &RW_REC.GPUS_SS_TIPS.Value = FLFormat(&SS_Tips, 11, "0");
         &RW_REC.GPUS_AEIC.Value = FLFormat(Abs(&Adv_EIC), 11, "0");
         &RW_REC.GPUS_DEP_CB.Value = FLFormat(&Dep_Care, 11, "0");
         &RW_REC.GPUS_DEF_401K.Value = FLFormat(&401K, 11, "0");
         &RW_REC.GPUS_DEF_403B.Value = FLFormat(&403B, 11, "0");
         &RW_REC.GPUS_DEF_408K.Value = FLFormat(&408K6, 11, "0");
         &RW_REC.GPUS_DEF_457B.Value = FLFormat(&457B, 11, "0");
         &RW_REC.GPUS_DEF_501C.Value = FLFormat(&501C18, 11, "0");
         &RW_REC.GPUS_BLNK_11.Value = Rept("0", 11);
         &RW_REC.GPUS_NQPS_457.Value = FLFormat(&Non_Qual_457_Y, 11, "0");
         &RW_REC.GPUS_HSA.Value = FLFormat(&HSA, 11, "0");
         &RW_REC.GPUS_NQNS_457.Value = FLFormat(&Non_Qual_457_N, 11, "0");
         &RW_REC.GPUS_NTAX_COMB_PAY.Value = FLFormat(&Nontaxable_Combat_Pay, 11, "0");
         &RW_REC.GPUS_NQDEFC_PL.Value = FLFormat(&NonQual_Def_Comp, 11, "0");
         &RW_REC.GPUS_BLNK_11_2.Value = " ";
         &RW_REC.GPUS_ERC_GTLI.Value = FLFormat(&Group_Term_ER_Cost, 11, "0");
         &RW_REC.GPUS_EX_NSSO.Value = FLFormat(&Nonstatutory_Stock_Options, 11, "0");
         &RW_REC.GPUS_ROTH_401K.Value = FLFormat(&401K, 11, "0");
         &RW_REC.GPUS_ROTH_403B.Value = FLFormat(&403B, 11, "0");

         &RW_REC.GPUS_BLNK_23_2.Value = " ";
         &RW_REC.GPUS_BLNK_1.Value = " ";
         &RW_REC.GPUS_BLNK_23_1.Value = " ";

         /* Write Employee Record (RW) */
         Evaluate GPUS_SM1C_AET.GPUS_YE_STATE.Value
         When "AL"
         When "CO"
         When "CT"
         When "DE"
         When "LA"
         When "ME"
         When "MA"
         When "MD"
         When "PA"
         When "RI"
         When "VA"
            Break;
        When-Other
           &ST_File.WriteRecord(&RW_REC);
           Break;
        End-Evaluate;

        &count_rt = &count_rt + 1;
        &Count_F = &Count_F + 1;

         &Fed_Wages_T = &Fed_Wages_T + &Fed_Wages;
         &Fed_Tax_T = &Fed_Tax_T + &Fed_Tax;
         &SS_Wages_T = &SS_Wages_T + &SS_Wages;
         &SS_Tax_T = &SS_Tax_T + &SS_Tax;
         &Med_Wages_T = &Med_Wages_T + &Med_Wages;
         &Med_Tax_T = &Med_Tax_T + &Med_Tax;
         &SS_Tips_T = &SS_Tips_T + &SS_Tips;
         &Adv_EIC_T = &Adv_EIC_T + &Adv_EIC;
         &Dep_Care_T = &Dep_Care_T + &Dep_Care;
         &Non_Qual_457_Y_T = &Non_Qual_457_Y_T + &Non_Qual_457_Y;
         &Non_Qual_457_N_T = &Non_Qual_457_N_T + &Non_Qual_457_N;
         &HSA_T = &HSA_T + &HSA;
         &Group_Term_ER_Cost_T = &Group_Term_ER_Cost_T + &Group_Term_ER_Cost;
         &401K_T = &401K_T + &401K;
         &403B_T = &403B_T + &403B;
         &408K6_T = &408K6_T + &408K6;
         &457B_T = &457B_T + &457B;
         &501C18_T = &501C18_T + &501C18;
         &Nonstatutory_Stock_Options_T = &Nonstatutory_Stock_Options_T +
&Nonstatutory_Stock_Options;
         &NonQual_Def_Comp_T = &NonQual_Def_Comp_T + &NonQual_Def_Comp;
         &Nontaxable_Combat_Pay_T = &Nontaxable_Combat_Pay_T + &Nontaxable_Combat_Pay;
         &Roth_401K_T = &Roth_401K_T + &Roth_401K;
         &Roth_403B_T = &Roth_403B_T + &Roth_403B;

        &SS_Wages = 0;
        &Med_Wages = 0;
        &SS_Tips = 0;
        &Ind_Adv_EIC = &Adv_EIC;
        &Adv_EIC = 0;
        &Dep_Care = 0;
        &Non_Qual_457_Y = 0;
        &Non_Qual_457_N = 0;
        &HSA = 0;
        &Group_Term_ER_Cost = 0;
        &401K = 0;
        &403B = 0;
        &408K6 = 0;
        &457B = 0;
        &501C18 = 0;
        &Nonstatutory_Stock_Options = 0;
        &NonQual_Def_Comp = 0;
        &Nontaxable_Combat_Pay = 0;
        &Roth_401K = 0;
        &Roth_403B = 0;

        /* RO Records */
        If &WriteORec = "Y" Then
           &RO_REC.GPUS_REC_ID.Value = "RO";
           &RO_REC.GPUS_BLNK_9.Value = " ";
           &RO_REC.GPUS_ALL_TIPS.Value = FLFormat(&Alloc_TIPS, 11, "0");
           &RO_REC.GPUS_UETX_TIP.Value = FLFormat(&Uncoll_Tax_On_Tips, 11, "0");
           &RO_REC.GPUS_MDS_ACCT.Value = FLFormat(&Med_Svgs_Acct, 11, "0");
           &RO_REC.GPUS_SRET_ACCT.Value = FLFormat(&408P_Simple_Retirement, 11, "0");
           &RO_REC.GPUS_QA_EXP.Value = FLFormat(&Adoption_Exp, 11, "0");
           &RO_REC.GPUS_UCSS_TLI.Value = FLFormat(&Uncoll_SS_Tax_GTL, 11, "0");
           &RO_REC.GPUS_UMT_TLI.Value = FLFormat(&Uncoll_Med_Tax_GTL, 11, "0");
           &RO_REC.GPUS_INC_NQDEFC_PL.Value = FLFormat(&Income_NonQual_Def_Comp, 11, "0");
           &RO_REC.GPUS_BLANK_165.Value = " ";
           &RO_REC.GPUS_YE_STATUS.Value = " ";
           &RO_REC.GPUS_BLNK_9_1.Value = " ";
           &RO_REC.GPUS_WG_PR.Value = FLFormat(&Fed_Wages_PR, 11, "0");
           &RO_REC.GPUS_COM_PR.Value = FLFormat(&Commissions_PR, 11, "0");
           &RO_REC.GPUS_AL_PR.Value = FLFormat(&Allow_Subj_Tax_PR, 11, "0");
           &RO_REC.GPUS_TIPS_PR.Value = FLFormat(&Tips_Subj_Tax_PR, 11, "0");
           &RO_REC.GPUS_TOTWG_PR.Value = FLFormat(&Total_Comp_PR, 11, "0");
           &RO_REC.GPUS_TXWHLD_PR.Value = FLFormat(&Fed_Tax_PR, 11, "0");
           &RO_REC.GPUS_RFAC.Value = FLFormat(&Retire_Fund_Contrib_PR, 11, "0");
           &RO_REC.GPUS_BLNK_11.Value = " ";
           &RO_REC.GPUS_BLNK_128.Value = " ";
           &RO_REC.GPUS_ITWHLD_VI.Value = FLFormat(&Fed_Tax_TY, 11, "0");
           &RO_REC.GPUS_TOTWG_VI.Value = FLFormat(&Fed_Wages_TY, 11, "0");

            /* Write RO Record */
            Evaluate GPUS_SM1C_AET.GPUS_YE_STATE.Value
            When "AL"
            When "AR"
            When "CO"
            When "CT"
            When "DE"
            When "LA"
            When "ME"
            When "MA"
            When "MD"
            When "ND"
            When "PA"
            When "RI"
            When "VA"
            When "KS"
            When "ME"
            When "NC"
            When "OH"
            When "SC"
            When "UT"
            When "WI"
               Break;
            When-Other
               &ST_File.WriteRecord(&RO_REC);
            End-Evaluate;
            &Count_U = &Count_U + 1;
            &Count_V = &Count_V + 1;
            &Alloc_TIPS_U = &Alloc_TIPS_U + &Alloc_TIPS;
            &Uncoll_Tax_On_Tips_U = &Uncoll_Tax_On_Tips_U + &Uncoll_Tax_On_Tips;
            &Med_Svgs_Acct_U = &Med_Svgs_Acct_U + &Med_Svgs_Acct;
            &408P_Simple_Retirement_U = &408P_Simple_Retirement_U +
&408P_Simple_Retirement;
            &Adoption_Exp_U = &Adoption_Exp_U + &Adoption_Exp;
            &Fed_Wages_PR_U = &Fed_Wages_PR_U + &Fed_Wages_PR;
            &Commissions_PR_U = &Commissions_PR_U + &Commissions_PR;
            &Allow_Subj_Tax_PR_U = &Allow_Subj_Tax_PR_U + &Allow_Subj_Tax_PR;
            &Tips_Subj_Tax_PR_U = &Tips_Subj_Tax_PR_U + &Tips_Subj_Tax_PR;
            &Total_Comp_PR_U = &Total_Comp_PR_U + &Total_Comm_Allow_Tips;
            &Fed_Tax_PR_U = &Fed_Tax_PR_U + &Fed_Tax_PR;
            &Retire_Fund_Contrib_PR_U = &Retire_Fund_Contrib_PR_U +
&Retire_Fund_Contrib_PR;
            &Fed_Wages_TY_U = &Fed_Wages_TY_U + &Fed_Wages_TY;
            &Fed_Tax_TY_U = &Fed_Tax_TY_U + &Fed_Wages_TY;
            &Uncoll_SS_Tax_GTL_U = &Uncoll_SS_Tax_GTL_U + &Uncoll_SS_Tax_GTL;
            &Uncoll_Med_Tax_GTL_U = &Uncoll_Med_Tax_GTL_U + &Uncoll_Med_Tax_GTL;
            &Income_NonQual_Def_Comp_U = &Income_NonQual_Def_Comp_U +
&Income_NonQual_Def_Comp;
            &Alloc_TIPS = 0;
            &Uncoll_Tax_On_Tips = 0;
            &Med_Svgs_Acct = 0;
            &408P_Simple_Retirement = 0;
            &Adoption_Exp = 0;
            &Fed_Wages_PR = 0;
            &Commissions_PR = 0;
            &Allow_Subj_Tax_PR = 0;
            &Tips_Subj_Tax_PR = 0;
            &Total_Comm_Allow_Tips = 0;
            &Fed_Tax_PR = 0;
            &Retire_Fund_Contrib_PR = 0;
            &Fed_Wages_TY = 0;
            &Uncoll_SS_Tax_GTL = 0;
            &Uncoll_Med_Tax_GTL = 0;
         End-If;
         &SQL14 = CreateSQL("SELECT GPUS_FWT_ALLOW FROM PS_GPUS_FWT_EE WHERE EMPLID=:1 AND
COMPANY = :2 AND EFFDT = (SELECT MAX(EFFDT) FROM PS_GPUS_FWT_EE WHERE EMPLID=:3 AND COMPANY
= :4 AND EFFDT <= %datein(:5))", &EE5_REC.EMPLID.Value, &EE5_REC.GPUS_YE_RPT_CO.Value,
&EE5_REC.EMPLID.Value, &EE5_REC.GPUS_YE_RPT_CO.Value, &cal_year);
         While &SQL14.Fetch(&fwt_allow1)
            &fwt_allow = &fwt_allow1;
         End-While;


         /* RS Record */
         /* Assign Values for RS*/
         &RS_REC.GPUS_REC_ID.Value = "RS";
         &RS_REC.GPUS_ST_CD.Value = &RS_StateCode;
         &RS_REC.GPUS_BLNK_5.Value = " ";
         &RS_REC.SSN.Value = &EE5_REC.SSN.Value;
         &RS_REC.GPUS_YE_FNAME.Value = Upper(&EE5_REC.GPUS_YE_FNAME.Value);
         &RS_REC.GPUS_YE_MNAME.Value = Upper(&EE5_REC.GPUS_YE_MNAME.Value);
         &RS_REC.GPUS_YE_LNAME.Value = Upper(&EE5_REC.GPUS_YE_LNAME.Value);
         &RS_REC.GPUS_YE_SUFFIX.Value = Upper(&EE5_REC.GPUS_YE_SUFFIX.Value);

         &Address1 = Upper(&EE5_REC.ADDRESS1.Value);
         &Address2 = Upper(&EE5_REC.ADDRESS2.Value);

         If GPUS_SM1C_AET.GPUS_YE_STATE.Value = "IN" Then
            If All(&Address1) And
                  All(&Address2) Then
               &RS_REC.ADDRESS1.Value = &Address2;
               &RS_REC.ADDRESS2.Value = &Address1;
            Else
               &RS_REC.ADDRESS1.Value = &Address1;
               &RS_REC.ADDRESS2.Value = &Address2;
            End-If;
         Else

            /* On the EFW2 layout, Address 1 is at the Location address offset and Address
2 is at
the Delivery address offset. If both address lines are populated then line 1 is typically the
Location address and line 2 is the Delivery address. if only line 1 is populated then typically
this will be the Delivery address. */
            If All(&Address1) And
                   All(&Address2) Then
               &RS_REC.ADDRESS1.Value = &Address1;
               &RS_REC.ADDRESS2.Value = &Address2;
            Else
               &RS_REC.ADDRESS1.Value = &Address2;
               &RS_REC.ADDRESS2.Value = &Address1;
            End-If;
         End-If;

         &RS_REC.CITY.Value = Upper(&EE5_REC.CITY.Value);
         &RS_REC.STATE.Value = &EE5_REC.STATE.Value;
         &RS_REC.GPUS_BLNK_5_2.Value = " ";
         &RS_REC.GPUS_BLNK_15.Value = &EE5_REC.POSTAL.Value;
         &RS_REC.GPUS_BLNK_2_1.Value = " ";
         &RS_REC.GPUS_REPORT_PERIOD.Value = "12" | GPUS_SM1C_AET.CALENDAR_YEAR.Value;
         &RS_REC.GPUS_SQUI_TWG.Value = FLFormat("0", 11, "0");
         &RS_REC.GPUS_QUITOTTX_WG.Value = FLFormat("0", 11, "0");
         &RS_REC.GPUS_NWW.Value = " ";
         &RS_REC.GPUS_RDFE.Value = " ";
         &RS_REC.GPUS_RDS.Value = " ";
         &RS_REC.GPUS_BLNK_5_1.Value = " ";
         &RS_REC.GPUS_SER_ACCT.Value = Right(Rept("0", 10) | String(&state_ein), 10);
         &RS_REC.GPUS_SER_ACCT.Value = " ";
         &RS_REC.GPUS_BLNK_6.Value = " ";
         &RS_REC.GPUS_ST_CD_1.Value = &RS_StateCode;
         &RS_REC.GPUS_RSTX_WG.Value = FLFormat(&state_wages, 11, "0");
         &RS_REC.GPUS_STX_WHLD.Value = FLFormat(&state_tax, 11, "0");
         &RS_REC.GPUS_TTC.Value = " ";
         &RS_REC.GPUS_LTW.Value = FLFormat(&Local_Wages, 11, "0");
         &RS_REC.GPUS_LIT_WHLD.Value = FLFormat(&Local_Tax, 11, "0");

         &RS_REC.GPUS_SUPP_D1.Value = &EE5_REC.STATE.Value;
         &RS_REC.GPUS_SUPP_D1.Value = " ";

         /* Foreign Address */
         If &EE5_REC.COUNTRY.Value = "USA" Then
            If &EE5_REC.POSTAL.Value <> "" Then
               &RS_REC.ZIP.Value = Substring(&EE5_REC.POSTAL.Value, 1, 5);
               &RS_REC.GPUS_ZIPEXTN.Value = Substring(&EE5_REC.POSTAL.Value, 7, 10);
               &RS_REC.GPUS_BLNK_15.Value = " ";
            End-If;
         Else
            If None(&EE5_REC.STATE.Value) Then
               &SQL12 = CreateSQL("SELECT DESCR FROM %Table(STATE_NAMES_TBL) WHERE COUNTRY
= :1 AND STATE = :2", &EE5_REC.COUNTRY.Value, &EE5_REC.STATE.Value, &State_Descr);
               While &SQL12.Fetch(&State_Descr)
                  &RS_REC.GPUS_BLNK_23.Value = &State_Descr;
               End-While;
            End-If;
            &SQL13 = CreateSQL("SELECT COUNTRY_2CHAR FROM %Table(COUNTRY_TBL) WHERE COUNTRY
= :1", &EE5_REC.COUNTRY.Value, &Country_2char);
            While &SQL13.Fetch(&Country_2char)
               &RS_REC.GPUS_BLNK_2.Value = &Country_2char;
            End-While;
            &RS_REC.ZIP.Value = " ";
            &RS_REC.GPUS_ZIPEXTN.Value = " ";
         End-If; /* End of Foreign Address */


         Evaluate GPUS_SM1C_AET.GPUS_YE_STATE.Value
         When "AL"
            &RS_REC.GPUS_OSD.Value = FLFormat(&Fed_Tax, 10, "0");
            &RS_REC.GPUS_SER_ACCT.Value = &RS_REC.GPUS_SER_ACCT.Value | Right(Rept("0", 9)
| String(&federal_ein), 9);
            &RS_REC.GPUS_SUPP_D1.Value = Rept("0", 11) | Rept(" ", 44) |
GPUS_SM1C_AET.CALENDAR_YEAR.Value;
            Break;
         When "AR"
            &RS_REC.GPUS_OSD.Value = "";
            If &EE5_REC.GPUS_TAX_EIN.Value <> "" Then
               &STR = "";
               For &I = 1 To 20
                   &CH = Substring(&EE5_REC.GPUS_TAX_EIN.Value, &I, 1);
                   /* strip out hyphens or blanks */
                   If &CH <> "-" And
                         &CH <> " " Then
                      &STR = &STR | &CH;
                   End-If;
               End-For;
               &FEIN = Substring(&STR, 1, 9);
               &RS_REC.GPUS_SUPP_D1.Value = &FEIN;
            End-If;
            If &EE5_REC.GPUS_SWT_EIN.Value <> "" Then
               &STR = "";
               For &I = 1 To 20
                   &CH = Substring(&EE5_REC.GPUS_SWT_EIN.Value, &I, 1);
                   /* strip out hyphens or blanks */
                   If &CH <> "-" And
                         &CH <> " " Then
                      &STR = &STR | &CH;
                   End-If;
               End-For;
               &AR_ST_EIN = Substring(&STR, 1, 9);
               &RS_REC.GPUS_SUPP_D2.Value = &AR_ST_EIN;
            End-If;
            Break;
         When "AZ"
            &RS_REC.GPUS_REPORT_PERIOD.Value = " ";
            &RS_REC.GPUS_SQUI_TWG.Value = " ";
            &RS_REC.GPUS_QUITOTTX_WG.Value = " ";
            &RS_REC.GPUS_SER_ACCT.Value = Left(&state_ein | Rept(" ", 20),    20);
         When "CT"
            &RS_REC.GPUS_SER_ACCT.Value = Left(&state_ein | Rept(" ", 20),    20);
            Break;
         When "DC"
            &RS_REC.GPUS_SQUI_TWG.Value = " ";
            &RS_REC.GPUS_QUITOTTX_WG.Value = " ";
            &RS_REC.GPUS_NWW.Value = " ";
            &RS_REC.GPUS_RDFE.Value = " ";
            &RS_REC.GPUS_RDS.Value = " ";
            &RS_REC.GPUS_BLNK_5_1.Value = " ";
            &RS_REC.GPUS_SER_ACCT.Value = " ";
            Break;
         When "OH"
            &RS_REC.GPUS_OSD.Value = FLFormat(&Fed_Wages, 10, "0");
            &RS_REC.GPUS_SER_ACCT.Value = Left(&state_ein | Rept(" ", 20),    20);
            Break;
         When "ID"
            &RS_REC.GPUS_REPORT_PERIOD.Value = " ";
            &RS_REC.GPUS_SQUI_TWG.Value = " ";
            &RS_REC.GPUS_QUITOTTX_WG.Value = " ";
            &RS_REC.GPUS_SER_ACCT.Value = Left(&state_ein | Rept(" ", 20),    20);
            Break;
         When "IN"
            &STR = FLFormat(Abs(&Ind_Adv_EIC), 11, "0");
            &RS_REC.GPUS_BLNK_2.Value = Left(&STR, 2);
            &RS_REC.GPUS_BLNK_2_1.Value = Substring(&STR, 3, 2);
            &RS_REC.GPUS_REPORT_PERIOD.Value = Substring(&STR, 5, 6);
            &RS_REC.GPUS_SQUI_TWG.Value = Right(&STR, 1) | Rept(" ", 10);
            &RS_REC.GPUS_QUITOTTX_WG.Value = Rept(" ", 11);
            &RS_REC.GPUS_SER_ACCT.Value = " ";
            &RS_REC.GPUS_RSTX_WG.Value = FLFormat(&state_wages, 11, "0");
            &RS_REC.GPUS_STX_WHLD.Value = FLFormat(&state_tax, 11, "0");
            &RS_REC.GPUS_ST_CD_1.Value = &RS_StateCode;
            &RS_REC.GPUS_OSD.Value = Rept(" ", 9) | "0";
            &RS_REC.GPUS_TTC.Value = "0";

           /* &RS_REC.GPUS_SUPP_D1.Value = Substring(&EE5_REC.GPUS_CONTROL_NBR.Value, 10,
3); */

           &state_eic_str = NumberToString("%#011.2t", &state_eic);

           For &I = 1 To 11
              &eic_ch = Substring(&state_eic_str, &I, 1);
              If &eic_ch <> "-" And
                    &eic_ch <> " " Then
                 &eic_STR = &eic_STR | &eic_ch;
              End-If;
           End-For;
           &state_eic_str = FLFormat(&eic_STR, 11, "0");
           &L2 = Len(String(&state_eic_str));

           If &EE5_REC.GPUS_SWT_EIN.Value <> "" Then
              &STR = "";
              For &I = 1 To 13
                 &CH = Substring(&EE5_REC.GPUS_SWT_EIN.Value, &I, 1);

                 If &CH <> "-" And
                        &CH <> " " Then
                    &STR = &STR | &CH;
                 End-If;
              End-For;
              &ER_TID = Substring(&STR, 1, 10);
              /*   &ER_TID_LOC = Substring(&STR, 11, 3); */
              &ER_TID_LOC = "000";
              /* span the TID over 2 fields in the RS record due to the way it has been defined
*/
              &RS_REC.GPUS_STC_NUM.Value = Substring(&ER_TID, 1, 7);
               /* If &L2 <> 0 Then */
               If Value(&state_eic_str) <> 0 Then
                   &RS_REC.GPUS_SUPP_D1.Value = Substring(&ER_TID, 8, 3) | &ER_TID_LOC |
&state_eic_str | "INADV";
               Else
                   &RS_REC.GPUS_SUPP_D1.Value = Substring(&ER_TID, 8, 3) | &ER_TID_LOC;
               End-If;
            Else
               /* If &L2 <> 0 Then */
               If Value(&state_eic_str) <> 0 Then
                   &RS_REC.GPUS_SUPP_D1.Value = Rept(" ", 6) | &state_eic_str | "INADV";
               End-If;
            End-If;
            &state_eic_str = "";
            &eic_STR = "";
            &state_eic_T = &state_eic_T + &state_eic;
            &Local_Wages_T = &Local_Wages_T + &Local_Wages;
            &Local_Tax = &Local_Tax_T + &Local_Tax;
            &state_eic = 0;
            &Local_Wages = 0;
            &Local_Tax = 0;
            Break;
         When "GA"
            &RS_REC.GPUS_OSD.Value = "12/31/" | String(GPUS_SM1C_AET.CALENDAR_YEAR);
            &RS_REC.GPUS_REPORT_PERIOD.Value = " ";
            &RS_REC.GPUS_SQUI_TWG.Value = " ";
            &RS_REC.GPUS_QUITOTTX_WG.Value = " ";
            &RS_REC.GPUS_SER_ACCT.Value = " ";

            If &state_ein <> "" Then
               &STR = "";
               /* Trim out the hyphens and spaces */
               For &I = 1 To 20
                  &CH = Substring(&state_ein, &I, 1);

                  If &CH <> "-" And
                         &CH <> " " Then
                     &STR = &STR | &CH;
                  End-If;
               End-For;
               &STR = Left(&STR | Rept(" ", 9), 9);
            End-If;
            &RS_REC.GPUS_STC_NUM.Value = Left(&STR, 7);
            &RS_REC.GPUS_SUPP_D1.Value = Right(&STR, 2);
            For &I = 1 To 74
               Evaluate &I
               When = 2
                  &RS_REC.GPUS_SUPP_D1.Value = &RS_REC.GPUS_SUPP_D1.Value   |
Left(&RE_REC.DESCR.Value | Rept(" ", 57), 57);
                  &I = &I + 56;
                  Break;
               When = 59
                  &RS_REC.GPUS_SUPP_D1.Value = &RS_REC.GPUS_SUPP_D1.Value   |
Left(&RE_REC.ADDRESS1.Value | Rept(" ", 16), 16);
                  &I = &I + 17;
                  Break;
               When-Other
                  &RS_REC.GPUS_SUPP_D1.Value = &RS_REC.GPUS_SUPP_D1.Value   | " ";
               End-Evaluate;
            End-For;
            For &I = 1 To 74
               Evaluate &I
               When = 1
                  &RS_REC.GPUS_SUPP_D2.Value = &RS_REC.GPUS_SUPP_D2.Value   |
Right(Left(&RE_REC.ADDRESS1.Value | Rept(" ", 22), 22), 6);
                  &I = &I + 6;
                  Break;
               When = 8
                  &RS_REC.GPUS_SUPP_D2.Value = &RS_REC.GPUS_SUPP_D2.Value   |
Left(&RE_REC.ADDRESS2.Value | Rept(" ", 22), 22);
                  &I = &I + 21;
                   Break;
               When = 30
                   &RS_REC.GPUS_SUPP_D2.Value = &RS_REC.GPUS_SUPP_D2.Value |
Left(&RE_REC.CITY.Value | Rept(" ", 22), 22);
                   &I = &I + 21;
                   Break;
               When = 52
                   &RS_REC.GPUS_SUPP_D2.Value = &RS_REC.GPUS_SUPP_D2.Value |
&RE_REC.STATE.Value;
                   &I = &I + 2;
                   Break;
               When = 55
                   &RS_REC.GPUS_SUPP_D2.Value = &RS_REC.GPUS_SUPP_D2.Value |
&RE_REC.ZIP.Value;
                   &I = &I + 4;
                   Break;
               When = 60
                   &RS_REC.GPUS_SUPP_D2.Value = &RS_REC.GPUS_SUPP_D2.Value |
Left(&RE_REC.GPUS_ZIPEXTN.Value | Rept(" ", 4), 4);
                   &I = &I + 3;
                   Break;
               When = 64
                   &RS_REC.GPUS_SUPP_D2.Value = &RS_REC.GPUS_SUPP_D2.Value | &trans_ein;
                   &I = &I + 9;
                   Break;
               When-Other
                   &RS_REC.GPUS_SUPP_D2.Value = &RS_REC.GPUS_SUPP_D2.Value | " ";
               End-Evaluate;
            End-For;
            Break;
         When "KS"
            &RS_REC.GPUS_SER_ACCT.Value = Left(String(&state_ein) | Rept(" ", 10), 10);
            &RS_REC.GPUS_REPORT_PERIOD.Value = " ";
            &RS_REC.GPUS_SQUI_TWG.Value = " ";
            &RS_REC.GPUS_QUITOTTX_WG.Value = " ";
            &RS_REC.GPUS_SUPP_D1.Value = Rept("0", 11) | Rept(" ", 64);
            Break;
         When "KY"
            &RS_REC.GPUS_BLNK_2_1.Value = "00";
            &RS_REC.GPUS_REPORT_PERIOD.Value = Rept(" ", 6);
            &RS_REC.GPUS_NWW.Value = "00";
            &RS_REC.GPUS_SER_ACCT.Value = Right(Rept("0", 20) | String(&state_ein), 20);
            &RS_REC.GPUS_OSD.Value = Rept("0", 10);
            &RS_REC.GPUS_LTW.Value = Rept("0", 11);
            &RS_REC.GPUS_LIT_WHLD.Value = Rept("0", 11);
            &RS_REC.GPUS_STC_NUM.Value = Rept("0", 7);
            /* KREDA + KJDA + KIRA + KIDA */
            &RS_REC.GPUS_SUPP_D1.Value = Rept("0", 11) | Rept("0", 11) | Rept("0", 11) |
Rept("0", 11) | " ";
            Break;
         When "LA"
            &RS_REC.GPUS_SER_ACCT.Value = Left(&state_ein | Rept(" ", 20), 20);
            Break;
         When "MA"
            &RS_REC.GPUS_BLNK_5_2.Value = " ";
            &RS_REC.GPUS_BLNK_23.Value = " ";
            &RS_REC.GPUS_BLNK_15.Value = " ";
            &RS_REC.GPUS_BLNK_2_1.Value = " ";
            &RS_REC.GPUS_REPORT_PERIOD.Value = " ";
            &RS_REC.GPUS_SQUI_TWG.Value = " ";
            &RS_REC.GPUS_QUITOTTX_WG.Value = " ";
            &RS_REC.GPUS_NWW.Value = " ";
            &RS_REC.GPUS_RDFE.Value = " ";
            &RS_REC.GPUS_RDS.Value = " ";
            &RS_REC.GPUS_BLNK_5_1.Value = " ";
            &RS_REC.GPUS_SER_ACCT.Value = " ";
            &RS_REC.GPUS_BLNK_6.Value = " ";
            &RS_REC.GPUS_OSD.Value = " ";
            &RS_REC.GPUS_TTC.Value = " ";
            &RS_REC.GPUS_LTW.Value = " ";
            &RS_REC.GPUS_LIT_WHLD.Value = " ";
            &RS_REC.GPUS_STC_NUM.Value = " ";
            &RS_REC.GPUS_SUPP_D1.Value = " ";
            &RS_REC.GPUS_SUPP_D2.Value = " ";
            Break;
         When "MD"
            &RS_REC.GPUS_ST_CD.Value = " ";
            &RS_REC.GPUS_BLNK_5.Value = " ";
            &RS_REC.GPUS_BLNK_5_2.Value = " ";
            &RS_REC.GPUS_BLNK_23.Value = " ";
            &RS_REC.GPUS_BLNK_15.Value = " ";
            &RS_REC.GPUS_BLNK_2_1.Value = " ";
            &RS_REC.GPUS_REPORT_PERIOD.Value = " ";
            &RS_REC.GPUS_SQUI_TWG.Value = " ";
            &RS_REC.GPUS_QUITOTTX_WG.Value = " ";
            &RS_REC.GPUS_NWW.Value = " ";
            &RS_REC.GPUS_RDFE.Value = " ";
            &RS_REC.GPUS_RDS.Value = " ";
            &RS_REC.GPUS_BLNK_5_1.Value = " ";
            &RS_REC.GPUS_SER_ACCT.Value = " ";
            &RS_REC.GPUS_BLNK_6.Value = " ";
            &RS_REC.GPUS_OSD.Value = Rept("0", 10);
            &RS_REC.GPUS_ST_CD_1.Value = "24";
            &YearStr = NumberToString("%04t", Year(%Date));
            &MonthStr = NumberToString("%02t", Month(%Date));
            &DayStr = NumberToString("%02t", Day(%Date));
            &HourStr = NumberToString("%02t", Hour(%Datetime));
            &MinuteStr = NumberToString("%02t", Minute(%Datetime));
            &SecondStr = NumberToString("%02t", Second(%Datetime));

            If &EE5_REC.GPUS_SWT_EIN.Value <> "" Then
               &STR = "";
               /* Trim out the hyphens and spaces */
               For &I = 1 To 20
                  &CH = Substring(&federal_ein, &I, 1);
                  If &CH <> "-" And
                        &CH <> " " Then
                     &STR = &STR | &CH;
                  End-If;
               End-For;
               &STR = Left(&STR | Rept(" ", 9), 9);
               REM &RS_REC.GPUS_SER_ACCT.Value = Substring(&STR, 1, 9);

               /* The EIN value spans 2 fields in the RS record - &RS_REC.GPUS_LIT_WHLD and
GPUS_STC_NUM */
               &RS_REC.GPUS_LIT_WHLD.Value = Rept(" ", 8) | Left(&STR, 3);
               &RS_REC.GPUS_STC_NUM.Value = Right(&STR, 6) | " ";

               &STR = Substring(&STR, 1, 8);

            End-If;
            For &I = 1 To 75
               Evaluate &I
               When = 1
                  &L1 = Len(String(&STR));
                  If &L1 <> 0 Then
                     &RS_REC.GPUS_SUPP_D1.Value = &STR;
                     &I = &I + &L1 - 1;
                  Else
                     &RS_REC.GPUS_SUPP_D1.Value = &RS_REC.GPUS_SUPP_D1.Value | " ";
                  End-If;
                  Break;
               When = 9
                  &L2 = Len(String(FLFormat(&Fed_Wages, 11, "0")));
                  If &L2 <> 0 Then
                     &RS_REC.GPUS_SUPP_D1.Value = &RS_REC.GPUS_SUPP_D1.Value |
FLFormat(&Fed_Wages, 11, "0");
                     &I = &I + &L2 - 1;
                  Else
                     &RS_REC.GPUS_SUPP_D1.Value = &RS_REC.GPUS_SUPP_D1.Value | " ";
                  End-If;
                  Break;
               When = 20
                   &L2 = Len(String(FLFormat(&Fed_Tax, 11, "0")));
                   If &L2 <> 0 Then
                      &RS_REC.GPUS_SUPP_D1.Value = &RS_REC.GPUS_SUPP_D1.Value |
FLFormat(&Fed_Tax, 11, "0");
                      &I = &I + &L2 - 1;
                   Else
                      &RS_REC.GPUS_SUPP_D1.Value = &RS_REC.GPUS_SUPP_D1.Value | " ";
                   End-If;
                   Break;
               When = 31
                   &fwt_allow_str = Right(Rept("0", 2) | String(&fwt_allow), 2);
                   &RS_REC.GPUS_SUPP_D1.Value = &RS_REC.GPUS_SUPP_D1.Value | &fwt_allow_str;
                   Break;
               When-Other
                   &RS_REC.GPUS_SUPP_D1.Value = &RS_REC.GPUS_SUPP_D1.Value | " ";
               End-Evaluate;
            End-For;
            &RS_REC.GPUS_BLNK_25.Value = Rept(" ", 9) | &YearStr | &MonthStr | &DayStr |
&HourStr | &MinuteStr | &SecondStr | "00";
            Break;
         When "ME"
            &STR = "";
            For &I = 1 To 20
               &CH = Substring(&EE5_REC.GPUS_SWT_EIN.Value, &I, 1);
               If &CH <> "-" And
                      &CH <> " " Then
                   &STR = &STR | &CH;
               End-If;
            End-For;
            &STR = Substring(&STR, 1, 9);
            &RS_REC.GPUS_SUPP_D1.Value = "00" | &STR;
            Break;
         When "CO"
         When "NE"
         When "MN"
            &RS_REC.GPUS_BLNK_2_1.Value = " ";
            &RS_REC.GPUS_REPORT_PERIOD.Value = " ";
            &RS_REC.GPUS_SQUI_TWG.Value = " ";
            &RS_REC.GPUS_QUITOTTX_WG.Value = " ";
            &RS_REC.GPUS_NWW.Value = " ";
            &RS_REC.GPUS_RDFE.Value = " ";
            &RS_REC.GPUS_RDS.Value = " ";
            &RS_REC.GPUS_BLNK_5_1.Value = " ";
            &RS_REC.GPUS_SER_ACCT.Value = Left(&RS_REC.GPUS_SER_ACCT.Value | Rept(" ", 20),
20);
            Break;
         When "MI"
            &RS_REC.GPUS_REPORT_PERIOD.Value = " ";
            &RS_REC.GPUS_SQUI_TWG.Value = " ";
            &RS_REC.GPUS_QUITOTTX_WG.Value = " ";
            &RS_REC.GPUS_SER_ACCT.Value = Left(&state_ein | Rept(" ", 20), 20);
            &RS_REC.GPUS_ST_CD_1.Value = " ";
            &RS_REC.GPUS_LTW.Value = " ";
            &RS_REC.GPUS_LIT_WHLD.Value = " ";
            Break;
         When "MO"
         When "MT"
         When "NC"
         When "RI"
         When "SC"
            &RS_REC.GPUS_SER_ACCT.Value = Left(&state_ein | Rept(" ", 20), 20);
            Break;
         When "MS"
            &RS_REC.SSN.Value = RTrim(LTrim(&RS_REC.SSN.Value, " "), " ");
            If &RS_REC.SSN.Value = "" Then
               &RS_REC.SSN.Value = "000000000";
            End-If;
            &RS_REC.GPUS_REPORT_PERIOD.Value = " ";
            &RS_REC.GPUS_SQUI_TWG.Value = " ";
            &RS_REC.GPUS_QUITOTTX_WG.Value = " ";
     &RS_REC.GPUS_SER_ACCT.Value = Right(Rept("0",   20) | &state_ein, 20);
     &RS_REC.GPUS_ST_CD_1.Value = "28";
     Break;
  When "UT"
     &RS_REC.GPUS_REPORT_PERIOD.Value = " ";
     &RS_REC.GPUS_SQUI_TWG.Value = " ";
     &RS_REC.GPUS_QUITOTTX_WG.Value = " ";
     &RS_REC.GPUS_LTW.Value = " ";
     &RS_REC.GPUS_LIT_WHLD.Value = " ";
     &RS_REC.GPUS_SER_ACCT.Value = Left(&state_ein   | Rept(" ", 20), 20);
     Break;
  When "VA"
  When "WI"
     &RS_REC.GPUS_REPORT_PERIOD.Value = " ";
     &RS_REC.GPUS_SQUI_TWG.Value = " ";
     &RS_REC.GPUS_QUITOTTX_WG.Value = " ";
     &RS_REC.GPUS_SER_ACCT.Value = Left(&state_ein   | Rept(" ", 20), 20);
     Break;
  When "WV"
     &RS_REC.GPUS_SER_ACCT.Value = Left(&state_ein   | "001" | Rept(" ", 20), 20);
     Break;

  End-Evaluate;

   /* Write RS Record */
   &ST_File.WriteRecord(&RS_REC);
   &count_rs = &count_rs + 1;
   &State_Wages_T = &State_Wages_T + &state_wages;
   &State_Tax_T = &State_Tax_T + &state_tax;
   &Fed_Wages = 0;
   &Fed_Tax = 0;
   &SS_Tax = 0;
   &Med_Tax = 0;
   &state_wages = 0;
   &state_tax = 0;
End-While; /* End of Employee Loop */

/* WRITE RT */
If &count_rt <> 0 Then
   /* Assign Values for RT*/
   &RT_REC.GPUS_REC_ID.Value = "RT";
   &RT_REC.GPUS_WG_TOT.Value = " ";
   &RT_REC.GPUS_FWT_TOT.Value = " ";
   &RT_REC.GPUS_SSW_TOT.Value = " ";
   &RT_REC.GPUS_SSWT_TOT.Value = " ";
   &RT_REC.GPUS_MWG_TOT.Value = " ";
   &RT_REC.GPUS_MTW_TOT.Value = " ";
   &RT_REC.GPUS_SS_T_TOT.Value = " ";
   &RT_REC.GPUS_AEIC_TOT.Value = " ";
   &RT_REC.GPUS_DCB_TOT.Value = " ";
   &RT_REC.GPUS_D401K_TOT.Value = " ";
   &RT_REC.GPUS_D403B_TOT.Value = " ";
   &RT_REC.GPUS_D408K_TOT.Value = " ";
   &RT_REC.GPUS_D457B_TOT.Value = " ";
   &RT_REC.GPUS_501C_TOT.Value = " ";
   &RT_REC.GPUS_N457_TOT.Value = " ";
   &RT_REC.GPUS_NN_457_TOT.Value = " ";
   &RT_REC.GPUS_HSA_T.Value = " ";
   &RT_REC.GPUS_NT_COMBPAY_T.Value = " ";
   &RT_REC.GPUS_NQDEFC_PL_T.Value = " ";
   &RT_REC.GPUS_EGTLI_TOT.Value = " ";
   &RT_REC.GPUS_RC_3RDPRTY_T.Value = " ";
   &RT_REC.GPUS_ENS_TOT.Value = " ";
   &RT_REC.GPUS_ROTH_401K_T.Value = " ";
   &RT_REC.GPUS_ROTH_403B_T.Value = " ";
   &RT_REC.GPUS_BLNK_15.Value = " ";
   &RT_REC.GPUS_BLNK_15_2.Value = " ";
   &RT_REC.GPUS_BLNK_113.Value = " ";
   &RT_REC.GPUS_RWE_TOT.Value = FLFormat(&count_rt, 7, "0");
   Evaluate GPUS_SM1C_AET.GPUS_YE_STATE.Value
   When "MA"
           When "CT"
              &RT_REC.GPUS_WG_TOT.Value = FLFormat(&State_Wages_T, 15, "0");
              &RT_REC.GPUS_FWT_TOT.Value = FLFormat(&State_Tax_T, 15, "0");
              Break;
           When "PA"
              &RT_REC.GPUS_RWE_TOT.Value = " ";
              &RT_REC.GPUS_BLNK_113.Value = Rept(" ", 76);
              &RT_REC.GPUS_BLNK_113.Value = &RT_REC.GPUS_BLNK_113.Value | FLFormat(&count_rs,
7, "0");
            &RT_REC.GPUS_BLNK_113.Value = &RT_REC.GPUS_BLNK_113.Value |
FLFormat(&State_Wages_T, 15, "0");
            &RT_REC.GPUS_BLNK_113.Value = &RT_REC.GPUS_BLNK_113.Value |
FLFormat(&State_Tax_T, 15, "0");
            Break;
         When "RI"
            &RT_REC.GPUS_SSW_TOT.Value = FLFormat(&State_Wages_T, 15, "0");
            &RT_REC.GPUS_SS_T_TOT.Value = FLFormat(&State_Tax_T, 15, "0");
            Break;
         When-Other
            &RT_REC.GPUS_WG_TOT.Value = FLFormat(&Fed_Wages_T, 15, "0");
            &RT_REC.GPUS_FWT_TOT.Value = FLFormat(&Fed_Tax_T, 15, "0");
            &RT_REC.GPUS_SSW_TOT.Value = FLFormat(&SS_Wages_T, 15, "0");
            &RT_REC.GPUS_SSWT_TOT.Value = FLFormat(&SS_Tax_T, 15, "0");
            &RT_REC.GPUS_MWG_TOT.Value = FLFormat(&Med_Wages_T, 15, "0");
            &RT_REC.GPUS_MTW_TOT.Value = FLFormat(&Med_Tax_T, 15, "0");
            &RT_REC.GPUS_SS_T_TOT.Value = FLFormat(&SS_Tips_T, 15, "0");
            &RT_REC.GPUS_AEIC_TOT.Value = FLFormat(Abs(&Adv_EIC_T), 15, "0");
            &RT_REC.GPUS_DCB_TOT.Value = FLFormat(&Dep_Care_T, 15, "0");
            &RT_REC.GPUS_D401K_TOT.Value = FLFormat(&401K_T, 15, "0");
            &RT_REC.GPUS_D403B_TOT.Value = FLFormat(&403B_T, 15, "0");
            &RT_REC.GPUS_D408K_TOT.Value = FLFormat(&408K6_T, 15, "0");
            &RT_REC.GPUS_D457B_TOT.Value = FLFormat(&457B_T, 15, "0");
            &RT_REC.GPUS_501C_TOT.Value = FLFormat(&501C18_T, 15, "0");
            &RT_REC.GPUS_N457_TOT.Value = FLFormat(&Non_Qual_457_Y_T, 15, "0");
            &RT_REC.GPUS_NN_457_TOT.Value = FLFormat(&Non_Qual_457_N_T, 15, "0");
            &RT_REC.GPUS_HSA_T.Value = FLFormat(&HSA_T, 15, "0");
            &RT_REC.GPUS_NT_COMBPAY_T.Value = FLFormat(&Nontaxable_Combat_Pay_T, 15, "0");
            &RT_REC.GPUS_NQDEFC_PL_T.Value = FLFormat(&NonQual_Def_Comp_T, 15, "0");
            &RT_REC.GPUS_EGTLI_TOT.Value = FLFormat(&Group_Term_ER_Cost_T, 15, "0");
            &RT_REC.GPUS_RC_3RDPRTY_T.Value = FLFormat(&Third_party_tax, 15, "0");
            &RT_REC.GPUS_ENS_TOT.Value = FLFormat(&Nonstatutory_Stock_Options_T, 15, "0");
            &RT_REC.GPUS_ROTH_401K_T.Value = FLFormat(&Roth_401K_T, 15, "0");
            &RT_REC.GPUS_ROTH_403B_T.Value = FLFormat(&Roth_403B_T, 15, "0");
            &RT_REC.GPUS_BLNK_15.Value = Rept("0", 15);
         End-Evaluate;

           Evaluate GPUS_SM1C_AET.GPUS_YE_STATE.Value
           When "LA"
           When "NC"
           When "MD"
           When "WI"
           When "CO"
              Break;
           When-Other
              &ST_File.WriteRecord(&RT_REC);
              Break;
           End-Evaluate;

           &RV_State_Wages = &State_Wages_T;
           &RV_State_Tax = &State_Tax_T;

         If GPUS_SM1C_AET.GPUS_YE_STATE.Value = "MD" Then
            &MD_Emplr_Gross_Payroll = &State_Wages_T;
            If &State_Wages_T <> &MW508_LN9 Then
               &State_Wages_str = NumberToDisplayString("%$", &State_Wages_T, 10, 2);
               &MW508_State_Wages_str = NumberToDisplayString("%$", &MW508_LN9, 10, 2);
               MessageBox(0, "", 17295, 12, "Message not found.", &RPT_COMPANY,
&MW508_State_Wages_str, &State_Wages_str);
            End-If;

              If &State_Tax_T <> &MW508_LN2 Then
               &State_Taxes_str = NumberToDisplayString("%$", &State_Tax_T);
               &MW508_State_Taxes_str = NumberToDisplayString("%$", &MW508_LN2, 10, 2);
               MessageBox(0, "", 17295, 13, "Message not found.", &RPT_COMPANY,
&MW508_State_Taxes_str, &State_Taxes_str);
            End-If;
         End-If;

        &State_Wages_F = &State_Wages_F + &State_Wages_T;
        &State_Tax_F = &State_Tax_F + &State_Tax_T;
        &State_Wages_T = 0;
        &State_Tax_T = 0;
        &count_rs = 0;
        &count_rt = 0;
        &Fed_Wages_T = 0;
        &Fed_Tax_T = 0;
        &SS_Wages_T = 0;
        &SS_Tax_T = 0;
        &Med_Wages_T = 0;
        &Med_Tax_T = 0;
        &SS_Tips_T = 0;
        &Adv_EIC_T = 0;
        &Dep_Care_T = 0;
        &401K_T = 0;
        &403B_T = 0;
        &408K6_T = 0;
        &457B_T = 0;
        &501C18_T = 0;
        &Non_Qual_457_Y_T = 0;
        &Non_Qual_457_N_T = 0;
        &HSA_T = 0;
        &Group_Term_ER_Cost_T = 0;
        &Nonstatutory_Stock_Options_T = 0;
        &NonQual_Def_Comp_T = 0;
        &Income_NonQual_Def_Comp_T = 0;
        &Nontaxable_Combat_Pay_T = 0;
        &Roth_401K_T = 0;
        &Roth_403B_T = 0;
     End-If;
     /* WRITE RU */
     If &Count_U <> 0 Then
        /* Assign Values for RU*/
        &RU_REC.GPUS_REC_ID.Value = "RU";
        &RU_REC.GPUS_RO_TOT.Value = FLFormat(&Count_U, 7, "0");
        &RU_REC.GPUS_TIP_TOT.Value = FLFormat(&Alloc_TIPS_U, 15, "0");
        &RU_REC.GPUS_UETX_T.Value = FLFormat(&Uncoll_Tax_On_Tips_U, 15, "0");
        &RU_REC.GPUS_MSA_TOT.Value = FLFormat(&Med_Svgs_Acct_U, 15, "0");
        &RU_REC.GPUS_SR_TOT.Value = FLFormat(&408P_Simple_Retirement_U, 15, "0");
        &RU_REC.GPUS_QA_TOT.Value = FLFormat(&Adoption_Exp_U, 15, "0");
        &RU_REC.GPUS_US_TOT.Value = FLFormat(&Uncoll_SS_Tax_GTL_U, 15, "0");
        &RU_REC.GPUS_UM_TOT.Value = FLFormat(&Uncoll_Med_Tax_GTL_U, 15, "0");
        &RU_REC.GPUS_INC_NQDEFPL_T.Value = FLFormat(&Income_NonQual_Def_Comp, 15, "0");
        &RU_REC.GPUS_BLANK_225.Value = " ";
        &RU_REC.GPUS_WG_PR_T.Value = FLFormat(&Fed_Wages_PR_U, 15, "0");
        &RU_REC.GPUS_COM_PR_T.Value = FLFormat(&Commissions_PR_U, 15, "0");
        &RU_REC.GPUS_AL_PR_T.Value = FLFormat(&Allow_Subj_Tax_PR_U, 15, "0");
        &RU_REC.GPUS_TIPS_PR_T.Value = FLFormat(&Tips_Subj_Tax_PR_U, 15, "0");
        &RU_REC.GPUS_TOTWG_PR_T.Value = FLFormat(&Total_Comp_PR_U, 15, "0");
        &RU_REC.GPUS_TXWHLD_PR_T.Value = FLFormat(&Fed_Tax_PR_U, 15, "0");
        &RU_REC.GPUS_RFAC_T.Value = FLFormat(&Retire_Fund_Contrib_PR_U, 15, "0");
        &RU_REC.GPUS_TOTWG_VI_T.Value = FLFormat(&Fed_Wages_TY_U, 15, "0");
        &RU_REC.GPUS_ITWHLD_VI_T.Value = FLFormat(&Fed_Tax_TY_U, 15, "0");
        &RU_REC.GPUS_BLNK_23.Value = " ";
        /* Write RU Record */
        Evaluate GPUS_SM1C_AET.GPUS_YE_STATE.Value
        When "PA"
           Break;
        When-Other
           &ST_File.WriteRecord(&RU_REC);
        End-Evaluate;
        &Count_U = 0;
        &Alloc_TIPS_U = 0;
          &Uncoll_Tax_On_Tips_U = 0;
          &Med_Svgs_Acct_U = 0;
          &408P_Simple_Retirement_U = 0;
          &Adoption_Exp_U = 0;
          &Fed_Wages_PR_U = 0;
          &Commissions_PR_U = 0;
          &Allow_Subj_Tax_PR_U = 0;
          &Tips_Subj_Tax_PR_U = 0;
          &Total_Comp_PR_U = 0;
          &Fed_Tax_PR_U = 0;
          &Retire_Fund_Contrib_PR_U = 0;
          &Fed_Wages_TY_U = 0;
          &Fed_Tax_TY_U = 0;
          &Uncoll_SS_Tax_GTL_U = 0;
          &Uncoll_Med_Tax_GTL_U = 0;
          &Income_NonQual_Def_Comp_U = 0;
       End-If;

       If &Write_RV = "Y" Then

         &RS_COUNT = 0;
         &SQL_RS_COUNT = CreateSQL("SELECT EMPLID FROM %TABLE(GPUS_YE_EE5_VW) WHERE
GPUS_TAX_EIN = :1 AND GPUS_YE_STATE = :2 AND GPUS_TAXFORM_ID = '10' AND GPUS_YE_STATUS = '10'
AND GPUS_CAL_YEAR = :3", &RE_ARRAY [1], GPUS_SM1C_AET.GPUS_YE_STATE.Value,
GPUS_SM1C_AET.CALENDAR_YEAR.Value, &RS_EMPLID);

         While &SQL_RS_COUNT.FETCH(&RS_EMPLID)
            &RS_COUNT = &RS_COUNT + 1;
         End-While;

         /* Assign Values for RU*/
         &RV_REC.GPUS_REC_ID.Value = "RV";

         /* Write RV Record */
         Evaluate GPUS_SM1C_AET.GPUS_YE_STATE.Value
         When "MD"

            /* for 2006 the MW508 amounts were located in the RE record. for 2007 it was moved
to the new RV record */

            &REMD_REC = CreateRecord(Record.GPUS_REMD_TMP);
            &MW508_REC = CreateRecord(Record.GPUS_MW508_VW);

            &SQL3_STEIN = CreateSQL("SELECT GPUS_SWT_EIN FROM %TABLE(GPUS_CO_ST_TAX) WHERE
COMPANY = :1 AND STATE = :2 AND EFFDT <= %datein(:3)", &RPT_COMPANY,
GPUS_SM1C_AET.GPUS_YE_STATE.Value, &cal_year, &swt_ein);
            While &SQL3_STEIN.FETCH(&swt_ein)
               &md_swt_ein = &swt_ein;
            End-While;

            &SQL3MD = CreateSQL("%SELECTALL(:1) WHERE OPRID = :2 AND RUN_CNTL_ID = :3 AND
COMPANY = :4", &MW508_REC, GPUS_SM1C_AET.OPRID.Value, GPUS_SM1C_AET.RUN_CNTL_ID.Value,
&RPT_COMPANY);

            If &SQL3MD.FETCH(&MW508_REC) Then

               &MW508_LN2 = &MW508_REC.GPUS_YE_MW508_LN2.Value;
               &MW508_LN3A = &MW508_REC.GPUS_YE_MW508_LN3A.Value;
               &MW508_LN3 = &MW508_REC.GPUS_YE_MW508_LN3.Value;
               &MW508_LN4 = &MW508_REC.GPUS_YE_MW508_LN4.Value;
               &MW508_LN5 = &MW508_REC.GPUS_YE_MW508_LN5.Value;
               &MW508_LN6 = &MW508_REC.GPUS_YE_MW508_LN6.Value;
               &MW508_LN7 = &MW508_REC.GPUS_YE_MW508_LN7.Value;
               &MW508_LN8 = &MW508_REC.GPUS_YE_MW508_LN8.Value;
               &MW508_LN9 = &MW508_REC.GPUS_YE_MW508_LN9.Value;

               &REMD_REC.GPUS_TAX_YEAR.Value = &RE_REC.CALENDAR_YEAR.Value;
               &REMD_REC.FEDERAL_EIN.Value = &RE_ARRAY [1];
               &REMD_REC.GPUS_MW508_NAME.Value = Left(&RE_REC.DESCR.Value | Rept(" ", 57),
57);
               &REMD_REC.GPUS_MW508_ADDRESS.Value = Left(&RE_REC.ADDRESS1.Value | Rept(" ",
22), 22);
               &REMD_REC.GPUS_MW508_CITY.Value = Left(&RE_REC.CITY.Value | Rept(" ", 22),
22);
               &REMD_REC.GPUS_MW508_STATE.Value = Left(&RE_REC.STATE.Value | Rept(" ", 2),
2);
               &REMD_REC.GPUS_MW508_ZIP_CD.Value = Left(&RE_REC.ZIP.Value | Rept(" ", 5), 5);
               &REMD_REC.GPUS_MW508_ZIP_EXT.Value = Left(&RE_REC.GPUS_ZIPEXTN.Value |
Rept(" ", 4), 4);
               &REMD_REC.GPUS_MW508_LN1_STR.Value = Right(Rept("0", 6) | String(&RS_COUNT),
6);
               &REMD_REC.GPUS_MW508_LN2_STR.Value = FLFormat(&MW508_LN2, 12, "0");
               &REMD_REC.GPUS_MW508_LN3ASTR.Value = FLFormat(&MW508_LN3A, 12, "0");
               &REMD_REC.GPUS_MW508_LN3_STR.Value = FLFormat(&MW508_LN3, 12, "0");
               &REMD_REC.GPUS_MW508_LN4_STR.Value = FLFormat(&MW508_LN4, 12, "0");
               &REMD_REC.GPUS_MW508_LN5_STR.Value = FLFormat(&MW508_LN5, 12, "0");
               &REMD_REC.GPUS_MW508_LN6_STR.Value = FLFormat(&MW508_LN6, 12, "0");
               &REMD_REC.GPUS_MW508_LN7_STR.Value = FLFormat(&MW508_LN7, 12, "0");
               &REMD_REC.GPUS_MW508_LN8_STR.Value = FLFormat(&MW508_LN8, 12, "0");
               &REMD_REC.GPUS_MW508_LN9_STR.Value = FLFormat(&MD_Emplr_Gross_Payroll, 12,
"0");
               &REMD_REC.GPUS_MW508_PIK_AMT.Value = Rept("0", 12);
               &REMD_REC.GPUS_MW508_REP_NM.Value = Left(&MW508_REC.GPUS_MW508_REP_NM.Value
| Rept(" ", 28), 28);
               &REMD_REC.GPUS_MW508_TITLE.Value = Left(&MW508_REC.GPUS_MW508_TITLE.Value |
Rept(" ", 15), 15);
               &REMD_REC.GPUS_MW508_PHONE.Value =
Validate_Phone_Nbr(&MW508_REC.TELEPHONE_NBR.Value);
               &REMD_REC.GPUS_MW508_IND.Value = Left(&MW508_REC.GPUS_MW508_IND.Value | " ",
1);

               /* PARSE DATE TO A STRING IN YYYYMMDD FORMAT */
               If All(&MW508_REC.GPUS_MW508_DATE.Value) Then
                  &Year = Year(&MW508_REC.GPUS_MW508_DATE.Value);
                  &Month = Month(&MW508_REC.GPUS_MW508_DATE.Value);
                  &Day = Day(&MW508_REC.GPUS_MW508_DATE.Value);

                  If &Month < 10 Then
                     &TermMonth = "0" | RTrim(LTrim(String(&Month)));
                  Else
                     &TermMonth = RTrim(LTrim(String(&Month)));
                  End-If;

                  If &Day < 10 Then
                     &TermDay = "0" | RTrim(LTrim(String(&Day)));
                  Else
                     &TermDay = RTrim(LTrim(String(&Day)));
                  End-If;

                  &TermYear = String(&Year);

                  &REMD_REC.GPUS_MW508_SUB_DT.Value = &TermYear | &TermMonth | &TermDay;
               Else
                  &REMD_REC.GPUS_MW508_SUB_DT.Value = Rept(" ", 8);
               End-If;

               /* format the MD Central Registration Number */
               If &md_swt_ein <> "" Then
                  &STR = "";
                  For &I = 1 To 20
                     &CH = Substring(&md_swt_ein, &I, 1);

                     If &CH <> "-" And
                           &CH <> " " Then
                        &STR = &STR | &CH;
                     End-If;
                  End-For;
                  &STR = Substring(&STR, 1, 8);
                  If Not IsDigits(&STR) Then
                     MessageBox(0, "", 17295, 11, "Message not found.", &STR, &RPT_COMPANY);
                  End-If;
                  &REMD_REC.GPUS_MW508_CRN.Value = &STR;
               Else
                  &REMD_REC.GPUS_MW508_CRN.Value = Rept("0", 8);
               End-If;

               &YearStr = NumberToString("%04t", Year(%Date));
               &MonthStr = NumberToString("%02t", Month(%Date));
               &DayStr = NumberToString("%02t", Day(%Date));
               &HourStr = NumberToString("%02t", Hour(%Datetime));
               &MinuteStr = NumberToString("%02t", Minute(%Datetime));
               &SecondStr = NumberToString("%02t", Second(%Datetime));

               &RV_REC.GPUS_BLNK_510.Value = "24" | "MW508" | &REMD_REC.GPUS_TAX_YEAR.Value
| &REMD_REC.FEDERAL_EIN.Value | &REMD_REC.GPUS_MW508_CRN.Value |
&REMD_REC.GPUS_MW508_NAME.Value | &REMD_REC.GPUS_MW508_ADDRESS.Value |
&REMD_REC.GPUS_MW508_CITY.Value | &REMD_REC.GPUS_MW508_STATE.Value |
&REMD_REC.GPUS_MW508_ZIP_CD.Value | &REMD_REC.GPUS_MW508_ZIP_EXT.Value |
&REMD_REC.GPUS_MW508_LN1_STR.Value | &REMD_REC.GPUS_MW508_LN2_STR.Value |
&REMD_REC.GPUS_MW508_LN3_STR.Value | &REMD_REC.GPUS_MW508_LN3ASTR.Value | Rept("0", 12) |
&REMD_REC.GPUS_MW508_LN4_STR.Value | &REMD_REC.GPUS_MW508_LN5_STR.Value |
&REMD_REC.GPUS_MW508_LN6_STR.Value | &REMD_REC.GPUS_MW508_LN7_STR.Value |
&REMD_REC.GPUS_MW508_LN9_STR.Value | &REMD_REC.GPUS_MW508_PIK_AMT.Value |
&REMD_REC.GPUS_MW508_REP_NM.Value | &REMD_REC.GPUS_MW508_TITLE.Value |
&REMD_REC.GPUS_MW508_SUB_DT.Value | &REMD_REC.GPUS_MW508_PHONE.Value |
&REMD_REC.GPUS_MW508_IND.Value | Rept(" ", 166) | &YearStr | &MonthStr | &DayStr | &HourStr
| &MinuteStr | &SecondStr | "00";

            End-If;
            Break;
         When "ID"

            &ID967_REC = CreateRecord(Record.GPUS_ID967_VW);
            &SQL3_STEIN = CreateSQL("SELECT GPUS_SWT_EIN FROM %TABLE(GPUS_CO_ST_TAX) WHERE
COMPANY = :1 AND STATE = :2 AND EFFDT <= %datein(:3)", &RPT_COMPANY,
GPUS_SM1C_AET.GPUS_YE_STATE.Value, &cal_year, &swt_ein);
            While &SQL3_STEIN.FETCH(&swt_ein)
               &id_swt_ein = &swt_ein;
            End-While;

            &SQL3ID = CreateSQL("%SELECTALL(:1) WHERE OPRID = :2 AND RUN_CNTL_ID = :3 AND
COMPANY = :4", &ID967_REC, GPUS_SM1C_AET.OPRID.Value, GPUS_SM1C_AET.RUN_CNTL_ID.Value,
&RPT_COMPANY);

            If &SQL3ID.FETCH(&ID967_REC) Then
               &ID967_LN3 = &ID967_REC.GPUS_YE_ID967_LN3.Value;
               &ID967_LN3A = &ID967_REC.GPUS_YE_ID967_LN3A.Value;
               &ID967_LN3B = &ID967_REC.GPUS_YE_ID967_LN3B.Value;
               &ID967_LN3C = &ID967_REC.GPUS_YE_ID967_LN3C.Value;
               &ID967_LN3D = &ID967_REC.GPUS_YE_ID967_LN3D.Value;
               &ID967_LN5 = &ID967_REC.GPUS_YE_ID967_LN5.Value;
               &ID967_LN6 = &ID967_REC.GPUS_YE_ID967_LN6.Value;
               &ID967_LN11 = &ID967_REC.GPUS_YE_ID967_LN11.Value;
            End-If;

            &STR = "";
            /*only parse the first 10 characters to create a 4 character fiel */
            For &I = 1 To 10
               &CH = Substring(&RE_REC.DESCR.Value, &I, 1);
               /* only allow alphanumeric, & or - in the Name Control field */
               If IsAlphaNumeric(&CH) Or
                     &CH = "&" Or
                     &CH = "-" Then
                  &STR = &STR | &CH;
               End-If;
            End-For;
            &Name_Control = Substring(&STR, 1, 4);

            &State_Wages_str = NumberToDisplayString("%011", Round(&RV_State_Wages, 0));
            &State_Tax_str = NumberToDisplayString("%011", Round(&RV_State_Tax, 0));
            &ID967_LN2 = &RV_State_Tax;
            &CYCLE = &ID967_REC.GPUS_FILING_CYCLE.Value;
            If &ID967_REC.GPUS_FILING_CYCLE.Value = "S" Then
               &CYCLE = "B"
            Else
               If &ID967_REC.GPUS_FILING_CYCLE.Value = "A" Then
                  &CYCLE = "Y"
               End-If;
            End-If;

            If &ID967_REC.GPUS_FILING_CYCLE.Value = "S" Then
               &TotalPayments = NumberToString("%011", &ID967_LN3B) | NumberToString("%011",
&ID967_LN3A) | NumberToString("%011", &ID967_LN3C);
               &ID967_LN4 = &ID967_LN3D;
            Else
               &TotalPayments = NumberToString("%011", &ID967_LN3) | Rept(" ", 11) | Rept("
", 11);
               &ID967_LN4 = &ID967_LN2 - &ID967_LN3;
            End-If;
            &ID967_LN4_STR = NumberToString("%011.0", Abs(&ID967_LN4));
            If &ID967_LN4 < 0 Then
               &ID967_LN4_SUFFIX = "-";
            Else
               &ID967_LN4_SUFFIX = " ";
            End-If;
            &ID967_LN5_STR = NumberToString("%011", &ID967_LN5);
            &ID967_LN6_STR = NumberToString("%011", &ID967_LN6);
            &ID967_LN7 = &ID967_LN4 + &ID967_LN5 + &ID967_LN6;
            &ID967_LN7_STR = NumberToString("%011.0", Abs(&ID967_LN7));
            If &ID967_LN7 < 0 Then
               &ID967_LN7_SUFFIX = "-";
            Else
               &ID967_LN7_SUFFIX = " ";
            End-If;
            &RS_Count_Str = Right(Rept("0", 7) | String(&RS_COUNT), 7);
            &ID967_LN11_STR = NumberToString("%011", &ID967_LN11);
            &ID967_LN12 = &ID967_LN7 + &ID967_LN11;
            &ID967_LN12_STR = NumberToString("%011.0", Abs(&ID967_LN12));
            If &ID967_LN12 < 0 Then
               &ID967_LN12_SUFFIX = "-";
            Else
               &ID967_LN12_SUFFIX = " ";
            End-If;

            &RV_REC.GPUS_BLNK_510.Value = &trans_ein | &Name_Control | Right(Rept("0", 9) |
&state_ein, 9);
            &RV_REC.GPUS_BLNK_510.Value = &RV_REC.GPUS_BLNK_510.Value | &CYCLE | Right("0"
| String(&ID967_REC.GPUS_TAX_MONTH.value), 2) | String(GPUS_SM1C_AET.CALENDAR_YEAR.Value) |
&State_Wages_str | &State_Tax_str;
            &RV_REC.GPUS_BLNK_510.Value = &RV_REC.GPUS_BLNK_510.Value | &TotalPayments |
&ID967_LN4_STR | &ID967_LN4_SUFFIX | &ID967_LN5_STR | &ID967_LN6_STR | &ID967_LN7_STR |
&ID967_LN7_SUFFIX;
            &RV_REC.GPUS_BLNK_510.Value = &RV_REC.GPUS_BLNK_510.Value | &RS_Count_Str |
Rept("0", 7) | "0" | &RS_Count_Str | &ID967_LN11_STR | &ID967_LN12_STR | &ID967_LN12_SUFFIX
| Rept(" ", 335);
            Break;
         When "IN"
            &RS_Count_Str = Right(Rept("0", 13) | String(&RS_COUNT), 13);
            &State_Tax_str = FLFormat(&RV_State_Tax, 13, "0");
            &state_eic_str = FLFormat(&state_eic_T, 13, "0");
            &Local_Tax_Str = FLFormat(&Local_Tax_T, 13, "0");
            &RV_REC.GPUS_BLNK_510.Value = "18" | &RS_Count_Str | &State_Tax_str |
&Local_Tax_Str | &state_eic_str;
            &RV_State_Tax = 0;
            &state_eic_T = 0;
            &Local_Tax_T = 0;

            Break;
         When "IL"
         When "NE"
         When "OR"
            &RS_Count_Str = Right(Rept("0", 7) | String(&RS_COUNT), 7);
            &State_Wages_str = FLFormat(&RV_State_Wages, 15, "0");
            &State_Tax_str = FLFormat(&RV_State_Tax, 15, "0");
            &RV_REC.GPUS_BLNK_510.Value = &RS_Count_Str | &State_Wages_str | &State_Tax_str;

            Break;
         When "MN"
            &v1 = Rept(" ", 27);
            &RS_Count_Str = Right(Rept("0", 7) | String(&RS_COUNT), 7);
            &v2 = Rept(" ", 36);
            &State_Wages_str = FLFormat(&RV_State_Wages, 15, "0");
            &State_Tax_str = FLFormat(&RV_State_Tax, 15, "0");
            &RV_REC.GPUS_BLNK_510.Value = &v1 | &RS_Count_Str | &v2 | &State_Wages_str |
&State_Tax_str;

            Break;
         End-Evaluate;

         Evaluate GPUS_SM1C_AET.GPUS_YE_STATE.Value
         When "MD"
         When "ID"
         When "IL"
         When "IN"
         When "NE"
         When "MN"
         When "OR"
            &ST_File.WriteRecord(&RV_REC);
            &Write_RV = "N";
         End-Evaluate;
      End-If;
   End-While;

   /*Write RF Record*/
   &RF_REC.GPUS_REC_ID.Value = "RF";
   &RF_REC.GPUS_BLNK_5.Value = " ";
   &RF_REC.GPUS_BLNK_496.Value = " ";
   Evaluate GPUS_SM1C_AET.GPUS_YE_STATE.Value
   When = "CO"
      &RF_REC.GPUS_RW_TOT.Value = " ";
      Break;
   When "CT"
      &temp1_str = FLFormat(&Count_F, 9, "0");
      &temp2_str = FLFormat(&State_Wages_F, 16, "0");
      &RF_REC.GPUS_BLNK_5.Value = Left(&temp1_str, 5);
      &RF_REC.GPUS_RW_TOT.Value = Right(&temp1_str, 4) | Left(&temp2_str, 5);
      &RF_REC.GPUS_BLNK_496.Value = Right(&temp2_str, 11) | FLFormat(&State_Tax_F, 16, "0")
| Rept(" ", 469);
      Break;
   When "PA"
      &temp1_str = FLFormat(&Count_F, 7, "0");
      &temp2_str = FLFormat(&State_Wages_F, 15, "0");
      &temp3_str = FLFormat(&State_Tax_F, 15, "0");
      &RF_REC.GPUS_BLNK_496.Value = Rept(" ", 459) | &temp1_str | &temp2_str | &temp3_str;
      Break;
   When-Other
      &RF_REC.GPUS_RW_TOT.Value = FLFormat(&Count_F, 9, "0");
      &RF_REC.GPUS_BLNK_496.Value = " ";
   End-Evaluate;

   Evaluate GPUS_SM1C_AET.GPUS_YE_STATE.Value
   When "AL"
   When "LA"
   When "MD"
   When "NC"
      Break;
   When-Other
      &ST_File.WriteRecord(&RF_REC);
   End-Evaluate;
End-If;

/* If Employee found, close the Ffile else delete the File*/
If (&RA_Found = "N" Or
         &RW_Found = "N") Then
   &ST_File.Delete();
       Else
          &ST_File.Close();
       End-If;




PeopleCode (Page): GPCH_EG_SEND_OPTN.Activate
       If GPCH_EG_PRO_DW.GPCH_SI_PROV_TYPE = "A" Then
          GPCH_EG_PRO_DW.GPCH_EG_SIGN = "N";
          GPCH_EG_PRO_DW.GPCH_EG_SIGN.Enabled = False;
          GPCH_EG_PRO_DW.GPCH_EG_TESTMODE.Enabled = False;
       Else
          GPCH_EG_PRO_DW.GPCH_EG_TESTMODE.Enabled = False;
          GPCH_EG_PRO_DW.GPCH_EG_SIGN.Enabled = False;

            If GPCH_EG_PRO_DW.GPCH_EG_POWERUSER = "Y" Then
               GPCH_EG_PRO_DW.GPCH_EG_TESTMODE.Enabled = True;
               GPCH_EG_PRO_DW.GPCH_EG_SIGN.Enabled = True;
            End-If;

       End-If;
       GPCH_EG_PRO_DW.GPCH_EG_COMPRESS = "N";
       GPCH_EG_PRO_DW.GPCH_EG_COMPRESS.Enabled = False;
       GPCH_EG_PRO_DW.GPCH_EG_ENCRYPT = "N";
       GPCH_EG_PRO_DW.GPCH_EG_ENCRYPT.Enabled = False;




PeopleCode (Page): GPCH_TX_DATA.Activate
       Local Rowset &RS;

       &RS = CreateRowset(Record.GPCH_TX_DATA);

       &emplid =
       GetLevel0().GetRow(1).GetRowset(Scroll.GPCH_TX_DATA).GetRow(1).GPCH_TX_DATA.EMPLID.Value;
       &empl_rcd =
       GetLevel0().GetRow(1).GetRowset(Scroll.GPCH_TX_DATA).GetRow(1).GPCH_TX_DATA.EMPL_RCD.Valu
       e;


       &NUM_READ = &RS.Fill("Where EMPLID=:1 and EMPL_RCD=:2", &emplid, &empl_rcd);

       If &NUM_READ = 0 Then
          WinMessage(MsgGet(17051, 185, "No setup exists! Default values are being fetched. Please
       save the page if you want to keep these values."));

            /* Change the value of empl_rcd and set it back so that tools thinks that a field was modified
       */

       GetLevel0().GetRow(1).GetRowset(Scroll.GPCH_TX_DATA).GetRow(1).GPCH_TX_DATA.EMPL_RCD.Valu
       e =
       GetLevel0().GetRow(1).GetRowset(Scroll.GPCH_TX_DATA).GetRow(1).GPCH_TX_DATA.EMPL_RCD.Valu
       e + 1;

       GetLevel0().GetRow(1).GetRowset(Scroll.GPCH_TX_DATA).GetRow(1).GPCH_TX_DATA.EMPL_RCD.Valu
       e = &empl_rcd;
       End-If;




PeopleCode (Page): GPES_TERM_MNG.Activate
       /*If field GPES_OVERW_INDM is checked on, enables the related field of
       the group box*/

       If GPES_TERM_MNG.GPES_OVERW_INDM = "Y" Then
          GPES_TERM_MNG.GPES_INDM_DAYS.Enabled = True;
          GPES_TERM_MNG.GPES_MAX_PRDS.Enabled = True;
          GPES_TERM_MNG.GPES_INDM_AMT.Enabled = True;
       Else

          GPES_TERM_MNG.GPES_INDM_DAYS.Enabled = False;
          GPES_TERM_MNG.GPES_MAX_PRDS.Enabled = False;
          GPES_TERM_MNG.GPES_INDM_AMT.Enabled = False;
       End-If;

       /*If field GPES_APPEAL_FLG is checked on, enables the related field of
       the group box*/

       If GPES_TERM_MNG.GPES_APPEAL_FLG = "Y" Then
          GPES_TERM_MNG.GPES_CONC_DT.Enabled = True;
          GPES_TERM_MNG.GPES_SEN_DT.Enabled = True;
          GPES_TERM_MNG.GPES_FINAL_DT.Enabled = True;
          GPES_TERM_MNG.GPES_SEN_LITIG.Enabled = True;
          GPES_TERM_MNG.GPES_SEN_INDM.Enabled = True;
          GPES_TERM_MNG.GPES_UNEMP_BENF.Enabled = True;
       Else
          GPES_TERM_MNG.GPES_CONC_DT.Enabled = False;
          GPES_TERM_MNG.GPES_SEN_DT.Enabled = False;
          GPES_TERM_MNG.GPES_FINAL_DT.Enabled = False;
          GPES_TERM_MNG.GPES_SEN_LITIG.Enabled = False;
          GPES_TERM_MNG.GPES_SEN_INDM.Enabled = False;
          GPES_TERM_MNG.GPES_UNEMP_BENF.Enabled = False;
       End-If;

       /* If Seniority Pay Calc Date is null, show the field Company Seniority Date */
       If None(PER_ORG_ASGN.SENIORITY_PAY_DT) Then
          PER_ORG_ASGN.SENIORITY_PAY_DT.Visible = False;
          PER_ORG_ASGN.CMPNY_SENIORITY_DT.Visible = True;
       Else
          PER_ORG_ASGN.SENIORITY_PAY_DT.Visible = True;
          PER_ORG_ASGN.CMPNY_SENIORITY_DT.Visible = False;
       End-If;




PeopleCode (Page): GP_ABS_EVENT_SEC.Activate
       Declare Function GetPayeeCountry PeopleCode DERIVED_GP.COUNTRY FieldFormula;

       Component string &Component_Name;

       DERIVED_GP.TITLE_MAIN = &Component_Name;
       DERIVED_GP.GP_PAGE_TITLE.Value = MsgGetText(17000, 4061, "");

       DERIVED.GP_EDIT_FLD1.Value = "GP_ABS_REASON";
       DERIVED_GP.LABEL1.Label = MsgGetText(17000, 1667, "");

       /* set the WorkFlow Status column Label */
       DERIVED_GP_ABS.GP_ABS_EVT_STAT.Label = MsgGetText(17441, 28, "Message Not Found");
       DERIVED_ABS_SS.DESCR1.Label = MsgGetText(17441, 21, "Message Not Found");

       If None(GP_ABS_EVENT.PIN_TAKE_NUM.Value) Then
          GP_PIN.COUNTRY.Value = GetPayeeCountry(GP_ABS_EVENT.EMPLID.Value,
       GP_ABS_EVENT.EMPL_RCD.Value);
       End-If;




PeopleCode (Component): GPCH_IF_TX07(GBL).SavePostChange
       Local Rowset &Rs1, &Rs2, &Rs3, &Rs4;
       Local Row &Row;


       &Rs1 = GetLevel0();
&Rs2 = &Rs1(1).GetRowset(Scroll.GPCH_IF_TX07);

&Rs3 = GetLevel0();
&Rs4 = &Rs3(1).GetRowset(Scroll.GPCH_IF_TX07);

&N_NEW_ROW_NUM = CurrentRowNumber();


SQLExec(SQL.GPCH_FETCH_PERS_ONL_XML,
Year(&Rs4(&Rs4.ActiveRowCount).GPCH_IF_TX07.BEGIN_DT.Value),
&Rs4(&N_NEW_ROW_NUM).GPCH_IF_TX07.COMPANY.Value, "8",
&Rs4(&N_NEW_ROW_NUM).GPCH_IF_TX07.EMPLID.Value,
&Rs4(&N_NEW_ROW_NUM).GPCH_IF_TX07.EMPL_RCD.Value,
&Rs4(&Rs4.ActiveRowCount).GPCH_IF_TX07.BEGIN_DT.Value,
&Rs4(&Rs4.ActiveRowCount).GPCH_IF_TX07.END_DT.Value,
&Rs4(&Rs4.ActiveRowCount).GPCH_IF_TX07.GPCH_EG_DOMAINID.Value, &GPCH_EG_DOMAINID, &YEAR,
&COMPANY, &GPCH_SI_PROV_TYPE, &EMPLID, &EMPL_RCD, &BEGIN_DT, &END_DT, &GPCH_IF_VER,
&GPCH_EG_PRSN_XML, &GPCH_SI_PROV_CD);
rem shant SQLExec(SQL.GPCH_FETCH_PERS_ONL_XML,
Year(&Rs4(&Rs4.ActiveRowCount).GPCH_IF_TX07.BEGIN_DT.Value),
&Rs4(&N_NEW_ROW_NUM).GPCH_IF_TX07.COMPANY.Value, "8",
&Rs4(&N_NEW_ROW_NUM).GPCH_IF_TX07.EMPLID.Value,
&Rs4(&N_NEW_ROW_NUM).GPCH_IF_TX07.EMPL_RCD.Value,
&Rs4(&Rs4.ActiveRowCount).GPCH_IF_TX07.BEGIN_DT.Value,
&Rs4(&Rs4.ActiveRowCount).GPCH_IF_TX07.END_DT.Value,
&Rs4(&Rs4.ActiveRowCount).GPCH_IF_TX07.GPCH_EG_DOMAINID.Value, &GPCH_EG_DOMAINID, &YEAR,
&COMPANY, &GPCH_SI_PROV_TYPE, &EMPLID, &EMPL_RCD, &BEGIN_DT, &END_DT, &GPCH_IF_VER,
&GPCH_EG_PRSN_XML, &GPCH_SI_PROV_CD);


For &i = 1 To &Rs2.RowCount
   SQLExec(SQL.GPCH_FETCH_PERS_ONL_XML, Year(&Rs4(&i).GPCH_IF_TX07.BEGIN_DT.Value),
&Rs4(&N_NEW_ROW_NUM).GPCH_IF_TX07.COMPANY.Value, "8",
&Rs4(&N_NEW_ROW_NUM).GPCH_IF_TX07.EMPLID.Value,
&Rs4(&N_NEW_ROW_NUM).GPCH_IF_TX07.EMPL_RCD.Value, &Rs4(&i).GPCH_IF_TX07.BEGIN_DT.Value,
&Rs4(&i).GPCH_IF_TX07.END_DT.Value,
&Rs4(&Rs4.ActiveRowCount).GPCH_IF_TX07.GPCH_EG_DOMAINID.Value, &GPCH_EG_DOMAINID, &YEAR,
&COMPANY, &GPCH_SI_PROV_TYPE, &EMPLID, &EMPL_RCD, &BEGIN_DT, &END_DT, &GPCH_IF_VER,
&GPCH_EG_PRSN_XML, &GPCH_SI_PROV_CD);
   &Row = &Rs2.GetRow(&i);
   If &Row.IsNew And
         &Row.IsChanged Then
      &Rec = CreateRecord(Record.GPCH_EG_PERSON);
      &Rec.GPCH_EG_DOMAINID.value = &GPCH_EG_DOMAINID;
      &Rec.GPCH_RC_PAY_YEAR.Value = &YEAR;
      &Rec.COMPANY.Value = &COMPANY;
      &Rec.GPCH_SI_PROV_TYPE.Value = &GPCH_SI_PROV_TYPE;
      &Rec.EMPLID.Value = &EMPLID;
      &Rec.EMPL_RCD.value = &EMPL_RCD;
      &Rec.BEGIN_DT.Value = &BEGIN_DT;
      &Rec.END_DT.Value = &END_DT;
      &Rec.GPCH_IF_VER.Value = &GPCH_IF_VER + 1;
      &Rec.GPCH_EG_PRSN_XML.Value = &GPCH_EG_PRSN_XML;
      &Rec.GPCH_SI_PROV_CD.Value = &GPCH_SI_PROV_CD;
      &Rec.Insert();

   End-If;


   If &Row.IsDeleted Then
      SQLExec("Delete from PS_GPCH_EG_PERSON Where GPCH_SI_PROV_TYPE = :1 AND EMPLID = :2 and
EMPL_RCD = :3 AND BEGIN_DT = %DateIn(:4) AND END_DT = %DateIn(:5) AND GPCH_IF_VER = :6", "8",
&Rs4(&i).GPCH_IF_TX07.EMPLID.Value, &Rs4(&i).GPCH_IF_TX07.EMPL_RCD.Value,
&Rs4(&i).GPCH_IF_TX07.BEGIN_DT.Value, &Rs4(&i).GPCH_IF_TX07.END_DT.Value,
&Rs4(&i).GPCH_IF_TX07.GPCH_IF_VER.Value)
      SQLExec("Delete from PS_GPCH_EG_PERSON Where GPCH_SI_PROV_TYPE = :1 AND EMPLID = :2
and EMPL_RCD = :3 AND BEGIN_DT = %DateIn(:4) AND END_DT = %DateIn(:5) AND GPCH_IF_VER = :6",
"8", &Rs4(&i).GPCH_IF_TX07.EMPLID.Value, &Rs4(&i).GPCH_IF_TX07.EMPL_RCD.Value,
&Rs4(&i).GPCH_IF_TX07.BEGIN_DT.Value, &Rs4(&i).GPCH_IF_TX07.END_DT.Value,
&Rs4(&i).GPCH_IF_TX07.GPCH_IF_VER.Value)
   End-If;
      End-For;

      /*FMB 20090118 */
      SQLExec(SQL.GPCH_FETCH_PERS_IDENT,
      Year(&Rs4(&Rs4.ActiveRowCount).GPCH_IF_TX07.BEGIN_DT.Value),
      &Rs4(&N_NEW_ROW_NUM).GPCH_IF_TX07.COMPANY.Value, "0",
      &Rs4(&N_NEW_ROW_NUM).GPCH_IF_TX07.EMPLID.Value,
      &Rs4(&N_NEW_ROW_NUM).GPCH_IF_TX07.EMPL_RCD.Value,
      &Rs4(&Rs4.ActiveRowCount).GPCH_IF_TX07.GPCH_EG_DOMAINID.Value, &GPCH_EG_DOMAINID, &YEAR,
      &COMPANY, &GPCH_SI_PROV_TYPE, &EMPLID, &EMPL_RCD, &BEGIN_DT, &END_DT, &GPCH_IF_VER,
      &GPCH_EG_PRSN_XML, &GPCH_SI_PROV_CD);
      rem shant SQLExec(SQL.GPCH_FETCH_PERS_IDENT,
      Year(&Rs4(&Rs4.ActiveRowCount).GPCH_IF_TX07.BEGIN_DT.Value),
      &Rs4(&N_NEW_ROW_NUM).GPCH_IF_TX07.COMPANY.Value, "0",
      &Rs4(&N_NEW_ROW_NUM).GPCH_IF_TX07.EMPLID.Value,
      &Rs4(&N_NEW_ROW_NUM).GPCH_IF_TX07.EMPL_RCD.Value,
      &Rs4(&Rs4.ActiveRowCount).GPCH_IF_TX07.GPCH_EG_DOMAINID.Value, &GPCH_EG_DOMAINID, &YEAR,
      &COMPANY, &GPCH_SI_PROV_TYPE, &EMPLID, &EMPL_RCD, &BEGIN_DT, &END_DT, &GPCH_IF_VER,
      &GPCH_EG_PRSN_XML, &GPCH_SI_PROV_CD);

      For &i = 1 To &Rs2.RowCount
         SQLExec(SQL.GPCH_FETCH_PERS_IDENT, Year(&Rs4(&i).GPCH_IF_TX07.BEGIN_DT.Value),
      &Rs4(&N_NEW_ROW_NUM).GPCH_IF_TX07.COMPANY.Value, "0",
      &Rs4(&N_NEW_ROW_NUM).GPCH_IF_TX07.EMPLID.Value,
      &Rs4(&N_NEW_ROW_NUM).GPCH_IF_TX07.EMPL_RCD.Value,
      &Rs4(&Rs4.ActiveRowCount).GPCH_IF_TX07.GPCH_EG_DOMAINID.Value, &GPCH_EG_DOMAINID, &YEAR,
      &COMPANY, &GPCH_SI_PROV_TYPE, &EMPLID, &EMPL_RCD, &BEGIN_DT, &END_DT, &GPCH_IF_VER,
      &GPCH_EG_PRSN_XML, &GPCH_SI_PROV_CD);
         &Row = &Rs2.GetRow(&i);
         If &Row.IsNew And
               &Row.IsChanged Then
            &Rec = CreateRecord(Record.GPCH_EG_PERSON);
            &Rec.GPCH_EG_DOMAINID.value = &GPCH_EG_DOMAINID;
            &Rec.GPCH_RC_PAY_YEAR.Value = &YEAR;
            &Rec.COMPANY.Value = &COMPANY;
            &Rec.GPCH_SI_PROV_TYPE.Value = &GPCH_SI_PROV_TYPE;
            &Rec.EMPLID.Value = &EMPLID;
            &Rec.EMPL_RCD.value = &EMPL_RCD;
            &Rec.BEGIN_DT.Value = &BEGIN_DT;
            &Rec.END_DT.Value = &END_DT;
            &Rec.GPCH_IF_VER.Value = &GPCH_IF_VER + 1;
            &Rec.GPCH_EG_PRSN_XML.Value = &GPCH_EG_PRSN_XML;
            &Rec.GPCH_SI_PROV_CD.Value = &GPCH_SI_PROV_CD;
            &Rec.Insert();
         End-If;

         If &Row.IsDeleted Then
            SQLExec("Delete from PS_GPCH_EG_PERSON Where GPCH_SI_PROV_TYPE = :1 AND EMPLID = :2 and
      EMPL_RCD = :3 AND GPCH_IF_VER = :4 AND GPCH_RC_PAY_YEAR = :5", "0",
      &Rs4(&i).GPCH_IF_TX07.EMPLID.Value, &Rs4(&i).GPCH_IF_TX07.EMPL_RCD.Value,
      &Rs4(&i).GPCH_IF_TX07.GPCH_IF_VER.Value,
      Year(&Rs4(&Rs4.ActiveRowCount).GPCH_IF_TX07.BEGIN_DT.Value))
            SQLExec("Delete from PS_GPCH_EG_PERSON Where GPCH_SI_PROV_TYPE = :1 AND EMPLID = :2
      and EMPL_RCD = :3 AND GPCH_IF_VER = :4 AND GPCH_RC_PAY_YEAR = :5", "0",
      &Rs4(&i).GPCH_IF_TX07.EMPLID.Value, &Rs4(&i).GPCH_IF_TX07.EMPL_RCD.Value,
      &Rs4(&i).GPCH_IF_TX07.GPCH_IF_VER.Value, Year(&Rs4(&i).GPCH_IF_TX07.BEGIN_DT.Value))
         End-If;
      End-For;




PeopleCode (Component): GPCH_RC_EGOVT(GBL).SavePostChange
      Declare   Function   Gen_Header_XML PeopleCode GPCH_EG_STAT_DW.FUNCLIB FieldFormula;
      Declare   Function   Get_File_status PeopleCode GPCH_EG_STAT_DW.FUNCLIB FieldFormula;
      Declare   Function   get_seq_no PeopleCode GPCH_EG_STAT_DW.FUNCLIB FieldFormula;
      Declare   Function   Get_status PeopleCode GPCH_EG_STAT_DW.FUNCLIB FieldFormula;
      Declare   Function   GetProviderSubselect PeopleCode GPCH_EG_STAT_DW.FUNCLIB FieldFormula;
      Declare   Function   GetCalDates PeopleCode GPCH_EG_STAT_DW.FUNCLIB FieldFormula;
Global string &ResendStatus;

&ResendStatus = "N";
&prov_type_old = "";
&quote = "'";
&prov_type_old_fstatus = " ";
&prov_type_old_pstatus = " ";
Local boolean &Run_option = False;
&fstatus_rec = CreateRecord(Record.GPCH_EG_FSTATUS);
&pstatus_rec = CreateRecord(Record.GPCH_EG_PSTATUS);
&pstatus_rec1 = CreateRecord(Record.GPCH_EG_PSTATUS);
&run_status_rec = CreateRecord(Record.GPCH_EG_REPORTS);
&pheader = CreateRecord(Record.GPCH_EG_PHEADER);
&fheader = CreateRecord(Record.GPCH_EG_FHEADER);
&Ptotals_rec = CreateRecord(Record.GPCH_EG_PTOTALS);
Local number &year = Value(GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR);
&SS = CreateRowset(Record.GPCH_EG_FSTA_VW);
&acc_ins = CreateRowset(Record.GPCH_SI_ACC_INS);
&run_status = CreateRowset(Record.GPCH_EG_RSTATUS);
&pstatus_vw_rec = CreateRowset(Record.GPCH_EG_PSTA_VW);
&pstatus_rec1 = CreateRowset(Record.GPCH_EG_PSTATUS);
&ParamSetup = GetLevel0().GetRow(1).GetRowset(Scroll.GPCH_EG_ST_HDR);
&RSetup = GetLevel0().GetRow(1).GetRowset(Scroll.GPCH_EG_RSTATUS);
&pstatus = GetLevel0().GetRow(1).GetRowset(Scroll.GPCH_EG_PSTATUS);
&rstatus_rec = CreateRecord(Record.GPCH_EG_RSTATUS);


&Year_date = Date3(&year, 12, 31);

&PoviderSelect = GetProviderSubselect();

If &PoviderSelect <> "" Then
   &PoviderSelect = "AND (" | &PoviderSelect | ")";
End-If;


&ProviderCode_clause = GetSQL(SQL.GPCH_EG_PROV).Value | &PoviderSelect;

&SS.Fill(&ProviderCode_clause | "ORDER BY FILL.GPCH_EG_F_GROUB", GPCH_RC_PAYROLL.COMPANY,
GPCH_RC_PAYROLL.GPCH_EG_DOMAINID, &Year_date);
&where_clause = "WHERE COMPANY = " | &quote | GPCH_RC_PAYROLL.COMPANY | &quote | "AND
GPCH_EG_DOMAINID=" | GPCH_RC_PAYROLL.GPCH_EG_DOMAINID | " AND GPCH_RC_PAY_YEAR=" |
GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR;
&run_status_where_clause = "WHERE COMPANY = " | &quote | GPCH_RC_PAYROLL.COMPANY | &quote |
"AND GPCH_EG_DOMAINID=" | GPCH_RC_PAYROLL.GPCH_EG_DOMAINID | " AND GPCH_RC_PAY_YEAR=" |
GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR | " AND GPCH_SI_PROV_TYPE=(:1)";
&acc_ins_where_clause = "where COMPANY=(:1) AND GPCH_SI_PROV_TYPE=(:2) AND
GPCH_TX_UV_PROV_CD=(:3) AND EFFDT = (SELECT MAX(EFFDT) FROM PS_GPCH_SI_ACC_INS WHERE
COMPANY=(:1) AND GPCH_SI_PROV_TYPE=(:2) AND GPCH_TX_UV_PROV_CD=(:3) AND EFFDT<=
%DATEIN(:4))";

&New_Month_run = False;
/* for loop for groub view */
For &i = 1 To &SS.RowCount
   &Run_option = False;
   &Cancel_option = False;
   &Rerun_option = True;
   &Pstatus_rownum = 0;

   /* for loop for Rstatus record */
   &tmp = &RSetup.ACTIVERowCount;
   &tmp2 = &SS.RowCount;

   For &m = 1 To &RSetup.ACTIVERowCount

      /* check the Rstatus record provider type is equal to groub view provider type then insert
into EG_REPORTS */
      &GPCH_EG_FSTA_VW_GPCH_SI_PROV_TYPE =
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_TYPE.Value;
      &GPCH_EG_RSTATUS_GPCH_SI_PROV_TYPE =
&RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value;
     &SSer = &SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_TYPE.Value;
     &RSET = &RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value;

      If &SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_TYPE.Value =
&RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value Or
            &RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value = 0 Or
            &RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value = "B" Then

         &run_status.fill(&run_status_where_clause,
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_TYPE.Value);
         &run_status_rec.OPRID.VALUE = %OperatorId;
         &run_status_rec.RUN_CNTL_ID.VALUE = GPCH_RC_PAYROLL.RUN_CNTL_ID.Value;
         &run_status_rec.GPCH_EG_DOMAINID.VALUE = GPCH_RC_PAYROLL.GPCH_EG_DOMAINID.Value;
         &run_status_rec.COMPANY.VALUE = GPCH_RC_PAYROLL.COMPANY.Value;
         &run_status_rec.GPCH_RC_PAY_YEAR.VALUE = GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR.Value;
         &run_status_rec.GPCH_SI_PROV_TYPE.VALUE =
&RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value;
         &run_status_rec.GPCH_EG_RPT_TYPE.VALUE =
&RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Value;
         &run_status_rec.GPCH_FK_QUARTER.VALUE =
&RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Value;
         If &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Value = "M" Then
            &run_status_rec.GPCH_AL_CPAY_ENDDT.VALUE =
&RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Value;
         End-If;
         If &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Value = "Y" Then
            &run_status_rec.GPCH_AL_CPAY_ENDDT.VALUE = &Year_date;
         End-If;

        If &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.Value = "Q" Then
           Evaluate(&RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Value)
           When "1"
              &run_status_rec.GPCH_AL_CPAY_ENDDT.VALUE = Date3(&year, 3, 31);
              Break;
           When "2"
              &run_status_rec.GPCH_AL_CPAY_ENDDT.VALUE = Date3(&year, 6, 30);
              Break;
           When "3"
              &run_status_rec.GPCH_AL_CPAY_ENDDT.VALUE = Date3(&year, 9, 30);
              Break;
           When "4"
              &run_status_rec.GPCH_AL_CPAY_ENDDT.VALUE = Date3(&year, 12, 31);
              Break;

            End-Evaluate;
         End-If;
         &run_status_rec.GPCH_RUN_OPTIONS.VALUE =
&RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_RUN_OPTIONS.Value;
         &run_status_rec.GPCH_CANCEL_OPTION.VALUE =
&RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_CANCEL_OPTION.Value;

         If &RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value = "A" Or
               &RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value = "5" Then
            If &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.VALUE = "M" Then
               SQLExec("Update PS_GPCH_RC_PAYROLL set GPCH_AL_CPAY_ENDDT= %Datein(:1)
,GPCH_RC_YEAR_OPT =:2 where RUN_CNTL_ID=:3",
&RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Value, "N",
GPCH_RC_PAYROLL.RUN_CNTL_ID);
               &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Enabled = False;
            Else
               If &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.VALUE = "Q" Then
                  SQLExec("Update PS_GPCH_RC_PAYROLL set GPCH_FK_QUARTER=
:1,GPCH_RC_YEAR_OPT =:2 where RUN_CNTL_ID=:3",
&RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Value, "Y",
GPCH_RC_PAYROLL.RUN_CNTL_ID);
                  SQLExec("Update PS_GPCH_RC_PAYROLL set GPCH_FK_QUARTER=
:1,GPCH_RC_YEAR_OPT =:2 ,GPCH_AL_CPAY_ENDDT= %Datein(:3) where RUN_CNTL_ID=:4",
&RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Value, "Y",
&run_status_rec.GPCH_AL_CPAY_ENDDT.VALUE, GPCH_RC_PAYROLL.RUN_CNTL_ID);
                  &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Enabled = False;
               End-If;
            End-If;
         End-If;

         If &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.VALUE = "Y" Then
            &New_Month_run = True;

            &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.VALUE = "N"
         End-If;
         /* check for row not deleted or if already exits then update else insert */
         &Newrec = False;
         If Not (&ParamSetup.GetRow(1).IsDeleted) Then
            &Newrec = &run_status_rec.Insert();
            If Not &Newrec Then
               &run_status_rec.update();
            End-If;

         End-If;

         /* check for Run option is selected */

         If &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_RUN_OPTIONS.Value = "Y" And
               &RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value <> 0 Then
            &Run_option = True;
         End-If;;

         /* check for Cancel option is selected */
         &prov = &RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value;
         If &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_CANCEL_OPTION.Value = "Y" And
               &RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value <> 0 Then
            &Cancel_option = True;
         End-If;

         /* This for loop will check the PSTATUS record is already have the same row.if it's
same row then Rerun_option is false */
         If &RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value <> 0 And
               &RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value <> "B" Then

            For &l = 1 To &pstatus.Rowcount

               If ((&pstatus.getrow(&l).IsDeleted) And
                        Not None(&pstatus.GetRow(&l).GPCH_EG_PSTATUS.COMPANY.Value)) Then
                  If (&Newrec) Then
                     &run_status_rec.delete(); /* Deletes the extra row inserted when a delete
happens for Monthly reports*/
                  End-If;
                  &pheader.GPCH_RC_PAY_YEAR.Value = GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR;
                  &pheader.GPCH_EG_DOMAINID.Value =
&pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_EG_DOMAINID.Value;
                  &pheader.COMPANY.Value =
&pstatus.GetRow(&l).GPCH_EG_PSTATUS.COMPANY.Value;
                  &pheader.GPCH_EG_REQUEST_ID.Value =
&pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_EG_REQUEST_ID.Value;
                  &pheader.GPCH_SI_PROV_TYPE.Value =
&pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_SI_PROV_TYPE.Value;
                  &pheader.GPCH_SI_PROV_CD.Value =
&pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_SI_PROV_CD.Value;
                  &pheader.delete();


                  &Ptotals_rec.GPCH_RC_PAY_YEAR.Value = GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR;
                  &Ptotals_rec.GPCH_EG_DOMAINID.Value =
&pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_EG_DOMAINID.Value;
                  &Ptotals_rec.COMPANY.Value =
&pstatus.GetRow(&l).GPCH_EG_PSTATUS.COMPANY.Value;
                  &Ptotals_rec.GPCH_EG_REQUEST_ID.Value =
&pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_EG_REQUEST_ID.Value;
                  &Ptotals_rec.GPCH_SI_PROV_TYPE.Value =
&pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_SI_PROV_TYPE.Value;
                  &Ptotals_rec.GPCH_SI_PROV_CD.Value =
&pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_SI_PROV_CD.Value;
                  &Ptotals_rec.delete();
                  &fheader.GPCH_RC_PAY_YEAR.Value = GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR;
                  &fheader.GPCH_EG_DOMAINID.Value =
&pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_EG_DOMAINID.Value;
                  &fheader.COMPANY.Value =
&pstatus.GetRow(&l).GPCH_EG_PSTATUS.COMPANY.Value;
                  &fheader.GPCH_EG_REQUEST_ID.Value =
&pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_EG_REQUEST_ID.Value;
                  &fheader.delete();

                  &req = &pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_EG_REQUEST_ID.Value;
                  &Caldates =
GetCalDates(&pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_EG_REQUEST_ID.Value);
                  rem   SQLExec("delete from PS_GPCH_EG_REPORTS where OPRID =%OperatorId
and RUN_CNTL_ID=:1 and GPCH_EG_DOMAINID =:2 and GPCH_RC_PAY_YEAR=:3 and COMPANY=:4 and
GPCH_SI_PROV_TYPE=5 and GPCH_EG_RPT_TYPE=:6 and GPCH_AL_CPAY_ENDDT=%Datein(:7)",
GPCH_RC_PAYROLL.RUN_CNTL_ID, GPCH_EG_FSTATUS.GPCH_EG_DOMAINID,
GPCH_EG_FSTATUS.GPCH_RC_PAY_YEAR, GPCH_EG_FSTATUS.COMPANY,
GPCH_EG_PRO_DW.GPCH_SI_PROV_TYPE, &reportType, &Date);



                  &run_status_rec.OPRID.VALUE = %OperatorId;
                  &run_status_rec.RUN_CNTL_ID.VALUE = GPCH_RC_PAYROLL.RUN_CNTL_ID.Value;
                  &run_status_rec.GPCH_EG_DOMAINID.VALUE =
GPCH_RC_PAYROLL.GPCH_EG_DOMAINID.Value;
                  &run_status_rec.COMPANY.VALUE = GPCH_RC_PAYROLL.COMPANY.Value;
                  &run_status_rec.GPCH_RC_PAY_YEAR.VALUE =
GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR.Value;
                  &run_status_rec.GPCH_SI_PROV_TYPE.VALUE =
&pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_SI_PROV_TYPE.Value;
                  &run_status_rec.GPCH_AL_CPAY_ENDDT.VALUE = &Caldates [2];
                  &run_status_rec.delete();

                  rem   SQLExec("delete from PS_GPCH_EG_PERSON where GPCH_EG_DOMAINID=:1 and
GPCH_RC_PAY_YEAR=:2 and COMPANY=:3 and GPCH_SI_PROV_TYPE=:4 and GPCH_SI_PROV_CD=:5 and
BEGIN_DT = %Datein(:6) and END_DT= %Datein(:7)", GPCH_EG_FSTATUS.GPCH_EG_DOMAINID,
GPCH_EG_FSTATUS.GPCH_RC_PAY_YEAR, GPCH_EG_FSTATUS.COMPANY,
GPCH_EG_PRO_DW.GPCH_SI_PROV_TYPE, GPCH_EG_PRO_DW.GPCH_SI_PROV_CD, &BeginDt, &Date);
                  /* delete form PS_GPCH_EG_PERSON*/

                  &Pstats_Company = &pstatus.GetRow(&l).GPCH_EG_PSTATUS.COMPANY.Value;
                  &Pstats_Year = GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR;
                  &Pstats_DomainId =
&pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_EG_DOMAINID.Value;
                  &Pstats_RequestID =
&pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_EG_REQUEST_ID.Value;
                  &Pstats_PovType =
&pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_SI_PROV_TYPE.Value;
                  &Pstats_ProvCode =
&pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_SI_PROV_CD.Value;

                  /* FMB 20090119 Delete only if no manual update exists */
                  &Del_EG_PErson_SQL = CreateSQL("delete from PS_GPCH_EG_PERSON where
GPCH_EG_DOMAINID=:1 and GPCH_RC_PAY_YEAR=:2 and COMPANY=:3 and GPCH_SI_PROV_TYPE=:4 and
GPCH_SI_PROV_CD=:5 and BEGIN_DT = %Datein(:6) and END_DT= %Datein(:7) and not exists ( select
'X' from PS_GPCH_EG_PERSON EG1 where PS_GPCH_EG_PERSON.GPCH_EG_DOMAINID =
EG1.GPCH_EG_DOMAINID and PS_GPCH_EG_PERSON.GPCH_RC_PAY_YEAR = EG1.GPCH_RC_PAY_YEAR and
PS_GPCH_EG_PERSON.COMPANY = EG1.COMPANY and PS_GPCH_EG_PERSON.GPCH_SI_PROV_TYPE =
EG1.GPCH_SI_PROV_TYPE and PS_GPCH_EG_PERSON.GPCH_SI_PROV_CD = EG1.GPCH_SI_PROV_CD and
PS_GPCH_EG_PERSON.EMPLID = EG1.EMPLID and PS_GPCH_EG_PERSON.EMPL_RCD = EG1.EMPL_RCD and
EG1.GPCH_IF_VER > 1 )");
                  &Del_EG_PErson_SQL.Execute(&Pstats_DomainId, &Pstats_Year,
&Pstats_Company, &Pstats_PovType, &Pstats_ProvCode, &Caldates [1], &Caldates [2]);

                  /* FMB 20090119 Delete as well GPCH_IF_TX07_1 and GPCH_IF_TX07 */
                  If &Pstats_PovType = "8" Then
                      &Del_IF_TX07_1_SQL = CreateSQL("delete from PS_GPCH_IF_TX07_1 where
COMPANY=:1 and BEGIN_DT >= %Datein(:2) and END_DT <= %Datein(:3) and exists ( select 'X' from
PS_GPCH_IF_TX07 T1 where PS_GPCH_IF_TX07_1.EMPLID = T1.EMPLID and PS_GPCH_IF_TX07_1.EMPL_RCD
= T1.EMPL_RCD and PS_GPCH_IF_TX07_1.BEGIN_DT = T1.BEGIN_DT and PS_GPCH_IF_TX07_1.END_DT =
T1.END_DT and PS_GPCH_IF_TX07_1.COMPANY = T1.COMPANY and T1.GPCH_EG_DOMAINID = :4 ) and not
exists ( select 'X' from PS_GPCH_IF_TX07 T1 where PS_GPCH_IF_TX07_1.EMPLID = T1.EMPLID and
PS_GPCH_IF_TX07_1.EMPL_RCD = T1.EMPL_RCD and PS_GPCH_IF_TX07_1.BEGIN_DT = T1.BEGIN_DT and
PS_GPCH_IF_TX07_1.END_DT = T1.END_DT and PS_GPCH_IF_TX07_1.COMPANY = T1.COMPANY and
T1.GPCH_EG_DOMAINID = :4 and T1.GPCH_IF_VER > 1 )");
                     &Del_IF_TX07_1_SQL.Execute(&Pstats_Company, &Caldates [1], &Caldates
[2], &Pstats_DomainId);

                      /* FMB 20090119 Second Delete GPCH_IF_TXO7 */
                      &Del_IF_TX07_SQL = CreateSQL("delete from PS_GPCH_IF_TX07 where
GPCH_EG_DOMAINID=:1 and COMPANY=:2 and BEGIN_DT >= %Datein(:3) and END_DT <= %Datein(:4) and
not exists ( select 'X' from PS_GPCH_IF_TX07 T1 where PS_GPCH_IF_TX07.GPCH_EG_DOMAINID =
T1.GPCH_EG_DOMAINID and PS_GPCH_IF_TX07.COMPANY = T1.COMPANY and PS_GPCH_IF_TX07.BEGIN_DT =
T1.BEGIN_DT and PS_GPCH_IF_TX07.END_DT = T1.END_DT and PS_GPCH_IF_TX07.EMPLID = T1.EMPLID and
PS_GPCH_IF_TX07.EMPL_RCD = T1.EMPL_RCD and T1.GPCH_IF_VER > 1 )");
                      &Del_IF_TX07_SQL.Execute(&Pstats_DomainId, &Pstats_Company, &Caldates
[1], &Caldates [2]);
                   End-If;


                  If (&l - 1 <> 0 And
                           Not None(&pstatus.GetRow(&l -
1).GPCH_EG_PSTATUS.GPCH_EG_REQUEST_ID.Value)) Then
                     &CaldatesNew = GetCalDates(&pstatus.GetRow(&l -
1).GPCH_EG_PSTATUS.GPCH_EG_REQUEST_ID.Value);
                     If &RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value = "A" Or
                           &RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value =
"5" Then
                        If &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.VALUE = "M"
Then
                           SQLExec("Update PS_GPCH_RC_PAYROLL set GPCH_AL_CPAY_ENDDT=
%Datein(:1) ,GPCH_RC_YEAR_OPT =:2 where RUN_CNTL_ID=:3", &CaldatesNew [2], "N",
GPCH_RC_PAYROLL.RUN_CNTL_ID);
                           &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Value =
&CaldatesNew [2];
                           GPCH_RC_PAYROLL.GPCH_AL_CPAY_ENDDT.Value = &CaldatesNew [2];
                        Else

                           If &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_EG_RPT_TYPE.VALUE =
"Q" Then
                              SQLExec("Update PS_GPCH_RC_PAYROLL set GPCH_FK_QUARTER=
:1,GPCH_RC_YEAR_OPT =:2 where RUN_CNTL_ID=:3", &CaldatesNew [3], "Y",
GPCH_RC_PAYROLL.RUN_CNTL_ID);
                              SQLExec("Update PS_GPCH_RC_PAYROLL set GPCH_AL_CPAY_ENDDT=
%Datein(:1) ,GPCH_RC_YEAR_OPT =:2 where RUN_CNTL_ID=:3", &CaldatesNew [2], "N",
GPCH_RC_PAYROLL.RUN_CNTL_ID);
                              GPCH_RC_PAYROLL.GPCH_AL_CPAY_ENDDT.Value = &CaldatesNew [2];
                              GPCH_RC_PAYROLL.GPCH_FK_QUARTER.Value = &CaldatesNew [3];
                              &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_AL_CPAY_ENDDT.Value
= &CaldatesNew [2];
                              &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_FK_QUARTER.Value =
&CaldatesNew [3];
                           End-If;
                        End-If;
                     End-If;
                  End-If;
               End-If;
            End-For;

            If &pstatus.ActiveRowcount = 1 Then
               If None(&pstatus.getrow(1).GPCH_EG_PSTATUS.COMPANY.Value) Then

                  &rstatus_rec.GPCH_EG_DOMAINID.VALUE =
GPCH_RC_PAYROLL.GPCH_EG_DOMAINID.Value;
                  &rstatus_rec.COMPANY.VALUE = GPCH_RC_PAYROLL.COMPANY.Value;
                  &rstatus_rec.GPCH_RC_PAY_YEAR.VALUE =
GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR.Value;
                  &rstatus_rec.GPCH_SI_PROV_TYPE.VALUE =
&RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value;
                  &rstatus_rec.GPCH_REPORT_STATUS.VALUE = "0008";
                  &rstatus_rec.update();
                  &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.enabled = True;
                  &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_EG_MONTH_RUN.Visible = True;

               End-If;
            End-If;
         End-If;
         For &l = 1 To &pstatus.activerowcount

            If (&pstatus.getrow(&l).GPCH_EG_PSTATUS.GPCH_SI_PROV_TYPE.Value =
&RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value And
                      &pstatus.getrow(&l).GPCH_EG_PSTATUS.GPCH_SI_PROV_CD.Value   =
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_CD.Value) Or
                  &RSetup.GetRow(&m).GPCH_EG_STAT_DW.GPCH_RUN_OPTIONS.Value <>    "Y" Or
                  &RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value =    0 Or
                  &RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value =    "B" Then
               &Rerun_option = False;
               Break;
            Else
               &Rerun_option = True;
            End-If;
         End-For;

         /*check PSTATUS record have atleast one row else set Rerun_option is false */

         If &pstatus.Rowcount <= 1 Then

            &Rerun_option = False;
         End-If;
         If &pstatus.ActiveRowcount = 1 Then
            If None(&pstatus.getrow(1).GPCH_EG_PSTATUS.COMPANY.Value) Then
               &Rerun_option = False;

               &rstatus_rec.GPCH_EG_DOMAINID.VALUE =
GPCH_RC_PAYROLL.GPCH_EG_DOMAINID.Value;
               &rstatus_rec.COMPANY.VALUE = GPCH_RC_PAYROLL.COMPANY.Value;
               &rstatus_rec.GPCH_RC_PAY_YEAR.VALUE =
GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR.Value;
               &rstatus_rec.GPCH_SI_PROV_TYPE.VALUE =
&pstatus.GetRow(1).GPCH_EG_PSTATUS.GPCH_SI_PROV_TYPE.Value;
               If ( Not (&ParamSetup.GetRow(1).ISdeleted) And
                        Not (&ParamSetup.GetRow(1).Isnew) And
                        (&pstatus.getrow(1).Isnew) And
                        Not (&pstatus.getrow(1).IsChanged) And
                        &pstatus.activerowcount = 1 And
                        &pstatus.Rowcount = 1 And
                        &New_Month_run = False) Then
                  &New_Month_run = True;
               End-If;



            End-If;
         End-If;

         If &RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value <> 0 And
               &i <> &SS.RowCount Then

            /*Rstatus record provider type is equal to groub view provider type then break
and do further steps*/

            Break;
         Else
            /* The final loop to Insert the File generate row*/
            If &RSetup.GetRow(&m).GPCH_EG_RSTATUS.GPCH_SI_PROV_TYPE.Value = "B" Then
               Break;
            End-If;
         End-If;
      End-If;
   End-For;
   If ( Not (&ParamSetup.GetRow(1).ISdeleted) And
            ((&ParamSetup.GetRow(1).Isnew) Or
               &New_Month_run = True)) And
         &Run_option = True Then
      /* insert into PSTATUS,FSTATUS and PTOTALS Record */

      &pstatus_rec.OPRID.Value = %OperatorId;
      &pstatus_rec.GPCH_RC_PAY_YEAR.Value = GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR;
      &pstatus_rec.GPCH_EG_DOMAINID.Value =
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_DOMAINID.Value;
      &pstatus_rec.COMPANY.Value = &SS.GetRow(&i).GPCH_EG_FSTA_VW.COMPANY.Value;

      /* The request Id is generated based on the GPCH_EG_F_GROUB value from GPCH_EG_FSTA_VW
view */
      If (&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_F_GROUB.Value <> &prov_type_old_pstatus)
Or
            (&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_TRANS_MODE.Value = 1) Or
            (&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_DISTRIBUTR.Value <> "Y") Or
            &New_Month_run = True Then
         &request_id = get_seq_no(&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_TYPE.Value);
      End-If;

      &pstatus_rec.GPCH_EG_REQUEST_ID.Value = &request_id;
      &prov_type_old = &SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_F_GROUB.Value;
      &pstatus_rec.GPCH_SI_PROV_TYPE.Value =
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_TYPE.Value;
      &pstatus_rec.GPCH_SI_PROV_CD.Value =
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_CD.Value;


      &Ptotals_rec.GPCH_RC_PAY_YEAR.Value = GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR;
      &Ptotals_rec.GPCH_EG_DOMAINID.Value =
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_DOMAINID.Value;
      &Ptotals_rec.COMPANY.Value = &SS.GetRow(&i).GPCH_EG_FSTA_VW.COMPANY.Value;
      &Ptotals_rec.GPCH_EG_REQUEST_ID.Value = &request_id;
      &Ptotals_rec.GPCH_SI_PROV_TYPE.Value =
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_TYPE.Value;

      &Ptotals_rec.GPCH_SI_PROV_CD.Value =
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_CD.Value;
      &acc_ins.FILL(&acc_ins_where_clause, &SS.GetRow(&i).GPCH_EG_FSTA_VW.COMPANY.Value,
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_TYPE.Value,
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_CD.Value, &Year_date);
      If &acc_ins.GetRow(1).GPCH_SI_ACC_INS.GPCH_ALL_CANTONFLG.VALUE = "Y" Then
         &pstatus_rec.GPCH_EG_USERKEY.Value = "99";
         &Ptotals_rec.GPCH_EG_USERKEY.Value = "99";
      Else
         If &acc_ins.GetRow(1).GPCH_SI_ACC_INS.GPCH_TX_CANTON.VALUE <> " " Then
            &pstatus_rec.GPCH_EG_USERKEY.Value =
&acc_ins.GetRow(1).GPCH_SI_ACC_INS.GPCH_TX_CANTON.VALUE;
            &Ptotals_rec.GPCH_EG_USERKEY.Value =
&acc_ins.GetRow(1).GPCH_SI_ACC_INS.GPCH_TX_CANTON.VALUE;
         End-If;
      End-If;
      &pstatus_rec.GPCH_REPORT_STATUS.Value = "0008";
      &pstatus_rec.GPCH_EG_RESEND.Value = "N";
      &pstatus_rec.GPCH_EG_COMPLETE.Value = "N";

      &pstatus_rec.Insert();
      &Ptotals_rec.Insert();


      &fstatus_rec.GPCH_RC_PAY_YEAR.Value = GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR;
      &fstatus_rec.GPCH_EG_DOMAINID.Value =
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_DOMAINID.Value;
      &fstatus_rec.COMPANY.Value = &SS.GetRow(&i).GPCH_EG_FSTA_VW.COMPANY.Value;
      &fstatus_rec.GPCH_REPORT_STATUS.Value = "0008";
      If (&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_F_GROUB.Value <> &prov_type_old_fstatus)
Or
           (&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_TRANS_MODE.Value = 1) Or
           (&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_DISTRIBUTR.Value <> "Y") Then
        &fstatus_rec.GPCH_EG_REQUEST_ID.Value = &request_id;
        &fstatus_rec.Insert();
     End-If;
     &prov_type_old_fstatus = &SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_F_GROUB.Value;
     &prov_type_old_pstatus = &SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_F_GROUB.Value;

  End-If;

   If Not (&ParamSetup.GetRow(1).Isdeleted) And
         &Cancel_option = True Then
      &No_rows = True;
      &pstatus_vw_rec.fill(&run_status_where_clause,
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_TYPE.Value);
      For &q = 1 To &pstatus_vw_rec.RowCount
         &pstatus_rec.OPRID.Value = %OperatorId;
         &pstatus_rec.GPCH_RC_PAY_YEAR.Value = GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR;
         &pstatus_rec.GPCH_EG_DOMAINID.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.GPCH_EG_DOMAINID.Value;
         &pstatus_rec.COMPANY.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.COMPANY.Value;
         &pstatus_rec.GPCH_EG_REQUEST_ID.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.GPCH_EG_REQUEST_ID.Value;
         &pstatus_rec.GPCH_SI_PROV_TYPE.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.GPCH_SI_PROV_TYPE.Value;
         &pstatus_rec.GPCH_SI_PROV_CD.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.GPCH_SI_PROV_CD.Value;
         &pstatus_rec.delete();


         &pheader.GPCH_RC_PAY_YEAR.Value = GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR;
         &pheader.GPCH_EG_DOMAINID.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.GPCH_EG_DOMAINID.Value;
         &pheader.COMPANY.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.COMPANY.Value;
         &pheader.GPCH_EG_REQUEST_ID.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.GPCH_EG_REQUEST_ID.Value;
         &pheader.GPCH_SI_PROV_TYPE.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.GPCH_SI_PROV_TYPE.Value;
         &pheader.GPCH_SI_PROV_CD.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.GPCH_SI_PROV_CD.Value;
         &pheader.delete();


         &Ptotals_rec.GPCH_RC_PAY_YEAR.Value = GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR;
         &Ptotals_rec.GPCH_EG_DOMAINID.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.GPCH_EG_DOMAINID.Value;
         &Ptotals_rec.COMPANY.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.COMPANY.Value;
         &Ptotals_rec.GPCH_EG_REQUEST_ID.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.GPCH_EG_REQUEST_ID.Value;
         &Ptotals_rec.GPCH_SI_PROV_TYPE.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.GPCH_SI_PROV_TYPE.Value;
         &Ptotals_rec.GPCH_SI_PROV_CD.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.GPCH_SI_PROV_CD.Value;
         rem &Ptotals_rec.delete();
         &pstatus_rec1.fill(&where_clause);
         For &j = 1 To &pstatus_rec1.activerowcount
            If &pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.GPCH_EG_REQUEST_ID.Value =
&pstatus_rec1.GETROW(&j).GPCH_EG_PSTATUS.GPCH_EG_REQUEST_ID.value Then
               &No_rows = False;
            End-If;
         End-For;
         If (&No_rows) Then
            &fstatus_rec.GPCH_RC_PAY_YEAR.Value = GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR;
            &fstatus_rec.GPCH_EG_DOMAINID.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.GPCH_EG_DOMAINID.Value;
            &fstatus_rec.COMPANY.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.COMPANY.Value;
            &fstatus_rec.GPCH_EG_REQUEST_ID.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.GPCH_EG_REQUEST_ID.Value;
            &fstatus_rec.delete();

            &fheader.GPCH_RC_PAY_YEAR.Value = GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR;
            &fheader.GPCH_EG_DOMAINID.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.GPCH_EG_DOMAINID.Value;
            &fheader.COMPANY.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.COMPANY.Value;
            &fheader.GPCH_EG_REQUEST_ID.Value =
&pstatus_vw_rec.GetRow(&q).GPCH_EG_PSTA_VW.GPCH_EG_REQUEST_ID.Value;
            &fheader.delete();
         End-If;
      End-For;
   End-If;

   If Not (&ParamSetup.GetRow(1).ISDELETED) And
         &Rerun_option = True Then
      &New_request_id = True;
      For &l = 1 To &pstatus.activerowcount
         If &SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_F_GROUB.Value =
&pstatus.GetRow(&l).GPCH_EG_PSTA_DW.GPCH_EG_F_GROUB.Value Then
            &request_id = &pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_EG_REQUEST_ID.Value;
            &New_request_id = False;
         End-If;
      End-For;

      &pstatus_rec.OPRID.Value = %OperatorId;
      &pstatus_rec.GPCH_RC_PAY_YEAR.Value = GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR;
      &Ptotals_rec.GPCH_RC_PAY_YEAR.Value = GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR;
      &pstatus_rec.GPCH_EG_DOMAINID.Value =
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_DOMAINID.Value;
      &Ptotals_rec.GPCH_EG_DOMAINID.Value =
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_DOMAINID.Value;
      &pstatus_rec.COMPANY.Value = &SS.GetRow(&i).GPCH_EG_FSTA_VW.COMPANY.Value;
      &Ptotals_rec.COMPANY.Value = &SS.GetRow(&i).GPCH_EG_FSTA_VW.COMPANY.Value;
      If (&New_request_id) Or
            (&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_TRANS_MODE.Value = 1) Or
            (&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_DISTRIBUTR.Value <> "Y") Then
         &request_id = get_seq_no(&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_TYPE.Value);
      End-If;
      &pstatus_rec.GPCH_EG_REQUEST_ID.Value = &request_id;
      &Ptotals_rec.GPCH_EG_REQUEST_ID.Value = &request_id;
      &prov_type_old = &SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_F_GROUB.Value;
      &pstatus_rec.GPCH_SI_PROV_TYPE.Value =
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_TYPE.Value;
      &Ptotals_rec.GPCH_SI_PROV_TYPE.Value =
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_TYPE.Value;
      &pstatus_rec.GPCH_SI_PROV_CD.Value =
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_CD.Value;
      &Ptotals_rec.GPCH_SI_PROV_CD.Value =
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_CD.Value;
      &acc_ins.FILL(&acc_ins_where_clause, &SS.GetRow(&i).GPCH_EG_FSTA_VW.COMPANY.Value,
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_TYPE.Value,
&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_CD.Value, &Year_date);
      If &acc_ins.GetRow(1).GPCH_SI_ACC_INS.GPCH_ALL_CANTONFLG.VALUE = "Y" Then
         &pstatus_rec.GPCH_EG_USERKEY.Value = "99";
         &Ptotals_rec.GPCH_EG_USERKEY.Value = "99";
      Else
         If &acc_ins.GetRow(1).GPCH_SI_ACC_INS.GPCH_TX_CANTON.VALUE <> " " Then
            &pstatus_rec.GPCH_EG_USERKEY.Value =
&acc_ins.GetRow(1).GPCH_SI_ACC_INS.GPCH_TX_CANTON.VALUE;
            &Ptotals_rec.GPCH_EG_USERKEY.Value =
&acc_ins.GetRow(1).GPCH_SI_ACC_INS.GPCH_TX_CANTON.VALUE;
         End-If;
      End-If;
      &pstatus_rec.GPCH_REPORT_STATUS.Value = "0008";
      &pstatus_rec.GPCH_REPORT_STATUS.Value = "N";
      &pstatus_rec.INSERT();
      &Ptotals_rec.INSERT();
      ScrollSelect(1, Record.GPCH_EG_PSTATUS, Record.GPCH_EG_PSTATUS,
&run_status_where_clause, &SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_TYPE.Value);
            For &l = 1 To &pstatus.activerowcount
               If &pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_SI_PROV_TYPE.Value =
      &SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_TYPE.Value And
                     &pstatus.GetRow(&l).GPCH_EG_PSTATUS.GPCH_SI_PROV_CD.Value =
      &SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_SI_PROV_CD.Value Then
                  &pstatus.GetRow(&l).GPCH_EG_PSTA_DW.GPCH_EG_F_GROUB.Value =
      &SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_F_GROUB.Value;
               End-If;
            End-For;

            &fstatus_rec.GPCH_RC_PAY_YEAR.Value = GPCH_RC_PAYROLL.GPCH_RC_PAY_YEAR;
            &fstatus_rec.GPCH_EG_DOMAINID.Value =
      &SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_DOMAINID.Value;
            &fstatus_rec.COMPANY.Value = &SS.GetRow(&i).GPCH_EG_FSTA_VW.COMPANY.Value;
            &fstatus_rec.GPCH_REPORT_STATUS.Value = "0008";
            If (&New_request_id) Or
                  (&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_TRANS_MODE.Value = 1) Or
                  (&SS.GetRow(&i).GPCH_EG_FSTA_VW.GPCH_EG_DISTRIBUTR.Value <> "Y") Then
               &fstatus_rec.GPCH_EG_REQUEST_ID.Value = &request_id;
               &fstatus_rec.Insert();
            End-If;
         End-If;
      End-For;

      If ( Not (&ParamSetup.GetRow(1).ISDELETED)) Then
         Gen_Header_XML();

      End-If;

      ScrollFlush(Record.GPCH_EG_RSTATUS);
      ScrollSelect(1, Record.GPCH_EG_RSTATUS, Record.GPCH_EG_RSTATUS, &where_clause);
      ScrollFlush(Record.GPCH_EG_FSTATUS);
      ScrollSelect(1, Record.GPCH_EG_FSTATUS, Record.GPCH_EG_PSTA_VW, &where_clause);
      ScrollFlush(Record.GPCH_EG_PSTATUS);
      ScrollSelect(1, Record.GPCH_EG_PSTATUS, Record.GPCH_EG_PSTATUS, &where_clause);

      Get_File_status();
      Get_status();

      SQLExec("SELECT LANGUAGE_CD FROM PS_PRCSRUNCNTL where OPRID =:1 and RUN_CNTL_ID=:2",
      GPCH_RC_PAYROLL.OPRID, GPCH_RC_PAYROLL.RUN_CNTL_ID, &LANG_CD);
      SQLExec("Update PS_GPCH_RC_PAYROLL set LANGUAGE_CD=:1 where OPRID=:2 and RUN_CNTL_ID=:3",
      &LANG_CD, %OperatorId, GPCH_RC_PAYROLL.RUN_CNTL_ID.Value);

      SQLExec(" Update PS_GPCH_RC_TX07 set GPCH_TX_FLG='N' where OPRID=:1 and RUN_CNTL_ID=:2",
      %OperatorId, &run_status_rec.RUN_CNTL_ID.VALUE);




PeopleCode (Component): GPFR_AF_NODE(GBL).PostBuild
      [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Component): GP_ABS_EESS_REQ(GBL).SavePreChange
      import HR_TEXT_CATALOG:TextCatalog;

      Declare Function AppendText PeopleCode FUNCLIB_ABSENCE.SAVE_BTN FieldFormula;
      Declare Function WrapText PeopleCode FUNCLIB_ABSENCE.SAVE_BTN FieldFormula;
      Declare Function PreSaveEdit PeopleCode FUNCLIB_ABSENCE.SAVE_BTN FieldFormula;
      Declare Function GetNextTransNbr PeopleCode FUNCLIB_ABSENCE.TRANSACTION_NBR FieldFormula;
      Component Record &COTKConfig_Rec;
      Component string &Country, &Elig_Grp, &Action, &Err;
      Component HR_TEXT_CATALOG:TextCatalog &AbsTextCatalog;
      Local string &TextId, &Text, &ResultText, &FCST_FIELDS_CHANGED;
      Local Rowset &RsEvent, &RsXref;
&Err = "N";
/*Populate Dat Record*/
If %Mode = %Action_Add Then
   &TransactionNbr = GetNextTransNbr();
   GP_ABS_SS_DAT.TRANSACTION_NBR.Value = &TransactionNbr;
   GP_ABS_SS_DAT.BGN_DT.Value = DERIVED_ABS_SS.BGN_DT;
   GP_ABS_SS_DAT.PIN_TAKE_NUM.Value = DERIVED_ABS_SS.PIN_TAKE_NUM;
   GP_ABS_SS_DAT.END_DT.Value = DERIVED_ABS_SS.END_DT;
End-If;

GP_ABS_SS_DAT.ORIG_EMPLID.Value = GP_ABS_SS_DAT.EMPLID.Value;
GP_ABS_SS_DAT.ORIG_EMPL_RCD.Value = GP_ABS_SS_DAT.EMPL_RCD.Value;
GP_ABS_SS_DAT.ORIG_BEGIN_DT.Value = DERIVED_ABS_SS.BGN_DT.Value;
GP_ABS_SS_DAT.ORIG_PIN_TAKE_NUM.Value = DERIVED_ABS_SS.PIN_TAKE_NUM.Value;
GP_ABS_SS_DAT.ORIG_END_DT.Value = DERIVED_ABS_SS.END_DT.Value;
GP_ABS_SS_DAT.COUNTRY.Value = &Country;
GP_ABS_SS_DAT.ELIG_GRP.Value = &Elig_Grp;


/*Populate GP_ABS_EVENT_REC*/
&RsEvent = GetLevel0()(1).GetRowset(Scroll.GP_ABS_EVENT);

If %Mode = %Action_Add Then
   &RsEvent.InsertRow(0);
End-If;
&RsEvent(1).GP_ABS_EVENT.EMPLID.Value = GP_ABS_SS_DAT.ORIG_EMPLID.Value;
&RsEvent(1).GP_ABS_EVENT.EMPL_RCD.Value = GP_ABS_SS_DAT.ORIG_EMPL_RCD.Value;
&RsEvent(1).GP_ABS_EVENT.BGN_DT.Value = GP_ABS_SS_DAT.ORIG_BEGIN_DT.Value;
&RsEvent(1).GP_ABS_EVENT.PIN_TAKE_NUM.Value = GP_ABS_SS_DAT.ORIG_PIN_TAKE_NUM.Value;
&RsEvent(1).GP_ABS_EVENT.END_DT.Value = GP_ABS_SS_DAT.ORIG_END_DT.Value;
If All(DERIVED_ABS_SS.ORIG_BEGIN_DT) Then;
   &RsEvent(1).GP_ABS_EVENT.ORIG_BEGIN_DT.Value = DERIVED_ABS_SS.ORIG_BEGIN_DT.Value;
Else
   &RsEvent(1).GP_ABS_EVENT.ORIG_BEGIN_DT.Value = DERIVED_ABS_SS.BGN_DT.Value;
End-If;
&Prior_Abs_Entry_Src = &RsEvent(1).GP_ABS_EVENT.ABS_ENTRY_SRC.Value;
&RsEvent(1).GP_ABS_EVENT.ABS_ENTRY_SRC.Value = 4;
&RsEvent(1).GP_ABS_EVENT.PRC_EVT_ACTN_OPTN.Value = "N";
&RsEvent(1).GP_ABS_EVENT.ABSENCE_REASON.Value = DERIVED_ABS_SS.ABSENCE_REASON.Value;

Evaluate DERIVED_ABS_SS.PARTIAL_DAYS.Value
When "N"
When ""
   /*If parial days are None set all the values to default*/
   &RsEvent(1).GP_ABS_EVENT.BEGIN_DAY_HRS.Value = 0;
   &RsEvent(1).GP_ABS_EVENT.BEGIN_DAY_HALF_IND.Value = "N";
   &RsEvent(1).GP_ABS_EVENT.END_DAY_HRS.Value = 0;
   &RsEvent(1).GP_ABS_EVENT.END_DAY_HALF_IND.Value = "N";
   &RsEvent(1).GP_ABS_EVENT.ALL_DAYS_IND.Value = "N";
   Break;
When "A"
   &RsEvent(1).GP_ABS_EVENT.BEGIN_DAY_HRS.Value = DERIVED_ABS_SS.ALL_DAY_HRS.Value;
   &RsEvent(1).GP_ABS_EVENT.BEGIN_DAY_HALF_IND.Value = DERIVED_ABS_SS.ALL_DAYS_IND.Value;
   &RsEvent(1).GP_ABS_EVENT.ALL_DAYS_IND.Value = "Y";
   Break;
When "S"
   &RsEvent(1).GP_ABS_EVENT.BEGIN_DAY_HRS.Value = DERIVED_ABS_SS.BEGIN_DAY_HRS.Value;
   &RsEvent(1).GP_ABS_EVENT.BEGIN_DAY_HALF_IND.Value =
DERIVED_ABS_SS.BEGIN_DAY_HALF_IND.Value;
   Break;
When "E"
   &RsEvent(1).GP_ABS_EVENT.END_DAY_HRS.Value = DERIVED_ABS_SS.END_DAY_HRS.Value;
   &RsEvent(1).GP_ABS_EVENT.END_DAY_HALF_IND.Value =
DERIVED_ABS_SS.END_DAY_HALF_IND.Value;
   Break;
When "B"
   &RsEvent(1).GP_ABS_EVENT.BEGIN_DAY_HRS.Value = DERIVED_ABS_SS.BEGIN_DAY_HRS.Value;
   &RsEvent(1).GP_ABS_EVENT.BEGIN_DAY_HALF_IND.Value =
DERIVED_ABS_SS.BEGIN_DAY_HALF_IND.Value;
   &RsEvent(1).GP_ABS_EVENT.END_DAY_HRS.Value = DERIVED_ABS_SS.END_DAY_HRS.Value;
   &RsEvent(1).GP_ABS_EVENT.END_DAY_HALF_IND.Value =
DERIVED_ABS_SS.END_DAY_HALF_IND.Value;
   Break;
End-Evaluate;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG1.Value = DERIVED_ABS_SS.EVT_CONFIG1.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG2.Value = DERIVED_ABS_SS.EVT_CONFIG2.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG3.Value = DERIVED_ABS_SS.EVT_CONFIG3.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG4.Value = DERIVED_ABS_SS.EVT_CONFIG4.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG1_DT.Value = DERIVED_ABS_SS.EVT_CONFIG1_DT.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG2_DT.Value = DERIVED_ABS_SS.EVT_CONFIG2_DT.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG3_DT.Value = DERIVED_ABS_SS.EVT_CONFIG3_DT.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG4_DT.Value = DERIVED_ABS_SS.EVT_CONFIG4_DT.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG1_DEC.Value = DERIVED_ABS_SS.EVT_CONFIG1_DEC.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG2_DEC.Value = DERIVED_ABS_SS.EVT_CONFIG2_DEC.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG3_DEC.Value = DERIVED_ABS_SS.EVT_CONFIG3_DEC.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG4_DEC.Value = DERIVED_ABS_SS.EVT_CONFIG4_DEC.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG1_MON.Value = DERIVED_ABS_SS.EVT_CONFIG1_MON.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG2_MON.Value = DERIVED_ABS_SS.EVT_CONFIG2_MON.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG3_MON.Value = DERIVED_ABS_SS.EVT_CONFIG3_MON.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG4_MON.Value = DERIVED_ABS_SS.EVT_CONFIG4_MON.Value;
&RsEvent(1).GP_ABS_EVENT.CURRENCY_CD1.Value = DERIVED_ABS_SS.CURRENCY_CD1.Value;
&RsEvent(1).GP_ABS_EVENT.CURRENCY_CD2.Value = DERIVED_ABS_SS.CURRENCY_CD2.Value;
&RsEvent(1).GP_ABS_EVENT.CURRENCY_CD3.Value = DERIVED_ABS_SS.CURRENCY_CD3.Value;
&RsEvent(1).GP_ABS_EVENT.CURRENCY_CD4.Value = DERIVED_ABS_SS.CURRENCY_CD4.Value;
&RsEvent(1).GP_ABS_EVENT.LAST_UPDT_DT.Value = %Date;
&RsEvent(1).GP_ABS_EVENT.DURATION_ABS.Value = DERIVED_ABS_SS.DURATION_ABS.Value;
&RsEvent(1).GP_ABS_EVENT.ACTION_DT_SS.Value = %Date;
&RsEvent(1).GP_ABS_EVENT.TRANSACTION_NBR.Value = GP_ABS_SS_DAT.TRANSACTION_NBR.Value;
&RsEvent(1).GP_ABS_EVENT.COMMENTS.Value = DERIVED_ABS_SS.COMMENTS.Value;

If &Action = "SUB" And
      None(&COTKConfig_Rec.AWPRCS_ID.Value) Then
   &RsEvent(1).GP_ABS_EVENT.WF_STATUS.Value = "A";
   &RsEvent(1).GP_ABS_EVENT.MANAGER_APPR_IND.Value = "Y";
Else
   &RsEvent(1).GP_ABS_EVENT.WF_STATUS.Value = DERIVED_ABS_SS.WF_STATUS.Value;
   &RsEvent(1).GP_ABS_EVENT.MANAGER_APPR_IND.Value = "N";
End-If;

If All(&Action) Then
   /*Populate STA Record*/
   &RsXref = GetLevel0()(1).GetRowset(Scroll.GP_ABS_SS_STA);
   If %Mode = %Action_Add Then
      &TargetRowNum = "1";
   Else
      &RsXref.Sort(GP_ABS_SS_STA.SEQNUM, "A");
      &LastRowNum = &RsXref.ActiveRowCount;
      If &RsXref(&LastRowNum).GP_ABS_SS_STA.HR_WF_ACTION.Value <> &Action Then
         &RsXref.InsertRow(&LastRowNum);
      End-If;
      &TargetRowNum = &RsXref.ActiveRowCount;
   End-If;
   &RsXref(&TargetRowNum).GP_ABS_SS_STA.TRANSACTION_NBR.Value =
GP_ABS_SS_DAT.TRANSACTION_NBR.Value;
   &RsXref(&TargetRowNum).GP_ABS_SS_STA.EMPLID.Value = GP_ABS_SS_DAT.EMPLID.Value;
   &RsXref(&TargetRowNum).GP_ABS_SS_STA.EMPL_RCD.Value = GP_ABS_SS_DAT.EMPL_RCD.Value;
   &RsXref(&TargetRowNum).GP_ABS_SS_STA.BGN_DT.Value = GP_ABS_SS_DAT.BGN_DT.Value;
   &RsXref(&TargetRowNum).GP_ABS_SS_STA.PIN_TAKE_NUM.Value =
GP_ABS_SS_DAT.PIN_TAKE_NUM.Value;
   &RsXref(&TargetRowNum).GP_ABS_SS_STA.END_DT.Value = GP_ABS_SS_DAT.END_DT.Value;
   &RsXref(&TargetRowNum).GP_ABS_SS_STA.SEQNUM.Value = &TargetRowNum;
   &RsXref(&TargetRowNum).GP_ABS_SS_STA.OPRID.Value = %OperatorId;
   &RsXref(&TargetRowNum).GP_ABS_SS_STA.EMPLID_CURR_APPR.Value =
GP_ABS_SS_DAT.EMPLID.Value;
   &RsXref(&TargetRowNum).GP_ABS_SS_STA.ACTION_DT.Value = %Date;

  Evaluate &Action
  When "SAV"
  When "FCST"
     &RsXref(&TargetRowNum).GP_ABS_SS_STA.HR_WF_ACTION.Value = "SAV";
     Break;
  When "SUB"
            &RsXref(&TargetRowNum).GP_ABS_SS_STA.HR_WF_ACTION.Value = "SUB";
            Break;
         When "FINCAN"
            If &COTKConfig_Rec.CANCEL_OPTION.Value = "D" Then
               /*Request As - Delete row only if entered by employee and not manager*/
               If &Prior_Abs_Entry_Src = "4" Then
                  &RsEvent.DeleteRow(1);
               End-If;
            End-If;
            &RsXref(&TargetRowNum).GP_ABS_SS_STA.HR_WF_ACTION.Value = "CAN";
            Break;
         End-Evaluate;

         &RsXref(&TargetRowNum).GP_ABS_SS_STA.COMMENTS.Value = DERIVED_ABS_SS.COMMENTS.Value;
      End-If;




PeopleCode (Component): GP_ABS_MGRSS_REQ(GBL).SavePreChange
      import HR_TEXT_CATALOG:TextCatalog;

      Declare Function AppendText PeopleCode FUNCLIB_ABSENCE.SAVE_BTN FieldFormula;
      Declare Function WrapText PeopleCode FUNCLIB_ABSENCE.SAVE_BTN FieldFormula;
      Declare Function PreSaveEdit PeopleCode FUNCLIB_ABSENCE.SAVE_BTN FieldFormula;
      Declare Function GetNextTransNbr PeopleCode FUNCLIB_ABSENCE.TRANSACTION_NBR FieldFormula;
      Component Record &COTKConfig_Rec;
      Component string &Country, &Elig_Grp, &Action, &Err;
      /*Request As*/
      Component number &TargetRowNum;
      Component HR_TEXT_CATALOG:TextCatalog &AbsTextCatalog;
      Local string &TextId, &Text, &ResultText;
      Local Rowset &RsEvent, &RsXref;

      &Err = "N";
      /*Populate Dat Record*/
      If %Mode = %Action_Add Then
         &TransactionNbr = GetNextTransNbr();
         GP_ABS_SS_DAT.TRANSACTION_NBR.Value = &TransactionNbr;
         GP_ABS_SS_DAT.BGN_DT.Value = DERIVED_ABS_SS.BGN_DT;
         GP_ABS_SS_DAT.PIN_TAKE_NUM.Value = DERIVED_ABS_SS.PIN_TAKE_NUM;
         GP_ABS_SS_DAT.END_DT.Value = DERIVED_ABS_SS.END_DT;
      End-If;

      GP_ABS_SS_DAT.ORIG_EMPLID.Value = GP_ABS_SS_DAT.EMPLID.Value;
      GP_ABS_SS_DAT.ORIG_EMPL_RCD.Value = GP_ABS_SS_DAT.EMPL_RCD.Value;
      GP_ABS_SS_DAT.ORIG_BEGIN_DT.Value = DERIVED_ABS_SS.BGN_DT.Value;
      GP_ABS_SS_DAT.ORIG_PIN_TAKE_NUM.Value = DERIVED_ABS_SS.PIN_TAKE_NUM.Value;
      GP_ABS_SS_DAT.ORIG_END_DT.Value = DERIVED_ABS_SS.END_DT.Value;
      GP_ABS_SS_DAT.COUNTRY.Value = &Country;
      GP_ABS_SS_DAT.ELIG_GRP.Value = &Elig_Grp;


      /*Populate GP_ABS_EVENT_REC*/
      &RsEvent = GetLevel0()(1).GetRowset(Scroll.GP_ABS_EVENT);

      If %Mode = %Action_Add Then
         &RsEvent.InsertRow(0);
      End-If;
      &RsEvent(1).GP_ABS_EVENT.EMPLID.Value = GP_ABS_SS_DAT.ORIG_EMPLID.Value;
      &RsEvent(1).GP_ABS_EVENT.EMPL_RCD.Value = GP_ABS_SS_DAT.ORIG_EMPL_RCD.Value;
      &RsEvent(1).GP_ABS_EVENT.BGN_DT.Value = GP_ABS_SS_DAT.ORIG_BEGIN_DT.Value;
      &RsEvent(1).GP_ABS_EVENT.PIN_TAKE_NUM.Value = GP_ABS_SS_DAT.ORIG_PIN_TAKE_NUM.Value;
      &RsEvent(1).GP_ABS_EVENT.END_DT.Value = GP_ABS_SS_DAT.ORIG_END_DT.Value;
      If All(DERIVED_ABS_SS.ORIG_BEGIN_DT) Then;
         &RsEvent(1).GP_ABS_EVENT.ORIG_BEGIN_DT.Value = DERIVED_ABS_SS.ORIG_BEGIN_DT.Value;
      Else
         &RsEvent(1).GP_ABS_EVENT.ORIG_BEGIN_DT.Value = DERIVED_ABS_SS.BGN_DT.Value;
      End-If;
      &RsEvent(1).GP_ABS_EVENT.ABS_ENTRY_SRC.Value = 5;
&RsEvent(1).GP_ABS_EVENT.PRC_EVT_ACTN_OPTN.Value = "N";
&RsEvent(1).GP_ABS_EVENT.ABSENCE_REASON.Value = DERIVED_ABS_SS.ABSENCE_REASON.Value;

Evaluate DERIVED_ABS_SS.PARTIAL_DAYS.Value
When "N"
When ""
   /*If parial days are None set all the values to default*/
   &RsEvent(1).GP_ABS_EVENT.BEGIN_DAY_HRS.Value = 0;
   &RsEvent(1).GP_ABS_EVENT.BEGIN_DAY_HALF_IND.Value = "N";
   &RsEvent(1).GP_ABS_EVENT.END_DAY_HRS.Value = 0;
   &RsEvent(1).GP_ABS_EVENT.END_DAY_HALF_IND.Value = "N";
   &RsEvent(1).GP_ABS_EVENT.ALL_DAYS_IND.Value = "N";
   Break;
When "A"
   &RsEvent(1).GP_ABS_EVENT.BEGIN_DAY_HRS.Value = DERIVED_ABS_SS.ALL_DAY_HRS.Value;
   &RsEvent(1).GP_ABS_EVENT.BEGIN_DAY_HALF_IND.Value = DERIVED_ABS_SS.ALL_DAYS_IND.Value;
   &RsEvent(1).GP_ABS_EVENT.ALL_DAYS_IND.Value = "Y";
   Break;
When "S"
   &RsEvent(1).GP_ABS_EVENT.BEGIN_DAY_HRS.Value = DERIVED_ABS_SS.BEGIN_DAY_HRS.Value;
   &RsEvent(1).GP_ABS_EVENT.BEGIN_DAY_HALF_IND.Value =
DERIVED_ABS_SS.BEGIN_DAY_HALF_IND.Value;
   Break;
When "E"
   &RsEvent(1).GP_ABS_EVENT.END_DAY_HRS.Value = DERIVED_ABS_SS.END_DAY_HRS.Value;
   &RsEvent(1).GP_ABS_EVENT.END_DAY_HALF_IND.Value =
DERIVED_ABS_SS.END_DAY_HALF_IND.Value;
   Break;
When "B"
   &RsEvent(1).GP_ABS_EVENT.BEGIN_DAY_HRS.Value = DERIVED_ABS_SS.BEGIN_DAY_HRS.Value;
   &RsEvent(1).GP_ABS_EVENT.BEGIN_DAY_HALF_IND.Value =
DERIVED_ABS_SS.BEGIN_DAY_HALF_IND.Value;
   &RsEvent(1).GP_ABS_EVENT.END_DAY_HRS.Value = DERIVED_ABS_SS.END_DAY_HRS.Value;
   &RsEvent(1).GP_ABS_EVENT.END_DAY_HALF_IND.Value =
DERIVED_ABS_SS.END_DAY_HALF_IND.Value;
   Break;
End-Evaluate;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG1.Value = DERIVED_ABS_SS.EVT_CONFIG1.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG2.Value = DERIVED_ABS_SS.EVT_CONFIG2.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG3.Value = DERIVED_ABS_SS.EVT_CONFIG3.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG4.Value = DERIVED_ABS_SS.EVT_CONFIG4.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG1_DT.Value = DERIVED_ABS_SS.EVT_CONFIG1_DT.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG2_DT.Value = DERIVED_ABS_SS.EVT_CONFIG2_DT.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG3_DT.Value = DERIVED_ABS_SS.EVT_CONFIG3_DT.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG4_DT.Value = DERIVED_ABS_SS.EVT_CONFIG4_DT.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG1_DEC.Value = DERIVED_ABS_SS.EVT_CONFIG1_DEC.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG2_DEC.Value = DERIVED_ABS_SS.EVT_CONFIG2_DEC.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG3_DEC.Value = DERIVED_ABS_SS.EVT_CONFIG3_DEC.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG4_DEC.Value = DERIVED_ABS_SS.EVT_CONFIG4_DEC.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG1_MON.Value = DERIVED_ABS_SS.EVT_CONFIG1_MON.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG2_MON.Value = DERIVED_ABS_SS.EVT_CONFIG2_MON.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG3_MON.Value = DERIVED_ABS_SS.EVT_CONFIG3_MON.Value;
&RsEvent(1).GP_ABS_EVENT.EVT_CONFIG4_MON.Value = DERIVED_ABS_SS.EVT_CONFIG4_MON.Value;
&RsEvent(1).GP_ABS_EVENT.CURRENCY_CD1.Value = DERIVED_ABS_SS.CURRENCY_CD1.Value;
&RsEvent(1).GP_ABS_EVENT.CURRENCY_CD2.Value = DERIVED_ABS_SS.CURRENCY_CD2.Value;
&RsEvent(1).GP_ABS_EVENT.CURRENCY_CD3.Value = DERIVED_ABS_SS.CURRENCY_CD3.Value;
&RsEvent(1).GP_ABS_EVENT.CURRENCY_CD4.Value = DERIVED_ABS_SS.CURRENCY_CD4.Value;
&RsEvent(1).GP_ABS_EVENT.LAST_UPDT_DT.Value = %Date;
&RsEvent(1).GP_ABS_EVENT.DURATION_ABS.Value = DERIVED_ABS_SS.DURATION_ABS.Value;
&RsEvent(1).GP_ABS_EVENT.ACTION_DT_SS.Value = %Date;
&RsEvent(1).GP_ABS_EVENT.TRANSACTION_NBR.Value = GP_ABS_SS_DAT.TRANSACTION_NBR.Value;
&RsEvent(1).GP_ABS_EVENT.COMMENTS.Value = DERIVED_ABS_SS.COMMENTS.Value;
If &Action = "SUB" And
      None(&COTKConfig_Rec.AWPRCS_ID.Value) Then
   &RsEvent(1).GP_ABS_EVENT.WF_STATUS.Value = "A";
   &RsEvent(1).GP_ABS_EVENT.MANAGER_APPR_IND.Value = "Y";
Else
   &RsEvent(1).GP_ABS_EVENT.WF_STATUS.Value = DERIVED_ABS_SS.WF_STATUS.Value;
   &RsEvent(1).GP_ABS_EVENT.MANAGER_APPR_IND.Value = "N";
End-If;
       If All(&Action) Then;
          /*Populate XREF Record*/
          &RsXref = GetLevel0()(1).GetRowset(Scroll.GP_ABS_SS_STA);
          If %Mode = %Action_Add Then
             /*Request As*/
             /* &TargetRowNum = "1";*/
             &TargetRowNum = 1;
          Else
             &RsXref.Sort(GP_ABS_SS_STA.SEQNUM, "A");
             &LastRowNum = &RsXref.ActiveRowCount;
             If &RsXref(&LastRowNum).GP_ABS_SS_STA.HR_WF_ACTION.Value <> &Action Then
                &RsXref.InsertRow(&LastRowNum);
             End-If;
             &TargetRowNum = &RsXref.ActiveRowCount;
          End-If;
          &RsXref(&TargetRowNum).GP_ABS_SS_STA.TRANSACTION_NBR.Value =
       GP_ABS_SS_DAT.TRANSACTION_NBR.Value;
          &RsXref(&TargetRowNum).GP_ABS_SS_STA.EMPLID.Value = GP_ABS_SS_DAT.EMPLID.Value;
          &RsXref(&TargetRowNum).GP_ABS_SS_STA.EMPL_RCD.Value = GP_ABS_SS_DAT.EMPL_RCD.Value;
          &RsXref(&TargetRowNum).GP_ABS_SS_STA.BGN_DT.Value = GP_ABS_SS_DAT.BGN_DT.Value;
          &RsXref(&TargetRowNum).GP_ABS_SS_STA.PIN_TAKE_NUM.Value =
       GP_ABS_SS_DAT.PIN_TAKE_NUM.Value;
          &RsXref(&TargetRowNum).GP_ABS_SS_STA.END_DT.Value = GP_ABS_SS_DAT.END_DT.Value;
          &RsXref(&TargetRowNum).GP_ABS_SS_STA.SEQNUM.Value = &TargetRowNum;
          &RsXref(&TargetRowNum).GP_ABS_SS_STA.OPRID.Value = %OperatorId;

          /*Request As*/
          If DERIVED_ABS_SS.REQUEST_AS = "E" Then
             &RsXref(&TargetRowNum).GP_ABS_SS_STA.EMPLID_CURR_APPR.Value =
       GP_ABS_SS_DAT.EMPLID.Value;
          Else
             &RsXref(&TargetRowNum).GP_ABS_SS_STA.EMPLID_CURR_APPR.Value = %EmployeeId;
          End-If;
          /*Request As*/

         &RsXref(&TargetRowNum).GP_ABS_SS_STA.ACTION_DT.Value = %Date;

          Evaluate &Action
          When "SAV"
          When "FCST"
             &RsXref(&TargetRowNum).GP_ABS_SS_STA.HR_WF_ACTION.Value = "SAV";
             Break;
          When "SUB"
             &RsXref(&TargetRowNum).GP_ABS_SS_STA.HR_WF_ACTION.Value = "SUB";
             Break;
          When "FINCAN"
             If &COTKConfig_Rec.CANCEL_OPTION.Value = "D" Then
                /*Request As - Delete row only if entered by manager and requested as manager*/
                If &RsEvent(1).GP_ABS_EVENT.ABS_ENTRY_SRC.Value = 5 And
                      &RsXref(&LastRowNum).GP_ABS_SS_STA.EMPLID_CURR_APPR.Value = %EmployeeId
       Then;
                   &RsEvent.DeleteRow(1);
                End-If;
             End-If;
             &RsXref(&TargetRowNum).GP_ABS_SS_STA.HR_WF_ACTION.Value = "CAN";
             /*Request As - Assign manager's emplid to cancel row*/
             &RsXref(&TargetRowNum).GP_ABS_SS_STA.EMPLID_CURR_APPR.Value = %EmployeeId;
             Break;
          End-Evaluate;

          &RsXref(&TargetRowNum).GP_ABS_SS_STA.COMMENTS.Value = DERIVED_ABS_SS.COMMENTS.Value;
       End-If;




PeopleCode (Component): GP_SS_EE_PSLP(GBL).PostBuild
       Local Rowset &LVL0, &LVL1, &rs1;
       Local GridColumn &GRIDCOLUMN;
       Local SQL &SQL1;
      Component string &PSLPPayGroup, &PSLPPayFlag, &PSLPCountry, &HDCOPYOPTN;

      /* set view hyperlink labels*/
      &GRIDCOLUMN = GetGrid(Page.GP_SS_EE_PSLP, "HR_LINK_WRK").GetColumn("VIEW");
      /* Set view payslip grid label to label of payment date */
      &rs1 = GetLevel0()(1).GetRowset(1);
      &LVL0 = GetLevel0();
      &LVL1 = &LVL0(1).GetRowset(1);
      &GRIDCOLUMN.Label = &LVL1.GetRow(1).GP_SS_PSLP_GDE.PYMT_DT.GetLongLabel("PYMT_DT");
      &rows = 0;

      /* Show or Hide everything related to the print payslp options if depending on settings in
      Payslip Options by Country*/
      &SQL1 = CreateSQL("Select REG_REGION_COUNTRY from PS_CURRENT_JOB where EMPLID = :1",
      %EmployeeId, &PSLPCountry);
      /* Fetch a country from the payee that has epay options defined */
      While &SQL1.Fetch(&PSLPCountry);
         SQLExec("Select GP_PSLP_HDCPYOPTN FROM PS_GP_SS_PSLP_OPT WHERE COUNTRY = :1",
      &PSLPCountry, &HDCOPYOPTN);
         If All(&HDCOPYOPTN) Then
            Break;
         End-If;
      End-While;

      If &HDCOPYOPTN = "Y" Then
         &LVL0(1).GP_SS_PSLP_HDR.GP_PSLP_ISSUEHDCPY.Visible = True;
      Else
         &LVL0(1).GP_SS_PSLP_HDR.GP_PSLP_ISSUEHDCPY.Visible = False;
      End-If;

      /* Load Grid with payslips */
      &SQL1 = CreateSQL("Select REG_REGION_COUNTRY FROM %TABLE(CURRENT_JOB) WHERE EMPLID = :1",
      %EmployeeId, &PSLPCountry);
      While &SQL1.Fetch(&PSLPCountry);
         &oldrows = &rows;
         &rows1 = &LVL1.Select(Record.GP_SS_PSLP_1_VW, "where country = :1 and emplid = :2",
      &PSLPCountry, %EmployeeId);
         &rows2 = &LVL1.Select(Record.GP_SS_PSLP_2_VW, "where country = :1 and emplid = :2",
      &PSLPCountry, %EmployeeId);
         &rows = &oldrows + &rows1 + &rows2;
      End-While;
      &rows1 = &LVL1.Select(Record.GP_SS_PSLP_1_VW, "where emplid = :1", %EmployeeId);
      &rows2 = &LVL1.Select(Record.GP_SS_PSLP_2_VW, "where emplid = :1", %EmployeeId);
      &rows = &rows1 + &rows2;


      /* hide the get next and get previous links if less than 10 payslips */
      If &rows = 0 Then
         &rs1(1).FILE_ATTACH_WRK.ATTACHVIEW.Label = " ";
         &rs1(1).FILE_ATTACH_WRK.ATTACHVIEW.Enabled = False;
         GP_SS_PSLP_WRK0.GP_PSLP_INFOBOX = MsgGetText(17007, 254, "");
      Else
         &LVL1.Sort(GP_SS_PSLP_GDE.PYMT_DT, "D", GP_SS_PSLP_GDE.PRD_BGN_DT, "D",
      GP_SS_PSLP_GDE.PRD_END_DT, "D", GP_SS_PSLP_GDE.GP_PSLP_ID, "D");
      End-If;

      If &rows > 10 Then
         &LVL0(1).GP_SS_PSLP_WRK0.GP_PSLP_TTLSNLBLS2.Visible = True;
      Else
         &LVL0(1).GP_SS_PSLP_WRK0.GP_PSLP_TTLSNLBLS2.Visible = False;
      End-If;




PeopleCode (CompRecord): GPCH_TX_DATA(GBL).GPCH_TX_DATA.RowInit
      Declare Function Get_Country_Of_Residence PeopleCode GPCH_TX_DATA.GPCH_TX_CANTON
      FieldFormula;
      Declare Function Get_State_Of_Residence PeopleCode GPCH_TX_DATA.GPCH_TX_CANTON FieldFormula;
      Declare Function Get_Description_Of_State PeopleCode GPCH_TX_DATA.GPCH_TX_CANTON
       FieldFormula;
       Declare Function GPCH_Get_Municipality_Descr PeopleCode GPCH_TX_DATA.GPCH_TX_VILLAGE_CD
       FieldFormula;
       Declare Function GetMunicipalityCode PeopleCode GPCH_TX_DATA.GPCH_TX_VILLAGE_CD
       FieldFormula;

       Local   SQL &AddressSql;
       Local   string &City;
       Local   string &Postal;
       Local   boolean &CityFound;

       Local SQL &MuniSql;
       Local string &MuniCode;
       Local boolean &MuniFound;


       &Emplid = GPCH_TX_DATA.EMPLID;
       SQLExec(SQL.GPCH_INST_ADDRESS_TYPE, &Type);
       &Effdt = GPCH_TX_DATA.EFFDT;

       &Country = Get_Country_Of_Residence(&Emplid, &Type, &Effdt);

       If &Country = "CHE" Then
          &State = Get_State_Of_Residence(&Emplid, &Type, &Effdt);
          &Descr = Get_Description_Of_State(&State);
          GPCH_AL_PAY_DW.GPCH_AL_CANTON = &Descr;
          GPCH_AL_PAY_DW.GPCH_AL_CANTON.Label =
       GPCH_AL_PAY_DW.GPCH_AL_CANTON.GetLongLabel("GPCH_CANTON_RES");
       Else
          &State = LOCATION_TBL.STATE;
          &Descr = Get_Description_Of_State(&State);
          GPCH_AL_PAY_DW.GPCH_AL_CANTON = &Descr;
          GPCH_AL_PAY_DW.GPCH_AL_CANTON.Label =
       GPCH_AL_PAY_DW.GPCH_AL_CANTON.GetLongLabel("GPCH_CANTON_WRK");
       End-If;

       /*
       If the municipality code is empty, default it with the one from the ee_s postal code or the
       location_s postal code (depending on whether he is residing in CHE or not).
       */
       If None(GPCH_TX_DATA.GPCH_TX_VILLAGE_CD) Then

          GetMunicipalityCode(&Country, GPCH_TX_DATA.EMPLID, GPCH_TX_DATA.EMPL_RCD,
       GPCH_TX_DATA.EFFDT, GPCH_TX_DATA.GPCH_TX_VILLAGE_CD, GPCH_AL_PAY_DW.DESCR);

       End-If;




PeopleCode (CompRecord): GPES_RC_SS_TC2(GBL).GPES_RC_SS_TC2W.RowInit
       Local Record &rCompanyData;

       &rCompanyData = CreateRecord(Record.SOCS_SETHD_ESP);
       &rCompanyData.COMPANY.Value = GPES_RC_SS.COMPANY.Value;
       &rCompanyData.SelectByKeyEffDt(%Date);
       &FT_CCC = &rCompanyData.TRN_T_SSN_RDNT_ESP.Value;
       If &FT_CCC = GPES_RC_SS_TC2W.SSN_EMPLOYER.Value Then
          GPES_RC_SS_TC2W.GPES_TRAINING_REDN.DisplayOnly = False;
          GPES_DERIVED.SRCH_BTN.DisplayOnly = False;
       Else
          GPES_RC_SS_TC2W.GPES_TRAINING_REDN.DisplayOnly = True;
          GPES_DERIVED.SRCH_BTN.DisplayOnly = True;
       End-If;




PeopleCode (CompRecFld):
GPCH_TX_DATA(GBL).GPCH_TX_DATA.GPCH_TX_VILLAGE_CDFieldDefault
      Declare Function GetMunicipalityCode PeopleCode GPCH_TX_DATA.GPCH_TX_VILLAGE_CD
      FieldFormula;

      /*
      If the municipality code is empty, default it with the one from the ee_s postal code or the
      location_s postal code (depending on whether he is residing in CHE or not).
      */
      If None(GPCH_TX_DATA.GPCH_TX_VILLAGE_CD) Then

         GetMunicipalityCode(&Country, GPCH_TX_DATA.EMPLID, GPCH_TX_DATA.EMPL_RCD,
      GPCH_TX_DATA.EFFDT, GPCH_TX_DATA.GPCH_TX_VILLAGE_CD, GPCH_AL_PAY_DW.DESCR);

      End-If;




PeopleCode (CompRecFld): GPDE_CT_MAIN(GBL).GPDE_CT_1_WRK.GPDE_CT_CR_PB
FieldChange
      Declare Function Init_home_State PeopleCode FUNCLIB_PMN.FUNCLIB FieldFormula;
      Declare Function ValidateContactInfo PeopleCode GPDE_CT_1_WRK.GPDE_AL_OPRNAME FieldFormula;

      Global string &ProcessName;
      Global string &ProcessType;
      Global boolean &create_xmldata;

      Local Rowset &ParamSetup;

      Local   Record &RunControlRec;
      Local   Record &ParamRec;
      Local   Record &ParamList;
      Local   SQL &mySql = CreateSQL("%Insert(:1)");
      Local   SQL &ListSQL = CreateSQL("%Insert(:1)");;
      Local   boolean &sqlRetCode;

      &ProcessName = "GPDE_CT_MAIN";
      &ProcessType = "Application Engine";

      &transfer = True;
      &create_xmldata = True;


      If All(GPDE_CT_1_WRK.GPDE_FM_FORM_ID) And
            All(GPDE_CT_1_WRK.GPDE_CT_REFDT) Then

         /* check for CONTACT_NAME, PHONE*/
         &ret_val = ValidateContactInfo( False, True, True, False, False);
         If Not &ret_val Then
            Exit
         End-If;

         &RunControlRec = CreateRecord(Record.GPDE_CT_RUNCTL);
         &ParamRec = CreateRecord(Record.GPDE_CT_PARAM);

         &RunControlRec.OPRID.Value = %OperatorId;
         &RunControlRec.RUN_CNTL_ID.Value = GPDE_CT_1_WRK.RUN_CNTL_ID;
         &RunControlRec.EMPLID.Value = GPDE_CT_1_WRK.EMPLID;
         &RunControlRec.EMPL_RCD.Value = GPDE_CT_1_WRK.EMPL_RCD;
         &RunControlRec.GPDE_FM_FORM_ID.Value = GPDE_CT_1_WRK.GPDE_FM_FORM_ID;
         &RunControlRec.EFFDT.Value = GPDE_CT_1_WRK.EFFDT;
         &RunControlRec.GPDE_CT_REFDT.Value = GPDE_CT_1_WRK.GPDE_CT_REFDT;
         &RunControlRec.GPDE_FM_LANG_CD.Value = GPDE_CT_1_WRK.GPDE_FM_LANG_CD;
         &RunControlRec.PAY_ENTITY.Value = GPDE_CT_1_WRK.PAY_ENTITY;
         &RunControlRec.LAST_UPDATE_DTTM.Value = %Datetime;


         /*   &RunControlRec.GPDE_AL_CONTACT_NM.Value = GPDE_CT_1_WRK.GPDE_AL_OPRNAME;    */
         &RunControlRec.GPDE_AL_CONTACT_NM.Value = GPDE_CT_1_WRK.GPDE_AL_CONTACT_NM;
         &RunControlRec.GPDE_AL_PHONE.Value = GPDE_CT_1_WRK.GPDE_AL_PHONE;
  &sqlRetCode = &mySql.Execute(&RunControlRec);

   &ParamSetup = GetLevel0().GetRow(1).GetRowset(Scroll.GPDE_CT_PSETUP);
   If All(&ParamSetup.GetRow(1).GPDE_CT_PSETUP.SEQ_NUM.Value) Then
      For &i = 1 To &ParamSetup.ActiveRowCount;
         &ParamRec.OPRID.Value = %OperatorId;
         &ParamRec.RUN_CNTL_ID.Value = GPDE_CT_1_WRK.GPDE_FM_FORM_ID;
         &ParamRec.SEQ_NUM.Value = &ParamSetup.GetRow(&i).GPDE_CT_PSETUP.SEQ_NUM.Value;
         &ParamRec.GPDE_FM_FLD_NAME.Value =
&ParamSetup.GetRow(&i).GPDE_CT_PSETUP.GPDE_FM_FLD_NAME.Value;
         &ParamRec.GPDE_CT_FIELDTYPE.Value =
&ParamSetup.GetRow(&i).GPDE_CT_PSETUP.GPDE_CT_FIELDTYPE.Value;
         &ParamRec.CHAR_VAL.Value = &ParamSetup.GetRow(&i).GPDE_CT_1_WRK.CHAR_VAL.Value;
         If &ParamRec.GPDE_CT_FIELDTYPE.Value = 7 Then
            &ParamRec.GPDE_CT_FIELDTYPE.Value = 0;
            &ParamRec.CHAR_VAL.Value =
&ParamSetup.GetRow(&i).GPDE_CT_1_WRK.CHAR_VALUE.Value;
         End-If;

        &ParamRec.DATE_VAL.Value = &ParamSetup.GetRow(&i).GPDE_CT_1_WRK.DATE_VAL.Value;
        &ParamRec.NUM_VAL.Value = &ParamSetup.GetRow(&i).GPDE_CT_1_WRK.NUM_VAL.Value;
        &sqlRetCode = &ListSQL.Execute(&ParamRec);
     End-For;
  End-If;

  If &sqlRetCode = False Then
  /* If &sqlRetCode = False Then*/
  /* formcreate is running for this Operator and Certificate*/
     Error MsgGet(17120, 71, "");
  /*Error MsgGet(17120, 71, "");
    &transfer = False;
  End-If;
  End-If; */

  /*test for field values. All parameters setup on PSETUP must be filled by clerk. */

   If &transfer Then
      CommitWork();
      SetComponentChanged();
      DoSaveNow();
      Init_home_State("Home", "Read-Write");
      /* Transfer( False, MenuName.PROCESSMONITOR, BarName."INQUIRE",
ItemName.PROCESSMONITOR, Panel.PMN_PRCSLIST, "U"); */
      TransferPage(Page.GPDE_CT_HIST);

  End-If;

Else
   &create_xmldata = False;

  If None(GPDE_CT_1_WRK.GPDE_FM_FORM_ID) Then

     SetCursorPos(%Page, GPDE_CT_1_WRK.GPDE_FM_FORM_ID, 1);
     /* form id must be provided */
     Error MsgGet(17120, 82, "");

  End-If;

  If None(GPDE_CT_1_WRK.GPDE_CT_REFDT) Then

     SetCursorPos(%Page, GPDE_CT_1_WRK.GPDE_CT_REFDT, 1);
     /* reference date must be provided */
     Error MsgGet(17120, 72, "");

  End-If;

End-If;
PeopleCode (CompRecFld): GPDE_RC_TX01(GBL).GPDE_RC_PAYROLL.GPDE_RC_SEND_XML
FieldChange
      If GPDE_RC_PAYROLL.GPDE_RC_SEND_XML.Value = "Y" Then
         GPDE_RC_PAYROLL.GPDE_RC_PREL_PRINT.Enabled = True;
         GPDE_RC_PAYROLL.GPDE_RC_YR_CLOSE.Value = "N";
         GPDE_RC_PAYROLL.GPDE_RC_YR_CLOSE.Enabled = False;

         GPDE_RC_PAYROLL.GPDE_RC_SIGN_XML.Enabled = True;
         rem XML has to be signed automatically once the "Generate & Send Official File" checkbox
      is checked;
         GPDE_RC_PAYROLL.GPDE_RC_SIGN_XML.Value = "Y";
      Else
         If All(GPDE_RC_PAYROLL.GPDE_ELSTER_TKT.Value) And
               GPDE_TX_XMLRSLT.GPDE_XML_STATUS.Value = "40" And
               GPDE_RC_PAYROLL.GPDE_RC_CREATE_XML.Value = "N" Then
            GPDE_RC_PAYROLL.GPDE_RC_PREL_PRINT.Value = "N";
            GPDE_RC_PAYROLL.GPDE_RC_PREL_PRINT.Enabled = False;
            GPDE_RC_PAYROLL.GPDE_RC_YR_CLOSE.Enabled = True;

         End-If;

         GPDE_RC_PAYROLL.GPDE_RC_SIGN_XML.Enabled = False;
         GPDE_RC_PAYROLL.GPDE_RC_SIGN_XML.Value = "N";
      End-If;




PeopleCode (CompRecFld): GPES_ABS_EVENT(GBL).GP_ABS_EVENT.ABSENCE_REASON
FieldChange
      Local Rowset &ABSRowset;

      &ABSRowset =
      GetLevel0().GetRow(1).GetRowset(Scroll.GP_ABS_EVENT).GetRow(CurrentRowNumber(1)).GetRowse
      t(Scroll.GPES_ABSEVT_AD);
      If %Page = Page.GPES_ABS_EVENT_ADD Then

         /* Number of children will be visible when absence type is MAT and absence reason is MLT:
      event of multiple birth and of adoption or foster care of more one minor simustaneously*/

         If GP_ABS_TAKE.ABS_TYPE_OPTN.Value = "MAT" And
               GP_ABS_EVENT.ABSENCE_REASON.Value = "MLT" Then
            GetRowset(Scroll.GPES_ABSEVT_AD).GetRow(1).GPES_ABSEVT_AD.GPES_CHILD_NUM.Visible =
      True;
         Else
            GetRowset(Scroll.GPES_ABSEVT_AD).GetRow(1).GPES_ABSEVT_AD.GPES_CHILD_NUM.Visible =
      False;

      GetRowset(Scroll.GPES_ABSEVT_AD).GetRow(1).GPES_ABSEVT_AD.GPES_CHILD_NUM.SetDefault();
         End-If;




         <*   &ABSRowset =
      GetLevel0().GetRow(1).GetRowset(Record.GP_ABS_EVENT).GetRow(CurrentRowNumber(1)).GetRowse
      t(Scroll.GPES_ABSEVT_AD);

         /* Number of children will be visible when absence type is MAT and absence reason is MLT:
      event of multiple birth and of adoption or foster care of more one minor simustaneously*/

         If GP_ABS_TAKE.ABS_TYPE_OPTN.Value = "MAT" And
               GP_ABS_EVENT.ABSENCE_REASON.Value = "MLT" Then
            &ABSRowset.GetRow(1).GPES_ABSEVT_AD.GPES_CHILD_NUM.Visible = True;
         Else
            &ABSRowset.GetRow(1).GPES_ABSEVT_AD.GPES_CHILD_NUM.Visible = False;
            &ABSRowset.GetRow(1).GPES_ABSEVT_AD.GPES_CHILD_NUM.SetDefault();
         End-If;*>
      End-If;




PeopleCode (CompRecFld): GPES_RC_SS_TC2(GBL).GPES_DERIVED.SRCH_BTN
FieldChange
      &Company = GPES_RC_SS.COMPANY.Value;
      &Year = GPES_RC_SS.YEARCD.Value;
      &Month = GPES_RC_SS.GPES_MONTHCD.Value;
      SQLExec("SELECT SUM (TRN_T_AMOUNT_ESP) FROM PS_TRN_T_RDCTN_ESP WHERE COMPANY =:1 AND YEARCD
      =:2 AND MONTHCD =:3", &Company, &Year, &Month, &Sum);
      GPES_RC_SS_TC2W.GPES_TRAINING_REDN.Value = &Sum;




PeopleCode (CompRecFld): GPES_RC_SS_TC2(GBL).GPES_RC_SS_TC2W.SSN_EMPLOYER
FieldChange
      Local Record &rCompanyData;

      &rCompanyData = CreateRecord(Record.SOCS_SETHD_ESP);
      &rCompanyData.COMPANY.Value = GPES_RC_SS.COMPANY.Value;
      &rCompanyData.SelectByKeyEffDt(%Date);
      &FT_CCC = &rCompanyData.TRN_T_SSN_RDNT_ESP.Value;
      If &FT_CCC = GPES_RC_SS_TC2W.SSN_EMPLOYER.Value Then
         GPES_RC_SS_TC2W.GPES_TRAINING_REDN.DisplayOnly = False;
         GPES_RC_SS_TC2W.GPES_TRAINING_REDN.Value = "";
         GPES_DERIVED.SRCH_BTN.DisplayOnly = False;

      Else
         GPES_RC_SS_TC2W.GPES_TRAINING_REDN.DisplayOnly = True;
         GPES_DERIVED.SRCH_BTN.DisplayOnly = True;
      End-If;




PeopleCode (Appl Package): GPDE_EGOV_XML:ELSTER:eTin.OnExecute
      [ . . . Unchanged Code not Shown . . . ]

      method getETin
         /+ &first as String, +/
         /+ &last as String, +/
         /+ &bday as Date +/
         /+ Returns String +/

         &lastname = &last;
         &firstname = &first;
         &birthdate = &bday;

         If All(&last, &first) Then
            Local string &dateString;
            If Day(&bday) < 10 Then
               &dateString = "0" | String(Day(&bday))
            Else
               &dateString = String(Day(&bday));
            End-If;
            &dateString = &dateString | ".";
            If Month(&bday) < 10 Then
               &dateString = &dateString | "0" | String(Month(&bday));
            Else
               &dateString = &dateString | String(Month(&bday));
            End-If;
            &dateString = &dateString | "." | Year(&bday);
            Return &java.berechneETIN(&last, &first, &dateString);
            Return &java.berechneETIN(&first, &last, &dateString);

          Else
             Return "";
          End-If;

       end-method;

       [ . . . Unchanged Code not Shown . . . ]




PeopleCode (Appl Package): GPFR_AF_DATA:ApplicationFrameworkClasses:GenerateXML.OnExecute
       [ . . . Unchanged Code not Shown . . . ]




         File Layout Definition Detail
File Layout Definition: GPJP_LA_ENROLL
                Description                   La Newly enrolled Empl file
                Layout Type                   CSV
                Field Qualifier
                Field Delimiter               ,
                Field Definition Tag
                Buffer Size                   0
                Imply Decimal Place           No
                Excel Format                  No
                Qualifier Optional            No
                Convert Tabs to Space         No
                Interpret Backslash           No
                Strip White Space             No
                Embedded Strings Inter        Double Quote
                Comments                      Enables the generation of the Newly Enrolled Employee
       Report

       Name                                                                 Max   ID   Start Len
       Quali Delim Descr
       +GPJP_LA_EN_HD                                                       36         0    0
       Comma LA Newly Enrolled Employee hea
         [DESCR]
         Trim Spaces :No
         Start Pos   :11
         Length      :30
         Field Type :Char
         Upper Case :No
         Qualifier   :
         Decimal     :0
         Field Tag   :DESCR
         Strip Char :~
         Field Descr :Establishment Name
         Default     :
         Rec Inherit :
         Fld Inherit :
         [GPJP_CHRDT_YYMMDD1]
         Trim Spaces :No
         Start Pos   :41
         Length      :6
         Field Type :Char
         Upper Case :No
         Qualifier   :
         Decimal     :0
         Field Tag   :GPJP_CHRDT_YYMMDD1
  Strip Char :~
  Field Descr :Date
  Default     :
  Rec Inherit :
  Fld Inherit :
+INSTALLATION                             5     0   0
Comma LA Newly Enrolled Employee det
  [GPJP_NUM5]
  Trim Spaces :No
  Start Pos   :1
  Length      :5
  Field Type :Char
  Upper Case :No
  Qualifier   :
  Decimal     :0
  Field Tag   :GPJP_NUM5
  Strip Char :~
  Field Descr :Report type
  Default     :10101
  Rec Inherit :
  Fld Inherit :
+GPJP_LA_ENR_DTL                          162   0   0
Comma LA Newly Enrolled Employee Det
  [GPJP_WORK1]
  Trim Spaces :No
  Start Pos   :1
  Length      :3
  Field Type :Num
  Upper Case :No
  Qualifier   :
  Decimal     :0
  Field Tag   :GPJP_WORK1
  Strip Char :~
  Field Descr :Report type
  Default     :3-1
  Rec Inherit :
  Fld Inherit :
  [NAME_AC]
  Trim Spaces :No
  Start Pos   :40
  Length      :50
  Field Type :Char
  Upper Case :No
  Qualifier   :
  Decimal     :0
  Field Tag   :NAME_AC
  Strip Char :~
  Field Descr :Alternate Character Name
  Default     :
  Rec Inherit :
  Fld Inherit :
  [GPJP_CHAR3]
  Trim Spaces :No
  Start Pos   :90
  Length      :3
  Field Type :Char
  Upper Case :No
  Qualifier   :
  Decimal     :0
  Field Tag   :GPJP_CHAR3
  Strip Char :~
  Field Descr :Sex
  Default     :
  Rec Inherit :
  Fld Inherit :
  [GPJP_DT_YYYYMMDD3]
  Trim Spaces :No
  Start Pos   :125
  Length      :10
  Field Type :Char
  Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPJP_DT_YYYYMMDD2
Strip Char :~
Field Descr :Insured Date
Default     :
Rec Inherit :
Fld Inherit :
[GPJP_CHAR15]
Trim Spaces :No
Start Pos   :1
Length      :15
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPJP_CHAR15
Strip Char :~
Field Descr :Labor Ins Estab No
Default     :
Rec Inherit :
Fld Inherit :
[GPJP_DT_YYYYMMDD1]
Trim Spaces :No
Start Pos   :94
Length      :8
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPJP_DT_YYYYMMDD1
Strip Char :~
Field Descr :Birthdate
Default     :
Rec Inherit :
Fld Inherit :
[GPJP_CHAR4_1]
Trim Spaces :No
Start Pos   :143
Length      :4
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPJP_CHAR4_1
Strip Char :~
Field Descr :Enrollment Reason
Default     :
Rec Inherit :
Fld Inherit :
[GPJP_CHAR9]
Trim Spaces :No
Start Pos   :148
Length      :9
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPJP_CHAR9
Strip Char :~
Field Descr :Wage Payment Method
Default     :
Rec Inherit :
Fld Inherit :
[GPJP_CHAR4_2]
Trim Spaces :No
Start Pos   :176
Length      :4
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPJP_CHAR4_2
Strip Char :~
Field Descr :Type of Employment
Default     :
Rec Inherit :
Fld Inherit :
[GPJP_CHAR4_3]
Trim Spaces :No
Start Pos   :181
Length      :4
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPJP_CHAR4_3
Strip Char :~
Field Descr :Job Type
Default     :
Rec Inherit :
Fld Inherit :
[GPJP_CHAR7]
Trim Spaces :No
Start Pos   :186
Length      :7
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPJP_CHAR7
Strip Char :~
Field Descr :Weekly Fix Working Hours
Default     :
Rec Inherit :
Fld Inherit :
[GPJP_CHAR22]
[GPJP_CHAR30]
Trim Spaces :No
Start Pos   :200
Length      :22
Start Pos   :1
Length      :30
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPJP_CHAR20
Strip Char :~
Field Tag   :GPJP_CHAR30
Strip Char :
Field Descr :Term Of Contract
Default     :
Rec Inherit :
Fld Inherit :
[NAME]
Trim Spaces :No
Start Pos   :242
Length      :50
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :NAME
Strip Char :~
Field Descr :Name
Default     :
Rec Inherit :
Fld Inherit :
File Layout Definition: GPUS_EFT_IAT
              Description                File Layout For IAT
              Layout Type                FIXED
              Field Qualifier
              Field Delimiter
              Field Definition Tag
              Buffer Size                0
              Imply Decimal Place        No
              Excel Format               No
              Qualifier Optional         No
              Convert Tabs to Space      No
              Interpret Backslash        No
              Strip White Space          No
              Embedded Strings Inter     Double Quote
              Comments
                                         File layout for IAT transactions

       Name                                                            Max   ID   Start Len
       Quali Delim Descr

       +GPUS_EFT_1REC                                                  94         0    0
       Comma 1 type record
         [GPUS_REC_TYPE]
         Trim Spaces :No
         Start Pos   :1
         Length      :1
         Field Type :Char
         Upper Case :No
         Qualifier   :"
         Decimal     :0
         Field Tag   :GPUS_REC_TYPE
         Strip Char :~
         Field Descr :record type
         Default     :1
         Rec Inherit :
         Fld Inherit :
         [GPUS_PRIORITY_CD]
         Trim Spaces :No
         Start Pos   :2
         Length      :2
         Field Type :Char
         Upper Case :No
         Qualifier   :
         Decimal     :0
         Field Tag   :GPUS_PRIORITY_CD
         Strip Char :~
         Field Descr :priority code
         Default     :01
         Rec Inherit :
         Fld Inherit :
         [GPUS_FILLER_1]
         Trim Spaces :No
         Start Pos   :4
         Length      :1
         Field Type :Char
         Upper Case :No
         Qualifier   :"
         Decimal     :0
         Field Tag   :GPUS_FILLER_1
         Strip Char :~
         Field Descr :filler 1
         Default     :
         Rec Inherit :
         Fld Inherit :
         [GPUS_BANK_CD]
         Trim Spaces :No
         Start Pos   :5
         Length      :9
         Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_BANK_CD
Strip Char :~
Field Descr :bank code 9 bytes
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_EFT_CHAR]
Trim Spaces :No
Start Pos   :14
Length      :1
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_EFT_CHAR
Strip Char :~
Field Descr :filler 1
Default     :1
Rec Inherit :
Fld Inherit :
[FEDERAL_EIN]
Trim Spaces :No
Start Pos   :15
Length      :9
Field Type :Num
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :FEDERAL_EIN
Strip Char :~
Field Descr :company federal EIN
Default     :999999999
Rec Inherit :
Fld Inherit :
[GPUS_EFT_CREATE_DT]
Trim Spaces :No
Start Pos   :24
Length      :6
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPUS_EFT_CR_DT
Strip Char :~
Field Descr :file creation date
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_EFT_CREATE_TM]
Trim Spaces :No
Start Pos   :30
Length      :4
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPUS_EFT_CR_TM
Strip Char :~
Field Descr :file creation time
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_FILE_ID]
Trim Spaces :No
Start Pos   :34
Length      :1
Field Type :Char
Upper Case :Yes
Qualifier   :
Decimal     :0
Field Tag   :GPUS_FILE_ID
Strip Char :~
Field Descr :file ID
Default     :A
Rec Inherit :
Fld Inherit :
[GPUS_REC_SIZE]
Trim Spaces :No
Start Pos   :35
Length      :3
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPUS_REC_SIZE
Strip Char :~
Field Descr :record size
Default     :094
Rec Inherit :
Fld Inherit :
[GPUS_BLOCK_FACTOR]
Trim Spaces :No
Start Pos   :38
Length      :2
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_BLOCK_FACTOR
Strip Char :~
Field Descr :blocking factor
Default     :10
Rec Inherit :
Fld Inherit :
[GPUS_EFT_FMT_CD]
Trim Spaces :No
Start Pos   :40
Length      :1
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPUS_EFT_FMT_CD
Strip Char :~
Field Descr :EFT format code
Default     :1
Rec Inherit :
Fld Inherit :
[GPUS_DEST_BANK_NM]
Trim Spaces :No
Start Pos   :41
Length      :23
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_DEST_BANK_NM
Strip Char :~
Field Descr :destination bank name
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_ORIGIN_NAME]
Trim Spaces :No
Start Pos   :64
Length      :23
Field Type :Char
Upper Case :Yes
Qualifier   :
  Decimal     :0
  Field Tag   :GPUS_ORIG_NAME
  Strip Char :~
  Field Descr :originating company name
  Default     :Company Name
  Rec Inherit :
  Fld Inherit :
  [GPUS_EFT_REF_CD]
  Trim Spaces :No
  Start Pos   :87
  Length      :8
  Field Type :Char
  Upper Case :No
  Qualifier   :
  Decimal     :0
  Field Tag   :GPUS_EFT_REF_CD
  Strip Char :~
  Field Descr :reference code
  Default     :
  Rec Inherit :
  Fld Inherit :
  +GPUS_IAT_5REC                          94   0   0
"     Comma IAT 5 Record Type
    [GPUS_REC_TYPE]
    Trim Spaces :No
    Start Pos   :1
    Length      :1
    Field Type :Char
    Upper Case :No
    Qualifier   :"
    Decimal     :0
    Field Tag   :GPUS_REC_TYPE
    Strip Char :~
    Field Descr :Record Type Code
    Default     :5
    Rec Inherit :
    Fld Inherit :
    [GPUS_SVC_CLASS_CD]
    Trim Spaces :No
    Start Pos   :2
    Length      :3
    Field Type :Char
    Upper Case :No
    Qualifier   :
    Decimal     :0
    Field Tag   :GPUS_SVC_CLASS_CD
    Strip Char :~
    Field Descr :Service Class Code
    Default     :200
    Rec Inherit :
    Fld Inherit :
    [GPUS_IAT_DSCRPTR]
    Trim Spaces :No
    Start Pos   :5
    Length      :16
    Field Type :Char
    Upper Case :No
    Qualifier   :"
    Decimal     :0
    Field Tag   :GPUS_IAT_DSCRPTR
    Strip Char :~
    Field Descr :IAT Descriptor
    Default     :
    Rec Inherit :
    Fld Inherit :
    [GPUS_FOREX_IND]
    Trim Spaces :No
    Start Pos   :21
    Length      :2
    Field Type :Char
    Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_FOREX_IND
Strip Char :~
Field Descr :Foreign Exchange Indicator
Default     :FF
Rec Inherit :
Fld Inherit :
[GPUS_FOREX_REF_IND]
Trim Spaces :No
Start Pos   :23
Length      :1
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_FOREX_REF_IND
Strip Char :~
Field Descr :Foreign Exchange Reference Indicator
Default     :3
Rec Inherit :
Fld Inherit :
[GPUS_FOREX_REF]
Trim Spaces :No
Start Pos   :24
Length      :15
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_FOREX_REF
Strip Char :~
Field Descr :Foreign Exchange Reference
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_ISO_DCNTRY_CD]
Trim Spaces :No
Start Pos   :39
Length      :2
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_ISO_DCNTRY_CD
Strip Char :~
Field Descr :ISO Destination Country Code
Default     :US
Rec Inherit :
Fld Inherit :
[FEDERAL_EIN]
Trim Spaces :No
Start Pos   :41
Length      :9
Field Type :Num
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :FEDERAL_EIN
Strip Char :~
Field Descr :Company Federal EIN
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_EFT_CHAR]
Trim Spaces :No
Start Pos   :50
Length      :1
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_EFT_CHAR
Strip Char :~
Field Descr :Filler 1
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_CLASS_CODE]
Trim Spaces :No
Start Pos   :51
Length      :3
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPUS_CLASS_CODE
Strip Char :~
Field Descr :Standard Entry Class Code
Default     :IAT
Rec Inherit :
Fld Inherit :
[GPUS_ENTRY_DESCR]
Trim Spaces :No
Start Pos   :54
Length      :10
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPUS_ENTRY_DESCR
Strip Char :~
Field Descr :Company Entry Description
Default     :DIR DEP
Rec Inherit :
Fld Inherit :
[GPUS_ISO_OCRNCY_CD]
Trim Spaces :No
Start Pos   :64
Length      :3
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_ISO_OCRNCY_CD
Strip Char :~
Field Descr :ISO Originationg Currency Code
Default     :USD
Rec Inherit :
Fld Inherit :
[GPUS_ISO_DCRNCY_CD]
Trim Spaces :No
Start Pos   :67
Length      :3
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_ISO_DCRNCY_CD
Strip Char :
Field Descr :ISO Destination Currency Code
Default     :USD
Rec Inherit :
Fld Inherit :
[GPUS_CHECK_DT]
Trim Spaces :No
Start Pos   :70
Length      :6
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
    Field Tag   :GPUS_CHECK_DT
    Strip Char :~
    Field Descr :Effective Entry Date (using Payment Date)
    Default     :
    Rec Inherit :
    Fld Inherit :
    [GPUS_SETTLE_DT]
    Trim Spaces :No
    Start Pos   :76
    Length      :3
    Field Type :Char
    Upper Case :No
    Qualifier   :
    Decimal     :0
    Field Tag   :GPUS_SETTLE_DT
    Strip Char :~
    Field Descr :Settlement Date
    Default     :000
    Rec Inherit :
    Fld Inherit :
    [GPUS_OSTATUS_CD]
    Trim Spaces :No
    Start Pos   :79
    Length      :1
    Field Type :Char
    Upper Case :No
    Qualifier   :"
    Decimal     :0
    Field Tag   :GPUS_OSTATUS_CD
    Strip Char :
    Field Descr :Originator Status Code
    Default     :1
    Rec Inherit :
    Fld Inherit :
    [GPUS_ORIGIN_DFI_ID]
    Trim Spaces :No
    Start Pos   :80
    Length      :8
    Field Type :Char
    Upper Case :No
    Qualifier   :
    Decimal     :0
    Field Tag   :GPUS_ORIG_DFI_ID
    Strip Char :~
    Field Descr :Originating DFI Identification
    Default     :
    Rec Inherit :
    Fld Inherit :
    [GPUS_BATCH_NBR]
    Trim Spaces :No
    Start Pos   :88
    Length      :7
    Field Type :Char
    Upper Case :No
    Qualifier   :
    Decimal     :0
    Field Tag   :GPUS_BATCH_NBR
    Strip Char :~
    Field Descr :Batch Number
    Default     :
    Rec Inherit :
    Fld Inherit :
    +GPUS_IAT_6REC                                           94   0   0
Comma IAT 6 Record Type
      [GPUS_REC_TYPE]
      Trim Spaces :No
      Start Pos   :1
      Length      :1
      Field Type :Char
      Upper Case :No
      Qualifier   :"
Decimal     :0
Field Tag   :GPUS_REC_TYPE
Strip Char :~
Field Descr :Record Type
Default     :6
Rec Inherit :
Fld Inherit :
[GPUS_TRANS_CD]
Trim Spaces :No
Start Pos   :2
Length      :2
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPUS_TRANS_CD
Strip Char :~
Field Descr :Transaction Code
Default     :22
Rec Inherit :
Fld Inherit :
[GPUS_RCV_DFI_ID]
Trim Spaces :No
Start Pos   :4
Length      :8
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPUS_RCV_DFI_ID
Strip Char :~
Field Descr :Receiving DFI Identification
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_CHECK_DIGIT]
Trim Spaces :No
Start Pos   :12
Length      :1
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPUS_CHECK_DIGIT
Strip Char :~
Field Descr :Check Digit
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_ADDENDA_CNT]
Trim Spaces :No
Start Pos   :13
Length      :4
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_ADDENDA_CNT
Strip Char :
Field Descr :Number of Addenda Records
Default     :0007
Rec Inherit :
Fld Inherit :
[GPUS_RESERVED_13]
Trim Spaces :No
Start Pos   :17
Length      :13
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_RESERVED_13
Strip Char :
Field Descr :Reserved
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_PMT_AMT]
Trim Spaces :No
Start Pos   :30
Length      :10
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_PMT_AMT
Strip Char :~
Field Descr :Amount
Default     :
Rec Inherit :
Fld Inherit :
[ACCOUNT_NUM]
Trim Spaces :No
Start Pos   :40
Length      :35
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :ACCOUNT_NUM
Strip Char :~
Field Descr :DFI Account Number
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_RESERVED_2]
Trim Spaces :No
Start Pos   :75
Length      :2
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_RESERVED_2
Strip Char :~
Field Descr :Reserved
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_FILLER_2]
Trim Spaces :No
Start Pos   :77
Length      :2
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_FILLER_2
Strip Char :~
Field Descr :Filler
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_ADDENDA_IND]
Trim Spaces :No
Start Pos   :79
Length      :1
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPUS_ADDENDA_IND
    Strip Char :~
    Field Descr :Addenda Record Indicator
    Default     :0
    Rec Inherit :
    Fld Inherit :
    [GPUS_TRACE_NBR]
    Trim Spaces :No
    Start Pos   :80
    Length      :15
    Field Type :Num
    Upper Case :No
    Qualifier   :
    Decimal     :0
    Field Tag   :GPUS_TRACE_NBR
    Strip Char :~
    Field Descr :Trace Number
    Default     :
    Rec Inherit :
    Fld Inherit :
    +GPUS_IAT_710                           94   0   0
"   Comma IAT 7 Record Type, 10 Addenda
      [GPUS_REC_TYPE]
      Trim Spaces :No
      Start Pos   :1
      Length      :1
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_REC_TYPE
      Strip Char :~
      Field Descr :Record Type Code
      Default     :7
      Rec Inherit :
      Fld Inherit :
      [GPUS_ADDENDA_TYPE]
      Trim Spaces :No
      Start Pos   :2
      Length      :2
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_ADD_TYPE
      Strip Char :~
      Field Descr :Addenda Type Code
      Default      :10
      Rec Inherit :
      Fld Inherit :
      [GPUS_TXN_TYPE]
      Trim Spaces :No
      Start Pos   :4
      Length      :3
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_TXN_TYPE
      Strip Char :
      Field Descr :Transaction Type Code
      Default     :SAL
      Rec Inherit :
      Fld Inherit :
      [GPUS_FOREIGN_PMT]
      Trim Spaces :No
      Start Pos   :7
      Length      :18
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_FOREIGN_PMT
      Strip Char :
      Field Descr :Foreign Payment Amount
      Default     :
      Rec Inherit :
      Fld Inherit :
      [GPUS_FOREIGN_TRC]
      Trim Spaces :No
      Start Pos   :25
      Length      :22
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_FOREIGN_TRC
      Strip Char :
      Field Descr :Foreign Trace Number
      Default     :
      Rec Inherit :
      Fld Inherit :
      [GPUS_RCVR_NAME]
      Trim Spaces :No
      Start Pos   :47
      Length      :35
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_RCVR_NAME
      Strip Char :
      Field Descr :Receiver Name
      Default     :
      Rec Inherit :
      Fld Inherit :
      [GPUS_RESERVED_6]
      Trim Spaces :No
      Start Pos   :82
      Length      :6
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_RESERVED_6
      Strip Char :
      Field Descr :Reserved
      Default     :
      Rec Inherit :
      Fld Inherit :
      [GPUS_TRACE_NBR7]
      Trim Spaces :No
      Start Pos   :88
      Length      :7
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_TRACE_NBR7
      Strip Char :
      Field Descr :Trace Number
      Default     :
      Rec Inherit :
      Fld Inherit :
    +GPUS_IAT_711                           94   0   0
"   Comma IAT 7 Record Type, 11 Addenda
      [GPUS_REC_TYPE]
      Trim Spaces :No
      Start Pos   :1
      Length      :1
      Field Type :Char
      Upper Case :No
      Qualifier   :"
Decimal     :0
Field Tag   :GPUS_REC_TYPE
Strip Char :
Field Descr :Record Type Code
Default     :7
Rec Inherit :
Fld Inherit :
[GPUS_ADDENDA_TYPE]
Trim Spaces :No
Start Pos   :2
Length      :2
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_ADD_TYPE
Strip Char :~
Field Descr :Addenda Type Code
Default     :11
Rec Inherit :
Fld Inherit :
[GPUS_ORIG_NAME]
Trim Spaces :No
Start Pos   :4
Length      :35
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_ORIG_NAME
Strip Char :
Field Descr :Originator Name
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_ORIG_ADDR]
Trim Spaces :No
Start Pos   :39
Length      :35
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_ORIG_ADDR
Strip Char :
Field Descr :Originator Address
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_RESERVED_14]
Trim Spaces :No
Start Pos   :74
Length      :14
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_RESERVED_14
Strip Char :
Field Descr :Reserved
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_TRACE_NBR7]
Trim Spaces :No
Start Pos   :88
Length      :7
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
      Field Tag   :GPUS_TRACE_NBR7
      Strip Char :
      Field Descr :Trace Number
      Default     :
      Rec Inherit :
      Fld Inherit :
    +GPUS_IAT_712                                       94   0   0
"   Comma IAT 7 Record Type, 12 Addenda
      [GPUS_REC_TYPE]
      Trim Spaces :No
      Start Pos   :1
      Length      :1
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_REC_TYPE
      Strip Char :
      Field Descr :Record Type Code
      Default     :7
      Rec Inherit :
      Fld Inherit :
      [GPUS_ADDENDA_TYPE]
      Trim Spaces :No
      Start Pos   :2
      Length      :2
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_ADD_TYPE
      Strip Char :~
      Field Descr :Addenda Type Code
      Default     :12
      Rec Inherit :
      Fld Inherit :
      [GPUS_ORIG_CITY_ST]
      Trim Spaces :No
      Start Pos   :4
      Length      :35
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_ORIG_CITY_ST
      Strip Char :
      Field Descr :Originator City and State
      Default     :
      Rec Inherit :
      Fld Inherit :
      [GPUS_ORIG_CNTRY_PC]
      Trim Spaces :No
      Start Pos   :39
      Length      :35
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_ORIG_CNTRY_PC
      Strip Char :
      Field Descr :Originator Country and Postal Code
      Default     :
      Rec Inherit :
      Fld Inherit :
      [GPUS_RESERVED_14]
      Trim Spaces :No
      Start Pos   :74
      Length      :14
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_RESERVED_14
      Strip Char :
      Field Descr :Reserved
      Default     :
      Rec Inherit :
      Fld Inherit :
      [GPUS_TRACE_NBR7]
      Trim Spaces :No
      Start Pos   :88
      Length      :7
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_TRACE_NBR7
      Strip Char :
      Field Descr :Trace Number
      Default     :
      Rec Inherit :
      Fld Inherit :
    +GPUS_IAT_713                         94   0   0
"   Comma IAT 7 Record Type, 13 Addenda
      [GPUS_REC_TYPE]
      Trim Spaces :No
      Start Pos   :1
      Length      :1
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_REC_TYPE
      Strip Char :
      Field Descr :Record Type Code
      Default     :7
      Rec Inherit :
      Fld Inherit :
      [GPUS_ADDENDA_TYPE]
      Trim Spaces :No
      Start Pos   :2
      Length      :2
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_ADD_TYPE
      Strip Char :~
      Field Descr :Addenda Type Code
      Default     :13
      Rec Inherit :
      Fld Inherit :
      [GPUS_ODFI_NAME]
      Trim Spaces :No
      Start Pos   :4
      Length      :35
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_ODFI_NAME
      Strip Char :
      Field Descr :ODFI Name
      Default     :
      Rec Inherit :
      Fld Inherit :
      [GPUS_ODFI_ID_QUAL]
      Trim Spaces :No
      Start Pos   :39
      Length      :2
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_ODFI_ID_QUAL
      Strip Char :
      Field Descr :ODFI ID Qualifier
      Default     :
      Rec Inherit :
      Fld Inherit :
      [GPUS_ODFI_ID]
      Trim Spaces :No
      Start Pos   :41
      Length      :34
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_ODFI_ID
      Strip Char :
      Field Descr :ODFI ID
      Default     :
      Rec Inherit :
      Fld Inherit :
      [GPUS_ODFI_BR_CNTRY]
      Trim Spaces :No
      Start Pos   :75
      Length      :3
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_ODFI_BR_CNTRY
      Strip Char :
      Field Descr :ODFI Branch Country
      Default     :US
      Rec Inherit :
      Fld Inherit :
      [GPUS_RESERVED_10]
      Trim Spaces :No
      Start Pos   :78
      Length      :10
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_RESERVED_10
      Strip Char :
      Field Descr :Reserved
      Default     :
      Rec Inherit :
      Fld Inherit :
      [GPUS_TRACE_NBR7]
      Trim Spaces :No
      Start Pos   :88
      Length      :7
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_TRACE_NBR7
      Strip Char :
      Field Descr :Trace Number
      Default     :
      Rec Inherit :
      Fld Inherit :
    +GPUS_IAT_714                         94   0   0
"   Comma IAT 7 Record Type, 14 Addenda
      [GPUS_REC_TYPE]
      Trim Spaces :No
      Start Pos   :1
      Length      :1
      Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_REC_TYPE
Strip Char :
Field Descr :Record Type Code
Default     :7
Rec Inherit :
Fld Inherit :
[GPUS_ADDENDA_TYPE]
Trim Spaces :No
Start Pos   :2
Length      :2
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_ADD_TYPE
Strip Char :~
Field Descr :Addenda Type Code
Default     :14
Rec Inherit :
Fld Inherit :
[GPUS_RDFI_NAME]
Trim Spaces :No
Start Pos   :4
Length      :35
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_RDFI_NAME
Strip Char :
Field Descr :RDFI Name
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_RDFI_ID_QUAL]
Trim Spaces :No
Start Pos   :39
Length      :2
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_RDFI_ID_QUAL
Strip Char :
Field Descr :RDFI ID Qualifier
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_RDFI_ID]
Trim Spaces :No
Start Pos   :41
Length      :34
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_RDFI_ID
Strip Char :
Field Descr :RDFI ID
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_RDFI_BR_CNTRY]
Trim Spaces :No
Start Pos   :75
Length      :3
Field Type :Char
Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_RDFI_BR_CNTRY
      Strip Char :
      Field Descr :RDFI Branch Country
      Default     :US
      Rec Inherit :
      Fld Inherit :
      [GPUS_RESERVED_10]
      Trim Spaces :No
      Start Pos   :78
      Length      :10
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_RESERVED_10
      Strip Char :
      Field Descr :Reserved
      Default     :
      Rec Inherit :
      Fld Inherit :
      [GPUS_TRACE_NBR7]
      Trim Spaces :No
      Start Pos   :88
      Length      :7
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_TRACE_NBR7
      Strip Char :
      Field Descr :Trace Number
      Default     :
      Rec Inherit :
      Fld Inherit :
    +GPUS_IAT_715                         94   0   0
"   Comma IAT 7 Record Type, 15 Addenda
      [GPUS_REC_TYPE]
      Trim Spaces :No
      Start Pos   :1
      Length      :1
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_REC_TYPE
      Strip Char :
      Field Descr :Record Type Code
      Default     :7
      Rec Inherit :
      Fld Inherit :
      [GPUS_ADDENDA_TYPE]
      Trim Spaces :No
      Start Pos   :2
      Length      :2
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_ADD_TYPE
      Strip Char :~
      Field Descr :Addenda Type Code
      Default     :15
      Rec Inherit :
      Fld Inherit :
      [GPUS_RCVR_ID]
      Trim Spaces :No
      Start Pos   :4
      Length      :15
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_RCVR_ID
      Strip Char :
      Field Descr :Receiver ID
      Default     :
      Rec Inherit :
      Fld Inherit :
      [GPUS_RCVR_ADDR]
      Trim Spaces :No
      Start Pos   :19
      Length      :35
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_RCVR_ADDR
      Strip Char :
      Field Descr :Receiver Address
      Default     :
      Rec Inherit :
      Fld Inherit :
      [GPUS_RESERVED_34]
      Trim Spaces :No
      Start Pos   :54
      Length      :34
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_RESERVED_34
      Strip Char :
      Field Descr :Reserved
      Default     :
      Rec Inherit :
      Fld Inherit :
      [GPUS_TRACE_NBR7]
      Trim Spaces :No
      Start Pos   :88
      Length      :7
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_TRACE_NBR7
      Strip Char :
      Field Descr :Trace Number
      Default     :
      Rec Inherit :
      Fld Inherit :
    +GPUS_IAT_716                         94   0   0
"   Comma IAT 7 Record Type, 16 Addenda
      [GPUS_REC_TYPE]
      Trim Spaces :No
      Start Pos   :1
      Length      :1
      Field Type :Char
      Upper Case :No
      Qualifier   :"
      Decimal     :0
      Field Tag   :GPUS_REC_TYPE
      Strip Char :
      Field Descr :Record Type Code
      Default     :7
      Rec Inherit :
      Fld Inherit :
      [GPUS_ADDENDA_TYPE]
      Trim Spaces :No
      Start Pos   :2
      Length      :2
        Field Type :Char
        Upper Case :No
        Qualifier   :"
        Decimal     :0
        Field Tag   :GPUS_ADD_TYPE
        Strip Char :~
        Field Descr :Addenda Type Code
        Default     :16
        Rec Inherit :
        Fld Inherit :
        [GPUS_RCVR_CITY_ST]
        Trim Spaces :No
        Start Pos   :4
        Length      :35
        Field Type :Char
        Upper Case :No
        Qualifier   :"
        Decimal     :0
        Field Tag   :GPUS_RCVR_CITY_ST
        Strip Char :
        Field Descr :Receiver City and State
        Default     :
        Rec Inherit :
        Fld Inherit :
        [GPUS_RCVR_CNTRY_PC]
        Trim Spaces :No
        Start Pos   :39
        Length      :35
        Field Type :Char
        Upper Case :No
        Qualifier   :"
        Decimal     :0
        Field Tag   :GPUS_RCVR_CNTRY_PC
        Strip Char :
        Field Descr :Receiver Country and Postal Code
        Default     :
        Rec Inherit :
        Fld Inherit :
        [GPUS_RESERVED_14]
        Trim Spaces :No
        Start Pos   :74
        Length      :14
        Field Type :Char
        Upper Case :No
        Qualifier   :"
        Decimal     :0
        Field Tag   :GPUS_RESERVED_14
        Strip Char :
        Field Descr :Reserved
        Default     :
        Rec Inherit :
        Fld Inherit :
        [GPUS_TRACE_NBR7]
        Trim Spaces :No
        Start Pos   :88
        Length      :7
        Field Type :Char
        Upper Case :No
        Qualifier   :"
        Decimal     :0
        Field Tag   :GPUS_TRACE_NBR7
        Strip Char :
        Field Descr :Trace Number
        Default     :
        Rec Inherit :
        Fld Inherit :
  +GPUS_EFT_8REC                                        94   0   0
Comma 8 type record
    [GPUS_REC_TYPE]
    Trim Spaces :No
    Start Pos   :1
Length      :1
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_REC_TYPE
Strip Char :~
Field Descr :record type
Default     :8
Rec Inherit :
Fld Inherit :
[GPUS_SVC_CLASS_CD]
Trim Spaces :No
Start Pos   :2
Length      :3
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPUS_SVC_CLASS_CD
Strip Char :~
Field Descr :service class code
Default     :200
Rec Inherit :
Fld Inherit :
[GPUS_ENTRY_COUNT6]
Trim Spaces :No
Start Pos   :5
Length      :6
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPUS_ENTRY_COUNT6
Strip Char :~
Field Descr :entry count 6 byte
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_ENTRY_HASH]
Trim Spaces :No
Start Pos   :11
Length      :10
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPUS_ENTRY_HASH
Strip Char :~
Field Descr :entry hash
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_TOTAL_DEBIT]
Trim Spaces :No
Start Pos   :21
Length      :12
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPUS_TOTAL_DEBIT
Strip Char :~
Field Descr :total debit amount
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_TOTAL_CREDIT]
Trim Spaces :No
Start Pos   :33
Length      :12
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPUS_TOTAL_CREDIT
Strip Char :~
Field Descr :total credit amount
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_EFT_CHAR]
Trim Spaces :No
Start Pos   :45
Length      :1
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_EFT_CHAR
Strip Char :~
Field Descr :filler 1
Default     :1
Rec Inherit :
Fld Inherit :
[FEDERAL_EIN]
Trim Spaces :No
Start Pos   :46
Length      :9
Field Type :Num
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :FEDERAL_EIN
Strip Char :~
Field Descr :company federal EIN
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_MSG_AUTH_CD]
Trim Spaces :No
Start Pos   :55
Length      :19
Field Type :Char
Upper Case :No
Qualifier   :
Decimal     :0
Field Tag   :GPUS_MSG_AUTH_CD
Strip Char :~
Field Descr :message authentication code
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_FILLER_6]
Trim Spaces :No
Start Pos   :74
Length      :6
Field Type :Char
Upper Case :No
Qualifier   :"
Decimal     :0
Field Tag   :GPUS_FILLER_6
Strip Char :~
Field Descr :filler 6
Default     :
Rec Inherit :
Fld Inherit :
[GPUS_ORIGIN_DFI_ID]
Trim Spaces :No
Start Pos   :80
Length      :8
Field Type :Char
    Upper Case :No
    Qualifier   :
    Decimal     :0
    Field Tag   :GPUS_ORIG_DFI_ID
    Strip Char :~
    Field Descr :origin DFI identification ID
    Default     :
    Rec Inherit :
    Fld Inherit :
    [GPUS_BATCH_NBR]
    Trim Spaces :No
    Start Pos   :88
    Length      :7
    Field Type :Num
    Upper Case :No
    Qualifier   :
    Decimal     :0
    Field Tag   :GPUS_BATCH_NBR
    Strip Char :~
    Field Descr :batch number
    Default     :
    Rec Inherit :
    Fld Inherit :
+GPUS_EFT_9REC                                  94   0   0
Comma 9 type record
  [GPUS_REC_TYPE]
  Trim Spaces :No
  Start Pos   :1
  Length      :1
  Field Type :Char
  Upper Case :No
  Qualifier   :"
  Decimal     :0
  Field Tag   :GPUS_REC_TYPE
  Strip Char :~
  Field Descr :record type
  Default     :9
  Rec Inherit :
  Fld Inherit :
  [GPUS_BATCH_COUNT]
  Trim Spaces :No
  Start Pos   :2
  Length      :6
  Field Type :Char
  Upper Case :No
  Qualifier   :
  Decimal     :0
  Field Tag   :GPUS_BATCH_COUNT
  Strip Char :~
  Field Descr :batch count
  Default     :
  Rec Inherit :
  Fld Inherit :
  [GPUS_BLOCK_COUNT]
  Trim Spaces :No
  Start Pos   :8
  Length      :6
  Field Type :Char
  Upper Case :No
  Qualifier   :"
  Decimal     :0
  Field Tag   :GPUS_BLOCK_COUNT
  Strip Char :~
  Field Descr :block count
  Default     :
  Rec Inherit :
  Fld Inherit :
  [GPUS_ENTRY_COUNT8]
  Trim Spaces :No
  Start Pos   :14
  Length      :8
  Field Type :Char
  Upper Case :No
  Qualifier   :
  Decimal     :0
  Field Tag   :GPUS_ENTRY_COUNT8
  Strip Char :~
  Field Descr :entry count
  Default     :
  Rec Inherit :
  F