Hi,
Thanks for replying, sorry for the late replies but was busy with the
holidays.

Will look in to what you guys wrote, dont fully understand it  :-p so will
spend some time with it and if I run into any problems will get back to ya.

Cheers,
-Ryan




Basically, have an array of # of days per month. Do a quick compare given
the month for the # of days. For the sake of example, we'll assume the month
in question has 31 days. So, here's some givens:

$month_days = 31;
$former_plan_days = $current_date;
$new_plan_days = ($current_date - $month_days);


Now, to get the values:

$former_plan_bill = ($full_former_price * ($former_plan_days /
$month_days));

$new_plan_bill = ($full_new_price * ($new_plan_days / $month_days));

$total_month_bill = ($former_plan_bill + $new_plan_bill);


There you have it. This should work no matter if they get an "upgrade" or
"downgrade" in service because it just takes the ratio of days to get the
percentage of the price that's owed and then multiplies the full price to
get the percentage that's owed.

Make sense? :)



> >Problem, selling 4 packages rangeing from $27.50-$99.00 a month...the
> >subscriber can change anytime he wants from one package to the other
> >(upgrade), if so I have to calculate how many days he has is with us and
> >then he just pays the balance...
> >
> >eg:
> >if he is on the smallest package ($27.50)
> >and the month has 30 days,
> >  and 15 days are up,
> >(means 50% is used and that translates to 13.75$)
> >  and he wants to upgrade to the next higher package ($43.00) he just has
to
> >pay $29.25
> >
> >Can you give me a clue on how to calculate that depending on the 12
months
> >and 4 packages?
>
> basically just thinking out loud here... not sure if this is what we want,
but:
>
> $daysNotPaid = $maxDaysInPackage - $daysPaid;
> $pricePerDay = $newPrice / $daysInPackage;
> $priceToPay = $pricePerDay * $daysNotPaid;
>
> obviously, for this you need some code to pick up how many days have
> elapsed in the current month, and something to pull the number of days in
> the package along with the price.
>
> naturally you can shove this all into one calculation and save 2
variables:
>
> $priceToPay = ($newPrice / $daysInPackage) * ($maxDaysInPackage -
$daysPaid);
>
> and if some of it don't vary, you can change that into the appropriate
> values naturally...
>
> HTH
>
> Rene (not a math wiz, but I do calcs like this constantly in my Excel
macros)
>
> -- 
> Rene Brehmer
> aka Metalbunny
>
> http://metalbunny.net/
> References, tools, and other useful stuff...
>
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to