<?php 
include_once("../php/config.php");
        $sql = mysql_query("select * from recargas where fecha='$hoy' order by id asc
		") or die(mysql_error());


?>
<style>
th{
	font-size:18;
}

</style>
<table class="table" data-page-length='100' style="width: 100%">


              <th># Venta</th>

			    <th>Telefono</th>
			 <th>Moneda</th>
              <th>Monto</th>
			   <th>Comision</th>
			   <th>Recibe en CHIP</th>
			   <th>Tipo</th>
			   <th>Compania</th>
              <th>Fecha - Hora</th>
			  <th>Realizada por</th>
			   <th>Asignada a</th>
              <th>Estado</th>
			  <th>Anular</th>

						<tbody>
            <?php while($r=mysql_fetch_array($sql)){?>
			<?php
			$c++;
			$monto+=$r["monto"];
			$comision+=$r["comision_remesa"];
     		$id = $r["id"];
			?>
			
							<tr>
							<td><a class="#"   onClick='ver(<?php echo $r["id"]?>)'><i class="bi bi-stickies"></i> <?php echo $r["id"]?></a></td>

								<td><a class="#"   onClick='ver(<?php echo $r["id"]?>)'><i class="bi bi-stickies"></i> <?php echo $r["telefono"]?></a></td>
               <td><b><?php echo ($r["moneda"])?></b></td>
				<td><?php echo decimal($r["monto"]);?>
				<td><?php echo decimal($r["comision_remesa"]);?>
				
				<td><b class="text-ubuntu"><?php echo decimal($r["recibe"])?></b></td>

				<td><?php echo ($r["tipo"])?></td>
				<td><b class="text-ubuntu"><?php echo ($r["compania"])?></b></td>

			<td><?php echo @fecha($r["fecha"])." | ".$r["hora"];?></td>
              <td><?php echo ($r["usuario"])?></td>
			  <td><?php echo ($r["vendedor"])?></td>

			  <?php if($r["estado"]==""){?>
			  <td><span class="btn btn-rojo">Pendiente</span></td>
			  <?php }?>
			<?php if($r["estado"]=="Realizada"){?>
             <td><span class="btn btn-verde">Realizada</span></td>
			  <?php }?>
			  
			  <?php if($r["estado"]=="Anulada"){?>
             <td><span class="btn btn-orange">Anulada</span></td>
			  <?php }?>
		        
				<td><?php if($_COOKIE["nivel"]=="Master"){?>
					
					<a class="btn btn-rojo"   href="anular_remesa.php?id=<?php echo $r['id']?>"><i class="bi bi-trash"></i> Anular</a></td>
          <?php }?>


            </tr>
                                                        <?php }?>
		
					<b>CANT. RECARGAS:</b> <?php echo $c;?> |
					 <b>MONTO ENVIADO:</b> <?php echo @decimal($monto);?>
					 | <b>COMISION:</b> <?php echo @decimal($comision);?>
					 | <b>TOTAL</b> <?php echo @decimal($comision + $monto);?>
			</table>		 
<?php 
function recibe($producto, $monto){
	   $sql = mysql_query("select remesa from tasas where moneda='GOURDE'") or die(mysql_error());
	   $tasa = @mysql_result($sql, 0, "remesa");
	   return $monto * $tasa;
}

?>