<?php

 if (!empty($_GET['bu_org_id'])) {
  $$class->bu_org_id = $_GET['bu_org_id'];
 }

 if (!empty($_GET['class_name']) && $_GET['class_name'] == 'inv_receipt_line') {
  $mode = 2; $readonly = 1;
  $class = 'inv_receipt_header';
  $$class = new $class;

  $class_second = 'inv_receipt_line';
  $$class_second = new $class_second;
  if (!empty($_GET['inv_receipt_line_id'])) {
   $inv_receipt_line_object = array(inv_receipt_line::find_by_id($_GET['inv_receipt_line_id']));
   $$class->inv_receipt_header_id = $inv_receipt_line_object[0]->inv_receipt_header_id;
   $$class->findBy_id($$class->inv_receipt_header_id);
  } else {
   $inv_receipt_line_object = array(new inv_receipt_line());
  }
 }


 if (!empty($inv_receipt_line_object)) {
  foreach ($inv_receipt_line_object as &$inv_receipt_lines) {
   if (!empty($inv_receipt_lines->po_detail_id)) {
    $po_all = new po_all_v();
    $po_all->po_detail_id = $inv_receipt_lines->po_detail_id;
    $po_all_i = $po_all->findBy_poDetailId();
    $inv_receipt_lines->po_number = $po_all_i->po_number;
    $inv_receipt_lines->po_line_number = $po_all_i->po_line_number;
    $inv_receipt_lines->shipment_number = $po_all_i->shipment_number;
    $inv_receipt_lines->quantity = $po_all_i->quantity;
    $inv_receipt_lines->received_quantity = $po_all_i->received_quantity;
    $inv_receipt_lines->item_number = $po_all_i->item_number;
    $inv_receipt_lines->supplier_name = $po_all_i->supplier_name;
    $inv_receipt_lines->supplier_number = $po_all_i->supplier_number;
    $inv_receipt_lines->supplier_site_name = $po_all_i->supplier_site_name;
    $inv_receipt_lines->supplier_site_number = $po_all_i->supplier_site_number;
    $inv_receipt_lines->supplier_id = $po_all_i->supplier_id;
    $inv_receipt_lines->supplier_site_id = $po_all_i->supplier_site_id;
    $inv_receipt_lines->uom_id = $po_all_i->uom_id;
    $inv_receipt_lines->kit_cb = $po_all_i->kit_cb;
   } else {
    
   }
  }
 }

//$po_line = new po_line();
//$po_detail = new po_detail();

 if (empty($$class->receipt_date)) {
  $$class->receipt_date = current_time(true);
 }

  if (!empty($$class->inv_receipt_header_id) && ($$class->transaction_type_id==4)) {
  $$class->action_a['COMPLETE_DELIVERY'] = 'Complete Delivery';
 }
 
 if (empty($$class->transaction_type_id)) {
  $$class->transaction_type_id = 4;
 }

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