project QadFinancials > class BCompanyGroup > method ValidateComponentPreCyGroup

Description

Implement extra validations for the Closing mask


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BCompanyGroup.ValidateComponentPre


program code (program1/bcompanygroup.p)

/* ============================================================================================ *
 * Perform validation for CyGroup record                                                          *
 * ============================================================================================ */

/* Precondition */
if not available t_sCyGroup
then do:
    assign vcMessage = #T-86'There is missing t_sCyGroup record.':255(930040240)T-86#.
    <M-22 run SetMessage
       (input  vcMessage (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'S':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'qadfin-631480':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BCMask>
    assign oiReturnStatus = -1.
    return.
end.

/* ============================================================================================ *
 * Remove empty lines with Entity                                                               *
 * ============================================================================================ */
for each t_sCyGroupCompany where
         t_sCyGroupCompany.tc_ParentRowid = t_sCyGroup.tc_Rowid and
         t_sCyGroupCompany.tc_Status     <> "D":U             and
         (t_sCyGroupCompany.tcCompanyCode = ? or
          t_sCyGroupCompany.tcCompanyCode = "":U):
          
    if t_sCyGroupCompany.tc_Status = "N":U
    then do:
        find t_oCyGroupCompany where
             t_oCyGroupCompany.tc_Rowid = t_sCyGroupCompany.tc_Rowid
             no-error.
        if available t_oCyGroupCompany
        then delete t_oCyGroupCompany.
        
        delete t_sCyGroupCompany.
    end.          
    else assign t_sCyGroupCompany.tc_Status = "D":U.
end.