project QadFinancials > class BJournalEntry > method CreateReverseEntryGetDefaults
Description
CreateReverseEntryGetDefaults; this method can be called to get the defaults when starting the Form for the Reversing Entries
Parameters
icPostingTcRowid | input | character | PostingTcRowid; rowid of the already loaded instance wherefor a new, reversing entry is required. |
oiNewPeriodYear | output | integer | NewPeriodYear; Year of the reverse entry |
oiNewPeriodPeriod | output | integer | NewPeriodPeriod; Period of the reverse entry |
ocNewJournalCode | output | character | NewJournalCode; JournalCode of the reverse entry |
otNewPostingDate | output | date | NewPostingDate; posting-date of the reverse posting |
ocNewPostingText | output | character | NewPostingText; posting-text of the reverse posting |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program9/bjournalentry.p)
/* =================================================== */
/* validate input paramaters */
/* =================================================== */
if icPostingTcRowid = "":U
then do :
assign vcMsgJE = trim(#T-7'You must enter the ID of the original journal entry in order to reverse it.':255(2761)t-7#)
oiReturnStatus = -1.
<M-1 run SetMessage (input vcMsgJE (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icPostingTcRowid (icRowid),
input 'QADFIN-888':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
Return.
end. /* if icPostingTcRowid = "":U or */
find tPosting where
tPosting.tc_Rowid = icPostingTcRowid
no-error.
if not available tPosting
then do :
assign vcMsgJE = trim(substitute(#T-8'Internal error: cannot find the originating journal entry based on its row ID &1.':255(2742)t-8#,icPostingTcRowid))
oiReturnStatus = -1.
<M-2 run SetMessage (input vcMsgJE (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'S':U (icType),
input 3 (iiSeverity),
input icPostingTcRowid (icRowid),
input 'QADFIN-889':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
Return.
end. /* if not available tPosting */
/* ======================================================== */
/* PostingDate = End-date of the current period + 1 day */
/* Period = period of the new posting-date */
/* Journal = Journal of the originating posting */
/* PostingText = PostingText of the originating posting */
/* ======================================================== */
assign ocNewJournalCode = tPosting.tcJournalCode
ocNewPostingText = tPosting.PostingText.
<Q-5 run PeriodByYearPeriod (all) (Read) (NoCache)
(input tPosting.Company_ID, (CompanyId)
input tPosting.PostingYear, (PeriodYear)
input tPosting.PostingPeriod, (PeriodPeriod)
input ?, (PeriodId)
output dataset tqPeriodByYearPeriod) in BPeriod >
find first tqPeriodByYearPeriod no-lock no-error.
if not available tqPeriodByYearPeriod
then return.
assign otNewPostingDate = tqPeriodByYearPeriod.ttPeriodEndDate + 1.
/*ca664237*/
/* Defaulting of the Accounting Period is done through UI call of the method APIGetDefaultPeriodDate on BPosting. */
<Q-6 run PeriodByStartEndDate (all) (Read) (NoCache)
(input tPosting.Company_ID, (CompanyId)
input otNewPostingDate, (Date)
output dataset tqPeriodByStartEndDate) in BPeriod >
find first tqPeriodByStartEndDate no-error.
if not available tqPeriodByStartEndDate or
not tqPeriodByStartEndDate.tlPeriodIsPostingGLAllowed
then do:
assign vcMsgJE = trim(#T-11'The period in which reverse journal entry is normally done is not yet created or it is locked. Therefore defaulted posting period is the same as posting period of original journal entry.':255(71430)T-11#).
<M-9 run SetMessage
(input vcMsgJE (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'W' (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-8701':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':u (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
assign otNewPostingDate = tqPeriodByYearPeriod.ttPeriodEndDate
oiNewPeriodYear = tPosting.PostingYear
oiNewPeriodPeriod = tPosting.PostingPeriod
oiReturnStatus = 1.
return.
end.
assign oiNewPeriodYear = tqPeriodByStartEndDate.tiPeriodYear
oiNewPeriodPeriod = tqPeriodByStartEndDate.tiPeriodPeriod.