<?php
if (!empty($_GET['bu_org_id']) && (!is_array($_GET['bu_org_id']))) {
 $$class->bu_org_id = $_GET['bu_org_id'];
}

if (!empty($_GET['sd_so_header_id']) && (!is_array($_GET['sd_so_header_id']))) {
 $$class->sd_so_header_id = $_GET['sd_so_header_id'];
 $$class->get_details_from_sd_so_header();
}

if (!empty($$class->ar_customer_id)) {
 $ac = new ar_customer();
  $ac->findBy_id($$class->ar_customer_id);
 $$class->customer_name = $ac->customer_name;
 $$class->customer_number = $ac->customer_number;
}

$customer_site_obj = [];
if (!empty($$class->ar_customer_site_id)) {
 $arc = new ar_customer_site();
 $arc_i = $arc->findBy_id($$class->ar_customer_site_id);
 array_push($customer_site_obj, $arc_i);
}

if(isset($hd_service_contract_header)){
$customer_name_stmt = $f->text_field('customer_name', $hd_service_contract_header->customer_name, '20', 'customer_name', 'select_customer_name', 1, $readonly1);
$customer_number_stmt = $f->text_field('customer_number', $hd_service_contract_header->customer_number, '8', 'customer_number', 'select_customer_number', 1, $readonly1);
}

if (!empty($hd_service_contract_line_object)) {
 foreach ($hd_service_contract_line_object as &$hd_service_contract_lines) {
	if (!empty($hd_service_contract_lines->item_id_m)) {
	 $item = item::find_by_id($hd_service_contract_lines->item_id_m);
	 $hd_service_contract_lines->item_number = $item->item_number;
	} else {
	 $hd_service_contract_lines->item_number = null;
	 }
 }
}

if((empty($$class->transaction_status))){
$$class->transaction_status = 'INCOMPLETE';
}

if((empty($$class->transaction_status))){
$$class->transaction_status = 'INCOMPLETE';
}

if((!empty($$class->arproval_status))&&($$class->arproval_status == 'CANCELLED')
				|| ($$class->transaction_status == 'CLOSED')){
 $mode=2;
 $readonly=1;
}
?>
