project QadFinancials > class BCInvoice > method CreateCIPostingTax
Description
Create the tax posting for the di
Parameters
icRowId | input | character | Row ID |
iiPostingId | input | integer | Posting ID |
itTaxPointDate | input | date | Tax Point Date |
icCInvoiceRowId | input | character | |
icCIText | input | character | CI Text |
icCurrencyCode | input | character | Currency Code |
iiCurrencyId | input | integer | Currency ID |
icExchangeRateType | input | character | Exchange Rate Type |
idExchangeRate | input | decimal | Exchange Rate |
idExchangeRateScale | input | decimal | Scale factor of exchange rate |
idVatFullDebitTC | input | decimal | Vat Full Debit TC |
idVatFullCreditTC | input | decimal | Vat Fiull Credit TC |
icCInvoiceType | input | character | Cinvoice Type |
icDivisionCode | input | character | Division Code |
icVatCurrencyCode | input | character | Vat Currency Code |
iiVatCurrencyId | input | integer | Vat Currency ID |
idVatExchangeRate | input | decimal | Vat Exchange Rate |
idVatExchangeRateScale | input | decimal | Vat Exchange Rate Scale |
icShipFromCountryCode | input | character | country code of the ship from address |
icShipToCountryCode | input | character | Country code of the ship to address |
ilShipFromCountryIsEUCountry | input | logical | Is the country code of the ship from address an EU country ? |
ilShipToCountryIsEUCountry | input | logical | Is the country code of the ship to address an EU country ? |
icTxclTaxCls | input | character | Tax Class of the creditor, or if the tax class on the tax tab is filled, then this one |
icTxuTaxUsage | input | character | Tax usage of the creditor, or if the tax usage on the tax tab is filled, then this one |
icCreditorTxzTaxZone | input | character | Tax zone of Creditor |
icShipToTxzTaxZone | input | character | Tax Zone of the Ship To Address |
icTxenvTaxEnv | input | character | Tax Environment of the tax tab, if not filled yet, give the default value then |
iiVoucher | input | integer | Voucher of the invoice |
icPaymentCondition | input | character | Payment Condition of the invoice |
ilIsTaxInCityFromShipTo | input | logical | tax in city flag from the ship to address |
icControlGLCode | input | character | Control GL Account |
iiMasterId | input | integer | Master Id : id of customer, supplier, ... |
iiTransactionId | input | integer | Transaction id : id of customer invoice, supplier invoice, .... |
icPoNbr | input | character | |
ilIsTaxable | input | logical | Is taxable flag |
icCostCentreCode | input | character | |
icProjectCode | 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 ? |
idInvoiceAmountTC | input | decimal | Invoice Amount TC |
icShipFromTaxIDFeder | input | character | Tax ID Federal of the ship from address |
icShipFromTaxIDState | input | character | Tax ID State of the ship from address |
icShipFromTaxIDMisc1 | input | character | Tax ID Misc1 of the ship from address |
icShipFromTaxIDMisc2 | input | character | Tax ID Misc2 of the ship from address |
icShipFromTaxIDMisc3 | input | character | Tax ID Misc3 of the ship from address |
icShipToTaxIDFeder | input | character | Tax ID Federal of ship to address |
icShipToTaxIDState | input | character | Tax ID State of the ship to address |
icShipToTaxIDMisc1 | input | character | Tax ID Misc1 of the ship to address |
icShipToTaxIDMisc2 | input | character | Tax ID Misc2 of the ship to address |
icShipToTaxIDMisc3 | input | character | Tax ID Misc3 of the ship to address |
iiShipToTaxDeclaration | input | integer | Tax Declaration of the ship to address |
itInvoiceDate | input | date | |
idCCExchangeRate | input | decimal | |
idCCExchangeRateScale | input | decimal | |
icCInvoiceReference | input | character | |
ilCInvoiceIsERS | input | logical | |
ilCInvoiceIsForLegalDoc | input | logical | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program3/bcinvoice.p)
if vlCompanyPropertyIsAPUseInvDate = true
then
assign vtExchangeRateDate = itInvoiceDate.
else
assign vtExchangeRateDate = ?.
if icPoNbr <> "":U and icPoNbr <> ?
then do:
<Q-2 run PurchaseOrderDetailForTax (all) (Read) (NoCache)
(input vcDomainCode, (Domain)
input icPoNbr, (PoNbr)
output dataset tqPurchaseOrderDetailForTax) in BMfgPO >
for each tqPurchaseOrderDetailForTax where
tqPurchaseOrderDetailForTax.tcpo_domain = vcDomainCode and
tqPurchaseOrderDetailForTax.tcpo_nbr = icPoNbr and
(tqPurchaseOrderDetailForTax.tctx2d_tr_type = {&VATTAXTRANSACTIONTYPE-PO} or
tqPurchaseOrderDetailForTax.tctx2d_tr_type = {&VATTAXTRANSACTIONTYPE-PORECEIPT}) and
(tqPurchaseOrderDetailForTax.tltx2_rcpt_tax_point = true or
tqPurchaseOrderDetailForTax.tltx2_usage_tax_point = true) :
<Q-3 run GLByGLSystemType (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input {&GLSYSTEMTYPE-VOUPAY}, (GLSystemTypeCode)
input {&GLTYPECODE-SYST}, (GlTypeCode)
input ?, (GlIsDivisionAccount)
output dataset tqGLByGLSystemType) in BGL >
find first tqGLByGLSystemType
no-error.
if not available tqGLByGLSystemType
then do:
assign oiReturnStatus = -1.
<M-5 run SetMessage
(input trim(#T-4'PO Receipt Account &1 is not defined in the system.':250(55212)T-4#) (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-5490':U (icFcMsgNumber),
input '':u (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
leave.
end.
assign vcGLCode = tqGLByGLSystemType.tcGLCode.
leave.
end.
end.
if oiReturnStatus < 0 then return.
if idInvoiceAmountTC <> 0 and
not can-find ( first tApiCInvoiceVat where
tApiCInvoiceVat.tc_ParentRowid = icCInvoiceRowId and
tApiCInvoiceVat.tc_Status <> "D":U and
(tApiCInvoiceVat.CInvoiceVatVatDebitTC <> 0 or
tApiCInvoiceVat.CInvoiceVatVatCreditTC <> 0)) and
not can-find ( first tApiCInvoiceVat where
tApiCInvoiceVat.tc_ParentRowid = icCInvoiceRowId and
tApiCInvoiceVat.tc_Status <> "D":U and
tApiCInvoiceVat.CInvoiceVatVatDebitTC = 0 and
tApiCInvoiceVat.CInvoiceVatVatCreditTC = 0 and
tApiCInvoiceVat.TxtyTaxType <> {&VATTAXTYPE-NONTAX})
then return.
for each tApiCInvoiceVat where
tApiCInvoiceVat.tc_ParentRowid = icCInvoiceRowId and
tApiCInvoiceVat.tc_Status <> "D":U
break by tApiCInvoiceVat.TxclTaxCls
by tApiCInvoiceVat.TxuTaxUsage
by tApiCInvoiceVat.TxenvTaxEnv
by tApiCInvoiceVat.TxtyTaxType
by tApiCInvoiceVat.tcVatCode :
if first-of (tApiCInvoiceVat.tcVatCode)
then do:
assign vdDebitAmountTC = 0
vdCreditAmountTC = 0.
empty temp-table tTaxDetailCInvoice.
end.
/* initialise it here, and it will be correctly filled in last-of */
assign tApiCInvoiceVat.PostingVat_ID = 0.
/* Because we can now change the SC exchange rate per tax line on the supplier invoice tax tab
(by editing the sc tax amounts DR/CR) - use the tax line SC rate to calculate amounts */
if tApiCInvoiceVat.tdCInvoiceVatExchangeRateCC <> ? and tApiCInvoiceVat.tdCInvoiceVatExchangeRateCC <> 0
then do:
if tApiCInvoiceVat.tdCInvoiceVatExchangeRateCC <> idCCExchangeRate
then assign idCCExchangeRate = tApiCInvoiceVat.tdCInvoiceVatExchangeRateCC.
end.
if last-of(tApiCInvoiceVat.tcVatCode) and
tApiCInvoiceVat.CInvoiceVatIsAccrRcpUs = false
then do:
/* When we call the integration for BCInvoice and we pass in all information about the taxes etc then - in some very odd configuration of the addresses - then we run */
/* into an error that the TransactionType is unknown. The solution is to set it to the most common value for BCInvoice ('Purchase') when this is unknown at this point */
if icShipFromCountryCode = icShipToCountryCode and
ilShipFromCountryIsEUCountry = ilShipToCountryIsEUCountry
then assign vcTransactionType = {&VATTRANSACTIONTYPE-PURCHASE}.
else if icShipFromCountryCode <> icShipToCountryCode
then assign vcTransactionType = if ilShipFromCountryIsEUCountry = yes and
ilShipFromCountryIsEUCountry = ilShipToCountryIsEUCountry
then {&VATTRANSACTIONTYPE-ACQUISITION}
else {&VATTRANSACTIONTYPE-IMPORT}.
else assign vcTransactionType = "":U.
if vcTransactionType = "":U or
vcTransactionType = ?
then assign vcTransactionType = {&VATTRANSACTIONTYPE-PURCHASE}.
assign vdVatNonRecTaxAmtTC = tApiCInvoiceVat.CInvoiceVatNonRecTaxAmtTC
vdVatNonRecTaxAmtLC = vdVatNonRecTaxAmtTC * idExchangeRate * idExchangeRateScale
vdVatNonRecTaxAmtCC = vdVatNonRecTaxAmtTC * idCCExchangeRate * idCCExchangeRateScale.
if icCInvoiceType = {&INVOICETYPE-INVOICE} or
icCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
then assign vdVatDebitTC = tApiCInvoiceVat.CInvoiceVatVatDebitTC - vdVatNonRecTaxAmtTC
vdVatCreditTC = 0
vdVatDebitLC = <M-30 GetAmountPreferencingExpected
(input if ilCInvoiceIsERS then tApiCInvoiceVat.CInvoiceVatVatDebitLC - vdVatNonRecTaxAmtLC else 0 (idExpectedAmount),
input vdVatDebitTC * idExchangeRate * idExchangeRateScale (idCalculatedAmount),
input viCompanyLCId (iiCurrencyId)) in BCInvoice>
vdVatCreditLC = 0
vdVatDebitCC = <M-91 GetAmountPreferencingExpected
(input if ilCInvoiceIsERS then tApiCInvoiceVat.CInvoiceVatVatDebitCC - vdVatNonRecTaxAmtCC else 0 (idExpectedAmount),
input vdVatDebitTC * idCCExchangeRate * idCCExchangeRateScale (idCalculatedAmount),
input viCompanyCCId (iiCurrencyId)) in BCInvoice>
vdVatCreditCC = 0.
else assign vdVatDebitTC = 0
vdVatCreditTC = tApiCInvoiceVat.CInvoiceVatVatCreditTC - vdVatNonRecTaxAmtTC
vdVatDebitLC = 0
vdVatCreditLC = <M-72 GetAmountPreferencingExpected
(input if ilCInvoiceIsERS then tApiCInvoiceVat.CInvoiceVatVatCreditLC - vdVatNonRecTaxAmtLC else 0 (idExpectedAmount),
input vdVatCreditTC * idExchangeRate * idExchangeRateScale (idCalculatedAmount),
input viCompanyLCId (iiCurrencyId)) in BCInvoice>
vdVatDebitCC = 0
vdVatCreditCC = <M-34 GetAmountPreferencingExpected
(input if ilCInvoiceIsERS then tApiCInvoiceVat.CInvoiceVatVatCreditCC - vdVatNonRecTaxAmtCC else 0 (idExpectedAmount),
input vdVatCreditTC * idCCExchangeRate * idCCExchangeRateScale (idCalculatedAmount),
input viCompanyCCId (iiCurrencyId)) in BCInvoice>.
<M-6 run AddPostingLineTax
(input icRowId (icPostingTcRowid),
input itTaxPointDate (itTaxPointDate),
input icCIText (icPostingLineText),
input icCurrencyCode (icCurrencyCode),
input tApiCInvoiceVat.tcVatInOut (icPostingVatInOut),
input tApiCInvoiceVat.tcVatCode (icPostingVatCode),
input tApiCInvoiceVat.tcDomainCode (icPostingVatDomain),
input idExchangeRate (idExchangeRate),
input idExchangeRateScale (idExchangeRateScale),
input icExchangeRateType (icExchangeRateType),
input idCCExchangeRate (idCCExchangeRate),
input idCCExchangeRateScale (idCCExchangeRateScale),
input vcTransactionType (icTransactionType),
input tApiCInvoiceVat.CInvoiceVatTaxTrType (icTaxTransactionType),
input tApiCInvoiceVat.CInvoiceVatVatBaseDebitTC (idBaseDebitTC),
input tApiCInvoiceVat.CInvoiceVatVatBaseCreditTC (idBaseCreditTC),
input tApiCInvoiceVat.CInvoiceVatVatBaseDebitLC (idBaseDebitLC),
input tApiCInvoiceVat.CInvoiceVatVatBaseCreditLC (idBaseCreditLC),
input tApiCInvoiceVat.CInvoiceVatVatBaseDebitCC (idBaseDebitCC),
input tApiCInvoiceVat.CInvoiceVatVatBaseCreditCC (idBaseCreditCC),
input vdVatDebitTC (idVatDebitTC),
input vdVatCreditTC (idVatCreditTC),
input vdVatDebitLC (idVatDebitLC),
input vdVatCreditLC (idVatCreditLC),
input vdVatDebitCC (idVatDebitCC),
input vdVatCreditCC (idVatCreditCC),
input if tApiCInvoiceVat.CInvoiceVatIsSuspDel = true then tApiCInvoiceVat.tcSuspDelTaxGLCode else tApiCInvoiceVat.tcNormalTaxGLCode (icNormalTaxGLCode),
input if tApiCInvoiceVat.CInvoiceVatIsSuspDel = true then tApiCInvoiceVat.tcSuspDelTaxDivisionCode else tApiCInvoiceVat.tcNormalTaxDivisionCode (icNormalTaxDivisionCode),
input false (ilNormalTaxIsAlreadyAbsRet),
input if tApiCInvoiceVat.CInvoiceVatNonRecTaxAmtTC = 0 then tApiCInvoiceVat.tcAbsRetTaxGLCode else ? (icAbsRetTaxGLCode),
input if tApiCInvoiceVat.CInvoiceVatNonRecTaxAmtTC = 0 then tApiCInvoiceVat.tcAbsRetTaxDivisionCode else ? (icAbsRetTaxDivisionCode),
input icCreditorTxzTaxZone (icFromTaxZone),
input icshipToTxzTaxZone (icToTaxZone),
input tApiCInvoiceVat.TxenvTaxEnv (icTaxEnvrionment),
input tApiCInvoiceVat.CInvoiceVatIsTaxable (ilIsTaxable),
input tApiCInvoiceVat.TxclTaxCls (icTaxClass),
input tApiCInvoiceVat.TxuTaxUsage (icTaxUsage),
input tApiCInvoiceVat.TxtyTaxType (icTaxType),
input tApiCInvoiceVat.CInvoiceVatIsRevCharge (ilTaxIsReverseChargeDomestic),
input iiShipFromAddressId (iiTaxAddressID),
input icShipFromTaxIDFeder (icTaxIDFeder),
input icShipFromTaxIDState (icTaxIDState),
input icShipFromTaxIDMisc1 (icTaxIDMisc1),
input icShipFromTaxIDMisc2 (icTaxIDMisc2),
input icShipFromTaxIDMisc3 (icTaxIDMisc3),
input iiShipToAddressId (iiOwnAddressID),
input icShipToTaxIDFeder (icOwnTaxIDFeder),
input icShipToTaxIDState (icOwnTaxIDState),
input icShipToTaxIDMisc1 (icOwnTaxIDMisc1),
input icShipToTaxIDMisc2 (icOwnTaxIDMisc2),
input icShipToTaxIDMisc3 (icOwnTaxIDMisc3),
input iiShipToTaxDeclaration (iiOwnTaxIDDeclarat),
input tApiCInvoiceVat.CInvoiceVatIsSuspDel (ilIsSuspDel),
output viVatPostingLineId (oiNormalTaxPostingLineID),
output vcDummy (ocNormalTaxPostingLineTcRowid),
output viDummyPostingLineID (oiAbsRetTaxPostingLineID),
output vcDummy (ocAbsRetTaxPostingLineTcRowid),
output tApiCInvoiceVat.PostingVat_ID (oiNormalTaxPostingVatID),
input false (ilLinkedCrCyDaemonReqExists),
input no (ilCalledFromMoveSuspDelTax),
input vtExchangeRateDate (itInvoiceExchangeRateDate),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
if tApiCInvoiceVat.tc_Status = "":U and
tApiCInvoiceVat.PostingVat_ID <> 0
then assign tApiCInvoiceVat.tc_Status = "C":U.
/* I19 requirement for Brazil ============================================================== */
/* Update posting line to contain legal document number filled in */
/* ========================================================================================= */
if ilCInvoiceIsForLegalDoc = true
then do:
<M-51 run SetPostingLineLegalDocNumber
(input ? (icPostingLineTcRowID),
input viVatPostingLineId (iiPostingLineID),
input entry(1, icCInvoiceReference) (icLegalDocumentNumber),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
end. /* if ilCInvoiceIsForLegalDoc */
/* if retained taxes, accrue at receipt yes and % recoverable <> 100 */
if tApiCInvoiceVat.CInvoiceVatIsAbsRet and tApiCInvoiceVat.CInvoiceVatNonRecTaxAmtTC <> 0
then do:
/* recalculate the lc values iso using the lc fields, because when you change manually the base amount, the tax lc are not calculated */
/* from the integration point LC values can be calcualted already. So try to used them when they have expected value */
/* This can prevent some rounding issues */
if icCInvoiceType = {&INVOICETYPE-INVOICE} or icCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
then assign vdVatDebitTC = 0
vdVatCreditTC = tApiCInvoiceVat.CInvoiceVatVatCreditTC
vdVatDebitLC = 0
vdVatCreditLC = <M-94 GetAmountPreferencingExpected
(input if ilCInvoiceIsERS then tApiCInvoiceVat.CInvoiceVatVatCreditLC else 0 (idExpectedAmount),
input vdVatCreditTC * idExchangeRate * idExchangeRateScale (idCalculatedAmount),
input viCompanyLCId (iiCurrencyId)) in BCInvoice>
vdVatDebitCC = 0
vdVatCreditCC = <M-80 GetAmountPreferencingExpected
(input if ilCInvoiceIsERS then tApiCInvoiceVat.CInvoiceVatVatCreditCC else 0 (idExpectedAmount),
input vdVatCreditTC * idCCExchangeRate * idCCExchangeRateScale (idCalculatedAmount),
input viCompanyCCId (iiCurrencyId)) in BCInvoice>.
else assign vdVatDebitTC = tApiCInvoiceVat.CInvoiceVatVatDebitTC
vdVatCreditTC = 0
vdVatDebitLC = <M-87 GetAmountPreferencingExpected
(input if ilCInvoiceIsERS then tApiCInvoiceVat.CInvoiceVatVatDebitLC else 0 (idExpectedAmount),
input vdVatDebitTC * idExchangeRate * idExchangeRateScale (idCalculatedAmount),
input viCompanyLCId (iiCurrencyId)) in BCInvoice>
vdVatCreditLC = 0
vdVatDebitCC = <M-57 GetAmountPreferencingExpected
(input if ilCInvoiceIsERS then tApiCInvoiceVat.CInvoiceVatVatDebitCC else 0 (idExpectedAmount),
input vdVatDebitTC * idCCExchangeRate * idCCExchangeRateScale (idCalculatedAmount),
input viCompanyCCId (iiCurrencyId)) in BCInvoice>
vdVatCreditCC = 0.
<M-11 run AddPostingLineTax
(input icRowId (icPostingTcRowid),
input itTaxPointDate (itTaxPointDate),
input icCIText (icPostingLineText),
input icCurrencyCode (icCurrencyCode),
input tApiCInvoiceVat.tcVatInOut (icPostingVatInOut),
input tApiCInvoiceVat.tcVatCode (icPostingVatCode),
input tApiCInvoiceVat.tcDomainCode (icPostingVatDomain),
input idExchangeRate (idExchangeRate),
input idExchangeRateScale (idExchangeRateScale),
input icExchangeRateType (icExchangeRateType),
input idCCExchangeRate (idCCExchangeRate),
input idCCExchangeRateScale (idCCExchangeRateScale),
input vcTransactionType (icTransactionType),
input tApiCInvoiceVat.CInvoiceVatTaxTrType (icTaxTransactionType),
input tApiCInvoiceVat.CInvoiceVatVatBaseCreditTC (idBaseDebitTC),
input tApiCInvoiceVat.CInvoiceVatVatBaseDebitTC (idBaseCreditTC),
input tApiCInvoiceVat.CInvoiceVatVatBaseCreditLC (idBaseDebitLC),
input tApiCInvoiceVat.CInvoiceVatVatBaseDebitLC (idBaseCreditLC),
input tApiCInvoiceVat.CInvoiceVatVatBaseCreditCC (idBaseDebitCC),
input tApiCInvoiceVat.CInvoiceVatVatBaseDebitCC (idBaseCreditCC),
input vdVatDebitTC (idVatDebitTC),
input vdVatCreditTC (idVatCreditTC),
input vdVatDebitLC (idVatDebitLC),
input vdVatCreditLC (idVatCreditLC),
input vdVatDebitCC (idVatDebitCC),
input vdVatCreditCC (idVatCreditCC),
input tApiCInvoiceVat.tcAbsRetTaxGLCode (icNormalTaxGLCode),
input tApiCInvoiceVat.tcAbsRetTaxDivisionCode (icNormalTaxDivisionCode),
input true (ilNormalTaxIsAlreadyAbsRet),
input ? (icAbsRetTaxGLCode),
input ? (icAbsRetTaxDivisionCode),
input icCreditorTxzTaxZone (icFromTaxZone),
input icshipToTxzTaxZone (icToTaxZone),
input tApiCInvoiceVat.TxenvTaxEnv (icTaxEnvrionment),
input tApiCInvoiceVat.CInvoiceVatIsTaxable (ilIsTaxable),
input tApiCInvoiceVat.TxclTaxCls (icTaxClass),
input tApiCInvoiceVat.TxuTaxUsage (icTaxUsage),
input tApiCInvoiceVat.TxtyTaxType (icTaxType),
input tApiCInvoiceVat.CInvoiceVatIsRevCharge (ilTaxIsReverseChargeDomestic),
input iiShipFromAddressId (iiTaxAddressID),
input icShipFromTaxIDFeder (icTaxIDFeder),
input icShipFromTaxIDState (icTaxIDState),
input icShipFromTaxIDMisc1 (icTaxIDMisc1),
input icShipFromTaxIDMisc2 (icTaxIDMisc2),
input icShipFromTaxIDMisc3 (icTaxIDMisc3),
input iiShipToAddressId (iiOwnAddressID),
input icShipToTaxIDFeder (icOwnTaxIDFeder),
input icShipToTaxIDState (icOwnTaxIDState),
input icShipToTaxIDMisc1 (icOwnTaxIDMisc1),
input icShipToTaxIDMisc2 (icOwnTaxIDMisc2),
input icShipToTaxIDMisc3 (icOwnTaxIDMisc3),
input iiShipToTaxDeclaration (iiOwnTaxIDDeclarat),
input ? (ilIsSuspDel),
output viVatPostingLineId (oiNormalTaxPostingLineID),
output vcDummy (ocNormalTaxPostingLineTcRowid),
output viDummyPostingLineID (oiAbsRetTaxPostingLineID),
output vcDummy (ocAbsRetTaxPostingLineTcRowid),
output viDummy (oiNormalTaxPostingVatID),
input false (ilLinkedCrCyDaemonReqExists),
input no (ilCalledFromMoveSuspDelTax),
input vtExchangeRateDate (itInvoiceExchangeRateDate),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
/* I19 requirement for Brazil ============================================================== */
/* Update posting line to contain legal document number filled in */
/* ========================================================================================= */
if ilCInvoiceIsForLegalDoc = true
then do:
<M-48 run SetPostingLineLegalDocNumber
(input ? (icPostingLineTcRowID),
input viVatPostingLineId (iiPostingLineID),
input entry(1, icCInvoiceReference) (icLegalDocumentNumber),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
end. /* if ilCInvoiceIsForLegalDoc */
end.
end.
end.