project QadFinancials > class BPaymentSelection > method FillProDataSetCCollection


Parameters


iiPaySel_IDinputinteger
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BPaymentSelection.FillProDataSet


program code (program7/bpaymentselection.p)

/* ============================================= */
/* Fill the CCollection Temp table in prodataset
   step1. Start All the Queries which will be used in the procedure.
   step2. Run the Query to get the records of the target table by supplying the ID parameter.
   step3. Validate whether the query return the expect records,if yes then continue else return.
   step4. Buffercopy the query result to the target temp table.
   step5. (optional) Do some calculation work. 
   step6. Stop All the queries which used in the procedure */
/* ============================================= */
if oiReturnStatus = 0 
then assign oiReturnStatus = -98.      
<Q-10 run CCollectionByIDAllInfo
   (Start) in BCCollection >
for each tPaySel where tPaySel.PaySel_ID = iiPaySel_ID:
for each tPaymentPaySel no-lock:
    <Q-2 run CCollectionByIDAllInfo (all) (Read) (NoCache)
       (input tPaySel.Company_ID, (CompanyId)
        input tPaymentPaySel.tiPaySelCCollection_ID, (CCollection_Id)
        output dataset tqCCollectionByIDAllInfo) in BCCollection >
    find first tqCCollectionByIDAllInfo no-error.
    if not available tqCCollectionByIDAllInfo 
    then do:
    <M-7 run SetMessage
       (input  #T-8'No selection record is available.':50(999890591)T-8# (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'D':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'QadFin-5333':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
     assign
         oiReturnStatus = -1.
     return.
    end. /* end of if not available */
    else do:
        assign
             vhBufferForProDataSet = dataset tqCCollectionByIDAllInfo:get-buffer-handle(1).
  /* Fill data to buffer of temp table handle vhCCollection */
        for each tqCCollectionByIDAllInfo no-lock:
          find first tPaySelCCollection where tPaySelCCollection.CCollection_ID = tqCCollectionByIDAllInfo.tiCCollection_ID no-error.
          if not available tPaySelCCollection
          then do: /* avoid duplicate key issue */
            create tPaySelCCollection.
            <M-5 run BufferCopy
               (input  vhBufferForProDataSet (ihFrom), 
                input  buffer tPaySelCCollection:handle (ihTo), 
                output oiReturnStatus (oiReturnStatus)) in BPaymentSelection>
           end. /* avoid duplicate key issue */                
        end. /* for each tqCCollectionAllInfo */
    end. /* end of else do */
     

end. /* for each tPaymentPaySel */
end. /* for each tPaySel */
<Q-9 run CCollectionByIDAllInfo
   (Stop) in BCCollection >
   
/* ========================= */
/* Set default return status */
/* ========================= */
if oiReturnStatus = -98 
then assign oiReturnstatus = 0.