--operacion FCO3080 Cierre de período de autoliquidación Pensionados
delete from rel_oper_menus where ejecuta_operacion = 'FCO3080';
delete from rel_oper_modulos where operacion = 'FCO3080';
delete from operaciones where operacion = 'FCO3080';
delete from aut_operaciones where operacion = 'FCO3080';

insert into operaciones  values ('FCO3080', 'Cierre de período de autoliquidación Pensionados', 4, 1, NULL,NULL,NULL,NULL);
insert into rel_oper_menus select 'F1', 30, NVL(max(secuencia),0) + 1, 2, null, 'FCO3080' from rel_oper_menus where modulo='F1' and menu = 30;
insert into rel_oper_modulos values ('FCO3080','F1');
insert into aut_operaciones values ('ADAM','FCO3080',4);
COMMIT;

--operacion FCO3090 Reapertura de período de autoliquidación Pensionados
delete from rel_oper_menus where ejecuta_operacion = 'FCO3090';
delete from rel_oper_modulos where operacion = 'FCO3090';
delete from operaciones where operacion = 'FCO3090';
delete from aut_operaciones where operacion = 'FCO3090';

insert into operaciones  values ('FCO3090', 'Reapertura de período de autoliquidación Pensionados', 4, 1, NULL,NULL,NULL,NULL);
insert into rel_oper_menus select 'F1', 30, NVL(max(secuencia),0) + 1, 2, null, 'FCO3090' from rel_oper_menus where modulo='F1' and menu = 30;
insert into rel_oper_modulos values ('FCO3090','F1');
insert into aut_operaciones values ('ADAM','FCO3090',4);
COMMIT;

CREATE OR REPLACE VIEW vw_fco_periodos_pens
AS
SELECT DISTINCT compania, periodo = Rtrim(anio) || '-' || Right('00' + RTrim(mes), 2), sit_periodo FROM fco_pi_pens_rt1;
GO
CREATE PUBLIC SYNONYM vw_fco_periodos_pens FOR ADAM.vw_fco_periodos_pens;
GRANT SELECT ON vw_fco_periodos_pens TO ADAMA;
GO
