project QadFinancials > class BEmployee > method PostValidateComponent

Description

This method is run after the standard ValidateComponent.
Runs specific validations.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BEmployee.ValidateComponent


program code (program1/bemployee.p)

/* Validates all New and Changed Employees */
for each t_sEmployee:
    if t_sEmployee.tc_Status = 'D':U
    then do:
        <Q-70 run EngineerByEmployee (all) (Read) (NoCache)
           (input vcDomainCode, (DomainCode)
            input t_sEmployee.EmployeeCode, (Employee)
            output dataset tqEngineerByEmployee) in BMfgEngineer>
        find first tqEngineerByEmployee where
            tqEngineerByEmployee.tceng_domain = vcDomainCode and
            tqEngineerByEmployee.tceng_addr = t_sEmployee.EmployeeCode 
        no-error.
        if available tqEngineerByEmployee then do:
            assign 
            vcMessage = trim(substitute(#T-35'Cannot Delete Employee. Engineer Master &1 exists for this employee':255(274372435)T-35#, trim(tqEngineerByEmployee.tceng_code)))
            oiReturnStatus = -1.
        <M-52 run SetMessage
           (input  vcMessage (icMessage), 
            input  '':U (icArguments), 
            input  'tEmployee.EmployeeCode':U (icFieldName), 
            input  t_sEmployee.EmployeeCode (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  t_sEmployee.tc_Rowid (icRowid), 
            input  'qadfin-755215':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BEmployee>    
        end.
    end.

    if t_sEmployee.tc_Status <> 'N':U and
       t_sEmployee.tc_Status <> 'C':U 
    then next.

    /* General */
    if t_sEmployee.tc_Status = 'N':U or
       t_sEmployee.tc_Status = 'C':U
    then do:
        <M-1 run ValGeneral (output viFcReturnSuper (oiReturnStatus)) in BEmployee>
        assign oiReturnStatus = if (oiReturnStatus  > 0 and 
                                    viFcReturnSuper = 0) or 
                                    oiReturnStatus  < 0
                                then oiReturnStatus
                                else viFcReturnSuper.
    end.

    /* Time Registration (Activity Sheets) */
    if t_sEmployee.EmployeeIsActiveTimeReg <> false
    then do:
        <M-3 run ValActiveActivity (output viFcReturnSuper (oiReturnStatus)) in BEmployee>
        assign oiReturnStatus = if (oiReturnStatus  > 0 and 
                                viFcReturnSuper = 0) or 
                                oiReturnStatus  < 0
                            then oiReturnStatus
                            else viFcReturnSuper.
    end.

    /* Expense Notes */
    if t_sEmployee.EmployeeIsActiveExpNotes <> false
    then do:
        <M-4 run ValActiveExpenses (output viFcReturnSuper (oiReturnStatus)) in BEmployee>
        assign oiReturnStatus = if (oiReturnStatus  > 0 and 
                                viFcReturnSuper = 0) or 
                                oiReturnStatus  < 0
                            then oiReturnStatus
                            else viFcReturnSuper.
    end.
end.