<?php

 $document_number_a = array(null);
 $asl_document_object = [];
 if (!empty($_GET['po_asl_line_id'])) {
  $po_asl_line_id_h = $_GET['po_asl_line_id'];
  $po_asl_line = po_asl_line::find_by_id($_GET['po_asl_line_id']);
  $po_asl_header = po_asl_header::find_by_id($po_asl_line->po_asl_header_id);
//  pa($po_asl_header);
  $bu_org_id = $po_asl_header->bu_org_id;
  $item_id_m = $po_asl_header->item_id_m;
  $item_number =item::find_by_item_id_m($po_asl_header->item_id_m)->item_number;
  $supplier_details = supplier_all_v::find_by_supplier_siteId($po_asl_line->supplier_site_id);
  $supplier_site_id = $po_asl_line->supplier_site_id;
  $supplier_id = $po_asl_line->supplier_id;
  $supplier_name = $supplier_details->supplier_name;
  $supplier_site_name = $supplier_details->supplier_site_name;
  $asl_document_object = po_asl_document::find_by_po_asl_lineId($_GET['po_asl_line_id']);
//  echo "<br><br><br><br>$bu_org_id, $supplier_site_id, $item_id_m";
  $document_number_obj = po_blanket_v::find_all_active_bpa($bu_org_id, $supplier_site_id, $item_id_m);
  if ($document_number_obj) {
   foreach ($document_number_obj as $obj){
    $document_number_a[$obj->po_line_id] = $obj->po_number . ' Line# ' . $obj->po_line_number;
  }
  }
//  pa($document_number_obj);
//  pa($document_number_a);
 } else {
  $po_asl_line_id_h = null;
  $bu_org_id = null;
  $supplier_site_id = null;
  $supplier_id = null;
  $supplier_name = null;
  $supplier_site_name = null;
  $item_id_m = null;
  $item_number = null;
 }
 
 if(empty($asl_document_object)){
   $asl_document_object = array(new po_asl_document);

 }
?>