←':''; //Check if allowed if (isAllowed($page,$_SESSION['profile'],$_SESSION['permission'],'R') === 0){ header('location: index.php'); exit; } //GET PARAMETERS && STORE in SESSION for FURTHER USE/NAVIGATION $pagination_page = $_SESSION['p'] = isset($_GET['p']) ? $_GET['p'] : 1; //PAGE Security $page_manage = 'contract_manage'; $update_allowed = isAllowed($page ,$_SESSION['profile'],$_SESSION['permission'],'U'); $update_allowed_edit = isAllowed($page_manage ,$_SESSION['profile'],$_SESSION['permission'],'U'); $delete_allowed = isAllowed($page_manage ,$_SESSION['profile'],$_SESSION['permission'],'D'); $create_allowed = isAllowed($page_manage ,$_SESSION['profile'],$_SESSION['permission'],'C'); $view_equipment = isAllowed('equipment' ,$_SESSION['profile'],$_SESSION['permission'],'R'); //GET Details from URL $GET_VALUES = urlGETdetails($_GET) ?? ''; $contract_ID = $_GET['rowID'] ?? ''; //CALL TO API FOR General information $api_url = '/v1/contracts/rowID='.$contract_ID;; $responses = ioServer($api_url,''); //Decode Payload if (!empty($responses)){$responses = decode_payload($responses);}else{$responses = null;} $responses = $responses[0]; //------------------------------ //Variables //------------------------------ $contract_status_text = 'contract_status'.$responses->status ?? ''; $contract_type_text = 'contract_type'.$responses->type ?? ''; $contract_billingplan_text = 'contract_billing'.$responses->billing_plan ?? ''; $servicetools = json_decode($responses->servicetool,true) ?? ''; $assigned_users = json_decode($responses->assigned_users,true) ?? ''; $ignore_lists = json_decode($responses->ignore_list,true) ?? ''; //Partnerdata $partner_data = json_decode($responses->accounthierarchy); $salesid = getPartnerName($partner_data->salesid) ?? $not_specified; $soldto = getPartnerName($partner_data->soldto) ?? '-'; $shipto = getPartnerName($partner_data->shipto) ?? '-'; $location = getPartnerName($partner_data->location) ?? '-'; // Handle success messages if (isset($_GET['success_msg'])) { if ($_GET['success_msg'] == 1) { $success_msg = $message_contract_1; } if ($_GET['success_msg'] == 2) { $success_msg = $message_contract_2; } if ($_GET['success_msg'] == 3) { $success_msg = $message_contract_3; } } template_header('Contract', 'contract', 'view'); $view = '
'.$success_msg.'
'.$responses->rowID.'
'.(($responses->status == 1)? '': (($responses->status == 3) ? '': '')).''.$$contract_status_text.'
'.$$contract_type_text.'
'.($$contract_billingplan_text ?? '').'
'.$responses->start_date.'
'.$responses->duration.'
'.$date.'
'.$responses->service_count.'
'.$salesid.'
'.$soldto.'
'.$shipto.'
'.$location.'
'.$responses->reference.'
| '.$general_year.' | '.$general_total.' | billing_plan && $responses->billing_plan == 2) ? '' :'style="display:none;"').'>'.$general_quarter.' | billing_plan && $responses->billing_plan == 2) ? '' :'style="display:none;"').'>'.$general_total.' | billing_plan && $responses->billing_plan == 1) ? '' :'style="display:none;"').'>'.$general_month.' | billing_plan && $responses->billing_plan == 1) ? '' :'style="display:none;"').'>'.$general_total.' |
|---|---|---|---|---|---|
| '.$key.' | '.$value['total'].' | ||||
| '.$key.' | '.$value['total'].' | billing_plan && $responses->billing_plan == 1) ? '' :'style="display:none;"').'> | billing_plan && $responses->billing_plan == 1) ? '' :'style="display:none;"').'> | ||
| billing_plan && $responses->billing_plan == 2) ? '' :'style="display:none;"').'> | billing_plan && $responses->billing_plan == 2) ? '' :'style="display:none;"').'> | billing_plan && $responses->billing_plan == 1) ? '' :'style="display:none;"').'>'.$key.' | billing_plan && $responses->billing_plan == 1) ? '' :'style="display:none;"').'>'.$value.' |
| '.$user.' |
| '.(($view_equipment == 1)? ''.$tools.'':$tools).' |
| '.(($view_equipment == 1)? ''.$list.'':$list).' |
| '.$general_created.' | '.getRelativeTime($responses->created).' |
| '.$general_createdby.' | '.$responses->createdby.' |
| '.$general_updated.' | '.getRelativeTime($responses->updated).' |
| '.$general_updatedby.' | '.$responses->updatedby.' |