# Round down discounted price to end with 0.99

I have used a rule to apply a discounts to prices. I now need to round the prices down to end in 0.99.

I have set up a module of "myfunctions" which includes a function called rounddownprice.

I now need to know how to call this function from a rule

function rounddownprice ($in) {

If ($in < 30.0) {

$roundprice = $in;

} Else {

$i1000 = Intval($in / 1000) * 1000;

$i100 = Intval($in / 100) * 100 - $i1000;

$i10 = Intval($in / 10) * 10 - $i100 - $i1000;

If ($i1000 == 0 and $i100 < 500) {

If ($i100 == 0) {

$i = $i10;

} Else {

$i = $i100;

If ($i10 < 30) {

} Else {

If ($i10 < 50) {

$i = $i + 30;

} Else {

If ($i10 < 80) {

$i = $i + 50;

} Else {

$i = $i + 80;

}

}

}

}

} Else {

$i = $i1000 + $i100;

If ($i10 < 50) {

} Else {

$i = $i + 50;

}

}

$roundprice = $i - 0.01;

}

return $roundprice;

}