project QadFinancials > class BBankEntry > method LoadBEPosting

Description

load the BE Posting


Parameters


iiPostingIdinputintegerPosting ID
biBJournalEntryInstanceIDinput-outputintegerJournal Entry Instance ID
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program4/bbankentry.p)

if iiPostingId = ? then assign iiPostingId = 0.

if iiPostingId = 0
then do:
    assign vcMessage      = trim(#T-7'The system cannot find a bank entry posting record.':150(266)t-7#)
           oiReturnStatus = -1.
    <M-1 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-994':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
    return.
end.

assign viBJournalEntryBEID = biBJournalEntryInstanceID.
if viBJournalEntryBEID = 0  or 
   viBJournalEntryBEID = ?
then do :
    <I-2 {bFcStartAndOpenInstance
            &ADD-TO-TRANSACTION = "true"
            &CLASS              = "BJournalEntry"}>
    assign vlBJEIsStartedFromBE = true.
    assign biBJournalEntryInstanceID = viBJournalEntryBEID.
end.
else do :
    <I-5 {bFcOpenInstance
            &CLASS           = "BJournalEntry"}>
end.

/* start block */
BlockTransaction:
do:
  <M-6 run CheckIfPostingExistInInstance (input  iiPostingId (iiPostingId), 
                                        output vlPostingExists (olPostingExists), 
                                        output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
  if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
  then assign oiReturnStatus = viFcReturnSuper.
  if oiReturnStatus < 0 
  then leave BlockTransaction.

  if not vlPostingExists
  then do:
    <M-3 run DataLoad
          (input  '':U (icRowids), 
           input  string(iiPostingId) (icPkeys), 
           input  '':U (icObjectIds), 
           input  '' (icFreeform), 
           input  true (ilKeepPrevious), 
           output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
    if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
    then assign oiReturnStatus = viFcReturnSuper.
  end.
end.  /* end block */

<I-4 {bFcCloseInstance
            &CLASS           = "BJournalEntry"}>