project QadFinancials > class BPaymentSelection > method DefaultValuesDocumentType


Parameters


icDocumentTypeinputcharacter
iiBankGLIDinputinteger
icBankGLCodeinputcharacter
ocGLCodeoutputcharacter
ocGLDescriptionoutputcharacter
ocJournalCodeoutputcharacter
olCreditDirectlyOnBankoutputlogical
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BPaymentSelection.ApiGetPaySelInfoForConfirm
method BPaymentSelection.Calculate01


program code (program3/bpaymentselection.p)

assign vcDocumentType = trim(#T-9'Unknown':15(17932)T-9#)
       olCreditDirectlyOnBank = false.
assign vcDOCUMENTTYPECREDITORS ={&DOCUMENTTYPECREDITORS}.

if icDocumentType <> "":U and
   icDocumentType <> ?
then do viA = num-entries(vcDOCUMENTTYPECREDITORS, chr(2)) to 1 by -2:
    if entry(viA, vcDOCUMENTTYPECREDITORS, chr(2)) = icDocumentType
    then do:
        assign vcDocumentType = entry(viA - 1, vcDOCUMENTTYPECREDITORS, chr(2)).
        leave.
    end.
end.

if icDocumentType   = "":U or
   icDocumentType   = ?    or
  (iiBankGLID       = 0    or
   iiBankGLID       = ?)   and
  (icBankGLCode     = "":U or
   icBankGLCode     = ?)
then do:
    assign ocGLCode        = trim(#T-2'Error':13(4593)T-2#)
           ocGLDescription = trim(subst(#T-4'The payment status is not defined for payment type &1, status &2 and bank account code &3.':250(17931)t-4#, vcDocumentType, {&DOCUMENTSTATUS-INCASSO-TR}, icBankGLCode))
           ocJournalCode   = trim(#T-5'Error':13(4593)T-5#).
           
    return.
end.

<Q-1 run CDocumentStatusByTypeStatusGL (all) (Read) (Cache)
          (input viCompanyId, (CompanyId)
           input icDocumentType, (CDocumentStatusDocumentType)
           input {&DOCUMENTSTATUS-INCASSO}, (CDocumentStatusStatus)
           input iiBankGLID, (BankGLId)
           input if iiBankGLID = 0 or iiBankGLID = ? then icBankGLCode else ?, (BankGLCode)
           output dataset tqCDocumentStatusByTypeStatusGL) in BCDocumentStatus >
                                        
find first tqCDocumentStatusByTypeStatusGL
           no-error.
           
if not available tqCDocumentStatusByTypeStatusGL
then do:
    <Q-10 run CDocumentStatusByTypeStatusGL (all) (Read) (NoCache)
       (input viCompanyId, (CompanyId)
        input icDocumentType, (CDocumentStatusDocumentType)
        input {&DOCUMENTSTATUS-PAID}, (CDocumentStatusStatus)
        input iiBankGLID, (BankGLId)
        input if iiBankGLID = 0 or iiBankGLID = ? then icBankGLCode else ?, (BankGLCode)
        output dataset tqCDocumentStatusByTypeStatusGL) in BCDocumentStatus >

    find first tqCDocumentStatusByTypeStatusGL
           no-error.

    if available tqCDocumentStatusByTypeStatusGL
    then assign olCreditDirectlyOnBank = true.
    else do:
        assign ocGLCode        = trim(#T-6'Error':13(4593)T-6#)
               ocGLDescription = trim(subst(#T-7'The payment status is not defined for payment type &1, status &2, and bank account &3.':250(63618)t-7#, vcDocumentType, {&DOCUMENTSTATUS-INCASSO-TR} + " or " + {&DOCUMENTSTATUS-PAID-TR}, icBankGLCode))
               ocJournalCode   = trim(#T-8'Error':13(4593)T-8#).
           
        return.
    end.
end.

assign ocGLCode        = tqCDocumentStatusByTypeStatusGL.tcGLCode
       ocGLDescription = tqCDocumentStatusByTypeStatusGL.tcGLDescription
       ocJournalCode   = tqCDocumentStatusByTypeStatusGL.tcJournalCode.