-- Customer specific once-script
--
-- Support: +31 53 4800700
--


SET ECHO ON
SET DEFINE ON
column fcltlogfile new_value fcltlogfile NOPRINT;
select UPPER(USER) || '_AAAH#35551.lst' as fcltlogfile from dual;
spool &fcltlogfile
SET DEFINE OFF

DROP TABLE aaah_imp_upd_absoluta;

CREATE TABLE aaah_imp_upd_absoluta
(
   bes_bestelopdr_id            VARCHAR2 (30),
   datum_tijd                   DATE,
   line_number                  NUMBER,
   bes_srtdeel_nummer           VARCHAR2 (32),
   bes_srtdeel_omschrijving     VARCHAR2 (100),
   bes_srtdeel_opmerking        VARCHAR2 (2000),
   bes_bestelling_item_aantal   NUMBER (5),
   bes_srtdeel_prijs_prijs      NUMBER (8, 2),
   bes_srtdeel_btw              NUMBER (3),
   bes_bestelling_leverdatum    DATE,
   supplier_ref                 VARCHAR2 (30),
   aflever_postcode             VARCHAR2 (15),
   aflever_adres                VARCHAR2 (50),
   catalogus                    VARCHAR2 (50),
   prs_kostenplaats_nr          VARCHAR2 (30)
);

INSERT INTO fac_import_app (fac_import_app_code,
                            fac_import_app_oms,
                            fac_import_app_xsl,
                            fac_functie_key,
                            fac_import_app_prefix,
                            fac_import_app_folder,
                            fac_import_app_action)
    VALUES ('UPD_ABSOLUTA',
            'AAAH: Updates uit Absoluta webshop',
            'import/absoluta_update.xsl',
            66,
            'AAAH',
            'd:\Apps\Facilitor\AAFM' || (SELECT DECODE(SUBSTR(UPPER(USER), 6, 4), 'TEST', '_A', '') FROM DUAL) || '\cust\AAAH\import',
            'ORACLE');


INSERT INTO fac_api (fac_api_name,
                     fac_api_omschrijving,
                     fac_api_filepath,
                     fac_api_loglevel,
                     fac_import_app_key,
                     fac_api_options_json
                     )
   SELECT 'ABSOLUTA',
          'Updates uit Absoluta webshop',
          'appl/api/api_gen_import.asp',
          1,
          fac_import_app_key,
          '{"import_app_key":' || fac_import_app_key || '}'
     FROM fac_import_app
    WHERE fac_import_app_code = 'UPD_ABSOLUTA';

INSERT INTO prs_perslid (prs_perslid_key,
                         prs_perslid_module,
                         prs_srtperslid_key,
                         prs_afdeling_key,
                         prs_perslid_naam,
                         prs_perslid_oslogin,
                         prs_perslid_apikey,
                         prs_perslid_flags,
                         prs_perslid_systeemadres)
   SELECT 62,
          'PRS',
          1,                                                       -- Onbekend
          prs_afdeling_key,
          'Absoluta API user',
          '_ABSOLUTA',
          'OYQhNpvlpBcWoqbaDKCWQtBKqXpXtyHh',
          4,
          NULL
     FROM prs_afdeling
    WHERE prs_afdeling_naam = 'Onbekend';

INSERT INTO fac_gebruikersgroep (prs_perslid_key, fac_groep_key)
    VALUES (62, 122);
    
COMMIT;


BEGIN adm.systrackscriptid('$Id$'); END;
/

COMMIT;
SPOOL OFF
