<?

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">

<script language="javascript">

function validar(formulario){

 var total_fp;

//  if(document.form2.txtdesccargo.value==""){

//   alert("Ingrese la descripción del cargo");

//   document.form2.txtdesccargo.focus();

//   return (false);

// }



// if(document.form2.txtvcargo.value==""){

//   alert("Ingrese el valor del cargo");

//   document.form2.txtvcargo.focus();

//   return (false);

// }



 if(parseFloat(document.form2.txttotalp.value)<=0){

  alert('Seleccione un pago para continuar');

  return (false);

 }



 total_fp=parseFloat(document.form2.txtvef.value)+parseFloat(document.form2.txtvchq.value)+parseFloat(document.form2.txtvdep.value)+parseFloat(document.form2.txtvtc.value);



 if(parseFloat(document.form2.txttotalp.value) != total_fp){

  alert('Los totales no coinciden\n\nPor favor verifique la forma de pago');

  return (false);

 }





return (true);

}



function total(formulario, numero){

 var total_pago, cargos;

 total_pago=parseFloat(document.form2.txttotalp.value);



<?

if($txtalumno or $txtcarnet){

                          if($txtalumno<>'SV'){

                           $p_alumno=$txtalumno;

                          }else{

                           $p_alumno=$txtcarnet;

                          }



$qcargo=mysql_query("select * from cp_cargos where carnet='$p_alumno' and year='$df_year_actual' and saldo > 0 order by mes");

$max=mysql_num_rows($qcargo);

for($i=1;$i<=$max;$i++){

?>

if(numero == <?=$i;?>){

 if(document.form2.txtcargo<?=$i;?>.checked){

  total_pago=total_pago+parseFloat(document.form2.txtvalor<?=$i;?>.value);

 }else{

  total_pago=total_pago-parseFloat(document.form2.txtvalor<?=$i;?>.value);

 }

}

<?

 }

}

?>

 document.form2.txttotalp.value=total_pago;

}

