-- Scipt para cuando no se usa facturacion, permite crear la tarifa bases en 0 y cargar codigos CUPS.
-- LIMPIA TABLAS
delete from rate;
SELECT setval('rate_id_seq	', 1, FALSE); 
DELETE FROM base_price;
SELECT setval('base_price_id_seq', 1, FALSE); 
--  INSERTA TARIFA BASE
INSERT INTO "base_price" ( "current", "description", "id",  "name") 
VALUES ( now()::timestamp(0) , 'Tarifa Base sin Facturación', nextval('base_price_id_seq') ,  'DEFAULT' ); 
SELECT * from base_price;

-- INSERTA VALORES EN CERO PARA LA TARIFA BASE
insert into rate 
SELECT (SELECT  id from base_price LIMIT 1)  , id_study_list, cod_study , 0 as value from study_list;

SELECT * from rate;

