-- Script containing customer specific configuration sql statements for aapm: Arcadis Aqumen Facility Management
-- (c) 2005-2007 Dijkoraad IT bv
-- $Revision$
-- $Id$
--
-- Support: +31 53 4800700

@aaxx.sql;

SPOOL xaapm.lst
SET ECHO ON

-- script om dagelijks terugkerende scripts aan te roepen.
CREATE OR REPLACE PROCEDURE aapm_select_daily_task (p_applname   IN   VARCHAR2, p_applrun    IN   VARCHAR2)
AS
BEGIN
   aaxx_daily_task (p_applname, p_applrun);
END;
/

-- budgettracker overrules
CREATE OR REPLACE VIEW aapm_v_export_budget_tracker   (RESULT, result_order) AS SELECT RESULT, result_order FROM aaxx_v_export_budget_tracker;

-- export overrules
-- exact
CREATE OR REPLACE VIEW aapm_v_export_exact            (RESULT, result_order) AS SELECT RESULT, result_order FROM aaxx_v_export_exact_xml;
CREATE OR REPLACE PROCEDURE aapm_select_exact (
   p_applname   IN   VARCHAR2,
   p_applrun    IN   VARCHAR2
)
AS
BEGIN
  aaxx_select_exact_xml(p_applname, p_applrun);
END;
/

CREATE OR REPLACE PROCEDURE aapm_export_exact (
   p_applname   IN   VARCHAR2,
   p_applrun    IN   VARCHAR2,
   p_filedir    IN   VARCHAR2,
   p_filename   IN   VARCHAR2
)
AS
BEGIN
  aaxx_export_exact(p_applname, p_applrun, p_filedir, p_filename);
END;
/

CREATE OR REPLACE VIEW aapm_v_export_verwerk_exact    (RESULT, result_order) AS SELECT RESULT, result_order FROM aaxx_v_export_verwerk_exact;
CREATE OR REPLACE PROCEDURE aapm_export_verwerk_exact (
   p_applname   IN   VARCHAR2,
   p_applrun    IN   VARCHAR2,
   p_filedir    IN   VARCHAR2,
   p_filename   IN   VARCHAR2
)
AS
BEGIN
  aaxx_export_verwerk_exact(p_applname, p_applrun, p_filedir, p_filename);
END;
/

-- bundel catering
CREATE OR REPLACE VIEW aapm_v_export_bundel_catering    (RESULT, result_order) AS SELECT RESULT, result_order FROM aaxx_v_export_bundel_catering;
CREATE OR REPLACE PROCEDURE aapm_export_bundel_catering (
   p_applname   IN   VARCHAR2,
   p_applrun    IN   VARCHAR2,
   p_filedir    IN   VARCHAR2,
   p_filename   IN   VARCHAR2
)
AS
BEGIN
   aaxx_export_bundel_catering(p_applname, p_applrun, p_filedir, p_filename);
END;
/

-- exact verkoop
CREATE OR REPLACE VIEW aapm_v_export_exact_verkoop    (RESULT, result_order) AS SELECT RESULT, result_order FROM aaxx_v_export_exact_verkoop;
CREATE OR REPLACE PROCEDURE aapm_select_exact_verkoop (
   p_applname   IN   VARCHAR2,
   p_applrun    IN   VARCHAR2
)
AS
BEGIN
  aaxx_select_exact_verkoop(p_applname, p_applrun, to_char(sysdate, 'yyyy'));
END;
/
CREATE OR REPLACE PROCEDURE aapm_export_exact_verkoop (
   p_applname   IN   VARCHAR2,
   p_applrun    IN   VARCHAR2,
   p_filedir    IN   VARCHAR2,
   p_filename   IN   VARCHAR2
)
AS
BEGIN
  aaxx_export_exact_verkoop(p_applname, p_applrun, p_filedir, p_filename, to_char(sysdate, 'yyyy'));
END;
/

-- exact verkoop over het vorige jaar
CREATE OR REPLACE VIEW aapm_v_export_exact_verkoop_vj    (RESULT, result_order) AS SELECT RESULT, result_order FROM aaxx_v_export_exact_verkoop;
CREATE OR REPLACE PROCEDURE aapm_select_exact_verkoop_vj (
   p_applname   IN   VARCHAR2,
   p_applrun    IN   VARCHAR2
)
AS
BEGIN
  aaxx_select_exact_verkoop(p_applname, p_applrun, to_char(to_number(to_char(sysdate, 'yyyy'))-1));
END;
/
CREATE OR REPLACE PROCEDURE aapm_export_exact_verkoop_vj (
   p_applname   IN   VARCHAR2,
   p_applrun    IN   VARCHAR2,
   p_filedir    IN   VARCHAR2,
   p_filename   IN   VARCHAR2
)
AS
BEGIN
  aaxx_export_exact_verkoop(p_applname, p_applrun, p_filedir, p_filename, to_char(to_number(to_char(sysdate, 'yyyy'))-1));
END;
/

-- exact projecturen (XML)
CREATE OR REPLACE VIEW aapm_v_export_exact_uren (result, result_order)
AS SELECT result, result_order FROM aaxx_v_export_exact_uren_xml;
CREATE OR REPLACE PROCEDURE aapm_select_exact_uren (
   p_applname   IN   VARCHAR2,
   p_applrun    IN   VARCHAR2
)
AS
BEGIN
  aaxx_select_exact_uren_xml(p_applname, p_applrun, '');
END;
/

-- verwerk exact projecturen (XML)
CREATE OR REPLACE PROCEDURE aapm_export_verwerk_exact_uren (
   p_applname   IN   VARCHAR2,
   p_applrun    IN   VARCHAR2,
   p_filedir    IN   VARCHAR2,
   p_filename   IN   VARCHAR2
)
AS
BEGIN
  aaxx_export_verwerk_exact_uren(p_applname, p_applrun, p_filedir, p_filename, '');
END;
/


--------------------------------
-- import contractorders
--------------------------------
CREATE OR REPLACE PROCEDURE aapm_import_contract (
   p_import_key IN NUMBER
) IS
BEGIN
    aaxx_import_contract (p_import_key);
END aapm_import_contract;
/

CREATE OR REPLACE PROCEDURE aapm_update_contract (p_import_key IN NUMBER)
AS
BEGIN
    aaxx_update_contract (p_import_key);
END aapm_update_contract;
/

CREATE OR REPLACE PROCEDURE aapm_import_ruimte (p_import_key IN NUMBER)
AS
BEGIN
  aaxx_import_ruimte(p_import_key);
END;
/

CREATE OR REPLACE PROCEDURE aapm_update_ruimte (p_import_key IN NUMBER)
AS
BEGIN
  aaxx_update_ruimte(p_import_key);
END;
/


-- import overrulles



BEGIN adm.systrackscriptId('$Id$', 0); END;
/


BEGIN fac.registercustversion('AAPM', 1); END;
/

COMMIT;

SPOOL OFF


