<?php 
date_default_timezone_set('America/Lima'); 
ob_start();
include("../conexion/conexion.php");
  ?>


  <html lang="es">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Inntel Peru - Panel</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">
    <link rel= "stylesheet" type= "text/css" href= "http://fonts.googleapis.com/css?family=Roboto">  
    


	
	<title>Formulario Contacto</title>
	<style type="text/css">
		 table {color:black; 
		 border: none;
            width: 100%;}
		

		 .header{
		 	/*display: inline-block;*/
		 	padding-left: 20px; 
		 	padding-right: 20px; 

		 	
		 }
		 .text{
		 	padding-left: 40px; 
		 	padding-right: 40px;
		 	/*padding-bottom: : 10px;*/
		 	text-align:justify-all;
			line-height: 120%;
		 }
		  .text1{
		 	padding-left: 40px; 
		 	padding-right: 40px;
		 	padding-bottom: : 10px;
		 	text-align:justify-all;
			line-height: 130%;
		 }
		 .text2{
		 	padding-left: 50px; 
		 	padding-right: 40px;
		 	padding-bottom: : 10px;
		 	text-align:justify-all;
			line-height: 170%;
		 }
		 .info{
		 	width: 30%; 
		 	color: #34495e;
		 	font-size:12px;
		 	text-align:justify-all;
		 }
		 .factura{
		 	color: red;
		 	width: 28%;
		 	height:10px;
		 	border: 1px solid red;
		 	text-align: center;
		 }
		 .linea{
		 	padding-left: 10px; 
		 	padding-right: 10px; 

		 }
		 .cliente{
		 	padding-left: 40px; 
		 	padding-right: 40px;

		 }
		 .articulos{
		 	padding-left: 40px; 
		 	padding-right: 40px;
		 	font-size:11px;
		 }
		 .cabecera{
			background:#38c011;
			color:white;
			font-size:12px;
			padding-left: 20px; 
		 	padding-right: 20px;
		 	border: 1px solid #087DA2;
		 }
		 .foot{
		 	padding-left: 20px; 
		 	padding-right: 20px;
		 	font-size: 8pt;


		 }
		  .productos{
		 	font-size:12px;
		 	border-collapse: collapse;
    		        padding-left: 20px; 
		 	padding-right: 20px;	 	
		 }	
		 .silver{
			background:white;
			padding: 3px 4px 3px;
		}
		.clouds{
			background:#ecf0f1;
			padding: 3px 4px 3px;
		}
		/*#encabezado {padding:10px 0; border-top: 1px solid; border-bottom: 1px solid; width:100%;}*/
		#encabezado .fila #col_1 {width: 15%}
		#encabezado .fila #col_2 {text-align:center; width: 55%}
		#encabezado .fila #col_3 {width: 15%}
		#encabezado .fila #col_4 {width: 15%}
		 
		#encabezado .fila td img {width:50%}
		#encabezado .fila #col_2 #span1{font-size: 15px;}
		#encabezado .fila #col_2 #span2{font-size: 12px; color: #4d9;}
		 .column {
            float: left;
            width: 50%;
            padding: 1px;
            box-sizing: border-box;
        }
	</style>
</head>
<body>
<?php 
    setlocale(LC_ALL, 'spanish');

     
     $desde=$_GET['desde'];
     $hasta=$_GET['hasta'];
     $tipo=$_GET['tipo'];
     $pago=$_GET['pago'];
     //$mes=1;

