project QadFinancials > class BBusinessRelation > method GetVatNumber

Description

Give the vat number back in the right format


Parameters


iiCountryIdinputintegercountry ID
icCountryCodeinputcharactercountrycode
icVatNumberinputcharacterTax Number
ocVatNumberShortoutputcharacterVat Number to write into the database
ocVatNumberLongoutputcharacterVat Number to show on User Interface
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program3/bbusinessrelation.p)

/* ==================== */
    /* Skip Unknown-values  */
    /* ==================== */
    if icCountryCode = ? then assign icCountryCode = "":U.
    if iiCountryId   = ? then assign iiCountryId   = 0.

    /* ===================================================== */
    /* if no country defined, give the given vat number back */
    /* ===================================================== */
    if iiCountryId = 0 and icCountryCode = "":U 
    then do:
        assign ocVatNumberLong = icVatNumber.
        return.
    end.

    /* ======================================================== */
    /* check the vat number and get it back in the right format */
    /* ======================================================== */
    assign vhFcComponent = ?.
    <M-1 run ApiCheckVatNumber
       (input  iiCountryId (iiCountryId), 
        input  icCountryCode (icCountryCode), 
        input  icVatNumber (icVatNumber), 
        input  false (ilMessage), 
        output ocVatNumberShort (ocVatNumberShort), 
        output ocVatNumberLong (ocVatNumberLong), 
        output viFcReturnSuper (oiReturnStatus)) in BCountry>
    if viFcReturnSuper < 0 or 
      (viFcReturnSuper > 0 and oiReturnStatus = 0)
    then assign oiReturnStatus = viFcReturnSuper.