$table->colspan = array(); $table->head[0] = __('Name'); $table->head[1] = __('Contract number'); $table->head[2] = __('Company'); $table->head[3] = __('Begin'); $table->head[4] = __('End'); $table->head[5] = __('Status'); $counter = 0; foreach ($contracts as $contract) { $data = array(); $data[0] = "<a href='index.php?sec=customers&sec2=operation/contracts/contract_detail&id_contract=" . $contract["id"] . "'>" . $contract["name"] . "</a>"; $data[1] = $contract["contract_number"]; $data[2] = get_db_value('name', 'tcompany', 'id', $contract["id_company"]); $data[3] = $contract["date_begin"]; $data[4] = $contract["date_end"] != '0000-00-00' ? $contract["date_end"] : "-"; $data[5] = get_contract_status_name($contract["status"]); array_push($table->data, $data); } print_table($table); if ($write_permission || $manage_permission) { echo '<form method="post" action="index.php?sec=customers&sec2=operation/contracts/contract_detail&id_company=' . $id . '">'; echo '<div style="width: ' . $table->width . '; text-align: right;">'; print_submit_button(__('Create'), 'new_btn', false, 'class="sub next"'); print_input_hidden('new_contract', 1); echo '</div>'; echo '</form>'; } } } elseif ($op == "contacts") { $name = get_db_value('name', 'tcompany', 'id', $id); $table->class = 'listing';
$table->data['button'][1] = $button; $table->colspan['button'][1] = 2; } else { $button = print_submit_button(__('Create'), 'create_btn', false, 'class="sub create"', true); $button .= print_input_hidden('create_contract', 1, true); $table->data['button'][1] = $button; $table->colspan['button'][1] = 2; } } else { $table->class = 'search-table'; $table->data[0][0] = "<b>" . __('Contract name') . "</b><br>{$name}<br>"; if ($contract_number == '') { $contract_number = '<i>-' . __('Empty') . '-</i>'; } $table->data[1][0] = "<b>" . __('Contract number') . "</b><br>{$contract_number}<br>"; $table->data[1][1] = "<b>" . __('Status') . "</b><br>" . get_contract_status_name($status) . "<br>"; $table->data[2][0] = "<b>" . __('Begin date') . "</b><br>{$date_begin}<br>"; $table->data[2][1] = "<b>" . __('End date') . "</b><br>{$date_end}<br>"; $company_name = get_db_value('name', 'tcompany', 'id', $id_company); $table->data[3][0] = "<b>" . __('Company') . "</b><br>{$company_name}"; $table->data[3][0] .= " <a href='index.php?sec=customers&sec2=operation/companies/company_detail&id={$id_company}'>"; $table->data[3][0] .= "<img src='images/company.png'></a>"; $sla_name = get_db_value('name', 'tsla', 'id', $id_sla); $table->data[3][1] = "<b>" . __('SLA') . "</b><br>{$sla_name}<br>"; if ($description == '') { $description = '<i>-' . __('Empty') . '-</i>'; } $table->data[3][1] = "<b>" . __('Description') . "</b><br>{$description}<br>"; } echo '<form id="contract_form" method="post" action="index.php?sec=customers&sec2=operation/contracts/contract_detail">'; print_table($table);