--
-- $Id$
--
-- Customer specific once-script
-- Dit script defninieert usrrap 'basis udr huurcontracten'
-- Om dit script te runnen moet:
-- 1) een cloon van udr rapport worden gemaakt.
-- 2) dan dit script daarop (= laatste) usrrap uitvoeren.

DEFINE thisfile = 'MDUX#37363-2.SQL'
DEFINE dbuser   = '^MDUX'
DEFINE custid   = 'MDUX'

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 ------

update fac_usrrap_cols
set fac_usrrap_cols_visible = 'H'
where fac_usrrap_key = (select max(fac_usrrap_key) from fac_usrrap);


update fac_usrrap_cols
set fac_usrrap_cols_visible = 'I',
		fac_usrrap_cols_caption = 'Contractnr.'
where fac_usrrap_key = (select max(fac_usrrap_key) from fac_usrrap)
and fac_usrrap_cols_column_name = 'cnt_contract_nummer_intern';

update fac_usrrap_cols
set fac_usrrap_cols_visible = 'I',
		fac_usrrap_cols_caption = 'Omschrijving'
where fac_usrrap_key = (select max(fac_usrrap_key) from fac_usrrap)
and fac_usrrap_cols_column_name = 'cnt_contract_omschrijving';

update fac_usrrap_cols
set fac_usrrap_cols_visible = 'I',
		fac_usrrap_cols_caption = 'Einde contract',
		fac_usrrap_cols_filter = 'A'	
where fac_usrrap_key = (select max(fac_usrrap_key) from fac_usrrap)
and fac_usrrap_cols_column_name = 'cnt_contract_looptijd_tot';

update fac_usrrap_cols
set fac_usrrap_cols_visible = 'I',
		fac_usrrap_cols_caption = 'Status',
		fac_usrrap_cols_filter = 'A'		
where fac_usrrap_key = (select max(fac_usrrap_key) from fac_usrrap)
and fac_usrrap_cols_column_name = 'contract_fase_actief';

update fac_usrrap_cols
set fac_usrrap_cols_visible = 'I',
		fac_usrrap_cols_caption = 'Contractbedrag',
		fac_usrrap_cols_datatype = 'currency'
where fac_usrrap_key = (select max(fac_usrrap_key) from fac_usrrap)
and fac_usrrap_cols_column_name = 'cnt_contract_termijnkosten';

update fac_usrrap_cols
set fac_usrrap_cols_visible = 'I',
		fac_usrrap_cols_caption = 'Maand contractbedrag',
		fac_usrrap_cols_datatype = 'currency'
where fac_usrrap_key = (select max(fac_usrrap_key) from fac_usrrap)
and fac_usrrap_cols_column_name = 'cnt_contract_termijnkosten_mnd';

update fac_usrrap_cols
set fac_usrrap_cols_visible = 'I',
		fac_usrrap_cols_caption = 'Contract termijn',
		fac_usrrap_cols_filter = 'A'	
where fac_usrrap_key = (select max(fac_usrrap_key) from fac_usrrap)
and fac_usrrap_cols_column_name = 'cnt_contract_termijn_omschr';


update fac_usrrap_cols
set fac_usrrap_cols_visible = 'I',
		fac_usrrap_cols_caption = 'Omschrijving'
where fac_usrrap_key = (select max(fac_usrrap_key) from fac_usrrap)
and fac_usrrap_cols_column_name = 'cnt_contract_omschrijving';

update fac_usrrap_cols
set fac_usrrap_cols_visible = 'I',
		fac_usrrap_cols_caption = 'Contractpartij',
		fac_usrrap_cols_filter = 'A'		
where fac_usrrap_key = (select max(fac_usrrap_key) from fac_usrrap)
and fac_usrrap_cols_column_name = 'prs_bedrijf_naam';

update fac_usrrap_cols
set fac_usrrap_cols_visible = 'I',
		fac_usrrap_cols_caption = 'Gebouw',
		fac_usrrap_cols_filter = 'A'
where fac_usrrap_key = (select max(fac_usrrap_key) from fac_usrrap)
and fac_usrrap_cols_column_name = 'alg_gebouw_omschrijving';

update fac_usrrap_cols
set fac_usrrap_cols_visible = 'I',
		fac_usrrap_cols_caption = 'Afdelingnr',
		fac_usrrap_cols_filter = 'A'
where fac_usrrap_key = (select max(fac_usrrap_key) from fac_usrrap)
and fac_usrrap_cols_column_name = 'prs_afdeling_naam';

update fac_usrrap_cols
set fac_usrrap_cols_visible = 'I',
		fac_usrrap_cols_caption = 'Afdelingsnaam',
		fac_usrrap_cols_filter = 'A'
where fac_usrrap_key = (select max(fac_usrrap_key) from fac_usrrap)
and fac_usrrap_cols_column_name = 'prs_afdeling_omschrijving';

update fac_usrrap_cols
set fac_usrrap_cols_visible = 'V',
		fac_usrrap_cols_caption = 'Kostenplaats',
		fac_usrrap_cols_filter = 'A'
where fac_usrrap_key = (select max(fac_usrrap_key) from fac_usrrap)
and fac_usrrap_cols_column_name = 'mdux_kostenplaats';

update fac_usrrap_cols
set fac_usrrap_cols_visible = 'V',
		fac_usrrap_cols_caption = 'Kostendrager',
		fac_usrrap_cols_filter = 'A'
where fac_usrrap_key = (select max(fac_usrrap_key) from fac_usrrap)
and fac_usrrap_cols_column_name = 'mdux_kostendrager';

update fac_usrrap_cols
set fac_usrrap_cols_visible = 'V',
		fac_usrrap_cols_caption = '!Maandkosten',
		fac_usrrap_cols_datatype = 'currency',
		fac_usrrap_cols_group = 'S'
where fac_usrrap_key = (select max(fac_usrrap_key) from fac_usrrap)
and fac_usrrap_cols_column_name = 'cnt_interne_doorbelasting_mnd';


------ 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
