project QadFinancials > class BYearClosing > method ValidateComponentAllJournal
Description
ValidateComponentAllJournal
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/byearclosing.p)
/* =============================================================================== */
/* Validate Journals for Year Closing */
/* IMPORTANT: This method is called from within the for each t_sYearClosing. */
/* So this record is available in this method. */
/* This can only be done when both methods are within the same segment. */
/* =============================================================================== */
/* ====================== */
/* Check Transfer Journal */
/* ====================== */
if t_sYearClosing.YearClosingIsTransPLToBal = false
then do:
if t_sYearClosing.ClosingTransferJournal_ID <> 0 and t_sYearClosing.ClosingTransferJournal_ID <> ?
then do:
assign vcMessage = trim(#T-5'You can only specify a transfer daybook code when the Automatic Transfer P&L to Balance Sheet field is selected.':200(20339)t-5#)
oiReturnStatus = -1.
<M-1 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tYearClosing.tcClosingTransferJournalCode':U (icFieldName),
input t_sYearClosing.tcClosingTransferJournalCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sYearClosing.tc_Rowid (icRowid),
input 'QadFin-4629':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BYearClosing>
end.
end. /* YearClosingIsAutoTransToBal = false */
else do:
if t_sYearClosing.ClosingTransferJournal_ID = 0 or t_sYearClosing.ClosingTransferJournal_ID = ?
then do:
assign vcMessage = trim(#T-6'You must specify a transfer daybook code when the Automatic Transfer P&L to Balance Sheet field is selected.':200(20340)t-6#)
oiReturnStatus = -1.
<M-2 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tYearClosing.tcClosingTransferJournalCode':U (icFieldName),
input t_sYearClosing.tcClosingTransferJournalCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sYearClosing.tc_Rowid (icRowid),
input 'QadFin-4630':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BYearClosing>
end. /* TransferJournal_ID = 0 */
else do:
<Q-9 assign vlFcQueryRecordsAvailable = JournalByJournalLayer (NoCache)
(input t_sYearClosing.Company_ID, (CompanyId)
input '':U, (JournalCode)
input {&JOURNALTYPE-YEARLYCLOSING}, (CandoJournalTypeCode)
input t_sYearClosing.tcLayerCode, (LayerCode)
input '':U, (CandoLayerTypeCode)
input t_sYearClosing.ClosingTransferJournal_ID, (JournalID)
input true, (JournalIsActive)) in BJournal>
if vlFcQueryRecordsAvailable <> true
then do:
assign vcMessage = trim(substitute(#T-7'The transfer daybook code must be an active daybook of type &1 and layer &2.':200(924981104)T-7#, trim({&JOURNALTYPE-YEARLYCLOSING-TR}), trim(t_sYearClosing.tcLayerCode)))
oiReturnStatus = -1.
<M-4 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tYearClosing.tcClosingTransferJournalCode':U (icFieldName),
input t_sYearClosing.tcClosingTransferJournalCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sYearClosing.tc_Rowid (icRowid),
input 'QadFin-4631':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BYearClosing>
end.
end. /* TransferJournal_ID <> 0 */
end. /* YearClosingIsAutoTransToBal = true */
/* ================ */
/* Check PL Journal */
/* ================ */
<Q-12 assign vlFcQueryRecordsAvailable = JournalByJournalLayer (NoCache)
(input t_sYearClosing.Company_ID, (CompanyId)
input '':U, (JournalCode)
input {&JOURNALTYPE-YEARLYCLOSING}, (CandoJournalTypeCode)
input t_sYearClosing.tcLayerCode, (LayerCode)
input '':U, (CandoLayerTypeCode)
input t_sYearClosing.ClosingPLJournal_ID, (JournalID)
input true, (JournalIsActive)) in BJournal>
if vlFcQueryRecordsAvailable <> true
then do:
/* Note: P&L must be P&&L inside a substitute statement */
assign vcMessage = trim(substitute(#T-16'The P&&L closing daybook must be an active daybook of type &1 and layer &2.':200(288745882)T-16#, trim({&JOURNALTYPE-YEARLYCLOSING-TR}), trim(t_sYearClosing.tcLayerCode)))
oiReturnStatus = -1.
<M-13 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tYearClosing.tcClosingPLJournalCode':U (icFieldName),
input t_sYearClosing.tcClosingPLJournalCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sYearClosing.tc_Rowid (icRowid),
input 'QadFin-4640':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BYearClosing>
end.
/* ===================== */
/* Check Balance Journal */
/* ===================== */
<Q-17 assign vlFcQueryRecordsAvailable = JournalByJournalLayer (NoCache)
(input t_sYearClosing.Company_ID, (CompanyId)
input '':U, (JournalCode)
input {&JOURNALTYPE-YEARLYCLOSING}, (CandoJournalTypeCode)
input t_sYearClosing.tcLayerCode, (LayerCode)
input '':U, (CandoLayerTypeCode)
input t_sYearClosing.ClosingBalanceJournal_ID, (JournalID)
input true, (JournalIsActive)) in BJournal>
if vlFcQueryRecordsAvailable <> true
then do:
assign vcMessage = trim(substitute(#T-19'The balance sheet closing daybook must be an active daybook of type &1 and layer &2.':200(26758468)T-19#, trim({&JOURNALTYPE-YEARLYCLOSING-TR}), trim(t_sYearClosing.tcLayerCode)))
oiReturnStatus = -1.
<M-18 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tYearClosing.tcClosingBalanceJournalCode':U (icFieldName),
input t_sYearClosing.tcClosingBalanceJournalCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sYearClosing.tc_Rowid (icRowid),
input 'QadFin-4641':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BYearClosing>
end.