project QadFinancials > class BCInvoice > method DefaultValuesBankCreateCIBankPayCode1


Parameters


icCInvoiceBankRowidinputcharacter
iiBankNumberIdinputinteger
iiCInvoiceBankIdinputinteger
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BCInvoice.UpdateCInvoiceBankNumber


program code (program3/bcinvoice.p)

assign vlQBPC =false.
if iiCInvoiceBankId = ? or
   iiCInvoiceBankId = 0 or
   iiBankNumberId   = ? or
   iiBankNumberId   = 0
then return.

/* Delete all t_oCInvoiceBankPayCode associated with the specified CInvoiceBank so when the user */
/* changes the bank on the CInvoiceBank, the old CInvoiceBankPayCode gets deleted                */
for each tCInvoiceBankPayCode where
         tCInvoiceBankPayCode.tc_ParentRowid = icCInvoiceBankRowid:
    if tCInvoiceBankPayCode.tc_Status = "N":U
    then delete tCInvoiceBankPayCode.
    else assign tCInvoiceBankPayCode.tc_Status = "D":U.
end. /*for each tCInvoiceBankPayCode*/

if not vlQBPC
then do:
   /* <Q-4 run BankNumberPayCodeForCIDef  (Start) in BBankNumber > */
    assign vlQBPC = true.
end. /*if not vlQBPC*/

<Q-91 run BankNumberPayCodeForCIDef (all) (Read) (NoCache)
   (input iiBankNumberId, (BankNumberId)
    output dataset tqBankNumberPayCodeForCIDef) in BBankNumber>
    
for each tqBankNumberPayCodeForCIDef where
         tqBankNumberPayCodeForCIDef.tiBankNumber_ID = iiBankNumberId:
    
    <M-47 run AddDetailLine
       (input  'CInvoiceBankPayCode':U (icTable), 
        input  icCInvoiceBankRowid (icParentRowid), 
        output viFcReturnSuper (oiReturnStatus)) in BCInvoice>

    if viFcReturnSuper < 0 or
       oiReturnStatus  = 0
    then assign oiReturnStatus = viFcReturnSuper.

    if oiReturnStatus < 0
    then return.

    assign tCInvoiceBankPayCode.CInvoiceBank_ID             = iiCInvoiceBankId
           tCInvoiceBankPayCode.PayFormatGroup_ID           = tqBankNumberPayCodeForCIDef.tiPayFormatGroup_ID
           tCInvoiceBankPayCode.PayFormatCode_ID            = tqBankNumberPayCodeForCIDef.tiPayFormatCode_ID
           tCInvoiceBankPayCode.CInvoiceBankPayCodeValue    = (if tqBankNumberPayCodeForCIDef.tcBankNumberPayCodeValue <> ? and
                                                                  tqBankNumberPayCodeForCIDef.tcBankNumberPayCodeValue <> "":U
                                                               then tqBankNumberPayCodeForCIDef.tcBankNumberPayCodeValue
                                                               else tqBankNumberPayCodeForCIDef.tcPayFormatCode)
           tCInvoiceBankPayCode.tcPayFormatGroupCode        = tqBankNumberPayCodeForCIDef.tcPayFormatGroupCode
           tCInvoiceBankPayCode.tcPayFormatGroupDescription = tqBankNumberPayCodeForCIDef.tcPayFormatGroupDescription
           tCInvoiceBankPayCode.tlPayFormatGroupIsMandatory = tqBankNumberPayCodeForCIDef.tlPayFormatGroupIsMandatory
           tCInvoiceBankPayCode.tcPayFormatGroupInputOption = tqBankNumberPayCodeForCIDef.tcPayFormatGroupInputOption
           tCInvoiceBankPayCode.tcPayFormatGroupDataType    = tqBankNumberPayCodeForCIDef.tcPayFormatGroupDataType.
           
    if tCInvoiceBankPayCode.tcPayFormatGroupDataType = {&PAYFORMATGROUPDATATYPE-LOGICAL} and
              (tCInvoiceBankPayCode.CInvoiceBankPayCodeValue = ? or
               tCInvoiceBankPayCode.CInvoiceBankPayCodeValue = "":U)
    then assign tCInvoiceBankPayCode.CInvoiceBankPayCodeValue = "false":U.
    if vlQBPC
    then do:
        /* <Q-6 run BankNumberPayCodeForCIDef  (Stop) in BBankNumber > */
    end.        
end.