$guardar = guardarSql($conexion, $sql); $sql_nuevo = "select (id_empresa,ruc_empresa,nombre_empresa,propietario,slogan,telefono1,telefono2,ciudad,direccion,correo,fax,sitio_web,nombre_contador,autorizacion_factura,ascesor_legal,representante_legal,identificacion_repre,inicio_fac_preimpresa,item_factura,anio_contable,modo_costeo,comentario,imagen,estado,fecha_creacion,ruc_contador,serie_retencion,autorizacion_retencion,serie_nota_credito,autorizacion_nota_credito) from empresa where id_empresa= '" . $id . "'"; $sql_nuevo = sql_array($conexion, $sql_nuevo); auditoria_sistema($conexion, 'empresa', $id_user, 'Insert', $id, $fecha_larga, $fecha, $sql_nuevo, ''); if ($guardar == 'true') { $data = 0; ////datos guardados } else { $data = 3; /// error al guardar } } else { if (strpos($cadena, $buscar) == FALSE) { $sql = "update empresa set ruc_empresa='" . $_POST['txt_1'] . "',nombre_empresa='" . $_POST['txt_12'] . "',propietario='" . $_POST['txt_2'] . "',slogan='" . $_POST['txt_13'] . "',telefono1='" . $_POST['txt_3'] . "',telefono2='" . $_POST['txt_4'] . "',ciudad='" . $_POST['txt_11'] . "',direccion='" . $_POST['txt_14'] . "',correo='" . $_POST['txt_5'] . "',fax='" . $_POST['txt_7'] . "',sitio_web='" . $_POST['txt_6'] . "',nombre_contador='" . $_POST['txt_17'] . "',autorizacion_factura='" . $_POST['txt_18'] . "',ascesor_legal='" . $_POST['txt_15'] . "',representante_legal='" . $_POST['txt_8'] . "',identificacion_repre='" . $_POST['txt_16'] . "',inicio_fac_preimpresa='" . $_POST['spinner1'] . "',item_factura='" . $_POST['spinner2'] . "',anio_contable='" . $_POST['spinner3'] . "',modo_costeo='" . $_POST['txt_19'] . "',comentario='" . $_POST['txt_20'] . "',imagen='default.png',estado='" . $check . "',ruc_contador='" . $_POST['txt_21'] . "',serie_retencion='" . $_POST['txt_22'] . "',autorizacion_retencion='" . $_POST['txt_23'] . "',serie_nota_credito='" . $_POST['txt_24'] . "',autorizacion_nota_credito='" . $_POST['txt_25'] . "' where id_empresa='" . $_POST['txt_o'] . "'"; } else { $resp = img_64("img", $_POST['img'], 'png', $id); if ($resp == "true") { $sql = "update empresa set ruc_empresa='" . $_POST['txt_1'] . "',nombre_empresa='" . $_POST['txt_12'] . "',propietario='" . $_POST['txt_2'] . "',slogan='" . $_POST['txt_13'] . "',telefono1='" . $_POST['txt_3'] . "',tlefono2='" . $_POST['txt_4'] . "',ciudad='" . $_POST['txt_11'] . "',direccion='" . $_POST['txt_14'] . "',correo='" . $_POST['txt_5'] . "',fax='" . $_POST['txt_7'] . "',sitio_web='" . $_POST['txt_6'] . "',nombre_contador='" . $_POST['txt_17'] . "',autorizacion_factura='" . $_POST['txt_18'] . "',ascesor_legal='" . $_POST['txt_15'] . "',representante_legal='" . $_POST['txt_8'] . "',identificacion_repre='" . $_POST['txt_16'] . "',inicio_fac_preimpresa='" . $_POST['spinner1'] . "',item_factura='" . $_POST['spinner2'] . "',anio_contable='" . $_POST['spinner3'] . "',modo_costeo='" . $_POST['txt_19'] . "',comentario='" . $_POST['txt_20'] . "',imagen='" . $id . ".png',estado='" . $check . "',ruc_contador='" . $_POST['txt_21'] . "',serie_retencion='" . $_POST['txt_22'] . "',autorizacion_retencion='" . $_POST['txt_23'] . "',serie_nota_credito='" . $_POST['txt_24'] . "',autorizacion_nota_credito='" . $_POST['txt_25'] . "' where id_empresa='" . $_POST['txt_o'] . "'"; } else { $sql = "update empresa set ruc_empresa='" . $_POST['txt_1'] . "',nombre_empresa='" . $_POST['txt_12'] . "',propietario='" . $_POST['txt_2'] . "',slogan='" . $_POST['txt_13'] . "',telefono1='" . $_POST['txt_3'] . "',tlefono2='" . $_POST['txt_4'] . "',ciudad='" . $_POST['txt_11'] . "',direccion='" . $_POST['txt_14'] . "',correo='" . $_POST['txt_5'] . "',fax='" . $_POST['txt_7'] . "',sitio_web='" . $_POST['txt_6'] . "',nombre_contador='" . $_POST['txt_17'] . "',autorizacion_factura='" . $_POST['txt_18'] . "',ascesor_legal='" . $_POST['txt_15'] . "',representante_legal='" . $_POST['txt_8'] . "',identificacion_repre='" . $_POST['txt_16'] . "',inicio_fac_preimpresa='" . $_POST['spinner1'] . "',item_factura='" . $_POST['spinner2'] . "',anio_contable='" . $_POST['spinner3'] . "',modo_costeo='" . $_POST['txt_19'] . "',comentario='" . $_POST['txt_20'] . "',imagen='default.png',estado='" . $check . "',ruc_contador='" . $_POST['txt_21'] . "',serie_retencion='" . $_POST['txt_22'] . "',autorizacion_retencion='" . $_POST['txt_23'] . "',serie_nota_credito='" . $_POST['txt_24'] . "',autorizacion_nota_credito='" . $_POST['txt_25'] . "' where id_empresa='" . $_POST['txt_o'] . "'"; } } $sql_anterior = "select (id_empresa,ruc_empresa,nombre_empresa,propietario,slogan,telefono1,telefono2,ciudad,direccion,correo,fax,sitio_web,nombre_contador,autorizacion_factura,ascesor_legal,representante_legal,identificacion_repre,inicio_fac_preimpresa,item_factura,anio_contable,modo_costeo,comentario,imagen,estado,fecha_creacion,ruc_contador,serie_retencion,autorizacion_retencion,serie_nota_credito,autorizacion_nota_credito) from empresa where id_empresa= '" . $_POST['txt_o'] . "'"; $sql_anterior = sql_array($conexion, $sql_anterior); $guardar = guardarSql($conexion, $sql); $sql_nuevo = "select (id_empresa,ruc_empresa,nombre_empresa,propietario,slogan,telefono1,telefono2,ciudad,direccion,correo,fax,sitio_web,nombre_contador,autorizacion_factura,ascesor_legal,representante_legal,identificacion_repre,inicio_fac_preimpresa,item_factura,anio_contable,modo_costeo,comentario,imagen,estado,fecha_creacion,ruc_contador,serie_retencion,autorizacion_retencion,serie_nota_credito,autorizacion_nota_credito) from empresa where id_empresa= '" . $_POST['txt_o'] . "'"; $sql_nuevo = sql_array($conexion, $sql_nuevo); auditoria_sistema($conexion, 'empresa', $id_user, 'Update', $_POST['txt_o'], $fecha_larga, $fecha, $sql_nuevo, $sql_anterior); if ($guardar == 'true') { $data = 0; ////datos guardados
$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); if ($guardar == 'true') { $data = 0; ////datos guardados } else { $data = 2; /// error al guardar } $sql = "update claves set id_usuario='{$_POST['txt_o']}',clave='{$_POST['txt_5']}' where id_usuario = '{$_POST['txt_o']}'";