project QadFinancials > class BPaymentSelection > method AdditionalUpdatesRegister1

Description

Extended method of AdditionalUpdatesRegister cause the origianl method exceed the limitation of length


Parameters


itCDocumentDueDateinputdate
icPaymentInstrumentinputcharacter
ilCDocCreatedinputlogical
biCDocSeqinput-outputinteger
ilCreateCDocumentPaySelinputlogical
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BPaymentSelection.AdditionalUpdatesRegister


program code (program5/bpaymentselection.p)

for first tMatchingInvoices 
    where tMatchingInvoices.tiPaySelLineID = tPaySelLine.PaySelLine_ID:    
    assign viMatchInvoiceGroupSeq = tMatchingInvoices.tiGroupSeq.
end.

find first tCDocumentPaySel where
                tCDocumentPaySel.CDocumentDueDate = tPaySelLine.ttDueDate and
                tCDocumentPaySel.tcCreditorCode   = tPaySelLine.tcCreditorCode and
                tCDocumentPaySel.tcCurrencyCode   = tPaySelLine.tcInvoiceCurrencyCode and
                tCDocumentPaySel.tiGroupSeq       = viMatchInvoiceGroupSeq
                no-error.

if ilCDocCreated = no           OR
   ilCreateCDocumentPaySel      OR
  (ilCDocCreated = yes and 
   not available tCDocumentPaySel)
then do:
    create tCDocumentPaySel.
    assign biCDocSeq                              = biCDocSeq + 1
           tCDocumentPaySel.CCollection_ID        = 0
           tCDocumentPaySel.CDocumentCreationDate = today
           tCDocumentPaySel.CDocumentDueDate      = if tPaySelLine.ttDiscountDueDate = ? or
                                                       tPaySelLine.PaySelLineDiscountTC = ? or
                                                       tPaySelLine.PaySelLineDiscountTC = 0
                                                    then max(itCDocumentDueDate, tPaySelLine.ttDueDate)
                                                    else max(itCDocumentDueDate, tPaySelLine.ttDiscountDueDate)
           tCDocumentPaySel.CDocumentNumber       = 0
           tCDocumentPaySel.CDocumentReference    = "":U
           tCDocumentPaySel.CDocumentStatus       = if tPaySel.tlCreditDirectlyOnBank then {&DOCUMENTSTATUS-PAID}
                                                    else {&DOCUMENTSTATUS-INCASSO}
           tCDocumentPaySel.CDocumentSubType      = (if icPaymentInstrument = {&PAYFORMATPAYINSTRUMENT-ELECTRONIC} 
                                                    then {&DOCUMENTSUBTYPE-AUTO} 
                                                    else {&DOCUMENTSUBTYPE-MAN})
           tCDocumentPaySel.CDocumentType         = icPaymentInstrument
           tCDocumentPaySel.CDocumentYear         = year(today)
           tCDocumentPaySel.CDocument_ID          = 0
           tCDocumentPaySel.Company_ID            = tPaySel.Company_ID
           tCDocumentPaySel.PaySel_ID             = tPaySel.PaySel_ID
           tCDocumentPaySel.tcCreditorCode        = tPaySelLine.tcCreditorCode
           tCDocumentPaySel.tcCurrencyCode        = tPaySelLine.tcInvoiceCurrencyCode
           tCDocumentPaySel.tcGLCode              = tPaySel.tcGLCode
           tCDocumentPaySel.tcPaySelCode          = tPaySel.PaySelCode
           tCDocumentPaySel.tc_Rowid              = string(biCDocSeq)
           tCDocumentPaySel.tc_Status             = "N":U
           tCDocumentPaySel.ttPostingDate         = if tPaySel.ttPostingDate = ?
                                                    then tPaySel.PaySelDate
                                                    else tPaySel.ttPostingDate
           tCDocumentPaySel.BankNumber_ID         = tPaySelLine.BankNumber_ID
           tCDocumentPaySel.tiGroupSeq            = viMatchInvoiceGroupSeq.
end.