<?php

 if($$class->wo_status == 'CLOSED' || $$class->wo_status == 'CANCELLED' ){
  $readonly = 1; $mode = 2;
 }

 $class_third = 'wip_wo_routing_detail';
 $$class_third = &$wip_wo_routing_detail;
 $class_fourth = 'wip_wo_bom';
 $$class_fourth = &$wip_wo_bom;
?>

<?php

 if (!empty($_GET["wip_wo_header_id"]) && (!is_array($_GET["wip_wo_header_id"]))) {
  $wip_wo_header_id = htmlentities($_GET["wip_wo_header_id"]);
 } elseif (!empty($_POST["wip_wo_header_id"][0])) {
  $wip_wo_header_id = $_POST["wip_wo_header_id"][0];
 } else {
  $wip_wo_bom = new wip_wo_bom();
  $wip_wo_bom_object = array();
  array_push($wip_wo_bom_object, $wip_wo_bom);

  $wip_wo_routing_line = new wip_wo_routing_line();
  $wip_wo_routing_line_object = array();
  array_push($wip_wo_routing_line_object, $wip_wo_routing_line);
 }

 if (!empty($wip_wo_header_id)) {
  $$class->remaining_quantity = $$class->quantity - $$class->completed_quantity;
  $item = new item();
  $item_i = $item->findBy_id($$class->item_id_m);
  if (!empty($item_i)) {
   $wip_wo_header->item_number = $item_i->item_number;
   $wip_wo_header->item_description = $item_i->item_description;
   $wip_wo_header->uom = $item_i->uom_id;
   $wip_wo_header->processing_lt = $item_i->processing_lt;
  }
  $wip_wo_bom_object = wip_wo_bom::find_by_wip_wo_headerId($wip_wo_header_id);
  if (count($wip_wo_bom_object) == 0) {
   $wip_wo_bom = new wip_wo_bom;
   $wip_wo_bom_object = array();
   array_push($wip_wo_bom_object, $wip_wo_bom);
  } else {
   $routing_line_details = wip_wo_routing_line::find_by_wip_wo_headerId($wip_wo_header_id);
  }

  $wip_wo_routing_line_object = wip_wo_routing_line::find_by_wip_wo_headerId($wip_wo_header_id);
  if (count($wip_wo_routing_line_object) == 0) {
   $wip_wo_routing_line = new wip_wo_routing_line;
   $wip_wo_routing_line_object = array();
   array_push($wip_wo_routing_line_object, $wip_wo_routing_line);
  } else {
   
  }
 }

 if (empty($$class->wo_type)) {
  $$class->wo_type = 'STANDARD';
 }

 if (!empty($$class->item_id_m) && !empty($$class->org_id)) {
  $revision_name_a = inv_item_revision::find_by_itemIdM_orgId($$class->item_id_m, $$class->org_id);
 } 
 if(empty($revision_name_a)){
  $revision_name_a = [];
 }
 

?>
