is this code correct? can someone give suggestion how to use this in mysql database to carry forward from the previous year & add to next year? thanx.
define('MAX_CARRY',10);
define('BASE_LEAVE', 20);
calc_carry($year_start, $year_used, $bonus_days)
{
return BASE_LEAVE + $bonus_days + min(MAX_CARRY, max($year_start-$year_used,0));
}