Beispiel #1
0
switch ($op) {
    case "upload_form":
        upload_form();
        break;
    case "upload_file":
        upload_file($tipo, $archivo, $archivo_name);
        break;
    case "nuevo":
        nuevo($padre, $apd_, $tipo, $nivel);
        break;
    case "guardar":
        guardar($padre, $apd_, $tipo, $nivel, $material);
        nuevo($padre, $apd_, $tipo, $nivel);
        break;
    case "listado":
        desbloquear_sistema();
        listado($type, $apd, $buscar, $pagina, $tipo);
        break;
    case "estado":
        estado($id_1, $id_2, $id_3, $estado, $type, $apd, $buscar, $pagina);
        listado($type, $apd, $buscar, $pagina, $tipo);
        break;
    case "editar":
        editar($id_1, $id_2, $id_3, $type, $apd, $buscar, $pagina);
        break;
    case "update":
        update($id_1, $id_2, $id_3, $type, $apd, $buscar, $pagina, $padre, $apd_, $tipo, $nivel, $material);
        listado($type, $apd, $buscar, $pagina, $tipo);
        break;
    case "borrar":
        borrar($id_1, $id_2, $id_3, $type, $apd, $buscar, $pagina);
Beispiel #2
0
function guardar_temp($type, $tabla, $orden, $tipo)
{
    $i = $j = 0;
    $s_2 = "select * from tmp_numeros group by nombre, tipo order by id";
    $r_2 = mysql_query($s_2);
    while ($d_2 = mysql_fetch_array($r_2)) {
        $s_ = "select * from numeros_parte where nombre='{$d_2['nombre']}' and tabla='{$tabla}'";
        $r_ = mysql_query($s_);
        if (mysql_num_rows($r_) <= 0) {
            //SI SON NUEVOS LOS INSERTO
            $s_1 = "insert into numeros_parte values('','{$d_2['nombre']}','{$d_2['descripcion']}', '{$tabla}', '{$d_2['tipo']}', '{$d_2['costo']}',";
            $s_1 .= "'{$d_2['unidad']}', '1', '{$d_2['archivo']}')";
            $i++;
        } else {
            //SI NO SON NUEVOS LOS ACTUALIZO
            $s_1 = "update numeros_parte set descripcion='{$d_2['descripcion']}', costo='{$d_2['costo']}', unidad='{$d_2['unidad']}' where ";
            $s_1 .= "nombre='{$d_2['nombre']}' and tabla='{$tabla}'";
            $j++;
        }
        $r_1 = mysql_query($s_1);
    }
    if ($tabla == 'fert') {
        $s_2 = "select * from tmp_batch order by id";
        $r_2 = mysql_query($s_2);
        while ($d_2 = mysql_fetch_array($r_2)) {
            $s_ = "select * from batch_ids where parte='{$d_2['parte']}' and batch_id='{$d_2['batch_id']}'";
            $r_ = mysql_query($s_);
            if (trim($d_2['batch_id']) != '' && trim($d_2['batch_id']) != '0' && mysql_num_rows($r_) <= 0) {
                $s_1 = "insert into\tbatch_ids values('','{$d_2['parte']}','{$d_2['batch_id']}','1')";
                $r_1 = mysql_query($s_1);
            }
        }
    }
    desbloquear_sistema();
    echo "<script>alert('{$i} registros insertados, {$j} actualizados');</script>";
}