Example #1
0
            } else {
                $data = '3';
                /// error al guardar
            }
            $data = '0';
            ///correcto
        }
    }
} else {
    if ($_POST['tipo'] == "m") {
        $repetidos = repetidos($conexion, "codigo_grupo", strtoupper($_POST['txt_1']), "grupos", "m", $_POST['txt_0'], "id");
        if ($repetidos == 'true') {
            $data = "1";
            /// este codigo ya existe;
        } else {
            $repetidos = repetidos($conexion, "nombre_grupo", strtoupper($_POST['txt_2']), "grupos", "m", $_POST['txt_0'], "id");
            if ($repetidos == 'true') {
                $data = "2";
                /// este nombre ya existe;
            } else {
                $sql = "update grupos set codigo_grupo = '" . strtoupper($_POST['txt_1']) . "',nombre_grupo = '" . strtoupper($_POST['txt_2']) . "',estado = '1',fecha = '" . $fecha . "' where id = '" . $_POST['txt_0'] . "'";
                $sql_nuevo = "SELECT (id,codigo_grupo,nombre_grupo,estado,fecha)  FROM grupos where id = '" . $_POST['txt_0'] . "'";
                $sql_nuevo = sql_array($conexion, $sql_nuevo);
                $guardar = guardarSql($conexion, $sql);
                if ($guardar == 'true') {
                    $data = '0';
                    ////datos guardados
                    $sql_anterior = "SELECT (id,codigo_grupo,nombre_grupo,estado,fecha)  FROM grupos where id = '" . $_POST['txt_0'] . "'";
                    $sql_anterior = sql_array($conexion, $sql_anterior);
                    auditoria_sistema($conexion, 'grupos', $id_user, 'Update', $id, $fecha_larga, $fecha, $sql_nuevo, $sql_anterior);
                    /////////////////////detalles grupos////////////
        /// este dato ya existe;
    } else {
        if ($_POST['principal'] == 'Si') {
            $sql = "update terminos_pago set principal = 'No'";
            guardarSql($conexion, $sql);
        }
        $sql = "insert into terminos_pago values ('{$id}','" . strtoupper($_POST['descripcion']) . "','" . $_POST['principal'] . "','0','{$fecha}','" . $_POST['porcentaje_inicial'] . "','" . $_POST['monto_inicial'] . "','" . $_POST['nro_meses'] . "')";
        $guardar = guardarSql($conexion, $sql);
        $sql_nuevo = "select (id_termino_pago,descripcion,principal,estado,fecha_creacion,porcentaje_inicial,monto_inicial,nro_meses) from terminos_pago where id_termino_pago = '{$id}'";
        $sql_nuevo = sql_array($conexion, $sql_nuevo);
        auditoria_sistema($conexion, 'terminos_pago', $id_user, 'Insert', $id, $fecha_larga, $fecha, $sql_nuevo, '');
        $data = "2";
    }
} else {
    if ($_POST['oper'] == "edit") {
        $repetidos = repetidos($conexion, "descripcion", strtoupper($_POST['descripcion']), "terminos_pago", "m", $_POST['id_termino_pago'], "id_termino_pago");
        if ($repetidos == 'true') {
            $data = "1";
            /// este dato ya existe;
        } else {
            if ($_POST['principal'] == 'Si') {
                $sql = "update terminos_pago set principal = 'No'";
                guardarSql($conexion, $sql);
            }
            $sql_anterior = "select (id_termino_pago,descripcion,principal,estado,fecha_creacion,porcentaje_inicial,monto_inicial,nro_meses) from terminos_pago where id_termino_pago = '{$_POST['id_termino_pago']}'";
            $sql_anterior = sql_array($conexion, $sql_anterior);
            $sql = "update terminos_pago set descripcion = '" . strtoupper($_POST['descripcion']) . "', principal = '" . $_POST['principal'] . "',estado = '0', fecha_creacion = '{$fecha}',porcentaje_inicial = '" . $_POST['porcentaje_inicial'] . "',monto_inicial = '" . $_POST['monto_inicial'] . "',nro_meses = '" . $_POST['nro_meses'] . "'  where id_termino_pago = '{$_POST['id_termino_pago']}'";
            $guardar = guardarSql($conexion, $sql);
            $sql_nuevo = "select (id_termino_pago,descripcion,principal,estado,fecha_creacion) from terminos_pago where id_termino_pago = '{$_POST['id_termino_pago']}'";
            $sql_nuevo = sql_array($conexion, $sql_nuevo);
            auditoria_sistema($conexion, 'terminos_pago', $id_user, 'Update', $_POST['id'], $fecha_larga, $fecha, $sql_nuevo, $sql_anterior);
Example #3
0
        /// este dato ya existe;
    } else {
        if ($_POST['principal'] == 'Si') {
            $sql = "update formas_pago set principal = 'No'";
            guardarSql($conexion, $sql);
        }
        $sql = "insert into formas_pago values ('{$id}','" . strtoupper($_POST['descripcion']) . "','0','" . $_POST['principal'] . "','{$fecha}','" . $_POST['id_plan_cuentas'] . "')";
        $guardar = guardarSql($conexion, $sql);
        $sql_nuevo = "select (id_forma_pago,descripcion,estado,principal,fecha_creacion,id_plan_cuentas) from formas_pago where id_forma_pago = '{$id}'";
        $sql_nuevo = sql_array($conexion, $sql_nuevo);
        auditoria_sistema($conexion, 'formas_pago', $id_user, 'Insert', $id, $fecha_larga, $fecha, $sql_nuevo, '');
        $data = "2";
    }
} else {
    if ($_POST['oper'] == "edit") {
        $repetidos = repetidos($conexion, "descripcion", strtoupper($_POST['descripcion']), "formas_pago", "m", $_POST['id_forma_pago'], "id_forma_pago");
        if ($repetidos == 'true') {
            $data = "1";
            /// este dato ya existe;
        } else {
            if ($_POST['principal'] == 'Si') {
                $sql = "update formas_pago set principal = 'No'";
                guardarSql($conexion, $sql);
            }
            $sql_anterior = "select (id_forma_pago,descripcion,estado,principal,fecha_creacion,id_plan_cuentas) from formas_pago where id_forma_pago = '{$_POST['id_forma_pago']}'";
            $sql_anterior = sql_array($conexion, $sql_anterior);
            $sql = "update formas_pago set descripcion = '" . strtoupper($_POST['descripcion']) . "',estado = '0', principal = '" . $_POST['principal'] . "', fecha_creacion = '{$fecha}', id_plan_cuentas = '" . $_POST['id_plan_cuentas'] . "'  where id_forma_pago = '{$_POST['id_forma_pago']}'";
            $guardar = guardarSql($conexion, $sql);
            $sql_nuevo = "select (id_forma_pago,descripcion,estado,principal,fecha_creacion,id_plan_cuentas) from formas_pago where id_forma_pago = '{$_POST['id_forma_pago']}'";
            $sql_nuevo = sql_array($conexion, $sql_nuevo);
            auditoria_sistema($conexion, 'formas_pago', $id_user, 'Update', $_POST['id'], $fecha_larga, $fecha, $sql_nuevo, $sql_anterior);
                $sql_nuevo = sql_array($conexion, $sql_nuevo);
                auditoria_sistema($conexion, 'sustento_tributario', $id_user, 'Insert', $id, $fecha_larga, $fecha, $sql_nuevo, '');
                $data = 0;
            } else {
                $data = 3;
            }
        }
    }
} else {
    if ($_POST['tipo'] == "m") {
        $repetidos = repetidos($conexion, "codigo_sustento", strtoupper($_POST['txt_1']), "sustento_tributario", "m", $_POST['txt_0'], "id_sustento");
        if ($repetidos == 'true') {
            $data = 1;
            /// este codigo ya existe;
        } else {
            $repetidos = repetidos($conexion, "nombre_sustento", strtoupper($_POST['txt_2']), "sustento_tributario", "m", $_POST['txt_0'], "id_sustento");
            if ($repetidos == 'true') {
                $data = 2;
                /// este nombre ya existe;
            } else {
                $sql = "update sustento_tributario set codigo_sustento = '" . $_POST['txt_1'] . "',nombre_sustento = '" . $_POST['txt_2'] . "' where id_sustento= '" . $_POST['txt_0'] . "'";
                $sql_anterior = "SELECT (id_sustento,codigo_sustento,nombre_sustento,fecha_creacion,estado)  FROM sustento_tributario where id_sustento = '" . $_POST['txt_0'] . "'";
                $sql_anterior = sql_array($conexion, $sql_anterior);
                if ($guardar = guardarSql($conexion, $sql)) {
                    $sql_nuevo = "SELECT (id_sustento,codigo_sustento,nombre_sustento,fecha_creacion,estado)  FROM sustento_tributario where id_sustento = '" . $_POST['txt_0'] . "'";
                    $sql_nuevo = sql_array($conexion, $sql_nuevo);
                    auditoria_sistema($conexion, 'sustento_tributario', $id_user, 'Update', $_POST['txt_0'], $fecha_larga, $fecha, $sql_nuevo, $sql_anterior);
                    $data = 0;
                } else {
                    $data = 3;
                }
                $sql_nuevo = sql_array($conexion, $sql_nuevo);
                auditoria_sistema($conexion, 'tipo_comprobante', $id_user, 'Insert', $id, $fecha_larga, $fecha, $sql_nuevo, '');
                $data = 0;
            } else {
                $data = 3;
            }
        }
    }
} else {
    if ($_POST['tipo'] == "m") {
        $repetidos = repetidos($conexion, "codigo_comprobante", strtoupper($_POST['txt_1']), "tipo_comprobante", "m", $_POST['txt_0'], "id_comprobante");
        if ($repetidos == 'true') {
            $data = 1;
            /// este codigo ya existe;
        } else {
            $repetidos = repetidos($conexion, "nombre_comprobante", strtoupper($_POST['txt_2']), "tipo_comprobante", "m", $_POST['txt_0'], "id_comprobante");
            if ($repetidos == 'true') {
                $data = 2;
                /// este nombre ya existe;
            } else {
                $sql = "update tipo_comprobante set codigo_comprobante = '" . $_POST['txt_1'] . "',nombre_comprobante = '" . $_POST['txt_2'] . "' where id_comprobante= '" . $_POST['txt_0'] . "'";
                $sql_anterior = "SELECT (id_comprobante,codigo_comprobante,nombre_comprobante,fecha_creacion,estado)  FROM tipo_comprobante where id_comprobante = '" . $_POST['txt_0'] . "'";
                $sql_anterior = sql_array($conexion, $sql_anterior);
                if ($guardar = guardarSql($conexion, $sql)) {
                    $sql_nuevo = "SELECT (id_comprobante,codigo_comprobante,nombre_comprobante,fecha_creacion,estado)  FROM tipo_comprobante where id_comprobante = '" . $_POST['txt_0'] . "'";
                    $sql_nuevo = sql_array($conexion, $sql_nuevo);
                    auditoria_sistema($conexion, 'tipo_comprobante', $id_user, 'Update', $_POST['txt_0'], $fecha_larga, $fecha, $sql_nuevo, $sql_anterior);
                    $data = 0;
                } else {
                    $data = 3;
                }
Example #6
0
            $data = 4;
            /// error al guardar
        }
    }
} else {
    $repetidos = repetidos($conexion, "codigo", strtoupper($_POST['txt_1']), "productos", "m", $_POST['txt_0'], "id_productos");
    if ($repetidos == 'true') {
        $data = 1;
        ///codigo repetido
    } else {
        $repetidos = repetidos($conexion, "codigo_barras", strtoupper($_POST['txt_8']), "productos", "mr", $_POST['txt_0'], "id_productos");
        if ($repetidos == 'true') {
            $data = 2;
            ///codigo barras repetido
        } else {
            $repetidos = repetidos($conexion, "descripcion", strtoupper($_POST['txt_2']), "productos", "m", $_POST['txt_0'], "id_productos");
            if ($repetidos == 'true') {
                $data = 3;
                ///nombre repetido
            } else {
                $data = 0;
            }
        }
    }
    if ($data == 0) {
        $valor1 = number_format($_POST['txt_9'], 2, '.', '');
        $valor2 = number_format($_POST['txt_4'], 2, '.', '');
        $valor3 = number_format($_POST['txt_11'], 2, '.', '');
        if (strpos($cadena, $buscar) == FALSE) {
            $sql = "update productos set codigo='" . strtoupper($_POST["txt_1"]) . "',codigo_barras='" . strtoupper($_POST["txt_8"]) . "',descripcion='" . strtoupper($_POST['txt_2']) . "',precio='{$valor1}',utilidad_minorista='" . $_POST["txt_3"] . "',utilidad_mayorista='" . $_POST["txt_10"] . "',precio_minorista='{$valor2}',precio_mayorista='{$valor3}',id_tipo='" . $_POST["txt_5"] . "',stock='" . $_POST["txt_12"] . "',id_categoria='" . $_POST["txt_6"] . "',id_marca='" . $_POST["txt_13"] . "',id_bodega='" . $_POST["txt_7"] . "',id_unidad='" . $_POST["txt_14"] . "',facturar_existencia='{$sin_existencia}',cantidad_minima='" . $_POST["txt_16"] . "',cantidad_maxima='" . $_POST["txt_17"] . "',id_series_venta='{$producto_series}',expiracion='{$expiracion_producto}',comentario='" . $_POST["txt_18"] . "',imagen='default.png',estado='{$producto_activo}',id_porcentaje_iva='" . $_POST["iva_producto"] . "',id_usuario ='{$id_user}', incluye_iva='" . $incluye_iva . "',descuento='" . $_POST["descuento"] . "',id_plan_cuentas='" . $_POST['grupo_contable'] . "' where id_productos = '" . $_POST["txt_0"] . "'";
        } else {
    $consulta = pg_query("select max(id_convocatoria) from convocatoria");
    while ($row = pg_fetch_row($consulta)) {
        $cont = $row[0];
    }
    $cont++;
    $repetidos = repetidos($conexion, "descripcion_convocatoria", strtoupper($_POST['descripcion_convocatoria']), "convocatoria", "g", "", "");
    if ($repetidos == 'true') {
        $data = "3";
        /// este dato ya existe;
    } else {
        $sql = "insert into convocatoria values ('{$cont}','" . strtoupper($_POST['descripcion_convocatoria']) . "','{$_POST['fecha_inicio']}','{$_POST['fecha_fin']}','1','{$fecha}')";
        $guardar = guardarSql($conexion, $sql);
        pg_query("insert into auditoria values('{$id_auditoria}','{$id_user}','{$fecha}','" . 'Se creó una nueva Convocatoria : ' . strtoupper($_POST['descripcion_convocatoria']) . "','Convocatoria','{$cliente}','{$cont}')");
        $data = "1";
        //guardado
    }
} else {
    if ($_POST['oper'] == "edit") {
        $repetidos = repetidos($conexion, "descripcion_convocatoria", strtoupper($_POST['descripcion_convocatoria']), "convocatoria", "m", $_POST['id'], "id_convocatoria");
        if ($repetidos == 'true') {
            $data = "3";
            /// este dato ya existe;
        } else {
            $sql = "update convocatoria set descripcion_convocatoria = '" . strtoupper($_POST['descripcion_convocatoria']) . "', fecha_inicio = '{$_POST['fecha_inicio']}', fecha_fin = '{$_POST['fecha_fin']}', fecha_creacion = '{$fecha}' where id_convocatoria = '{$_POST['id_convocatoria']}'";
            $guardar = guardarSql($conexion, $sql);
            pg_query("insert into auditoria values('{$id_auditoria}','{$id_user}','{$fecha}','" . 'Se Modificó la Convocatoria : ' . strtoupper($_POST['descripcion_convocatoria']) . "','Convocatoria','{$cliente}','{$_POST['id_convocatoria']}')");
            $data = "2";
        }
    }
}
echo $data;
if ($_POST['oper'] == "add") {
    $repetidos = repetidos($conexion, "descripcion", strtoupper($_POST['descripcion']), "unidades_medida", "g", "", "");
    if ($repetidos == 'true') {
        $data = "1";
        /// este dato ya existe;
    } else {
        $sql = "insert into unidades_medida values ('{$id}','" . strtoupper($_POST['descripcion']) . "','" . strtoupper($_POST['abreviatura']) . "','{$_POST['cantidad']}','{$fecha}','1')";
        $guardar = guardarSql($conexion, $sql);
        $sql_nuevo = "select (id_unidad,descripcion,abreviatura,cantidad,fecha_creacion,estado) from unidades_medida where id_unidad = '{$id}'";
        $sql_nuevo = sql_array($conexion, $sql_nuevo);
        auditoria_sistema($conexion, 'unidades_medida', $id_user, 'Insert', $id, $fecha_larga, $fecha, $sql_nuevo, '');
        $data = "2";
    }
} else {
    if ($_POST['oper'] == "edit") {
        $repetidos = repetidos($conexion, "descripcion", strtoupper($_POST['descripcion']), "unidades_medida", "m", $_POST['id'], "id_unidad");
        if ($repetidos == 'true') {
            $data = "1";
            /// este dato ya existe;
        } else {
            $sql_anterior = "select (id_unidad,descripcion,abreviatura,cantidad,fecha_creacion,estado) from unidades_medida where id_unidad = '{$_POST['id']}'";
            $sql_anterior = sql_array($conexion, $sql_anterior);
            $sql = "update unidades_medida set descripcion = '" . strtoupper($_POST['descripcion']) . "', abreviatura= '" . strtoupper($_POST['abreviatura']) . "', cantidad = '{$_POST['cantidad']}', fecha_creacion = '{$fecha}'  where id_unidad = '{$_POST['id']}'";
            $guardar = guardarSql($conexion, $sql);
            $sql_nuevo = "select (id_unidad,descripcion,abreviatura,cantidad,fecha_creacion,estado) from unidades_medida where id_unidad = '{$_POST['id']}'";
            $sql_nuevo = sql_array($conexion, $sql_nuevo);
            auditoria_sistema($conexion, 'unidades_medida', $id_user, 'Update', $_POST['id'], $fecha_larga, $fecha, $sql_nuevo, $sql_anterior);
            $data = "3";
        }
    }
}
        $sql = "insert into retenciones values ('{$id}','" . $_POST['codigo_anexo'] . "','" . $_POST['formulario_103'] . "','" . $_POST['porcentaje'] . "','" . $_POST['descripcion'] . "','" . $_POST['id_plan'] . "','1','{$fecha}')";
        $guardar = guardarSql($conexion, $sql);
        $sql_nuevo = "select (id_retencion,codigo_anexo,formulario_103,porcentaje,descripcion,id_plan,estado,fecha_creacion) from retenciones where id_retencion = '{$id}'";
        $sql_nuevo = sql_array($conexion, $sql_nuevo);
        auditoria_sistema($conexion, 'retenciones', $id_user, 'Insert', $id, $fecha_larga, $fecha, $sql_nuevo, '');
        if ($guardar == 'true') {
            $data = 0;
            ////datos guardados
        } else {
            $data = 2;
            /// error al guardar
        }
    }
} else {
    if ($_POST['oper'] == "edit") {
        $repetidos = repetidos($conexion, 'codigo_anexo', $_POST['codigo_anexo'], 'retenciones', 'm', $_POST['id_retencion'], 'id_retencion');
        if ($repetidos == 'true') {
            $data = 1;
            /// este dato ya existe;
        } else {
            $sql = "update retenciones set codigo_anexo ='" . $_POST['codigo_anexo'] . "',formulario_103 = '" . $_POST['formulario_103'] . "',porcentaje = '" . $_POST['porcentaje'] . "',descripcion = '" . $_POST['descripcion'] . "',id_plan = '" . $_POST['id_plan'] . "',estado = '1',fecha_creacion = '{$fecha}' where id_retencion= '" . $_POST['id_retencion'] . "'";
            $sql_anterior = "select (id_retencion,codigo_anexo,formulario_103,porcentaje,descripcion,id_plan,estado,fecha_creacion) from retenciones where id_retencion = '" . $_POST['id_retencion'] . "'";
            $sql_anterior = sql_array($conexion, $sql_anterior);
            $guardar = guardarSql($conexion, $sql);
            $sql_nuevo = "select (id_retencion,codigo_anexo,formulario_103,porcentaje,descripcion,id_plan,estado,fecha_creacion) from retenciones where id_retencion = '" . $_POST['id_retencion'] . "'";
            $sql_nuevo = sql_array($conexion, $sql_nuevo);
            auditoria_sistema($conexion, 'retenciones', $id_user, 'Update', $_POST['id_retencion'], $fecha_larga, $fecha, $sql_nuevo, $sql_anterior);
            if ($guardar == 'true') {
                $data = 0;
                ////datos guardados
            } else {
Example #10
0
        $sql = "insert into plan_cuentas values ('{$id}','" . $_POST['codigo_cuenta'] . "','" . ucwords($_POST['nombre_cuenta']) . "','0','{$fecha}','" . $_POST['grupo_cuenta'] . "')";
        $guardar = guardarSql($conexion, $sql);
        $sql_nuevo = "select (id_plan,codigo_cuenta,nombre_cuenta,estado,fecha,tipo_cuenta) from plan_cuentas where id_plan = '{$id}'";
        $sql_nuevo = sql_array($conexion, $sql_nuevo);
        auditoria_sistema($conexion, 'plan_cuentas', $id_user, 'Insert', $id, $fecha_larga, $fecha, $sql_nuevo, '');
        if ($guardar == 'true') {
            $data = 0;
            ////datos guardados
        } else {
            $data = 2;
            /// error al guardar
        }
    }
} else {
    if ($_POST['oper'] == "edit") {
        $repetidos = repetidos($conexion, 'codigo_cuenta', $_POST['codigo_cuenta'], 'plan_cuentas', 'm', $_POST['id_plan'], 'id_plan');
        if ($repetidos == 'true') {
            $data = 1;
            /// este dato ya existe;
        } else {
            $sql = "update plan_cuentas set codigo_cuenta='" . $_POST['codigo_cuenta'] . "',nombre_cuenta='" . ucwords($_POST['nombre_cuenta']) . "',estado='0',fecha='" . $fecha . "',tipo_cuenta='" . $_POST['grupo_cuenta'] . "' where id_plan= '" . $_POST['id_plan'] . "'";
            $sql_anterior = "select (id_plan,codigo_cuenta,nombre_cuenta,estado,fecha,tipo_cuenta) from plan_cuentas where id_plan = '{$_POST['id_plan']}'";
            $sql_anterior = sql_array($conexion, $sql_anterior);
            $guardar = guardarSql($conexion, $sql);
            $sql_nuevo = "select (id_plan,codigo_cuenta,nombre_cuenta,estado,fecha,tipo_cuenta) from plan_cuentas where id_plan = '{$_POST['id_plan']}'";
            $sql_nuevo = sql_array($conexion, $sql_nuevo);
            auditoria_sistema($conexion, 'plan_cuentas', $id_user, 'Update', $_POST['id_plan'], $fecha_larga, $fecha, $sql_nuevo, $sql_anterior);
            if ($guardar == 'true') {
                $data = 0;
                ////datos guardados
            } else {
Example #11
0
    $consulta = pg_query("select max(id_tribunal) from tribunal");
    while ($row = pg_fetch_row($consulta)) {
        $cont = $row[0];
    }
    $cont++;
    $repetidos = repetidos($conexion, "area_tribunal", strtoupper($_POST['area_tribunal']), "tribunal", "g", "", "");
    if ($repetidos == 'true') {
        $data = "3";
        /// este dato ya existe;
    } else {
        $sql = "insert into tribunal values ('{$cont}','" . strtoupper($_POST['area_tribunal']) . "','" . strtoupper($_POST['tribunal1']) . "','" . strtoupper($_POST['tribunal2']) . "','" . strtoupper($_POST['tribunal3']) . "','1','{$fecha}')";
        $guardar = guardarSql($conexion, $sql);
        pg_query("insert into auditoria values('{$id_auditoria}','{$id_user}','{$fecha}','" . 'Se creó una nuevo Tribunal: ' . strtoupper($_POST['area_tribunal']) . "','Tribunal','{$cliente}','{$cont}')");
        $data = "1";
        //guardado
    }
} else {
    if ($_POST['oper'] == "edit") {
        $repetidos = repetidos($conexion, "area_tribunal", strtoupper($_POST['area_tribunal']), "tribunal", "m", $_POST['id'], "id_tribunal");
        if ($repetidos == 'true') {
            $data = "3";
            /// este dato ya existe;
        } else {
            $sql = "update tribunal set area_tribunal = '" . strtoupper($_POST['area_tribunal']) . "', tribunal1 = '" . strtoupper($_POST['tribunal1']) . "', tribunal2 = '" . strtoupper($_POST['tribunal2']) . "', tribunal3 = '" . strtoupper($_POST['tribunal3']) . "', fecha_creacion = '{$fecha}' where id_tribunal = '{$_POST['id_tribunal']}'";
            $guardar = guardarSql($conexion, $sql);
            pg_query("insert into auditoria values('{$id_auditoria}','{$id_user}','{$fecha}','" . 'Se Modificó el Tribunal: ' . strtoupper($_POST['area_tribunal']) . "','Tribunal','{$cliente}','{$_POST['id_tribunal']}')");
            $data = "2";
        }
    }
}
echo $data;
Example #12
0
if ($_POST['oper'] == "add") {
    $repetidos = repetidos($conexion, "nombre_banco", strtoupper($_POST['nombre_banco']), "bancos", "g", "", "");
    if ($repetidos == 'true') {
        $data = "1";
        /// este dato ya existe;
    } else {
        $sql = "insert into bancos values ('{$id}','" . strtoupper($_POST['codigo']) . "','" . strtoupper($_POST['nombre_banco']) . "','{$fecha}','1')";
        $guardar = guardarSql($conexion, $sql);
        $sql_nuevo = "select (id_bancos, codigo, nombre_banco, fecha_creacion, estado) from bancos where id_bancos = '{$id}'";
        $sql_nuevo = sql_array($conexion, $sql_nuevo);
        auditoria_sistema($conexion, 'bancos', $id_user, 'Insert', $id, $fecha_larga, $fecha, $sql_nuevo, '');
        $data = "2";
    }
} else {
    if ($_POST['oper'] == "edit") {
        $repetidos = repetidos($conexion, "nombre_banco", strtoupper($_POST['nombre_banco']), "bancos", "m", $_POST['id'], "id_bancos");
        if ($repetidos == 'true') {
            $data = "1";
            /// este dato ya existe;
        } else {
            // $sql_anterior = "select (id_bancos, codigo, nombre_banco, fecha_creacion, estado) from bancos where id_bancos = '$_POST[id]'";
            // $sql_anterior = sql_array($conexion,$sql_anterior);
            $sql = "update bancos set codigo = '" . strtoupper($_POST['codigo']) . "', nombre_banco = '" . strtoupper($_POST['nombre_banco']) . "', fecha_creacion = '{$fecha}' where id_bancos = '{$_POST['id']}'";
            $guardar = guardarSql($conexion, $sql);
            // $sql_nuevo = "select (id_bancos, ,codigo, nombre_banco, fecha_creacion, estado) from bancos where id_bancos = '$_POST[id]'";
            // $sql_nuevo = sql_array($conexion,$sql_nuevo);
            // auditoria_sistema($conexion,'bancos',$id_user,'Update',$_POST['id'],$fecha_larga,$fecha,$sql_nuevo,$sql_anterior);
            $data = "3";
        }
    }
}
if ($_POST['oper'] == "add") {
    $repetidos = repetidos($conexion, "descripcion", strtoupper($_POST['descripcion']), "tipo_producto", "g", "", "");
    if ($repetidos == 'true') {
        $data = "1";
        /// este dato ya existe;
    } else {
        $sql = "insert into tipo_producto values ('{$id}','" . strtoupper($_POST['descripcion']) . "','{$fecha}','1')";
        $guardar = guardarSql($conexion, $sql);
        $sql_nuevo = "select (id_tipo,descripcion,fecha_creacion,estado) from tipo_producto where id_tipo='{$id}'";
        $sql_nuevo = sql_array($conexion, $sql_nuevo);
        auditoria_sistema($conexion, 'tipo_producto', $id_user, 'Insert', $id, $fecha_larga, $fecha, $sql_nuevo, '');
        $data = "2";
    }
} else {
    if ($_POST['oper'] == "edit") {
        $repetidos = repetidos($conexion, "descripcion", strtoupper($_POST['descripcion']), "tipo_producto", "m", $_POST['id'], "id_tipo");
        if ($repetidos == 'true') {
            $data = "1";
            /// este dato ya existe;
        } else {
            $sql_anterior = "select (id_tipo,descripcion,fecha_creacion,estado) from tipo_producto where id_tipo='{$_POST['id']}'";
            $sql_anterior = sql_array($conexion, $sql_anterior);
            $sql = "update tipo_producto set descripcion = '" . strtoupper($_POST['descripcion']) . "', fecha_creacion = '{$fecha}' where id_tipo = '{$_POST['id']}'";
            $guardar = guardarSql($conexion, $sql);
            $sql_nuevo = "select (id_tipo,descripcion,fecha_creacion,estado) from tipo_producto where id_tipo='{$_POST['id']}'";
            $sql_nuevo = sql_array($conexion, $sql_nuevo);
            auditoria_sistema($conexion, 'tipo_producto', $id_user, 'Update', $_POST['id'], $fecha_larga, $fecha, $sql_nuevo, $sql_anterior);
            $data = "3";
        }
    }
}
Example #14
0
                /// error al guardar
            }
            $sql = "insert into claves values ('{$id_c}','{$id}','{$_POST['txt_5']}')";
            $guardar = guardarSql($conexion, $sql);
            if ($guardar == 'true') {
                $data = 0;
                ////datos guardados
            } else {
                $data = 3;
                /// error al guardar
            }
        }
    }
} else {
    if ($_POST['tipo'] == "m") {
        $repetidos = repetidos($conexion, "usuario", strtoupper($_POST["txt_13"]), "usuario", "m", $_POST['txt_o'], "id_usuario");
        if ($repetidos == 'true') {
            $data = 1;
            /// este dato ya existe;
        } else {
            if (strpos($cadena, $buscar) == FALSE) {
                $sql = "update usuario set identificacion='{$_POST['txt_1']}',nombres_completos='{$_POST['txt_2']}',telefono1='{$_POST['txt_3']}',telefono2='{$_POST['txt_7']}',id_ciudad='{$_POST['txt_11']}',direccion='{$_POST['txt_12']}',correo='{$_POST['txt_8']}',usuario='{$_POST['txt_13']}',id_cargo='{$_POST['txt_4']}',extranjero='{$check}' where id_usuario = '{$_POST['txt_o']}'";
            } else {
                $resp = img_64("img", $_POST['img'], 'png', $_POST['txt_o']);
                if ($resp == "true") {
                    $sql = "update usuario set identificacion='{$_POST['txt_1']}',nombres_completos='{$_POST['txt_2']}',telefono1='{$_POST['txt_3']}',telefono2='{$_POST['txt_7']}',id_ciudad='{$_POST['txt_11']}',direccion='{$_POST['txt_12']}',correo='{$_POST['txt_8']}',usuario='{$_POST['txt_13']}',id_cargo='{$_POST['txt_4']}',imagen='" . $_POST['txt_o'] . ".png',extranjero='{$check}' where id_usuario = '{$_POST['txt_o']}'";
                } else {
                    $sql = "update usuario set identificacion='{$_POST['txt_1']}',nombres_completos='{$_POST['txt_2']}',telefono1='{$_POST['txt_3']}',telefono2='{$_POST['txt_7']}',id_ciudad='{$_POST['txt_11']}',direccion='{$_POST['txt_12']}',correo='{$_POST['txt_8']}',usuario='{$_POST['txt_13']}',id_cargo='{$_POST['txt_4']}',extranjero='{$check}' where id_usuario = '{$_POST['txt_o']}'";
                }
            }
            $guardar = guardarSql($conexion, $sql);
Example #15
0
    $repetidos = repetidos($conexion, "nombre_bodega", strtoupper($_POST['nombre_bodega']), "bodega", "g", "", "");
    if ($repetidos == 'true') {
        $data = "1";
        /// este dato ya existe;
    } else {
        $sql = "insert into bodega values ('{$id}','" . strtoupper($_POST['nombre_bodega']) . "','" . strtoupper($_POST['ubicacion_bodega']) . "','{$fecha}','1')";
        $guardar = guardarSql($conexion, $sql);
        $sql_nuevo = "select (id_bodega,nombre_bodega,ubicacion_bodega,fecha_creacion,estado) from bodega where id_bodega = '{$id}'";
        $sql_nuevo = sql_array($conexion, $sql_nuevo);
        auditoria_sistema($conexion, 'bodega', $id_user, 'Insert', $id, $fecha_larga, $fecha, $sql_nuevo, '');
        $data = "2";
        //guardado
    }
} else {
    if ($_POST['oper'] == "edit") {
        $repetidos = repetidos($conexion, "nombre_bodega", strtoupper($_POST['nombre_bodega']), "bodega", "m", $_POST['id'], "id_bodega");
        if ($repetidos == 'true') {
            $data = "1";
            /// este dato ya existe;
        } else {
            $sql_anterior = "select (id_bodega,nombre_bodega,ubicacion_bodega,fecha_creacion,estado) from bodega where id_bodega = '{$_POST['id']}'";
            $sql_anterior = sql_array($conexion, $sql_anterior);
            $sql = "update bodega set nombre_bodega = '" . strtoupper($_POST['nombre_bodega']) . "', ubicacion_bodega= '" . strtoupper($_POST['ubicacion_bodega']) . "', fecha_creacion = '{$fecha}' where id_bodega = '{$_POST['id']}'";
            $guardar = guardarSql($conexion, $sql);
            $sql_nuevo = "select (id_bodega,nombre_bodega,ubicacion_bodega,fecha_creacion,estado) from bodega where id_bodega = '{$_POST['id']}'";
            $sql_nuevo = sql_array($conexion, $sql_nuevo);
            auditoria_sistema($conexion, 'bodega', $id_user, 'Update', $_POST['id'], $fecha_larga, $fecha, $sql_nuevo, $sql_anterior);
            $data = "3";
        }
    }
}
Example #16
0
if ($_POST['oper'] == "add") {
    $repetidos = repetidos($conexion, "nombre_marca", strtoupper($_POST['nombre_marca']), "marca", "g", "", "");
    if ($repetidos == 'true') {
        $data = "1";
        /// este dato ya existe;
    } else {
        $sql = "insert into marca values ('{$id}','" . strtoupper($_POST['nombre_marca']) . "','{$fecha}','1')";
        $guardar = guardarSql($conexion, $sql);
        $sql_nuevo = "SELECT (id_marca,nombre_marca,fecha_creacion,estado)  FROM marca where id_marca = '{$id}'";
        $sql_nuevo = sql_array($conexion, $sql_nuevo);
        auditoria_sistema($conexion, 'marca', $id_user, 'Insert', $id, $fecha_larga, $fecha, $sql_nuevo, '');
        $data = "2";
    }
} else {
    if ($_POST['oper'] == "edit") {
        $repetidos = repetidos($conexion, "nombre_marca", strtoupper($_POST['nombre_marca']), "marca", "m", $_POST['id'], "id_marca");
        if ($repetidos == 'true') {
            $data = "1";
            /// este dato ya existe;
        } else {
            $sql_anterior = "SELECT (id_marca,nombre_marca,fecha_creacion,estado)  FROM marca where id_marca = '{$_POST['id']}'";
            $sql_anterior = sql_array($conexion, $sql_anterior);
            $sql = "update marca set nombre_marca = '" . strtoupper($_POST['nombre_marca']) . "', fecha_creacion = '{$fecha}' where id_marca = '{$_POST['id']}'";
            $guardar = guardarSql($conexion, $sql);
            $sql_nuevo = "SELECT (id_marca,nombre_marca,fecha_creacion,estado)  FROM marca where id_marca = '{$_POST['id']}'";
            $sql_nuevo = sql_array($conexion, $sql_nuevo);
            auditoria_sistema($conexion, 'marca', $id_user, 'Update', $_POST['id'], $fecha_larga, $fecha, $sql_nuevo, $sql_anterior);
            $data = "3";
        }
    }
}
Example #17
0
if ($_POST['oper'] == "add") {
    $repetidos = repetidos($conexion, "nombre_categoria", strtoupper($_POST['nombre_categoria']), "categoria", "g", "", "");
    if ($repetidos == 'true') {
        $data = "1";
        /// este dato ya existe;
    } else {
        $sql = "insert into categoria values ('{$id}','" . strtoupper($_POST['nombre_categoria']) . "','{$fecha}','1')";
        $guardar = guardarSql($conexion, $sql);
        $sql_nuevo = "select (id_categoria,nombre_categoria,fecha_creacion,estado) from categoria where id_categoria = '{$id}'";
        $sql_nuevo = sql_array($conexion, $sql_nuevo);
        auditoria_sistema($conexion, 'categoria', $id_user, 'Insert', $id, $fecha_larga, $fecha, $sql_nuevo, '');
        $data = "2";
    }
} else {
    if ($_POST['oper'] == "edit") {
        $repetidos = repetidos($conexion, "nombre_categoria", strtoupper($_POST['nombre_categoria']), "categoria", "m", $_POST['id'], "id_categoria");
        if ($repetidos == 'true') {
            $data = "1";
            /// este dato ya existe;
        } else {
            $sql_anterior = "select (id_categoria,nombre_categoria,fecha_creacion,estado) from categoria where id_categoria = '{$_POST['id']}'";
            $sql_anterior = sql_array($conexion, $sql_anterior);
            $sql = "update categoria set nombre_categoria = '" . strtoupper($_POST['nombre_categoria']) . "', fecha_creacion = '{$fecha}' where id_categoria = '{$_POST['id']}'";
            $guardar = guardarSql($conexion, $sql);
            $sql_nuevo = "select (id_categoria,nombre_categoria,fecha_creacion,estado) from categoria where id_categoria = '{$_POST['id']}'";
            $sql_nuevo = sql_array($conexion, $sql_nuevo);
            auditoria_sistema($conexion, 'categoria', $id_user, 'Update', $_POST['id'], $fecha_larga, $fecha, $sql_nuevo, $sql_anterior);
            $data = "3";
        }
    }
}
            $data = '0';
            ////datos guardados
            $sql_nuevo = "SELECT (id_retencion,codigo_anexo,formulario_103,porcentaje,descripcion,id_plan,estado,fecha_creacion)  FROM retenciones where id_retencion = '" . $id . "'";
            $sql_nuevo = sql_array($conexion, $sql_nuevo);
            auditoria_sistema($conexion, 'retenciones', $id_user, 'Insert', $id, $fecha_larga, $fecha, $sql_nuevo, '');
            /////////////////////detalles retenciones////////////
        } else {
            $data = '3';
            /// error al guardar
        }
        $data = '0';
        ///correcto
    }
} else {
    if ($_POST['tipo'] == "m") {
        $repetidos = repetidos($conexion, "codigo_anexo", strtoupper($_POST['txt_1']), "retenciones", "m", $_POST['txt_0'], "id_retencion");
        if ($repetidos == 'true') {
            $data = "1";
            /// este codigo ya existe;
        } else {
            $sql = "update retenciones set codigo_anexo = '" . strtoupper($_POST['txt_1']) . "',formulario_103 = '" . strtoupper($_POST['txt_2']) . "',porcentaje = '" . strtoupper($_POST['txt_3']) . "',descripcion = '" . strtoupper($_POST['txt_5']) . "',id_plan = '" . $_POST['txt_00'] . "',estado = '1',fecha_creacion = '" . $fecha . "' where id_retencion = '" . $_POST['txt_0'] . "'";
            $sql_nuevo = "SELECT (id_retencion,codigo_anexo,formulario_103,porcentaje,descripcion,id_plan,estado,fecha_creacion)  FROM retenciones where id_retencion = '" . $_POST['txt_0'] . "'";
            $sql_nuevo = sql_array($conexion, $sql_nuevo);
            $guardar = guardarSql($conexion, $sql);
            if ($guardar == 'true') {
                $data = '0';
                ////datos guardados
                $sql_anterior = "SELECT (id_retencion,codigo_anexo,formulario_103,porcentaje,descripcion,id_plan,estado,fecha_creacion) FROM retenciones where id_retencion = '" . $_POST['txt_0'] . "'";
                $sql_anterior = sql_array($conexion, $sql_anterior);
                auditoria_sistema($conexion, 'retenciones', $id_user, 'Update', $id, $fecha_larga, $fecha, $sql_nuevo, $sql_anterior);
                /////////////////////detalles retenciones////////////