DELETE fco_reportes Where descripcion = 'Certificado de Ingresos y Retenciones';
DELETE fco_reportes WHERE cod_rep = 10;
INSERT INTO fco_reportes (cod_rep, descripcion, proc_generacion, proc_borrado, operacion) VALUES(10, 'Certificado de Ingresos y Retenciones', 'sp_fco_rep_cir', 'sp_fco_del_rep_cir', 'FCO1080');
DELETE fco_reportes_cias WHERE cod_rep = 10;
INSERT INTO fco_reportes_cias (compania, cod_rep) SELECT compania, 10 FROM companias;
DELETE fco_reportes_par WHERE cod_rep = 10;
EXEC sp_fco_upd_reportes_par (10, 0, 1, 'Compañía', 1);
EXEC sp_fco_upd_reportes_par (10, 0, 2, 'Sucursal', 16);
EXEC sp_fco_upd_reportes_par (10, 0, 3, 'Año', 20);
EXEC sp_fco_upd_reportes_par (10, 0, 4, 'Fecha de Expedición', 12);
DELETE fdt_rutas WHERE operacion = 'FCO1080' AND codigo = 10 AND tipo = 1;
EXEC sp_fdt_upd_rutas('FCO1080', 10, 0, 1, 'CIR_2007.rpt', 'C:/Archivos de programa/ADAM Technologies/ADAMV3/Reportes', 'vw_fco_rep_cir');
DELETE fdt_parametros WHERE pais = 'COL' AND compania = '0' AND parametro = 'report_10';
DELETE fco_reportes_aut WHERE cod_rep = 10;
INSERT INTO fco_reportes_aut (cod_rep, compania, usuariow) 
select distinct 10, compania, m.username 
FROM companias c, sys.all_users m , dba_role_privs n
WHERE m.UserName = n.grantee AND
granted_role in ('ADAMA', 'ADAMS', 'ADAME');
commit;

