<script   src="js/scroll.js"></script>

<div class="row text-center">
    <b>
        <?php if($titulo!="d"): ?>
            <?php echo e($titulo); ?>

        <?php endif; ?>
    </b>
</div>

<div class="table-responsive"><br/>
<table width="95%" class="table-bordered table-hover fixed" id="tablaReporte">
    <thead>
        <tr>
            <th colspan="4" style="text-align: center; background: #bababa">Producto</th>
            <th colspan="2" style="text-align: center; background: #bababa">Fecha</th>
            <th colspan="2" style="text-align: center; background: #bababa">Valor</th>
            <th colspan="3" style="text-align: center; background: #FCFB98">Proveedor</th>
        </tr>
        <tr style="background: #aa4d0e; color:white">
            <th>Cant.</th>
            <th>Código</th>
            <th>Nombre</th>
            <th># Factura.</th>
            <th>Carga</th>            
            <th>Factura</th>            
            <th>Unitario</th>
            <th>Total</th>
            <th>Nit</th>
            <th>Nombre</th>        
        </tr>
    </thead>
    <tbody>
        <?php
            $TTotalCompra = 0;
       ?>
       <?php foreach($reporte as $repor): ?>
    <tr>
        <td ><?php echo e($repor->Cantidad_Producto); ?></td>
        <td align="right"><?php echo e($repor->idProducto); ?></td>
        <td align="letf">&nbsp;<?php echo e($repor->Nombre_Produc); ?></td>
        <td align="right"><a href="<?php echo e(url('/detfaccom/'.$repor->Factura_compra.'/'.$repor->idProveedor)); ?>" target="_blank"><?php echo e($repor->Factura_compra); ?></a></td>
        <td align="right"><?php echo e($repor->created_at); ?></td>
        <td align="right"><?php echo e($repor->fecfac); ?></td>
        <?php if($repor->Cantidad_Producto>0): ?>
        <td align="right"><?php echo e($repor->valor_compra); ?></td>
        <?php endif; ?>
        <td align="right">&nbsp;&nbsp;<?php echo e($repor->total); ?></td>
        <td align="right">&nbsp;&nbsp;<?php echo e($repor->Nit); ?></td>
        <td align="letf">&nbsp;<?php echo e($repor->Nombre); ?></td>
        <?php $TTotalCompra += $repor->valor_compra; ?>
    </tr>    
      <?php endforeach; ?>
    </tbody>
    
    <tfoot>
        <tr>
          <td colspan="10"><br/></td>
      </tr>
      <tr>
        <th colspan="7" style="text-align: right">Total:</th>
        <th style="text-align: right">&nbsp;<?=$TTotalCompra?></th>
        <th colspan="2" style="text-align: right"></th>
      </tr>
      <tr>
          <td colspan="10"><br/></td>
      </tr>
    </tfoot>      
</table>
</div>