<?php include('casa/setup.casa.php');
include('inc_scripts.php');
$title = 'Reportes Caja Chica';
echo "<title>".AppName.' - '.$title."</title>";
?>
<style>
th{background:#156E10;
color:white;
text-align:center;
text-transform:uppercase;}	
</style>
</head>
<body>
	<div class="wrapper">		
	<?php include('inc_menu.php');?>
		<div class="main-panel">
			<div class="content">
				
			<div class="page-inner">
					
					<div class="row">						
						<div class="col-md-12">
							<div class="card">
								<div class="card-header">
									<div class="d-flex align-items-center">
										<h3 class="card-title"><?php echo $title?></h3>																																									
									</div>
								</div>
								
								<div class="card-body">		
																									
									<div class="table-responsive">										
										<table id="add-row" class="display table table-striped table-hover" >
											<thead>
												<tr>													
													<th>N&ordm;</th>
													<th>Usuario</th>
													<th>Detalles</th>
													<th>Importe</th>
													<th>fecha</th>
												</tr>
											</thead>											
											<tbody>
											<?php
											$sql = "SELECT * FROM inventarios_cajachica caja, rol_usuarios us 
											WHERE caja.us_codigo = us.us_id
											ORDER BY caja.caja_id ASC;";	
											$db= new DB();
											$db->dbSQL($sql);
											$html='';
											$i=0;
											while($db->next()){						
											$i++;										
											//usuario					
												$UsNombres = $db->dbField('us_nombres').' '.$db->dbField('us_apellidos');		
												$UsTipo = $db->dbField('rol_id');
											//cajachica
												$caja_codigo = $db->dbField('caja_codigo');
												$caja_detalle = $db->dbField('caja_detalle');
												$caja_importe = $db->dbField('caja_importe');
												$caja_fecha = $db->dbField('caja_fecha');												

												$html.='<tr>';
													$html.='<td align=center>'.$i.'</td>';
													$html.='<td>'.$UsNombres.'</td>';
													$html.='<td>'.$caja_detalle.'</td>';
													$html.='<td align=right>'.number_format($caja_importe,2).'</td>';				
													$html.='<td>'.$caja_fecha.'</td>';														
												$html.='</tr>';											
												
											}//wend() 
											
											echo utf8_encode($html);
											?>													
											</tbody>
										</table>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				
			</div>
			<?php include('inc_pie.php');?>
		</div>
		
		
	</div>
</body>
</html>
<script>
$(document).ready(function() {			
	$('#add-row').DataTable({
		"pageLength": 25,
	});
});	
$('#cmbCiudades').change(function(){
    let codegen = $(this).val();
    if(codegen == '') codegen ='ver';
    self.location="<?php echo PATH_HOME.'eventos/' ?>"+codegen;
});
</script>