I want to display the prices with the VAT (19%). help...

Discussion in 'PHP' started by Kyriakos, Apr 16, 2008.

  1. #1
    Hi guys,

    I have an asp page with some products. the prices are without VAT in my database. with the script below the VAT is added inside the page. it's working fine with ASP but i want to convert this to PHP for another web site. can you help me? my asp script:
    Price without VAT: <% =formatnumber(RS("price"),2) %> &euro; <br />
    + VAT 19%: <% vat=RS("price")*0.19 %> <%= formatnumber(vat,2) %> &euro; <br />
    Price with VAT = <%final=cdbl(fpa)+cdbl(RS("price"))%><%= formatnumber(final,2) %> &euro;
    PHP:
    thanks in advance.
     
    Kyriakos, Apr 16, 2008 IP
  2. m0nkeymafia

    m0nkeymafia Well-Known Member

    Messages:
    399
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    125
    #2
    Well you either write your own VAT function, or show us the ASP functions you are using so we can convert them :)

    FYI to add VAT @ 19% you do this:
    
    function AddVAT($number, $vat)
    {
       $multiplier = 1 + ($vat / 100);
       return round(($number * $multiplier), 2);
    }
    
    //Usage, add 19% VAT to £100
    echo AddVat(100,19);
    
    Code (markup):
     
    m0nkeymafia, Apr 16, 2008 IP
  3. Kyriakos

    Kyriakos Active Member

    Messages:
    155
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    where i should place this code? i'm a beginner with php.
     
    Kyriakos, Apr 16, 2008 IP
  4. CreativeClans

    CreativeClans Peon

    Messages:
    128
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    CreativeClans, Apr 16, 2008 IP