//      $dateObj   = DateTime::createFromFormat('!m', $mes);
//      $monthName = strftime('%B', $dateObj->getTimestamp());

  if($tipo==2){
  $tip="TECNICOS";
  }else{
  $tip="COBRANZA";
  }


 ?>

		<!-- <page backtop="7mm" backbottom="7mm" backleft="10mm" backright="10mm"> -->
		    <page_header>
		        <table id="encabezado">
		            <tr class="fila">
		                <td id="col_1" style="width: 96%" >
		                   <!--  <img style="width: 760px;height: 80px;" src=""> -->
		                </td>
		            </tr>
		        </table>
		    </page_header>
    	 
		 <div class="header">
			 <table style="width: 100%;">
	        	<tr>
		            <td colspan="" style="text-align:center;width: 27%" >
		            </td>
			     <td style="width:60%">
			 <p> REPORTE DE CAJAS <?php echo $tip?> POR FECHAS
			</p>
			</td>
	         	</tr>
   		 	</table>
		</div>	
               
         	<?php          	
         	$query = "SELECT m.id as idcierre,m.fechahora as cierre ,m.fechaapertura as apertura,m.idresponsable,u.nombre,m.operacion FROM `movcajas` m join usuario u on m.idresponsable=u.idusuario WHERE date(m.fechahora) BETWEEN '$desde' and '$hasta' AND m.operacion='2' and u.estadocaja='$tipo' ORDER BY m.id desc";
                  $adicional = mysqli_query($conexion,$query);
                  while ($row1 = mysqli_fetch_array($adicional)){
                    $nombre=$row1['nombre'];
                    $idusu=$row1['idresponsable'];
                    $id=$row1['idcierre'];
                    $aper=$row1['apertura'];
                    $cier=$row1['cierre'];
                    $concat=$nombre;
                    
                  ?>
		
		
		<div  class="productos">
			<table   border="1"  align="center"  bgcolor="#FFFFFF" >
			 <tr  height="50" bgcolor="#F3F3F3">
                    <th    style="text-align: center;font-size:18px" colspan="8" ><?php echo $concat ?></th></tr>  
                      <th    style="text-align: center;font-size:18px" colspan="8" >Fecha Apertura:<?php echo $aper ?>/Fecha Cierre:<?php echo $cier ?></th></tr>  
                  <tr  height="50" bgcolor="#F3F3F3"><th   style="text-align: center" colspan="8" >INGRESO A CAJA</th></tr>      
                  <tr style="background-color:#0a3259">                   
                  <th style="color:#ffffff;">Tipo Pago</th>
                  <th style="color:#ffffff;width: 8%">Fecha de Pago</th>         
                  <th style="color:#ffffff;">Nombre O Razon Social</th>
                  <th style="color:#ffffff;">Servicio</th>              
                  <th style="color:#ffffff;">Banco</th>
                  <th style="color:#ffffff;">Nro Operacion</th>
                  <th style="color:#ffffff;">Nro Comprobante</th>                 
                  <th style="color:#ffffff;">Importe</th>           
        		</tr>
        		 
        		<?php
        		 $query = "SELECT i.idtipo,date(i.fechahora)as fechahora,u.name,i.tiposervicio,a.nombre,b.nombrebanco,i.numeroperacion,i.monto,i.idoperacion,o.tipotrabajo FROM tb_ingreso i left join users u on i.cliente=u.id left join usuario a on i.idresponsable=a.idusuario left join tb_banco b on i.banco=b.id  left join conceptoingreso o on i.tipotrabajo=o.idingreso where  i.idcierre='$id' and i.tipoingreso='$pago' order by i.id desc ";
                  $adicional3 = mysqli_query($conexion,$query);

              $i = 1;
              $suma=0.00;
              $efectivo=0.00;
              $deposito=0.00;
              $otros=0.00;
              $monto=0.00;
               while ($row = mysqli_fetch_array($adicional3)){
                   
                  $suma=$suma+$row['monto'];   
                     
                     
                  if($row['idtipo']=='1'){
                          $row['idtipo']="venta";
                      }else if ($row['idtipo']=='2'){
                          $row['idtipo']="Efectivo";
                          $efectivo=$efectivo+$row['monto']; 
                      }else if ($row['idtipo']=='3'){
                          $row['idtipo']="Deposito";
                          $deposito=$deposito+$row['monto']; 
                      }else if ($row['idtipo']=='4'){
                          $row['idtipo']="Apertura";
                      }else if ($row['idtipo']=='5'){
                          $row['idtipo']="Otros";
                          $otros=$otros+$row['monto'];
                      }

                     $totalefec= $apertura+$efectivo;
                     $totalde= $deposito;

               if($row['tiposervicio']=='1'){
                          $row['tiposervicio']="Servicio Inalambrico";
                      }else if ($row['tiposervicio']=='3'){
                          $row['tiposervicio']="Servicio Fibra Optica";
                      }else if ($row['tiposervicio']=='5'){
                          $row['tiposervicio']="Instalación Sist. Inalambrico";
                      }else if ($row['tiposervicio']=='6'){
                          $row['tiposervicio']="Instalación Sist. Fibra Optica";
                      }else if ($row['tiposervicio']=='7'){
                          $row['tiposervicio']="Configuración Router o Antena";
                      }else if ($row['tiposervicio']=='8'){
                          $row['tiposervicio']="Migración";
                      }else if ($row['tiposervicio']=='9'){
                          $row['tiposervicio']="Reubicación/ Reconexión";
                      }else if ($row['tiposervicio']=='10'){
                          $row['tiposervicio']="Averia";
                      }else if ($row['tiposervicio']=='11'){
                          $row['tiposervicio']="Venta Equipos y Materiales";
                      }else if ($row['tiposervicio']=='12'){
                          $row['tiposervicio']="Otros Diversos";
                      }else if ($row['tiposervicio']=='4'){
                          $row['tiposervicio']="Tv Cable Satelital";
                      }
                      
                      $tipotr=$row['tipotrabajo'];
                  
 
                        //$id = $row['id'];
                        $idt = $row['idtipo']; 
                        $tipo = $row['tiposervicio']; 
                        $idp = number_format($row['monto'], 2,'.','') ;                                            
                        $fechau = $row['fechahora'];
                        $cliente = $row['name'];
                        $responsable = $row['nombre'];
                         $idoperacion = $row['idoperacion'];
                         $numeroperacion = $row['numeroperacion'];
                         $banco = $row['nombrebanco'];
              

    ?>
        		
        		
           <tr style="font-size:14px; text-align:center"> 
           
           <th><?php echo "$idt"; ?> </th>
           <th><?php echo "$fechau"; ?> </th>
           <th><?php echo "$cliente"; ?></th>
           <th><?php echo "$tipotr"; ?></th>
           <th><?php echo "$banco"; ?></th>
           <th><?php echo "$numeroperacion"; ?></th>
           <th><?php echo "$idoperacion"; ?></th>
           <th><?php echo "$idp"; ?></th>
          
           </tr>
           
            <?php
      // $cont++;
        }
        
  
       ?>
   
              
     
                     <tr style="font-size:18px; text-align:center; background-color:#8abcf2;"> 
                    <th colspan="7" style="text-align: right" >Total Ingresos</th>
                    <th>S/<?php echo number_format($suma,2,'.',''); ?></th>
                  </tr>
                  <tfoot>
  
                  </tfoot>
         
              
 

        
       	

<P class="text1"><b></b></p>
			
			 <tr height="50" bgcolor="#F3F3F3"><th style="text-align: center" colspan="8">EGRESO DE CAJA</th></tr>        
                <tr style="background-color:#0a3259">
                   <th  style="color:#ffffff;width: 1%">#</th>                 
                  <th colspan="1" style="color:#ffffff;">Fecha de Pago</th> 
                  <th style="color:#ffffff;">Tipo Pago</th>        
                  <th style="color:#ffffff;">Clasificador de Gasto</th>
                  <th style="color:#ffffff;">Detalle Gasto</th>                  
                  <th style="color:#ffffff;">Comprobante</th>                  
                  <th style="color:#ffffff;">Nro Comprobante</th>                 
                  <th style="color:#ffffff;">Monto</th>        
        		</tr>
        		 
        		<?php
        	 $query = "SELECT e.id,e.idtipo,e.monto,c.concepto,e.descripcion,e.nrorecibo,e.tipopago,e.comprobante,date(e.fechapago)as fechapago,s.nombre FROM tb_egreso e join conceptoegreso c on e.concepto=c.idconcepto join usuario s on e.idresponsable=s.idusuario WHERE e.idcierre='$id' and e.tipopago='$pago' order by e.id desc ";
                  $adicional3 = mysqli_query($conexion,$query);
               //$cont=0;
              $i = 1;
                  $suma1=0.00;
                  $efectivoe=0.00;
                  $depositoe=0.00;
                  $otros=0.00;
               while ($row = mysqli_fetch_array($adicional3)){
                   
               $suma1=$suma1+$row['monto'];                    
                     
                  if($row['idtipo']=='1'){
                          $row['idtipo']="Fijo";
                      }else if ($row['idtipo']=='2'){
                          $row['idtipo']="Variable";                          
                      }

                      if($row['tipopago']=='2'){
                           $row['tipopago']="Efectivo";
                           $efectivoe=$efectivoe+$row['monto'];
                      }else if ($row['tipopago']=='3'){
                          $row['tipopago']="Deposito";
                          $depositoe=$depositoe+$row['monto'];

                      }

                      if($row['comprobante']=='1'){
                          $row['comprobante']="Recibo";
                      }else if ($row['comprobante']=='2'){
                          $row['comprobante']="Boleta";                          
                      }else if ($row['comprobante']=='3'){
                          $row['comprobante']="Factura";
                        }
 
                        $idt = $row['idtipo']; 
                        $tipo = $row['tipopago']; 
                        $fechap = $row['fechapago'];
                        $con = $row['concepto'];
                        $des = $row['descripcion'];
                        $comp = $row['comprobante'];
                        $nro1 = $row['nrorecibo'];
                        $nomb = $row['nombre'];
                        $idp = number_format($row['monto'], 2,'.','') ;      
              

    ?>
        		
        		
           <tr style="font-size:14px; text-align:center"> 
           <th colspan="1" ></th>
           <th  ><?php echo "$fechap"; ?> </th>
           <th><?php echo "$idt"; ?> </th>
           <th><?php echo "$con"; ?></th>
           <th><?php echo "$des"; ?></th>
           <th><?php echo "$comp"; ?></th>
           <th><?php echo "$nro1"; ?></th>
           <th><?php echo "$idp"; ?></th>
          
           </tr>
           
            <?php
      // $cont++;
        }
        
  
       ?>
   
      
                  <tr style="font-size:18px; text-align:center; background-color:#f23535;"> 
                    <th  colspan="7" style="text-align: right;color:#ffffff;"  >Total Gastos</th>
                    <th style="color:#ffffff;" >S/<?php echo number_format($suma1,2,'.',''); ?></th>
                  </tr>
 

	</table>
</div>

  <?php 
  }
  ?>
  
  
    <P class="text1"><b></b></p>
    <P class="text1"><b></b></p>
