project QadFinancials > class BPosting > method ValidateComponentPreClearAutoBalAndRounding
validation procedure
Description
This method removes all automatically generated posting lines to Auto-balance GL account.
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bposting.p)
/* ====================================================================================== *
* Method : ValidateComponentPreClearAutoBal *
* Description : This method clears all the posting lines which were automatically *
* generated by the Auto-balancing posting mechanism *
* -------------------------------------------------------------------------------------- *
* Parameters : *
* ====================================================================================== */
MAIN_BLOCK:
do on error undo, throw:
if vcAutoBalancePostingRowIds <> ? and
vcAutoBalancePostingRowIds <> '':U
then do:
for each t_sPosting where
t_sPosting.tc_Status <> 'D':U,
each t_sPostingLine where
t_sPostingLine.tc_ParentRowid = t_sPosting.tc_Rowid and
t_sPostingLine.tc_Status = "N":U:
if can-do(vcAutoBalancePostingRowIds, t_sPostingLine.tc_Rowid)
then do:
find t_oPostingLine where
t_oPostingLine.tc_Rowid = t_sPostingLine.tc_Rowid
no-error.
if available t_oPostingLine
then delete t_oPostingLine.
delete t_sPostingLine.
end.
assign viMethodCompanyId = t_sPosting.Company_ID.
end. /* for each t_sPosting where */
assign vcAutoBalancePostingRowIds = '':U.
end. /* if vcAutoBalancePostingRowIds */
/* clearing rounding posting lines */
if vlTaxPostingSCExRateModified
then do:
assign viRoundingGLID = ?.
if viMethodCompanyId = ? or viMethodCompanyId = 0
then assign viMethodCompanyId = viCompanyId.
<Q-87 run GLBySystemTypeAndType (all) (Read) (NoCache)
(input ?, (GLCode)
input {&GLSYSTEMTYPE-ROUND}, (GLSystemTypeCode)
input ?, (GLId)
input {&GLTYPECODE-SYST}, (GLTypeCode)
input viMethodCompanyId, (CompanyId)
input ?, (GlIsActive)
output dataset tqGLBySystemTypeAndType) in BGL>
find tqGLBySystemTypeAndType where
tqGLBySystemTypeAndType.tcGLSystemTypeCode = {&GLSYSTEMTYPE-ROUND} and
tqGLBySystemTypeAndType.tcGLTypeCode = {&GLTYPECODE-SYST}
no-error.
if available tqGLBySystemTypeAndType
then assign viRoundingGLID = tqGLBySystemTypeAndType.tiGL_ID.
/* Reverse postings should be exact opposite of original invoice and include all the posting lines.
Extra filtering added to ensure that only non-reversed posting lines are potentially removed. */
for each t_sPosting where t_sPosting.PostingIsReversing = false,
each t_sPostingLine where t_sPostingLine.GL_ID = viRoundingGLID and
t_sPostingLine.tc_ParentRowid = t_sPosting.tc_Rowid:
find t_oPostingLine where t_oPostingLine.tc_Rowid = t_sPostingLine.tc_Rowid no-error.
if available t_oPostingLine
then delete t_oPostingLine.
delete t_sPostingLine.
end. /* for each t_sPosting where t_sPosting.PostingIsReversing = false, */
end. /* if vlTaxPostingSCExRateModified */
end. /* MAIN_BLOCK */