<?php 
require("../conectar.php");
require("funciones.php");
$periodoinicial=date("Y-m-");
$periodofinal=date("Y-m-");
$periodofinal.="30";
$periodoinicial.="01";
$actividad="SELECT p.monto, c.id_concepto, c.tarifa, c.no_anios, c.no_meses, c.no_sem, c.no_dias, c.id_departamento, e.nombre FROM pagos as p INNER JOIN conceptos as c ON p.id_concepto=c.id_concepto INNER JOIN clientes as cli ON c.id_cliente=cli.id_cliente INNER JOIN empleados as e ON cli.id_emp=e.id_empleado WHERE p.valadmon='s' AND p.concepto<>'DEPOSITO' AND p.fecha between '$periodoinicial' and '$periodofinal' order by e.nombre";
$activid=mysql_query($actividad);
?><table border="1" >
<tr><td>Monto</td><td>Id concepto</td><td>Ejecutivo</td><td>Tarifa</td><td>Anios</td><td>Meses</td><td>Semanas</td><td>Dias</td>
<td>tar anual</td>
<td>tar 5a8</td>
<td>tar 4a2</td>
<td>tar mes</td>
<td>tar semana</td>
<td>tar noche</td>
<?
while($activi=mysql_fetch_array($activid))
{
?>

<tr>
<td>
<?php
echo moneda($activi["monto"]);
?>
</td>
<td>
<?php
echo $activi['id_concepto'];
?>
</td>
<td>
<?php
echo $activi['nombre'];
?></td>
<td>
<?php
echo $activi['tarifa'];
?></td>
<td>
<?php
echo $activi['no_anios'];
?></td>
<td>
<?php
echo $activi['no_meses'];
?></td>
<td>
<?php
echo $activi['no_sem'];
?></td>
<td>
<?php
echo $activi['no_dias'];
?></td>
<?
$depa=$activi['id_departamento'];
if($activi['tarifa']=="ta"){$tabla="tarifa_alta";}
if($activi['tarifa']=="tm"){$tabla="tarifa_media";}
if($activi['tarifa']=="tb"){$tabla="tarifa_baja";}
$real="Select * FROM $tabla WHERE id_departamento='$depa' "; 
$contarifa=mysql_query($real);
$tar=mysql_fetch_array($contarifa);
     ?>
	 <td>
<?php
echo $tar["anual"];
?></td>
<td>
<?php
echo $tar["5a8"];
?></td>
<td>
<?php
echo $tar["2a4"];
?></td>
<td>
<?php
echo $tar["mes"];
?></td>
<td>
<?php
echo $tar["semana"];
?></td>
	 <td>
<?php
echo $tar["noche"];
?></td>
	 <?
}
?>
</table>