project QadFinancials > class BPaymentSelection > method GetPaySelPayCode


Parameters


iiPaySel_IDinputinteger
icParentObjectRow_IDinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BPaymentSelection.ApiGetPaySelInfoForConfirm


program code (program3/bpaymentselection.p)

assign oiReturnStatus = -98.
empty temp-table tPaySelPayCodeRef.

if num-entries(icParentObjectRow_ID, ",":U) > 0 then
    assign vcParentObjRow_ID = entry(1, icParentObjectRow_ID).

<Q-53 run PaySelPayCodeByPaySelID (all) (Read) (NoCache)
   (input iiPaySel_ID, (PaySelID)
    input ?, (PayFormatGroupCode)
    output dataset tqPaySelPayCodeByPaySelID) in BPaymentSelection>

for each tqPaySelPayCodeByPaySelID where 
    tqPaySelPayCodeByPaySelID.tiPaySel_ID = iiPaySel_ID:

    create tPaySelPayCodeRef.
    assign tPaySelPayCodeRef.PaySelPayCode_ID   = tqPaySelPayCodeByPaySelID.tiPaySelPayCode_ID
           tPaySelPayCodeRef.PaySel_ID          = iiPaySel_ID
           tPaySelPayCodeRef.PayFormatGroup_ID  = tqPaySelPayCodeByPaySelID.tiPayFormatGroup_ID
           tPaySelPayCodeRef.PayFormatCode_ID   = tqPaySelPayCodeByPaySelID.tiPayFormatCode_ID
           tPaySelPayCodeRef.PaySelPayCodeValue = tqPaySelPayCodeByPaySelID.tcPaySelPayCodeValue
           tPaySelPayCodeRef.tc_Rowid           = entry(1, tqPaySelPayCodeByPaySelID.tc_rowid)
           tPaySelPayCodeRef.tc_ParentRowid     = vcParentObjRow_ID.

    <Q-51 run PayFormatGroupPrim (all) (Read) (NoCache)
       (input tqPaySelPayCodeByPaySelID.tiPayFormatGroup_ID, (PayFormatGroupID)
        input '':U, (PayFormatTypeCode)
        input ?, (PayFormatGroupSequence)
        output dataset tqPayFormatGroupPrim) in BPaymentFormat>

    for each tqPayFormatGroupPrim no-lock:
        assign tPaySelPayCodeRef.tcPayFormatGroupCode        = tqPayFormatGroupPrim.tcPayFormatGroupCode
               tPaySelPayCodeRef.tcPayFormatGroupDescription = tqPayFormatGroupPrim.tcPayFormatGroupDescription
               tPaySelPayCodeRef.tcPayFormatGroupInputOption = tqPayFormatGroupPrim.tcPayFormatGroupInputOption
               tPaySelPayCodeRef.tlPayFormatGroupIsMandatory = tqPayFormatGroupPrim.tlPayFormatGroupIsMandatory
               tPaySelPayCodeRef.tcPayFormatGroupDataType    = tqPayFormatGroupPrim.tcPayFormatGroupDataType
               tPaySelPayCodeRef.tiPayFormatGroupSequence    = tqPayFormatGroupPrim.tiPayFormatGroupSequence.
    end.

    if tPaySelPayCodeRef.PayFormatCode_ID <> ? and tPaySelPayCodeRef.PayFormatCode_ID <> 0 then 
    do:
        <Q-21 run PayFormatCodePrim (all) (Read) (NoCache)
           (input tPaySelPayCodeRef.PayFormatCode_ID, (PayFormatCodeID)
            input '', (PayFormatCode)
            output dataset tqPayFormatCodePrim) in BPaymentFormat>

        for each tqPayFormatCodePrim no-lock:
            assign tPaySelPayCodeRef.tcPayFormatCode = tqPayFormatCodePrim.tcPayFormatCode
                   tPaySelPayCodeRef.tcPayFormatCodeDescription = tqPayFormatCodePrim.tcPayFormatCodeDescription.
                   /*tPaySelPayCode.tcPayFormatCodeValue = tqPayFormatCodePrim.tcPayFormatCode.*/
        end.
    end.
    /*else if (tPaySelPayCode.PayFormatCode_ID = 0 or tPaySelPayCode.PayFormatCode_ID = ?) then do:*/
        assign tPaySelPayCodeRef.tcPayFormatCodeValue = tPaySelPayCodeRef.PaySelPayCodeValue.
    /*end.*/
    /*FIN-3198:
            This method is called when the information of an exsiting payment selection is to be presented on the UI. 
            1."tPaySelPayCode.PaySelPayCodeValue" keeps the value of a corresponding field when the payment selection is last saved;
            2."tPaySelPayCode.tcPayFormatCodeValue" holds the value which is to be presented on the UI and bound to a corresponding tag;
            3.So whatever the value of "tPaySelPayCode.PayFormatCode_ID" is, "tPaySelPayCode.tcPayFormatCodeValue" always has to be set to
                "tPaySelPayCode.PaySelPayCodeValue". */     
                                                             
end.

assign oiReturnStatus = 0.