project QadFinancials > class BPosting > method ValidateComponentPost
Description
Validation methods that need to be run after Ancestor tag
Parameters
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bposting.p)
/* IMPORTANT: This method is defined as Private & is not shown in descendant classes */
/* ================== */
/* Exception handling */
/* ================== */
assign oiReturnStatus = -98
viLocalReturnStatus = 0
vlQueryStartedJournalByJournal = false
vlQueryStartedGLByID = false
vlQueryStartedProjectById = false
vlQueryStartedCostCentreByID = false
vlQueryStartedPostingTemplate = false
vlQueryStartedPeriodByID = false
vlQueryStartedGLByPosting = false
vlQueryStartedGLOpenItemByAll = false
vlQueryStartedSafConceptByCode = false
vlQueryStartedSafStructureLine = false
vlQueryStartedCompanyPrim = false
vlQueryStartedGLByCyBR = false
vlQueryStartedCompanyProperty = false
vlQueryStartedCompPropByCode = false
vlQueryStartedGLForPostingLine = false
vlQueryStartedGetCostCentre = false
vlQueryStartedGetProject = false
vlClassStartedAndOpenedBCOAMask = false
.
POSTINGBLOCK:
for each t_sPosting
break by t_sPosting.Journal_ID:
/* ====================================================================================== */
/* Check if WHT is enable in current domain */
/* ====================================================================================== */
<M-83 run CheckIsDomainWithWHT
(input t_sPosting.Company_ID (iiCompanyID),
output vlIsDomainWithWHT (olIsDomainWithWHT),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
/* ================================================== */
/* Check if the user can use this daybook */
/* ================================================== */
if first-of (t_sPosting.Journal_ID)
then do :
<M-94 run ValidateComponentPostJournalRole (output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0
then assign viLocalReturnStatus = viFcReturnSuper.
end. /* first-of (t_sPosting.Journal_ID */
/* ================================================================= */
/* Check that the daybook is not part of a daybook mask */
/* ================================================================= */
if t_sPosting.tc_Status = "N":U or
t_sPosting.tc_Status = "C":U or
t_sPosting.tc_Status = "D":U
then do:
<M-102 run ValidateComponentPostPeriodJournalClosed (output viFcReturnSuper (oiReturnStatus)) in BPosting>
end.
if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0
then assign viLocalReturnStatus = viFcReturnSuper.
if viLocalReturnStatus < 0
then leave POSTINGBLOCK.
if vlPostingMustBeBalanced
then assign vdBalanceLC = 0
vdBalanceTC = 0
vdBalanceCC = 0
viCurrencyID = 0.
/* ================================================== */
/* Only transient postings can be deleted or modified */
/* ================================================== */
if t_sPosting.tc_Status <> "N":U and
(t_sPosting.tcLayerTypeCode <> {&LAYERTYPECODE-TRANSIENT} or
can-find (first t_iPosting where
t_iPosting.tc_Rowid = t_sPosting.tc_Rowid and
t_iPosting.tcLayerTypeCode <> {&LAYERTYPECODE-TRANSIENT}))
then do:
<M-3 run ValidateComponentPostCheckLayer (output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0
then assign viLocalReturnStatus = viFcReturnSuper.
if viLocalReturnStatus < 0
then leave POSTINGBLOCK.
end.
if vcActivityCode = "JournalEntryExcelIntegrationRepair" or
vcActivityCode = "ExcelIntegration"
then do:
assign vcMsgExplanation = <M-87 GetErrorExplanation
(input t_sPosting.tc_Rowid (icPostingRowId),
input ? (icPostingLineRowId),
output viFcReturnSuper (oiReturnStatus)) in BPosting>.
if t_sPosting.tcJournalTypeCode <> {&JOURNALTYPE-JOURNALENTRY} and
t_sPosting.tcJournalTypeCode <> {&JOURNALTYPE-YEARLYCLOSING}
then do:
<M-96 run SetMessage
(input trim(#T-59'Daybook Type should be Journal Entry':250(461288319)T-59#) + '/' + #T-81'Year-End Closing':40(4480)T-81# (icMessage),
input vcActivityCode (icArguments),
input 't_sPosting.tcJournalTypeCode':U (icFieldName),
input t_sPosting.tcJournalTypeCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sPosting.tc_Rowid (icRowid),
input 'qadfin-176402':U (icFcMsgNumber),
input vcMsgExplanation (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
assign viLocalReturnStatus = -1.
leave POSTINGBLOCK.
end. /* IF t_sPosting.tcJournalTypeCode <> {&JOURNALTYPE-JOURNALENTRY} then do */
end. /* IF vcActivityCode = "JournalEntryTransExcelIntegration" ... */
/* ===================================================================================================================== */
/* Reset flag that indicates if GLMasks need to be checked for a certain company or not - this is reset for each posting */
/* ===================================================================================================================== */
assign vlCheckCOAMaskForThisPosting = ?.
/*
* Validate the reporting journal code
*/
if t_sPosting.tc_Status = "N":U and
t_sPosting.tcReportingJournalCode <> "" and
t_sPosting.tcReportingJournalCode <> ? and
t_sPosting.tcReportingJournalCode <> t_sPosting.tcJournalCode
then do:
assign vcMsgExplanation = <M-61 GetErrorExplanation
(input t_sPosting.tc_Rowid (icPostingRowId),
input ? (icPostingLineRowId),
output viFcReturnSuper (oiReturnStatus)) in BPosting>.
assign vcMessage = substitute(#T-34'Reporting Daybook &1 must have the same value as Posting Daybook &2 (&3/&4/&5)':255(842139043)T-34#, t_sPosting.tcReportingJournalCode, t_sPosting.tcJournalCode, string(t_sPosting.PostingYear), string(t_sPosting.postingperiod), string(t_sPosting.postingvoucher))
viLocalReturnStatus = -1.
<M-35 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tPosting.tcReportingJournalCode':U (icFieldName),
input tPosting.tcReportingJournalCode (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input t_sPosting.tc_rowid (icRowid),
input 'QadFin-9322':U (icFcMsgNumber),
input vcMsgExplanation (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
end.
else
if t_sPosting.tc_Status = "C":U
then do:
for first t_iPosting
where t_iPosting.tc_rowid = t_sPosting.tc_rowid:
if t_sPosting.tcReportingJournalCode <> t_iPosting.tcReportingJournalCode
then do:
/* Reporting journal daybook has changed so we need to validate */
<Q-57 run JournalByJournalLayerType (all) (Read) (Cache)
(input t_sPosting.ReportingJournal_ID, (JournalId)
input ?, (JournalCode)
input ?, (CompanyId)
input ?, (LayerTypeCode)
output dataset tqJournalByJournalLayerType) in BJournal>
Find first tqJournalByJournalLayerType where
tqJournalByJournalLayerType.tiJournal_ID = t_sPosting.ReportingJournal_ID
no-error.
if (not available tqJournalByJournalLayerType) or
(tqJournalByJournalLayerType.tlJournalIsActive = false)
then do:
assign vcMsgExplanation = <M-93 GetErrorExplanation
(input t_sPosting.tc_Rowid (icPostingRowId),
input ? (icPostingLineRowId),
output viFcReturnSuper (oiReturnStatus)) in BPosting>.
assign vcMessage = #T-43'Reporting Daybook $1 must be a valid active Daybook (Posting $2/$3/$4)':255(999890787)T-43#
oiReturnStatus = -1.
<M-41 run SetMessage
(input vcMessage (icMessage),
input t_sPosting.tcReportingJournalCode + chr(2) + string(t_sPosting.PostingYear) + chr(2) + string(t_sPosting.postingperiod) + chr(2) + string(t_sPosting.postingvoucher) (icArguments),
input 'tPosting.tcReportingJournalCode':U (icFieldName),
input t_sPosting.tcReportingJournalCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sPosting.tc_Rowid (icRowid),
input 'QadFin-9329':U (icFcMsgNumber),
input vcMsgExplanation (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
leave POSTINGBLOCK.
end.
else if tqJournalByJournalLayerType.tcJournalTypeCode <> t_sPosting.tcJournalTypeCode
then do:
assign vcMsgExplanation = <M-7 GetErrorExplanation
(input t_sPosting.tc_Rowid (icPostingRowId),
input ? (icPostingLineRowId),
output viFcReturnSuper (oiReturnStatus)) in BPosting>.
assign vcMessage = #T-44'Reporting Daybook $1 must have the same Daybook Type as the Posting Daybook $2 (Posting $3/$4/$5)':255(999890788)T-44#
oiReturnStatus = -1.
<M-42 run SetMessage
(input vcMessage (icMessage),
input t_sPosting.tcReportingJournalCode + chr(2) + t_sPosting.tcJournalCode + chr(2) + string(t_sPosting.PostingYear) + chr(2) + string(t_sPosting.postingperiod) + chr(2) + string(t_sPosting.postingvoucher) (icArguments),
input 'tPosting.tcReportingJournalCode':U (icFieldName),
input t_sPosting.tcReportingJournalCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sPosting.tc_Rowid (icRowid),
input 'QadFin-9330':U (icFcMsgNumber),
input vcMsgExplanation (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
leave POSTINGBLOCK.
end.
end. /* t_sPosting.tcReportingJournalCode <> t_iPosting.tcReportingJournalCode */
end. /* end for first t_iPosting */
end. /* if t_sPosting.tc_Status = "C":U */
/* ====================== */
/* Validations on Posting */
/* ====================== */
if t_sPosting.tc_Status <> "D":U
then do:
/* Check if posting is YearClosing Posting */
assign vlPostingIsYearClosing = false.
if t_sPosting.tcJournalTypeCode = {&JOURNALTYPE-YEARLYCLOSING}
then do:
if vlQueryStartedPeriodByID <> true
then do:
<Q-89 run PeriodByID (Start) in BPeriod>
assign vlQueryStartedPeriodByID = true.
end. /* if vlQueryStartedPeriodByID <> true */
<Q-31 run PeriodByID (all) (Read) (NoCache)
(input t_sPosting.Company_ID, (CompanyId)
input t_sPosting.Period_ID, (PeriodID)
output dataset tqPeriodByID) in BPeriod>
find tqPeriodByID where
tqPeriodByID.tiCompany_ID = t_sPosting.Company_ID and
tqPeriodByID.tiPeriod_ID = t_sPosting.Period_ID
no-error.
if available tqPeriodByID and
tqPeriodByID.tcPeriodTypeCode = {&PERIODTYPECODE-YEARCLOSING}
then assign vlPostingIsYearClosing = true.
if not available tqPeriodByID
then do:
if viBPeriodPostingID <> 0 and viBPeriodPostingID <> ?
then do:
<I-28 {bFcOpenInstance
&CLASS = "BPeriod"}>
<M-29 run CheckPeriodExistence
(input t_sPosting.Company_ID (iiCompanyId),
input t_sPosting.PostingYear (iiPeriodYear),
input t_sPosting.PostingPeriod (iiPeriodPeriod),
output vlPeriodExists (olDoesExist),
output viPeriodID (oiPeriod_ID),
output viPeriodMarkID (oiPeriodMark_ID),
output vtStartDate (otStartDate),
output vtEndDate (otEndDate),
output vcPeriodTypeCode (ocPeriodTypeCode),
output viFcReturnSuper (oiReturnStatus)) in BPeriod>
if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0
then assign viLocalReturnStatus = viFcReturnSuper.
if vlPeriodExists = true and
vcPeriodTypeCode = {&PERIODTYPECODE-YEARCLOSING}
then assign vlPostingIsYearClosing = true.
<I-32 {bFcCloseInstance
&CLASS = "BPeriod"}>
end. /* if viBPeriodPostingID <> 0 and viBPeriodPostingID <> ? */
end. /* if not availalbe tqPeriodByID */
end. /* if t_sPosting.tcJournalTypeCode = {&JOURNALTYPE-YEARLYCLOSING} */
/* set GL mask flag based on whether the posting is yeaer closing one */
if vlPostingIsYearClosing = true
then assign vlCheckCOAMaskForThisPosting = false.
<M-5 run ValidateComponentPostPosting1
(input-output vlQueryStartedCompPropByCode (blQueryStartedCompPropByCode),
input-output vlQueryStartedCompanyPrim (blQueryStartedCompanyPrim),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0
then assign viLocalReturnStatus = viFcReturnSuper.
<M-12 run ValidateComponentPostPosting2
(input-output vlQueryStartedPostingTemplate (blQueryStartedPostingTemplate),
input-output vlQueryStartedPeriodByID (blQueryStartedPeriodById),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0
then assign viLocalReturnStatus = viFcReturnSuper.
end. /* if t_sPosting.tc_Status <> "D":U */
POSTINGLINEBLOCK:
for each t_sPostingLine where
t_sPostingLine.tc_ParentRowid = t_sPosting.tc_Rowid:
/* ================== */
/* Calculate balances */
/* ================== */
if t_sPostingLine.tc_Status <> "D":U and
vlPostingMustBeBalanced = true
then assign vdBalanceLC = vdBalanceLC + t_sPostingLine.PostingLineDebitLC - t_sPostingLine.PostingLineCreditLC
vdBalanceTC = vdBalanceTC + t_sPostingLine.PostingLineDebitTC - t_sPostingLine.PostingLineCreditTC
vdBalanceCC = vdBalanceCC + t_sPostingLine.PostingLineDebitCC - t_sPostingLine.PostingLineCreditCC
viCurrencyID = (if viCurrencyID = 0 or
viCurrencyID = t_sPostingLine.Currency_ID
then t_sPostingLine.Currency_ID
else ?).
/* ========================== */
/* Validation on PostingLines */
/* ========================== */
<M-13 run ValidateComponentPostPostingLine1
(input-output vlQueryStartedGLByID (blQueryStartedGLByID),
input-output vlQueryStartedProjectById (blQueryStartedProjectById),
input-output vlQueryStartedCostCentreByID (blQueryStartedCostCentreByID),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0
then assign viLocalReturnStatus = viFcReturnSuper.
<M-14 run ValidateComponentPostPostingLine2
(input-output vlQueryStartedGLByPosting (blQueryStartedGLByPosting),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0
then assign viLocalReturnStatus = viFcReturnSuper.
<M-27 run ValidateComponentPostPostingLine3
(input vlPostingIsYearClosing (ilPostingIsYearClosing),
input-output vlQueryStartedGLForPostingLine (blQueryStartedGLForPostingLine),
input-output vlQueryStartedGetCostCentre (blQueryStartedGetCostCentre),
input-output vlQueryStartedGetProject (blQueryStartedGetProject),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0
then assign viLocalReturnStatus = viFcReturnSuper.
/* ================================================================================= */
/* skip coa validations when daybook is of period costing and skipcoavalforPC = true */
/* ================================================================================= */
if t_sPosting.tcJournalTypeCode = {&JOURNALTYPE-PERIODICCOSTING} and
t_sPostingLine.tlSkipCOAValForPeriodCosting = true
then assign vlCheckCOAMaskForThisPosting = false.
<M-26 run ValidateComponentPostPostingLine4
(input-output vlQueryStartedGLOpenItemByAll (blQueryStartedGLOpenItemByAll),
input-output vlClassStartedAndOpenedBCOAMask (blClassStartedAndOpenedBCOAMask),
input-output vlCheckCOAMaskForThisPosting (blCheckCOAMaskForThisPosting),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0
then assign viLocalReturnStatus = viFcReturnSuper.
<M-17 run ValidateComponentPostRounding (output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0
then assign viLocalReturnStatus = viFcReturnSuper.
POSTINGSAFBLOCK: DO :
/* ================================================================================= */
/* skip coa validations when daybook is of period costing and skipcoavalforPC = true */
/* ================================================================================= */
if t_sPosting.tcJournalTypeCode = {&JOURNALTYPE-PERIODICCOSTING} and
t_sPostingLine.tlSkipCOAValForPeriodCosting = true
then leave POSTINGSAFBLOCK.
assign vcPostingSafParentType = "":U.
for each t_sPostingSaf where
t_sPostingSaf.tc_ParentRowid = t_sPostingLine.tc_Rowid:
/* ========================= */
/* Validations on PostingSaf */
/* ========================= */
<M-16 run ValidateComponentPostPostingSaf
(input-output vlQueryStartedSafConceptByCode (blQueryStartedSafConceptByCode),
input-output vlQueryStartedSafStructureLine (blQueryStartedSafStructureLine),
input-output vcPostingSafParentType (bcPostingSafParentType),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0
then assign viLocalReturnStatus = viFcReturnSuper.
end. /* for each t_sPpostingSaf */
END. /* POSTINGSAFBLOCK */
/* ========================= */
/* Cross-company validations */
/* ========================= */
<M-18 run ValidateComponentPostCrossCompany
(input-output vlQueryStartedJournalByJournal (blQueryStartedJournalByJournal),
input-output vlQueryStartedCompanyPrim (blQueryStartedCompanyPrim),
input-output vlQueryStartedGLByCyBR (blQueryStartedGLByCyBR),
input-output vlQueryStartedCompanyProperty (blQueryStartedCompanyProperty),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0
then assign viLocalReturnStatus = viFcReturnSuper.
<M-85 run ValidateComponentPostCrossCompanyDeleteConstraint (output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0
then assign viLocalReturnStatus = viFcReturnSuper.
/* ====================================================================================== */
/* check if VAT currency are filled, if not take transactional currency from posting line */
/* and construct exchange rate between TC and VC */
/* ====================================================================================== */
for each t_sPostingVat where
t_sPostingVat.tc_ParentRowid = t_sPostingLine.tc_Rowid:
if t_sPosting.tc_Status <> "D":U and
t_sPostingLine.tc_Status <> "D":U and
(t_sPostingVat.tc_Status = "N":U or
t_sPostingVat.tc_Status = "C":U) and
(t_sPostingVat.Currency_ID = ? or
t_sPostingVat.Currency_ID = 0)
then assign t_sPostingVat.Currency_ID = t_sPostingLine.Currency_ID
t_sPostingVat.PostingVatExchangeRate = 1
t_sPostingVat.PostingVatRateScale = 1.
if t_sPostingVat.tc_Status <> 'D':U and
t_sPostingVat.TxtyTaxType <> '':U and
t_sPostingVat.TxtyTaxType <> ? then
do:
<Q-54 run MfgTaxTypeByTaxTypeV01 (all) (Read) (NoCache)
(input t_sPostingVat.TxtyTaxType, (TaxTypeCode)
input yes, (TaxTypeIsWHT)
output dataset tqMfgTaxTypeByTaxTypeV01) in BMfgTaxType>
find first tqMfgTaxTypeByTaxTypeV01 no-error.
if available tqMfgTaxTypeByTaxTypeV01 and
tqMfgTaxTypeByTaxTypeV01.tltxty_wt_type = yes and
not vlIsDomainWithWHT then
do:
assign vcMessage =
trim(substitute(#T-50'Tax type withholding tax '&1' cannot be used because the domain does not have withholding tax enabled.':255(766146317)T-50#, t_sPostingVat.TxtyTaxType)).
<M-84 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tPostingVat.TxtyTaxType':U (icFieldName),
input t_sPostingVat.TxtyTaxType (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sPostingVat.tc_Rowid (icRowid),
input 'qadfin-814876':U (icFcMsgNumber),
input ? (icFcExplanation),
input ? (icFcIdentification),
input ? (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
assign viLocalReturnStatus = -1.
end. /* if available tqMfgTaxTypeByTaxTypeV01 */
end. /* t_sPostingVat.tc_Status <> 'D':U */
end. /* for each t_sPostingVat where */
/* ====================================================================================== */
/* check if VAT currency are filled, if not take transactional currency from posting line */
/* and construct exchange rate between TC and VC */
/* ====================================================================================== */
for each t_sPostingVatDelay where
t_sPostingVatDelay.tc_ParentRowid = t_sPostingLine.tc_Rowid:
if t_sPosting.tc_Status <> "D":U and
t_sPostingLine.tc_Status <> "D":U and
(t_sPostingVatDelay.tc_Status = "N":U or
t_sPostingVatDelay.tc_Status = "C":U) and
(t_sPostingVatDelay.Currency_ID = ? or
t_sPostingVatDelay.Currency_ID = 0)
then assign t_sPostingVatDelay.Currency_ID = t_sPostingLine.Currency_ID
t_sPostingVatDelay.PostingVatDelayExchRate = 1
t_sPostingVatDelay.PostingVatDelayRateScale = 1.
end. /* for each t_sPostingVatDelay where */
end. /* POSTINGLINEBLOCK */
/* ============================ */
/* Check if Posting is balanced */
/* ============================ */
/* Single currency = check TC balance // Not needed in case of ExternalPostings*/
/* Multi currency = check LC balance */
if vlPostingMustBeBalanced = true and
t_sPosting.PostingOriginIsExternal = false and
((viCurrencyId <> ? and vdBalanceTC <> 0 and vdBalanceTC <> ?) or
(vdBalanceLC <> 0 and vdBalanceLC <> ?) or
(vdBalanceCC <> 0 and vdBalanceCC <> ?))
then do:
/* This validation is also skipped, when there is defined Auto-balancing GL account */
<Q-60 assign vlFcQueryRecordsAvailable = GLBySystemTypeAndType (NoCache)
(input ?, (GLCode)
input {&GLSYSTEMTYPE-AUTOBALANCE}, (GLSystemTypeCode)
input ?, (GLId)
input {&GLTYPECODE-SYST}, (GLTypeCode)
input t_sPosting.Company_ID, (CompanyId)
input true, (GlIsActive)) in BGL>
if not(vlFcQueryRecordsAvailable = true)
then do:
assign vcMsgExplanation = <M-37 GetErrorExplanation
(input t_sPosting.tc_Rowid (icPostingRowId),
input ? (icPostingLineRowId),
output viFcReturnSuper (oiReturnStatus)) in BPosting>.
assign vcMessage = trim(substitute(#T-9'The journal entry balance must be zero for posting &1\&2\&3.':255(63303)T-9#,trim(string(t_sPosting.PostingYear)),trim(t_sPosting.tcJournalCode),trim(string(t_sPosting.PostingVoucher)))) + chr(10) +
trim(subst(#T-10'Balance in transaction currency: &1':255(3215)T-10#, string(vdBalanceTC) )) + chr(10) +
trim(subst(#T-11'Balance in base currency: &1':255(3216)T-11#, string(vdBalanceLC) )) + chr(10) +
trim(subst(#T-45'Balance in Statutory Currency: &1':255(999890789)T-45#, string(vdBalanceCC) ))
viLocalReturnStatus = -1
vcMessage = vcMessage + chr(10) + trim(#T-19'Details of the posting lines:':255(69230)T-19#).
for each t_sPostingLine where
t_sPostingLine.tc_ParentRowid = t_sPosting.tc_Rowid and
t_sPostingLine.tc_Status <> "D":U :
if length(vcMessage, "CHARACTER") < 30000
then assign vcMessage = vcMessage + chr(10) +
trim(substitute(#T-20'Amount for account &1 (&2): transaction currency: &3, base currency: &4, Statutory Currency: &5':255(999890790)T-20#,
t_sPostingLine.tcGLCode,
t_sPostingLine.tcGLDescription,
t_sPostingLine.PostingLineDebitTC - t_sPostingLine.PostingLineCreditTC,
t_sPostingLine.PostingLineDebitLC - t_sPostingLine.PostingLineCreditLC,
t_sPostingLine.PostingLineDebitCC - t_sPostingLine.PostingLineCreditCC)).
else do:
assign vcMessage = vcMessage + chr(10) +
trim(#T-33'Note: Not all postinglines are included in the message.':255(999890618)T-33#).
leave.
end. /* else do */
end. /* for each t_sPostingLine where */
<M-8 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sPosting.tc_Rowid (icRowid),
input 'QadFin-7325':U (icFcMsgNumber),
input vcMsgExplanation (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
end. /* if not(vlFcQueryRecordsAvailable = true) */
end. /* if vlPostingMustBeBalanced = true and */
end. /* POSTINGBLOCK */
/* =========================================================================================================== */
/* CloseAndStop BGLMask. If the GLMask needed to be checked in method ValidateComponentPostingLine3 , then it */
/* was StartedAndOpened there in another transaction. This is much more performing then using an instance-less */
/* call as the call to ApiGLMaskIsValid needs to be done multiple times (when it needs to be done once). */
/* =========================================================================================================== */
if vlClassStartedAndOpenedBCOAMask = True
then do :
<I-22 {bFcCloseAndStopInstance
&CLASS = "BCOAMask"}>
assign vlClassStartedAndOpenedBCOAMask = false.
end. /* if vlClassStartedAndOpenedBCOAMask = false */
/* ============ */
/* Stop queries */
/* ============ */
<M-6 run ValidateComponentPostStopQueries
(input vlQueryStartedJournalByJournal (ilQueryStartedJournalByJournal),
input vlQueryStartedGLByID (ilQueryStartedGLByID),
input vlQueryStartedProjectById (ilQueryStartedProjectById),
input vlQueryStartedCostCentreByID (ilQueryStartedCostCentreByID),
input vlQueryStartedPostingTemplate (ilQueryStartedPostingTemplate),
input vlQueryStartedPeriodByID (ilQueryStartedPeriodByID),
input vlQueryStartedGLByPosting (ilQueryStartedGLByPosting),
input vlQueryStartedGLOpenItemByAll (ilQueryStartedGLOpenItemByAll),
input vlQueryStartedSafConceptByCode (ilQueryStartedSafConceptByCode),
input vlQueryStartedSafStructureLine (ilQueryStartedSafStructureLine),
input vlQueryStartedCompanyPrim (ilQueryStartedCompanyPrim),
input vlQueryStartedGLByCyBR (ilQueryStartedGLByCyBR),
input vlQueryStartedCompanyProperty (ilQueryStartedCompanyProperty),
input vlQueryStartedCompPropByCode (ilQueryStartedCompPropByCode),
input vlQueryStartedGLForPostingLine (ilQueryStartedGLForPostingLine),
input vlQueryStartedGetCostCentre (ilQueryStartedGetCostCentre),
input vlQueryStartedGetProject (ilQueryStartedGetProject),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0
then assign viLocalReturnStatus = viFcReturnSuper.
/* ================== */
/* Exception handling */
/* ================== */
assign oiReturnStatus = viLocalReturnStatus.