project QadFinancials > class BJournalEntry > method UpdateJournalDateInPostingInstance

Description

update the journal and the period, year, posting date in the posting instance


Parameters


iiPostingIdinputintegerID of the posting
icNewJournalCodeinputcharacterNew Journal Code
oiPostingVoucheroutputintegerPosting Voucher
oiPostingYearoutputintegerPosting Year
oiPostingPeriodoutputintegerPosting Period
otPostingDateoutputdatePosting Date
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BCInvoice.UpdateJournalInPostingInstance


program code (program3/bjournalentry.p)

if iiPostingId = ? then assign iiPostingId = 0.
if icNewJournalCode = ? then assign icNewJournalCode = "":U.

if icNewJournalCode = "":U
then return.

find tPosting where
     tPosting.Posting_ID = iiPostingId and
     tPosting.tc_Status <> "D":U
     no-error.
if not available tPosting
then do:
    assign vcMessage      = trim(#T-4'Posting Record not found':255(69499)T-4#)
           oiReturnStatus = -3.
    <M-3 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-8123':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
    return.
end.

if viBPeriodPostingID = 0 or viBPeriodPostingID = ?
then do:
    <I-5 {bFcStartAndOpenInstance
         &ADD-TO-TRANSACTION = "true"
         &CLASS              = "BPeriod"}>
end.
else do:
     <I-6 {bFcOpenInstance
          &CLASS           = "BPeriod"}>
end.

<M-2 run GetDefaultPeriodDate
   (input  ? (iiYearIn), 
    input  ? (iiPeriodIn), 
    input  tPosting.PostingDate (itDateIn), 
    input  true (ilOpenForPurchase), 
    input  ? (ilOpenForSales), 
    input  ? (ilOpenForInventory), 
    output tPosting.PostingYear (oiYear), 
    output tPosting.PostingPeriod (oiPeriod), 
    output tPosting.PostingDate (otPostingDate), 
    output viFcReturnSuper (oiReturnStatus)) in BPeriod>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)        
then assign oiReturnStatus = viFcReturnSuper.

<I-7 {bFcCloseInstance
     &CLASS           = "BPeriod"}>
     
if oiReturnStatus < 0
then return.

assign tPosting.tc_Status  = (if tPosting.tc_Status = "":U
                              then 'C':U
                              else tPosting.tc_Status)
       tPosting.Journal_ID = ?.

/* ================================================================ */
/* Get new number of journal entry                                  */
/* ================================================================ */
<M-1 run GetPostingNumber
   (input  tPosting.tc_Rowid (ictcRowid), 
    input  tPosting.PostingYear (iiYear), 
    input  icNewJournalCode (icJournalCode), 
    output tPosting.PostingVoucher (oiVoucher), 
    output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>

if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper <  0 then return.

assign oiPostingVoucher  = tPosting.PostingVoucher
       oiPostingYear     = tPosting.PostingYear
       oiPostingPeriod   = tPosting.PostingPeriod
       otPostingDate     = tPosting.PostingDate.