Example #1
0
function insert_txt($alias, $tipo)
{
    $s_ = "delete from tmp_partes";
    $r_ = mysql_query($s_);
    $s_ = "select * from configuracion where variable='ruta_cargas'";
    $r_ = mysql_query($s_);
    $d_ = mysql_fetch_array($r_);
    $r_server = $d_['valor'];
    $cont = 0;
    $fd = fopen($r_server . "{$alias}", "r");
    while (!feof($fd)) {
        $buffer = fgets($fd);
        if (substr($buffer, 0, 3) != '---') {
            $campo['0'] = trim(substr($buffer, 0, 15));
            //Parte Padre
            $campo['0'] = ltrim($campo['0'], "0");
            //Quitar ceros a la izquierda
            $campo['1'] = trim(substr($buffer, 39, 25));
            //Material
            $campo['1'] = ltrim($campo['1'], "0");
            //Quitar ceros a la izquierda
            $campo['2'] = trim(substr($buffer, 81, 5));
            //APD
            $campo['3'] = trim(substr($buffer, 89, 6));
            //Tipo
            $campo['4'] = trim(substr($buffer, 26, 28));
            //Nivel
            if ($campo['0'] != 'Material' && $campo['0'] != '' && $campo['1'] != '' && $campo['2'] != '' && $campo['3'] != '' && $campo['4'] != '') {
                $sql = "INSERT into tmp_partes values('{$campo['0']}', '{$campo['1']}', '{$campo['2']}', '{$campo['3']}', '{$campo['4']}', '{$alias}')";
                $res = mysql_query($sql);
                $cont++;
            }
        }
    }
    fclose($fd);
    unlink($r_server . $alias);
    guardar_temp($tipo);
    exit;
}
Example #2
0
</tr>
<tr height="600" valign="top">
    <td background="../imagenes/borde_izq_tabla.png">&nbsp;</td>
    <td>&nbsp;
	<!--Todo el contenido de cada página--->
	<?php 
menu_interno();
switch ($op) {
    case "upload_form":
        upload_form();
        break;
    case "upload_file":
        upload_file($archivo, $archivo_name);
        break;
    case "guardar_temp":
        guardar_temp();
        listado($f_linea, $f_area, $f_estacion, $pagina);
        break;
    case "nuevo":
        nuevo($area);
        break;
    case "guardar":
        guardar($area, $estacion, $nombre);
        nuevo($area);
        break;
    case "listado":
        listado($f_linea, $f_area, $f_estacion, $pagina);
        break;
    case "estado":
        estado($id_, $estado, $nombre, $f_area, $f_estacion, $f_linea);
        listado($f_linea, $f_area, $f_estacion, $pagina);
Example #3
0
</tr>
<tr height="600" valign="top">
    <td background="../imagenes/borde_izq_tabla.png">&nbsp;</td>
    <td>&nbsp;
	<!--Todo el contenido de cada página--->
	<?php 
menu_interno($type, $tabla);
switch ($op) {
    case "upload_form":
        upload_form($tabla);
        break;
    case "upload_file":
        upload_file($tabla, $type, $archivo, $archivo_name);
        break;
    case "guardar_temp":
        guardar_temp($type, $tabla, $orden, $tipo);
        listado($type, $tabla, $orden, $tipo, $buscar, $inicio);
        break;
    case "nuevo":
        nuevo($type, $tabla);
        break;
    case "guardar":
        guardar($tabla, $tipo, $nombre, $costo, $unidad, $descripcion);
        nuevo($type, $tabla);
        break;
    case "listado":
        desbloquear_sistema();
        listado($type, $tabla, $orden, $tipo, $buscar, $inicio);
        break;
    case "estado":
        estado($id_, $estado, $tabla, $buscar, $inicio);
Example #4
0
function insert_txt($alias, $tipo)
{
    $s_ = "delete from tmp_partes";
    $r_ = mysql_query($s_);
    $s_ = "select * from configuracion where variable='ruta_cargas'";
    $r_ = mysql_query($s_);
    $d_ = mysql_fetch_array($r_);
    $r_server = $d_['valor'];
    $cont = 0;
    //echo "Leyendo archivo: ".$r_server.$alias."<br>";
    $fd = fopen($r_server . "{$alias}", "r");
    while (!feof($fd)) {
        $buffer = fgets($fd);
        if (substr($buffer, 0, 3) != '---') {
            $campo['0'] = trim(substr($buffer, 0, 15));
            //Parte Padre
            $campo['0'] = ltrim($campo['0'], "0");
            //Quitar ceros a la izquierda
            $campo['1'] = trim(substr($buffer, 39, 25));
            //Material
            $campo['1'] = ltrim($campo['1'], "0");
            //Quitar ceros a la izquierda
            $campo['2'] = trim(substr($buffer, 81, 5));
            //APD
            $campo['3'] = trim(substr($buffer, 89, 6));
            //Tipo
            $campo['4'] = trim(substr($buffer, 26, 28));
            //Nivel
            if ($campo['0'] != 'Material' && $campo['0'] != '' && $campo['1'] != '' && $campo['2'] != '' && $campo['3'] != '' && $campo['4'] != '') {
                $sql = "INSERT into tmp_partes values('{$campo['0']}', '{$campo['1']}', '{$campo['2']}', '{$campo['3']}', '{$campo['4']}', '{$alias}')";
                $res = mysql_query($sql);
                $cont++;
            }
        }
    }
    fclose($fd);
    unlink($r_server . $alias);
    guardar_temp($tipo);
    exit;
    /*$s_ = "delete from tmp_partes";
    	$r_ = mysql_query($s_);
    	$s_ = "select * from configuracion where variable='ruta_cargas'";
    	$r_ = mysql_query($s_);
    	$d_ = mysql_fetch_array($r_);
    		
    	$r_server = $d_['valor']; $cont=0; 
    	//echo "Leyendo archivo: ".$r_server.$alias."<br>";
    	$fd       = fopen($r_server."$alias", "r");
    	while ( !feof($fd) ) 
     	{
    		$buffer = fgets($fd);
    		$campos = split ("\t", $buffer);
    		if($campos['0']!='Material' && substr($campos['0'],0,3)!='---') { 
    			$padre    = ltrim($campos['0'],"0"); //Parte Padre
    			$nivel    = trim($campos['2']); //Nivel
    			$material = ltrim($campos['5'],"0"); //Material
    			$apd 	  = trim($campos['8']); //APD
    			$tipo_    = trim($campos['11']); //Tipo
    		
    		if($padre!='' && $material!='' && $nivel!='' && $apd!='' && $tipo!='') {
    			$sql = "INSERT into tmp_partes values('$padre', '$material', '$apd', '$tipo_', '$nivel', '$alias')"; 
    			$res = mysql_query($sql);
    			$cont++;
    		}	
    	} } 
    	fclose($fd); 
    	unlink($r_server.$alias); 
    	guardar_temp($tipo); 
    	exit;*/
}