project QadFinancials > class BJournalEntry > method CreateEntriesPostingTemplate
Description
This method is primarily designed to work as an envelope method for the CreateFDSEntryPostingTemplate. It can process a set of requested entries.
Parameters
Internal usage
QadFinancials
program code (program6/bjournalentry.p)
/* check if any proposed postings was passed to this procedure */
find first t_sProposedEntry no-error.
if not available t_sProposedEntry
then do:
<M-4 run SetMessage
(input #T-5'No journal entry will be created.':100(14841)T-5# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-3479':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
assign oiReturnStatus = -1.
return.
end.
for each t_sProposedEntry,
each t_sProposedEntryLine where
t_sProposedEntryLine.tc_ParentRowid = t_sProposedEntry.tc_Rowid
break by t_sProposedEntryLine.tc_ParentRowid:
/* ============================================== */
/* Create posting header */
/* ============================================== */
if first-of(t_sProposedEntryLine.tc_ParentRowid)
then do:
<M-3 run AddDetailLine (input 'Posting':U (icTable),
input '':U (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
assign vcPostingRowid = tPosting.tc_Rowid
tPosting.Period_ID = ?
tPosting.PostingYear = t_sProposedEntry.tiPeriodYear
tPosting.PostingPeriod = t_sProposedEntry.tiPeriodPeriod
tPosting.tcJournalCode = t_sProposedEntry.tcJournalCode
tPosting.PeriodMark_ID = ?
tPosting.PostingDate = t_sProposedEntry.ttPostingDate
tPosting.PostingValueDate = t_sProposedEntry.ttPostingDate
tPosting.PostingText = t_sProposedEntry.tcPostingText
tPosting.PostingVoucher = 0
tPosting.tcTemplateCode = '':U.
<M-6 run GetPostingNumber (input tPosting.tc_Rowid (ictcRowid),
input tPosting.PostingYear (iiYear),
input tPosting.tcJournalCode (icJournalCode),
output viFcCount1 (oiVoucher),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
/* store reference to created posting */
assign t_sProposedEntry.tcPostingReference = string(tPosting.PostingYear) + '/':U +
tPosting.tcJournalCode + '/':U +
string(tPosting.PostingVoucher)
t_sProposedEntry.tiPosting_ID = tPosting.Posting_ID.
end.
/* ============================================== */
/* Create posting lines from posting templates */
/* ============================================== */
<M-2 run LoadTemplate
(input 0 (iiCompanyId),
input t_sProposedEntryLine.tcPostingTemplateCode (icTemplateCode),
input t_sProposedEntry.tcPostingText (icPostingText),
input t_sProposedEntryLine.tcPostingLineText (icPostingLineText),
input false (ilClearAll),
input t_sProposedEntry.tcCurrencyCode (icCurrencyCode),
input t_sProposedEntryLine.tdAmountTC (idAmountTC),
input t_sProposedEntryLine.tdAmountCC (idAmountCC),
input ? (idExchangeRate),
input t_sProposedEntryLine.tdQuantity (idQuantity),
input t_sProposedEntryLine.tcDivisionCode (icDivision),
input t_sProposedEntryLine.tcProjectCode (icProject),
input t_sProposedEntryLine.tcCostCentre (icCostCentre),
input t_sProposedEntryLine.tcSafConceptCode (icSafConceptCode),
input t_sProposedEntryLine.tcSafCode (icSafCode),
input if first-of(t_sProposedEntryLine.tc_ParentRowid) then false else true (ilAppend),
input true (ilSkipGLIsAutomaticAccount),
input true (ilReplAnalInfoOnLastLineOnly),
input vcPostingRowid (icPostingRowid),
input t_sProposedEntry.ttPostingDate (itPostingDate),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
end.