Jump to content

tax issue in php


Recommended Posts

hello @LL,

is this piece of code correct ?

$showTotalShippingPrice=number_format($totalShippingPrice,2);
//calc tax
if(strtolower($memberDataArray['state'])=='il')
{
// Patch by someone
// Fixes "divide by zero" error.
if(!isset($discountedProdPrice) || $discountedProdPrice <= 0) {
$discountedProdPrice = 1;
}
if(!isset($totalProdPrice) || $totalProdPrice <= 0) {
$totalProdPrice = 1;
}
$discountFraction=$discountedProdPrice/$totalProdPrice;

$taxExclusionDiscountTotal=$taxExclusionRetailTotal;

$taxableAmount=$discountedProdPrice-$taxExclusionDiscountTotal;

$taxableAmount=number_format($taxableAmount,2);

$taxRate=.085;
$taxRate=.09;
$tmp=$taxRate*100;
$showTaxRate=number_Format($tmp, 2)."%";
$totalTax=number_format(($taxableAmount)*$taxRate, 2);

$totalTax=max(0,$totalTax); //with discounts, total tax can go negative

$showTotalTax=$totalTax;

if ($taxExclusionDiscountTotal>0)
{
$taxExclusionNotificationString="
- <SPAN style=color:green><SPAN style=font-size:120%>+</SPAN> $dollarSign$taxExclusionDiscountTotal non-taxable</SPAN>, $dollarSign$taxableAmount taxable at $showTaxRate
";
}
else
{
$taxExclusionNotificationString="
- $showTaxRate
";
}
if ($nonTaxableItemFound=='true')
{
$promotionMsg.="
<DIV class=processMsgSuccess>'+' (plus sign) signifies non-taxable item</DIV>
";
}
}
else
{
$totalTax=0;
$showTotalTax=number_format($totalTax, 2);
}

thanks

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...