project QadFinancials > class BCInvoice > method DefaultValuesReverseInvoiceTypes

Description

This procedure populates list of applicable invoice types which can be used for creation of reversal invoice.


Parameters


icOriginalInvoiceTypeinputcharacter
ocReverseInvoiceTypesoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BCInvoice.DefaultValuesReverse
method BCInvoice.ReverseCInvoiceValidate


program code (program3/bcinvoice.p)

assign oiReturnStatus = -98.

/* =================================================================================================== */
/* Get list of valid invoice types which can be used for reverse operation                             */
/* =================================================================================================== */
/* Is there set-up for invoice correction */
assign vlGLCorrAP = false.
<Q-1 run GLCorrectionControlByDomain (all) (Read) (NoCache)
   (input vcDomainCode, (DomainCode)
    output dataset tqGLCorrectionControlByDomain) in BMFGGLCorrectionControl >
find first tqGLCorrectionControlByDomain where
           tqGLCorrectionControlByDomain.tcglcor_domain = vcDomainCode no-error.

if available tqGLCorrectionControlByDomain
then assign vlGLCorrAP = tqGLCorrectionControlByDomain.tlglcor_ap.

/* Create list of invoices types which can be used for reverse */
if icOriginalInvoiceType           = {&INVOICETYPE-INVOICE}
then assign ocReverseInvoiceTypes  = (if vlGLCorrAP
                                      then {&INVOICETYPE-INVOICECORRECTION-TR} + chr(2) + {&INVOICETYPE-INVOICECORRECTION} + chr(2)
                                      else "":U)
                                   + {&INVOICETYPE-CREDITNOTE-TR} + chr(2) + {&INVOICETYPE-CREDITNOTE}.

else if icOriginalInvoiceType      = {&INVOICETYPE-INVOICECORRECTION}
then assign ocReverseInvoiceTypes  = {&INVOICETYPE-INVOICE-TR} + chr(2) + {&INVOICETYPE-INVOICE}.

else if icOriginalInvoiceType      = {&INVOICETYPE-CREDITNOTE}
then assign ocReverseInvoiceTypes  = (if vlGLCorrAP
                                      then {&INVOICETYPE-CREDITNOTECORRECTION-TR} + chr(2) + {&INVOICETYPE-CREDITNOTECORRECTION} + chr(2)
                                      else "":U)
                                   + {&INVOICETYPE-INVOICE-TR} + chr(2) + {&INVOICETYPE-INVOICE}.

else if icOriginalInvoiceType      = {&INVOICETYPE-CREDITNOTECORRECTION}
then assign ocReverseInvoiceTypes  = {&INVOICETYPE-CREDITNOTE-TR} + chr(2) + {&INVOICETYPE-CREDITNOTE}.


/* Return */
if oiReturnStatus = -98 then assign oiReturnStatus = 0.