<?php require_once('Connections/cn.php'); ?>
<?php
	$id_alumno=$_GET['id_alumno'];
	$nro_comprobante=$_GET['nro_comprobante'];

	mysql_select_db($database_cn, $cn);
 	$sql = "SELECT * FROM pagos WHERE id_alumno='$id_alumno' AND nro_comprobante='$nro_comprobante' AND sw='S'";
 	$rs=mysql_query($sql, $cn);
	$row=mysql_fetch_assoc($rs);
	$reg=mysql_num_rows($rs);
	if ($reg!= 0)
	 {
 	$sql = "UPDATE pagos SET sw='N', procesado='N' WHERE id_alumno='$id_alumno' AND nro_comprobante='$nro_comprobante' AND sw='S'";
 	$rs=mysql_query($sql, $cn);
	 ?>
	 <script type="text/javascript">
		window.parent.document.form2.montop.value=parseFloat(window.parent.document.form2.montop.value)-parseFloat('<?php echo $row['monto']; ?>');
	 </script>
	 <?php
	 }
	 else
	 {
	 ?>
	 <script type="text/javascript">
			alert("Comprobante no ha sido Procesado");
	 </script>
	 <?php
	 }
?>