Description
ValidateComponentAllGL
Parameters
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/byearclosing.p)
/* =============================================================================== */
/* Validate GL's 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 Closing PL GL Code */
/* ======================== */
if t_sYearClosing.YearClosingIsTransPLToBal = false
then do:
if t_sYearClosing.ClosingPLGL_ID <> 0 and t_sYearClosing.ClosingPLGL_ID <> ?
then do:
assign vcMessage = trim(#T-9'You can only specify a P&L closing account when the Automatic Transfer P&L to Balance Sheet field is selected.':200(20324)t-9#)
oiReturnStatus = -1.
<M-1 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tYearClosing.tcClosingPLGLCode':U (icFieldName),
input t_sYearClosing.tcClosingPLGLCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sYearClosing.tc_Rowid (icRowid),
input 'QadFin-4613':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.ClosingPLGL_ID = 0 or t_sYearClosing.ClosingPLGL_ID = ?
then do:
assign vcMessage = trim(#T-10'You must specify a P&L closing account when the Automatic Transfer P&L to Balance Sheet field is selected.':200(20325)t-10#)
oiReturnStatus = -1.
<M-2 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tYearClosing.tcClosingPLGLCode':U (icFieldName),
input t_sYearClosing.tcClosingPLGLCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sYearClosing.tc_Rowid (icRowid),
input 'QadFin-4614':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BYearClosing>
end. /* PLGL_ID = 0 */
else do:
<Q-3 run GLById (all) (Read) (NoCache)
(input t_sYearClosing.Company_ID, (CompanyId)
input t_sYearClosing.ClosingPLGL_ID, (GLId)
output dataset tqGLById) in BGL >
find tqGLById where
tqGLById.tiGL_ID = t_sYearClosing.ClosingPLGL_ID
no-error.
if available tqGLById
then do:
if tqGLById.tlGLIsBalanceAccount <> false or
tqGLById.tlGLIsDivisionAccount <> false or
tqGLById.tlGLIsProjectAccount <> false or
tqGLById.tlGLIsCostCentreAccount <> false or
tqGLById.tlGLIsSafAccount <> false or
tqGLById.tlGLIsIntercoAccount <> false or
tqGLById.tlGLIsActive <> true or
tqGLById.tlGLIsLocalCurrency <> true or
tqGLById.tcGLTypeCode <> {&GLTYPECODE-YEARCLOSING}
then do:
assign vcMessage = trim(#T-11'The P&L GL account must be an active Closing account defined in the base currency. It must be defined without sub-accounts analysis, and must not be an intercompany account.':200(63841)t-11#)
oiReturnStatus = -1.
<M-4 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tYearClosing.tcClosingPLGLCode':U (icFieldName),
input t_sYearClosing.tcClosingPLGLCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sYearClosing.tc_Rowid (icRowid),
input 'QadFin-4615':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BYearClosing>
end.
end.
end. /* PLGL_ID <> 0 */
end. /* YearClosingIsAutoTransToBal = true */
/* ============================= */
/* Check Closing Balance GL Code */
/* ============================= */
if t_sYearClosing.YearClosingIsTransPLToBal = false
then do:
if t_sYearClosing.ClosingBalanceGL_ID <> 0 and t_sYearClosing.ClosingBalanceGL_ID <> ?
then do:
assign vcMessage = trim(#T-12'You can only specify a Balance Sheet closing account when the Automatic Transfer P&L to Balance Sheet field is selected.':200(20327)t-12#)
oiReturnStatus = -1.
<M-5 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tYearClosing.tcClosingBalanceGLCode':U (icFieldName),
input t_sYearClosing.tcClosingBalanceGLCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sYearClosing.tc_Rowid (icRowid),
input 'QadFin-4616':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.ClosingBalanceGL_ID = 0 or t_sYearClosing.ClosingBalanceGL_ID = ?
then do:
assign vcMessage = trim(#T-13'You must specify a Balance Sheet closing account when the Automatic Transfer P&L to Balance Sheet field is selected.':200(20326)t-13#)
oiReturnStatus = -1.
<M-6 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tYearClosing.tcClosingBalanceGLCode':U (icFieldName),
input t_sYearClosing.tcClosingBalanceGLCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sYearClosing.tc_Rowid (icRowid),
input 'QadFin-4617':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BYearClosing>
end. /* BalanceGL_ID = 0 */
else do:
<Q-7 run GLById (all) (Read) (NoCache)
(input t_sYearClosing.Company_ID, (CompanyId)
input t_sYearClosing.ClosingBalanceGL_ID, (GLId)
output dataset tqGLById) in BGL >
find tqGLById where
tqGLById.tiGL_ID = t_sYearClosing.ClosingBalanceGL_ID
no-error.
if available tqGLById
then do:
if tqGLById.tlGLIsBalanceAccount <> true or
tqGLById.tlGLIsDivisionAccount <> false or
tqGLById.tlGLIsProjectAccount <> false or
tqGLById.tlGLIsCostCentreAccount <> false or
tqGLById.tlGLIsSafAccount <> false or
tqGLById.tlGLIsIntercoAccount <> false or
tqGLById.tlGLIsActive <> true or
tqGLById.tlGLIsLocalCurrency <> true or
tqGLById.tcGLTypeCode <> {&GLTYPECODE-YEARCLOSING}
then do:
assign vcMessage = trim(#T-14'The Balance Sheet GL account must be an active closing account defined in the base currency. It must be defined without sub-accounts analysis, and must not be an intercompany account.':200(63842)t-14#)
oiReturnStatus = -1.
<M-8 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tYearClosing.tcClosingBalanceGLCode':U (icFieldName),
input t_sYearClosing.tcClosingBalanceGLCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sYearClosing.tc_Rowid (icRowid),
input 'QadFin-4618':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BYearClosing>
end.
end.
end. /* BalanceGL_ID <> 0 */
end. /* YearClosingIsAutoTransToBal = true */
/* ================================= */
/* Check Closing PL Division GL Code */
/* ================================= */
if (t_sYearClosing.YearClosingIsTransPLToBal = false or t_sYearClosing.YearClosingIsInclDivision = false ) and
(t_sYearClosing.ClosingPLDivGL_ID <> 0 and t_sYearClosing.ClosingPLDivGL_ID <> ?)
then do:
assign vcMessage = trim(#T-23'The P&L Sub-Account closing account can only be entered when Automatic Transfer P&L to Balance Sheet and Include Sub-Account are true.':200(20330)T-23#)
oiReturnStatus = -1.
<M-15 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tYearClosing.tcClosingPLDivGLCode':U (icFieldName),
input t_sYearClosing.tcClosingPLDivGLCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sYearClosing.tc_Rowid (icRowid),
input 'QadFin-4619':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BYearClosing>
end. /* YearClosingIsAutoTransToBal = false or YearClosingIsInclDivision = false */
if t_sYearClosing.YearClosingIsTransPLToBal = true and t_sYearClosing.YearClosingIsInclDivision = true
then do:
if t_sYearClosing.ClosingPLDivGL_ID = 0 or t_sYearClosing.ClosingPLDivGL_ID = ?
then do:
assign vcMessage = trim(#T-24'You must specify a P&L Closing account with sub-account analysis when both the Automatic Transfer P&L to Balance Sheet field and the Include Sub-Account field are selected.':200(20336)t-24#)
oiReturnStatus = -1.
<M-16 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tYearClosing.tcClosingPLDivGLCode':U (icFieldName),
input t_sYearClosing.tcClosingPLDivGLCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sYearClosing.tc_Rowid (icRowid),
input 'QadFin-4620':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BYearClosing>
end. /* PLDivGL_ID = 0 */
else do:
<Q-17 run GLById (all) (Read) (NoCache)
(input t_sYearClosing.Company_ID, (CompanyId)
input t_sYearClosing.ClosingPLDivGL_ID, (GLId)
output dataset tqGLById) in BGL >
find tqGLById where
tqGLById.tiGL_ID = t_sYearClosing.ClosingPLDivGL_ID
no-error.
if available tqGLById
then do:
if tqGLById.tlGLIsBalanceAccount <> false or
tqGLById.tlGLIsDivisionAccount <> true or
tqGLById.tlGLIsProjectAccount <> false or
tqGLById.tlGLIsCostCentreAccount <> false or
tqGLById.tlGLIsSafAccount <> false or
tqGLById.tlGLIsIntercoAccount <> false or
tqGLById.tlGLIsActive <> true or
tqGLById.tlGLIsLocalCurrency <> true or
tqGLById.tcGLTypeCode <> {&GLTYPECODE-YEARCLOSING}
then do:
assign vcMessage = trim(#T-25'The P&L Sub-Account GL account should be an active closing account in base currency with sub-accounts and without analysis and intercompany.':200(63843)T-25#)
oiReturnStatus = -1.
<M-18 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tYearClosing.tcClosingPLDivGLCode':U (icFieldName),
input t_sYearClosing.tcClosingPLDivGLCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sYearClosing.tc_Rowid (icRowid),
input 'QadFin-4621':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BYearClosing>
end.
end.
end. /* PLDivGL_ID <> 0 */
end. /* YearClosingIsAutoTransToBal = true */
/* ====================================== */
/* Check Closing Balance Division GL Code */
/* ====================================== */
if (t_sYearClosing.YearClosingIsTransPLToBal = false or t_sYearClosing.YearClosingIsInclDivision = false ) and
(t_sYearClosing.ClosingBalanceDivGL_ID <> 0 and t_sYearClosing.ClosingBalanceDivGL_ID <> ?)
then do:
assign vcMessage = trim(#T-26'You can only specify a Balance Sheet Closing account with sub-account analysis when both the Automatic Transfer P&L to Balance Sheet field and the Include Sub-Account field are selected.':200(20333)t-26#)
oiReturnStatus = -1.
<M-19 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tYearClosing.tcClosingBalanceDivGLCode':U (icFieldName),
input t_sYearClosing.tcClosingBalanceDivGLCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sYearClosing.tc_Rowid (icRowid),
input 'QadFin-4622':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BYearClosing>
end. /* YearClosingIsAutoTransToBal = false or YearClosingIsInclDivision = false */
if t_sYearClosing.YearClosingIsTransPLToBal = true and t_sYearClosing.YearClosingIsInclDivision = true
then do:
if t_sYearClosing.ClosingBalanceDivGL_ID = 0 or t_sYearClosing.ClosingBalanceDivGL_ID = ?
then do:
assign vcMessage = trim(#T-27'The Balance Sheet Sub-Account closing account should be entered when Automatic Transfer P&L to Balance Sheet and Include Sub-Account are true.':200(20335)T-27#)
oiReturnStatus = -1.
<M-20 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tYearClosing.tcClosingBalanceDivGLCode':U (icFieldName),
input t_sYearClosing.tcClosingBalanceDivGLCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sYearClosing.tc_Rowid (icRowid),
input 'QadFin-4623':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BYearClosing>
end. /* BalanceDivGL_ID = 0 */
else do:
<Q-21 run GLById (all) (Read) (NoCache)
(input t_sYearClosing.Company_ID, (CompanyId)
input t_sYearClosing.ClosingBalanceDivGL_ID, (GLId)
output dataset tqGLById) in BGL >
find tqGLById where
tqGLById.tiGL_ID = t_sYearClosing.ClosingBalanceDivGL_ID
no-error.
if available tqGLById
then do:
if tqGLById.tlGLIsBalanceAccount <> true or
tqGLById.tlGLIsDivisionAccount <> true or
tqGLById.tlGLIsProjectAccount <> false or
tqGLById.tlGLIsCostCentreAccount <> false or
tqGLById.tlGLIsSafAccount <> false or
tqGLById.tlGLIsIntercoAccount <> false or
tqGLById.tlGLIsActive <> true or
tqGLById.tlGLIsLocalCurrency <> true or
tqGLById.tcGLTypeCode <> {&GLTYPECODE-YEARCLOSING}
then do:
assign vcMessage = trim(#T-28'The Balance Sheet Sub-Account GL account should be an active closing account in base currency with sub-accounts and without analysis and intercompany.':200(63844)T-28#)
oiReturnStatus = -1.
<M-22 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tYearClosing.tcClosingPLDivGLCode':U (icFieldName),
input t_sYearClosing.tcClosingPLDivGLCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sYearClosing.tc_Rowid (icRowid),
input 'QadFin-4624':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BYearClosing>
end.
end.
end. /* BalanceDivGL_ID <> 0 */
end. /* YearClosingIsAutoTransToBal = true */