help with the formula to compute rate

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ehpratah
    New Member
    • Mar 2012
    • 35

    #1

    help with the formula to compute rate

    hi need a hand here..

    im having trouble in making my code work(well actually im not getting it)what i need to do is to compute the rate of vehicle that is rented..the only thing ta ht i came up is with the perday rate and the other 2 i cant find a way(i really sucks with formula )here is the thing..

    SELF - DRIVE RATES

    1. Minimum rental periods :
    Daily - 24 hours
    Weekly - 7 days
    Monthly - 30 days


    CAR
    Toyota VIOS 1.3 MT
    DAILY
    2,500

    WEEKLY
    15,000

    MONTHLY
    52,500


    and this is the code that i can came up

    Code:
    <?php
      $vehicle;
    $rday=$_POST['txtrday'];
    $pday=$_POST['txtpday'];
    	$phr;
    	$total;
    	$totalhr;
    	$pday;
    	$totald;
    	$totalday;
    	$rmonth;
    	$pmonth;
    	$totalm;
    	$totalmonth;
    	
    if($vehicle=="Toyota VIOS 1.3 MT")
    {
    	$perday=2500;
    	$permonth=52500;
    	$perweek=15000;
    
    	if($rday>$pday)
    		{
    		$totald=($rday)-($pday);
    		
    		}
    	else if($rday==$pday)
    		{
    		$totalday=$perday;
    		}
    	
    		
    	if($rmonth>$pmonth)
    		{
    		$totalm=$rmonth-$pmonth;
    		
    		
    		}
    	else if($rmonth==$pmonth)
    		{
    		$totalmonth;
    		}
    		
    		$totalday=$perday * $totald+2500;
    		$totalmonth=$totalm * $permonth;
    		$rate=$totalday + $totalmonth; 	
    }
    ?>
    please see attached image to see the output..in need of lot of help right now
    Attached Files
    Last edited by ehpratah; Jun 21 '12, 06:06 AM. Reason: forgot something to add
  • ehpratah
    New Member
    • Mar 2012
    • 35

    #2
    and if you need to see the actual web here is the link http://europcar1.com.ph/selfdrive.php

    just choose NO in the part that will ask you if you have a corporate accnt..thanks

    Comment

    Working...