<?php 
ini_set('date.timezone','America/Lima');
require_once("../include/InforegMod.php");
if(isset($_SESSION["session_edgard"])){
	$obj_con=new InforegMod();
	if($_POST["ano"]=="nada" && $_POST["mes"]=="nada" && $_POST["dia"]=="nada"){
		$ano = date("Y");
		$mes = date("m"); 
		$dia = date("d");
		$valor=$obj_con->listarInforegAnoMesDia($ano,$mes,$dia);
	}else{
		$ano = $_POST["ano"];
		$mes = $_POST["mes"]; 
		$dia = $_POST["dia"]; 
		$valor=$obj_con->listarInforegAnoMesDia($ano,$mes,$dia);
	}
?>
<?php 
	require_once("../include/AdquisicionMod.php");
	$obj_ena=new AdquisicionEnt();
	$obj_moa=new AdquisicionMod();
?>
<?php 
	require_once("../include/EntidadMod.php");
	$obj_een=new EntidadEnt();
	$obj_men=new EntidadMod();
?>
<?php 
	require_once("../include/UsuarioMod.php");
	$obj_ent=new UsuarioEnt();
	$obj_mod=new UsuarioMod();
	$obj_ent->setIdusua($_SESSION["session_edgard"]);
	$val=$obj_mod->mostrarUsuario($obj_ent);
	$idusua=$val->getIdusua();
	$nombreu=$val->getNombreu();
?>
<?php 
	$fecha_actual = date("Y-m-d H:i:s");
	$fecha_actual2= date("Y-m-d");
?>
<style>
	body{font-family: Gotham, "Helvetica Neue", Helvetica, Arial, "sans-serif";}
	.tabla{border: 1px solid #000000;background-color: #FFFFFF;}
	.lp{font-size: 12px;}
	.tds {
		border-bottom: 1px dashed #000000;
		border-left: 0px solid #000000;
		border-right: 1px solid #000000;
		font-size:12px;
		padding-left: 8px;
		padding-right: 6px;
		padding-top: 6px;
		padding-bottom: 6px;
	}
	th {
		border-bottom: 1px solid #000000;
		border-left: 0px solid #000000;
		border-right: 1px solid #000000;
		background-color: #C8C9FF;
		font-size: 14px;
	}
</style>

<div style="display: block" id="">
	<table class="tabla" width="100%" cellspacing="0" cellpadding="0">
	<tbody>
		<tr>
			<th scope="col">Contacto</th>
			<th scope="col">Entidad</th>
			<th scope="col">Telefono</th>
			<th scope="col">Area</th>
			<th scope="col">Motivo</th>
			<th scope="col">Lo asigna</th>
			<th scope="col">Responsable</th>
			<th scope="col">Resultado</th>
			<th scope="col">Hora</th>
			<th scope="col">Estado</th>
		</tr>
		<?php if($valor!=0){for($k=0;$k<count($valor);$k++){ 
			$nb = ucwords(strtolower($valor[$k]->getNombres()));
			$ap = ucwords(strtolower($valor[$k]->getApellidos()));
			$co = $valor[$k]->getCodsiaf();
			$or = ucwords(strtolower($valor[$k]->getOrganizacion()));
			$te = $valor[$k]->getTelefono();
			$ce = $valor[$k]->getCelular();
			$ar = ucwords(strtolower($valor[$k]->getOficina()));
			$pr = $valor[$k]->getProblema();
			$re = $valor[$k]->getResultado();
			$us = $valor[$k]->getUsnombreu();
			$no = $valor[$k]->getNombreu();
			$fe = $valor[$k]->getFecha_registro();
			$ff = $valor[$k]->getFechafa();
		?>
		<tr>
			<td class="tds" width="10%"><?=$nb." ".$ap?></td>
			<td class="tds" width="18%" ><?=$co." - ".$or?></td>
			<td class="tds" width="8%"><?=$te." - ".$ce?></td>
			<td class="tds" width="12%"><?=$ar?></td>
			<td class="tds" width="12%"><?=$pr?></td>
			<td class="tds" width="8%"><?=$us?></td>
			<td class="tds" width="8%"><?=$no?></td>
			<td class="tds" width="12%"><?=$re?></td>
			<td class="tds" width="6%">
				<?=date("h:i a", strtotime($fe));?><br>
				<?php if($ff!=''){?>
					<?=date("h:i a", strtotime($ff));?>
				<?php } ?>
			</td>
			<td class="tds" width="6%">
				<?php 
					if($re==''){
						echo 'Pendiente';
					}else{
						echo 'Atendido';
					}
				?>
			</td>
		</tr>
		<?php }}else{ ?>
		<tr>
			<td width="10%" colspan="10" align="center" class="tds">SIN ASISTENCIAS</td>
		</tr>
		<?php } ?>
	</tbody>
	</table>
</div>

<?php }else{ ?>
	<script>
		alert('Inicie sesion por favor');
		window.location.href = "admi_";
    </script>
<?php } ?>
