<?php
//coa_structure_id is same as option_header_id
if (!empty($_GET["coa_id"]) && (!is_array($_GET["coa_id"]))) {
 $coa_id = htmlentities($_GET["coa_id"]);
}

if (!empty($_GET['coa_structure_id']) && (!is_array($_GET['coa_structure_id']))) {
 $coa_structure_id = $_GET['coa_structure_id'];
 if (count(coa::find_by_structure($coa_structure_id)) > 0) {
	$coa = coa::find_by_structure($coa_structure_id);
 }
}
//Display statement
$dispaly_statement = '';
if (!empty($$class->coa_structure_id)) {
 $dispaly_statement .= '<ul class="column header_field" id="segment_structure"> ';
 $filed_count = 1;
 foreach (coa::coa_segments_by_optionHeaderId($$class->coa_structure_id) as $obj) {
	$field = 'field' . $filed_count;
	$dispaly_statement .= "<li><label>Field #: $filed_count </label>";
	$dispaly_statement .= form::select_field_from_object($field, coa::coa_segments_by_optionHeaderId($$class->coa_structure_id), 'option_line_code', 'option_line_value', $$class->$field, $field);
	$dispaly_statement .= '</li>';
	$filed_count++;
 }
 $dispaly_statement .= '</ul>';
} else {
 $dispaly_statement .= '<ul class="column header_field" id="segment_structure"></ul>';
  $dispaly_statement .= '<span class="heading" id="no_coa_structure_id"> Chart of account coa_structure_id is not available <span>';
}

$readonly1 = false;
if (!empty($$class->coa_id)) {
 $readonly1 = true;
}
?>

