Description
Validations that need to be done after the ancestor code of ValidateComponent.
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bgrossincomeaccounting.p)
empty temp-table tValidateCAOMasks.
for each t_sGrossIncAcc where
t_sGrossIncAcc.tc_Status <> "D":U
on error undo, throw:
/* ================ */
/* Validate Journal */
/* ================ */
<M-11 run ValidateComponentPostJournal (output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
if viFcReturnSuper <> 0 and oiReturnStatus >= 0
then assign oiReturnStatus = viFcReturnSuper.
/* ========================================= */
/* Validate COA Mask for Tax Expense Account */
/* ========================================= */
create tValidateCAOMasks.
assign tValidateCAOMasks.tcGLCode = t_sGrossIncAcc.tcTaxExpenseGLCode
tValidateCAOMasks.tcDivisionCode = t_sGrossIncAcc.tcTaxExpenseDivisionCode
tValidateCAOMasks.tcCostCentreCode = t_sGrossIncAcc.tcTaxExpenseCostCentreCode
tValidateCAOMasks.tcProjectCode = t_sGrossIncAcc.tcTaxExpenseProjectCode
tValidateCAOMasks.tc_Rowid = t_sGrossIncAcc.tc_Rowid.
/* ======================= */
/* Retrieve GL Information */
/* ======================= */
/* Sales GL */
<Q-31 run GLByIDsAllInfo (all) (Read) (Cache)
(input t_sGrossIncAcc.Company_ID, (CompanyId)
input t_sGrossIncAcc.SalesGL_ID, (GL_ID)
output dataset tqGLByIDsAllInfo) in BGL >
find tqGLByIDsAllInfo where
tqGLByIDsAllInfo.tiGL_ID = t_sGrossIncAcc.SalesGL_ID
no-error.
if not available tqGLByIDsAllInfo
then do:
assign oiReturnStatus = -3
vcMessage = substitute(#T-279'Could not find Sales GL with ID &1.':255(870152182)T-279#, string(t_sGrossIncAcc.SalesGL_ID)).
<M-66 run SetMessage
(input vcMessage (icMessage),
input '' (icArguments),
input 'tGrossIncAcc.SalesGL_ID' (icFieldName),
input string(t_sGrossIncAcc.SalesGL_ID) (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input t_sGrossIncAcc.tc_Rowid (icRowid),
input 'qadfin-616426':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
return.
end. /* if not available tqGLByIDsAllInfo */
assign vcSalesGLType = tqGLByIDsAllInfo.tcGLTypeCode
vlSalesGLIsDivision = tqGLByIDsAllInfo.tlGLIsDivisionAccount
vlSalesGLIsCostCentre = tqGLByIDsAllInfo.tlGLIsCostCentreAccount
vlSalesGLIsProject = tqGLByIDsAllInfo.tlGLIsProjectAccount
vlSalesGLIsSaf = tqGLByIDsAllInfo.tlGLIsSafAccount
viSalesGLDivisionID = tqGLByIDsAllInfo.tiDivisionProfile_ID
viSalesGLCostCentreID = tqGLByIDsAllInfo.tiCostCentreProfile_ID
viSalesGLProjectID = tqGLByIDsAllInfo.tiProjectProfile_ID
vcSalesGLAnalysisLimit = tqGLByIDsAllInfo.tcGLAnalysisLimitation.
<Q-75 run GetSafStructureLinkForGL (all) (Read) (NoCache)
(input t_sGrossIncAcc.SalesGL_ID, (GL_ID)
output dataset tqSafStructureLinkForGL) in BSafStructureLink >
find first tqSafStructureLinkForGL where
tqSafStructureLinkForGL.tiGL_ID = t_sGrossIncAcc.SalesGL_ID
no-error.
if available tqSafStructureLinkForGL
then assign viSalesGLSafStructID = tqSafStructureLinkForGL.tiSafStructure_ID.
else assign viSalesGLSafStructID = 0.
/* Tax Payable GL */
<Q-65 run GLByIDsAllInfo (all) (Read) (Cache)
(input t_sGrossIncAcc.Company_ID, (CompanyId)
input t_sGrossIncAcc.TaxPayableGL_ID, (GL_ID)
output dataset tqGLByIDsAllInfo) in BGL >
find tqGLByIDsAllInfo where
tqGLByIDsAllInfo.tiGL_ID = t_sGrossIncAcc.TaxPayableGL_ID
no-error.
if not available tqGLByIDsAllInfo
then do:
assign oiReturnStatus = -3
vcMessage = substitute(#T-18'Could not find Tax Payable GL with ID &1.':255(550850071)T-18#, string(t_sGrossIncAcc.TaxPayableGL_ID)).
<M-85 run SetMessage
(input vcMessage (icMessage),
input '' (icArguments),
input 'tGrossIncAcc.TaxPayableGL_ID' (icFieldName),
input string(t_sGrossIncAcc.TaxPayableGL_ID) (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input t_sGrossIncAcc.tc_Rowid (icRowid),
input 'qadfin-26967':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
return.
end. /* if not available tqGLByIDsAllInfo */
assign vcTaxPayGLType = tqGLByIDsAllInfo.tcGLTypeCode
vlTaxPayGLIsDivision = tqGLByIDsAllInfo.tlGLIsDivisionAccount
viTaxPayGLDivisionID = tqGLByIDsAllInfo.tiDivisionProfile_ID.
/* Tax Expense GL */
<Q-15 run GLByIDsAllInfo (all) (Read) (Cache)
(input t_sGrossIncAcc.Company_ID, (CompanyId)
input t_sGrossIncAcc.TaxExpenseGL_ID, (GL_ID)
output dataset tqGLByIDsAllInfo) in BGL >
find tqGLByIDsAllInfo where
tqGLByIDsAllInfo.tiGL_ID = t_sGrossIncAcc.TaxExpenseGL_ID
no-error.
if not available tqGLByIDsAllInfo
then do:
assign oiReturnStatus = -3
vcMessage = substitute(#T-72'Could not find Tax Expense GL with ID &1.':255(140335317)T-72#, string(t_sGrossIncAcc.TaxExpenseGL_ID)).
<M-53 run SetMessage
(input vcMessage (icMessage),
input '' (icArguments),
input 'tGrossIncAcc.TaxExpenseGL_ID' (icFieldName),
input string(t_sGrossIncAcc.TaxExpenseGL_ID) (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input t_sGrossIncAcc.tc_Rowid (icRowid),
input 'qadfin-740076':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
return.
end. /* if not available tqGLByIDsAllInfo */
assign vcTaxExpGLType = tqGLByIDsAllInfo.tcGLTypeCode
vlTaxExpGLIsDivision = tqGLByIDsAllInfo.tlGLIsDivisionAccount
vlTaxExpGLIsCostCentre = tqGLByIDsAllInfo.tlGLIsCostCentreAccount
vlTaxExpGLIsProject = tqGLByIDsAllInfo.tlGLIsProjectAccount
vlTaxExpGLIsSaf = tqGLByIDsAllInfo.tlGLIsSafAccount
viTaxExpGLDivisionID = tqGLByIDsAllInfo.tiDivisionProfile_ID
viTaxExpGLCostCentreID = tqGLByIDsAllInfo.tiCostCentreProfile_ID
viTaxExpGLProjectID = tqGLByIDsAllInfo.tiProjectProfile_ID
vcTaxExpGLAnalysisLimit = tqGLByIDsAllInfo.tcGLAnalysisLimitation.
<Q-16 run GetSafStructureLinkForGL (all) (Read) (NoCache)
(input t_sGrossIncAcc.TaxExpenseGL_ID, (GL_ID)
output dataset tqSafStructureLinkForGL) in BSafStructureLink >
find first tqSafStructureLinkForGL where
tqSafStructureLinkForGL.tiGL_ID = t_sGrossIncAcc.TaxExpenseGL_ID
no-error.
if available tqSafStructureLinkForGL
then assign viTaxExpGLSafStructID = tqSafStructureLinkForGL.tiSafStructure_ID.
else assign viTaxExpGLSafStructID = 0.
/* ================= */
/* Validate GL Types */
/* ================= */
/* Validate that Sales Account is a standard account */
if vcSalesGLType <> {&GLTYPECODE-STAN}
then do:
assign oiReturnStatus = -1
vcMessage = substitute(#T-1'The Sales GL Account (&1) must be a &2.':255(170309149)T-1#, t_sGrossIncAcc.tcSalesGLCode, {&GLTYPECODE-STAN-TR}).
<M-38 run SetMessage
(input vcMessage (icMessage),
input '' (icArguments),
input 'tGrossIncAcc.tcSalesGLCode' (icFieldName),
input t_sGrossIncAcc.tcSalesGLCode (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input t_sGrossIncAcc.tc_Rowid (icRowid),
input 'qadfin-877126':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
end. /* if vcSalesGLType <> {&GLTYPECODE-STAN} */
/* Validate that Tax Payable Account is a Tax Account */
if vcTaxPayGLType <> {&GLTYPECODE-VAT}
then do:
assign oiReturnStatus = -1
vcMessage = substitute(#T-60'The Tax Payable GL Account (&1) must be a &2.':255(591125709)T-60#, t_sGrossIncAcc.tcTaxPayableGLCode, {&GLTYPECODE-VAT-TR}).
<M-22 run SetMessage
(input vcMessage (icMessage),
input '' (icArguments),
input 'tGrossIncAcc.tcTaxPayableGLCode' (icFieldName),
input t_sGrossIncAcc.tcTaxPayableGLCode (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input t_sGrossIncAcc.tc_Rowid (icRowid),
input 'qadfin-417330':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
end. /* if vcTaxPayGLType <> {&GLTYPECODE-VAT} */
/* Validate that tax expense account is a standard account */
if vcTaxExpGLType <> {&GLTYPECODE-STAN}
then do:
assign oiReturnStatus = -1
vcMessage = substitute(#T-37'The Tax Expense GL Account (&1) must be a &2.':255(703342575)T-37#, t_sGrossIncAcc.tcTaxExpenseGLCode, {&GLTYPECODE-STAN-TR}).
<M-50 run SetMessage
(input vcMessage (icMessage),
input '' (icArguments),
input 'tGrossIncAcc.tcTaxExpenseGLCode' (icFieldName),
input t_sGrossIncAcc.tcTaxExpenseGLCode (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input t_sGrossIncAcc.tc_Rowid (icRowid),
input 'qadfin-851997':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
end. /* if vcTaxExpGLType <> {&GLTYPECODE-STAN} */
/* ================================================== */
/* Validate empty analysis depending on GL definition */
/* ================================================== */
/* Empty division for Sales account */
if vlSalesGLIsDivision <> true and
t_sGrossIncAcc.SalesDivision_ID <> 0 and
t_sGrossIncAcc.SalesDivision_ID <> ?
then do:
assign oiReturnStatus = -1
vcMessage = #T-80'The Sales Account is not defined with Sub-Account analysis. You cannot specify a Sub-Account.':255(92656199)T-80#.
<M-14 run SetMessage
(input vcMessage (icMessage),
input '' (icArguments),
input 'tGrossIncAcc.tcSalesDivisionCode' (icFieldName),
input t_sGrossIncAcc.tcSalesDivisionCode (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input t_sGrossIncAcc.tc_Rowid (icRowid),
input 'qadfin-373313':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
end. /* if vlSalesGLIsDivision <> true and */
/* Empty division for Tax Payable account */
if vlTaxPayGLIsDivision <> true and
t_sGrossIncAcc.TaxPayableDivision_ID <> 0 and
t_sGrossIncAcc.TaxPayableDivision_ID <> ?
then do:
assign oiReturnStatus = -1
vcMessage = #T-79'The Tax Payable Account is not defined with Sub-Account analysis. You cannot specify a Sub-Account.':255(142656877)T-79#.
<M-9 run SetMessage
(input vcMessage (icMessage),
input '' (icArguments),
input 'tGrossIncAcc.tcTaxPayableDivisionCode' (icFieldName),
input t_sGrossIncAcc.tcTaxPayableDivisionCode (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input t_sGrossIncAcc.tc_Rowid (icRowid),
input 'qadfin-928158':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
end. /* if vlTaxPayableGLIsDivision <> true and */
/* Empty division for Tax Expense account */
if vlTaxExpGLIsDivision <> true and
t_sGrossIncAcc.TaxExpenseDivision_ID <> 0 and
t_sGrossIncAcc.TaxExpenseDivision_ID <> ?
then do:
assign oiReturnStatus = -1
vcMessage = #T-8'The Tax Expense Account is not defined with Sub-Account analysis. You cannot specify a Sub-Account.':255(61999861)T-8#.
<M-98 run SetMessage
(input vcMessage (icMessage),
input '' (icArguments),
input 'tGrossIncAcc.tcTaxExpenseDivisionCode' (icFieldName),
input t_sGrossIncAcc.tcTaxExpenseDivisionCode (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input t_sGrossIncAcc.tc_Rowid (icRowid),
input 'qadfin-489657':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
end. /* if vlTaxExpenseGLIsDivision <> true and */
/* Empty Cost Centre for Sales Account */
if vlSalesGLIsCostCentre <> true and
t_sGrossIncAcc.SalesCostCentre_ID <> 0 and
t_sGrossIncAcc.SalesCostCentre_ID <> ?
then do:
assign oiReturnStatus = -1
vcMessage = #T-93'The Sales Account is not defined with Cost Center analysis. You cannot specify a Cost Center.':255(408980868)T-93#.
<M-62 run SetMessage
(input vcMessage (icMessage),
input '' (icArguments),
input 'tGrossIncAcc.tcSalesCostCentreCode' (icFieldName),
input t_sGrossIncAcc.tcSalesCostCentreCode (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input t_sGrossIncAcc.tc_Rowid (icRowid),
input 'qadfin-902035':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
end. /* if vlSalesGLIsCostCentre <> true and */
/* Empty Cost Centre for Tax Expense Account */
if vlTaxExpGLIsCostCentre <> true and
t_sGrossIncAcc.TaxExpenseCostCentre_ID <> 0 and
t_sGrossIncAcc.TaxExpenseCostCentre_ID <> ?
then do:
assign oiReturnStatus = -1
vcMessage = #T-74'The Tax Expense Account is not defined with Cost Center analysis. You cannot specify a Cost Center.':255(552592883)T-74#.
<M-4 run SetMessage
(input vcMessage (icMessage),
input '' (icArguments),
input 'tGrossIncAcc.tcTaxExpenseCostCentreCode' (icFieldName),
input t_sGrossIncAcc.tcTaxExpenseCostCentreCode (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input t_sGrossIncAcc.tc_Rowid (icRowid),
input 'qadfin-216849':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
end. /* if vlTaxExpGLIsCostCentre <> true and */
/* Empty Project for Sales Account */
if vlSalesGLIsProject <> true and
t_sGrossIncAcc.SalesProject_ID <> 0 and
t_sGrossIncAcc.SalesProject_ID <> ?
then do:
assign oiReturnStatus = -1
vcMessage = #T-6'The Sales Account is not defined with Project analysis. You cannot specify a Project.':255(355578261)T-6#.
<M-2 run SetMessage
(input vcMessage (icMessage),
input '' (icArguments),
input 'tGrossIncAcc.tcSalesProjectCode' (icFieldName),
input t_sGrossIncAcc.tcSalesProjectCode (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input t_sGrossIncAcc.tc_Rowid (icRowid),
input 'qadfin-81233':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
end. /* if vlSalesGLIsProject <> true and */
/* Empty Project for Tax Expense Account */
if vlTaxExpGLIsProject <> true and
t_sGrossIncAcc.TaxExpenseProject_ID <> 0 and
t_sGrossIncAcc.TaxExpenseProject_ID <> ?
then do:
assign oiReturnStatus = -1
vcMessage = #T-39'The Tax Expense Account is not defined with Project analysis. You cannot specify a Project.':255(662351617)T-39#.
<M-57 run SetMessage
(input vcMessage (icMessage),
input '' (icArguments),
input 'tGrossIncAcc.tcTaxExpenseProjectCode' (icFieldName),
input t_sGrossIncAcc.tcTaxExpenseProjectCode (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input t_sGrossIncAcc.tc_Rowid (icRowid),
input 'qadfin-825942':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
end. /* if vlTaxExpGLIsProject <> true and */
/* ====================== */
/* Validate flags All ... */
/* ====================== */
<M-70 run ValidateComponentPostAllFlags
(input vlSalesGLIsDivision (ilSalesGLIsDivision),
input vlSalesGLIsCostCentre (ilSalesGLIsCostCentre),
input vlSalesGLIsProject (ilSalesGLIsProject),
input vlSalesGLIsSaf (ilSalesGLIsSaf),
input viSalesGLDivisionID (iiSalesGLDivisionID),
input viSalesGLCostCentreID (iiSalesGLCostCentreID),
input viSalesGLProjectID (iiSalesGLProjectID),
input viSalesGLSafStructID (iiSalesGLSafStructID),
input vlTaxPayGLIsDivision (ilTaxPayGLIsDivision),
input viTaxPayGLDivisionID (iiTaxPayGLDivisionID),
input vlTaxExpGLIsDivision (ilTaxExpGLIsDivision),
input vlTaxExpGLIsCostCentre (ilTaxExpGLIsCostCentre),
input vlTaxExpGLIsProject (ilTaxExpGLIsProject),
input vlTaxExpGLIsSaf (ilTaxExpGLIsSaf),
input viTaxExpGLDivisionID (iiTaxExpGLDivisionID),
input viTaxExpGLCostCentreID (iiTaxExpGLCostCentreID),
input viTaxExpGLProjectID (iiTaxExpGLProjectID),
input viTaxExpGLSafStructID (iiTaxExpGLSafStructID),
input vcSalesGLAnalysisLimit (icSalesGLAnalysisLimit),
input vcTaxExpGLAnalysisLimit (icTaxExpGLAnalysisLimit),
output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
if viFcReturnSuper <> 0 and oiReturnStatus >= 0
then assign oiReturnStatus = viFcReturnSuper.
end. /* for each t_sGrossIncAcc... */
/* Validate COA Masks */
assign vhFcComponent = ?.
<M-20 run ApiValidateCOAMasks
(input tValidateCAOMasks (tApiValidateCOAMasks),
output viFcReturnSuper (oiReturnStatus)) in BCOAMask>
if viFcReturnSuper <> 0 and oiReturnStatus >= 0
then assign oiReturnStatus = viFcReturnSuper.