--
-- $Id$
--
-- <<Korte omschrijving wat het script doet>>

DEFINE thisfile = 'TWYN#55541.SQL'
DEFINE dbuser   = '^TWYN'

SET ECHO ON
SET DEFINE ON
COLUMN fcltlogfile NEW_VALUE fcltlogfile NOPRINT;
WHENEVER SQLERROR EXIT;
SELECT adm.scriptspoolfile('&dbuser', '&thisfile') AS fcltlogfile FROM DUAL;
WHENEVER SQLERROR CONTINUE;
SPOOL &fcltlogfile
SET DEFINE OFF

------ payload begin ------

DELETE FROM fac_usrdata
 WHERE fac_usrtab_key IN (SELECT fac_usrtab_key
                            FROM fac_usrtab
                           WHERE fac_usrtab_naam = 'project_import'
                         );

DELETE FROM fac_usrtab WHERE fac_usrtab_naam = 'project_import';

DELETE FROM fac_import
 WHERE fac_import_app_key IN (SELECT fac_import_app_key
                                FROM fac_import_app
                               WHERE fac_import_app_prefix = 'TWYN'
                             );

DELETE FROM fac_import_app WHERE fac_import_app_prefix = 'TWYN';

DROP PROCEDURE twyn_import_reportdbf;
DROP PROCEDURE twyn_update_reportdbf;

DROP PROCEDURE twyn_import_projectcsv;
DROP PROCEDURE twyn_update_projectcsv;

DROP VIEW twyn_v_bgt_mutatie;
DROP VIEW twyn_v_budgetdetail;
DROP VIEW twyn_v_budgetrubriek;
DROP VIEW twyn_v_budgettotaal;
DROP VIEW twyn_v_reserve;

DROP VIEW twyn_v_bgt_budget;
DROP VIEW twyn_v_bgt_budgetsrtmutatie;
DROP VIEW twyn_v_bgt_factuur;
DROP VIEW twyn_v_bgt_opdracht;
DROP VIEW twyn_v_bgt_rubriekmutatie;

DROP TABLE twyn_imp_discipline;
DROP TABLE twyn_imp_project;
DROP TABLE twyn_imp_kostenrubriek;
DROP TABLE twyn_imp_kostensoortgrp;
DROP TABLE twyn_imp_kostensoort;
DROP TABLE twyn_imp_budget;
DROP TABLE twyn_imp_contract;
DROP TABLE twyn_imp_factuur;






------ payload end   ------

SET DEFINE OFF
BEGIN adm.systrackscriptId ('$Id$', 1); END;
/

COMMIT;
SET ECHO OFF
SPOOL OFF
SET DEFINE ON
PROMPT Logfile of this upgrade is: &fcltlogfile
