MSFN Forum: tax issue in php - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

tax issue in php tax issue in php Rate Topic: -----

#1 User is offline   kabucek 

  • Member
  • PipPip
  • Group: Members
  • Posts: 102
  • Joined: 07-August 06

Posted 10 September 2008 - 09:04 AM

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


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy