project QadFinancials > class BDInvoice > method ValDeductionCatLine

Description

Validate the DeductionCat Line ID


Parameters


biDeductionCatLineIDinput-outputintegerValue of the business field to validate.
icTargetFieldNameinputcharacterName of the business field to validate.
icRowidinputcharacterContents of field tc_Rowid, if the target field is a field of a component temp-table.
icDeductionCatCodeinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDInvoice.ApiCreateDebtorInvoicesV01
method BDInvoice.CreateDInvoicesDeduction


program code (program5/bdinvoice.p)

/*get deduction id with deduction code*/
if icDeductionCatCode = ?  or icDeductionCatCode = '':U
then do:
      assign vcMessage = trim(#T-30'the deduction code should not be blank':255(299498492)T-30#)
             oiReturnStatus = -1.
      <M-72 run SetMessage
         (input  vcMessage (icMessage), 
          input  '':U (icArguments), 
          input  '':U (icFieldName), 
          input  '':U (icFieldValue), 
          input  'E' (icType), 
          input  3 (iiSeverity), 
          input  icRowid (icRowid), 
          input  'qadfin-194650':U (icFcMsgNumber), 
          input  '':U (icFcExplanation), 
          input  '':U (icFcIdentification), 
          input  '':U (icFcContext), 
          output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
      return.
end.
else do:
       <Q-97 run DeductionCatLineByCode (all) (Read) (NoCache)
                (input viDomainID, (DomainId)
                 input ?, (CompanyId)
                 input icDeductionCatCode, (DeductionCode)
                 output dataset tqDeductionCatLineByCode) in BDeductionCat>
       find first tqDeductionCatLineByCode
            where tqDeductionCatLineByCode.tcDeductionCatCode = icDeductionCatCode no-lock no-error.
       
       if not available tqDeductionCatLineByCode 
       then do: /*Deudction Cat Code does not exists.*/
            assign vcMessage = trim(#T-46'The deduction code $1 does not exists.':255(124954338)T-46#)
                   oiReturnStatus = -1.
            <M-94 run SetMessage
                  (input  vcMessage (icMessage), 
                   input  icDeductionCatCode (icArguments), 
                   input  '':U (icFieldName), 
                   input  '':U (icFieldValue), 
                   input  'E':U (icType), 
                   input  3 (iiSeverity), 
                   input  ? (icRowid), 
                   input  'qadfin-86311':U (icFcMsgNumber), 
                   input  '':U (icFcExplanation), 
                   input  '':U (icFcIdentification), 
                   input  '':U (icFcContext), 
                   output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
           return.
       end.
       
       else if tqDeductionCatLineByCode.tlDeductionCatIsActive <> true
       then do:
       /*the deudction category code is not active*/
            assign vcMessage = trim(#T-28'The deduction code $1 is not active':255(405735694)T-28#)
                  oiReturnStatus = -1.
             <M-50 run SetMessage
                (input  vcMessage (icMessage), 
                 input  icDeductionCatCode (icArguments), 
                 input  '':U (icFieldName), 
                 input  '':U (icFieldValue), 
                 input  'E':U (icType), 
                 input  3 (iiSeverity), 
                 input  ? (icRowid), 
                 input  'qadfin-905738':U (icFcMsgNumber), 
                 input  '':U (icFcExplanation), 
                 input  '':U (icFcIdentification), 
                 input  '':U (icFcContext), 
                 output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
           return.
       end.
       else 
       do:
           assign biDeductionCatLineID = tqDeductionCatLineByCode.tiDeductionCatLine_ID.
       end.
end.

if biDeductionCatLineID = 0
then do:
     assign vcMessage = trim(#T-81'The deduction cat is not defind.':255(142658957)T-81#)
            oiReturnStatus = -1.
                 <M-9 run SetMessage
                    (input  vcMessage (icMessage), 
                     input  '':U (icArguments), 
                     input  '':U (icFieldName), 
                     input  '':U (icFieldValue), 
                     input  'E' (icType), 
                     input  3 (iiSeverity), 
                     input  icRowid (icRowid), 
                     input  'qadfin-124386':U (icFcMsgNumber), 
                     input  '':U (icFcExplanation), 
                     input  '':U (icFcIdentification), 
                     input  '':U (icFcContext), 
                     output viFcReturnSuper (oiReturnStatus)) in BDInvoice>

end.