Description
Create the CI Posting
Parameters
iiCInvoiceId | input | integer | CInvoice ID |
iiPeriodYear | input | integer | Accounting Year |
iiPeriodPeriod | input | integer | GL Period |
itPostingDate | input | date | posting date |
iiCreditorId | input | integer | Creditor ID |
icCreditorCode | input | character | Supplier Code |
icCInvoiceType | input | character | Type of the creditor invoice |
icDivisionCode | input | character | Sub-Account Code |
icJournalCode | input | character | Daybook Code |
iiVoucher | input | integer | Voucher |
itTaxPointDate | input | date | tax point date |
icReference | input | character | Reference |
icDescription | input | character | Description |
idInvoiceAmountTC | input | decimal | Invoice Amount in TC |
idInvoiceAmountLC | input | decimal | Invoice Amount in LC |
idInvoiceAmountCC | input | decimal | Invoice Amount in CC |
icCurrencyCode | input | character | Transactial Currency Code |
idExchangeRate | input | decimal | exchange rate |
idExchangeRateScale | input | decimal | |
icCIText | input | character | SI Text |
icPostingType | input | character | Posting Type |
icGlCode | input | character | gl account |
icCostCentreCode | input | character | Cost Center Code |
icProjectCode | input | character | Project Code |
ilOnlyControlAccount | input | logical | Posting only on the control account |
icShipToCountryCode | input | character | Country code of the ship to address |
icTxclTaxCls | input | character | Tax Class of the Tax tab if filled, otherwise the tax class of the creditor |
icTxuTaxUsage | input | character | Tax Usage of the Tax tab, if not filled, then pass the tax usage of the creditor |
icTxenvTaxEnv | input | character | Tax environment of the tax tab, if not filled, pass the default value of it |
icPaymentCondition | input | character | Payment Condition |
ilIsTaxInCityFromShipTo | input | logical | tax in city flag of the ship to address |
icPoNbr | input | character | Po number |
ilIsTaxable | input | logical | Is taxable flag |
icControlCostCentreCode | input | character | |
icControlProjectCode | input | character | |
iiShipFromAddressId | input | integer | Ship From Address ID : necessary to fill the federal tax, state tax, misc .... Not needed for manual journal entries |
iiShipToAddressId | input | integer | Ship To Address ID : necessary to fill the federal tax, state tax, misc .... Not needed for manual journal entries |
ilIsLogisticMatching | input | logical | Is logistic matching ? |
ilGetDefaultSafs | input | logical | |
icBusinessRelationCode | input | character | |
iiPrePayControlGLProfileId | input | integer | |
iiInvControlGLProfileId | input | integer | |
iiCnControlGLProfileId | input | integer | |
icCInvoiceRowid | input | character | |
icBusinessRelationInterCoCode | input | character | |
icShipFromCountryCode | input | character | |
ilShipFromCountryIsEUCountry | input | logical | |
icCreditorTaxZone | input | character | |
ilCInvoiceIsTaxExcluded | input | logical | Is tax excluded in the invoice amount? |
ilIsInitialStatus | input | logical | at modify : pass the initial value of the IsInitialStatus flag, in all other cases pass false |
tApiCInvoiceVat | input-output | temp-table | |
tDefaultSafsCI | input | temp-table | |
ilHandleCommunicationWithJE | input | logical | do you want that this method handles the communication with the journal entry component or not ? If the instance of the journal entry is already started, pass false... |
biBJournalEntryId | input-output | integer | Instance of Journal Entry |
biPostingId | input-output | integer | ID of the CI Posting |
idExchangeRateCC | input | decimal | |
idExchangeRateScaleCC | input | decimal | |
itInvoiceDate | input | date | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program3/bcinvoice.p)
if ilIsInitialStatus = ?
then assign ilIsInitialStatus = false.
if ilCInvoiceIsTaxExcluded = ?
then assign ilCInvoiceIsTaxExcluded = false.
/* if the tax excluded is checked on, then we have to calculated total invoice *
* amount. This total invoice amount is used by CreateCIPosting + all *
* sub-methods */
if ilCInvoiceIsTaxExcluded = true
then do:
<M-31 run CreatePostingCalculateTotInvAmount
(input iiCInvoiceId (iiCInvoiceId),
input icCurrencyCode (icCurrencyCode),
input ilCInvoiceIsTaxExcluded (ilCInvoiceIsTaxExcluded),
input tApiCInvoicevat (tApiCInvoiceVat),
input icCInvoiceRowid (icCInvoiceRowid),
input icCInvoiceType (icCInvoiceType),
input idExchangeRate (idExchangeRate),
input idExchangeRateScale (idExchangeRateScale),
input-output idInvoiceAmountTC (bdInvoiceAmountTC),
input-output idInvoiceAmountLC (bdInvoiceAmountLC),
input-output idInvoiceAmountCC (bdInvoiceAmountCC),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
end.
/* If CC is same as LC or TC */
if idInvoiceAmountCC <> 0 and
idInvoiceAmountCC <> ?
then if vcCompanyCC = icCurrencyCode
then assign idInvoiceAmountCC = idInvoiceAmountTC.
else if vcCompanyCC = vcCompanyLC
then assign idInvoiceAmountCC = idInvoiceAmountLC.
<M-107 run CreateCIPostingValidate
(input iiPeriodPeriod (iiPeriodPeriod),
input iiPeriodYear (iiPeriodYear),
input itPostingDate (itPostingDate),
input icJournalCode (icJournalCode),
input icCreditorCode (icCreditorCode),
input idExchangeRateCC (idExchangeRateCC),
input idExchangeRateScaleCC (idExchangeRateScaleCC),
input idInvoiceAmountTC (idInvoiceAmountTC),
input idInvoiceAmountCC (idInvoiceAmountCC),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
assign vlCIREC = false.
if icPostingType = "":U or
icPostingType = ?
then assign icPostingType = if icCInvoiceType = {&INVOICETYPE-INVOICE} or
icCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
then {&POSTINGTYPE-CREDIT}
else
if icCInvoiceType = {&INVOICETYPE-CREDITNOTE} or
icCInvoiceType = {&INVOICETYPE-CREDITNOTECORRECTION}
then {&POSTINGTYPE-DEBIT}
else "":U.
/* Actions on the Statutory Currency Rate fields */
if idExchangeRateCC = 0
then assign idExchangeRateCC = ?.
if idExchangeRateScaleCC = 0
then assign idExchangeRateScaleCC = ?.
if viCompanyCCId <> 0 and
viCompanyCCId <> ? and
(idExchangeRateCC = ? or
idExchangeRateScaleCC = ?)
then do:
if icCurrencyCode = vcCompanyCC
then assign idExchangeRateCC = 1
idExchangeRateScaleCC = 1.
if vlDomainIsStatutory = false
then assign idExchangeRateCC = idExchangeRate
idExchangeRateScaleCC = idExchangeRateScale.
else do :
<M-57 run GetExRateByEntityInvoiceFlag
(input itInvoiceDate (itCInvoiceDate),
input itPostingDate (itCInvoicePostingDate),
input ? (iiFromCurrencyId),
input icCurrencyCode (icFromCurrencyCode),
input viCompanyCCId (iiToCurrencyId),
input vcCompanyCC (icToCurrencyCode),
input ? (iiExchangeRateTypeId),
input {&EXCHANGERATETYPE-STATUTORY} (icExchangeRateTypeCode),
output idExchangeRateCC (odCInvoiceExchangeRate),
output idExchangeRateScaleCC (odCInvoiceRateScale),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
end. /* Not if vlDomainIsStatutory = false */
end. /* if viCompanyCCId <> 0 and */
find tCInvoice where
tCInvoice.tc_Rowid = icCInvoiceRowid no-error.
if not available tCInvoice
then do:
assign vcMessage = trim(#T-109'Supplier Invoice Record is not available.':255(70984)T-109#)
oiReturnStatus = -3.
<M-108 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-8540':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
end.
/* Get SAF Def */
if ilGetDefaultSafs
then do:
<Q-100 run CreditorSafDefaultForCIDef (all) (Read) (NoCache)
(input iiCreditorId, (CreditorId)
output dataset tqCreditorSafDefaultForCIDef) in BCreditor >
for each tqCreditorSafDefaultForCIDef where
tqCreditorSafDefaultForCIDef.tiCreditor_ID = iiCreditorId:
create tDefaultSafsCI.
assign tDefaultSafsCI.tcSafCode = tqCreditorSafDefaultForCIDef.tcSafCode
tDefaultSafsCI.tcSafConceptCode = tqCreditorSafDefaultForCIDef.tcSafConceptCode.
end.
end. /* if ilGetDefaultSafs */
if icCreditorCode <> '':U and
icCreditorCode <> ?
then do:
<Q-113 run SupplierForSICACreate (all) (Read) (Cache)
(input tCInvoice.Company_ID, (CompanyId)
input ?, (CreditorId)
input icCreditorCode, (CreditorCode)
output dataset tqSupplierForSICACreate) in BCreditor >
find tqSupplierForSICACreate where
tqSupplierForSICACreate.tcCreditorCode = icCreditorCode
no-error.
find tDefaultSafsCI where
tDefaultSafsCI.tcSafConceptCode = {&SAFCONCEPT-SUPPLIERTYPE}
no-lock no-error.
if not available tDefaultSafsCI
then create tDefaultSafsCI.
assign tDefaultSafsCI.tcSafConceptCode = {&SAFCONCEPT-SUPPLIERTYPE}
tDefaultSafsCI.tcSafCode = (if available tqSupplierForSICACreate
then tqSupplierForSICACreate.tcCreditorTypeCode
else tDefaultSafsCI.tcSafCode).
end. /* if not can-find(... ) */
/* ============================================== */
/* Get the proper ControlGL, If: */
/* - the ControlGL on the invoice is still empty */
/* - the Customer has changed */
/* - the InvoiceType has chnaged */
/* ============================================== */
if tCInvoice.tcControlGLCode = "":U or
tCInvoice.tcControlGLCode = ? or
tCInvoice.tcCreditorCode <> icCreditorCode or
tCInvoice.CInvoiceType <> icCInvoiceType
then do :
assign viControlGLProfileId = if icCInvoiceType = {&INVOICETYPE-PREPAYMENT}
then iiPrePayControlGLProfileId
else if icCInvoiceType = {&INVOICETYPE-INVOICE} or
icCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
then iiInvControlGLProfileId
else iiCnControlGLProfileId.
if viControlGLProfileId = ? or viControlGLProfileId = 0
then assign vlError = true.
else do:
<Q-40 run ProfileLinkByGL (all) (Read) (NoCache)
(input viControlGLProfileId, (GlProfileId)
input viCompanyId, (CompanyId)
output dataset tqProfileLinkByGL) in BProfile >
find first tqProfileLinkByGL where
tqProfileLinkByGL.tiProfile_ID = viControlGLProfileId no-error.
if not available tqProfileLinkByGL
then assign vlError = true.
end.
if vlError
then do:
<M-103 run SetMessage
(input trim(#T-83'The system could not find a supplier control account record.':150(1053)T-83#) (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input tCInvoice.tc_Rowid (icRowid),
input 'QadFin-7140':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
return.
end. /* if vlError */
/* Store all values so the ControlGL can be used further on the program-code and the Creditor and InvoiceType can be used for comparison when this method is called again for the same invoice */
assign tCInvoice.tcControlGLCode = tqProfileLinkByGL.tcGLCode
tCInvoice.tcCreditorCode = icCreditorCode
tCInvoice.CInvoiceType = icCInvoiceType.
end. /* if tCInvoice.tcControlGLCode = "":U or */
/* Start and/or Open BJournalEntry */
if ilHandleCommunicationWithJE = true
then do:
if biBJournalEntryId <> 0 and
biBJournalEntryId <> ?
then assign viBJournalEntryCIID = biBJournalEntryId.
if viBJournalEntryCIId = 0 or
viBJournalEntryCIId = ?
then do:
<I-101 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "true"
&CLASS = "BJournalEntry"}>
assign vlBJEIsStartedFromCI = true.
end.
else do:
<I-102 {bFcOpenInstance
&CLASS = "BJournalEntry"}>
end.
assign biBJournalEntryId = viBJournalEntryCIID.
end.
/* Start the posting */
if biPostingId = 0 or
ilOnlyControlAccount
then do:
if ilOnlyControlAccount
then do:
<M-76 run PassRowIdBasedOnPostingIdInInstance
(input biPostingId (iiPostingId),
output vcRowId (ocPostingRowId),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then do:
if ilHandleCommunicationWithJE = true
then do:
<I-77 {bFcCloseInstance
&CLASS = "BJournalEntry"}>
end.
return.
end.
end.
else do:
assign vcPostingInvoiceReferenceText = string(iiPeriodYear, "9999":U) + "/":U +
string(iiPeriodPeriod, "99":U) + " ":U +
icJournalCode + " ":U +
string(iiVoucher, "999999999":U) + " ":U +
trim(icReference).
<M-49 run AddPostingHeader
(input ? (iiCompanyId),
input iiPeriodYear (iiPeriodYear),
input iiPeriodPeriod (iiPeriodPeriod),
input icJournalCode (icJournalCode),
input icJournalCode (icReportingJournalCode),
input iiVoucher (iiVoucher),
input itPostingDate (itPostingDate),
input ? (itValueDate),
input icCIText (icPostingText),
input icBusinessRelationCode (icPostingBusinessRelationText),
input vcPostingInvoiceReferenceText (icPostingInvoiceReferenceText),
input icDescription (icPostingParentText),
input ? (iiBPeriodId),
input icCreditorCode (icPostingOriginAddressCode),
input string(iiPeriodYear, '9999':U) + '/':U + trim(icJournalCode) + string(iiVoucher,'999999999':U) (icPostingOriginDocument),
input ? (icPostingOriginDocumentType),
input tCInvoice.CInvoiceBatchNumber (icBatchNumber),
input ? (icBankImpLineRef),
output biPostingId (oiPostingId),
output vcRowId (ocRowid),
output viDummy (oiPostingVoucher),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then do:
if ilHandleCommunicationWithJE = true
then do:
<I-62 {bFcCloseInstance
&CLASS = "BJournalEntry"}>
end.
return.
end.
assign tCInvoice.CInvoiceVoucher = viDummy.
end.
end. /* biPostingId = 0*/
else do:
/* Delete init CInvoice amt to control a/c posting */
for each tCInvoiceMovement where
tCInvoiceMovement.tc_ParentRowid = tCInvoice.tc_Rowid:
delete tCInvoiceMovement.
end.
assign tCInvoice.CInvoiceBalanceCreditTC = 0
tCInvoice.CInvoiceBalanceCreditLC = 0
tCInvoice.CInvoiceBalanceCreditCC = 0
tCInvoice.CInvoiceBalanceDebitTC = 0
tCInvoice.CInvoiceBalanceDebitLC = 0
tCInvoice.CInvoiceBalanceDebitCC = 0.
<M-42 run PassRowIdBasedOnPostingIdInInstance
(input biPostingId (iiPostingId),
output vcRowId (ocPostingRowId),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
<M-32 run UpdatePostingHeaderInInstance
(input vcRowId (icPostingRowId),
input iiPeriodYear (iiPeriodYear),
input iiPeriodPeriod (iiPeriodPeriod),
input itPostingDate (itPostingDate),
input icCIText (icPostingText),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then do:
if ilHandleCommunicationWithJE = true
then do:
<I-73 {bFcCloseInstance
&CLASS = "BJournalEntry"}>
end.
return.
end.
find first tCInvoicePosting where
tCInvoicePosting.tc_ParentRowid = tCInvoice.tc_Rowid and
tCInvoicePosting.Posting_ID = biPostingId
no-error.
if available tCInvoicePosting
then do:
<M-43 run DeleteInstanceLinesExceptGL
(input tCInvoicePosting.Posting_ID (iiPostingId),
input ? (icGLCode),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then do:
if ilHandleCommunicationWithJE = true
then do:
<I-74 {bFcCloseInstance
&CLASS = "BJournalEntry"}>
end.
return.
end.
end.
end.
/* Create posting on control a/c*/
<M-86 run CreateCIPostingControl
(input icCInvoiceType (icCInvoiceType),
input idInvoiceAmountTC (idInvoiceAmountTC),
input idInvoiceAmountLC (idInvoiceAmountLC),
input idInvoiceAmountCC (idInvoiceAmountCC),
input icPostingType (icPostingType),
input tCInvoice.tcControlGLCode (icGLCode),
input vcRowId (icRowId),
input icDivisionCode (icDivisionCode),
input icBusinessRelationInterCoCode (icBusinessRelationIntercoCode),
input icCurrencyCode (icCurrencyCode),
input icCIText (icCIText),
input iiCreditorId (iiCreditorId),
input iiCInvoiceId (iiCInvoiceId),
input idExchangeRate (idExchangeRate),
input idExchangeRateScale (idExchangeRateScale),
input icControlCostCentreCode (icControlCostCentreCode),
input icControlProjectCode (icControlProjectCode),
input ilHandleCommunicationWithJE (ilHandleCommunicationWithJE),
input idExchangeRateCC (idCCExchangeRate),
input idExchangeRateScaleCC (idCCExchangeRateScale),
output viControlPostingLineId (oiControlPostingLineId),
input itInvoiceDate (itInvoiceDate),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then do:
if ilHandleCommunicationWithJE = true
then do:
<I-88 {bFcCloseInstance
&CLASS = "BJournalEntry"}>
end.
return.
end.
/* I19 requirement for Brazil ============================================================== */
/* Update posting line to control account to contain legal document number filled in */
/* ========================================================================================= */
if tCInvoice.tlCInvoiceIsForLegalDoc
then do:
<M-30 run SetPostingLineLegalDocNumber
(input ? (icPostingLineTcRowID),
input viControlPostingLineId (iiPostingLineID),
input entry(1, tcinvoice.cinvoiceReference) (icLegalDocumentNumber),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper < 0 or oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then do:
if ilHandleCommunicationWithJE = true
then do:
<I-15 {bFcCloseInstance
&CLASS = "BJournalEntry"}>
end.
return.
end.
end. /* if tCInvoice.tlCInvoiceIsForLegalDoc */
/* Tax stuff */
if ilIsTaxable and
(icCInvoiceType = {&INVOICETYPE-INVOICE} or
icCInvoiceType = {&INVOICETYPE-INVOICECORRECTION} or
icCInvoiceType = {&INVOICETYPE-CREDITNOTE} or
icCInvoiceType = {&INVOICETYPE-CREDITNOTECORRECTION})
then do:
<M-105 run CreateCIPostingGetShipTo
(input iiShipToAddressId (iiShipToAddressId),
output vcShipToTaxIDFeder (ocShipToTaxIDFeder),
output vcShipToTaxIDState (ocShipToTaxIDState),
output vcShipToTaxIDMisc1 (ocShipToTaxIDMisc1),
output vcShipToTaxIDMisc2 (ocShipToTaxIDMisc2),
output vcShipToTaxIDMisc3 (ocShipToTaxIDMisc3),
output viShipToTaxDeclaration (oiShipToTaxDeclaration),
output vcShipToTxzTaxZone (ocShipToTxzTaxZone),
output vlShipToCountryIsEUCountry (olShipToCountryIsEUCountry),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
if iiCreditorId <> 0 and iiCreditorId <> ?
then do:
<Q-106 run CreditorAllInfo (all) (Read) (NoCache)
(input ?, (CompanyId)
input iiCreditorId, (Creditor_ID)
output dataset tqCreditorAllInfo) in BCreditor >
find first tqCreditorAllInfo where
tqCreditorAllInfo.tiCreditor_ID = iiCreditorId
no-lock no-error.
if available tqCreditorAllInfo
then assign vcShipFromTaxIDFeder = tqCreditorAllInfo.tcCreditorTaxIDFederal
vcShipFromTaxIDState = tqCreditorAllInfo.tcCreditorTaxIDState
vcShipFromTaxIDMisc1 = tqCreditorAllInfo.tcCreditorTaxIDMisc1
vcShipFromTaxIDMisc2 = tqCreditorAllInfo.tcCreditorTaxIDMisc2
vcShipFromTaxIDMisc3 = tqCreditorAllInfo.tcCreditorTaxIDMisc3.
end.
else assign vcShipFromTaxIDFeder = "":U
vcShipFromTaxIDState = "":U
vcShipFromTaxIDMisc1 = "":U
vcShipFromTaxIDMisc2 = "":U
vcShipFromTaxIDMisc3 = "":U.
assign vdDebitAmountTC = if biPostingId = 0
then if icCInvoiceType = {&INVOICETYPE-INVOICE} or
icCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
then idInvoiceAmountTC
else 0
else 0
vdCreditAmountTC = if biPostingId = 0
then if icCInvoiceType = {&INVOICETYPE-INVOICE} or
icCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
then 0
else idInvoiceAmountTC
else 0.
/* tax ids can be past as unknown value because all detailed info is passed */
<M-98 run CreateCIPostingTax
(input vcRowId (icRowId),
input biPostingId (iiPostingId),
input itTaxPointDate (itTaxPointDate),
input tCInvoice.tc_Rowid (icCInvoiceRowId),
input icCIText (icCIText),
input icCurrencyCode (icCurrencyCode),
input ? (iiCurrencyId),
input {&EXCHANGERATETYPE-ACCOUNTING} (icExchangeRateType),
input idExchangeRate (idExchangeRate),
input idExchangeRateScale (idExchangeRateScale),
input vdDebitAmountTC (idVatFullDebitTC),
input vdCreditAmountTC (idVatFullCreditTC),
input icCInvoiceType (icCInvoiceType),
input icDivisionCode (icDivisionCode),
input '':U (icVatCurrencyCode),
input 0 (iiVatCurrencyId),
input 0 (idVatExchangeRate),
input 0 (idVatExchangeRateScale),
input icShipFromCountryCode (icShipFromCountryCode),
input icShipToCountryCode (icShipToCountryCode),
input ilShipFromCountryIsEUCountry (ilShipFromCountryIsEUCountry),
input vlShipToCountryIsEUCountry (ilShipToCountryIsEUCountry),
input icTxclTaxCls (icTxclTaxCls),
input icTxuTaxUsage (icTxuTaxUsage),
input icCreditorTaxZone (icCreditorTxzTaxZone),
input vcShipToTxzTaxZone (icShipToTxzTaxZone),
input icTxenvTaxEnv (icTxenvTaxEnv),
input iiVoucher (iiVoucher),
input icPaymentCondition (icPaymentCondition),
input ilIsTaxInCityFromShipTo (ilIsTaxInCityFromShipTo),
input tCInvoice.tcControlGLCode (icControlGLCode),
input iiCreditorId (iiMasterId),
input iiCInvoiceId (iiTransactionId),
input icPoNbr (icPoNbr),
input ilIsTaxable (ilIsTaxable),
input icControlCostCentreCode (icCostCentreCode),
input icControlProjectCode (icProjectCode),
input ? (iiShipFromAddressId),
input ? (iiShipToAddressId),
input ilIsLogisticMatching (ilIsLogisticMatching),
input idInvoiceAmountTC (idInvoiceAmountTC),
input vcShipFromTaxIDFeder (icShipFromTaxIDFeder),
input vcShipFromTaxIDState (icShipFromTaxIDState),
input vcShipFromTaxIDMisc1 (icShipFromTaxIDMisc1),
input vcShipFromTaxIDMisc2 (icShipFromTaxIDMisc2),
input vcShipFromTaxIDMisc3 (icShipFromTaxIDMisc3),
input vcShipToTaxIDFeder (icShipToTaxIDFeder),
input vcShipToTaxIDState (icShipToTaxIDState),
input vcShipToTaxIDMisc1 (icShipToTaxIDMisc1),
input vcShipToTaxIDMisc2 (icShipToTaxIDMisc2),
input vcShipToTaxIDMisc3 (icShipToTaxIDMisc3),
input viShipToTaxDeclaration (iiShipToTaxDeclaration),
input itInvoiceDate (itInvoiceDate),
input idExchangeRateCC (idCCExchangeRate),
input idExchangeRateScaleCC (idCCExchangeRateScale),
input icReference (icCInvoiceReference),
input tCInvoice.CInvoiceIsERS (ilCInvoiceIsERS),
input tCInvoice.tlCInvoiceIsForLegalDoc (ilCInvoiceIsForLegalDoc),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then do:
if ilHandleCommunicationWithJE = true
then do:
<I-75 {bFcCloseInstance
&CLASS = "BJournalEntry"}>
end.
return.
end.
end. /* ilIsTaxable */
/* PostingLine on CIREC account */
<M-112 run CreateCIPosting2
(input iiCInvoiceId (iiCInvoiceId),
input iiPeriodYear (iiPeriodYear),
input iiPeriodPeriod (iiPeriodPeriod),
input itPostingDate (itPostingDate),
input iiCreditorId (iiCreditorId),
input icCreditorCode (icCreditorCode),
input icCInvoiceType (icCInvoiceType),
input icDivisionCode (icDivisionCode),
input icJournalCode (icJournalCode),
input iiVoucher (iiVoucher),
input itTaxPointDate (itTaxPointDate),
input icReference (icReference),
input icDescription (icDescription),
input idInvoiceAmountTC (idInvoiceAmountTC),
input idInvoiceAmountLC (idInvoiceAmountLC),
input idInvoiceAmountCC (idInvoiceAmountCC),
input icCurrencyCode (icCurrencyCode),
input idExchangeRate (idExchangeRate),
input idExchangeRateScale (idExchangeRateScale),
input icCIText (icCIText),
input icPostingType (icPostingType),
input icGlCode (icGlCode),
input icCostCentreCode (icCostCentreCode),
input icProjectCode (icProjectCode),
input ilOnlyControlAccount (ilOnlyControlAccount),
input icShipToCountryCode (icShipToCountryCode),
input icTxclTaxCls (icTxclTaxCls),
input icTxuTaxUsage (icTxuTaxUsage),
input icTxenvTaxEnv (icTxenvTaxEnv),
input icPaymentCondition (icPaymentCondition),
input ilIsTaxInCityFromShipTo (ilIsTaxInCityFromShipTo),
input icPoNbr (icPoNbr),
input ilIsTaxable (ilIsTaxable),
input icControlCostCentreCode (icControlCostCentreCode),
input icControlProjectCode (icControlProjectCode),
input iiShipFromAddressId (iiShipFromAddressId),
input iiShipToAddressId (iiShipToAddressId),
input ilIsLogisticMatching (ilIsLogisticMatching),
input ilGetDefaultSafs (ilGetDefaultSafs),
input icBusinessRelationCode (icBusinessRelationCode),
input iiPrePayControlGLProfileId (iiPrePayControlGLProfileId),
input iiInvControlGLProfileId (iiInvControlGLProfileId),
input iiCnControlGLProfileId (iiCnControlGLProfileId),
input icCInvoiceRowid (icCInvoiceRowid),
input icBusinessRelationInterCoCode (icBusinessRelationInterCoCode),
input icShipFromCountryCode (icShipFromCountryCode),
input ilShipFromCountryIsEUCountry (ilShipFromCountryIsEUCountry),
input icCreditorTaxZone (icCreditorTaxZone),
input ilIsInitialStatus (ilIsInitialStatus),
input-output tApiCInvoiceVat (tApiCInvoiceVat),
input tDefaultSafsCI (tDefaultSafsCI),
input ilHandleCommunicationWithJE (ilHandleCommunicationWithJE),
input-output biBJournalEntryId (biBJournalEntryId),
input-output biPostingId (biPostingId),
input vcRowid (icRowId),
input viControlPostingLineId (iiControlPostingLineId),
input itInvoiceDate (itInvoiceDate),
input idExchangeRateCC (idCCExchangeRate),
input idExchangeRateScaleCC (idCCExchangeRateScale),
input tCInvoice.tlCInvoiceIsForLegalDoc (ilCInvoiceIsForLegalDoc),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.