if ($data['start_date'] != '') {
        $data['start_date'] = TTDate::parseDateTime($data['start_date']);
    }
    if ($data['end_date'] != '') {
        $data['end_date'] = TTDate::parseDateTime($data['end_date']);
    }
}
$cdf = new CompanyDeductionFactory();
$action = Misc::findSubmitButton();
$action = strtolower($action);
switch ($action) {
    case 'submit':
        Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
        //Debug::setVerbosity(11);
        $cdf->StartTransaction();
        $cdf->setId($data['id']);
        $cdf->setCompany($current_company->getId());
        $cdf->setStatus($data['status_id']);
        $cdf->setType($data['type_id']);
        $cdf->setName($data['name']);
        $cdf->setCalculation($data['calculation_id']);
        $cdf->setCalculationOrder($data['calculation_order']);
        if (isset($data['country'])) {
            $cdf->setCountry($data['country']);
        }
        if (isset($data['province'])) {
            $cdf->setProvince($data['province']);
        } else {
            $cdf->setProvince(NULL);
        }
        if (isset($data['district'])) {