project QadFinancials > class BExpenseNote > method PreValidateComponent


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BExpenseNote.ValidateComponent


program code (program1/bexpensenote.p)

for each t_sExpNoteLine where t_sExpNoteLine.tc_Status = "N":U or
                              t_sExpNoteLine.tc_Status = "C":U:
    /*Update/Create  t_sExpNoteSaf*/
    if (t_sExpNoteLine.tcProjectCode = "":U or 
        t_sExpNoteLine.tcProjectCode = ? or 
        t_sExpNoteLine.tcProjectCode = "?":U) and
       (t_sExpNoteLine.tcCostCentreCode = "":U or 
        t_sExpNoteLine.tcCostCentreCode = ? or 
        t_sExpNoteLine.tcCostCentreCode = "?":U)
    then assign vcSafParentType = {&POSTINGSAFPARENTTYPE-GL}.
    else do:
        if t_sExpNoteLine.tcProjectCode <> "":U and 
           t_sExpNoteLine.tcProjectCode <> ?    and
           t_sExpNoteLine.tcProjectCode <> "?":U
        then assign vcSafParentType = {&POSTINGSAFPARENTTYPE-PROJECT}.
        else assign vcSafParentType = {&POSTINGSAFPARENTTYPE-COSTCENTRE}.
    end.
    <M-1 run CreateExpNoteLineSafs (input  t_sExpNoteLine.tc_Rowid (icParentRowid), 
                                input  vcSafParentType (icSafParentType), 
                                output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
    
        
    assign oiReturnStatus = if (oiReturnStatus  > 0 and 
                            viFcReturnSuper = 0) or 
                            oiReturnStatus  < 0
                        then oiReturnStatus
                        else viFcReturnSuper.
    for each t_sExpNoteLineSaf where
             t_sExpNoteLineSaf.tc_ParentRowid = t_sExpNoteLine.tc_Rowid and
             t_sExpNoteLineSaf.tc_Status     <> 'D':U:

        /* delete all the ExpNoteLineSaf records where the saf concept and code are undefined */
   
        if (t_sExpNoteLineSaf.ExpNoteLineSafInputSeq = 1      and
            t_sExpNoteLine.tcSAFConcept1         = "":U and
            t_sExpNoteLine.tcSAFCode1            = "":U) or
           (t_sExpNoteLineSaf.ExpNoteLineSafInputSeq = 2      and
            t_sExpNoteLine.tcSAFConcept2         = "":U and
            t_sExpNoteLine.tcSAFCode2            = "":U) or
           (t_sExpNoteLineSaf.ExpNoteLineSafInputSeq = 3      and
            t_sExpNoteLine.tcSAFConcept3         = "":U and
            t_sExpNoteLine.tcSAFCode3            = "":U) or
           (t_sExpNoteLineSaf.ExpNoteLineSafInputSeq = 4      and
            t_sExpNoteLine.tcSAFConcept4         = "":U and
            t_sExpNoteLine.tcSAFCode4            = "":U) or
           (t_sExpNoteLineSaf.ExpNoteLineSafInputSeq = 5      and
            t_sExpNoteLine.tcSAFConcept5         = "":U and
            t_sExpNoteLine.tcSAFCode5            = "":U)
        then do:
            assign t_sExpNoteLineSaf.tc_Status = if t_sExpNoteLineSaf.tc_Status = "N":U or
                                                 t_sExpNoteLineSaf.tc_Status = "":U
                                              then "":U 
                                              else "D":U.
            next.
        end.
    end.
end.