project QadFinancials > class BCInvoice > method ValidateComponentPost
Description
This method is a submethod of ValidateComponent.
This method includes the validations that are done after the ancestor code of the ValidateComponent.
This method includes the validation of the creditor invoice and his sub-tables.
Parameters
blStartVal1 | input-output | logical | Is query tqCreditorForCInvoiceVal already started or not ? |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program5/bcinvoice.p)
assign vlStart1 = false
vlStart2 = false
vlStart3 = false
vlStart4 = false
vlStart5 = false
vlStart7 = false
vlStart8 = false
vlStart9 = false
vlStart10 = false
vlStart11 = false
vlStart12 = false
vlStart13 = false
vlStart14 = false
vlStart15 = false
vlStart16 = false
vlStart17 = false
vlStart18 = false
vhTTSM = ?
vlBJEOpened= false.
<M-48 run StartCacher
(output vhFcComponent (ohCacher),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
<Q-85 run AddressTypePrim (all) (Read) (NoCache)
(input ?, (AddressTypeId)
input {&ADDRESSTYPECODESYSTEM-HEADOFFICE}, (AddressTypeCode)
output dataset tqAddressTypePrim) in BAddressType >
find first tqAddressTypePrim where
tqAddressTypePrim.tcAddressTypeCode = {&ADDRESSTYPECODESYSTEM-HEADOFFICE}
no-lock no-error.
assign viHOAddressTypeID = if available tqAddressTypePrim
then tqAddressTypePrim.tiAddressType_ID
else ?.
/* DaemonLogicByPass: indicates if the daemon-logic should be by-passed or not */
/* This flag is to by-pass validation for payment selection un-confirm through a daemon */
/* This value is retrieved from Session and passed to sub-methods and only retrieved once here */
/* We turn this OFF after we have retrieved this */
<I-43 {bFcOpenInstance
&CLASS = "Session"}>
<M-65 run GetLogicalValue
(input 'DaemonLogicByPass':U (icName),
output vlDaemonLogicByPass (olValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
<M-13 run SetLogicalValue
(input 'DaemonLogicByPass':U (icName),
input ? (ilValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
<I-66 {bFcCloseInstance
&CLASS = "Session"}>
for each t_sCInvoice where
t_sCInvoice.tc_Status <> "D":U:
if t_sCInvoice.tc_Status <> "N":U
then do:
find t_iCInvoice where
t_iCInvoice.tc_Rowid = t_sCInvoice.tc_Rowid
no-error.
if not available t_iCInvoice
then do:
<M-1 run SetMessage
(input trim(#T-1'The system cannot find initial values for supplier invoice $1 $2 $3.':255(65420)t-1#) (icMessage),
input string(t_sCInvoice.CInvoicePostingYear) + chr(2) + t_sCInvoice.tcJournalCode + chr(2) + string(t_sCInvoice.CInvoiceVoucher) (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7029':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
next.
end.
end.
/* ====================================== */
/* Check for duplicate invoice-references */
/* ====================================== */
if (t_sCInvoice.CInvoiceType = {&INVOICETYPE-INVOICE} or
t_sCInvoice.CInvoiceType = {&INVOICETYPE-INVOICECORRECTION} or
t_sCInvoice.CInvoiceType = {&INVOICETYPE-CREDITNOTE} or
t_sCInvoice.CInvoiceType = {&INVOICETYPE-CREDITNOTECORRECTION}) and
t_sCInvoice.tc_Status <> "":U
then do:
/* Reference is mandatory */
if t_sCInvoice.CInvoiceReference = "":U or
t_sCInvoice.CInvoiceReference = ?
then do:
<M-72 run SetMessage
(input trim(#T-75'You must enter the reference.':150(1189)T-75#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceReference':U (icFieldName),
input t_sCInvoice.CInvoiceReference (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7909':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
end. /* if t_sCInvoice.CInvoiceReference = "":U or */
else do :
if t_sCInvoice.CInvoiceIsInitialStatus = false and
(t_sCInvoice.tc_Status = 'N':U or
(available t_iCInvoice and
t_sCInvoice.tc_Status <> 'N':U and
(t_sCInvoice.CInvoiceReference <> t_iCInvoice.CInvoiceReference or
t_sCInvoice.Creditor_ID <> t_iCInvoice.Creditor_ID or
t_sCInvoice.CInvoiceType <> t_iCInvoice.CInvoiceType or
t_sCInvoice.CInvoiceIsInitialStatus <> t_iCInvoice.CInvoiceIsInitialStatus) ))
then do :
<M-475 run CheckDuplicateCInvoiceReference
(input t_sCInvoice.CInvoice_ID (iiCInvoiceID),
input t_sCInvoice.Company_ID (iiCompanyID),
input t_sCInvoice.Creditor_ID (iiCreditorID),
input t_sCInvoice.tcCreditorCode (icCreditorCode),
input t_sCInvoice.CInvoiceType (icCInvoiceType),
input t_sCInvoice.CInvoiceReference (icCInvoiceReference),
input t_sCInvoice.CInvoiceIsInitialStatus (ilCInvoiceIsInitialStatus),
input t_sCInvoice.tiLinkedPeriodYear (iiLinkedPeriodYear),
input t_sCInvoice.tcLinkedJournalCode (icLinkedJournalCode),
input t_sCInvoice.tiLinkedCInvoiceVoucher (iiLinkedCInvoiceVoucher),
input true (ilForCheckUI),
output vcDummy (ocCInvoiceReferenceDuplicate),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
If viFcReturnSuper < 0 or
(viFcReturnSuper > 0 and
oiReturnStatus = 0)
Then assign oiReturnStatus = viFcReturnSuper.
end. /* if (t_sCInvoice.LinkedCInvoice_ID = ? or */
end. /* not if if t_sCInvoice.CInvoiceReference = "":U or */
end. /* if (t_sCInvoice.CInvoiceType = {&INVOICETYPE-INVOICE} or */
/* Some validations for new invoices */
if t_sCInvoice.tc_Status = "N":U
then do:
<M-47 run ValidateComponentPostCreate
(input-output vlStart2 (blStart2),
input-output vlStart10 (blStart10),
input-output vlStart11 (blStart11),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
end.
else
/* Some validations for modified invoices */
if t_sCInvoice.tc_Status = "C":U
then do:
<M-58 run ValidateComponentPostModify (output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
end.
/* Due date cannot be before invoice date */
<M-801 run ValidateComponentPostDueDate (output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
/* defect 10249-0233 mnz Posting date is allowed to be before invoice date for invoices, credit notes, invoice corrections and credit note corrections */
if (t_sCInvoice.tc_Status = "N":U or
t_sCInvoice.tc_Status = "C":U and
(t_sCInvoice.CInvoiceDate <> t_iCInvoice.CInvoiceDate or
t_sCInvoice.CInvoicePostingDate <> t_iCInvoice.CInvoicePostingDate or
t_sCInvoice.CInvoiceType <> t_iCInvoice.CInvoiceType)) and
(t_sCInvoice.CInvoiceType = {&INVOICETYPE-INVOICE} or
t_sCInvoice.CInvoiceType = {&INVOICETYPE-CREDITNOTE} or
t_sCInvoice.CInvoiceType = {&INVOICETYPE-INVOICECORRECTION} or
t_sCInvoice.CInvoiceType = {&INVOICETYPE-CREDITNOTECORRECTION}) and
t_sCInvoice.CInvoicePostingDate < t_sCInvoice.CInvoiceDate
then do:
assign vcDatetemp = <M-24 DisplayDate (input t_sCInvoice.CInvoiceDate (itDate)) in BCInvoice>
vcDatetemp1 = <M-42 DisplayDate (input t_sCInvoice.CInvoicePostingDate (itDate)) in BCInvoice>.
assign vcMsg = trim(substitute(#T-80'The invoice date (&1) is after the posting date (&2).':150(69262)T-80#, vcDatetemp, vcDatetemp1)).
<M-7 run SetMessage
(input vcMsg (icMessage),
input string(t_sCInvoice.CInvoiceDate) (icArguments),
input 'tCInvoice.CInvoiceDate':U (icFieldName),
input vcDatetemp (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7050':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if oiReturnStatus >= 0
then
assign oiReturnStatus = 1.
end.
/* Posting date must be between start/end date of the GL period */
if t_sCInvoice.tc_Status = "N":U or
t_sCInvoice.tc_Status = "C":U and
(t_sCInvoice.CInvoicePostingDate <> t_iCInvoice.CInvoicePostingDate or
t_sCInvoice.Period_ID <> t_iCInvoice.Period_ID)
then do:
<Q-78 assign vlFcQueryRecordsAvailable = PeriodByPeriodStartEndDate (NoCache)
(input ?, (CompanyId)
input t_sCInvoice.CInvoicePostingDate, (Date)
input t_sCInvoice.Period_ID, (PeriodId)
input ?, (PeriodYear)
input ?, (PeriodPeriod)) in BPeriod >
if vlFcQueryRecordsAvailable = false
then do:
assign vcMessage = trim(substitute(#T-97'The posting date specified is not within the specified GL period. Please specify a posting date from Period &1/&2.':255(20482147)T-97#, trim(string(t_sCInvoice.CInvoicePostingYear)) , trim(string(t_sCInvoice.CInvoicePostingPeriod)) ))
vcDatetemp2 = <M-79 DisplayDate (input t_sCInvoice.CInvoicePostingDate (itDate)) in BCInvoice>.
oiReturnStatus = -1.
<M-81 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoicePostingDate':U (icFieldName),
input vcDatetemp2 (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-8007':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
end.
end.
/* Ship To Address is mandatory for invoices, credit notes, invoice corrections and credit note corrections */
if (t_sCInvoice.tc_Status = "N":U or
t_sCInvoice.tc_Status = "C":U and
(t_sCInvoice.CInvoiceType <> t_iCInvoice.CInvoiceType or
t_sCInvoice.ShipToAddress_ID <> t_iCInvoice.ShipToAddress_ID)) and
(t_sCInvoice.CInvoiceType = {&INVOICETYPE-INVOICE} or
t_sCInvoice.CInvoiceType = {&INVOICETYPE-CREDITNOTE} or
t_sCInvoice.CInvoiceType = {&INVOICETYPE-INVOICECORRECTION} or
t_sCInvoice.CInvoiceType = {&INVOICETYPE-CREDITNOTECORRECTION}) and
(t_sCInvoice.ShipToAddress_ID = 0 or
t_sCInvoice.ShipToAddress_ID = ?)
then do:
<M-18 run SetMessage
(input trim(#T-6'A ship-to address is mandatory for invoices of type $1, $2, $3 or $4.':255(65453)t-6#) (icMessage),
input {&INVOICETYPE-INVOICE-TR} + chr(2) + {&INVOICETYPE-CREDITNOTE-TR} + chr(2) + {&INVOICETYPE-INVOICECORRECTION-TR} + chr(2) + {&INVOICETYPE-CREDITNOTECORRECTION-TR} (icArguments),
input 'tCInvoice.tcShipToBusinessRelationCode':U (icFieldName),
input t_sCInvoice.tcShipToBusinessRelationCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7073':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
end.
/* Tax period must exist for tax point date */
if t_sCInvoice.tc_Status = "N":U or
t_sCInvoice.tc_Status = "C":U and
t_sCInvoice.CInvoiceTaxPointDate <> t_iCInvoice.CInvoiceTaxPointDate
then do:
<Q-20 assign vlFcQueryRecordsAvailable = VatPeriodByStartEndDate (Cache)
(input t_sCInvoice.Company_ID, (CompanyId)
input t_sCInvoice.CInvoiceTaxPointDate, (Date)
input ?, (Status)) in BVATPeriod >
if not vlFcQueryRecordsAvailable
then do:
vcDatetemp1 = <M-247 DisplayDate (input t_sCInvoice.CInvoiceTaxPointDate (itDate)) in BCInvoice>.
<M-21 run SetMessage
(input trim(#T-7'No tax period is defined for the tax point date.':150(1115)t-7#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceTaxPointDate':U (icFieldName),
input vcDatetemp1 (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7074':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
end.
end.
/* Validate Reason */
<M-57 run ValidateComponentPostReason
(input-output vlStart14 (blStart14),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
/* Validate TSM */
<M-53 run ValidateComponentPostTSM
(input viHOAddressTypeId (iiHOAddressTypeId),
input-output vhTTSM (bhTTSM),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
/* Purchase Type is mandatory for tax reporting */
if (t_sCInvoice.tc_Status = "N":U or
t_sCInvoice.tc_Status = "C":U and
(t_sCInvoice.Creditor_ID <> t_iCInvoice.Creditor_ID or
t_sCInvoice.PurchaseType_ID <> t_iCInvoice.PurchaseType_ID)) and
(t_sCInvoice.PurchaseType_ID = 0 or
t_sCInvoice.PurchaseType_ID = ?)
then do:
if not blStartVal1
then do:
<Q-37 run CreditorForCInvoiceVal (Start) in BCreditor >
assign blStartVal1 = true.
end.
<Q-38 run CreditorForCInvoiceVal (all) (Read) (Cache)
(input t_sCInvoice.Company_ID, (CompanyId)
input t_sCInvoice.tcCreditorCode, (CreditorCode)
output dataset tqCreditorForCInvoiceVal) in BCreditor >
find first tqCreditorForCInvoiceVal where
tqCreditorForCInvoiceVal.tcCreditorCode = t_sCInvoice.tcCreditorCode
no-error.
if tqCreditorForCInvoiceVal.tlCreditorIsTaxReport
then do:
<M-39 run SetMessage
(input trim(#T-33'You must specify a purchase type for tax reporting.':255(65470)t-33#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.tcPurchaseTypeCode':U (icFieldName),
input t_sCInvoice.tcPurchaseTypeCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7080':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
end.
end.
/* Validate Balances */
<M-2 run ValidateComponentPostBalances (output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
/* Validate CA Journal */
<M-3 run ValidateComponentPostCAJournal
(input-output vlStart1 (blStart1),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
/* Validate Exchange Rate */
<M-5 run ValidateComponentPostExchangeRate (output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if t_sCInvoice.CInvoiceType <> {&INVOICETYPE-PREPAYMENT}
then do:
/* Validate DaybookSet */
<M-87 run ValidateComponentPostDaybookSet
(input-output vlStart17 (blStart17),
input-output vlStart18 (blStart18),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
end.
/* Validate Journal */
<M-8 run ValidateComponentPostJournal (output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
/* Validate Originals */
<M-11 run ValidateComponentPostOriginals (output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
/* Validate Analysis */
<M-44 run ValidateComponentPostAnalysis
(input-output vlStart4 (blStart4),
input-output vlStart8 (blStart8),
input-output vlStart9 (blStart9),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
/* Validate CInvoiceStage */
<M-36 run ValidateComponentPostStage (output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
/* Payment condition can only change if no payments were made yet */
if t_sCInvoice.tc_Status = "C":U and
t_sCInvoice.NormalPaymentCondition_ID <> t_iCInvoice.NormalPaymentCondition_ID and
(t_iCInvoice.CInvoiceOriginalCreditTC <> t_iCInvoice.CInvoiceBalanceCreditTC or
t_iCInvoice.CInvoiceOriginalDebitTC <> t_iCInvoice.CInvoiceBalanceDebitTC)
then do:
<M-34 run SetMessage
(input trim(#T-32'You cannot modify the credit terms ($1) for invoice ($2) because payments have already been created for it.':255(65467)t-32#) (icMessage),
input t_iCInvoice.tcNormalPaymentConditionCode + chr(2) + string(t_iCInvoice.CInvoicePostingYear) + ' ':U + t_iCInvoice.tcJournalCode + ' ':U + string(t_iCInvoice.CInvoiceVoucher) (icArguments),
input 'tCInvoice.tcNormalPaymentConditionCode':U (icFieldName),
input t_sCInvoice.tcNormalPaymentConditionCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7077':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
end.
/* Validation that no movement records exist when CInvoiceIsInitialStatus is true */
if t_sCInvoice.CInvoiceIsInitialStatus = true
then do:
<Q-70 assign vlFcQueryRecordsAvailable = CInvoiceMovementByType (NoCache)
(input ?, (CompanyId)
input t_sCInvoice.CInvoice_ID, (CInvoiceId)
input ?, (CInvoiceMovementType)) in BCInvoice >
if vlFcQueryRecordsAvailable <> false
then do:
<M-71 run SetMessage
(input 'Cannot set invoice to Initial Status because it has movements against it':U (icMessage),
input ' ':U (icArguments),
input 'tCInvoice.tcReasonCode':U (icFieldName),
input t_sCInvoice.tcReasonCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7805':U (icFcMsgNumber),
input ' ':U (icFcExplanation),
input ' ':U (icFcIdentification),
input ' ':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
end.
end.
/*Validate Voucher number, mandatory when CInvoiceIsInitialStatus if false and zero when true */
if ((t_sCInvoice.CInvoiceIsInitialStatus = true and
not (t_sCInvoice.CInvoiceVoucher = 0 or t_sCInvoice.CInvoiceVoucher = ?)) or
(t_sCInvoice.CInvoiceIsInitialStatus = false and (t_sCInvoice.CInvoiceVoucher = 0 or t_sCInvoice.CInvoiceVoucher = ?)))
then do:
<M-69 run SetMessage
(input #T-68'You can only set the invoice number if the invoice is not in the Initial status.':80(68732)t-68# (icMessage),
input ' ':U (icArguments),
input 'tCInvoice.CInvoiceVoucher':U (icFieldName),
input t_sCInvoice.CInvoiceVoucher (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7776':U (icFcMsgNumber),
input ' ':U (icFcExplanation),
input ' ':U (icFcIdentification),
input ' ':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
end.
/* Validate Hold Amount */
<M-50 run ValidateComponentPostHoldAmount (output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
/* Validate Matching flag */
<M-52 run ValidateComponentPostMatching (output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
/* Validate Bank records */
<M-40 run ValidateComponentPostBank
(input vlDaemonLogicByPass (ilDaemonLogicByPass),
input-output vlStart12 (blStart12),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
/* Validate Movement */
if can-find(first t_sCInvoiceMovement where
t_sCInvoiceMovement.CInvoice_ID = t_sCInvoice.CInvoice_ID and
t_sCInvoiceMovement.CInvoiceMovementType = {&MOVEMENTTYPE-MOVEMENT} and
t_sCInvoiceMovement.tc_Status = "N":U)
then do:
<M-88 run ValidateComponentPostMovement
(input-output vlBJEOpened (blBJEOpened),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
end. /* if can-find(first t_sDInvoiceMovement where */
/* Validate Tax records */
<M-54 run ValidateComponentPostTax
(input viMfgProMajorVersionBCI (iiMfgProMajorVersion),
input viMfgProMinorVersionBCI (iiMfgProMinorVersion),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
/* Validate PO records */
<M-59 run ValidateComponentPostPO
(input-output vlStart15 (blStart15),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
/* Valiadte NonDiscAmt CA676097*/
<M-93 run ValidateComponentPostNonDiscAmt (output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
/* Validate WHT records */
<M-22 run ValidateComponentPostWHT
(input viMfgProMajorVersionBCI (iiMfgProMajorVersion),
input viMfgProMinorVersionBCI (iiMfgProMinorVersion),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
end.
if vhTTSM <> ? and
valid-handle(vhTTSM)
then do :
run gipr_DeleteProcedure in vhTTSM no-error.
delete procedure vhTTSM.
end. /* if vhTTSM <> ? and */
if vlBJEOpened and
valid-handle(vhBJournalEntryCIInst)
then do:
<I-94 {bFcCloseInstance
&CLASS = "BJournalEntry"}>
end.