Script Sial Gr.txt

  • Uploaded by: MARIO CONDORI QUISPE
  • 0
  • 0
  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Script Sial Gr.txt as PDF for free.

More details

  • Words: 423
  • Pages: 4
--INSERT INTO public.modificaciones( -id, valor) -VALUES (121213, 'REPORTE COTIZACION SERVICIOS APARTE'); -- MsgBox Encriptar("@frank"), CInt(19) create extension pgcrypto; INSERT INTO public.modificaciones( id, valor) VALUES (121214, 'RECODIFICAR PASS'); DROP VIEW public.vw_trabajadores; ALTER TABLE public.usuarios ALTER COLUMN cpwd TYPE text; CREATE OR REPLACE VIEW public.vw_trabajadores AS SELECT usuarios.nlineno, usuarios.cdescribe, usuarios.csuspendido, usuarios.fecha, usuarios.cidusuario, usuarios.cpwd AS cpassword, usuarios.cdni FROM usuarios WHERE usuarios.cidusuario::text <> 'ADMIN'::text AND usuarios.csuspendido::numeric = 1::numeric; ALTER TABLE public.vw_trabajadores OWNER TO postgres; CREATE OR REPLACE FUNCTION encode_user(pid integer, pchar text) RETURNS text AS $BODY$ declare rec record; declare TmpVal text; begin UPDATE SET WHERE return

public.usuarios cpwd=crypt(pchar, gen_salt('bf',10)) nlineno=pid; 1;

end; $BODY$ LANGUAGE plpgsql VOLATILE COST 100; --DROP FUNCTION public.encode_user(integer, text); ALTER TABLE logistica.req_aprobados ADD COLUMN fecha_aprob date DEFAULT CURRENT_DATE; CREATE TABLE logistica.doc_adjuntos ( id_adj serial NOT NULL PRIMARY KEY, nombre_cod text, nombre_real text,

ext varchar(5), size integer ) WITH ( OIDS = FALSE ); CREATE OR REPLACE FUNCTION logistica.fn_inserta_doc_adj( pid_adj integer, pnombre_real text, pnombre_cod text, pext character, psize integer) RETURNS integer AS $BODY$ DECLARE haydato integer; haydato1 character; BEGIN SELECT id_adj into haydato FROM logistica.doc_adjuntos where id_adj=pid_adj; if haydato isnull then INSERT INTO logistica.doc_adjuntos( nombre_real, nombre_cod, ext, size) VALUES (pnombre_real, pnombre_cod, pext, psize); RETURN currval('logistica.doc_adjuntos_id_adj_seq'); end if; RETURN haydato; END;

$BODY$ LANGUAGE plpgsql VOLATILE COST 100;

ALTER TABLE logistica.req_det ADD COLUMN req_adjunto varchar(250); CREATE OR REPLACE FUNCTION logistica.fn_req_det_web( nuevo_modificar character, pid_det_req integer, preq_id integer, pide_b_s integer, pmarca character, preq_esp_tec text, preq_cant numeric, preq_val_ref numeric, pclass_id integer, preq_adjunto text) RETURNS character AS $BODY$ DECLARE BEGIN

EXECUTE 'select logistica.fn_bie_ser_usados('|| pide_b_s || ')'; UPDATE logistica.req SET tipo_b_s=(SELECT substr(cod_com::text,1,1) FROM logistica.bie_ser_usados where ide_b_s=pide_b_s) WHERE req_id=preq_id; if (nuevo_modificar='nuevo') then INSERT INTO logistica.req_det ( id_det_req , req_id , ide_b_s , id_marca , req_esp_tec , req_cant , req_val_ref, class_id, req_adjunto ) VALUES ( DEFAULT, preq_id, pide_b_s, logistica.fn_insertar_marca(pmarca), preq_esp_tec, preq_cant, preq_val_ref, pclass_id, preq_adjunto ); RETURN currval('logistica.req_det_id_det_req_seq'); elseif (nuevo_modificar='modificado') then--modificado UPDATE logistica.req_det SET id_marca =logistica.fn_insertar_marca(pmarca), ide_b_s=pide_b_s, req_esp_tec=preq_esp_tec , req_cant =preq_cant, req_val_ref=preq_val_ref, req_stock=preq_cant, class_id=pclass_id, req_adjunto=preq_adjunto WHERE id_det_req=pid_det_req; else

RETURN 'modificado';

-- Eliminar end if; END; $BODY$ LANGUAGE plpgsql VOLATILE COST 100; CREATE OR REPLACE VIEW logistica.vw_det_req AS SELECT req_det.id_det_req, req_det.req_id,

req_det.ide_b_s, bie_ser_usados.cod_com AS cod_com1, bie_ser_usados.des_b_s, bie_ser_usados.ide_u_m, bie_ser_usados.des_u_m, req_det.id_marca, marca.nomb_marca AS marca, req_det.req_esp_tec AS esp_tecn, req_det.req_cant, req_det.req_val_ref, req_det.req_valor_aprob, req_det.class_id, clasificador.class_num, clasificador.nomb_especifica_det, req_det.req_stock, lpad(fte_fto.fte_fto_cod::character(2)::text, 2, '0'::text) || '-'::text AS fte_fto_cod, fte_fto.fte_fto_nombre, familia.tipo_patrimonio, req_adjunto FROM logistica.req_det LEFT JOIN logistica.req ON req.req_id = req_det.req_id LEFT JOIN logistica.fte_fto ON fte_fto.id_ide_fto = req.id_ide_fto LEFT JOIN logistica.bie_ser_usados ON bie_ser_usados.ide_b_s = req_det.ide_b_s LEFT JOIN logistica.familia ON familia.ide_fam = bie_ser_usados.ide_fam LEFT JOIN logistica.marca ON marca.id_marca = req_det.id_marca LEFT JOIN logistica.clasificador ON clasificador.class_id = req_det.class_id ORDER BY req_det.id_det_req; ALTER TABLE logistica.vw_det_req OWNER TO postgres;

Related Documents

Script Sial Gr.txt
June 2020 2
Pembawa Sial.
November 2019 19
Script
October 2019 23
Script
April 2020 14
Script
November 2019 18

More Documents from ""

Script Sial Gr.txt
June 2020 2
Ondas.docx
November 2019 0
Saludar.docx
October 2019 10
November 2019 21
Plan-de-calidad-cosapi.docx
October 2019 12