</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">CONTROL DE PAGOS <img src="../images/flecha_3.jpg" width="9" height="9"> Cargo a alumno en forma individual </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>

            <tr>

              <td align="left" valign="top" bgcolor="#FFFFCC"><div align="left" class="parrafo">

                <table width="100%"  border="0" cellspacing="0" cellpadding="1">

                  <tr>

                    <td align="left" valign="top" background="../images/tema/bg_contenido.png"><table width="100%"  border="0" cellspacing="0" cellpadding="0">

                      <tr>

                        <td><form name="form1" method="post" action="<?=$PHP_SELF;?>">

                          <table width="100%"  border="0" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">

                            <tr>

                              <td width="24%" background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF"><strong>Seleccione un alumno </strong></td>

                              <td width="60%" background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9">

                               <select name="txtalumno" class="textbox" id="txtalumno">

                                <option value="SV" selected>Seleccione uno...</option>

                               <?

                               $qalum=mysql_query("select carnet, apellido, nombre

                                                   from alumnos

                                                   order by apellido, nombre");

                               while($ialum=mysql_fetch_array($qalum)){

                                echo "<option value='{$ialum[carnet]}'>{$ialum[apellido]}, {$ialum[nombre]}</option>";

                               }

                               ?>

                               </select>

                              </td>

                              <td width="16%" rowspan="2" background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9"><input name="Submit" type="submit" class="boton_guardar" value="Ver cargos..."></td>

                            </tr>

                            <tr>

                              <td background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF"><strong>o ingrese n&uacute;mero de carn&eacute;:</strong></td>

                              <td background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9"><input name="txtcarnet" type="text" class="textbox" id="txtcarnet" size="15" maxlength="15"></td>

                              </tr>

                          </table>

                          <?

                          if(!$txtalumno and !$txtcarnet){

                           exit();

                          }

                          if($txtalumno<>'SV'){

                           $p_alumno=$txtalumno;

                          }else{

                           $p_alumno=$txtcarnet;

                          }



                          $qalm=mysql_query("select * from alumnos where carnet = '$p_alumno'");

                          if(mysql_num_rows($qalm)==0){

                            alert("El alumno no existe","javascript:history.go(-1)");

                          }

                          $ialm=mysql_fetch_array($qalm);

                          $qvam=mysql_query("select * from grados where id = {$ialm[grado_estudio]}");

                          if(mysql_num_rows($qvam)==0){

                           alert("ERROR:\\nEl alumno no está inscrito en ningun grado","javascript:history.go(-1)");

                          }

                          $ivam=mysql_fetch_array($qvam);

                          ?>

                          </form>

                          <table width="100%"  border="0" cellspacing="0" cellpadding="0">

                            <tr>

                              <td><form name="form2" method="post" action="mnt_pago.php" onsubmit="return validar(this.form);">

                                <table width="125%"  border="0" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">

                                  <tr>

                                    <td width="24%" background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF"><strong># Carn&eacute;:</strong></td>

                                    <td width="76%" background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9" class="lbl_formulario"><?=$ialm[carnet];?>                                      </td>

                                  </tr>

                                  <tr>

                                    <td background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF"><strong>Alumno:</strong></td>

                                    <td background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9"><span class="lbl_formulario">

                                      <?=$ialm[apellido].", ".$ialm[nombre];?>

                                    </span></td>

                                  </tr>

                                </table>

                                <hr size="1">

                                <table width="100%"  border="0" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">

                                  <tr bgcolor="#CFDFEF">

                                    <td width="7%"><div align="center"><strong>TIPO</strong></div></td>

                                    <td width="21%" bgcolor="#CFDFEF"><div align="center"><strong>FECHA DEL CARGO </strong></div></td>

                                    <td width="48%"><div align="center"><strong>DESCRIPCION</strong></div></td>

                                    <td width="12%"><div align="center"><strong>SALDO</strong></div></td>

                                    <td width="12%"><div align="center"><strong>SELECCIONE</strong></div></td>

                                  </tr>

                                  <?

                                  $qcargo=mysql_query("select * from cp_cargos where carnet='$p_alumno' and year='$df_year_actual' and saldo > 0 order by mes");

                                  $i=0;

                                  $suma_cargo=0;

                                  $suma_saldo=0;

                                  while($icargo=mysql_fetch_array($qcargo)){

                                  $i++;

                                  $suma_cargo+=$icargo[valor];

                                  $suma_saldo+=$icargo[saldo];

                                  ?>

                                  <tr bgcolor="<?=color_fila($i);?>">

                                    <td height="21"><div align="center">

                                        <?=$icargo[tipo];?>

                                    </div></td>

                                    <td><div align="center">

                                        <?=fecha($icargo[fecha_cargo]);?>

                                    </div></td>

                                    <td><div align="left">

                                        <?=($icargo[descripcion]);?>

                                        <input type="hidden" name="txtidc[<?=$i;?>]" value="<?=$icargo[id];?>">

                                    </div></td>

                                    <td><div align="right">

                                        <input name="txtvalor<?=$i;?>" type="hidden" id="txtvalor<?=$i;?>" value="<?=$icargo[saldo];?>">

                                        <input name="txtvalor[<?=$i;?>]" type="hidden" id="txtvalor[<?=$i;?>"] value="<?=$icargo[saldo];?>">

                                        <?=sprintf("Q%.2f",$icargo[saldo]);?>

                                    </div></td>

                                    <td><div align="center"><input name="txtcargo<?=$i;?>" type="checkbox" id="txt1" value="S" onClick="total(document.form2, <?=$i;?>)"></div></td>

                                  </tr>

                                  <?

                                  }

                                  ?>

                                  <tr bgcolor="#CFDFEF">

                                    <td><div align="center">&nbsp;</div></td>

                                    <td align="center" valign="bottom"><div align="left"><strong>TOTALES</strong></div></td>

                                    <td align="center" valign="bottom"><input name="imax" type="hidden" id="imax" value="<?=$i;?>"></td>

                                    <td align="center" valign="bottom"><div align="right"><strong>

                                        <?=sprintf("Q%.2f",$suma_saldo);?>

                                    </strong></div></td>

                                    <td align="center" valign="bottom"><div align="center">

                                      <input name="txttotalp" type="text" id="txttotalp" dir="rtl" value="0.00" size="8" maxlength="8">

