<html>
<style>
table {
  font-family: arial, sans-serif;
  border-collapse: collapse;
  width: 100%;
}

td, th {
  border: 0.7px solid #000000;
  text-align: left;
  padding: 8px;
}

tr:nth-child(even) {
  background-color: #dddddd;
}
</style>

<div class="panel-title" style="text-align:center"><?php echo HTML::image(Config::get('kblis.organization-logo'),  Config::get('kblis.country') . trans('messages.court-of-arms'), array('width' => '30px')); ?>

  <br>
  <strong><?php echo strtoupper(Config::get('constants.stockcard')); ?>

    <br> <?php echo Config::get('kblis.address-info'); ?></strong></div>
    <br> <?php echo Config::get('constants.card'); ?></strong></div>

    <table class="table table-bordered">

    <tr>
        <th><b>Item Code:</b> <?php echo $c; ?></th>

        <th><b>Item Description:</b> <?php echo $n; ?></th>
      </tr>

        <tr>
        <th><b>Minimum Stock Level: </b> <?php echo $mn; ?></th>
        <th><b>Maximum Stock Level:</b>  <?php echo $mx; ?></th>
      </tr>

        <tr>
        <th style="color:blue"><b>AMC:</b>  <?php echo $amc; ?></th>
      </tr>

          <tr>
        <th width="9.5%"><b><small>Txn<br> Date </small></b></th>
        <th width="15%"><b><small>To / From</small></b> </th>
        <th width="7%"> <b><small>Voucher <br>Number </small></b></th>
        <th width="7%"> <b><small>Batch <br>Number </small></b></th>
        <th width="7%"> <b><small>Physical Count </small></b></th>
        <th width="7%"> <b><small>P/C <br>Discrepancy </small></b></th>
        <th width="6.7%"> <b><small>Opening <br>Balance </small></b></th>
        <th width="4.5%"> <b><small>Qty <br>In / Out </small></b></th>
        <th width="5%"> <b><small>Txn Type </small></b></th>
        <th width="10%"> <b><small>Expiry date </small></b></th>
        <th width="4.5%"> <b><small>SOH </small></b></th>
        <th width="10.3%"> <b><small>Remarks </small></b></th>
        <th width="6.5%"> <b><small>Initials </small> </b></th>

      </tr>

      <tbody>
        <?php $row=1;
        ?>
        <?php foreach($order as $value): ?>
        <tr>
          <td> <small><?php echo date('d M Y', strtotime ($value->transaction_date)); ?> </small></td>
          <?php if($value->action==\Config::get('constants.INCOMING_STOCK_FLAG')): ?>
          <td> <small><?php echo $value->sourceOfStock($value->to_from,$value->to_from)->name; ?> </small></td>
          <?php endif; ?>
          <?php if($value->action==\Config::get('constants.OUTGOING_STOCK_FLAG')): ?>
          <td> <small> <?php echo $value->destinationOfStock($value->to_from_type,$value->to_from)->name; ?> </small></td>
          <?php endif; ?>
          <?php if($value->action==\Config::get('constants.LOSSES_ADJUSTMENTS_STOCK_FLAG')): ?>
          <td> <small> N/A </small></td>
          <?php endif; ?>

          <?php if($value->action==\Config::get('constants.PHYSICAL_COUNT_STOCK_FLAG')): ?>
          <td> <small>Physical Count </small> </td>
          <?php endif; ?>

          <td> <small><?php echo $value->voucher_number; ?></small></td>
          <td> <small><?php echo $value->batch_number; ?></small></td>
          <?php if($value->physical_count == 0): ?>
          <td><small> - </small></td>
          <?php else: ?>
          <td> <small><?php echo $value->physical_count; ?> </small></td>
          <?php endif; ?>

          <?php if($value->discrepancy == 0): ?>
          <td> <small>- </small></td>
          <?php else: ?>
          <td><small><?php echo $value->discrepancy; ?></small></td>
          <?php endif; ?>

          <?php if($value->opening_balance == 0): ?>
          <td><small>-</small></td>

          <?php else: ?>
          <td><small><?php echo $value->opening_balance; ?></small></td>
          <?php endif; ?>

          <td><small><?php echo ($value->action=='I'?$value->quantity_in:($value->action=='O'?$value->quantity_out:$value->quantity) ); ?></small></td>
          <td class="text-center"><small><?php echo $value->action; ?></small></td>
          <?php if($value->expiry_date ==  0000-00-00): ?>
          <td><small>N/A</small></td>
          <?php else: ?>
          <td><small><?php echo date('d M Y', strtotime($value->expiry_date)); ?></small></td>
          <?php endif; ?>
          <td><small><?php echo $value->balance; ?></small></td>
          <td><small><?php echo $value->remarks; ?></small></td>
          <td><small><?php echo $value->initials; ?></small></td>
        </tr>
        <?php $row++; ?>
        <?php endforeach; ?>
      </tbody>
    </table>
  </div>
  <br><br><br><br>
  <b><small>Generated from UNHLS Inventory Management System </small></b>
  </html>
