project QadFinancials > class BPosting > method ValidateComponentReversingPosting
Description
This method is run when the posting is a reversing posting. If the status is create it makes a duplicate reversing posting of the the original posting. If it is a modify (or delete) it modifies (or deletes) both the original entry and the reversing entry.
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bposting.p)
/* Check current journal entry data to make sure it is correct */
/* Exception Handling */
assign oiReturnStatus = -98
viLocalReturn = 0.
POSTINGBLOCK:
do on error undo, return:
/* There can be situation, where user wanted to created/update reverse posting, but during validation/additional updates */
/* something failed. In this case REVERSE posting is automatically created and this posting have to be deleted when */
/* button Submit is pressed for next time */
if vcActivityCode <> "JournalEntryTransExcelIntegration" and
vcActivityCode <> "JournalEntryExcelIntegrationRepair" and
vcActivityCode <> "ExcelIntegration"
then do:
for each t_sPosting where
t_sPosting.PostingIsAutoReversal = true and
t_sPosting.PostingAutoReversalType = {&POSTINGAUTOREVERSALTYPE-REVERSING} and
t_sPosting.tc_Status = "N":U:
<M-70 run RemovePostingFromInstance
(input t_sPosting.Posting_ID (iiPostingID),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and viLocalReturn = 0 then assign viLocalReturn = viFcReturnSuper.
if viFcReturnSuper < 0 then leave POSTINGBLOCK.
end.
end.
<M-60 run ValidateComponentReversingPostingCheck (output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and viLocalReturn = 0 then assign viLocalReturn = viFcReturnSuper.
if viFcReturnSuper < 0 then leave POSTINGBLOCK.
/* if status is delete then delete both the reversing and original entries */
if can-find (first t_sPosting where
t_sPosting.tc_Status = 'D':U)
then do:
<M-65 run ValidateComponentReversingPostingDelete (output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and viLocalReturn = 0 then assign viLocalReturn = viFcReturnSuper.
if viFcReturnSuper < 0 then leave POSTINGBLOCK.
end. /* if can-find (first t_sPosting where t_sPosting.tc_Status = 'D':U) */
/* if status is changed then update the entries */
if can-find (first t_sPosting where
t_sPosting.tc_Status = 'C':U and
t_sPosting.PostingAutoReversalType = {&POSTINGAUTOREVERSALTYPE-REVERSING})
then do:
<M-67 run ValidateComponentReversingPostingModifyReversing (output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and viLocalReturn = 0 then assign viLocalReturn = viFcReturnSuper.
if viFcReturnSuper < 0 then leave POSTINGBLOCK.
end. /* if can-find (first t_sPosting where t_sPosting.tc_Status = 'C':U and {&POSTINGAUTOREVERSALTYPE-REVERSING}) */
if can-find (first t_sPosting where
t_sPosting.tc_Status = 'C':U and
t_sPosting.PostingAutoReversalType = {&POSTINGAUTOREVERSALTYPE-ORIGINAL})
then do:
<M-68 run ValidateComponentReversingPostingModifyOriginal (output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and viLocalReturn = 0 then assign viLocalReturn = viFcReturnSuper.
if viFcReturnSuper < 0 then leave POSTINGBLOCK.
end. /* else if can-find (first t_sPosting where t_sPosting.tc_Status = 'C':U and {&POSTINGAUTOREVERSALTYPE-ORIGINAL}) */
/* if status is new then create the reversing entry */
if can-find (first t_sPosting where
t_sPosting.tc_Status = 'N':U)
then do:
<M-69 run ValidateComponentReversingPostingCreate (output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and viLocalReturn = 0 then assign viLocalReturn = viFcReturnSuper.
if viFcReturnSuper < 0 then leave POSTINGBLOCK.
end. /* if can-find (first t_sPosting where t_sPosting.tc_Status = 'N':U) */
END. /* POSTINGBLOCK */
/* Exception Handling */
assign oiReturnStatus = viLocalReturn.