MOON
Server: Apache/2.2.34 (Unix) mod_ssl/2.2.34 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 FrontPage/5.0.2.2635
System: Linux server.asjudinet.com 2.6.32-042stab141.3 #1 SMP Fri Nov 15 22:45:34 MSK 2019 i686
User: asjudine (504)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: /home/asjudine/public_html/ingresar_devolucion.php
<?php
require_once("mainfile.php");
include ("config.php");
global $dbi;

 require_once("Conectarse.php");

//$sql = "select numero_carpeta, cedula, nombre_completo, numero, tipo, capital_periodo, capital_renovacion, interes_prejuridico, interes_cobroejecutivo,  capital_clausula, deuda_total, oficio_numero, fecha_oficio, cedula_funcionario, unidad from cobranzas where cedula = $id and numero_carpeta = '$carpeta' ";
//$control = mysql_query($sql, $dbi) or die(mysql_error());	

	$resul = mysql_query('SELECT numero_carpeta, cedula, nombre_completo, numero, tipo, capital_periodo, capital_renovacion, interes_prejuridico, interes_cobroejecutivo,  capital_clausula, deuda_total, oficio_numero, fecha_oficio, cedula_funcionario, unidad ,cuotas_mora ,valor_mora,clausula_permanencia , fecha_anulacion, carta_aceptacion, fecha_afiliacion FROM cobranzas WHERE cedula = "' . $_GET["id"] . '" and numero_carpeta = "' . $_GET["carpeta"] . '"');
			if (!$resul) {
				die('Invalid query: ' . mysql_error());
			} 
if ((mysql_num_rows($resul)!=0)) 
{	 
    list($numero_carpeta, $cedula, $nombre_completo, $numero, $tipo, $capital_periodo, $capital_renovacion, $interes_prejuridico, $interes_cobroejecutivo,$capital_clausula, $deuda_total, $oficio_numero, $fecha, $cedfun, $uni)  = mysql_fetch_row($resul);
   $tres=substr($fecha, 0, 4);
   $dos=substr($fecha, 5, 2);
   $uno=substr($fecha, 8, 2);
  // $fecha = ($uno."-".$dos."-".$tres);	
   $fecha = ($_POST[uno]."-".$_POST[dos]."-".$_POST[tres]);	
  		  				  		  
}






  $perit = mysql_query('SELECT telefono, direccion, celular, ciudad FROM cartera_serviasjudinet WHERE cedula = "' . $_GET["id"] . '" ');
			
		
		
        if ( (mysql_num_rows($perit) != 0)) 
	    {	 		 
 list($telefono, $direccion, $celular, $ciudad) = mysql_fetch_row($perit);            									   
          		
        }









