project QadFinancials > class BDPaymentSelection > method CheckTargetPaymentSelection

Description

Check that the details of the Target Payment Selections (for moving canceled lines to). Status, bank details etc.


Parameters


iiCurrentGLIDinputinteger
iiCurrentBankPayFormatIDinputinteger
iiTargetPaySelIDinputinteger
icCurrentDPaySelCodeinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDPaymentSelection.StoreSelectedObjects


program code (program1/bdpaymentselection.p)

/****************************************************************************/
find first tDPaySel where tDPaySel.DPaySel_ID = iiTargetPaySelID no-error.
if available tDPaySel
then do:
    /* make sure it is not the same as the original */
    if tDPaySel.DPaySelCode = icCurrentDPaySelCode
    then do:
        assign 
            oiReturnStatus = -1                                          
            vcMessage      = trim(substitute(#T-34'Cannot move lines to a Payment Selection with the same code.':150(968772541)T-34#, 
                                        tDPaySel.DPaySelCode)).
            <M-71 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tDPaySel.DPaySelCode':U (icFieldName), 
                input  tDPaySel.DPaySelCode (icFieldValue), 
                input  'E':u (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-724471':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BDPaymentSelection>            
        return.                           
    end. /*if  tDPaySel.tlPaySelIsExecuted */
    /* make sure it is not executed */
    if tDPaySel.tlPaySelIsExecuted
    then do:
        assign 
            oiReturnStatus = -1                                          
            vcMessage      = trim(substitute(#T-5'Cannot move lines to a Payment Selection (&1) which has been executed.':150(797962667)T-5#, 
                                        tDPaySel.DPaySelCode)).
            <M-38 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':u (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-920210':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BDPaymentSelection>            
        return.                           
    end. /*if  tDPaySel.tlPaySelIsExecuted */
    /* check that the gl and bankpay format are the same */
    if not (tDPaySel.GL_ID = iiCurrentGLID and tDPaySel.BankPayFormat_ID = iiCurrentBankPayFormatID)
    then do:
        assign 
            oiReturnStatus = -1                                          
            vcMessage      = trim(#T-88'Can only move lines to a Payment Selection which has the same bank details.':150(651072782)T-88#). 
             <M-28 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':u (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-399399':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BDPaymentSelection>            
        return.                       
    end. /* if tDPaySel.GL_ID */               
    /* check that the status is initial */
    if tDPaySel.DPaySelStatus <> {&DOCUMENTSTATUS-INIT}
    then do:
        assign 
            oiReturnStatus = -1                                          
            vcMessage      = trim(#T-82'The Target Payment Selection has to be of status initial':150(64473256)T-82#).
                                  
            <M-70 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':u (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-675675':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BDPaymentSelection>            
        return.                       
    end. /* if tDPaySel.GL_ID */ 
end. /* if available */