project QadFinancials > class BCInvoice > method DefaultValuesOwnVatNumber

Description

default the own vat number


Parameters


ilShipToCountryIsEUCountryinputlogicalIs the country an EU country for ship to
icShipToAddressTaxIdStateinputcharacterTax Id State for the ship to address
icShipToCountryCodeinputcharactercountry code of the ship to address
ocOwnVatNumberoutputcharacterOwn Vat Number
ocOwnVatCountryCodeoutputcharacterOwn Vat Country Code
ocOwnVatCurrencyCodeoutputcharacterOwn Vat Currency Code
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BCInvoice.InitialValues


program code (program3/bcinvoice.p)

if ilShipToCountryIsEUCountry
then do:
    assign ocOwnVatNumber      = icShipToAddressTaxIdState
           ocOwnVatCountryCode = icShipToCountryCode.

    /* CEE VAT Currency ================ */
    /* Default Vat declaration currency  */
    /* ================================= */
    if icShipToCountryCode <> ? and
       icShipToCountryCode <> "":U
    then do:
        <Q-1 run CountryByCountry (all) (Read) (NoCache)
           (input ?, (CountryId)
            input icShipToCountryCode, (CountryCode)
            output dataset tqCountryByCountry) in BCountry >

        find first tqCountryByCountry where
                   tqCountryByCountry.tcCountryCode = icShipToCountryCode
                   no-error.

        if available tqCountryByCountry
        then assign ocOwnVatCurrencyCode = tqCountryByCountry.tcCurrencyCode.
    end.
end.