</div></td>

                                  </tr>

                                </table>

                                <br>

                                <table width="100%"  border="0" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">

                                  <tr bgcolor="#CFDFEF">

                                    <td colspan="5" class="titulo_seccion"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                      <tr>
                                        <td width="6%" background="../images/tema/bg_titulo_frm.png"><img src="../images/tema/ic_pagos.png" width="35" height="32"></td>
                                        <td width="94%" background="../images/tema/bg_titulo_frm.png"><span class="titulo_formulario">INGRESE LA  FORMA DE PAGO</span>
                                          <input name="txtcarnet" type="hidden" id="txtcarnet" value="<?=$p_alumno;?>"></td>
                                      </tr>
                                    </table></td>

                                    </tr>

                                  <tr>

                                    <td width="17%" bgcolor="#CFDFEF"><strong>Efectivo</strong></td>

                                    <td colspan="4" bgcolor="#ECF2F9"><strong>

                                      <input name="txtvef" type="text" class="textbox" id="txtvef" dir="rtl" value="0" size="11" maxlength="11">

                                    </strong></td>

                                  </tr>

                                  <tr bgcolor="#FFFFFF">

                                    <td colspan="5"><hr size="1"></td>

                                    </tr>

                                  <tr>

                                    <td bgcolor="#CFDFEF"><strong>Valor del Cheque</strong></td>

                                    <td width="13%" bgcolor="#ECF2F9"><strong>

                                      <input name="txtvchq" type="text" class="textbox" id="txtvchq" dir="rtl" value="0" size="11" maxlength="11">

                                    </strong></td>

                                    <td width="19%" bgcolor="#CFDFEF"><div align="right"><strong># Cheque </strong></div></td>

                                    <td width="51%" colspan="2" bgcolor="#ECF2F9"><strong>

                                      <input name="txtchq" type="text" class="textbox" id="txtchq" size="10" maxlength="10">

                                    </strong></td>

                                    </tr>

                                  <tr bgcolor="#FFFFFF">

                                    <td colspan="5"><hr size="1"></td>

                                    </tr>

                                  <tr>

                                    <td bgcolor="#CFDFEF"><strong>Valor  dep&oacute;sito </strong></td>

                                    <td bgcolor="#ECF2F9"><strong>

                                      <input name="txtvdep" type="text" class="textbox" id="txtvdep" dir="rtl" value="0" size="11" maxlength="11">

</strong></td>

                                    <td bgcolor="#CFDFEF"><div align="right"><strong># Boleta dep&oacute;sito</strong></div></td>

                                    <td colspan="2" bgcolor="#ECF2F9"><strong>

                                      <input name="txtdep" type="text" class="textbox" id="txtdep2" size="10" maxlength="10">

                                    </strong></td>

                                  </tr>

                                  <tr bgcolor="#FFFFFF">

                                    <td colspan="5"><hr size="1"></td>

                                    </tr>

                                  <tr>

                                    <td bgcolor="#CFDFEF"><strong>Valor <br>

                                      Tarjeta Cr&eacute;dito</strong></td>

                                    <td bgcolor="#ECF2F9"><strong>

                                    <input name="txtvtc" type="text" class="textbox" id="txtvtc" dir="rtl" value="0" size="11" maxlength="11">

</strong></td>

                                    <td bgcolor="#CFDFEF"><div align="right"><strong># Tarjtea de cr&eacute;dito</strong></div></td>

                                    <td bgcolor="#ECF2F9"><strong>

                                      <input name="txttc" type="text" class="textbox" id="txttc2" size="16" maxlength="16">

                                    </strong></td>

                                    <td bgcolor="#ECF2F9"><div align="right">

                                      <input name="Submit2" type="submit" class="boton_guardar" value="Continuar &raquo;">

                                    </div></td>

                                  </tr>

                                </table>

                              </form>

                                </td>

                            </tr>

                          </table></td>

                      </tr>

                    </table></td>

                    </tr>

                </table>

                </div></td>

              </tr>

          </table></td>

        </tr>

    </table>    </td>

  </tr>

</table>

</body>

</html>