project QadFinancials > class BEmployee > method ValExpenseCode

Description

Validates Expense Code. Check t_sTables here.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BEmployee.ValActiveExpenses


program code (program1/bemployee.p)

/* The Expense Code is mandatory */
if t_sEmployee.ExpenseCode_ID = 0 or
   t_sEmployee.ExpenseCode_ID = ?
then do:
    assign vcMessage = trim(substitute(#T-4'You must enter the expense code (employee: &1).':200(1823)T-4#, trim(t_sEmployee.EmployeeCode))).
    <M-1 run SetMessage (input  vcMessage (icMessage),
                     input  '':U (icArguments),
                     input  'tEmployee.tcExpenseCode':U (icFieldName),
                     input  '':U (icFieldValue),
                     input  'E':U (icType),
                     input  3 (iiSeverity),
                     input  t_sEmployee.tc_Rowid (icRowid),
                     input  'QADFIN-1642':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BEmployee>
    assign oiReturnStatus = min(-1,viFcReturnSuper).
end.
/* The Expense Code has to be of the type Employee */
else do:
    <Q-2 assign vlFcQueryRecordsAvailable = ExpenseCodeByCodeTypeAct (NoCache)
          (input t_sEmployee.tcExpenseCode, (ExpenseCode)
           input ?, (ExpenseCodeIsActive)
           input {&EXPENSECODETYPE-EMPLOYEE}, (ExpenseCodeType)) in BExpenseCode >
    if not vlFcQueryRecordsAvailable
    then do:
        assign vcMessage = trim(substitute(#T-5'The expense code must be of type '&2' (employee: &1).':200(1824)t-5#, trim(t_sEmployee.EmployeeCode), {&EXPENSECODETYPE-EMPLOYEE-TR})).
        <M-3 run SetMessage (input  vcMessage (icMessage),
                     input  '':U (icArguments),
                     input  'tEmployee.tcExpenseCode':U (icFieldName),
                     input  '':U (icFieldValue),
                     input  'E':U (icType),
                     input  3 (iiSeverity),
                     input  t_sEmployee.tc_Rowid (icRowid),
                     input  'QADFIN-2192':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BEmployee>
        assign oiReturnStatus = min(-1,viFcReturnSuper).
    end.                                                                  
end.