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/www/ingresar_rech_auto.php
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ingresar rechazos Debito</title>
<style type="text/css">
<!--
.Estilo2 {color: #CC3333;
	font-size: 16px;
}
.Estilo3 {color: #2492FF;
	font-weight: bold;
}
.Estilo4 {	color: #D94B3C;
	font-size: 24px;
}
.Estilo51 {	font-size: 22px
}
.recaudo {font-family: "Courier New", Courier, monospace;
	font-size: 12px;
	font-style: normal;
	font-weight: bold;
	font-variant: normal;
	color: #000000;
	background-color: #B6CBDC;
	margin: 4px;
	padding: 8px;
	width: auto;
	border: medium outset #339966;
}
.Estilo50 {color: #CC3333;
	font-family: "Arial Narrow";
	font-weight: bold;
}
-->
</style>
</head>

<body>
<form action="" method="post" enctype="multipart/form-data" name="form1" id="form1">
  <label> </label>
  <div align="center">
    <table width="448" border="3" cellpadding="3" cellspacing="3" class="recaudo">
      <caption>
      <div align="center" class="Estilo4 Estilo51">INGRESAR RECHAZOS  DEBITO</div>
      </caption>
      <tr>
        <th colspan="2" scope="col"><label>Seleccione el Archivo a Cargar</label></th>
      </tr>
      <tr>
        <td width="150"><div align="center"><span class="Estilo2">ARHIVO(Excel): </span></div></td>
        <td width="265"><div align="center">
          <input type="file" name="archivo_carga" id="archivo_carga" />
        </div></td>
      </tr>
      <tr>
        <td colspan="2"><div align="center">
          <input type="submit" name="cargar" id="cargar" value="Enviar" />
        </div></td>
      </tr>
      <tr>
        <td colspan="2"><div align="center">
          <input name="menu2" type="button" class="Estilo50" id="menu2" onclick="window.location.href='menu_cartera_debito.php'" value="IR AL MENU" />
        </div></td>
      </tr>
      </table>
  </div>
  <label><br />
  </label>
  <p>
    <label></label>
  </p>
</form>
<p>&nbsp;</p>
</body>
</html>
<?php 
require_once("mainfile.php");
include ("config.php");
global $dbi;

require_once("Conectarse.php");


if(isset($_POST["cargar"]))
{
// Test CVS

require_once 'Excel/reader.php';


// ExcelFile($filename, $encoding);
$data = new Spreadsheet_Excel_Reader();


// Set output Encoding.
$data->setOutputEncoding('CP1251');


$data->read($archivo_carga);



error_reporting(E_ALL ^ E_NOTICE);


$fecha_act=date ( "Y-n-j" );


echo "<TABLE width='550' border='1' align='center' cellpadding='0' cellspacing='1'>
                              <TR>
                              <TD bgcolor='#FFFFCC'><div align='center'><span class='texto'>CEDULA</span></div></TD>		 		  
                              <TD bgcolor='#FFFFCC'><div align='center'><span class='texto'>ANOMALIA</span></div></TD>";	
		
		
			/*$f1 = explode('-',$fecha_act); 
				$dia1 = $f1[0]; 
				$mes1 = $f1[1]; 
				$ano1 = $f1[2]; 
				
				$f2 = explode('-',$regis); 
				$dia2 = $f2[0]; 
				$mes2 = $f2[1]; 
				$ano2 = $f2[2]; 
	
				$time1 = mktime (0,0,0,$mes1,$dia1,$ano1); 
				$time2 = mktime (0,0,0,$mes2,$dia2,$ano2);*/
									  
for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) 
{
	for ($j = 1; $j <= 3; $j++) 
	{
	 		$data2[$j]=$data->sheets[0]['cells'][$i][$j];			
	}

	$mssql = mysql_query('SELECT cedula, cuotas_desc , cuotas_pend , fecha_registro, estado FROM debitos  WHERE cedula =  ' ."$data2[1]".' GROUP BY  cedula');
			 if (!$mssql) {
			die('Invalid query 1 mssql: ' . mysql_error());
								}
			list($cedula, $cuodesc, $cuopend, $registro, $estado) =  mysql_fetch_row($mssql);
			$num=mysql_num_rows($mssql);

		
	
		if ($cedula == $data2[1] )
			{	
			
			if ($estado != 0)
			{
			
$dis = date("d");
$mes = date("m");
$anos = date("Y");	
$fechar = $anos.'-'.$mes.'-'.$dis;

					 if($fechar != $registro)
				 {

	$reg = mysql_query('SELECT cedula, nombres, cuotas_desc, cuotas_pend, fecha_registro FROM debitos  WHERE cedula =  ' ."$data2[1]".' ');
	 if (!$reg) {
			die('Invalid query 1  reg: ' . mysql_error());
								}
			list($cedu, $nombre, $cuodesc, $cuopend, $regis) =  mysql_fetch_row($reg);


$guardar =  mysql_query("INSERT INTO debitos_estado_contable (cedula, nombre, cuota, valor_cuota, fecha_registro,  codigo_descuento, unidad_descuento) VALUES ('" ."$cedu". "', '" ."$nombre". "', '0', '" . "$data2[2]". "', '" ."$fechar". "', '0', '" . "$data2[3]". "')");
					  if (!$guardar) {
			die('Invalid query 1  cartera_estado_contable guardar: ' . mysql_error());
								}
		
			/*	$upd = mysql_query("UPDATE debitos set  cuotas_desc = '" ."$cuodesc". "', cuotas_pend = '" ."$cuopend". "', fecha_registro = '" ."$fechar". "' WHERE cedula = '$data2[1]'  ");
						if (!$upd) {
				die('Invalid query update upd: ' . mysql_error());
									}*/

								
			}
			else
			{
			 printf("<tr>
                                   <td bgcolor='#C5D6FC'><div align='center' class='lista'>".$data2[1]."</span></div></td>
		                           <TD bgcolor='#C5D6FC'><div align='center'><span class='texto'>Cuota ya fue cargada el dia de hoy</span></div></TD>");    
					}
					
						}
		else
		{
			 printf("<tr>
              <td bgcolor='#C5D6FC'><div align='center' class='lista'>".$data2[1]."</span></div></td>
		      <TD bgcolor='#C5D6FC'><div align='center'><span class='texto'>Debito en Historico</span></div></TD>");    
		}
					
		}
		else
		{
			 printf("<tr>
              <td bgcolor='#C5D6FC'><div align='center' class='lista'>".$data2[1]."</span></div></td>
		      <TD bgcolor='#C5D6FC'><div align='center'><span class='texto'>Cedula Incorrecta</span></div></TD>");    
		}
		  
			                      
} 
  echo "</table>";	

}
?>