project QadFinancials > class BDInvoice > method ValidateComponentAllMovement
validation procedure
Description
This method is a submethod of ValidateComponentAll.
Validates if you can find the postingdate of an invoicemovement of type Movement is smaller than the postingdate of the invoice.
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program5/bdinvoice.p)
empty temp-table tPostingPostingLineInfoDIJE.
/* Validate Date of an AP/AR Movement can not be earlier then the Invoice Creation Date */
for each t_sDInvoiceMovement where
t_sDInvoiceMovement.DInvoice_ID = t_sDInvoice.DInvoice_ID and
t_sDInvoiceMovement.DInvoiceMovementType = {&MOVEMENTTYPE-MOVEMENT} and
t_sDInvoiceMovement.tc_Status = "N":U:
if not can-find(first tPostingPostingLineInfoDIJE where
tPostingPostingLineInfoDIJE.tiPostingLine_ID = t_sDInvoiceMovement.PostingLine_ID)
then do:
create tPostingPostingLineInfoDIJE.
assign tPostingPostingLineInfoDIJE.tiPostingLine_ID = t_sDInvoiceMovement.PostingLine_ID.
end.
<I-11 {bFcOpenInstance
&CLASS = "BJournalEntry"}>
<M-10 run GetPostingInfoByPostingLineIDTT
(input-output tPostingPostingLineInfoDIJE (tPostingPostingLineInfo),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
/* ========================================================================================================= */
/* Normally we would here close BJournalEntry but we will not do it for performance */
/* reasons as this way the Commit of the transaction does not have to re-open the instance to commit it. */
/* And in all other scenario's the instance of the class will be closed by the de-activiate procedure of the */
/* appserver that is executed after each call to the appserver */
/* ========================================================================================================= */
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
if can-find(first tPostingPostingLineInfoDIJE where
tPostingPostingLineInfoDIJE.tiPostingLine_ID = t_sDInvoiceMovement.PostingLine_ID and
tPostingPostingLineInfoDIJE.ttPostingDate < t_sDinvoice.DInvoicePostingDate)
then do:
assign vcMessage = #T-9'Date of an AR Movement can not be earlier then the Customer Invoice Posting Date.':255(73426690)T-9#
oiReturnStatus = -1.
vcDatetemp = <M-90 DisplayDate (input t_sDInvoiceMovement.DinvoiceMovementPostDate (itDate)) in BDInvoice>.
<M-8 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'DInvoiceMovement.DInvoiceMovementPostDate':U (icFieldName),
input vcDatetemp (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sDInvoiceMovement.tc_Rowid (icRowid),
input 'QadFin-9636':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
end. /* if can-find(first tPostingPostingLineInfoDIJE where */
find first tDInvoiceMovement where
tDInvoiceMovement.DInvoice_ID = t_sDInvoiceMovement.DInvoice_ID and
tDInvoiceMovement.DInvoiceMovementPostDate > t_sDInvoiceMovement.DInvoiceMovementPostDate no-error.
if available tDInvoiceMovement
then do:
assign vcDatetemp = <M-12 DisplayDate (input tDInvoiceMovement.DInvoiceMovementPostDate (itDate)) in BDInvoice>
vcDatetemp1 = <M-21 DisplayDate (input t_sDInvoiceMovement.DinvoiceMovementPostDate (itDate)) in BDInvoice>.
assign vcMessage = trim(substitute(#T-97'An invoice activity cannot have an earlier posting date &1 than any previous activity posting date. A previous posting date &2 exists.':255(988062127)T-97#,
vcDatetemp1,vcDatetemp))
oiReturnStatus = -1.
<M-19 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'DInvoiceMovement.DInvoiceMovementPostDate':U (icFieldName),
input vcDatetemp1 (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sDInvoiceMovement.tc_Rowid (icRowid),
input 'QadFin-700550':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
end. /* if available tDInvoiceMovement */
end. /* for each t_sDInvoiceMovement where */