<?php 
require("funciones.php");
require("../conectar.php");
require('generaclave.php');
$idcliente=$_GET["idcliente"];
$idrenta=$_GET["idrenta"];
$idconcepto=$_GET["idconcepto"];
$hoy=date("Y-m-d");
$res="SELECT c.razon_soc, c.rfc, c.direc_fis, con.subtotal, con.tipomoneda, r.divisa FROM clientes as c inner join renta as r ON r.id_renta='$idrenta' inner join conceptos as con ON con.id_concepto='$idconcepto' where c.id_cliente='$idcliente'";
$consulta=mysql_query($res);
$regis=mysql_fetch_array($consulta);
$total=$regis['subtotal'];
if($regis['tipomoneda']=='USD') {$total=$total*$regis['divisa']; }
$nombrerfc=$regis['razon_soc'];
$rfc=$regis['rfc'];
$direccionrfc=$regis['direc_fis'];
?>
<?php
$consulta="SELECT concat(c.nombre,' ',c.a_pat,' ',c.a_mat) as cliente, r.f_ingreso,f_salida, concat(e.nombre,' ',e.a_pat,' ',e.a_mat) as recibio, coordinador FROM clientes as c INNER JOIN empleados as e  ON c.id_emp=e.id_empleado INNER JOIN renta as r ON r.id_ejecutivo=e.id_empleado WHERE c.id_cliente='$idcliente' and r.id_renta='$idrenta'";
$consus=mysql_query($consulta);
$con=mysql_fetch_array($consus);

$consulta="SELECT con.id_concepto,con.dia_inicio, con.dia_salida, con.tipomoneda, con.subtotal, d.clave,com.nombre from conceptos as con  INNER JOIN  departamentos as d ON con.id_departamento=d.id_departamento  INNER JOIN  complejo as com ON con.id_complejo=com.id_complejo  WHERE con.id_concepto='$idconcepto'";
$sus=mysql_query($consulta);
$n=mysql_fetch_array($sus);

$coor="select concat(nombre,' ',a_pat) as coordinador from empleados where id_empleado='$con[coordinador]' ";
$coom=mysql_query($coor);
$coo=mysql_fetch_array($coom);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="JavaScript" type="text/javascript"> 
function javas(){
//window.print();
}


</script>
<style>
div{ margin-left:15px; }
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>
<body  onload="javas()">
<br>
  <table width="625" height="97" border="0">
    <tr>
      <td width="332" rowspan="2">&nbsp;</td>
      <td width="283" height="16">&nbsp;</td>
    </tr>
    <tr>
      <td height="67">&nbsp;</td>
    </tr>
  </table>
 <div id="segunda" style="position:absolute; top:140px;">
  <table width="627" height="120" border="0">
    <tr>
      <td width="86" height="24">&nbsp;</td>
      <td colspan="3"><?php echo $nombrerfc;?></td>
    </tr>
    <tr>
      <td height="26">&nbsp;</td>
      <td colspan="2"><?php echo $rfc;?></td>
     
      <td width="138">&nbsp;</td>
    </tr>
    <tr>
      <td height="32">&nbsp;</td>
      <td colspan="2"><?php echo $direccionrfc;?></td>
      
      
    </tr>
    <tr>
      <td height="27">&nbsp;</td>
      <td width="135" ></td>
      <td height="27" colspan="2"><?php echo "M&eacute;xico D. F. a ";echo fechatexto($hoy);?></td>
    </tr>
  </table>
  </div>
<div id="tercera" style="position:absolute; top:300px;">
  <table width="625" height="427" border="0">
    <tr>
      <td height="29" colspan="2"><div align="center"></div></td>
      <td colspan="2"><div align="center"></div></td>
      <td width="107"><div align="center"></div></td>
      <td width="119"><div align="center"></div></td>
    </tr>
    <tr>
      <td width="5" height="358"><p>&nbsp;</p>        </td>
      <td width="66" align="center" valign="top"><br />
      1	  </td>
      <td colspan="2" valign="top"><br />
      Servicios inmobiliarios <?echo clave($idconcepto);?>
	  <br> PERIODO:<?echo strtoupper(fechatexto($n["dia_inicio"]));?> al <?echo strtoupper(fechatexto($n["dia_salida"]));?>
<br><?//echo$n["nombre"];?> <?//echo$n["clave"];?>
</td>
      <td valign="top"><br />
      <?php echo $preciounitario;?></td>
      <td valign="top"><br />
      <?php echo moneda($total);?></td>
    </tr>
    <tr>
      <td height="32" colspan="2">&nbsp;</td>  <?php $iva=$total*.16;?>
      <td width="110" height="32">&nbsp;</td><?php $mas=$total+$iva;?>
      <td width="192" colspan="3"  ><font size="1"><?php echo numerotexto("$mas",'MXN'); ?></font></td>
     
    </tr>
  </table>
  </div>
 <div id="cuarta" style="position:absolute; top:735px;">
  <table width="615" border="0">

    <tr>
      <td width="116" rowspan="4">&nbsp;</td>
      <td height="23">&nbsp;</td>
      <td><div align="right">&nbsp;</div></td>
      <td><div align="rigth"><?php echo moneda($total);?></div></td>
    </tr>
    <tr>
      <td width="275" >&nbsp;</td>
      <td width="95"><div align="right">16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></td>
	
      <td width="111"><div align="rigth"><?php echo moneda($iva); ?></div></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><div align="right"></div></td>
	  
      <td><div align="rigth"><?php echo moneda($mas); ?></div></td>
    </tr>
    <tr>
      <td><div align="right" ></div></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td height="23">&nbsp;</td>
      <td><div align="center" ></div></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
  </div>
</body>
</html>