| icCurrencyCode | input | character | Tax Currency |
| icTransactionType | input | character | Transaction Type |
| icDocumentReference | input | character | Document Reference : invoice number, voucher number, ... |
| icDocumentNumber | input | character | Document Number : eg po number, payment number, ... |
| ilTaxable | input | logical | |
| ilTaxIsIncluded | input | logical | is the Amount with taxes or without ? |
| itTaxPointDate | input | date | tax point date |
| itPostingDate | input | date | posting date |
| icTaxEnvCode | input | character | Tax Environment |
| icFromTaxZoneCode | input | character | From Tax Zone : Tax zone of the company or tax zone of default site of creditor/debtor |
| icToTaxZoneCode | input | character | To Tax Zone : Tax Zone of creditor/debtor or Tax Zone of ship-to site of Invoice |
| icTaxClassCode | input | character | Tax Class |
| icTaxUsageCode | input | character | Tax Usage |
| idAmountTC | input | decimal | Amount TC : invoice amount with or without taxes, you can indicate that by setting the input parameter ilTaxIsIncluded |
| idExchangeRateScale | input | decimal | Scale factor of the exchange rate |
| idExchangeRate | input | decimal | exchange rate |
| icCompanyCode | input | character | Company code of the invoice |
| idAdjustmentFactor | input | decimal | Adjustment Factor |
| idPaymentConditionPercentage | input | decimal | discount percentage |
| ilIsTaxInCityFromCompany | input | logical | In city flag from the Headoffice address of the company |
| ilIsTaxInCityFromShipTo | input | logical | In city flag from the headoffice address of the ship to |
| iiShipToAddressID | input | integer | Address ID of ShipTo |
| iiShipFromAddressID | input | integer | Ship from Address ID |
| icShipToAddrLine1 | input | character | |
| icShipToAddrLine2 | input | character | |
| icShipToAddrLine3 | input | character | |
| icShipToAddrCity | input | character | |
| icShipToAddrState | input | character | |
| icShipToAddrZip | input | character | |
| icShipToAddrCountry | input | character | |
| icShipToAddrCounty | input | character | |
| icCustomerCode | input | character | |
| ilIsAvataxCommit | input | logical | If true then the tax details will be committed |
| icInvoiceType | input | character | |
| tTaxParametersExtended | output | temp-table | |
| tTaxDetailDataExt | input-output | temp-table | output records with all tax lines to post in it |
| oiReturnStatus | output | integer | Return status of the method. |
QadFinancials
if oiReturnStatus = 0 then oiReturnStatus = -98.
empty temp-table tTaxParametersExtended.
empty temp-table tTaxParameters.
if vlUseExtendedTaxParams
then do:
create tTaxParametersExtended.
assign
tTaxParametersExtended.tcCurrencyCode = icCurrencyCode
tTaxParametersExtended.tcTransactionType = icTransactionType
tTaxParametersExtended.tcDocumentReference = icDocumentReference
tTaxParametersExtended.tcDocumentNumber = icDocumentNumber
tTaxParametersExtended.tcTrailerCode = vcCompanyCode
tTaxParametersExtended.tlTaxable = ilTaxable
tTaxParametersExtended.tlTaxIsIncluded = ilTaxIsIncluded
tTaxParametersExtended.ttTaxPointDate = itTaxPointDate
tTaxParametersExtended.ttPostingDate = itPostingDate
tTaxParametersExtended.tcTaxEnvCode = icTaxEnvCode
tTaxParametersExtended.tcFromTaxZoneCode = icFromTaxZoneCode
tTaxParametersExtended.tcToTaxZoneCode = icToTaxZoneCode
tTaxParametersExtended.tcTaxClassCode = icTaxClassCode
tTaxParametersExtended.tcTaxUsageCode = icTaxUsageCode
tTaxParametersExtended.tdAmountTC = idAmountTC
tTaxParametersExtended.tdExchangeRateScale = idExchangeRateScale
tTaxParametersExtended.tdExchangeRate = idExchangeRate
tTaxParametersExtended.tcCompanyCode = icCompanyCode
tTaxParametersExtended.tdAdjustmentFactor = idAdjustmentFactor
tTaxParametersExtended.tdPaymentConditionPercentage = idPaymentConditionPercentage
tTaxParametersExtended.tlIsTaxInCityFromCompany = ilIsTaxInCityFromCompany
tTaxParametersExtended.tlIsTaxInCityFromShipTo = ilIsTaxInCityFromShipTo
tTaxParametersExtended.tiShipFromAddressID = iiShipFromAddressID
tTaxParametersExtended.tiShipToAddressID = iiShipToAddressID
tTaxParametersExtended.tcShipToAddrLine1 = icShipToAddrLine1
tTaxParametersExtended.tcShipToAddrLine2 = icShipToAddrLine2
tTaxParametersExtended.tcShipToAddrLine3 = icShipToAddrLine3
tTaxParametersExtended.tcShipToAddrCity = icShipToAddrCity
tTaxParametersExtended.tcShipToAddrState = icShipToAddrState
tTaxParametersExtended.tcShipToAddrZip = icShipToAddrZip
tTaxParametersExtended.tcShipToAddrCountry = icShipToAddrCountry
tTaxParametersExtended.tcShipToAddrCounty = icShipToAddrCounty
tTaxParametersExtended.tcCustomerCode = icCustomerCode
tTaxParametersExtended.tlIsAvataxCommit = ilIsAvataxCommit
tTaxParametersExtended.tcInvoiceType = icInvoiceType.
/* query BR if Avatax is on to retrieve the address ?*/
assign
vhTaxParamHandle = dataset tTaxParametersExtended:handle
vhTaxDetailHandle = dataset tTaxDetailDataExt:handle.
<M-17 run CalculateTax
(input-output vhTaxParamHandle (bhTaxParametersHandle),
input-output vhTaxDetailHandle (bhTaxDetailDataHandle),
output viFcReturnSuper (oiReturnStatus)) in PGTM>
end. /* if vlUseExtendedTaxParams */
else do:
empty temp-table tTaxDetailDataExt.
create tTaxParameters.
assign
tTaxParameters.tcCurrencyCode = icCurrencyCode
tTaxParameters.tcTransactionType = icTransactionType
tTaxParameters.tcDocumentReference = icDocumentReference
tTaxParameters.tcDocumentNumber = icDocumentNumber
tTaxParameters.tcTrailerCode = vcCompanyCode
tTaxParameters.tlTaxable = ilTaxable
tTaxParameters.tlTaxIsIncluded = ilTaxIsIncluded
tTaxParameters.ttTaxPointDate = itTaxPointDate
tTaxParameters.ttPostingDate = itPostingDate
tTaxParameters.tcTaxEnvCode = icTaxEnvCode
tTaxParameters.tcFromTaxZoneCode = icFromTaxZoneCode
tTaxParameters.tcToTaxZoneCode = icToTaxZoneCode
tTaxParameters.tcTaxClassCode = icTaxClassCode
tTaxParameters.tcTaxUsageCode = icTaxUsageCode
tTaxParameters.tdAmountTC = idAmountTC
tTaxParameters.tdExchangeRateScale = idExchangeRateScale
tTaxParameters.tdExchangeRate = idExchangeRate
tTaxParameters.tcCompanyCode = icCompanyCode
tTaxParameters.tdAdjustmentFactor = idAdjustmentFactor
tTaxParameters.tdPaymentConditionPercentage = idPaymentConditionPercentage
tTaxParameters.tlIsTaxInCityFromCompany = ilIsTaxInCityFromCompany
tTaxParameters.tlIsTaxInCityFromShipTo = ilIsTaxInCityFromShipTo.
assign
vhTaxParamHandle = dataset tTaxParameters:handle
vhTaxDetailHandle = dataset tTaxDetailData:handle.
<M-70 run CalculateTax
(input-output vhTaxParamHandle (bhTaxParametersHandle),
input-output vhTaxDetailHandle (bhTaxDetailDataHandle),
output viFcReturnSuper (oiReturnStatus)) in PGTM>
/* copy the tax detail to the extended dataset */
for each tTaxDetailData:
create tTaxDetailDataExt.
buffer-copy tTaxDetailData to tTaxDetailDataExt.
assign tTaxDetailDataExt.tlIsAvataxLine = false.
end. /* for each */
end. /* else */
if viFcReturnSuper <> 0 then
assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus = -98 then
assign oiReturnStatus = 0.