project QadFinancials > class BCashBox > method UpdateJournal

Description

Releases the old voucher and gets a new voucher for the new year/journal code.


Parameters


iiCompanyIdinputintegerCompany id
iiPostingIDinputinteger
iiNewPostingYearinputintegerNew Year
icNewJournalCodeinputcharacterNew Journal
oiNewVoucheroutputintegerNew Voucher
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program5/bcashbox.p)

MAIN_BLOCK:
do on error undo, leave:
    assign oiReturnStatus = -98
           viLocalReturn  = 0.
           
    if viBJournalEntryBEID = ? or
       viBJournalEntryBEID = 0 
    then leave MAIN_BLOCK.
    
    /* ================================================================= */
    /* Execute method in BJournalEntry component to supply new posting   */
    /* daybook                                                           */
    /* ================================================================= */
    if not valid-handle(vhBJournalEntryBEInst)
    then do:
        <I-24 {bFcOpenInstance
             &CLASS           = "BJournalEntry"}>
    end.

    <M-55 run UpdateYearJournal
       (input  iiPostingID (iiPostingID), 
        input  ? (icPostingRowId), 
        input  iiNewPostingYear (iiNewPostingYear), 
        input  icNewJournalCode (icNewJournalCode), 
        input  true (ilIsReleaseOriginalVoucher), 
        output oiNewVoucher (oiNewVoucherNumber), 
        output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
    if viFcReturnSuper < 0 or viFcReturnSuper > 0 and viLocalReturn = 0 then assign viLocalReturn = viFcReturnSuper.
    if viLocalReturn < 0 then leave MAIN_BLOCK.
end.  /* MAIN_BLOCK */

/* Close communication with openeed components */
if valid-handle(vhBJournalEntryBEInst)
then do:
    <I-56 {bFcCloseInstance
         &CLASS           = "BJournalEntry"}>
end.

/* Return values */
assign oiReturnStatus = viLocalReturn.