<?php $__env->startSection('content'); ?>
<style>
  .form-check{
    display: inline-block;
    top: -15px;
    left: 13px;
  }
  .verTotal22{
    text-align: right;
    margin-right: 400px;
    font-size: 17px;
    font-weight: 700;
  }
  .regresar{
    margin-top: -10px;
    padding-left: 6px;
  }
  .eliminar{
    margin-top: -10px;
    padding-left: 6px;
  }
  .nota_{
    margin-top: -10px;
    padding-left: 6px;
  }

  .fa-upload {
    padding-top: 5px;
    padding-left: 6px;
  }
</style>
<div class="container date-consult">
  <div class="row">
      <div class="md-col-4 my-4">

      </div>
  </div>
</div>
<form action="<?php echo e(route('reportes.dashboard')); ?>" method="POST">
  <?php echo csrf_field(); ?>
<div id="contenedor-dashboard" class="container-fluid">
  <div class="row ">
    <div class="col-md-12">
      <h2>reporte Mensual de ventas.</h2>
    </div>
  </div>
  <div class="col-md-12">
    <br>

    <table id="example2" class="display" style="width:100%">
      <thead>
        <tr>
          <td>ID</td>
          <td>Fecha</td>
          <td>Cliente</td>
          <td>Total</td>
          

        </tr>
      </thead>
      <tbody>      
        <?php $__currentLoopData = $salidasAlmacen; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $op): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
          <?php if($op->total-$op->abono > 0): ?>
          <tr>
            <td><?php echo e($op->id); ?></td>
            <td><?php echo e(date("d/m/Y h:i:s", strtotime($op->created_at))); ?></td>
            <td>
              <?php echo e($op->cliente->nombre??''); ?>

              <?php if($op->saldo_favor): ?>
              (<?php echo e(number_format($op->saldo_favor,2,'.',',')); ?> <a href="<?php echo e(route('contabilidad.editar_recibos',$op->id_saldo)); ?>" target="_blank" title="Editar recibo"><i class="fas fa-search-plus"></i></a>)      
              <?php endif; ?>
            </td>
            <!--- factura --->
            <td class="monto">
            <?php if($op->nota): ?>
              <?php if($op->nota->estatus == 1): ?>
                <?php echo e(number_format($op->total)); ?>

              <?php else: ?>
                <?php if($op->nota->id_tipo==1): ?>
                  <?php echo e(number_format(($op->total - $op->nota->cantidad),2,'.',',')); ?>

                <?php else: ?>
                  <?php echo e(number_format(($op->total + $op->nota->cantidad),2,'.',',')); ?>

                <?php endif; ?>
              <?php endif; ?>
            <?php else: ?>
                <?php echo e(number_format($op->total,'2','.',',')); ?>

            <?php endif; ?>
            </td>

          </tr>
          <?php endif; ?>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
      </tbody>
      <tfoot>
        <tr id="total_final2">
          <td id="total_final">.TOTAL</td>
          <td></td>
          <td id="data1"></td>
          <td><b class="mostrar_total"></b></td>
          
        </tr>
      </tfoot>
    </table>
  </form>
  </div>
  
  <div class="alert alert-success"><b> Acumulado : <span class="mostrar_total"></span></b></div>

  <div>
  </div>
</div>

<script>
 $(document).ready(function(){
 $.fn.dataTable.moment( 'DD/MM/YYYY' );
  $('#example2').dataTable( {
    "paging": false,
    "order":[[ 0, "desc" ]],
              dom: 'Bfrtip',
              buttons: [
                  'excel', 'print'
              ],
  });


  var total = 0;
  $('.monto').each(function(){
    total += parseFloat($(this).text().replace(/,/g, ''));
  });
  $('.mostrar_total').each(function(){
    $(this).text(total.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,'));
  });

  console.log(total);
})
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/devpwg5/laravelrp.com/resources/views/reportes/reporte_facturas_mes.blade.php ENDPATH**/ ?>