project QadFinancials > class PGTM > method CalculateTaxByParam


Parameters


icCurrencyCodeinputcharacterTax Currency
icTransactionTypeinputcharacterTransaction Type
icDocumentReferenceinputcharacterDocument Reference : invoice number, voucher number, ...
icDocumentNumberinputcharacterDocument Number : eg po number, payment number, ...
ilTaxableinputlogical
ilTaxIsIncludedinputlogicalis the Amount with taxes or without ?
itTaxPointDateinputdatetax point date
itPostingDateinputdateposting date
icTaxEnvCodeinputcharacterTax Environment
icFromTaxZoneCodeinputcharacterFrom Tax Zone : Tax zone of the company or tax zone of default site of creditor/debtor
icToTaxZoneCodeinputcharacterTo Tax Zone : Tax Zone of creditor/debtor or Tax Zone of ship-to site of Invoice
icTaxClassCodeinputcharacterTax Class
icTaxUsageCodeinputcharacterTax Usage
idAmountTCinputdecimalAmount TC : invoice amount with or without taxes, you can indicate that by setting the input parameter ilTaxIsIncluded
idExchangeRateScaleinputdecimalScale factor of the exchange rate
idExchangeRateinputdecimalexchange rate
icCompanyCodeinputcharacterCompany code of the invoice
idAdjustmentFactorinputdecimalAdjustment Factor
idPaymentConditionPercentageinputdecimaldiscount percentage
ilIsTaxInCityFromCompanyinputlogicalIn city flag from the Headoffice address of the company
ilIsTaxInCityFromShipToinputlogicalIn city flag from the headoffice address of the ship to
iiShipToAddressIDinputintegerAddress ID of ShipTo
iiShipFromAddressIDinputintegerShip from Address ID
icShipToAddrLine1inputcharacter
icShipToAddrLine2inputcharacter
icShipToAddrLine3inputcharacter
icShipToAddrCityinputcharacter
icShipToAddrStateinputcharacter
icShipToAddrZipinputcharacter
icShipToAddrCountryinputcharacter
icShipToAddrCountyinputcharacter
icCustomerCodeinputcharacter
ilIsAvataxCommitinputlogicalIf true then the tax details will be committed
icInvoiceTypeinputcharacter
tTaxParametersExtendedoutputtemp-table
tTaxDetailDataExtinput-outputtemp-tableoutput records with all tax lines to post in it
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BAPMatching.CreateAPMatchingLNTaxFromGTM
method BVAT.CalculateTax


program code (program1/pgtm.p)

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.