<!DOCTYPE html>
<html >
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>SUHOL</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.7 -->
  <link rel="stylesheet" href="{{asset('lte/bower_components/bootstrap/dist/css/bootstrap.min.css')}}">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="{{asset('lte/bower_components/font-awesome/css/font-awesome.min.css')}}">
  <!-- Ionicons -->
  <link rel="stylesheet" href="{{asset('lte/bower_components/Ionicons/css/ionicons.min.css')}}">
  <!-- Theme style -->
  <link rel="stylesheet" href="{{asset('lte/dist/css/AdminLTE.min.css')}}">

  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->

  <!-- Google Font -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
</head>
<style type="text/css">
    .table > thead > tr > th,
    .table > tbody > tr > th,
    .table > tfoot > tr > th,
    .table > thead > tr > td,
    .table > tbody > tr > td,
    .table > tfoot > tr > td {
      padding: 1px;
      line-height: 1.42857143;
      vertical-align: top;
      border-top: 1px solid #ddd;
    }

    .table > thead > tr > th {
      vertical-align: bottom;
      border-bottom: 2px solid #ddd;
    }

    body {
      font-size: 14px;
    }

    .table-condensed > tbody > tr > td {
      border :none;
    }

  </style>
<body >
<!-- <div class="hidden-print text-center" style="float:left; margin:20px" >
        <a  class="btn btn-danger" href="{{URL::previous()}}">Back</a>
    </div> -->
  <!-- Main content -->
   <section class="invoice">
      <!-- title row -->
      <div class="row">
        <div class="col-xs-12">
          <div class="box-header with-border">
            <div class="pull-right">
              <address style="text-align: right">
                <h3><b>{{$po->supplier->office['office']}}</b></h3>
                <pre style="border: none;background: transparent;">{{$po->supplier->office['address']}}</pre>
              </address>
              <h4 style="text-align: right"><b>PURCHASE ORDER</b></h4>
            </div>
          </div>
        </div>
        <!-- /.col -->
      </div>

      <!-- info row -->
      <div class="row invoice-info">
        <div class="box-header with-border">
          <div class="col-sm-4 invoice-col">
            <h5><b>Purchase Order- SFT Sea Shipment</b></h5><br>
          </div>
          <div class="col-sm-4 invoice-col pull-right">
            <table class="table" style="text-align: right;">
              <tr>
                <td style="border: none;">POHS Number</td>
                <td style="border: none;">{{$po->po_no}}</td>
              </tr>
               <tr>
                <td style="border: none;">Ref No:</td>
                <td style="border: none;"></td>
              </tr>
              <tr>
                <td style="border: none;">Date</td>
                <td style="border: none;">{{date('d-m-Y')}}</td>
              </tr>
            </table>
          </div>
        </div>

        <div class="box-header">
          <div class="col-xs-6">
            <table class="table table-bordered">
              <tr>
                <td>
                  <b>{{$po->supplier['name']}}</b>
                  <address style="text-align: left;margin-left: -8px;">
                    <pre style="border: none;background: transparent;">{{$po->supplier['address']}}</pre>
                  </address>
                </td>
              </tr>
            </table>
          </div>
          <div class="col-xs-6">
            <table class="table table-condensed">
              <tr>
                <td>ETA</td>

                <td>:@if($po->eta) {{ date('d-m-Y', strtotime($po->eta)) }} @endif</td>
              </tr> 
              <tr>
                <td>Port of Discharge</td>
                <td>: SOHAR</td>
              </tr>
              <tr>
                <td>Currency</td>
                <td>: {{$po->supplier->supplierCurrency['currency']}}</td>
              </tr> 
              <tr>
                <td>Prepared By</td>
                <td>: {{$po->enteredBy['name']}}</td>
              </tr>       
            </table>
          </div>

          <div class="col-xs-12 table-responsive">
            <table class="table table-bordered table-striped">
              <thead>
                <tr style="background: #bebdbf;">
                  <th>Sl No.</th>
                  <th>Product Name</th>
                  <th>Grade</th>
                  <th>Packing</th>
                  <th>Unit</th>
                  <th>Gross wtg.(Kg)</th>
                  <th>Qty</th>
                  <th>Unit Price({{$po->supplier->supplierCurrency['currency']}})</th>
                  <th>Amt({{$po->supplier->supplierCurrency['currency']}})</th>
                </tr>
              </thead>
              <tbody>
                <?php $c=1;$tot=0;$wgt=0;?>
                @foreach($products_dist as $prd)
                <tr>
                  <td>{{$c++}}</td>
                  <td>{{$products->where('product_id','=',$prd->product_id)->first()->product['name']}}</td>
                  <td>{{$products->where('standard_id','=',$prd->standard_id)->first()->standard['standard'] or ''}}</td>
                  <td>{{$products->where('grade_id','=',$prd->grade_id)->first()->grade['grade']}}</td>
                  <td>{{$products->where('unit_id','=',$prd->unit_id)->first()->unit['unit']}}</td>
                  <td>{{$products->where('product_id','=',$prd->product_id)->first()->weight}}</td>
                  <td>{{$products->where('product_id','=',$prd->product_id)->sum('qty')}}</td>
                  <td>{{number_format($products->where('product_id','=',$prd->product_id)->first()->unit_price,3)}}</td>
                  <td>{{$products->where('product_id','=',$prd->product_id)->sum('price')}}</td>
                </tr>
                <?php $tot = $tot + $products->where('product_id','=',$prd->product_id)->sum('price'); $wgt = $wgt + $products->where('product_id','=',$prd->product_id)->first()->weight;?>
                @endforeach
                <tr>
                  <th colspan="5" style="text-align: right;">Wtg :</th>
                  <th>{{$wgt}}</th>
                  <th colspan="2" style="text-align: right;">Total:</th>
                  <th>{{number_format($tot,3)}}</th>
                </tr>
              </tbody>
            </table>
          </div>

        </div>

        <div class="col-xs-12">
          <div class="box">
            <div class="box-header">
              <h3 style="font-size: 13px;margin-left: -10px;"><b><u>Export Queries/Documents Required</u></b></h3>
            </div>
            <table class="table">
              <tr>
                <td class="col-xs-6" style="border: none;"><i class="fa fa-fw fa-square-o"></i>Packing List</td>
                 <td class="col-xs-6" style="border: none;"><i class="fa fa-fw fa-square-o"></i>Phytosanitary Certificate</td>
              </tr>
              <tr>
                <td class="col-xs-6" style="border: none;"><i class="fa fa-fw fa-square-o"></i>Certificate of Orgin(1) original & (2) copies duly stamped by chamber of commerce</td>
                <td class="col-xs-6" style="border: none;"><i class="fa fa-fw fa-square-o"></i>Commercial invoice in atleast (1) original copy</td>
              </tr>
               <tr>
                <td class="col-xs-6" style="border: none;"><i class="fa fa-fw fa-square-o"></i>BL</td>
                 <td class="col-xs-6" style="border: none;"></td>
              </tr>
            </table>
          </div>
        </div>

        <div class="box-header">
          <div class="col-xs-6">
              <h5>PAYMENT MODE: {{$po->supplier->pay['name']}}</h5>
              <h5>SHIPPING TERMS: PO VALID FOR 10 DAYS</h5>
              <h5>INCASE OF DAMAGES THE SAME AND I WILL INFORM YOU IN 24 HOURS FROM THE SHIPMENT ARRIVED AT OUR STORE</h5>
            
                <h3 style="font-size: 13px;margin-left: -10px;"><b><u>SHIPPING INSTRUCTIONS</u></b></h3>
                <h5>C.IF MUSCAT</h5>
                <h5>INVOICE/CREDIT PARTY</h5>
          </div>
          <div class="col-xs-6">
            <table class="table table-bordered">
              <thead>
                <tr>
                  <th>Prepared by</th>
                  <th>Reviewed By</th>
                  <th>Approved By</th>
                </tr> 
              </thead>
              <tbody>
                <tr>
                  <td><textarea class="form-control" style="border: none;" cols="7" rows="4"></textarea></td>
                  <td></td>
                  <td></td>
                </tr> 
              </tbody>
                 
            </table>
          </div>

          <div class="col-xs-12"> <div class="box-header">
          <div class="col-xs-6">
              
      <h3 style="font-size: 13px;margin-left: -6%;"><b><u>SHIPPING SCHEDULES</u></b></h3>
                
          </div></div>
        
            <table class="table table-bordered">
              <thead>
                <tr>
                  <th>Month</th>
                  <th>ETA</th>
                  <th>Product</th>
                  <th>Packing</th>
                  <th>Qty</th>
                  <th>Port</th>
                </tr> 
              </thead>
              <tbody>
              @foreach($products as $prd)
                <tr>
                    <td>{{date('F',strtotime($prd->scheduled_date))}}</td>
                    <td>{{date('d-m-Y',strtotime($prd->scheduled_date))}}</td>
                    <td>{{$prd->product['name']}}</td>
                    <td>{{$prd->standard['standard'] or ''}}</td>
                    <td>{{$prd->qty}}</td>
                    <td></td>
                </tr> 
              @endforeach  
              </tbody>
                 
            </table>
          </div>

        </div>

      </div>
      <!-- /.row -->

      <div style="text-align: center;"><i>--This Is a system generated report--</i></div>

      <!-- this row will not appear when printing -->
      <div class="row no-print">
        <div class="col-xs-12">
          <a  target="_blank"  class="btn btn-default pull-right" onclick="window.print();"><i class="fa fa-print"></i> Print</a>
         
        </div>
      </div>
    </section>
    <!-- /.content -->
  <!-- /.content -->
</body>
</html>
