<?
include("../fnc.php");
enlinea_a();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>e-Ducativo - Bienvenido</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../estilo1.css" rel="stylesheet" type="text/css">
<?=mascara();?>
<script language="javascript">
function validar(){
 var objeto;
 var respuesta;

 objeto=document.form1.txtnfc;
 if(objeto.value==""){
   alert("Ingrese el número de factura");
   objeto.focus();
   return (false);
 }

 objeto=document.form1.txtfecha;
 if(objeto.value==""){
   alert("Ingrese la fecha de la factura");
   objeto.focus();
   return (false);
 }

 objeto=document.form1.txtnit;
 if(objeto.value==""){
   alert("Ingrese el nit del cliente");
   objeto.focus();
   return (false);
 }

 objeto=document.form1.txtnombre;
 if(objeto.value==""){
   alert("Ingrese el nombre para la factura");
   objeto.focus();
   return (false);
 }

 respuesta=confirm("DESEA OPERAR LA TRANSACCION?")
 if(respuesta){
  return (true);
 }else{
  return (false);
 }

}
</script>
<style type="text/css">
<!--
body {
	background-image: url(../images/tema/bg_pagina.png);
}
-->
</style></head>

<body>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#333333">
  <tr>
    <td bgcolor="#336699">    <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#E5E5E5">
      <tr bgcolor="#FFFFFF">
        <td width="40%"><img src="../images/logo_5.gif" width="300" height="50"></td>
        <td width="60%" background="../images/back_header_admin.gif" bgcolor="#FFFFFF"><div align="right" class="usuario_nombre_enc"><strong><?echo "$unombre $uapellido";?><br>
          </strong>Tiene <?=mensajes($uuser);?> mensaje(s) sin leer</div></td>
      </tr>
      <tr bgcolor="#FFFFFF">
        <td height="15" colspan="2" background="../images/barra_encabezado.gif">&nbsp;</td>
        </tr>
    </table>
      <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFCC">
        <tr>
          <td width="20%" valign="top" background="../images/tema/bg_contenido.png" bgcolor="#FFFFCC"><?php include("menu.php"); ?>&nbsp;</td>
          <td width="80%" valign="top" background="../images/tema/bg_contenido.png" bgcolor="#FFFFCC"><table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#333333">
            <tr align="center" valign="middle" bgcolor="#FFFFCC">
              <td height="20" bgcolor="#FFFFCC" class="titulo_pagina"><div align="center" class="titulo_seccion">
                <div align="left">
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td background="../images/tema/bg_contenido.png"><div align="center" class="titulo_pagina">
                        <div align="left" class="parrafo">FACTURACION<img src="../images/flecha_3.jpg" width="9" height="9"> Facturaci&oacute;n directa / Ingreso de datos generales </div>
                      </div></td>
                      <td width="65" background="../images/tema/bg_contenido.png"><div align="right"><a href="inicio.php" class="link_parrafo">Inicio<img src="../images/ic_home.png" width="21" height="21" border="0"></a></div></td>
                    </tr>
                  </table>
                </div>
              </div></td>
            </tr>
            <?
            $qfc=mysql_query("select correlativo + 1 as numero from cp_talonarios where id = 1");
            $ifc=mysql_fetch_array($qfc);
            ?>
            <tr>
              <td align="left" valign="top" background="../images/tema/bg_contenido.png" bgcolor="#FFFFCC"><div align="left" class="parrafo">
               <form action="mnt_cp_facturacion.php" method="post" name="form1" id="form1" onsubmit="return validar(this);">
                 <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                   <tr>
                     <td width="20%" background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF" class="lbl_campo">No. de documento:</td>
                     <td width="80%" background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9"><input name="txtnfc" type="text" class="textbox" id="txtnfc" size="11" maxlength="11" value="<?=$ifc[numero];?>"></td>
                   </tr>
                   <tr>
                     <td background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF" class="lbl_campo">Fecha:</td>
                     <td background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9"><input name="txtfecha" type="text" class="textbox" id="txtfecha" size="10" maxlength="10" value="<?=date("d/m/Y");?>" <?=fmascara();?>></td>
                   </tr>
                   <tr>
                     <td background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF" class="lbl_campo">Nit:</td>
                     <td background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9"><input name="txtnit" type="text" class="textbox" id="txtnit" size="11" maxlength="11"></td>
                   </tr>
                   <tr>
                     <td background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF" class="lbl_campo">Nombre:</td>
                     <td background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9"><input name="txtnombre" type="text" class="textbox" id="txtnombre" size="60" maxlength="100"></td>
                   </tr>
                   <tr>
                     <td background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF" class="lbl_campo">Direcci&oacute;n:</td>
                     <td background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9"><textarea name="txtdireccion" cols="70" rows="2" class="textbox" id="txtdireccion"></textarea></td>
                   </tr>
                   <tr>
                     <td background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF" class="lbl_campo">&nbsp;</td>
                     <td background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF"><input name="Submit" type="submit" class="boton_guardar" value="Guardar Factura">
                       <input name="tipo_trn" type="hidden" id="tipo_trn" value="general"></td>
                   </tr>
                 </table>
               </form>
                <br>
                <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="3%" background="../images/tema/bg_titulo_frm.png"><img src="../images/tema/ic_formularios.png" width="35" height="32"></td>
                        <td width="97%" background="../images/tema/bg_titulo_frm.png"><strong class="titulo_formulario">Detalle de la factura </strong></td>
                      </tr>
                    </table></td>
                    <td background="../images/tema/bg_titulo_frm.png">&nbsp;</td>
                    <td colspan="2" background="../images/tema/bg_titulo_frm.png"><div align="right">
                        <input name="Submit2" type="submit" class="boton_guardar" onClick="self.location='frm_cp_det_facturacion.php'" value="&laquo; Regresar al detalle">
                    </div></td>
                  </tr>
                  <tr bgcolor="#CFDFEF" class="lbl_formulario">
                    <td background="../images/tema/bg_frm_campos.png"><div align="center">Cantidad</div></td>
                    <td background="../images/tema/bg_frm_campos.png"><div align="center">Descripci&oacute;n</div></td>
                    <td background="../images/tema/bg_frm_campos.png">Valor Unit. </td>
                    <td background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF"><div align="center">Total</div></td>
                    <td background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF"><div align="center">Opciones</div></td>
                  </tr>
                  <?
                  $i=0;
                  $total=0;
                  $qdet=mysql_query("select * from cp_tmp_det_facturas where tipo='FC' order by id");
                  while($idet=mysql_fetch_array($qdet)){
                  $i++;
                  $total+=$idet[cantidad]*$idet[valorunit];
                  ?>
                  <tr bgcolor="<?=color_fila($i);?>">
                    <td width="10%"><div align="center">
                        <?=$idet[cantidad];?>
                    </div></td>
                    <td width="53%"><?=$idet[descripcion];?></td>
                    <td width="10%"><div align="right">
                        <?=moneda($idet[valorunit]);?>
                    </div></td>
                    <td width="13%" bgcolor="<?=color_fila($i);?>"><div align="right">
                        <?=moneda($idet[valorunit]*$idet[cantidad]);?>
                    </div></td>
                    <td width="14%" bgcolor="<?=color_fila($i);?>"><div align="center"><a href="mnt_cp_facturacion.php?tipo_trn=Delete_det&idd=<?=$idet[id];?>" class="link_parrafo">Eliminar</a></div></td>
                  </tr>
                  <?}?>
                  <tr bgcolor="#CFDFEF">
                    <td background="../images/tema/bg_frm_campos.png">&nbsp;</td>
                    <td colspan="2" background="../images/tema/bg_frm_campos.png"><div align="right"><strong>TOTAL:</strong></div></td>
                    <td background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF"><div align="right"><strong>
                        <?=moneda($total);?>
                    </strong></div></td>
                    <td background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF">&nbsp;</td>
                  </tr>
                </table>
              </div></td>
              </tr>
          </table></td>
        </tr>
    </table>    </td>
  </tr>
</table>
</body>
</html>