function getByCompanyId($company_id, $where = NULL, $order = NULL)
    {
        if ($company_id == '') {
            return FALSE;
        }
        $rpsaf = new RecurringPayStubAmendmentFactory();
        $ph = array('company_id' => $company_id);
        $query = '
					SELECT a.*
					FROM ' . $this->getTable() . ' as a
						LEFT JOIN ' . $rpsaf->getTable() . ' as b ON a.recurring_ps_amendment_id = b.id
					WHERE
							b.company_id = ?
							AND ( b.deleted = 0 )
					';
        $this->ExecuteSQL($query, $ph);
        return $this;
    }
}
$smarty->assign('title', TTi18n::gettext($title = 'Edit Recurring Pay Stub Amendment'));
// See index.php
/*
 * Get FORM variables
 */
extract(FormVariables::GetVariables(array('action', 'id', 'user_id', 'pay_stub_amendment_data')));
if (isset($pay_stub_amendment_data)) {
    if ($pay_stub_amendment_data['start_date'] != '') {
        $pay_stub_amendment_data['start_date'] = TTDate::parseDateTime($pay_stub_amendment_data['start_date']);
    }
    if ($pay_stub_amendment_data['end_date'] != '') {
        $pay_stub_amendment_data['end_date'] = TTDate::parseDateTime($pay_stub_amendment_data['end_date']);
    }
}
$rpsaf = new RecurringPayStubAmendmentFactory();
$action = Misc::findSubmitButton();
$action = strtolower($action);
switch ($action) {
    case 'recalculate':
        //Debug::setVerbosity(11);
        $rpsalf = new RecurringPayStubAmendmentListFactory();
        $rpsalf->getById($pay_stub_amendment_data['id']);
        if ($rpsalf->getRecordCount() > 0) {
            $rpsa_obj = $rpsalf->getCurrent();
            $rpsa_obj->createPayStubAmendments();
        }
        Redirect::Page(URLBuilder::getURL(NULL, 'RecurringPayStubAmendmentList.php'));
        break;
    case 'submit':
        Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);