mynton

01-04-2011, 11:00 AM

Hi,

I am fairly new to this so please bare with me.

I have a php page that uses Javascript (I think) to calculate the percentage Insurance Premium Tax (IPT field) of a total.

I have located where the calculation occurs and can see that it take the total of a predefined amount and divides it by 21 to give me the 5% IPT tax. IPT has risen in the UK today to 6% so I need to know what I need to change the 21 to to give me an accurate IPT calculation.

Here's a snippet of the code. Can anyone help please? Is it 17.65?

////////////////////////////////////////////

// Motor Bike Calculations

////////////////////////////////////////////

$p = 3;

$q = 0;

while ($p < 6){

$base_array = mysql_fetch_row($result4);

// Motor Bikes

$risk_code = 2;

$ap = (0 + ($p));

$ipt_rate = $ipt_main;

$monthly_total = $pricing_row[$ap];

// Calculate IPT

$ipt_percentage = $monthly_total / 21;

$monthly_ipt = $ipt_percentage;

$base_cost = $base_array[0] + $dealer_loading;

$base_final = $base_cost;

$profit = $monthly_total - $base_cost - $monthly_ipt;

$monthly_total = number_format($monthly_total, 2, '.', '');

$monthly_ipt = number_format($monthly_ipt, 2, '.', '');

$base_final = number_format($base_final, 2, '.', '');

$profit = number_format($profit, 2, '.', '');

echo '

<tr align="center" bgcolor="#FFDDFF">

<td>';

if ($p == 3)

{

echo ('');

}

elseif ($p == 4)

{

echo ('UK');

}

elseif ($p == 5)

{

echo ('UK & European');

}

echo '</td>

<td>

<input name="';

if ($p == 3)

{

echo ('comprehensive_plus_'.$risk_code);

}

elseif ($p == 4)

{

echo ('comprehensive_'.$risk_code);

}

elseif ($p == 5)

{

echo ('driveline_plus_'.$risk_code);

}

echo '" type="text" value="'.$pricing_row[$ap].'" size="6" maxlength="6" class="smallinfo">

</td>

<td>'.$monthly_ipt.'</td>

<td>'.$base_final.'</td>

<td>'.$profit.'</td>

</tr>';

$q++;

$p++;

}

I am fairly new to this so please bare with me.

I have a php page that uses Javascript (I think) to calculate the percentage Insurance Premium Tax (IPT field) of a total.

I have located where the calculation occurs and can see that it take the total of a predefined amount and divides it by 21 to give me the 5% IPT tax. IPT has risen in the UK today to 6% so I need to know what I need to change the 21 to to give me an accurate IPT calculation.

Here's a snippet of the code. Can anyone help please? Is it 17.65?

////////////////////////////////////////////

// Motor Bike Calculations

////////////////////////////////////////////

$p = 3;

$q = 0;

while ($p < 6){

$base_array = mysql_fetch_row($result4);

// Motor Bikes

$risk_code = 2;

$ap = (0 + ($p));

$ipt_rate = $ipt_main;

$monthly_total = $pricing_row[$ap];

// Calculate IPT

$ipt_percentage = $monthly_total / 21;

$monthly_ipt = $ipt_percentage;

$base_cost = $base_array[0] + $dealer_loading;

$base_final = $base_cost;

$profit = $monthly_total - $base_cost - $monthly_ipt;

$monthly_total = number_format($monthly_total, 2, '.', '');

$monthly_ipt = number_format($monthly_ipt, 2, '.', '');

$base_final = number_format($base_final, 2, '.', '');

$profit = number_format($profit, 2, '.', '');

echo '

<tr align="center" bgcolor="#FFDDFF">

<td>';

if ($p == 3)

{

echo ('');

}

elseif ($p == 4)

{

echo ('UK');

}

elseif ($p == 5)

{

echo ('UK & European');

}

echo '</td>

<td>

<input name="';

if ($p == 3)

{

echo ('comprehensive_plus_'.$risk_code);

}

elseif ($p == 4)

{

echo ('comprehensive_'.$risk_code);

}

elseif ($p == 5)

{

echo ('driveline_plus_'.$risk_code);

}

echo '" type="text" value="'.$pricing_row[$ap].'" size="6" maxlength="6" class="smallinfo">

</td>

<td>'.$monthly_ipt.'</td>

<td>'.$base_final.'</td>

<td>'.$profit.'</td>

</tr>';

$q++;

$p++;

}