<P class="text1"><b>Resumen de Cajas</b></p>     	
     	 <div class="table-responsive">				
			<table style="border: solid 1px #050505 ">
			<tr  height="50" bgcolor="#F3F3F3"><th   style="text-align: center" colspan="2" >APERTURA DE CAJA</th></tr>	
           		<tr style="width: 50%; background:#38c011;color:white;text-align: left; border="0.2">                         
                           <td style="text-align: center; width:20%">Nombre Responsable</td>		            
		            <td style="text-align: center; width:20%">Monto Total</td>		                      
        		</tr>
                <?php 
                
     $desde=$_GET['desde'];
     $hasta=$_GET['hasta'];
     $tipo=$_GET['tipo'];
     $pago=$_GET['pago'];
                $query = "SELECT m.id as idcierre,m.fechahora as cierre ,m.fechaapertura as apertura,m.idresponsable,u.nombre,m.operacion,m.nrocorrelativo FROM `movcajas` m join usuario u on m.idresponsable=u.idusuario WHERE date(m.fechahora) BETWEEN '$desde' and '$hasta' AND m.operacion='2' and u.estadocaja='$tipo' ORDER BY m.id desc";
                      $adicional = mysqli_query($conexion,$query);                 
        		$montoaper=0;
        		while($row1 = mysqli_fetch_array($adicional)){
        			$apertura=$row1['idcierre']; 
        			$nombre1=$row1['nombre'];      
                                $aper=$row1['apertura'];
        			 $cero=00;
                                $ano1 = date("Y",strtotime ($aper));
                                $mes1 = date("m",strtotime($aper));
                                $nro = $ano1.''.$mes1.'-'.$cero.''.$row1['nrocorrelativo'];
                                $concatenar=$nombre1."&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;".$nro;
        			 $montoapertura=$row1['monto'];
        						
        			?>	
				<?php 
				$query = "SELECT m.monto,m.fechahora,u.nombre,u.nombre FROM movcajas m join usuario u on m.idresponsable=u.idusuario  where m.idcierre='".$apertura."'";
                                $adicional1 = mysqli_query($conexion,$query); 
                                //$montoaper=0;
                                while($row1 = mysqli_fetch_array($adicional1)){
                                $montoaper=$montoaper+$row1['monto'];                                
        			$nombre=$row1['nombre']; 
        			$montoapertura=$row1['monto'];
				?>
				<tr style="width: 80%; text-align: center;">
				<td style="width:20%;border: solid 0.3px #050505"><?php echo $concatenar ?></td>					
				<td style="width:20%;border: solid 0.3px #050505">S/<?php echo number_format($montoapertura,2); ?></td>
				</tr>				
	                 	<?php } ?>
				<?php } ?>	
            		<tr style="width: 80%; text-align: center;">
            				<td style="width:20%;background:#241e1f;color:white;font-size:15;font-weight:bold">Total Apertura</td>					
					<td style="width:20%;background:#241e1f;color:white;font-size:15;font-weight:bold">S/<?php echo number_format($montoaper,2) ?></td>		

        	</table>
        </div>
        
         <P class="text1"><b></b></p>
         <div class="table-responsive">       
      <table style="border: solid 1px #050505 ">
      <tr  height="50" bgcolor="#F3F3F3"><th   style="text-align: center" colspan="3" >INGRESO CAJA</th></tr>  
              <tr style="width: 50%; background:#38c011;color:white;text-align: left; border="0.2">                         
                <td style="text-align: center; width:20%">Nombre Responsable</td>                
                <td style="text-align: center; width:20%">Monto Efectivo</td>
                <td style="text-align: center; width:20%">Monto Deposito</td>                          
            </tr>
           <?php 
           $montoingd=0.00;
            $montoinge=0.00;
            $query = "SELECT m.id as idcierre,m.fechahora as cierre ,m.fechaapertura as apertura,m.idresponsable,u.nombre,m.operacion,m.nrocorrelativo FROM `movcajas` m join usuario u on m.idresponsable=u.idusuario WHERE date(m.fechahora) BETWEEN '$desde' and '$hasta' AND m.operacion='2' and u.estadocaja='$tipo' ORDER BY m.id desc";
             $adicional = mysqli_query($conexion,$query);                             
            while($row1 = mysqli_fetch_array($adicional)){
              $apertura=$row1['idcierre'];   
               $nombre2=$row1['nombre'];
              $cie=$row1['cierre'];
              
               $cero=00;
              $ano1 = date("Y",strtotime ($cie));
              $mes1 = date("m",strtotime($cie));
              $nro = $ano1.''.$mes1.'-'.$cero.''.$row1['nrocorrelativo'];
               $concatenar1=$nombre2."&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;".$nro;          
           ?>            
        <?php 
        
     $query1 = "SELECT i.monto as montoo,u.nombre,i.tipoingreso FROM tb_ingreso i left join usuario u on i.idresponsable=u.idusuario where i.idcierre='".$apertura."' and i.tipoingreso='$pago' ";
           $adicional2 = mysqli_query($conexion,$query1);
            $depoi=0;
            $efei=0;
           
            while($row2 = mysqli_fetch_array($adicional2)){
             // $montoing=$montoing+$row2['montoo'];
              $nombre=$row2['nombre']; 
             // $montoingreso=$row2['montoo'];
              
              if($row2['tipoingreso']==3){
              $depoi= $depoi+$row2['montoo'];
               $montoingd=$montoingd+$row2['montoo'];
              }else{
              $efei=$efei+$row2['montoo'];
               $montoinge=$montoinge+$row2['montoo'];
              }
              
              
             
       ?>
              
    <?php } ?>
    
     
     <tr style="width: 80%; text-align: center;">                                    
          <td style="width:20%;border: solid 0.3px #050505"><?php echo $concatenar1 ?></td>          
          <td style="width:20%;border: solid 0.3px #050505">S/<?php echo number_format($efei,2); ?></td>
          <td style="width:20%;border: solid 0.3px #050505">S/<?php echo number_format($depoi,2); ?></td>
        </tr> 
           
    <?php } ?>  
         <tr style="width: 80%; text-align: center;">                
          <td style="width:20%;background:#241e1f;color:white;font-size:15;font-weight:bold">Total Ingreso</td>         
          <td style="width:20%;background:#241e1f;color:white;font-size:15;font-weight:bold">S/<?php echo number_format($montoinge,2) ?></td>   
          <td style="width:20%;background:#241e1f;color:white;font-size:15;font-weight:bold">S/<?php echo number_format($montoingd,2) ?></td> 
          </table>
        </div>
        
         <P class="text1"><b></b></p>
        
        <div class="table-responsive">       
      <table style="border: solid 1px #050505 ">
      <tr  height="50" bgcolor="#F3F3F3"><th   style="text-align: center" colspan="3" >EGRESO CAJA</th></tr>  
              <tr style="width: 50%; background:#38c011;color:white;text-align: left; border="0.2">                         
                           <td style="text-align: center; width:20%">Nombre Responsable</td>                
                <td style="text-align: center; width:20%">Monto Efectivo</td>                          
                <td style="text-align: center; width:20%">Monto Deposito</td>
            </tr>
           <?php 
           $montoingee=0.00;
           $montoingdd=0.00;
            $query = "SELECT m.id as idcierre,m.fechahora as cierre ,m.fechaapertura as apertura,m.idresponsable,u.nombre,m.operacion,m.nrocorrelativo FROM `movcajas` m join usuario u on m.idresponsable=u.idusuario WHERE date(m.fechahora) BETWEEN '$desde' and '$hasta' AND m.operacion='2' and u.estadocaja='$tipo' ORDER BY m.id desc";
             $adicional = mysqli_query($conexion,$query);                             
            while($row1 = mysqli_fetch_array($adicional)){
              $apertura=$row1['idcierre']; 
             $nombree=$row1['nombre'];
              $cie=$row1['cierre']; 
                 $cero=00;
              $ano1 = date("Y",strtotime ($cie));
              $mes1 = date("m",strtotime($cie));
              $nro = $ano1.''.$mes1.'-'.$cero.''.$row1['nrocorrelativo'];   
              $concatenar2=$nombree."&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;".$nro;             
           ?>            
        <?php 
     $query1 = "SELECT e.monto as montooo,s.nombre,e.tipopago FROM tb_egreso e left join usuario s on e.idresponsable=s.idusuario where e.idcierre='".$apertura."' and e.tipopago='$pago'";
           $adicional2 = mysqli_query($conexion,$query1);
            $depoii=0.00;
             $efeii=0.00;
            while($row2 = mysqli_fetch_array($adicional2)){
              $montoegre=$montoegre+$row2['montooo'];
              $nombre=$row2['nombre']; 
              $montoegreso=$row2['montooo'];
              
               if($row2['tipopago']==3){
              $depoii= $depoii+$row2['montooo'];
               $montoingdd=$montoingdd+$row2['montooo'];
              }else{
              $efeii=$efeii+$row2['montooo'];
               $montoingee=$montoingee+$row2['montooo'];
              }
       ?>
                
    <?php } ?> 
    <tr style="width: 80%; text-align: center;">                                    
          <td style="width:20%;border: solid 0.3px #050505"><?php echo $concatenar2 ?></td>          
          <td style="width:20%;border: solid 0.3px #050505">S/<?php echo number_format($efeii,2); ?></td>
          <td style="width:20%;border: solid 0.3px #050505">S/<?php echo number_format($depoii,2); ?></td>
        </tr>     
    <?php } ?>  
         <tr style="width: 80%; text-align: center;">                
          <td style="width:20%;background:#241e1f;color:white;font-size:15;font-weight:bold">Total Egreso</td>         
          <td style="width:20%;background:#241e1f;color:white;font-size:15;font-weight:bold">S/<?php echo number_format($montoingee,2) ?></td>   
          <td style="width:20%;background:#241e1f;color:white;font-size:15;font-weight:bold">S/<?php echo number_format($montoingdd,2) ?></td> 
          </table>
        </div>
        
         <P class="text1"><b></b></p>
         
              <div class="table-responsive">       
      <table style="border: solid 1px #050505 ">
      <tr  height="50" bgcolor="#F3F3F3"><th   style="text-align: center" colspan="3" >SALDO TOTAL</th></tr>  
              <tr style="width: 50%; background:#38c011;color:white;text-align: left; border="0.2">                         
                           <td style="text-align: center; width:20%">Nombre Responsable</td>                
                <td style="text-align: center; width:20%">Monto Total Efectivo</td> 
                <td style="text-align: center; width:20%">Monto Total Deposito</td>                          
            </tr>
            <tr style="width: 80%; text-align: center;">
		<td style="width:20%;border: solid 0.3px #050505 ">Saldo Inicial</td>
		<td style="width:20%;border: solid 0.3px #050505 ">S/<?php echo number_format($montoaper,2); ?></td>									
		<td style="width:20%;border: solid 0.3px #050505 ">S/0.00</td>
		</tr>	
          	<tr style="width: 80%; text-align: center;">
		<td style="width:20%;border: solid 0.3px #050505 ">Ingreso</td>
		<td style="width:20%;border: solid 0.3px #050505 ">S/<?php echo number_format($montoinge,2); ?></td>									
		<td style="width:20%;border: solid 0.3px #050505 ">S/<?php echo number_format($montoingd,2); ?></td>
		</tr>	
		<tr style="width: 80%; text-align: center;">
		<td style="width:20%;border: solid 0.3px #050505 ">Egreso (D)</td>
		<td style="width:20%;border: solid 0.3px #050505 ">S/<?php echo number_format($montoingee,2); ?></td>
		<td style="width:20%;border: solid 0.3px #050505 ">S/<?php echo number_format($montoingdd,2); ?></td>									
		</tr>					
		<tr style="width: 80%; text-align: center;">
		<td style="width:20%;background:#f23535;color:white;font-size:15;font-weight:bold">Saldo Total</td>
		<td style="width:20%;background:#f23535;color:white;font-size:15;font-weight:bold">S/<?php echo number_format($montoaper+$montoinge-$montoingee,2); ?></td>								
		<td style="width:20%;background:#f23535;color:white;font-size:15;font-weight:bold">S/<?php echo number_format($montoingd-$montoingdd,2); ?></td>
		</tr>  
          </table>
        </div>

		<?php 
		$dia=date("d");
		$mes=date("m");
		$anio=date("Y");
		$hora=date("g:i A");
		$query1 = "SELECT nombre FROM `usuario` where idusuario='3'";
                $adicional = mysqli_query($conexion,$query1);
                $row10 = mysqli_fetch_array($adicional);
                $nomb=$row10['nombre'];
              
               $dateObj   = DateTime::createFromFormat('!m', $mes);
              $monthName = strftime('%B', $dateObj->getTimestamp());
                 
		
		?>			
	<p class="text" style=""> HUANCAYO, <?php echo $dia;?> <?php echo strtoupper($monthName); ?> DEL <?php echo $anio;?> HORA: <?php echo $hora ?> </p>
		<br>

		



 	 <page_footer>
		        <table id="">
		            <tr class="">
		                <td style="">
		                    <!-- <img style="width: 760px;height: 140px;" src=""> -->
		                    <!-- 240 -->
		                </td>
		            </tr>
		        </table>
    	</page_footer>
			
</body>
</html>



<?php 
$html=ob_get_clean();
//echo $html;

require_once '../reportes/libreria/dompdf/autoload.inc.php';
use Dompdf\Dompdf;
$dompdf = new Dompdf();

$options = $dompdf->getOptions();
$options->set(array('isRemoteEnabled' => true));
$dompdf->setOptions($options);

$dompdf->loadHtml($html);

$dompdf->setPaper('letter');
$dompdf->setPaper('A4','landscape');
//$dompdf->set

$dompdf->render();
$dompdf->stream("reporte-detallado.pdf",array('Attachment' => false));




?>