       <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            Dashboard
            <small>Version 2.0</small>
          </h1>
          <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li class="active">Dashboard</li>
          </ol>
        </section>

        <!-- Main content -->
        <section class="content">
          <!-- Info boxes -->
          <div class="row">
            <div class="col-md-3 col-sm-6 col-xs-12">
              <div class="info-box">
                <span class="info-box-icon bg-aqua"><i class="fa fa-shopping-bag"></i></span>
                <div class="info-box-content">
                  <span class="info-box-text">Productos</span>
                  <span class="info-box-number"><?=$db->fetch_custom_single('SELECT Count(*) as cont FROM productos')->cont?></span>
                </div><!-- /.info-box-content -->
              </div><!-- /.info-box -->
            </div><!-- /.col -->
            <div class="col-md-3 col-sm-6 col-xs-12">
              <div class="info-box">
                <span class="info-box-icon bg-red"><i class="fa fa-dollar"></i></span>
                <div class="info-box-content">
                  <span class="info-box-text">Egresos <?php setlocale(LC_TIME, "spanish"); date_default_timezone_set('America/Bogota');echo strftime("%B"); ?></span>
                  <span class="info-box-number">$<?=number_format($db->fetch_custom_single('SELECT Sum(gasto.valor) as egre FROM gasto WHERE MONTH(gasto.fecha) = MONTH(CURRENT_DATE()) AND YEAR(gasto.fecha) = YEAR(CURRENT_DATE())')->egre);?></span>
                </div><!-- /.info-box-content -->
              </div><!-- /.info-box -->
            </div><!-- /.col -->

            <!-- fix for small devices only -->
            <div class="clearfix visible-sm-block"></div>

            <div class="col-md-3 col-sm-6 col-xs-12">
              <div class="info-box">
                <span class="info-box-icon bg-green"><i class="ion ion-ios-cart-outline"></i></span>
                <div class="info-box-content">
                  <span class="info-box-text">Ventas <?php setlocale(LC_TIME, "spanish"); date_default_timezone_set('America/Bogota');echo strftime("%B"); ?></span>
                  <span class="info-box-number">$<?=number_format($db->fetch_custom_single('SELECT Sum(factura.total_venta) AS venta FROM factura WHERE factura.estado <> "A" AND MONTH(factura.fecha) = MONTH( CURRENT_DATE()) AND YEAR(factura.fecha) = YEAR(CURRENT_DATE())')->venta)?></span>
                </div><!-- /.info-box-content -->
              </div><!-- /.info-box -->
            </div><!-- /.col -->
            <div class="col-md-3 col-sm-6 col-xs-12">
              <div class="info-box">
                <span class="info-box-icon bg-yellow"><i class="ion ion-ios-people-outline"></i></span>
                <div class="info-box-content">
                  <span class="info-box-text">Clientes</span>
                  <span class="info-box-number"><?=$db->fetch_custom_single('SELECT Sum(clientes.idclientes) as cli FROM clientes ')->cli?></span>
                </div><!-- /.info-box-content -->
              </div><!-- /.info-box -->
            </div><!-- /.col -->
          </div><!-- /.row -->

         
          <!-- Main row -->
          <div class="row">
            <!-- Left col -->
            <div class="col-md-12">
              <!-- MAP & BOX PANE -->
              <div class="box">
                <div class="box-header with-border">
                  <h3 class="box-title">Reporte Diario</h3>
                  <div class="box-tools pull-right">
                    <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
                    <button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                  </div>
                </div><!-- /.box-header -->
                <div class="box-body">
                  <h4 class="label pull-left bg-green">Fecha: <?php setlocale(LC_TIME, "spanish"); date_default_timezone_set('America/Bogota');echo strftime("%A %e %B %G"); ?></h4>
                  <table id="dtb_manual" class="table table-bordered table-striped">
                                   <thead>
                                     <tr>
                           <th style="width:25px" align="center">No</th>
                          <th>Factura</th>
                          <th>Fecha</th>
                          <th>Cliente</th>
                          <th>Total</th>
                          
                         
                        </tr>
                                      </thead>
                                        <tbody>
                                         <?php 
      $dtb=$db->fetch_custom("SELECT factura.numfact, clientes.nombres, clientes.apellidos, factura.total_venta, factura.fecha FROM factura INNER JOIN clientes ON factura.clientes_idclientes = clientes.idclientes WHERE factura.fecha = CURRENT_DATE() AND factura.estado='P'");
      $i=1;
      foreach ($dtb as $isi) {
        ?><tr id="line_<?=$isi->idcategoria;?>">
        <td align="center"><?=$i;?></td><td><?=$isi->numfact;?></td>
        <td><?=$isi->fecha;?></td>
        <td><?=$isi->nombres;?> <?=$isi->apellidos;?></td>
        <td><?=$isi->total_venta;?></td>
        </tr>
        <?php
        $i++;
      }
      ?>
                                        </tbody>
                                    </table>
                </div>
                <div class="box-footer">
                  <div class="row">
                    <div class="col-sm-3 col-xs-6">
                      <div class="description-block border-right">
                        <!--<span class="description-percentage text-green"><i class="fa fa-caret-up"></i> 17%</span>-->
                        <h5 class="description-header">$<?=number_format($db->fetch_custom_single('SELECT Sum(factura.total_venta) as ve FROM factura WHERE factura.fecha = CURRENT_DATE() AND factura.estado = "P"')->ve)?></h5>
                        <span class="description-text"><small class="label bg-green"><?php setlocale(LC_TIME, "spanish"); date_default_timezone_set('America/Bogota');echo strftime("%A %e %B %G"); ?></small></span>
                      </div><!-- /.description-block -->
                    </div><!-- /.col -->
                    <div class="col-sm-3 col-xs-6">
                      <div class="description-block border-right">
                        <!--<span class="description-percentage text-yellow"><i class="fa fa-caret-left"></i> 0%</span>-->
                        <h5 class="description-header">$<?=number_format($db->fetch_custom_single('SELECT Sum(factura.total_venta) as ve FROM factura WHERE factura.fecha = CURRENT_DATE()-1 AND factura.estado = "P"')->ve)?></h5>
                        <span class="description-text"><small class="label bg-yellow"><?php setlocale(LC_TIME, "spanish"); date_default_timezone_set('America/Bogota');echo utf8_encode(strftime("%A %e %B %G",strtotime('-1 day', strtotime(date('Y-m-d'))))); ?></small></span>
                      </div><!-- /.description-block -->
                    </div><!-- /.col -->
                    <div class="col-sm-3 col-xs-6">
                      <div class="description-block border-right">
                        <!--<span class="description-percentage text-green"><i class="fa fa-caret-up"></i> 20%</span>-->
                        <h5 class="description-header">$<?=number_format($db->fetch_custom_single('SELECT Sum(factura.total_venta) as ve FROM factura WHERE factura.fecha = CURRENT_DATE()-2 AND factura.estado = "P"')->ve)?></h5>
                        <span class="description-text"><small class="label bg-yellow"><?php setlocale(LC_TIME, "spanish"); date_default_timezone_set('America/Bogota');echo utf8_encode(strftime("%A %e %B %G",strtotime('-2 day', strtotime(date('Y-m-d'))))); ?></small></span>
                      </div><!-- /.description-block -->
                    </div><!-- /.col -->
                    <div class="col-sm-3 col-xs-6">
                      <div class="description-block">
                        <!--<span class="description-percentage text-red"><i class="fa fa-caret-down"></i> 18%</span>-->
                        <h5 class="description-header">$<?=number_format($db->fetch_custom_single('SELECT Sum(factura.total_venta) as ve FROM factura WHERE factura.fecha = CURRENT_DATE()-3 AND factura.estado = "P"')->ve)?></h5>
                        <span class="description-text"><small class="label bg-yellow"><?php setlocale(LC_TIME, "spanish"); date_default_timezone_set('America/Bogota');echo utf8_encode(strftime("%A %e %B %G",strtotime('-3 day', strtotime(date('Y-m-d'))))); ?></small></span>
                      </div><!-- /.description-block -->
                    </div>
                  </div><!-- /.row -->
                </div><!-- /.box-footer -->
              </div><!-- /.box -->

            </div><!-- /.col -->

            <!-- Left col -->
            <div class="col-md-12">
              <!-- MAP & BOX PANE -->
              <div class="box">
                <div class="box-header with-border">
                  <h3 class="box-title">Reporte de Ganancias</h3>
                  <div class="box-tools pull-right">
                    <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
                    <button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                  </div>
                </div><!-- /.box-header -->
                <div class="box-body">
                  <form id="reporfecha" class="form-horizontal foto_banyak">
                    <div class="col-lg-4">
                 <div class="form-group ">
                        <label for="Fecha" class="control-label">Fecha Desde</label>
                        <div class="input-group">
                          <div class="input-group-addon">
                            <i class="fa fa-calendar"></i>
                          </div>
                          <input type="date" name="fechad"  id="tgl1" data-rule-date="true" placeholder="Fecha" class="form-control"> 
                        </div>
                      </div><!-- /.form-group -->
                    </div>
                    <div class="col-lg-4 col-lg-offset-1">
                      <div class="form-group  ">
                        <label for="Fecha" class="control-label">Fecha Hasta</label>
                        <div class="input-group">
                          <div class="input-group-addon">
                            <i class="fa fa-calendar"></i>
                          </div>
                          <input type="date" name="fechah"  id="tgl1" data-rule-date="true" placeholder="Fecha" class="form-control" > 
                        </div>
                      </div><!-- /.form-group --> 
                      </div>
                      <div class="col-lg-2 col-lg-offset-1">
                        <div class="form-group">
                        <label for="tags" class="control-label">&nbsp;</label>
                        <div class="input-group">
                          <input id="enviar" type="submit" class="btn btn-primary btn-flat" value="Enviar">
                        </div>
                      </div><!-- /.form-group -->
                      </div>
                    </form>
                    <div id="ta"></div>
                  </div><!-- /.row -->
                </div><!-- /.box-footer -->
              </div><!-- /.box -->

            </div><!-- /.col -->


        </section><!-- /.content -->
<script>
$('#enviar').click(function(){
  var gana = $('#reporfecha').serialize();
  $.ajax({
    url: '<?=base_admin();?>modul/nuevafactura/ganancias.php',
    type: 'POST',
    data: gana,
    success: function(data){
      $('#ta').html(data);
    }
  })
  return false;
})
</script>