if ($_POST["guardar"])	
{
  
	$resu = mysql_query('SELECT * FROM devolucion_carpeta WHERE cedula = "' . $_POST[cedula] . '" ');
					if (!$resu) {
							die('Invalid query: ' . mysql_error());
								}
			
	    	$num=mysql_num_rows($resu); 

	if($num == "0")
	{
			$unidad = strtoupper($unidad);


          mysql_query("INSERT INTO  devolucion_carpeta (cuenta_cobro, numero_carpeta, cedula, motivo, capital_recuperado, oficio_dev_num, fecha, unidad, estado) values ('" . $_POST["cuenta_cobro"]  . "','" . $_POST["numero_carpeta"]  . "','" . $_POST["cedula"]  . "','" . $_POST["motivo"]  . "','" . $_POST["capital_recuperado"]  . "','" . $_POST["oficio_dev_num"]  . "','" . $_POST["fecha_dev"]  . "','" . $_POST["unidad"]  . "','1')");
    
				if($motivo == 'Por cambio a la CADC')
				{
$sql2 = mysql_query('UPDATE cobranzas set estado = "1", unidad = "CADC"  WHERE cedula = "' . $_POST[cedula] . '" ');
			
				}else{
$sql = mysql_query('UPDATE cobranzas set estado = "0"  WHERE cedula = "' . $_POST[cedula] . '" ');
				 
				}
				   
$mssql = mysql_query ('UPDATE actuaciones_cobranzas set estado = "" WHERE cedula = "' . $_POST[cedula] . '" ');

				  echo "<script>alert('Registro grabado correctamante');</script>";
				 			
   }else{
	echo "<script>alert('Ya existe una devolucion con esta cedula');</script>";
	}
	
  
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script Language="JavaScript"><!--
function control(form)
{

 if (form.identi.value == "")
  {
    alert("Ingrese el número de cedula");
    form.identi.focus();
    return (false);
  }

  if (form.numero_carpeta.value == "")
  {
    alert("Ingrese el número de carpeta");
    form.numero_carpeta.focus();
    return (false);
  }

  return (true);
}
//--></script>

<script Language="JavaScript"><!--
function validar(formulario)
{

  if (formulario.cuenta_cobro.value == "")
  {
    alert("Ingrese el número de la cuenta de cobro");
    formulario.cuenta_cobro.focus();
    return (false);
  }

  if (formulario.motivo.value == "")
  {
    alert("seleccione el motivo de la devolución");
    formulario.motivo.focus();
    return (false);
  }

  if (formulario.capital_recuperado.value == "")
  {
    alert("Ingrese el capital recuperado");
    formulario.capital_recuperado.focus();
    return (false);
  }

  if (formulario.oficio_dev_num.value == "")
  {
    alert("Ingrese el número de oficio de la devolución");
    formulario.oficio_dev_num.focus();
    return (false);
  }

  if (formulario.dia_dev.value > 31)
  {
    alert("El número de día no se debe exceder de 31");
    formulario.dia_dev.focus();
    return (false);
  }

  if (formulario.mes_dev.value > 12)
  {
    alert("El número del mes no se debe exceder de 12");
    formulario.mes_dev.focus();
    return (false);
  }

  if (formulario.dia_dev.value == "")
  {
    alert("Ingrese el día de la devolución");
    formulario.dia_dev.focus();
    return (false);
  }

  if (formulario.mes_dev.value == "")
  {
    alert("Ingrese el mes de la devolución");
    formulario.mes_dev.focus();
    return (false);
  }

  if (formulario.ano_dev.value == "")
  {
    alert("Ingrese el año de la devolución");
    formulario.ano_dev.focus();
    return (false);
  }

  return (true);
}
//--></script>

<script languaje="JavaScript">
function Mostrar_Fecha()
{
         var mydate=new Date()
         var year=mydate.getYear()
         if (year < 1000)
                 year+=1900
                 var day=mydate.getDay()
                 var month=mydate.getMonth()
                 var daym=mydate.getDate()
                 if (daym<10)
                    daym="0"+daym
                    var dayarray=new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado")
                    var montharray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre")
                    document.write("<b><font face='Arial, Helvetica, sans-serif'>"+dayarray[day]+" "+daym+" de "+montharray[month]+" de "+year+"</font></b>")
}					
</script>
<style type="text/css">
<!--
.Estilo2 {
	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
}
.Estilo29 {font-family: Tahoma; font-size: 12px; }
.Estilo30 {font-size: 12px}
.Estilo32 {
	font-family: Tahoma;
	font-size: 12px;
	color: #FFFFFF;
	font-weight: bold;
}
.Estilo33 {color: #FF0000}
.Estilo18 {font-family: "Arial Narrow"; font-weight: bold; font-size: 14; }
-->
</style>
</head>
<body onload="document.formulario.identi.focus()">
<form method="post" name="form" action="" onSubmit="return control(this)">
<table width="639" border="1" align="center" cellpadding="3" cellspacing="3">    
  <tr valign="baseline" bgcolor="#0099FF">
    <td colspan="4" align="right" nowrap><div align="center"><span class="Estilo2">CAPTURA DE DEVOLUCIONES </span></div></td>
  </tr>
  <tr valign="baseline" bgcolor="#0099FF">
    <td colspan="4" align="right" nowrap><div align="center" class="Estilo2"><script languaje="JavaScript">Mostrar_Fecha()</script></div></td>
  </tr>
  <tr valign="baseline" bgcolor="#0099FF">
    <td width="180" align="right" nowrap><span class="Estilo29">C&eacute;dula, apellidos y nombres</span></td>
    <td><input name="cedula" type="text" id="cedula" value="<?php echo $cedula; ?>" size="15" maxlength="15" readonly=""></td>
    <td colspan="2"><input name="nombre_completo" type="text" id="nombre_completo3" value="<?php echo $nombre_completo; ?>" size="50" maxlength="50" readonly=""></td>
    </tr>
    
    
    
  <tr valign="baseline" bgcolor="#0099FF">
      <td align="right" nowrap><div align="left" class="Estilo4 Estilo10 Estilo17 Estilo1">
        <div align="right"><span class="Estilo29">Telefono </span></div>
      </div></td>
      <td><input name="telefono" type="text" id="telefono" value="<?php echo  $telefono; ?>" size="10" maxlength="10" readonly=""></td>
      <td><div align="right" class="Estilo29">Direccion:</div></td>
    <td><input name="direccion" type="text" id="direccion" value="<?php echo $direccion; ?>" size="40" maxlength="40" readonly=""></td>
    </tr>
  
  
   <tr valign="baseline" bgcolor="#0099FF">
      <td align="right" nowrap><div align="left" class="Estilo4 Estilo10 Estilo17 Estilo1">
        <div align="right"><span class="Estilo29">Ciudad</span></div>
      </div></td>
      <td><input name="ciudad" type="text" id="ciudad" value="<?php echo  $ciudad; ?>" size="10" maxlength="10" readonly=""></td>
      <td><div align="right" class="Estilo29">Celular: </div></td>
      <td ><input name="celular" type="text" id="celular" value="<?php echo $celular; ?>" size="15" maxlength="10" readonly=""></td>
    </tr>
      
    
    
    
    
    
    
    
    
    
  <tr valign="baseline" bgcolor="#0099FF">
    <td align="right" nowrap><span class="Estilo30"><span class="Estilo29">N&uacute;mero de carpeta:</span></span></td>
    <td><input name="numero_carpeta2" type="text" id="numero_carpeta2" value="<?php echo $numero_carpeta; ?>" size="4" maxlength="4" readonly=""></td>
    <td><div align="right" class="Estilo29">Unidad:</div></td>
    <td><input name="unidad2" type="text" id="unidad2" value="<?php echo $uni; ?>" size="4" maxlength="4" readonly=""></td>
  </tr>
  <tr valign="baseline" bgcolor="#0099FF">
      <td><div align="right"><span class="Estilo29">N&uacute;mero de Contrato:</span></div></td>
      <td width="69"><input name="numero" type="text" id="numero" value="<?php echo $numero; ?>" size="6" maxlength="6" readonly=""></td>
      <td width="196"><div align="right"><span class="Estilo29">Tipo:</span></div></td>
      <td><input name="tipo" type="text" id="tipo" value="<?php echo $tipo; ?>" size="4" maxlength="4" readonly=""></td>
  </tr>
  
  
     
    <tr valign="baseline" bgcolor="#0099FF">
      <td align="right" nowrap bgcolor="#FFFDE8" class="Estilo18"><div align="right" class="Estilo33">Carta Aceptacion </div></td>
      <td colspan="1" bgcolor="#0099FF"><input name="fecha_afiliacion" type="text" id="fecha_afiliacion" value="<?php echo $carta_aceptacion; ?>" size="10" maxlength="10" readonly></td> 
      
  
           
      <td bgcolor="#FFFDE8"><div align="right" class="Estilo33"><strong>Fecha Afiliacion: </strong></div></td>
      <td colspan="3" bgcolor="#0099FF"><input name="fecha_afiliacion" type="text" id="fecha_afiliacion" value="<?php echo $fecha_afiliacion; ?>" size="10" maxlength="10" readonly></td>
    </tr>
  
  
  
   <tr valign="baseline" bgcolor="#0099FF">
      <td align="right" nowrap bgcolor="#FFFDE8"><div align="left" class="Estilo4 Estilo10 Estilo17 Estilo1">
        <div align="right" class="Estilo33"><strong>Cuotas En Mora: </strong></div>
      </div></td>   
      <td bgcolor="#0099FF"><input name="cuotas_mora" type="text" id="cuotas_mora" value="<?php echo $cuotas_mora; ?>" size="10" maxlength="10"></td>
     
      
      <td bgcolor="#FFFDE8"><div align="right"  class="Estilo33"><strong>Valor Cuotas En Mora: </strong></div></td>  
      <td colspan="3" bgcolor="#0099FF"><input name="valor_mora" type="text" id="valor_mora" value="<?php echo  $valor_mora; ?>" size="35" 

maxlength="10"></td>
    </tr>
  
  
   <tr valign="baseline" bgcolor="#0099FF">
      <td align="right" nowrap bgcolor="#FFFDE8" class="Estilo24"><div align="left" class="Estilo4 Estilo10 Estilo17 

Estilo1">
        <div align="right"><span class="Estilo33"><strong>Clausula De Permanencia Meses:</strong></span></div>
      </div></td>
      <td bgcolor="#0099FF"><input name="clausula_permanencia" type="text" id="clausula_permanencia" value="<?php echo  $clausula_permanencia; ?>" size="10" 

maxlength="10"></td>
      
      
      <td bgcolor="#FFFDE8"><div align="right"  class="Estilo33"><strong>Fecha Anulacion:</strong></div></td>
      <td colspan="3" bgcolor="#0099FF"><input name="fecha_anulacion" type="text" id="fecha_anulacion" value="<?php echo $fecha_anulacion; ?>" size="15" maxlength="10" readonly=""></td>
    </tr>
  
        
  
  
  
  
  
    <tr valign="baseline" bgcolor="#0099FF">
      <td align="right" nowrap><span class="Estilo29">Capital Per&iacute;odo actual:</span></td>
      <td><input name="capital_periodo" type="text" id="capital_periodo" value="<?php echo $capital_periodo; ?>" size="10" maxlength="10" readonly=""></td>
      <td><div align="right"><span class="Estilo29">Capital renovaci&oacute;n Autom&aacute;tica:</span></div></td>
      <td width="155"><input name="capital_renovacion" type="text" id="capital_renovacion" value="<?php echo $capital_renovacion; ?>" size="10" maxlength="10" readonly=""></td>
    </tr>
    <tr valign="baseline" bgcolor="#0099FF">
      <td align="right" nowrap><span class="Estilo29">Intereses Cobro Prejur&iacute;dico:</span></td>
      <td><input name="interes_prejuridico" type="text" id="interes_prejuridico" value="<?php echo $interes_prejuridico; ?>" size="10" maxlength="10" readonly=""></td>
      <td><div align="right"><span class="Estilo29">Inter&eacute;s Cobro Ejecutivo:</span></div></td>
      <td><input name="interes_cobroejecutivo" type="text" id="interes_cobroejecutivo" value="<?php echo $interes_cobroejecutivo; ?>" size="10" maxlength="10" readonly=""></td>
    </tr>
    <tr valign="baseline" bgcolor="#0099FF">
      <td align="right" nowrap><span class="Estilo29">Capital cl&aacute;usula penal:</span></td>
      <td><input name="capital_clausula" type="text" id="interes_prejuridico3" value="<?php echo $capital_clausula; ?>" size="10" maxlength="10" readonly=""></td>
      <td><div align="right"><span class="Estilo29">Deuda Total:</span></div></td>
      <td><input name="deuda_total" type="text" id="deuda_total3" value="<?php echo $deuda_total; ?>" size="10" maxlength="10" readonly=""></td>
    </tr>
  
  </table>
</form>  
	
<form method="post" name="form" action="" onSubmit="return validar(this)">	
<input name="cedula" type= "hidden" value="<?php echo $cedula; ?>" size="10" maxlength="10">
<table width="651" border="0" align="center" cellpadding="3" cellspacing="3">    	
    <tr valign="baseline" bgcolor="#0099FF">
      <td align="right" nowrap><span class="Estilo29">N&uacute;mero Carpeta:</span></td>
      <td align="right" nowrap><div align="left">
        <input name="numero_carpeta" type="text" value="<?php echo $numero_carpeta; ?>" size="4" maxlength="4" readonly="">
      </div></td>
      <td align="right" nowrap><span class="Estilo29">Cuenta de cobro No.:</span></td>
      <td align="right" nowrap><div align="left">
        <input name="cuenta_cobro" type="text" id="cuenta_cobro" size="4" maxlength="4">
      </div></td>
    </tr>
    <tr valign="baseline" bgcolor="#0099FF">
      <td align="right" nowrap><span class="Estilo29">Unidad:</span></td>
      <td width="53" align="right" nowrap><div align="left">
        <input name="unidad" type="text" id="unidad" size="4" maxlength="4">
      </div></td>
      <td width="188" align="right" nowrap><span class="Estilo29">Capital recuperado:</span></td>
      <td width="149" align="right" nowrap><div align="left">
        <input name="capital_recuperado" type="text" size="10" maxlength="10">
      </div></td>
    </tr>
    <tr valign="baseline" bgcolor="#0099FF">
      <td align="right" nowrap><span class="Estilo29">N&uacute;mero de oficio devoluci&oacute;n:</span></td>
      <td align="right" nowrap><div align="left">
        <input name="oficio_dev_num" type="text" size="4" maxlength="4">
      </div></td>
  <td><div align="right"><span class="Estilo29">Fecha Devoluci&oacute;n<span class="Estilo33">aaaa-mm-dd:</span></span></div></td>
      <td>
	    <span class="Estilo29">
      <input name="fecha_dev" type="text" id="fecha_dev" value="0000-00-00" size="15" maxlength="15" >
      </span></span></td>
    </tr>
    <tr valign="baseline" bgcolor="#0099FF">
      <td width="222" align="right" nowrap><span class="Estilo29">Motivo de la devoluci&oacute;n:</span></td>
      <td colspan="3" align="right" nowrap><div align="left">
        <select name="motivo">
          <option value="">SELECCIONE EL MOTIVO</option>
          <option value="Por condonaci&oacute;n deuda">Por condonaci&oacute;n deuda</option>
          <option value="Por paz y salvo">Por paz y salvo</option>
          <option value="Por no dar lugar al cobro ejecutivo">Por no dar lugar al cobro ejecutivo</option>
          <option value="Por no legalizaci&oacute;n">Por no legalizaci&oacute;n</option>
          <option value="Por pago total de la obligaci&oacute;n">Por pago total de la obligaci&oacute;n</option>
          <option value="Por solicitud de Serviasjudinet">Por solicitud de Serviasjudinet</option>
          <option value="Por cambio a la CADC">Por cambio a la CADC</option>
          <option value="Por fallecimiento">Por fallecimiento</option>		  
        </select>
      </div></td>
    </tr>
    <tr valign="baseline" bgcolor="#0099FF">
      <td colspan="4" align="right" nowrap><div align="center">
          <input name="guardar" type="submit" id="guardar" value ="Guardar" style="font-family: Verdana; font-size: 8 pt; color: #000080; background-color: #C0C0C0; border-style: solid">
          <input name="button" type="button" style="font-family: Verdana; font-size: 8 pt; color: #000080; background-color: #C0C0C0; border-style: solid" onClick="javascript:window.close()" value="Cerrar Ventana">		   		  
      </div></td>
    </tr>
  </table>
</form>  
</body>
</html>