Debug::Text('Lowest ID: ' . $row_keys[0], __FILE__, __LINE__, __METHOD__, 10);
            $lowest_id = $row_keys[0];
            if ($lowest_id < 0) {
                $next_blank_id = $lowest_id - 1;
            } else {
                $next_blank_id = -1;
            }
            Debug::Text('Next Blank ID: ' . $next_blank_id, __FILE__, __LINE__, __METHOD__, 10);
            $data['milestone_rows'][$next_blank_id] = array('id' => $next_blank_id, 'length_of_service' => 0, 'accrual_rate' => 0, 'minimum_time' => 0, 'maximum_time' => 0);
        } elseif ($action != 'submit' and $action != 'change_type') {
            $data = array('type_id' => 10, 'minimum_employed_days' => 0, 'recalculate_start_date' => TTDate::getBeginMonthEpoch(time()), 'recalculate_end_date' => TTDate::getEndMonthEpoch(time()), 'milestone_rows' => array(-1 => array('id' => -1, 'length_of_service' => 0, 'accrual_rate' => '0.0000', 'minimum_time' => 0, 'maximum_time' => 0)));
        } else {
            if ($data['type_id'] == 20) {
                $data['recalculate_start_date'] = TTDate::getBeginMonthEpoch(time());
                $data['recalculate_end_date'] = TTDate::getEndMonthEpoch(time());
            }
        }
        //print_r($data);
        //Select box options;
        $data['type_options'] = $apf->getOptions('type');
        $data['apply_frequency_options'] = $apf->getOptions('apply_frequency');
        $data['month_options'] = TTDate::getMonthOfYearArray();
        $data['day_of_month_options'] = TTDate::getDayOfMonthArray();
        $data['day_of_week_options'] = TTDate::getDayOfWeekArray();
        $data['length_of_service_unit_options'] = $apmf->getOptions('length_of_service_unit');
        $smarty->assign_by_ref('data', $data);
        break;
}
$smarty->assign_by_ref('apf', $apf);
$smarty->assign_by_ref('apmf', $apmf);
$smarty->display('policy/EditAccrualPolicy.tpl');