CREATE OR REPLACE PACKAGE PACK_UTILITIES is

  ABS_MAX_DATE date := to_date('31/12/2099', 'dd/MM/yyyy');
  type refcursor is ref cursor;

  procedure CreateSettingGroup(FPgroupName     settinggroup.groupname%type,
                               FPABSAccessOnly settinggroup.absaccessonly%type,
                               FPpassword      settinggroup.password%type);
  procedure CreateSystemSetting(FPgroupName      systemsetting.groupname%type,
                                FPname           systemsetting.name%type,
                                FPvalue          systemsetting.value%type,
                                FPtypeOfValue    systemsetting.typeofvalue%type,
                                FPfactoryDefault systemsetting.factorydefault%type,
                                FPdefaultAllowed systemsetting.defaultallowed%type,
                                FPusedAsDefault  systemsetting.usedasdefault%type,
                                FPminValue       systemsetting.minvalue%type,
                                FPmaxValue       systemsetting.maxvalue%type,
                                FPallowedChars   systemsetting.allowedchars%type,
                                FPdescription    long,
                                FPisObsolete     varchar2);

  procedure CreateSerialDevice(FPbrandType           serialdevice.brandtype%type,
                               FPname                serialdevice.name%type,
                               FPdeviceType          serialdevice.devicetype%type,
                               FPbaudRate            serialdevice.baudrate%type,
                               FPparity              serialdevice.parity%type,
                               FPdataBits            serialdevice.databits%type,
                               FPstopBits            serialdevice.stopbits%type,
                               FPinitString          serialdevice.initstring%type,
                               FPinitChar1           serialdevice.initchar1%type,
                               FPinitChar2           serialdevice.initchar2%type,
                               FPinitChar3           serialdevice.initchar3%type,
                               FPverifyString        serialdevice.verifystring%type,
                               FPverifyPosition      serialdevice.verifyposition%type,
                               FPweightPosition      serialdevice.weightposition%type,
                               FPweightStringSize    serialdevice.weightstringsize%type,
                               FPweightDecimals      serialdevice.weightdecimals%type,
                               FPendCharacter1       serialdevice.endcharacter1%type,
                               FPendCharacter2       serialdevice.endcharacter2%type,
                               FPalibiPrinter        serialdevice.alibiprinter%type,
                               FPalibiInitString     serialdevice.alibiinitstring%type,
                               FPalibiEndString      serialdevice.alibiendstring%type,
                               FPalibiVerifyString   serialdevice.alibiverifystring%type,
                               FPaccuracyLevelWeight serialdevice.accuracylevelweight%type,
                               FPtareInitString      serialdevice.tareinitstring%type,
                               FPtareVerifyString    serialdevice.tareverifystring%type,
                               FPweightseqnrposition serialdevice.weightseqnrposition%type,
                               FPweightseqnrlength   serialdevice.weightseqnrlength%type);

  function GetNumberValue(FPnCODE WORKSTATION.CODE%type) return number;
  PRAGMA RESTRICT_REFERENCES(GetNumberValue, WNDS, WNPS);

  function StringAsNumber(FPsString varchar2) return number;
  PRAGMA RESTRICT_REFERENCES(StringAsNumber, WNDS, WNPS);

  function GetISOYear(FPdtDate date) return number;
  PRAGMA RESTRICT_REFERENCES(GetISOYear, WNDS, WNPS);

  function GetISOWeek(FPdtDate date) return number;
  PRAGMA RESTRICT_REFERENCES(GetISOWeek, WNDS, WNPS);

  procedure getISOYearWeekDay(FPdtDate in date,
                              FPnYear  out number,
                              FPnWeek  out number,
                              FPnDay   out number);

  procedure ImportLicenseForEmptyDatabase(FPsCustomerCode databasesettings.code%type,
                                          FPsLanguageCode databasesettings.lancode%type);
  procedure ImportLanguageForEmptyDatabase;
  procedure ImportPlantForEmptyDatabase(FPnPLANT_ID      in out PLANT.PLANT_ID%type,
                                        FPsCode          in plant.code%type,
                                        FPsName          in plant.name%type,
                                        FPnSYSTEMUSER_ID in plant.systemuser_id%type);

  procedure ImportFixedInfo(FPsLastScriptOfCurrentVersion varchar2);

  procedure createNoteSequence(FPsSequenceName           in varchar2,
                               FPsExtraCode              in varchar2,
                               FPsTableName              in varchar2,
                               FPsNoteColumnName         in varchar2,
                               FPsBusinessUnitCode       in businessunit.code%type,
                               FPnMinValue               in integer,
                               FPnMaxValue               in integer,
                               FPsBusinessUnitColumnName in varchar2,
                               FPsFilter                 in varchar2);
  procedure createIdCodeSequence(FPsSequenceName           in varchar2,
                                 FPsExtraCode              in varchar2,
                                 FPsTableName              in varchar2,
                                 FPsNoteColumnName         in varchar2,
                                 FPsBusinessUnitCode       in businessunit.code%type,
                                 FPsMinValue               in varchar2,
                                 FPsMaxValue               in varchar2,
                                 FPsBusinessUnitColumnName in varchar2,
                                 FPsFilter                 in varchar2);

  function GetDayNumber(FPdtDate date) return int;
  procedure CreateDialogDescription(DialogID      in dialogs.dialog_id%type,
                                    Endescription in dialogs.endescription%type,
                                    Nldescription in dialogs.nldescription%type,
                                    Frdescription in dialogs.frdescription%type,
                                    Dedescription in dialogs.gedescription%type,
                                    Dkdescription in dialogs.dkdescription%type,
                                    Esdescription in dialogs.spdescription%type);
  PRAGMA RESTRICT_REFERENCES(GetDayNumber, WNDS, WNPS);

  procedure InsertReasonCodeDialogs(p_reasoncode_id      in reasoncode.reasoncode_id%type,
                                   rc_garmentreason     in reasoncode.garmentreason%type,
                                   rc_linenreason       in reasoncode.linenreason%type,
                                   rc_orpackreason      in reasoncode.orpackreason%type,
                                   rc_residentialreason in reasoncode.residentialreason%type,
                                   systemUserID         in systemuser.systemuser_id%type);

  procedure InsertRagReasonCodeDialogs(p_ragreason_id in ragreason.ragreason_id%type,
                                       systemUserID   in systemuser.systemuser_id%type);


end PACK_UTILITIES;
/
CREATE OR REPLACE PACKAGE BODY PACK_UTILITIES is

  type t_arrayvarchar is table of varchar2(255) index by binary_integer;

  procedure CreateSettingGroup(FPgroupName     settinggroup.groupname%type,
                               FPABSAccessOnly settinggroup.absaccessonly%type,
                               FPpassword      settinggroup.password%type) is
  begin
    begin
      insert into settinggroup
        (groupname, absaccessonly, password)
      values
        (FPgroupName, FPABSAccessOnly, FPpassword);
      commit;
    exception
      when dup_val_on_index then
        null;
    end;
  end;

  procedure CreateSystemSetting(FPgroupName      systemsetting.groupname%type,
                                FPname           systemsetting.name%type,
                                FPvalue          systemsetting.value%type,
                                FPtypeOfValue    systemsetting.typeofvalue%type,
                                FPfactoryDefault systemsetting.factorydefault%type,
                                FPdefaultAllowed systemsetting.defaultallowed%type,
                                FPusedAsDefault  systemsetting.usedasdefault%type,
                                FPminValue       systemsetting.minvalue%type,
                                FPmaxValue       systemsetting.maxvalue%type,
                                FPallowedChars   systemsetting.allowedchars%type,
                                FPdescription    long,
                                FPisObsolete     varchar2) is
    systemuserid   int := 0;
    activevalue    varchar2(1);
    oldtypeofvalue systemsetting.typeofvalue%type;
    oldvalue       systemsetting.value%type;
  begin

    execute immediate 'alter session set nls_territory = america';
    if fpisobsolete = 'y' then
      activevalue := 'n';
    else
      activevalue := 'y';
    end if;

    for vcursor in (select plant_id from plant) loop
      begin
        insert into systemsetting
          (plant_id,
           groupname,
           name,
           value,
           typeofvalue,
           factorydefault,
           defaultallowed,
           usedasdefault,
           minvalue,
           maxvalue,
           allowedchars,
           description,
           systemuser_id,
           timestamp,
           active)
        values
          (vcursor.plant_id,
           fpgroupname,
           fpname,
           fpvalue,
           fptypeofvalue,
           fpfactorydefault,
           fpdefaultallowed,
           fpusedasdefault,
           fpminvalue,
           fpmaxvalue,
           fpallowedchars,
           fpdescription,
           systemuserid,
           sysdate,
           activevalue);
      exception
        when dup_val_on_index then

          select typeofvalue, value
            into oldtypeofvalue, oldvalue
            from systemsetting
           where plant_id = vcursor.plant_id
             and name = fpname;

          update systemsetting
             set groupname      = fpgroupname,
                 typeofvalue    = fptypeofvalue,
                 factorydefault = fpfactorydefault,
                 defaultallowed = fpdefaultallowed,
                 minvalue       = fpminvalue,
                 maxvalue       = fpmaxvalue,
                 allowedchars   = fpallowedchars,
                 description    = fpdescription,
                 timestamp      = sysdate,
                 systemuser_id  = systemuserid,
                 active         = activevalue
           where plant_id = vcursor.plant_id
             and name = fpname
             and (groupname != fpgroupname or typeofvalue != fptypeofvalue or
                 factorydefault != fpfactorydefault or
                 defaultallowed != fpdefaultallowed or
                 minvalue != fpminvalue or maxvalue != fpmaxvalue or
                 allowedchars != fpallowedchars or
                 description != fpdescription or active != activevalue);

          -- update the value if the type of value was changed
          if (((oldtypeofvalue != fptypeofvalue) and
             ((fpname = 'defaultcustomermin') or
             (fpname = 'defaultcustomermax')) and
             (oldvalue > fpmaxvalue or oldvalue < fpminvalue)) or
             ((oldtypeofvalue != fptypeofvalue) and
             (fpname != 'defaultcustomermin') and
             (fpname != 'defaultcustomermax'))) then
            update systemsetting
               set value = fpvalue
             where plant_id = vcursor.plant_id
               and name = fpname;
          end if;

      end;
    end loop;
    commit;
    dbms_output.put_line('restart server before ' || fpname ||
                         ' setting takes effect.');
  end;

  procedure CreateSerialDevice(FPbrandType           serialdevice.brandtype%type,
                               FPname                serialdevice.name%type,
                               FPdeviceType          serialdevice.devicetype%type,
                               FPbaudRate            serialdevice.baudrate%type,
                               FPparity              serialdevice.parity%type,
                               FPdataBits            serialdevice.databits%type,
                               FPstopBits            serialdevice.stopbits%type,
                               FPinitString          serialdevice.initstring%type,
                               FPinitChar1           serialdevice.initchar1%type,
                               FPinitChar2           serialdevice.initchar2%type,
                               FPinitChar3           serialdevice.initchar3%type,
                               FPverifyString        serialdevice.verifystring%type,
                               FPverifyPosition      serialdevice.verifyposition%type,
                               FPweightPosition      serialdevice.weightposition%type,
                               FPweightStringSize    serialdevice.weightstringsize%type,
                               FPweightDecimals      serialdevice.weightdecimals%type,
                               FPendCharacter1       serialdevice.endcharacter1%type,
                               FPendCharacter2       serialdevice.endcharacter2%type,
                               FPalibiPrinter        serialdevice.alibiprinter%type,
                               FPalibiInitString     serialdevice.alibiinitstring%type,
                               FPalibiEndString      serialdevice.alibiendstring%type,
                               FPalibiVerifyString   serialdevice.alibiverifystring%type,
                               FPaccuracyLevelWeight serialdevice.accuracylevelweight%type,
                               FPtareInitString      serialdevice.tareinitstring%type,
                               FPtareVerifyString    serialdevice.tareverifystring%type,
                               FPweightseqnrposition serialdevice.weightseqnrposition%type,
                               FPweightseqnrlength   serialdevice.weightseqnrlength%type) is
    serialDeviceID serialdevice.serialdevice_id%type;
  begin
    begin
      select serialdevice_id
        into serialDeviceID
        from serialdevice
       where brandtype = FPbrandType;
      update serialdevice
         set name                = FPname,
             deviceType          = FPdeviceType,
             baudRate            = FPbaudRate,
             parity              = FPparity,
             dataBits            = FPdataBits,
             stopBits            = FPstopBits,
             initString          = FPinitString,
             initChar1           = FPinitChar1,
             initChar2           = FPinitChar2,
             initChar3           = FPinitChar3,
             verifyString        = FPverifyString,
             verifyPosition      = FPverifyPosition,
             weightPosition      = FPweightPosition,
             weightStringSize    = FPweightStringSize,
             weightDecimals      = FPweightDecimals,
             endCharacter1       = FPendCharacter1,
             endCharacter2       = FPendCharacter2,
             alibiPrinter        = FPalibiPrinter,
             alibiInitString     = FPalibiInitString,
             alibiEndString      = FPalibiEndString,
             alibiVerifyString   = FPalibiVerifyString,
             accuracyLevelWeight = FPaccuracyLevelWeight,
             tareInitString      = FPtareInitString,
             tareVerifyString    = FPtareVerifyString,
             weightseqnrposition = FPweightseqnrposition,
             weightseqnrlength   = FPweightseqnrlength
       where serialdevice_id = serialDeviceID
         and not exists
       (select serialdevice_id
                from comportconfiguration
               where serialdevice_id = serialDeviceID);
    exception
      when no_data_found then
        insert into serialdevice
          (serialdevice_id,
           brandtype,
           name,
           devicetype,
           baudrate,
           parity,
           databits,
           stopbits,
           initstring,
           initchar1,
           initchar2,
           initchar3,
           verifystring,
           verifyposition,
           weightposition,
           weightstringsize,
           weightdecimals,
           endcharacter1,
           endcharacter2,
           alibiprinter,
           alibiinitstring,
           alibiendstring,
           alibiverifystring,
           accuracylevelweight,
           tareinitstring,
           tareverifystring,
           weightseqnrposition,
           weightseqnrlength)
        values
          (seq_serialdevice.nextval,
           FPbrandType,
           FPname,
           FPdeviceType,
           FPbaudRate,
           FPparity,
           FPdataBits,
           FPstopBits,
           FPinitString,
           FPinitChar1,
           FPinitChar2,
           FPinitChar3,
           FPverifyString,
           FPverifyPosition,
           FPweightPosition,
           FPweightStringSize,
           FPweightDecimals,
           FPendCharacter1,
           FPendCharacter2,
           FPalibiPrinter,
           FPalibiInitString,
           FPalibiEndString,
           FPalibiVerifyString,
           FPaccuracyLevelWeight,
           FPtareInitString,
           FPtareVerifyString,
           FPweightseqnrposition,
           FPweightseqnrlength);
    end;
    commit;
  end;

  -- todo delete it later. FGA 18.08.2004
  function GetNumberValue(FPnCODE WORKSTATION.CODE%type) return number is
  begin
    return(to_number(FPnCODE));
  EXCEPTION
    WHEN OTHERS THEN
      return 0;
  end;

  function StringAsNumber(FPsString varchar2) return number is
    lengthNumericPart integer := 0;
    oneChar           varchar2(1);
  begin
    for i in 1 .. length(FPsString) loop
      oneChar := substr(FPsString, i, 1);
      if ascii(oneChar) >= 48 and ascii(oneChar) <= 57 then
        lengthNumericPart := lengthNumericPart + 1;
      else
        exit;
      end if;
    end loop;
    return substr(FPsString, 1, lengthNumericPart);
  end;

  function GetISOYear(FPdtDate date) return number is
  begin
    return to_char(FPdtDate, 'IYYY');
  end;

  function GetISOWeek(FPdtDate date) return number is
  begin
    return GetISOWeek(FPdtDate);
  end;

  procedure getISOYearWeekDay(FPdtDate in date,
                              FPnYear  out number,
                              FPnWeek  out number,
                              FPnDay   out number) is
  begin
    FPnYear := to_char(FPdtDate, 'IYYY');
    FPnWeek := GetISOWeek(FPdtDate);
    FPnDay  := to_char(FPdtDate, 'D');
  end;

  procedure ImportLicenseForEmptyDatabase(FPsCustomerCode databasesettings.code%type,
                                          FPsLanguageCode databasesettings.lancode%type) is
    languageCode databasesettings.lancode%type;
  begin
    select lancode into languageCode from databasesettings;
  exception
    when no_data_found then
      insert into databasesettings
        (code, lancode, menubaselanguage, referenceyear, referenceweek)
      values
        (FPsCustomerCode, FPsLanguageCode, FPsLanguageCode, 2001, 1);
  end;

  procedure ImportLanguageForEmptyDatabase is
    systemUserID       int := 0;
    languageCode       languages.code%type;
    legacyLanguageCode languages.legacylanguagecode%type;
    description        languages.description%type;
  begin
    select lancode into languageCode from databasesettings;
    if (languageCode = 'NL') then
      languageCode       := 'NL_NL';
      legacyLanguageCode := '1';
      description        := 'Nederlands (Nederland)';
    end if;
    if (languageCode = 'EN') then
      languageCode       := 'EN_US';
      legacyLanguageCode := '2';
      description        := 'English (United States)';
    end if;
    if (languageCode = 'DE') then
      languageCode       := 'DE_DE';
      legacyLanguageCode := '3';
      description        := 'Deutsch (Deutschland)';
    end if;
    if (languageCode = 'DA') then
      languageCode       := 'DA_DK';
      legacyLanguageCode := '4';
      description        := 'Dansk (Danmark)';
    end if;
    if (languageCode = 'ES') then
      languageCode       := 'ES_ES';
      legacyLanguageCode := '5';
      description        := 'Español (España)';
    end if;
    if (languageCode = 'FR') then
      languageCode       := 'FR_FR';
      legacyLanguageCode := '6';
      description        := 'Français (France)';
    end if;
    if (languageCode = 'JA') then
      languageCode       := 'JA_JA';
      legacyLanguageCode := '7';
      description        := 'Japanese (Japan)';
    end if;

    insert into languages
      (LANGUAGE_ID,
       CODE,
       DESCRIPTION,
       LEGACYLANGUAGECODE,
       TRANSLATEDESCRIPTION,
       SYSTEMUSER_ID,
       TIMESTAMP,
       USEFORSYSTEMUSER)
    values
      (seq_languages.nextval,
       languageCode,
       description,
       legacyLanguageCode,
       'Y',
       systemUserID,
       sysdate,
       'Y');
  exception
    when dup_val_on_index then
      null;
  end;

  procedure ImportPlantForEmptyDatabase(FPnPLANT_ID      in out plant.plant_id%type,
                                        FPsCode          in plant.code%type,
                                        FPsName          in plant.name%type,
                                        FPnSYSTEMUSER_ID in plant.systemuser_id%type) is
    languageID        languages.language_id%type;
    businessunitID    businessunit.businessunit_id%type;
    addressMinusID    address.address_id%type;
    currencyDefaultID currency.currency_id%type;
    countryDefaultID  country.country_id%type;
    plantdepartmentID plantdepartment.plantdepartment_id%type;
    regionID          region.region_id%type;
    divisionID        division.division_id%type;
    serviceteamID     serviceteam.serviceteam_id%type;
  begin

    select min(language_id) into languageID from languages;

    -- address '-'
    begin
      select address_id
        into addressMinusID
        from address
       where street = FPsCode
         and zipcode = '-'
         and city = '-';
    exception
      when too_many_rows then
        null;
      when no_data_found then
        insert into address
          (address_id,
           street,
           zipcode,
           city,
           state,
           county,
           systemuser_id,
           timestamp)
        values
          (seq_address.nextval,
           FPsCode,
           '-',
           '-',
           '-',
           '-',
           FPnSYSTEMUSER_ID,
           sysdate)
        returning address_id into addressMinusID;
    end;
    -- currency '-'
    begin
      select currency_id
        into currencyDefaultID
        from currency
       where rownum = 1;
    exception
      when no_data_found then
        insert into currency
          (currency_id,
           code,
           description,
           exchangerate,
           decimals,
           invoiceamountdecimals,
           systemuser_id,
           timestamp)
        values
          (seq_currency.nextval,
           '-',
           '-',
           1,
           2,
           2,
           FPnSYSTEMUSER_ID,
           sysdate)
        returning currency_id into currencyDefaultID;
    end;
    -- country '-'
    begin
      select country_id
        into countryDefaultID
        from country
       where rownum = 1;
    exception
      when no_data_found then
        insert into country
          (country_id,
           code,
           description,
           defaultcurrency_id,
           definetax,
           systemuser_id,
           timestamp)
        values
          (seq_country.nextval,
           '-',
           '-',
           currencyDefaultID,
           'Y',
           FPnSYSTEMUSER_ID,
           sysdate)
        returning country_id into countryDefaultID;
    end;
    -- region '-'
    begin
      select region_id into regionID from region where code = '-';
    exception
      when no_data_found then
        null;
        insert into region
          (region_id, code, systemuser_id, timestamp)
        values
          (seq_region.nextval, '-', FPnSYSTEMUSER_ID, sysdate)
        returning region_id into regionID;
        insert into region_desc
          (region_id, language_id, description, systemuser_id, timestamp)
        values
          (seq_region.currval, languageID, '-', FPnSYSTEMUSER_ID, sysdate);
    end;
    -- division '-'
    begin
      select division_id into divisionID from division where code = '-';
    exception
      when no_data_found then
        null;
        insert into division
          (division_id, code, systemuser_id, timestamp)
        values
          (seq_division.nextval, '-', FPnSYSTEMUSER_ID, sysdate)
        returning division_id into divisionID;
        insert into division_desc
          (division_id, language_id, description, systemuser_id, timestamp)
        values
          (seq_division.currval,
           languageID,
           '-',
           FPnSYSTEMUSER_ID,
           sysdate);
    end;
    -- plant FPsCode
    begin
      select plant_id into FPnPLANT_ID from plant where code = FPsCode;
    exception
      when no_data_found then
        null;
        select seq_plant.nextval into FPnPLANT_ID from dual;
        insert into plant
          (plant_id,
           code,
           name,
           active,
           financechargepercentage,
           language_id,
           address_id,
           country_id,
           headoffice_id,
           systemuser_id,
           timestamp)
        values
          (FPnPLANT_ID,
           FPsCode,
           FPsName,
           'Y',
           0,
           languageID,
           addressMinusID,
           countryDefaultID,
           FPnPLANT_ID,
           FPnSYSTEMUSER_ID,
           sysdate)
        returning plant_id into FPnPLANT_ID;
    end;
    -- plantdepartment '-'
    begin
      select plantdepartment_id
        into plantdepartmentID
        from plantdepartment
       where code = '-'
         and plant_id = FPnPLANT_ID;
    exception
      when no_data_found then
        insert into plantdepartment
          (plantdepartment_id,
           plant_id,
           code,
           description,
           systemuser_id,
           timestamp,
           defaultplantdepartment)
        values
          (seq_plantdepartment.nextval,
           FPnPLANT_ID,
           '-',
           '-',
           FPnSYSTEMUSER_ID,
           sysdate,
           'Y')
        returning plantdepartment_id into plantdepartmentID;
    end;
    -- serviceteam '-'
    begin
      select serviceteam_id
        into serviceteamID
        from serviceteam
       where code = '-'
         and plant_id = FPnPLANT_ID;
    exception
      when no_data_found then
        null;
        insert into serviceteam
          (serviceteam_id,
           plant_id,
           code,
           description,
           systemuser_id,
           timestamp)
        values
          (seq_serviceteam.nextval,
           FPnPLANT_ID,
           '-',
           '-',
           FPnSYSTEMUSER_ID,
           sysdate)
        returning serviceteam_id into serviceteamID;
    end;
    -- businessunit FPsCode
    begin
      select businessunit_id
        into businessunitID
        from businessunit
       where code = FPsCode;
    exception
      when no_data_found then
        insert into businessunit
          (businessunit_id,
           code,
           description,
           plant_id,
           region_id,
           division_id,
           systemuser_id,
           timestamp)
        values
          (seq_businessunit.nextval,
           FPsCode,
           'Default business unit',
           FPnPLANT_ID,
           regionID,
           divisionID,
           FPnSYSTEMUSER_ID,
           sysdate)
        returning businessunit_id into businessunitID;
    end;
  end;

  procedure ImportFixedInfo(FPsLastScriptOfCurrentVersion varchar2) is
    systemUserID systemuser.systemuser_id%type;
    absUserID    systemuser.systemuser_id%type;
    languageID   languages.language_id%type;
    userGroupID  usergroup.usergroup_id%type;
    absGroupID   usergroup.usergroup_id%type;
    id           integer;
    type t_arrayvarchar is table of varchar2(255) index by binary_integer;
    aDesc        t_arrayvarchar;
    aTax         t_arrayvarchar;
    aTurnover    t_arrayvarchar;
    aCharge      t_arrayvarchar;
    dayID        day.day_id%type;
    dayCode      t_arrayvarchar;
    dayDesc      t_arrayvarchar;
    lastScriptNo int;
    prefixScript varchar2(50);
  begin

    select min(language_id) into languageID from languages;

    -- user group SYSADM
    begin
      select usergroup_id
        into userGroupID
        from usergroup
       where groupname = 'SYSADM';
    exception
      when no_data_found then
        insert into usergroup
          (USERGROUP_ID,
           GROUPNAME,
           DESCRIPTION,
           ACTIVE,
           REMARK,
           SYSTEMUSER_ID,
           TIMESTAMP,
           contactmanageractive,
           singletask,
           enableleasebuyback,
           ALLOWCHNGCUSTPAYMENTTERM,
           DASHBOARD,
           AUTHRIGHTSCONTRACT,
           AUTHRIGHTSPRICELIST,
           PASSWORDREQUIRED,
           MULTIPLELOGINALLOWED,
           PASSWORDCHANGEALLOWED,
           PASSWORDCOMPLEXITY,
           MINPASSWORDLENGTH)
        values
          (seq_usergroup.nextval,
           'SYSADM',
           'System administrator',
           'Y',
           NULL,
           1,
           sysdate,
           'N',
           'N',
           'N',
           'N',
           0,
           'N',
           'N',
           0,
           0,
           0,
           0,
           0)
        returning usergroup_id into userGroupID;
    end;
    -- user group ABSADM
    begin
      select usergroup_id
        into absGroupID
        from usergroup
       where groupname = 'ABSADM';
    exception
      when no_data_found then
        insert into usergroup
          (USERGROUP_ID,
           GROUPNAME,
           DESCRIPTION,
           ACTIVE,
           REMARK,
           SYSTEMUSER_ID,
           TIMESTAMP,
           contactmanageractive,
           singletask,
           enableleasebuyback,
           ALLOWCHNGCUSTPAYMENTTERM,
           DASHBOARD,
           AUTHRIGHTSCONTRACT,
           AUTHRIGHTSPRICELIST,
           PASSWORDREQUIRED,
           MULTIPLELOGINALLOWED,
           PASSWORDCHANGEALLOWED,
           PASSWORDCOMPLEXITY,
           MINPASSWORDLENGTH)
        values
          (seq_usergroup.nextval,
           'ABSADM',
           'ABS administrator',
           'Y',
           NULL,
           1,
           sysdate,
           'Y',
           'N',
           'Y',
           'Y',
           2,
           'Y',
           'Y',
           0,
           0,
           0,
           0,
           0)
        returning usergroup_id into absGroupID;
    end;
    -- user SYSADM, password CHANGE_ON_INSTALL
    begin
      select systemuser_id
        into systemUserID
        from systemuser
       where username = 'SYSADM';
    exception
      when no_data_found then
        insert into systemuser
          (SYSTEMUSER_ID,
           USERGROUP_ID,
           LANGUAGE_ID,
           USERNAME,
           PASSWORD,
           FULLNAME,
           ACTIVE,
           SYSADMIN,
           contactmgrfullrights,
           creditcardauthorised,
           SHOWCONTACTLOGIN,
           LASTLOGINTIMESTAMP,
           PASSWORDCHANGETIMESTAMP,
           LOCKEDOUT,
           LASTLOGINATWORKSTATION,
           LASTLOGINATAPPSERVER,
           LASTINCORRECTLOGINTIMESTAMP,
           INCORRECTLOGINSSINCEPWCHANGE,
           LOGGEDIN,
           PASSWORDEXPIRES,
           CHANGEPASSWORDNEXLOGIN)
        values
          (seq_systemuser.nextval,
           userGroupID,
           languageID,
           'SYSADM',
           'cUSwcnDkgmYn5Y0bsLfpM3xXeXnFTEUj',
           'Automatic conversion from legacy system',
           'Y',
           'Y',
           'N',
           'N',
           'N',
           NULL,
           NULL,
           'N',
           NULL,
           NULL,
           NULL,
           0,
           0,
           0,
           'N')
        returning systemuser_id into systemUserID;
    end;
    -- user ABSADM, password CHANGE_ON_INSTALL
    begin
      select systemuser_id
        into absUserID
        from systemuser
       where username = 'ABSADM';
      update systemuser
         set usergroup_id = absGroupID
       where systemuser_id = absUserID;
    exception
      when no_data_found then
        insert into systemuser
          (SYSTEMUSER_ID,
           USERGROUP_ID,
           LANGUAGE_ID,
           USERNAME,
           PASSWORD,
           FULLNAME,
           ACTIVE,
           SYSADMIN,
           contactmgrfullrights,
           creditcardauthorised,
           SHOWCONTACTLOGIN,
           LASTLOGINTIMESTAMP,
           PASSWORDCHANGETIMESTAMP,
           LOCKEDOUT,
           LASTLOGINATWORKSTATION,
           LASTLOGINATAPPSERVER,
           LASTINCORRECTLOGINTIMESTAMP,
           INCORRECTLOGINSSINCEPWCHANGE,
           LOGGEDIN,
           PASSWORDEXPIRES,
           CHANGEPASSWORDNEXLOGIN)
        values
          (seq_systemuser.nextval,
           absGroupID,
           languageID,
           'ABSADM',
           'cUSwcnDkgmYn5Y0bsLfpM3xXeXnFTEUj',
           'ABS user',
           'Y',
           'Y',
           'Y',
           'N',
           'N',
           NULL,
           NULL,
           'N',
           NULL,
           NULL,
           NULL,
           0,
           0,
           0,
           'N')
        returning systemuser_id into absUserID;
    end;

    if systemUserID is null then
      select min(systemuser_id) into systemUserID from systemuser;
    end if;
    if absUserID is null then
      select min(systemuser_id) into absUserID from systemuser;
    end if;

    -- businessunitsperusergroup
    for vCursor in (select businessunit_id from businessunit) loop
      begin
        insert into businessunitsperusergroup
          (businessunit_id, usergroup_id, systemuser_id, timestamp)
        values
          (vCursor.businessunit_id, userGroupID, systemUserID, sysdate);
        insert into businessunitsperusergroup
          (businessunit_id, usergroup_id, systemuser_id, timestamp)
        values
          (vCursor.businessunit_id, absGroupID, absUserID, sysdate);
      exception
        when dup_val_on_index then
          null;
      end;
    end loop;
    -- invoice frequency
    begin
      select invoicefrequency_id
        into id
        from invoicefrequency
       where invoicefrequency_id = 0;
    exception
      when no_data_found then
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (0, 0, 'Direct', systemUserID, sysdate, 'N');

        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (5, 5, 'Direct with all services', systemUserID, sysdate, 'N');
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (10, 10, 'Weekly', systemUserID, sysdate, 'N');
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (20, 20, 'Every 2 weeks', systemUserID, sysdate, 'N');
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (30, 30, 'Every 3 weeks', systemUserID, sysdate, 'N');
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (40, 40, 'Every 4 weeks', systemUserID, sysdate, 'N');
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (45, 45, '4-4-5 week schedule', systemUserID, sysdate, 'N');
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (50, 50, 'Every 8 weeks', systemUserID, sysdate, 'N');
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (60, 60, 'Every 12 weeks', systemUserID, sysdate, 'N');
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (65, 65, 'Every 16 weeks', systemUserID, sysdate, 'N');
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (70, 70, 'Every 26 weeks', systemUserID, sysdate, 'N');
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (80, 80, 'Every 52 weeks', systemUserID, sysdate, 'N');
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (105, 105, 'Twice a month', systemUserID, sysdate, 'N');
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (110, 110, 'Monthly', systemUserID, sysdate, 'N');
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (111, 111, 'Monthly (price*1)', systemUserID, sysdate, 'N');
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (112,
           112,
           'Monthly with coefficient',
           systemUserID,
           sysdate,
           'N');
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency,
           pricefrequencynumber)
        values
          (115,
           115,
           'Monthly (price*4.33)',
           systemUserID,
           sysdate,
           'N',
           110);
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (120, 120, 'Every 2 months', systemUserID, sysdate, 'N');
        INSERT INTO INVOICEFREQUENCY
          (INVOICEFREQUENCY_ID,
           INVOICEFREQUENCYNUMBER,
           FACTORYDESCRIPTION,
           SYSTEMUSER_ID,
           TIMESTAMP,
           DEFAULTFREQUENCY,
           PRICEFREQUENCYNUMBER)
          SELECT 121,
                 121,
                 '2 Monthly(price*1)',
                 systemUserID,
                 SYSDATE,
                 'N',
                 110
            FROM DUAL;
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (130, 130, 'Every 3 months', systemUserID, sysdate, 'N');
        INSERT INTO INVOICEFREQUENCY
          (INVOICEFREQUENCY_ID,
           INVOICEFREQUENCYNUMBER,
           FACTORYDESCRIPTION,
           SYSTEMUSER_ID,
           TIMESTAMP,
           DEFAULTFREQUENCY,
           PRICEFREQUENCYNUMBER)
          SELECT 131,
                 131,
                 '3 Monthly(price*1)',
                 systemUserID,
                 SYSDATE,
                 'N',
                 110
            FROM DUAL;
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (140, 140, 'Every 4 months', systemUserID, sysdate, 'N');
        INSERT INTO INVOICEFREQUENCY
          (INVOICEFREQUENCY_ID,
           INVOICEFREQUENCYNUMBER,
           FACTORYDESCRIPTION,
           SYSTEMUSER_ID,
           TIMESTAMP,
           DEFAULTFREQUENCY,
           PRICEFREQUENCYNUMBER)
          SELECT 141,
                 141,
                 '4 Monthly(price*1)',
                 systemUserID,
                 SYSDATE,
                 'N',
                 110
            FROM DUAL;
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (160, 160, 'Every 6 months', systemUserID, sysdate, 'N');
        INSERT INTO INVOICEFREQUENCY
          (INVOICEFREQUENCY_ID,
           INVOICEFREQUENCYNUMBER,
           FACTORYDESCRIPTION,
           SYSTEMUSER_ID,
           TIMESTAMP,
           DEFAULTFREQUENCY,
           PRICEFREQUENCYNUMBER)
          SELECT 161,
                 161,
                 '6 Monthly(price*1)',
                 systemUserID,
                 SYSDATE,
                 'N',
                 110
            FROM DUAL;
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (170, 170, 'Every 12 months', systemUserID, sysdate, 'N');
        INSERT INTO INVOICEFREQUENCY
          (INVOICEFREQUENCY_ID,
           INVOICEFREQUENCYNUMBER,
           FACTORYDESCRIPTION,
           SYSTEMUSER_ID,
           TIMESTAMP,
           DEFAULTFREQUENCY,
           PRICEFREQUENCYNUMBER)
          SELECT 171,
                 171,
                 '12 Monthly(price*1)',
                 systemUserID,
                 SYSDATE,
                 'N',
                 110
            FROM DUAL;
        insert into invoicefrequency
          (invoicefrequency_id,
           invoicefrequencynumber,
           factorydescription,
           systemuser_id,
           timestamp,
           defaultfrequency)
        values
          (200, 200, 'Manual', systemUserID, sysdate, 'N');

        insert into invoicefrequency_desc
          (invoicefrequency_id,
           language_id,
           description,
           systemuser_id,
           timestamp)
          select x.invoicefrequency_id,
                 languageID,
                 x.factorydescription,
                 x.systemuser_id,
                 x.timestamp
            from invoicefrequency x;
    end;
    -- invoice line type
    begin
      select invoicelinetype_id
        into id
        from invoicelinetype
       where invoicelinetype_id = 1;
    exception
      when no_data_found then
        aDesc(1) := 'Rent';
        aTax(1) := 2;
        aTurnover(1) := 'Y';
        aCharge(1) := 'Y';
        aDesc(2) := 'Delivery (wash)';
        aTax(2) := 3;
        aTurnover(2) := 'N';
        aCharge(2) := 'Y';
        aDesc(3) := 'Soil Weight';
        aTax(3) := 3;
        aTurnover(3) := 'N';
        aCharge(3) := 'Y';
        aDesc(4) := 'Clean Weight';
        aTax(4) := 3;
        aTurnover(4) := 'N';
        aCharge(4) := 'Y';
        aDesc(5) := 'Sales';
        aTax(5) := 1;
        aTurnover(5) := 'N';
        aCharge(5) := 'Y';
        aDesc(6) := 'Repair';
        aTax(6) := 3;
        aTurnover(6) := 'Y';
        aCharge(6) := 'Y';
        aDesc(7) := 'Replacement charge';
        aTax(7) := 1;
        aTurnover(7) := 'N';
        aCharge(7) := 'Y';
        aDesc(8) := 'Automatic Replacement';
        aTax(8) := 1;
        aTurnover(8) := 'Y';
        aCharge(8) := 'Y';
        aDesc(9) := 'Loss charge';
        aTax(9) := 1;
        aTurnover(9) := 'Y';
        aCharge(9) := 'Y';
        aDesc(10) := 'Residual value charge';
        aTax(10) := 1;
        aTurnover(10) := 'Y';
        aCharge(10) := 'Y';
        aDesc(11) := 'Garment Insurance';
        aTax(11) := 1;
        aTurnover(11) := 'Y';
        aCharge(11) := 'Y';
        aDesc(12) := 'Stockroom Handling & Label/Emblem charge';
        aTax(12) := 1;
        aTurnover(12) := 'Y';
        aCharge(12) := 'Y';
        aDesc(13) := 'Finance charge';
        aTax(13) := 3;
        aTurnover(13) := 'Y';
        aCharge(13) := 'N';
        aDesc(14) := 'Cash Delay line';
        aTax(14) := 0;
        aTurnover(14) := 'N';
        aCharge(14) := 'N';
        aDesc(15) := 'Miscellaneous Invoice line';
        aTax(15) := 3;
        aTurnover(15) := 'Y';
        aCharge(15) := 'Y';
        aDesc(16) := 'Special Charge';
        aTax(16) := 3;
        aTurnover(16) := 'N';
        aCharge(16) := 'Y';
        aDesc(17) := 'Minimum invoice amount';
        aTax(17) := 3;
        aTurnover(17) := 'Y';
        aCharge(17) := 'N';
        aDesc(18) := 'Tax';
        aTax(18) := 0;
        aTurnover(18) := 'N';
        aCharge(18) := 'N';
        aDesc(19) := 'Emblem Rent';
        aTax(19) := 2;
        aTurnover(19) := 'Y';
        aCharge(19) := 'Y';
        aDesc(20) := 'Locker Rent';
        aTax(20) := 2;
        aTurnover(20) := 'Y';
        aCharge(20) := 'Y';
        aDesc(21) := 'Locker Service';
        aTax(21) := 1;
        aTurnover(21) := 'Y';
        aCharge(21) := 'Y';
        aDesc(22) := 'Lease';
        aTax(22) := 2;
        aTurnover(22) := 'Y';
        aCharge(22) := 'Y';
        aDesc(23) := 'Stock Charge';
        aTax(23) := 2;
        aTurnover(23) := 'Y';
        aCharge(23) := 'Y';
        aDesc(24) := 'Lost Customer Residual Value Charge';
        aTax(24) := 3;
        aTurnover(24) := 'Y';
        aCharge(24) := 'Y';
        aDesc(25) := 'Lost Revenue Charge';
        aTax(25) := 3;
        aTurnover(25) := 'Y';
        aCharge(25) := 'Y';
        aDesc(26) := 'Residential Services Wash';
        aTax(26) := 3;
        aTurnover(26) := 'N';
        aCharge(26) := 'Y';
        aDesc(27) := 'Client Labels';
        aTax(27) := 1;
        aTurnover(27) := 'Y';
        aCharge(27) := 'Y';
        aDesc(28) := 'Service Costs';
        aTax(28) := 3;
        aTurnover(28) := 'Y';
        aCharge(28) := 'Y';
        aDesc(29) := 'Capped Excess Amounts';
        aTax(29) := 3;
        aTurnover(29) := 'Y';
        aCharge(29) := 'N';
        aDesc(30) := 'Client Rent';
        aTax(30) := 2;
        aTurnover(30) := 'N';
        aCharge(30) := 'Y';
        aDesc(31) := 'Budget';
        aTax(31) := 3;
        aTurnover(31) := 'Y';
        aCharge(31) := 'N';
        aDesc(32) := 'Down Payment';
        aTax(32) := 3;
        aTurnover(32) := 'Y';
        aCharge(32) := 'N';
        aDesc(33) := 'Statement fee';
        aTax(33) := 3;
        aTurnover(33) := 'Y';
        aCharge(33) := 'N';
        aDesc(34) := 'Custom Garment Charge';
        aTax(34) := 2;
        aTurnover(34) := 'Y';
        aCharge(34) := 'Y';

        for i in 1 .. 34 loop
        insert into invoicelinetype
            (invoicelinetype_id,
             type,
             factorydescription,
             includeinminimumcalc,
             taxtype,
             defineturnovergroup,
             definespecialcharge,
             supressprinting,
             systemuser_id,
             timestamp)
          values
            (i,
             i,
             aDesc(i),
             'N',
             aTax(i),
             aTurnover(i),
             aCharge(i),
             0,
             systemUserID,
             sysdate);
        end loop;
        update invoicelinetype
           set supressprinting = 2
         where invoicelinetype_id = 15;
        update invoicelinetype
           set includeinminimumcalc = 'Y'
         where invoicelinetype_id = 16;
        update invoicelinetype
           set includeinminimumcalc = 'Y'
         where invoicelinetype_id = 31;
        update invoicelinetype
           set includeinminimumcalc = 'Y'
         where invoicelinetype_id = 33;
        update invoicelinetype
        set includeinminimumcalc = 'Y'
         where invoicelinetype_id = 34;
        insert into invoicelinetype_desc
          (invoicelinetype_id,
           language_id,
           description,
           systemuser_id,
           timestamp)
          select x.invoicelinetype_id,
                 languageID,
                 x.factorydescription,
                 x.systemuser_id,
                 x.timestamp
            from invoicelinetype x;
    end;
    -- invoice line type tax
    for vCursor in (select country_id from country where definetax = 'Y') loop
      begin
        insert into invoicelinetypetax
         (invoicelinetype_id, country_id, systemuser_id, timestamp)
          select invoicelinetype_id,
                 vCursor.country_id,
                 systemuser_id,
                 timestamp
            from invoicelinetype;
      exception
        when dup_val_on_index then
          null;
      end;
    end loop;
    --invoicelinesubtype
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             1,
             'Rent Other Items',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             2,
             'Wash LOG',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             5,
             'Sales Products via Delivery Note ',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             6,
             'Regular Repair',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             7,
             'Replacement Charge',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             8,
             'Automatic Replace',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             9,
             'Loss Charge Non Garments',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             10,
             'Residual Value Charge',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             11,
             'Insurance Price per Product',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             13,
             'Finance Charge',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             15,
             'Miscellaneous Charge',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             17,
             'Minimum Invoice Charge',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             19,
             'Emblem Rent',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             20,
             'Locker Rent',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             21,
             'Locker Service',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             22,
             'Lease Non Garments',
             1,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             23,
             'Stock Charge',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             24,
             'Lost Customer Residual Value Charge',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             25,
             'Lost Revenue Charge',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             30,
             'Client Rent',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             31,
             'Budget',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             33,
             'Statement Fee',
             systemUserID,
             sysdate
        from dual;

       insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             34,
             'Custom Garment Charge',
             getminsystemuser(),
             sysdate
        from dual;

    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             1,
             1,
             'Rent by Wearer Product',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             1,
             2,
             'Wash specified by Wearer',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             1,
             5,
             'Garment Sales via automatic sales during issue',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             1,
             9,
             'Loss Charge Garments - Loan products',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             1,
             22,
             'Lease Garments',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             2,
             1,
             'Rent by Wearer Item Condensed',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             3,
             1,
             'Rent by Total Wearer',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             4,
             1,
             'Rent by Product',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             5,
             1,
             'Rent by Wearer Summary',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             6,
             1,
             'Under Use',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             7,
             1,
             'Rent in Advance',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             8,
             1,
             'Correction Rent',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             9,
             12,
             'Prep Charges',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             10,
             12,
             'Emblem Charges',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             11,
             12,
             'Label Charges',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             12,
             12,
             'Restocking Fee',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             13,
             2,
             'Changes per Week',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             14,
             1,
             'Rent Deposit Stock',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval, 15, 2, 'Wash COG', 1, sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             16,
             9,
             'Loss Credit',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             17,
             5,
             'Garment Sales via Sales Note',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             18,
             5,
             'Garment Sales Credit',
             1,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             19,
             11,
             'Garment insurance for Repair ',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             20,
             11,
             'Garment insurance for Loss',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             21,
             11,
             'Garment insurance for Repair and Loss',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             22,
             11,
             'Garment insurance for Residual Value ',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             23,
             11,
             'Garment insurance for Repair and Residual Value',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             24,
             11,
             'Garment insurance for Loss and Residual Value',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             25,
             11,
             'Garment insurance for Loss, Repair and Residual Value',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             26,
             10,
             'Contract Change',
             1,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             27,
             10,
             'Replacement',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             28,
             10,
             'Out Of Circulation',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             29,
             26,
             'Laundry',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             30,
             26,
             'Dry clean',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             31,
             27,
             'Labels Charged',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             32,
             27,
             'Labels Free of Charge',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             33,
             27,
             'Labels Patching',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             33,
             9,
             'Loss Charge Garments - Product list per Customer Inactive',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             34,
             9,
             'Loss Charge Garments - Wearer Inventory Inactive',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             35,
             9,
             'Loss Charge Garments - Wearer Inactive',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             36,
             9,
             'Loss Charge Garments - Replacement',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             37,
             16,
             'Client Charge',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             38,
             12,
             'COG Code Label',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             39,
             2,
             'Wash based on soiled registered items',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             40,
             1,
             'Sample products',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             41,
             2,
             'Wash No Delivery',
             systemUserID,
             sysdate
        from dual;
    --> 502698
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             1,
             6,
             'Regular Repair COG',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             2,
             6,
             'Service Charge',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             3,
             6,
             'Service Charge COG',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             4,
             6,
             'Modification Charge',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             5,
             6,
             'Modification Charge COG',
             systemUserID,
             sysdate
        from dual;

    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             28,
             'Service Costs LOG',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             1,
             28,
             'Service Costs COG',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             2,
             28,
             'Service Costs for max inventory',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             3,
             28,
             'Product list specific Service Costs LOG',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             4,
             28,
             'Product list specific Service Costs COG',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             5,
             28,
             'Product list specific Service Costs for max inventory',
             systemUserID,
             sysdate
        from dual;

    --< 502698
    --20011755.70
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             4,
             'Weight recording',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             42,
             4,
             'Special use',
             systemUserID,
             sysdate
        from dual;
    ---<20011755.70
    --20011850
    INSERT INTO INVOICELINESUBTYPE I
      (I.INVOICELINESUBTYPE_ID,
       SUBTYPE,
       INVOICELINETYPE_ID,
       FACTORYDESCRIPTION,
       SYSTEMUSER_ID,
       TIMESTAMP)
      SELECT SEQ_INVOICELINESUBTYPE.NEXTVAL,
             37,
             9,
             'Loss for pool',
             systemUserID,
             SYSDATE
        FROM DUAL;

    INSERT INTO INVOICELINESUBTYPE I
      (I.INVOICELINESUBTYPE_ID,
       SUBTYPE,
       INVOICELINETYPE_ID,
       FACTORYDESCRIPTION,
       SYSTEMUSER_ID,
       TIMESTAMP)
      SELECT SEQ_INVOICELINESUBTYPE.NEXTVAL,
             38,
             9,
             'Credit for pool',
             systemUserID,
             SYSDATE
        FROM DUAL;
    --20011284.100
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             0,
             29,
             'Full credit on client invoice',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             1,
             29,
             'Credit Excess Amount on client invoice',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             2,
             29,
             'Full debit to customer',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             3,
             29,
             'Debit Excess Amount to customer',
             systemUserID,
             sysdate
        from dual;
    --20012126
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             2,
             16,
             'Postage & Transport costs',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             5,
             5,
             'General Sales Order Discount',
             systemUserID,
             sysdate
        from dual;
    -->20013178
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             41,
             1,
             'New Loan',
             systemUserID,
             sysdate
        from dual;
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             42,
             1,
             'Outstanding Loan',
             systemUserID,
             sysdate
        from dual;
    --<20013178
    -->20013177
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             43,
             1,
             'Excess',
             systemUserID,
             sysdate
        from dual;
    --<20013177
    -->20013408.70
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             43,
             2,
             'Heavy Soil',
             systemUserID,
             sysdate
        from dual;
    --<20013408.70

    -->20013061.70
    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             44,
             1,
             'Rent Not Returned items',
             systemUserID,
             sysdate
        from dual;
    --<20013061.70

    INSERT INTO INVOICELINESUBTYPE I
      (I.INVOICELINESUBTYPE_ID,
       SUBTYPE,
       INVOICELINETYPE_ID,
       FACTORYDESCRIPTION,
       SYSTEMUSER_ID,
       TIMESTAMP)
      SELECT SEQ_INVOICELINESUBTYPE.NEXTVAL,
             1,
             7,
             'Loss (replacement)',
             systemUserID,
             SYSDATE
        FROM DUAL;

    --20014824
    INSERT INTO INVOICELINESUBTYPE I
      (I.INVOICELINESUBTYPE_ID,
       SUBTYPE,
       INVOICELINETYPE_ID,
       FACTORYDESCRIPTION,
       SYSTEMUSER_ID,
       TIMESTAMP)
      SELECT SEQ_INVOICELINESUBTYPE.NEXTVAL,
             39,
             9,
             'Loss Charge Garments – Decrease Max Inventory',
             systemUserID,
             SYSDATE
        FROM DUAL;

    --20015398

    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             44,
             2,
             'Free Clean Change Per Week',
             systemUserID,
             sysdate
        from dual;

    -- ABS-5795 / 20015850
    INSERT INTO INVOICELINESUBTYPE I
      (I.INVOICELINESUBTYPE_ID,
       SUBTYPE,
       INVOICELINETYPE_ID,
       FACTORYDESCRIPTION,
       SYSTEMUSER_ID,
       TIMESTAMP)
      SELECT SEQ_INVOICELINESUBTYPE.NEXTVAL,
             45,
             1,
             'Rent by Wearer Product Free of Charge',
             systemUserID,
             SYSDATE
        FROM DUAL;

    --ABS-7278 / 20014060
    INSERT INTO INVOICELINESUBTYPE I
      (I.INVOICELINESUBTYPE_ID,
       SUBTYPE,
       INVOICELINETYPE_ID,
       FACTORYDESCRIPTION,
       SYSTEMUSER_ID,
       TIMESTAMP)
      SELECT SEQ_INVOICELINESUBTYPE.NEXTVAL,
             6,
             6,
             'Summarized per Repairtype',
             systemUserID,
             SYSDATE
        FROM DUAL;

    INSERT INTO INVOICELINESUBTYPE I
      (I.INVOICELINESUBTYPE_ID,
       SUBTYPE,
       INVOICELINETYPE_ID,
       FACTORYDESCRIPTION,
       SYSTEMUSER_ID,
       TIMESTAMP)
      SELECT SEQ_INVOICELINESUBTYPE.NEXTVAL,
             7,
             6,
             'Summarized per Repairtype – COG',
             systemUserID,
             SYSDATE
        FROM DUAL;

    INSERT INTO INVOICELINESUBTYPE I
      (I.INVOICELINESUBTYPE_ID,
       SUBTYPE,
       INVOICELINETYPE_ID,
       FACTORYDESCRIPTION,
       SYSTEMUSER_ID,
       TIMESTAMP)
      SELECT SEQ_INVOICELINESUBTYPE.NEXTVAL,
             8,
             6,
             'Detailed per Wearer',
             systemUserID,
             SYSDATE
        FROM DUAL;

    INSERT INTO INVOICELINESUBTYPE I
      (I.INVOICELINESUBTYPE_ID,
       SUBTYPE,
       INVOICELINETYPE_ID,
       FACTORYDESCRIPTION,
       SYSTEMUSER_ID,
       TIMESTAMP)
      SELECT SEQ_INVOICELINESUBTYPE.NEXTVAL,
             9,
             6,
             'Detailed per Wearer',
             systemUserID,
             SYSDATE
        FROM DUAL;

    INSERT INTO INVOICELINESUBTYPE I
      (I.INVOICELINESUBTYPE_ID,
       SUBTYPE,
       INVOICELINETYPE_ID,
       FACTORYDESCRIPTION,
       SYSTEMUSER_ID,
       TIMESTAMP)
      select seq_invoicelinesubtype.nextval,
             0,
             32,
             'Down Payment Debit',
             1,
             sysdate
        from dual;

    INSERT INTO INVOICELINESUBTYPE I
      (I.INVOICELINESUBTYPE_ID,
       SUBTYPE,
       INVOICELINETYPE_ID,
       FACTORYDESCRIPTION,
       SYSTEMUSER_ID,
       TIMESTAMP)
      select seq_invoicelinesubtype.nextval,
             1,
             32,
             'Down Payment Credit',
             1,
             sysdate
        from dual;

    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             46,
             2,
             'Wash No Delivery COG',
             getminsystemuser(),
             sysdate
        from dual;

    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             26,
             11,
             'Material Maintenance Protection (MMP)',
             getminsystemuser(),
             sysdate
        from dual;

    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             27,
             11,
             'Garment Maintenance Protection (GMP)',
             getminsystemuser(),
             sysdate
        from dual;

    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             28,
             11,
             'Garment Setup Protection (GSP)',
             getminsystemuser(),
             sysdate
        from dual;

    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             29,
             11,
             'Garment Loss Protection (GLP)',
             getminsystemuser(),
             sysdate
        from dual;

    insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             30,
             11,
             'Garment Repair Protection (GRP)',
             getminsystemuser(),
             sysdate
        from dual;

     insert into invoicelinesubtype i
      (i.invoicelinesubtype_id,
       subtype,
       invoicelinetype_id,
       factorydescription,
       systemuser_id,
       timestamp)
      select seq_invoicelinesubtype.nextval,
             47,
             2,
             'Wash overuse',
             systemUserID,
             sysdate
        from dual;

    --invoice line subtype description
    insert into invoicelinesubtype_desc
      (invoicelinesubtype_id,
       language_id,
       description,
       systemuser_id,
       timestamp)
      select i.invoicelinesubtype_id,
             l.language_id,
             i.factorydescription,
             systemUserID,
             sysdate
        from invoicelinesubtype i, languages l
       where l.translatedescription = 'Y';

    --invoice correction type
    insert into invoicecorrectiontype i
      (i.invoicecorrectiontype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       debitcredit,
       sequencenumber,
       active)
      select seq_invoicelinesubtype.nextval,
             101,
             'Credit due to changes in quantity',
             systemUserID,
             sysdate,
             'C',
             1,
             'N'
        from dual;
    insert into invoicecorrectiontype i
      (i.invoicecorrectiontype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       debitcredit,
       sequencenumber,
       active)
      select seq_invoicelinesubtype.nextval,
             102,
             'Correction due to changes in quantity',
             systemUserID,
             sysdate,
             'D',
             2,
             'N'
        from dual;
    insert into invoicecorrectiontype i
      (i.invoicecorrectiontype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       debitcredit,
       sequencenumber,
       active)
      select seq_invoicelinesubtype.nextval,
             103,
             'Credit due to price changes',
             systemUserID,
             sysdate,
             'C',
             3,
             'N'
        from dual;
    insert into invoicecorrectiontype i
      (i.invoicecorrectiontype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       debitcredit,
       sequencenumber,
       active)
      select seq_invoicelinesubtype.nextval,
             104,
             'Correction due to price changes',
             systemUserID,
             sysdate,
             'D',
             4,
             'Y'
        from dual;
    insert into invoicecorrectiontype i
      (i.invoicecorrectiontype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       debitcredit,
       sequencenumber,
       active)
      select seq_invoicelinesubtype.nextval,
             105,
             'Credit due to discount changes',
             systemUserID,
             sysdate,
             'C',
             5,
             'Y'
        from dual;
    insert into invoicecorrectiontype i
      (i.invoicecorrectiontype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       debitcredit,
       sequencenumber,
       active)
      select seq_invoicelinesubtype.nextval,
             106,
             'Correction due to discount changes',
             systemUserID,
             sysdate,
             'D',
             6,
             'Y'
        from dual;
    insert into invoicecorrectiontype i
      (i.invoicecorrectiontype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       debitcredit,
       sequencenumber,
       active)
      select seq_invoicelinesubtype.nextval,
             107,
             'Credit due to multiple changes',
             systemUserID,
             sysdate,
             'C',
             7,
             'N'
        from dual;
    insert into invoicecorrectiontype i
      (i.invoicecorrectiontype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       debitcredit,
       sequencenumber,
       active)
      select seq_invoicelinesubtype.nextval,
             108,
             'Correction due to multiple changes',
             systemUserID,
             sysdate,
             'D',
             8,
             'Y'
        from dual;
    insert into invoicecorrectiontype i
      (i.invoicecorrectiontype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       debitcredit,
       sequencenumber,
       active)
      select seq_invoicelinesubtype.nextval,
             109,
             'Credit due to changes in rent stops',
             systemUserID,
             sysdate,
             'C',
             9,
             'N'
        from dual;
    insert into invoicecorrectiontype i
      (i.invoicecorrectiontype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       debitcredit,
       sequencenumber,
       active)
      select seq_invoicelinesubtype.nextval,
             110,
             'Correction due to changes in rent stops',
             systemUserID,
             sysdate,
             'D',
             10,
             'N'
        from dual;
    insert into invoicecorrectiontype i
      (i.invoicecorrectiontype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       debitcredit,
       sequencenumber,
       active)
      select seq_invoicelinesubtype.nextval,
             111,
             'Correction for not yet invoiced period',
             systemUserID,
             sysdate,
             'D',
             11,
             'Y'
        from dual;
    insert into invoicecorrectiontype_desc
      (invoicecorrectiontype_id,
       language_id,
       description,
       systemuser_id,
       timestamp)
      select i.invoicecorrectiontype_id,
             l.language_id,
             i.factorydescription,
             systemUserID,
             sysdate
        from invoicecorrectiontype i, languages l
       where l.translatedescription = 'Y';
    -- AR transaction type
    begin
      select artransactiontype_id
        into id
        from artransactiontype
       where typenumber = 1
         and debitcredit = 'D';
    exception
      when no_data_found then
        insert into artransactiontype
          (artransactiontype_id,
           debitcredit,
           typenumber,
           factorydescription,
           code,
           predefined,
           systemuser_id,
           timestamp)
        values
          (seq_artransactiontype.nextval,
           'D',
           1,
           'Invoice',
           'INV',
           'Y',
           systemUserID,
           sysdate);
        insert into artransactiontype
          (artransactiontype_id,
           debitcredit,
           typenumber,
           factorydescription,
           code,
           predefined,
           systemuser_id,
           timestamp)
        values
          (seq_artransactiontype.nextval,
           'D',
           2,
           'Open Difference',
           'DIF',
           'Y',
           systemUserID,
           sysdate);
        insert into artransactiontype
          (artransactiontype_id,
           debitcredit,
           typenumber,
           factorydescription,
           code,
           predefined,
           systemuser_id,
           timestamp)
        values
          (seq_artransactiontype.nextval,
           'D',
           3,
           'Statement',
           'STA',
           'Y',
           systemUserID,
           sysdate);
        insert into artransactiontype
          (artransactiontype_id,
           debitcredit,
           typenumber,
           factorydescription,
           code,
           predefined,
           systemuser_id,
           timestamp)
        values
          (seq_artransactiontype.nextval,
           'D',
           4,
           'Discount Charge',
           'DIS',
           'Y',
           systemUserID,
           sysdate);
        insert into artransactiontype
          (artransactiontype_id,
           debitcredit,
           typenumber,
           factorydescription,
           code,
           predefined,
           systemuser_id,
           timestamp)
        values
          (seq_artransactiontype.nextval,
           'C',
           1,
           'Credit Invoice',
           'CRD',
           'Y',
           systemUserID,
           sysdate);
        insert into artransactiontype
          (artransactiontype_id,
           debitcredit,
           typenumber,
           factorydescription,
           code,
           predefined,
           systemuser_id,
           timestamp)
        values
          (seq_artransactiontype.nextval,
           'C',
           2,
           'Open Difference Credit',
           'DIF',
           'Y',
           systemUserID,
           sysdate);
        insert into artransactiontype
          (artransactiontype_id,
           debitcredit,
           typenumber,
           factorydescription,
           code,
           predefined,
           systemuser_id,
           timestamp)
        values
          (seq_artransactiontype.nextval,
           'C',
           3,
           'Statement Credit',
           'STA',
           'Y',
           systemUserID,
           sysdate);
        insert into artransactiontype
          (artransactiontype_id,
           debitcredit,
           typenumber,
           factorydescription,
           code,
           predefined,
           systemuser_id,
           timestamp)
        values
          (seq_artransactiontype.nextval,
           'C',
           4,
           'Discount',
           'DIS',
           'Y',
           systemUserID,
           sysdate);
        insert into artransactiontype
          (artransactiontype_id,
           debitcredit,
           typenumber,
           factorydescription,
           code,
           predefined,
           systemuser_id,
           timestamp)
        values
          (seq_artransactiontype.nextval,
           'C',
           5,
           'Payment',
           'PAY',
           'Y',
           systemUserID,
           sysdate);
        insert into artransactiontype_desc
          (artransactiontype_id,
           language_id,
           description,
           systemuser_id,
           timestamp)
          select artransactiontype_id,
                 languageID,
                 factorydescription,
                 systemuser_id,
                 timestamp
            from artransactiontype;
    end;
    -- status
    begin
      select status_id
        into id
        from status
       where statustype = 'PN'
         and code = '10';
    exception
      when no_data_found then
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'IN',
           1,
           'Not Settled (US) / Test invoice (EU)',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'IN',
           2,
           'Settled (US) / Final Invoice (EU)',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval, 'IN', 3, 'Cancelled', systemUserID, sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'PN',
           5,
           'Special Order',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'PN',
           10,
           'Packing note',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'PN',
           20,
           'In progress',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'PN',
           30,
           'Processed',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'PN',
           40,
           'Cancelled',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'PN',
           50,
           'Postponed',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'WN',
           20,
           'In progress',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'WN',
           30,
           'Processed',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'WN',
           40,
           'Cancelled',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'ST',
           1,
           'In Progress',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval, 'ST', 2, 'Processed', systemUserID, sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval, 'ST', 3, 'Cancelled', systemUserID, sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'RB',
           1,
           'In Progress',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval, 'RB', 2, 'Completed', systemUserID, sysdate);
        -- workorder statuses:
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'WO',
           '3',
           'Waiting Supervisor Approval',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'WO',
           '05',
           'Waiting for approval',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp,
           legacystatuscode)
        values
          (seq_status.nextval, 'WO', 10, 'New', systemUserID, sysdate, '1');
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp,
           legacystatuscode)
        values
          (seq_status.nextval,
           'WO',
           15,
           'Picked',
           systemUserID,
           sysdate,
           '1');
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'WO',
           20,
           'In Progress',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'WO',
           25,
           'In Progress with Priority',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp,
           legacystatuscode)
        values
          (seq_status.nextval,
           'WO',
           30,
           'Completed',
           systemUserID,
           sysdate,
           '3');
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp,
           legacystatuscode)
        values
          (seq_status.nextval,
           'WO',
           40,
           'Cancelled',
           systemUserID,
           sysdate,
           '4');
        -- unique item status
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval, 'UI', 10, 'Stock', systemUserID, sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'UI',
           20,
           'In Circulation',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'UI',
           '25',
           '',
           systemUserID,
           sysdate,
           'Picked');
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval, 'UI', 30, 'Assigned', systemUserID, sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'UI',
           '35',
           '',
           systemUserID,
           sysdate,
           'Transfer Stock');
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval, 'UI', 40, 'Ragged', systemUserID, sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval, 'UI', 50, 'Sold', systemUserID, sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'UI',
           60,
           'Returned to Supplier',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'UI',
           70,
           'Returned by customer',
           systemUserID,
           sysdate);
        -- straight even return
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'SR',
           10,
           'Outstanding',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'SR',
           20,
           'Processed',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval, 'SR', 30, 'Cancel', systemUserID, sysdate);
        -- garment dispenser export
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval, 'GD', 10, 'New', systemUserID, sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval, 'GD', 11, 'Reset', systemUserID, sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'GD',
           20,
           'Export Created',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'GD',
           30,
           'Export Sent',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval, 'GD', 40, 'Accepted', systemUserID, sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval, 'GD', 50, 'Rejected', systemUserID, sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'GD',
           '60',
           '',
           systemUserID,
           sysdate,
           'Ignored/Not supported');
        -- purchase order
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'PO',
           '05',
           'Waiting for approval',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'PO',
           10,
           'New (approved)',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval, 'PO', 20, 'Send', systemUserID, sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'PO',
           25,
           'Confirmed',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'PO',
           30,
           'Partly received',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'PO',
           40,
           'Completed (receiving)',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'PO',
           50,
           'Cancelled',
           systemUserID,
           sysdate);
        -- unique bundle status
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval, 'BN', 10, 'New', systemUserID, sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'BN',
           20,
           'Scanned out',
           systemUserID,
           sysdate);
        -- unique residentiat items
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'UR',
           10,
           'In Circulation',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'UR',
           20,
           'No product assigned',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (seq_status.nextval,
           'UR',
           30,
           'Out of Circulation',
           systemUserID,
           sysdate);
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'PL',
           '10',
           '',
           systemUserID,
           sysdate,
           'Proposal');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'PL',
           '20',
           '',
           systemUserID,
           sysdate,
           'Picking in Progress');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'PL',
           '30',
           '',
           systemUserID,
           sysdate,
           'Picking Confirmed');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'PL',
           '40',
           '',
           systemUserID,
           sysdate,
           'Cancelled');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'PL',
           '50',
           '',
           systemUserID,
           sysdate,
           'Issuing in Progress');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'PL',
           '60',
           '',
           systemUserID,
           sysdate,
           'Issue Completed');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'MO',
           '05',
           '',
           systemUserID,
           sysdate,
           'Waiting for approval');

        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'MO',
           '10',
           '',
           systemUserID,
           sysdate,
           'New');

        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'MO',
           '12',
           '',
           systemUserID,
           sysdate,
           'Not available');

        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'MO',
           '15',
           '',
           systemUserID,
           sysdate,
           'Picked');

        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'MO',
           '20',
           '',
           systemUserID,
           sysdate,
           'In progress');

        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'MO',
           '25',
           '',
           systemUserID,
           sysdate,
           'In Progress with Priority');

        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'MO',
           '30',
           '',
           systemUserID,
           sysdate,
           'Completed');

        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'MO',
           '40',
           '',
           systemUserID,
           sysdate,
           'Cancelled');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'MO',
           '50',
           '',
           systemUserID,
           sysdate,
           'Confirmed');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'CA',
           '10',
           '',
           systemUserID,
           sysdate,
           'Available');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'CA',
           '20',
           '',
           systemUserID,
           sysdate,
           'Loaded');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'CA',
           '30',
           '',
           systemUserID,
           sysdate,
           'Ready for Sterilization');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'OR',
           '10',
           '',
           systemUserID,
           sysdate,
           'Generated(label)');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'OR',
           '20',
           '',
           systemUserID,
           sysdate,
           'Assembled');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'OR',
           '25',
           '',
           systemUserID,
           sysdate,
           'Loaded on Cart');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'OR',
           '30',
           '',
           systemUserID,
           sysdate,
           'Sterilized');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'OR',
           '40',
           '',
           systemUserID,
           sysdate,
           'Delivered');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'OR',
           '50',
           '',
           systemUserID,
           sysdate,
           'Used');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'OR',
           '60',
           '',
           systemUserID,
           sysdate,
           'Cancelled');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'OR',
           '70',
           '',
           systemUserID,
           sysdate,
           'Recalled');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'SL',
           '10',
           '',
           systemUserID,
           sysdate,
           'New');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'SL',
           '20',
           '',
           systemUserID,
           sysdate,
           'In Progress');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'SL',
           '30',
           '',
           systemUserID,
           sysdate,
           'Completed');
        insert into status
          (status_id,
           statustype,
           code,
           legacystatuscode,
           systemuser_id,
           timestamp,
           factorydescription)
        values
          (seq_status.nextval,
           'SL',
           '40',
           '',
           systemUserID,
           sysdate,
           'Closed');
        insert into status
          (STATUS_ID,
           STATUSTYPE,
           CODE,
           LEGACYSTATUSCODE,
           SYSTEMUSER_ID,
           TIMESTAMP,
           FACTORYDESCRIPTION)
        values
          (SEQ_STATUS.NEXTVAL,
           'PN',
           '60',
           '',
           systemUserID,
           sysdate,
           'Pre-packingnote');

        -->ABS-5747
        INSERT INTO STATUS
          (STATUS_ID,
           STATUSTYPE,
           CODE,
           LEGACYSTATUSCODE,
           FACTORYDESCRIPTION,
           SYSTEMUSER_ID,
           TIMESTAMP)
        values
          (SEQ_STATUS.NEXTVAL,
           'CO',
           10,
           '',
           'New / Not yet approved',
           systemUserID,
           sysdate);

        INSERT INTO STATUS
          (STATUS_ID,
           STATUSTYPE,
           CODE,
           LEGACYSTATUSCODE,
           FACTORYDESCRIPTION,
           SYSTEMUSER_ID,
           TIMESTAMP)
        values
          (SEQ_STATUS.NEXTVAL,
           'CO',
           20,
           '',
           'Approved',
           systemUserID,
           sysdate);

        INSERT INTO STATUS
          (STATUS_ID,
           STATUSTYPE,
           CODE,
           LEGACYSTATUSCODE,
           FACTORYDESCRIPTION,
           SYSTEMUSER_ID,
           TIMESTAMP)
        values
          (SEQ_STATUS.NEXTVAL,
           'CO',
           30,
           '',
           'Extended',
           systemUserID,
           sysdate);

        INSERT INTO STATUS
          (STATUS_ID,
           STATUSTYPE,
           CODE,
           LEGACYSTATUSCODE,
           FACTORYDESCRIPTION,
           SYSTEMUSER_ID,
           TIMESTAMP)
        values
          (SEQ_STATUS.NEXTVAL,
           'CO',
           40,
           '',
           'Expired',
           systemUserID,
           sysdate);

        INSERT INTO STATUS
          (STATUS_ID,
           STATUSTYPE,
           CODE,
           LEGACYSTATUSCODE,
           FACTORYDESCRIPTION,
           SYSTEMUSER_ID,
           TIMESTAMP)
        values
          (SEQ_STATUS.NEXTVAL,
           'CO',
           50,
           '',
           'Terminated',
           systemUserID,
           sysdate);

        insert into status_desc
          (status_id, language_id, description, systemuser_id, timestamp)
          select status_id,
                 languageID,
                 factorydescription,
                 systemuser_id,
                 timestamp
            from status;
    end;

    -- stay
    begin
      select stay_id
        into id
        from stay
       where staytype = 1
         and staynr = 10;
    exception
      when no_data_found then
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 10, 'In Stockroom', systemUserID, sysdate, 1);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 11, 'Stockroom/Picked', systemUserID, sysdate, 1);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 20, 'Outscan/At Customer', systemUserID, sysdate, 2);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 22, 'Clean in Garment Dispenser', systemUserID, sysdate, 2);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 23, 'Desk Scan/Issue to Wearer', systemUserID, sysdate, 2);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 24, 'Out of Garment Dispenser', systemUserID, sysdate, 2);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 25, 'Soiled in Garment Dispenser', systemUserID, sysdate, 2);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 26, 'Outscan/Transfer Stock', systemUserID, sysdate, 2);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 27, 'On-site at Customer', systemUserID, sysdate, 2);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 28, 'Sent to Laundry', systemUserID, sysdate, 4);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 29, 'Returned / In Transit', systemUserID, sysdate, 4);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 30, 'In Scan/Soiled Received', systemUserID, sysdate, 1);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 31, 'Rewash', systemUserID, sysdate, 1);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 32, 'Repair/Mending', systemUserID, sysdate, 3);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 33, 'Checkpoint/Inspection', systemUserID, sysdate, 1);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 34, 'Sorted', systemUserID, sysdate, 1);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 35, 'OR Packing', systemUserID, sysdate, 1);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 36, 'Late Piece', systemUserID, sysdate, 1);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 37, 'Deposit Stock', systemUserID, sysdate, 1);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 38, 'Treatment', systemUserID, sysdate, 1);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 39, 'Bundle Scan', systemUserID, sysdate, 1);

        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 40, 'ON SHELF', systemUserID, sysdate, 2);

        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 41, 'Inscan / Clean Return', systemUserID, sysdate, 1);

        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 42, 'Locker Fed', systemUserID, sysdate, 2);

        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 2, 10, 'InScan', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 2, 20, 'OutScan/At Customer', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 2, 21, 'ON-SITE AT CUSTOMER', systemuserid, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 2, 22, 'Picked Up at Customer', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 2, 23, 'Received from Laundry', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 2, 24, 'Sent to Laundry', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 2, 30, 'Disinfection', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 2, 40, 'OR Load', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 2, 41, 'OR Sterile', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 2, 50, 'Maintenance', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 3, 10, 'Label Printed', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 3, 20, 'OutScan/At Customer', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 3, 30, 'Assemble pack', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 3, 35, 'OR Load', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 3, 40, 'Confirm Sterilization', systemUserID, sysdate, 0);
         insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 3, 45, 'Deposit', systemUserID, sysdate, 0);
         insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 3, 46, 'Transit', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 3, 50, 'Inscan', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 4, 10, 'In Production', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 4, 20, 'At Customer', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 5, 10, 'Inscan/in laundry', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 5, 15, 'Inscan/Returned from Sub Contractor', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 5, 20, 'Outscan/at customer', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 5, 25, '(Send to) Sub Contractor', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 5, 30, 'Checkpoint', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 5, 40, 'Repair', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 5, 50, 'Rewash', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 5, 55, 'Infectious Wash', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 5, 60, 'In Laundry/delayed', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 5, 65, 'Wrongly received', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 5, 70, 'In Laundry/ready for delivery', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 5, 90, 'Not scanned (Label)', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 6, 10, 'New (not scanned)', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 6, 20, 'Scanned at conveyor belt', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 6, 30, 'Received at shipping', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 6, 40, 'Delivered at customer', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 6, 50, 'Picked up at customer', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 6, 60, 'Unloaded from truck', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 6, 70, 'Soil sorted', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 2, 11, 'Manual Count (Exchange Cart)', systemUserID, sysdate, 0);
        insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 2, 42, 'Packing (Exchange Cart)', systemUserID, sysdate, 0);

         insert into stay
          (stay_id,
           staytype,
           staynr,
           factorydescription,
           systemuser_id,
           timestamp,
           location)
        values
          (seq_stay.nextval, 1, 44, 'Rejected from Customer / At Inscan', systemUserID, sysdate, 1);

        insert into stay_desc
          (stay_id, language_id, description, systemuser_id, timestamp)
          select stay_id,
                 languageID,
                 factorydescription,
                 systemuser_id,
                 timestamp
            from stay;
    end;
    -- transaction type (scan)
    begin
      select transactiontype_id
        into id
        from transactiontype
       where transactiontype_id = 0;
    exception
      when no_data_found then
        --
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (0, 'Scan Cancelled', systemUserID, sysdate);
        -- Basic Laundry Scans
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (1, 'In Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (2, 'Out Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (3, 'Repair Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (4, 'Rewash Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (5, 'Late Piece Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (6, 'Checkpoint Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (7, 'Storage Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (8, 'Outscan (from active stock)', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (9, 'Outscan (bulk put up per route)', systemUserID, sysdate);
        -- Put On Stock
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (10, 'Put On Stock New', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (11, 'Record On Stock', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (12,
           'Receive in Stock from Purchase Order',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (13,
           'Undo rag / Put on stock ragged item',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (14,
           'Rejected from Customer Scan',
           systemUserID,
           sysdate);
        -- Returning
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (15, 'Return to Stock', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (16, 'Return to Stock (Assigned)', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (17, 'Image Capture', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (18,
           'Return to stock (Returned by customer)',
           systemUserID,
           sysdate);

        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (19, 'Production Process Scan', systemUserID, sysdate);

        -- Bring In Circulation
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (20, 'In Circ via Direct Issue with WO', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (21,
           'In Circ via Direct Issue without WO',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (22,
           'In Circ via Issue from Stock with WO',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (23,
           'In Circ via Issue from Stock without WO',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (24, 'In Circ by Delivery Assigned Item', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (25,
           'In Circ by Start Date Assigned Item',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (26,
           'In Circ by Record In Use of Assigned Itm',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (27, 'In Circ by re-issuing ragged item', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (28, 'In Circ by Garment Dispenser', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (29,
           'In Circ via InScan make cust owned item',
           systemUserID,
           sysdate);
        -- Assign
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (30, 'Assigned via Direct Issue with WO', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (31,
           'Assigned via Direct Issue without WO',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (32,
           'Assigned via Issue from Stock with WO',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (33,
           'Assigned via Issue from Stock without WO',
           systemUserID,
           sysdate);
        --assign product
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (34, 'Assign Product', systemUserID, sysdate);
        --BF20013075
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (35,
           'Property Start Rent changed by Del Note',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (36, 'Assign and In Circ Via Stack Check', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (37, 'In Circ via Bundle Sort Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (38, 'Stockroom Shipping Scan', systemUserID, sysdate);
        -- Ragging
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (40, 'Ragged from Stock', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (41, 'Ragged from Stock via Batch Rag', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (42, 'Ragged while In Circ.', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (43,
           'Ragged while In Circ. via Batch Rag',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (44, 'Ragged via Stock Correction', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (45, 'Rag by Garment Dispenser', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (47,
           'Ragged while in circ., returned from customer',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (48,
           'Ragged while in circ., returned from customer via Rag in Batch',
           systemUserID,
           sysdate);
        -- Sales
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (50, 'Sold from Stock', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (51, 'Sold while In Circulation', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (53, 'Undo Sales', systemUserID, sysdate);
        -- Return to Supplier
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (54, 'Return to Supplier', systemUserID, sysdate);

        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
         values
           (55, 'Clean Return Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
         values
           (56, 'Season Scan', systemUserID, sysdate);
         insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
         values
           (57, 'Send to Sub Contractor', systemUserID, sysdate);
         insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
         values
           (58, 'Received from Sub Contractor', systemUserID, sysdate);
        -- Production Scan
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (60, 'Sort Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (61, 'Bundle Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (62, 'Deposit Stock Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (63, 'Quality Test Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (64, 'Assemble pack scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (65, 'Stock Inventory Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (66, 'Infectious scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (67, 'Wrong received scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (68, 'Send to Laundry', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (69, 'Received at Customer', systemUserID, sysdate);
        -- Garment Dispenser
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (70, 'Clean in Garment Dispenser', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (71, 'Desk Scan/Issue to Wearer', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (72, 'Out of Garment Dispenser', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (73, 'Soiled in Garment Dispenser', systemUserID, sysdate);
		insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (74, 'Stock Count Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (75, 'Onsite soil scan (PDA)', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (76, 'On-site Inventory Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (77, 'Changed to Customer related', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (78,
           'Changed to Bill to Customer related',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (79, 'Changed to Master Account related', systemUserID, sysdate);
        -- Modify Item Info
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (80, 'Item Properties Changed', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (81, 'Product Changed', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (82, 'Size Changed', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (83, 'Move Wearer', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (84, 'Stock Correction', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (85, 'Changed to customer owned', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (86, 'Changed to laundry owned', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (87, 'Inventory move', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (88, 'Move garment to another customer', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (89,
           'Move garment back to original customer',
           systemUserID,
           sysdate);
        -- Miscellaneous
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (90, 'Replaced ID Code (old)', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (91, 'Replacement ID Code (new)', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (92, 'Made Unique', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (93, 'Move Stock', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (94, 'Move Single Garment', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (95,
           'Outscan via Outscan Work Order in Batch',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (96, 'Bundle Outscan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (97, 'System Generated Outscan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (98, 'Wrong BusinessUnit Scanned', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (99, 'Not Applicable', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (100, 'Flag Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (102, 'Undo Stock Reception from PO', systemUserID, sysdate);
          insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (110, 'Placed in Locker', systemUserID, sysdate);
        ----Stockroom HTS/HOW
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (400,
           'Receive Used Items in Stock from PO',
           systemuserID,
           sysdate);

        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (401, 'Put Used item in stock', systemUserID, sysdate);

        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (402, 'Put Defect item in stock', systemUserID, sysdate);

        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (403, 'Move Defect item to New stock', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (404, 'Move Defect item to Used stock', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (405, 'Move New item to Truck stock', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (406, 'Move Used item to Truck stock', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (407, 'Move New item to Blocked stock', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (408, 'Move Defect item to Blocked stock', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (409, 'Transit-Out via Issue of SDO', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (410, 'Register Picking Items From Stock', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (411, 'Transit-In via internal PO', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (412, 'Undo Pick and Return to Stock', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (414, 'Add To Truck Stock (Correction)', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (415, 'Move New Item From Truck Stock', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (416, 'Move Used Item From Truck Stock', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (417, 'Transit-Out via Shipment List', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (418, 'Transit-In via Shipment List', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (419,
           'Emblems TRANSIT Stock via ShipmentList',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (422,
           'In Circ Via Issue From Truck Stock (WO)',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (423,
           'In Circ Via Issue From Truck Stock (MO)',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (424,
           'In Circ Via Issue From Truck Stock (PN)',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (444,
           'Ragged From Truck Stock (Correction)',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (450, 'Sold From Truck Stock', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (453, 'Sold From Truck Stock With MO', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (454, 'Sold From Truck Stock With PN', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (490, 'Stock value change', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (493,
           'Move Truck Stock(From Truck To Truck)',
           systemUserID,
           sysdate);
        -- Container Recording
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (510, 'In Scan via Soil Weighing', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (511, 'In Scan Empty', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (512, 'In Scan Empty + Tare Check', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (514,
           'In scan Clean Return (Exchange Cart)',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (515, 'In Scan via Item Dispense App', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (520, 'Disinfection Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (521, 'Clean Count (Exchange Cart)', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (530, 'OR Load', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (531, 'OR Sterilize', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (532, 'Start Filling (Exchange Cart)', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (533, 'Put on Hold (Exchange Cart)', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (534, 'Release (Exchange Cart)', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (540, 'Out Scan via Delivery Note', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (541, 'Out Scan via Clean Weighing', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (542, 'Out Scan Empty', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (543, 'Out Scan Empty + Tare Check', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (545, 'outscan / shipping', systemuserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (546, 'On-Site Delivery Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (547, 'Pick Up at Customer', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (548, 'Receive from Laundry', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (549, 'Send to Laundry', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (550, 'Create Container', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (551, 'Exchange Cart', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (560, 'Inactivate Container', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (580, 'Change Container Properties', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (590, 'Replace ID Code (old)', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (591, 'Replacement ID Code (new)', systemUserID, sysdate);
        -- OR Pack transactions
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (600, 'Generate OR Pack label', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (610, 'Assemble pack', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (612, 'Quick Load', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (615, 'Assemble + load pack', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (620, 'Load pack', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (621, 'Cleanroom Charge Scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (630, 'Sterilization - Approved', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (631, 'Sterilization - Rejected', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (632, 'Sterilization - Rejected + cancel', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (633, 'Sterilization - Rejected + unload', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (634, 'Clean Room Batch Reject', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (640, 'Outscan on delivery note', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (645, 'Delivery note cancelled', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (650, 'Used scan', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (660, 'Cancel pack', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (670, 'Recall pack', systemUserID, sysdate);
        -->ABS-5747
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (700, 'Created new', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (701, 'Modify', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (702, 'Conversion', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (703, 'Approved', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (704, 'Contract termination', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (705, 'Contract extension', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (706, 'Contract renewal', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (707, 'Price update', systemUserID, sysdate);
        --<
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (1000, 'Check-in new items', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (1001, 'Check-in used items', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (1005, 'Correct checked-in new items', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (1006, 'Correct checked-in used items', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (1010, 'Make checked-in new items unique', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (1011,
           'Make checked-in used items unique',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (1015,
           'Undo make checked-in new items unique',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (1016,
           'Undo make checked-in used items unique',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (1020, 'Put away checked-in new items', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (1021, 'Put away checked-in used items', systemUserID, sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (1025,
           'Issue WO from checked-in new items',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (1026,
           'Issue WO from checked-in used items',
           systemUserID,
           sysdate);
	insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (1030,
           'Correct received new items from SDO Push',
           systemUserID,
           sysdate);
        insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (1031,
           'Correct received used items from SDO Push',
           systemUserID,
           sysdate);
	insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (1032,
           'Correct received defect items from SDO Push',
           systemUserID,
           sysdate);
	insert into transactiontype
          (transactiontype_id,
           factorydescription,
           systemuser_id,
           timestamp)
        values
          (1033,
           'Cancel expected items from SDO Push',
           systemUserID,
           sysdate);

        insert into transactiontype_desc
          (transactiontype_id,
           language_id,
           description,
           systemuser_id,
           timestamp)
          select transactiontype_id,
                 languageID,
                 factorydescription,
                 systemuser_id,
                 timestamp
            from transactiontype;
    end;
    -- special scans
    insert into specialscans sp
      (specialscans_id,
       transactiontype_id,
       stay_id,
       systemuser_id,
       timestamp)
      select 1,
             6,
             (select s.stay_id
                from stay s
               where s.staytype = 5
                 and s.staynr = 30),
             0,
             sysdate
        from dual;

    insert into specialscans sp
      (specialscans_id,
       transactiontype_id,
       stay_id,
       systemuser_id,
       timestamp)
      select 2,
             5,
             (select s.stay_id
                from stay s
               where s.staytype = 5
                 and s.staynr = 70),
             0,
             sysdate
        from dual;

    insert into specialscans sp
      (specialscans_id,
       transactiontype_id,
       stay_id,
       systemuser_id,
       timestamp)
      select 3,
             4,
             (select s.stay_id
                from stay s
               where s.staytype = 5
                 and s.staynr = 50),
             0,
             sysdate
        from dual;

    insert into specialscans sp
      (specialscans_id,
       transactiontype_id,
       stay_id,
       systemuser_id,
       timestamp)
      select 4,
             66,
             (select s.stay_id
                from stay s
               where s.staytype = 5
                 and s.staynr = 55),
             0,
             sysdate
        from dual;

    insert into specialscans sp
      (specialscans_id,
       transactiontype_id,
       stay_id,
       systemuser_id,
       timestamp)
      select 5,
             67,
             (select s.stay_id
                from stay s
               where s.staytype = 5
                 and s.staynr = 65),
             0,
             sysdate
        from dual;

    insert into specialscans sp
      (specialscans_id,
       transactiontype_id,
       stay_id,
       systemuser_id,
       timestamp)
      select 6,
             57,
             (select s.stay_id
                from stay s
               where s.staytype = 5
                 and s.staynr = 25),
             0,
             sysdate
        from dual;

    insert into specialscans sp
      (specialscans_id,
       transactiontype_id,
       stay_id,
       systemuser_id,
       timestamp)
      select 7,
             58,
             (select s.stay_id
                from stay s
               where s.staytype = 5
                 and s.staynr = 15),
             0,
             sysdate
        from dual;
    -- Sound Configuration
    begin
      select soundconfiguration_id
        into id
        from soundconfiguration
       where categorydescription = 'Scanning';
    exception
      when too_many_rows then
        null;
      when no_data_found then
        insert into soundconfiguration
          (soundconfiguration_id,
           categorydescription,
           eventdescription,
           systemuser_id,
           timestamp,
           sound_id)
        values
          (1, 'Scanning', 'Good Scan', systemUserID, sysdate, null);
        insert into soundconfiguration
          (soundconfiguration_id,
           categorydescription,
           eventdescription,
           systemuser_id,
           timestamp,
           sound_id)
        values
          (2, 'Scanning', 'Error Scan', systemUserID, sysdate, null);
        insert into soundconfiguration
          (soundconfiguration_id,
           categorydescription,
           eventdescription,
           systemuser_id,
           timestamp,
           sound_id)
        values
          (3,
           'Scanning',
           'Good Scan, Delivery from Stock',
           systemUserID,
           sysdate,
           null);
        insert into soundconfiguration
          (soundconfiguration_id,
           categorydescription,
           eventdescription,
           systemuser_id,
           timestamp,
           sound_id)
        values
          (4, 'Scanning', 'Flag', systemUserID, sysdate, null);
        insert into soundconfiguration
          (soundconfiguration_id,
           categorydescription,
           eventdescription,
           systemuser_id,
           timestamp,
           sound_id)
        values
          (5, 'Messages', 'Information', systemUserID, sysdate, null);
        insert into soundconfiguration
          (soundconfiguration_id,
           categorydescription,
           eventdescription,
           systemuser_id,
           timestamp,
           sound_id)
        values
          (6, 'Messages', 'Error', systemUserID, sysdate, null);
        insert into soundconfiguration
          (soundconfiguration_id,
           categorydescription,
           eventdescription,
           systemuser_id,
           timestamp,
           sound_id)
        values
          (7, 'Messages', 'Warning', systemUserID, sysdate, null);
        insert into soundconfiguration
          (soundconfiguration_id,
           categorydescription,
           eventdescription,
           systemuser_id,
           timestamp,
           sound_id)
        values
          (8, 'Messages', 'Question', systemUserID, sysdate, null);
        insert into soundconfiguration
          (soundconfiguration_id,
           categorydescription,
           eventdescription,
           systemuser_id,
           timestamp,
           sound_id)
        values
          (9,
           'Miscellaneous',
           'Process Finished Successfully',
           systemUserID,
           sysdate,
           null);
        insert into soundconfiguration
          (soundconfiguration_id,
           categorydescription,
           eventdescription,
           systemuser_id,
           timestamp,
           sound_id)
        values
          (10,
           'Miscellaneous',
           'Process Finished with Error',
           systemUserID,
           sysdate,
           null);
        insert into soundconfiguration
          (soundconfiguration_id,
           categorydescription,
           eventdescription,
           systemuser_id,
           timestamp,
           sound_id)
        values
          (11,
           'Miscellaneous',
           'New Follow Up Action Request Notification',
           systemUserID,
           sysdate,
           null);
        insert into soundconfiguration
          (soundconfiguration_id,
           categorydescription,
           eventdescription,
           systemuser_id,
           timestamp,
           sound_id)
        values
          (12, 'Scanning', 'Mat Type Changed', systemUserID, sysdate, null);
        insert into soundconfiguration
          (soundconfiguration_id,
           categorydescription,
           eventdescription,
           systemuser_id,
           timestamp,
           sound_id)
        values
          (13,
           'Miscellaneous',
           'Touchscreen Button Pressed',
           systemUserID,
           sysdate,
           null);
        --20011419.80
        INSERT INTO SOUNDCONFIGURATION
          (SOUNDCONFIGURATION_ID,
           CATEGORYDESCRIPTION,
           EVENTDESCRIPTION,
           SYSTEMUSER_ID,
           TIMESTAMP,
           SOUND_ID)
        values
          (14,
           'Scanning',
           'Good Scan, Final Inspection',
           systemUserID,
           SYSDATE,
           NULL);

        INSERT INTO SOUNDCONFIGURATION
          (SOUNDCONFIGURATION_ID,
           CATEGORYDESCRIPTION,
           EVENTDESCRIPTION,
           SYSTEMUSER_ID,
           TIMESTAMP,
           SOUND_ID)
        values
          (15,
           'Scanning',
           'Error Scan, Final Inspection',
           systemUserID,
           SYSDATE,
           NULL);
        --<20011419.80

        --ABS-7281 / 20015872
        insert into soundconfiguration
          (soundconfiguration_id,
           categorydescription,
           eventdescription,
           systemuser_id,
           timestamp,
           sound_id)
        values
          (16,
           'Scanning',
           'Washing Process Change',
           systemUserID,
           sysdate,
           null);
        insert into soundconfiguration
          (soundconfiguration_id,
           categorydescription,
           eventdescription,
           systemuser_id,
           timestamp,
           sound_id)
        values
          (17,
           'Miscellaneous',
           'Right Rail Button Pressed',
           systemUserID,
           sysdate,
           null);
        insert into soundconfiguration
          (soundconfiguration_id,
           categorydescription,
           eventdescription,
           systemuser_id,
           timestamp,
           sound_id)
        values
          (18,
           'Miscellaneous',
           'Wrong Rail Button Pressed',
           systemUserID,
           sysdate,
           null);
    end;

    --SO 20013877
    -- ROUTETRANSACTIONCATEGORY
    begin
      select ROUTETRANSACTIONCATEGORY_ID
        into id
        from ROUTETRANSACTIONCATEGORY;
    exception
      when too_many_rows then
        null;
      when no_data_found then
        INSERT INTO ROUTETRANSACTIONCATEGORY
          SELECT 0, 'No Tab', 'N', 1, SYSDATE FROM DUAL;

        INSERT INTO ROUTETRANSACTIONCATEGORY
          SELECT 1, 'Invoice Adjustments', 'Y', 1, SYSDATE FROM DUAL;

        INSERT INTO ROUTETRANSACTIONCATEGORY
          SELECT 2, 'Orders', 'Y', 1, SYSDATE FROM DUAL;

        INSERT INTO ROUTETRANSACTIONCATEGORY
          SELECT 3, 'Proof of Visit Anomalies', 'N', 1, SYSDATE FROM DUAL;

        INSERT INTO ROUTETRANSACTIONCATEGORY
          SELECT 4, 'Contract Adjustments', 'Y', 1, SYSDATE FROM DUAL;

        INSERT INTO ROUTETRANSACTIONCATEGORY
          SELECT 5, 'Contact Messages', 'N', 1, SYSDATE FROM DUAL;

        INSERT INTO ROUTETRANSACTIONCATEGORY
          SELECT 6, 'Deliver/Pickup Anomalies', 'N', 1, SYSDATE FROM DUAL;

        INSERT INTO ROUTETRANSACTIONCATEGORY
          SELECT 7, 'Container Scans', 'N', 1, SYSDATE FROM DUAL;

        INSERT INTO ROUTETRANSACTIONCATEGORY
          SELECT 8, 'Contact Persons', 'N', 1, SYSDATE FROM DUAL;

        INSERT INTO ROUTETRANSACTIONCATEGORY
          SELECT 9, 'Garment Scans', 'Y', 1, SYSDATE FROM DUAL;
    end;

    begin
      select ROUTETRANSACTIONTYPE_ID into id from ROUTETRANSACTIONTYPE;
    exception
      when too_many_rows then
        null;
      when no_data_found then
        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 100, 'Start Route', 'N', 'N', 0, systemUserID, SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 101, 'End Route', 'N', 'N', 0, systemUserID, SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 102, 'Safety Check', 'N', 'N', 0, systemUserID, SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 103, 'Safety Remarks', 'N', 'N', 0, systemUserID, SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 200, 'Arrive at Stop', 'N', 'N', 0, systemUserID, SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 201,
                 'Depart from Stop',
                 'N',
                 'N',
                 0,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 202,
                 'Undeliverable Stop',
                 'N',
                 'N',
                 0,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 203,
                 'Move Stop Permanent',
                 'N',
                 'N',
                 0,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 204,
                 'Add New Contact Message',
                 'N',
                 'N',
                 5,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 205,
                 'Update Existing Contact Message',
                 'N',
                 'N',
                 5,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 206,
                 'Proof of Visit Scan',
                 'N',
                 'N',
                 3,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 207,
                 'Signature Capture',
                 'N',
                 'N',
                 0,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 208,
                 'Move Stop Temporarily',
                 'N',
                 'N',
                 0,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 209,
                 'Change GPS Coordinates',
                 'N',
                 'N',
                 0,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 212,
                 'Unload (container) Scan',
                 'N',
                 'N',
                 7,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 213,
                 'Return Container Scan',
                 'N',
                 'N',
                 7,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 214,
                 'Add Contact Person',
                 'N',
                 'N',
                 8,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 215,
                 'Edit Contact Person',
                 'N',
                 'N',
                 8,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 216,
                 'Replace Contact Person',
                 'N',
                 'N',
                 8,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

		INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 217,
                 'Combined Move Stop (Permanent and Temporarily)',
                 'N',
                 'N',
                 0,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 220,
                 'Consumption Point Proof of Visit Scan',
                 'N',
                 'N',
                 3,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 300, 'Add Wearer', 'Y', 'N', 2, systemUserID, SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 301, 'Quit Wearer', 'Y', 'N', 2, systemUserID, SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 302,
                 'Add Product Existing Wearer',
                 'Y',
                 'N',
                 2,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 303,
                 'Quit Product Existing Wearer',
                 'Y',
                 'N',
                 2,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 304, 'Style Exchange', 'Y', 'N', 2, systemUserID, SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 305, 'Size Exchange', 'Y', 'N', 2, systemUserID, SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 306,
                 'Decrease Wearer Inventory',
                 'Y',
                 'N',
                 2,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 307,
                 'Increase Wearer Inventory',
                 'Y',
                 'N',
                 2,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 308,
                 'Decrease inventory',
                 'Y',
                 'N',
                 2,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 309,
                 'Increase inventory',
                 'Y',
                 'N',
                 2,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 310, 'One Time Order', 'Y', 'N', 2, systemUserID, SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 311, 'Modify Wearer', 'N', 'N', 2, systemUserID, SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 400,
                 'Change Delivered Qty',
                 'N',
                 'N',
                 6,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 401,
                 'Pick Up Qty (SER)',
                 'N',
                 'N',
                 6,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 402,
                 'Soil Count per Cons. Point',
                 'N',
                 'N',
                 6,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 403,
                 'Soil Count per Soil Ticket',
                 'N',
                 'N',
                 6,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 500, 'Add Product', 'Y', 'Y', 4, systemUserID, SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 501, 'Quit Product', 'Y', 'Y', 4, systemUserID, SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 502, 'Modify Quantity', 'N', 'N', 4, systemUserID, SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 503,
                 'Add Temporary Delivery Stop',
                 'N',
                 'N',
                 4,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

          INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 504,
                 'Modify Product',
                 'Y',
                 'Y',
                 4,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

            INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 505,
                 'Add delivery / collection',
                 'Y',
                 'Y',
                 4,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 506,
                 'Quit delivery / collection day',
                 'Y',
                 'Y',
                 4,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

      INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 507,
                 'Modify delivery / collection',
                 'Y',
                 'Y',
                 4,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 600,
                 'On Site Soil Scan',
                 'N',
                 'N',
                 0,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 601,
                 'Flag unique item',
                 'N',
                 'N',
                 0,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 602,
                 'Mark for replacement',
                 'N',
                 'N',
                 0,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 700, 'Settle Invoice', 'N', 'N', 0, systemUserID, SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 701,
                 'Minus Adjustment',
                 'N',
                 'N',
                 1,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 702, 'Plus Adjustment', 'N', 'N', 1, systemUserID, SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 703,
                 'Loss Charge Invoice Line Adjustment',
                 'N',
                 'N',
                 1,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 704,
                 'Returned Item Invoice Line Adjustment',
                 'N',
                 'N',
                 1,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 750,
                 'Email Statement',
                 'N',
                 'N',
                 0,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 751,
                 'Email Invoice',
                 'N',
                 'N',
                 0,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 752,
                 'Apply Payment',
                 'N',
                 'N',
                 0,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 800,
                 'Scan Garment Place Flag',
                 'N',
                 'N',
                 9,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 801,
                 'Scan Garment Replace',
                 'N',
                 'N',
                 9,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 802,
                 'Scan Garment Rag',
                 'N',
                 'N',
                 9,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 804,
                 'Scan Returned Item',
                 'N',
                 'N',
                 9,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

        INSERT INTO ROUTETRANSACTIONTYPE
          SELECT 805,
                 'Garment Scan Replace Overruled Grade',
                 'Y',
                 'Y',
                 2,
                 systemUserID,
                 SYSDATE
            FROM DUAL;

    end;

    -- automaticflag
    begin
      select automaticflag_id into id from automaticflag;
    exception
      when too_many_rows then
        null;
      when no_data_found then
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (1,
           'Maximum number of washes reached',
           systemUserID,
           sysdate,
           'N',
           'N',
           'Y',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (2,
           'End of norm life time reached, auto replacement',
           systemUserID,
           sysdate,
           'N',
           'Y',
           'Y',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (3,
           'Repair requested by repair pointer',
           systemUserID,
           sysdate,
           'N',
           'Y',
           'Y',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (4,
           'Replacement requested using replacement button',
           systemUserID,
           sysdate,
           'N',
           'N',
           'N',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (5,
           'Return free of charge item',
           systemUserID,
           sysdate,
           'N',
           'N',
           'N',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (6,
           'Every xx washes reached',
           systemUserID,
           sysdate,
           'N',
           'N',
           'Y',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (7,
           'Flag for return to stock due to manual decrease of max inv',
           systemUserID,
           sysdate,
           'Y',
           'N',
           'N',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (8,
           'Quit wearer',
           systemUserID,
           sysdate,
           'Y',
           'N',
           'Y',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (9,
           'End of Season',
           systemUserID,
           sysdate,
           'N',
           'N',
           'N',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (10,
           'Start of Season',
           systemUserID,
           sysdate,
           'N',
           'N',
           'N',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (11,
           'Missing emblem',
           systemUserID,
           sysdate,
           'N',
           'Y',
           'Y',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (12,
           'Substitute garment',
           systemUserID,
           sysdate,
           'N',
           'N',
           'N',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (13,
           'Quit Mat',
           systemUserID,
           sysdate,
           'Y',
           'N',
           'Y',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (14,
           'Charged for Loss',
           systemUserID,
           sysdate,
           'N',
           'N',
           'N',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (15,
           'Temporary wearer inventory rent stop',
           systemUserID,
           sysdate,
           'N',
           'N',
           'N',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (16,
           'Decrease max inv. after return to stock items with this flag',
           systemUserID,
           sysdate,
           'Y',
           'Y',
           'Y',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (17,
           'Product contract ended for customer',
           systemUserID,
           sysdate,
           'N',
           'Y',
           'Y',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (18,
           'Customer no longer active',
           systemUserID,
           sysdate,
           'N',
           'N',
           'Y',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (19,
           'Rewash',
           systemUserID,
           sysdate,
           'Y',
           'Y',
           'Y',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (20,
           'Show on replaced item before replacement is active',
           systemUserID,
           sysdate,
           'N',
           'N',
           'N',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (21,
           'Saving changed wearer data',
           systemUserID,
           sysdate,
           'Y',
           'Y',
           'Y',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (22,
           'Rewashed',
           systemUserID,
           sysdate,
           'Y',
           'Y',
           'Y',
           4);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (23,
           'Garment Dispenser',
           systemUserID,
           sysdate,
           'Y',
           'Y',
           'Y',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (24,
           'Quit Wearer Inventory',
           systemUserID,
           sysdate,
           'Y',
           'N',
           'Y',
           1);
        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (25,
           'Direct Sales Only',
           systemUserID,
           sysdate,
           'Y',
           'N',
           'N',
           1);

        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (26,
           'Returned',
           systemUserID,
           sysdate,
           'N',
           'N',
           'Y',
           1);

        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (27,
           'Maximum Number of Repairs',
           systemUserID,
           sysdate,
           'N',
           'Y',
           'Y',
           1);

        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (28,
           'Lost And Found',
           systemUserID,
           sysdate,
           'N',
           'N',
           'N',
           1);

        insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (29,
           'Repair requested by Web',
           systemUserID,
           sysdate,
           'N',
           'Y',
           'Y',
           1);

       insert into automaticflag
          (automaticflag_id,
           event,
           systemuser_id,
           timestamp,
           selectable,
           deletable,
           transferable,
           flagtype)
        values
          (30,
           'Repair',
           systemUserID,
           sysdate,
           'Y',
           'Y',
           'Y',
           4);
    end;

    -- size '*'
    begin
      select sizedefinition_id
        into id
        from sizedefinition
       where code = '*';
    exception
      when no_data_found then
        insert into sizedefinition
          (sizedefinition_id,
           code,
           unfinishedlength,
           usedforemblem,
           systemuser_id,
           timestamp)
        values
          (seq_sizedefinition.nextval,
           '*',
           'N',
           'N',
           systemUserID,
           sysdate);
        insert into sizedefinition_desc
          (sizedefinition_id,
           language_id,
           description,
           systemuser_id,
           timestamp)
        values
          (seq_sizedefinition.currval,
           languageID,
           'All',
           systemUserID,
           sysdate);

        insert into sizedefinition_link
          (sizedefinition_link_id,
           sizedefinition_id,
           code,
           systemuser_id,
           timestamp)
        values
          (seq_sizedefinition.currval,
           seq_sizedefinition.currval,
           '*',
           systemUserID,
           sysdate);
        insert into sizedefinition_link_desc
          (sizedefinition_link_id,
           language_id,
           description,
           systemuser_id,
           timestamp)
        values
          (seq_sizedefinition.currval,
           languageID,
           'All',
           systemUserID,
           sysdate);
    end;

    -- label print engine
    begin
      select labelprintengine_id
        into id
        from labelprintengine
       where labelprintengine_id = 1;
    exception
      when no_data_found then
        insert into labelprintengine
          (labelprintengine_id, description, systemuser_id, timestamp)
        values
          (1, 'Spark', systemUserID, sysdate);
        insert into labelprintengine
          (labelprintengine_id, description, systemuser_id, timestamp)
        values
          (2, 'Labserv', systemUserID, sysdate);
        insert into labelprintengine
          (labelprintengine_id, description, systemuser_id, timestamp)
        values
          (3, 'Label Designer', systemUserID, sysdate);
    end;

    -- days
    dayCode(1) := 'MO';
    dayDesc(1) := 'Monday';
    dayCode(2) := 'TU';
    dayDesc(2) := 'Tuesday';
    dayCode(3) := 'WE';
    dayDesc(3) := 'Wednesday';
    dayCode(4) := 'TH';
    dayDesc(4) := 'Thursday';
    dayCode(5) := 'FR';
    dayDesc(5) := 'Friday';
    dayCode(6) := 'SA';
    dayDesc(6) := 'Saturday';
    dayCode(7) := 'SU';
    dayDesc(7) := 'Sunday';
    for i in 1 .. 7 loop
      begin
        select day_id into dayID from day where daynumber = i;
      exception
        when no_data_found then
          insert into day
            (day_id, daynumber, systemuser_id, timestamp)
          values
            (i, i, systemUserID, sysdate);
          insert into day_desc
            (day_id,
             language_id,
             code,
             description,
             systemuser_id,
             timestamp)
          values
            (i, languageID, dayCode(i), dayDesc(i), systemUserID, sysdate);
      end;
    end loop;

    -- processes
    begin
      select process_id into id from process where process_id = 1;
    exception
      when no_data_found then
        insert into process
          (process_id, description, active)
        values
          (1, 'Status Quo Pieces in Circulation', 'Y');
        insert into process
          (process_id, description, active)
        values
          (2, 'Status Quo Sets in Circulation', 'Y');
        insert into process
          (process_id, description, active)
        values
          (3, 'Status Quo Wearers', 'Y');
        insert into process
          (process_id, description, active)
        values
          (4, 'Status Quo Stockroom Quantity', 'Y');
        insert into process
          (process_id, description, active)
        values
          (5, 'Status Quo Residual Value', 'Y');
        insert into process
          (process_id, description, active)
        values
          (6, 'Status Quo Circulating Inventory', 'Y');
        insert into process
          (process_id, description, active)
        values
          (7, 'Status Quo Max Items in Circulation', 'Y');
        insert into process
          (process_id, description, active)
        values
          (12, 'Put Assigned items into circulation', 'Y');
        insert into process
          (process_id, description, active)
        values
          (13, 'Flag items beyound contract weeks for replacement', 'Y');
        insert into process
          (process_id, description, active)
        values
          (14, 'Import stock counts from handheld terminal', 'Y');
        insert into process
          (process_id, description, active)
        values
          (15, 'Price Update at Anniversary Date', 'Y');
        insert into process
          (process_id, description, active)
        values
          (16, 'Import from EASy & MobiDiK', 'Y');
        insert into process
          (process_id, description, active)
        values
          (17, 'Export info for Line Cards', 'Y');
        insert into process
          (process_id, description, active)
        values
          (18, 'Import soil counts', 'Y');
        insert into process
          (process_id, description, active)
        values
          (19, 'Export info to Garment Dispenser', 'Y');
        insert into process
          (process_id, description, active)
        values
          (20, 'Import info from Garment Dispenser', 'Y');
        insert into process
          (process_id, description, active)
        values
          (21, 'Email Invoices', 'Y');
        insert into process
          (process_id, description, active)
        values
          (22, 'Email Statements', 'Y');
        insert into process
          (process_id, description, active)
        values
          (23, 'Status Quo Leasing', 'Y');
        insert into process
          (process_id, description, active)
        values
          (24, 'Status Quo Stock Charge', 'Y');
        insert into process
          (process_id, description, active)
        values
          (25, 'E-mail Direct Invoices', 'Y');
        insert into process
          (process_id, description, active)
        values
          (26, 'Fax Invoices', 'Y');
        insert into process
          (process_id, description, active)
        values
          (27, 'Fax Statements', 'Y');
        insert into process
          (process_id, description, active)
        values
          (28, 'Fax Direct Invoices', 'Y');
        insert into process
          (process_id, description, active)
        values
          (29, 'Automatic Flag Seasonal Items', 'Y');
        insert into process
          (process_id, description, active)
        values
          (30, 'Status Quo On Site Inventory', 'Y');
        insert into process
          (process_id, description, active)
        values
          (31, 'Rag after Grace Period', 'Y');
        insert into process
          (process_id, description, active)
        values
          (32, 'Sort Batch Preparation', 'Y');
        insert into process
          (process_id, description, active)
        values
          (33, 'Clean Up Garment Scans', 'Y');
        insert into process
          (process_id, description, active)
        values
          (34, 'Clean Up Container Scans', 'Y');
        insert into process
          (process_id, description, active)
        values
          (35, 'Generate Turnover Forecast', 'Y');
        insert into process
          (process_id, description, active)
        values
          (36, 'Generate Cost Information', 'Y');
        insert into process
          (process_id, description, active)
        values
          (37, 'Internal Value Calculation', 'Y');
        insert into process
          (process_id, description, active)
        values
          (38, 'Clean Up Status Quo Information', 'Y');
        insert into process
          (process_id, description, active)
        values
          (39, 'Compress Status Quo Items and Sets in Circulation', 'Y');
        insert into process
          (process_id, description, active)
        values
          (40, 'Import Account Receivable Late charge', 'Y');
        insert into process
          (process_id, description, active)
        values
          (41, 'Export Account Receivable Customer Information', 'Y');
        insert into process
          (process_id, description, active)
        values
          (42, 'Export Account Receivable Information', 'Y');
        insert into process
          (process_id, description, active)
        values
          (43, 'Flag Items with Temp. Wearer Inventory Rent Stop', 'Y');
        insert into process
          (process_id, description, active)
        values
          (44, 'Import Payment Conditions from Axapta', 'Y');
        insert into process
          (process_id, description, active)
        values
          (45, 'Import Work Orders from Axapta', 'Y');
        insert into process
          (process_id, description, active)
        values
          (46, 'Export Invoices to Axapta', 'Y');
        insert into process
          (process_id, description, active)
        values
          (47, 'Export Stock Transactions', 'Y');
        insert into process
          (process_id, description, active)
        values
          (48, 'Automatic disable soil count/product when no recent soil count', 'Y');
        insert into process
          (process_id, description, active)
        values
          (49, 'Import Products from Axapta', 'Y');
        insert into process
          (process_id, description, active)
        values
          (50, 'Move Garments to Original Customer', 'Y');
        insert into process
          (process_id, description, active)
        values
          (51, 'Calculate Commission', 'Y');
        insert into process
          (process_id, description, active)
        values
          (52, 'Export to DocuWare', 'Y');
        insert into process
          (process_id, description, active)
        values
          (53, 'Average Calculation Standard Deliveries', 'Y');
        insert into process
          (process_id, description, active)
        values
          (54, 'Export to Cobra', 'Y');
        insert into process
          (process_id, description, active)
        values
          (55, 'Export Invoices to Stralfors', 'Y');
        insert into process
          (process_id, description, active)
        values
          (56, 'Process Wearer Garments Budgets', 'Y');
        insert into process
          (process_id, description, active)
        values
          (57, 'Process Export EDI-OIO', 'Y');
        insert into process
          (process_id, description, active)
        values
          (58, 'Export POS Customers', 'Y');
        insert into process
          (process_id, description, active)
        values
          (59, 'Export POS Invoices', 'Y');
        insert into process
          (process_id, description, active)
        values
          (60, 'Export POS Purchase Orders', 'Y');
        insert into process
          (process_id, description, active)
        values
          (61, 'Export POS Receipts', 'Y');
        insert into process
          (process_id, description, active)
        values
          (62, 'Process Export Invoices Daily System', 'Y');
        insert into process
          (process_id, description, active)
        values
          (63, 'Import POS Payments', 'Y');
        insert into process
          (process_id, description, active)
        values
          (64, 'Update Contract prices', 'Y');
        insert into process
          (process_id, description, active)
        values
          (65, 'Automatic Contract Extension', 'Y');
        insert into process
          (process_id, description, active)
        values
          (66, 'Import Orders', 'Y');
        insert into process
          (process_id, description, active)
        values
          (67, 'Import HL7 Connections', 'Y');
        insert into process
          (process_id, description, active)
        values
          (68, 'Export to delivery notes', 'Y');
        insert into process
          (process_id, description, active)
        values
          (69, 'Process Import DW', 'Y');
        insert into process
          (process_id, description, active)
        values
          (70, 'Clean up web service log', 'Y');
        insert into process
          (process_id, description, active)
        values
          (71, 'Reference SQ Items in circulation', 'Y');
        insert into process
          (process_id, description, active)
        values
          (72, 'Reference SQ Mats in circulation', 'Y');
        insert into process
          (process_id, description, active)
        values
          (73, 'Generate Internal Stock Delivery Orders', 'Y');
        insert into process
          (process_id, description, active)
        values
          (74, 'Clean up delivery scans', 'Y');
        insert into process
          (process_id, description, active)
        values
          (75, 'Invoice Job', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('76', 'Check Mounting Order Availability', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('77', 'Export Indaut', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('78', 'Import scans Indaut', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('79', 'Import soil scans', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('80', 'Automatic Billing', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('81', 'Import Route Info from PDS', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('82', 'Clean up Log', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('83', 'Collect HTS Financial Stock Transactions', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('84', 'Export HTS Financial Stock Transactions', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('85', 'Settle Web Catalog Routes', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('86', 'Clean up wearers', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('87', 'Revenue Growth Calculation', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('88', 'AR Snapshot', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('90', 'User defined database script', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('91', 'Export Invoices To Etra', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('92', 'Import WMU Web Sales', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('93', 'Export WMU Web Sales', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('94', 'Export Invoices To Itella', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('95', 'Clean Up Historical Invoice Data', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('96', 'Import LCT transactions', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('97', 'Generic purge', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('98', 'Export Credit Card transactions for authorization and capture','Y');
        insert into process
          (process_id, description, active)
        values
          ('99', 'Import Credit Card Transactions authorization and capture results','Y');
        insert into process
          (process_id, description, active)
        values
          ('100', 'Send email with PDF delivery notes in attachment', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('101', 'Send email with PDF consignment notes in attachment','Y');
        insert into process
          (process_id, description, active)
        values
          ('102', 'Inactivate Customer Delivery Schemes', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('103', 'Print Pick Orders', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('104', 'Loss for pool', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('105', 'Generate finance charges', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('106', 'Generate and print monthly statements', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('107', 'Export Invoices (Postings) to GP', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('108', 'Export Invoices (PDF)', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('109', 'Import Customers on Hold from GP', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('110', 'Import Sales Item Cost from GP', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('111', 'Import Direct Sales Item from GP', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('112', 'Export Dispatched Sales Items to GP', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('113', 'Export Invoices for External Printing', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('114','Generate finance charges and generate and print monthly statements', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('115', 'Email POD', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('116', 'Fill Size Ratio for size breakdown', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('117', 'PDF Archiving', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('118', 'Update Delivery Variations Delivery Date LLG', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('119', 'Scrutiny', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('120', 'Determine Slow and Fast Movers per Stockroom', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('121', 'COMPLETE WEIGHINGTICKETS', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('122', 'Add OR Delivery Variations to Existing Packing Notes', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('123', 'Auto Complete Cleanroom Charges', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('124', 'Status Quo Historic Residual value', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('125', 'Import Contract Purchase Orde', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('126', 'Delivered Quantities Planned Data', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('127', 'Recalculate Norm Stock', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('128', 'Recalculate Standard Deliveries', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('129', 'Fill Weight Based Delivery History', 'Y');
        insert into process
          (process_id, description, active)
        values
          (130, 'Send Container Usage Report by E-mail', 'Y');
        insert into process
          (process_id, description, active)
        values
          (131, 'Import Perl Stock Counts', 'Y');
        insert into process
          (process_id, description, active)
        values
          (132, 'Delivery Efficiency Check', 'Y');
        insert into process
          (process_id, description, active)
        values
          (133, 'Charge to Product Weekly', 'Y');
        insert into process
          (process_id, description, active)
        values
          (134, 'Charge to Product Daily', 'Y');
        insert into process
          (process_id, description, active)
        values
          (135, 'Close remit batch portal', 'Y');
        insert into process
          (process_id, description, active)
        values
          (136, 'Production Process Buffer Snapshot', 'Y');
        insert into process
          (process_id, description, active)
        values
          (137, 'Settle Subcontractor Routes', 'Y');
        insert into process
          (process_id, description, active)
        values
          (138, 'Send Client Invoices by Email', 'Y');
        insert into process
          (process_id, description, active)
        values
          (139, 'Fill Delivery Average', 'Y');
        insert into process
          (process_id, description, active)
        values
          (140, 'Create Residential Inscan', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('141', 'Chipping Rate Standard', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('142', 'Chipping Rate Stock Level', 'Y');
        insert into process
          (process_id, description, active)
        values
          (143, 'Automatic renewal of periodical free-of-charge adjustments', 'Y');
        insert into process
          (process_id, description, active)
        values
          ('144', 'Send document via email', 'Y');
		insert into process
          (process_id, description, active)
        values
          ('145', 'Settle Credit Card Transactions EBizCharge Gateway', 'Y');
     insert into process
       (process_id, description, active)
     values
       ('146', 'Hungarian Tax Export', 'Y');
    insert into process
       (process_id, description, active)
     values
       (147, 'Generate finance charges and statements (no printing)', 'Y');
    end;

    -- residual value scheme '-'
    begin
      select residualvaluescheme_id
        into id
        from residualvaluescheme
       where code = '-';
    exception
      when no_data_found then
        insert into residualvaluescheme
          (residualvaluescheme_id,
           code,
           calculationweeks,
           calculationbasis,
           systemuser_id,
           timestamp)
        values
          (seq_residualvaluescheme.nextval,
           '-',
           0,
           1,
           systemUserID,
           sysdate);
        insert into residualvaluescheme_desc
          (residualvaluescheme_id,
           language_id,
           description,
           systemuser_id,
           timestamp)
        values
          (seq_residualvaluescheme.currval,
           languageID,
           '-',
           systemUserID,
           sysdate);
    end;
    -- quality grade
    begin
      select q.qualitygrade_id
        into id
        from qualitygrade q
       where q.code = 'N';
    exception
      when no_data_found then
        insert into qualitygrade
          (qualitygrade_id,
           code,
           priority,
           defaultqualitygrade,
           newgarment,
           minwashes,
           maxwashes,
           minweeksinuse,
           maxweeksinuse,
           systemuser_id,
           timestamp)
        values
          (seq_qualitygrade.nextval,
           'N',
           1,
           'N',
           'Y',
           0,
           999,
           0,
           999,
           systemUserID,
           sysdate);
        insert into qualitygrade_desc
          (qualitygrade_id,
           language_id,
           description,
           systemuser_id,
           timestamp)
        values
          (seq_qualitygrade.currval,
           languageID,
           'New',
           systemUserID,
           sysdate);

        insert into qualitygrade
          (qualitygrade_id,
           code,
           priority,
           defaultqualitygrade,
           newgarment,
           minwashes,
           maxwashes,
           minweeksinuse,
           maxweeksinuse,
           systemuser_id,
           timestamp)
        values
          (seq_qualitygrade.nextval,
           'U',
           2,
           'Y',
           'N',
           0,
           999,
           0,
           999,
           systemUserID,
           sysdate);
        insert into qualitygrade_desc
          (qualitygrade_id,
           language_id,
           description,
           systemuser_id,
           timestamp)
        values
          (seq_qualitygrade.currval,
           languageID,
           'Used',
           systemUserID,
           sysdate);
    end;

    -- convertproducttablelist
    delete from CONVERTPRODUCTTABLELIST;
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('DELIVERYVARIATIONS', 1);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('GENERALRENTDISCOUNT', 1);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('GENERALRENTPRICE', 1);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('GENERALWASHDISCOUNT', 1);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('GENERALWASHPRICE', 1);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('PACKINGNOTELINE', 1);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('PRODUCTLISTPERCUSTOMER', 1);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('PRODUCTLISTPERDISTRIBPOINT', 1);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('SOILTICKETLINE', 1);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('UNIQUEITEM', 1);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('WEARERINVENTORY', 1);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('GENERALEMBLEMPRICE', 2);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('GENERALREPLACEMENTPRICE', 2);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('GENERALSALESPRICE', 2);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('CUSTOMERREPLACEMENTPRICE', 2);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('CUSTOMERSALESPRICE', 2);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('PACKCONTENTS', 2);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('WORKORDERLINEEMBLEM', 2);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('WORKORDERLINE', 3);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('DELIVERYSCAN', 3);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('INTERNETORDERLINE', 3);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('INVOICELINEPRODUCT', 3);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('PACKINGNOTELINECONTENT', 1);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('PURCHASEORDERLINE', 4);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('SOILCOUNTLINE', 3);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('STANDARDINVENTORY', 5);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('STANDARDLOCATIONPERPRODUCT', 5);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('STOCKDEFINITIONPERITEM', 2);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('STRAIGHTEVENRETURN', 1);
    insert into CONVERTPRODUCTTABLELIST
      (TABLENAME, TABLETYPE)
    values
      ('UNRELATEDLOAN', 2);
    insert into convertproducttablelist
      (tablename, tabletype)
    values
      ('DELIVERYHISTORY', 3);
    insert into convertproducttablelist
      (tablename, tabletype)
    values
      ('SQITEMINCIRCULATION', 3);
    insert into convertproducttablelist
      (tablename, tabletype)
    values
      ('SQSETINCIRCULATION', 3);
    insert into convertproducttablelist
      (tablename, tabletype)
    values
      ('SOILREASONABILITY', 3);
    insert into convertproducttablelist
      (tablename, tabletype)
    values
      ('EMBLEMHISTORY', 4);
    insert into convertproducttablelist
      (tablename, tabletype)
    values
      ('GARMENTSALESHISTORY', 4);
    insert into convertproducttablelist
      (tablename, tabletype)
    values
      ('ISSUEHISTORY', 4);
    insert into convertproducttablelist
      (tablename, tabletype)
    values
      ('OUTOFCIRCULATIONHISTORY', 4);
    insert into convertproducttablelist
      (tablename, tabletype)
    values
      ('OUTOFSTOCKHISTORY', 4);
    insert into convertproducttablelist
      (tablename, tabletype)
    values
      ('PRINTQUEUE', 4);
    insert into convertproducttablelist
      (tablename, tabletype)
    values
      ('RAGGEDITEM', 4);
    insert into convertproducttablelist
      (tablename, tabletype)
    values
      ('RECEIVEINSTOCKHISTORY', 4);
    insert into convertproducttablelist
      (tablename, tabletype)
    values
      ('SCAN', 4);
    insert into convertproducttablelist
      (tablename, tabletype)
    values
      ('SOILHISTORY', 4);
    insert into convertproducttablelist
      (tablename, tabletype)
    values
      ('SQSTOCKQUANTITY', 4);
    insert into convertproducttablelist
      (tablename, tabletype)
    values
      ('REPAIRHISTORY', 6);

    -- paymentterms
    insert into paymentterms
      (paymentterms_id,
       code,
       active,
       defaultpaymentterm,
       discountdays,
       netpaymentdays,
       discountdays2,
       paymentdiscount,
       paymentdiscount2,
       systemuser_id,
       timestamp)
    values
      (seq_paymentterms.nextval,
       '-',
       'Y',
       'Y',
       0,
       0,
       0,
       0,
       0,
       systemUserID,
       sysdate);

    -- supplier
    insert into address
      (address_id,
       street,
       zipcode,
       city,
       state,
       county,
       systemuser_id,
       timestamp)
    values
      (seq_address.nextval, '-', '-', '-', '-', '-', systemUserID, sysdate);
    insert into supplier
      (supplier_id,
       suppliernumber,
       name,
       address_id,
       currency_id,
       country_id,
       averageshipmentcosts,
       sendpurchaseorder,
       printpriceonpo,
       discountpercdays,
       discountwithindays,
       discountpercoverall,
       filelayout,
       shipmenttype_id,
       systemuser_id,
       timestamp)
    values
      (seq_supplier.nextval,
       0,
       '-',
       seq_address.currval,
       (select currency_id from currency where code = '-'),
       (select country_id from country where code = '-'),
       0,
       1,
       'Y',
       0,
       0,
       0,
       0,
       null,
       systemUserID,
       sysdate);

    -- taxgroup
    insert into taxgroup
      (taxgroup_id,
       code,
       description,
       active,
       taxrate,
       oldtaxrate,
       startdatetaxrate,
       country_id,
       systemuser_id,
       timestamp)
    values
      (seq_taxgroup.nextval,
       '-',
       '-',
       'Y',
       0,
       0,
       sysdate,
       (select country_id from country where code = '-'),
       systemUserID,
       sysdate);

    -- plant invoice frequency

    -- db consistency check

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (1,
       'All debtors have CustomerBillingInfo records',
       'select d.customer_id debtor_id, d.customernumber debtornumber, c.customer_id customer_id, c.customernumber customernumber' ||
       chr(10) || 'from customer c, customer d' || chr(10) ||
       'where c.debtor_id = d.customer_id' || chr(10) ||
       'and not exists(select b.customer_id from customerbillinginfo b where d.customer_id= b.customer_id)',
       'There are debtors without CustomerBillingInfo records!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (2,
       'Invoice address does not exists for Customer or Debtor ',
       'select c.customer_id customerid, c.customernumber customernumber,' ||
       chr(10) || ' d.customer_id debtorid, d.customernumber debtornumber' ||
       chr(10) || 'from customer c, customer d' || chr(10) ||
       'where c.debtor_id = d.customer_id' || chr(10) ||
       'and c.invoiceaddress_id is  null' || chr(10) ||
       'and d.invoiceaddress_id is  null',
       'There should be at least one invoice address defined for customer and debtor!',
       'N',
       'Please define invoiceaddress on customer level or debtor level!',
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (3,
       'Customers that are not debtors don''t have CustomerBillingInfo records',
       'select c.customer_id customerid, c.customernumber customernumber, c.debtor_id debtorid' ||
       chr(10) || 'from customer c, customerbillinginfo b' || chr(10) ||
       'where c.customer_id = b.customer_id' || chr(10) ||
       'and not exists (select cc.customer_id from customer cc, customer d' ||
       chr(10) || 'where cc.debtor_id = d.customer_id' || chr(10) ||
       'and cc.debtor_id = c.customer_id)',
       'Customers that are not debtors should not have CustomerBillingInfo records',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (4,
       'Products from productlistpercustomer has corresponding records in productgroups per customer',
       'select a.productlistpercustomer_id, a.product_id, b.code, b.productgroup_id' ||
       chr(10) || 'from productlistpercustomer a, product b' || chr(10) ||
       'where a.product_id = b.product_id ' || chr(10) ||
       'and a.dateinactive = to_date(''31.12.2099 '','' dd.mm.yyyy '')' ||
       chr(10) || ' and not exists (select pgpc.productgroup_id ' ||
       chr(10) || 'from productgrouppercustomer pgpc ' || chr(10) ||
       'where pgpc.customer_id = a.customer_id and ' || chr(10) ||
       'pgpc.productgroup_id = b.productgroup_id) ',
       'There are productlistpercustomer records with products that do not have productgroups in productgrouppercustomer table',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (5,
       'Correspondence plpc billingmethod with type of merchandise',
       'select a.productlistpercustomer_id,(select cu.customernumber  from customer cu where cu.customer_id = a.customer_id) customernumber,
        a.billingmethod, a.changesperweek, b.product_id, b.code,
        (select sz.code from sizedefinition sz where sz.sizedefinition_id = a.sizedefinition_id) SizedefinitionCode,
        (select fm.code from finishingmethod fm where fm.finishingmethod_id = a.finishingmethod_id) finishingmethodCode,
        b.typeofmerchandise, a.dateactive, a.dateinactive' || chr(10) ||
       'from productlistpercustomer a, product b' || chr(10) ||
       'where a.product_id = b.product_id' || chr(10) ||
       'and not exists (select plpc.productlistpercustomer_id' || chr(10) ||
       'from productlistpercustomer plpc, product p' || chr(10) ||
       'where plpc.customer_id = a.customer_id and ' || chr(10) ||
       'plpc.product_id = a.product_id and ' || chr(10) ||
       ' plpc.dateactive = a.dateactive and ' || chr(10) ||
       ' plpc.dateinactive = a.dateinactive and ' || chr(10) ||
       ' plpc.product_id = p.product_id' || chr(10) || 'and (' || chr(10) ||
       '(plpc.billingmethod = 1 and ' || chr(10) || '(' || chr(10) ||
       '(plpc.changesperweek = ''N''and p.typeofmerchandise in(1,2)) or' ||
       chr(10) ||
       '(plpc.changesperweek = ''Y''and p.typeofmerchandise = 2)' ||
       chr(10) || ')' || chr(10) || ')' || chr(10) ||
       'or (plpc.billingmethod = 2 and p.typeofmerchandise in (1,2))' ||
       chr(10) ||
       'or (plpc.billingmethod = 3 and p.typeofmerchandise in (1,2))' ||
       chr(10) ||
       'or (plpc.billingmethod = 4 and p.typeofmerchandise in (1,2,3,5))' ||
       chr(10) || 'or (plpc.billingmethod = 5 and (' || chr(10) ||
       '(plpc.changesperweek = ''N''and p.typeofmerchandise in(1,2)) or' ||
       chr(10) ||
       '(plpc.changesperweek = ''Y''and p.typeofmerchandise = 2)' ||
       chr(10) || '))' || chr(10) || '))',
       'There are wrong combination of billingmethod with type of merchandise in product list per customer records!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (6,
       'CUSTOMER_LINK table is correctly filled',
       'select customernumber, name custName, customer_id, timestamp' ||
       chr(10) || 'from customer a' || chr(10) ||
       'where not exists (select x.customer_id from customer_link x ' ||
       chr(10) || '                  where x.customer_id = a.customer_id)' ||
       chr(10) || 'order by 1' || chr(9) || '' || chr(9) || '' || chr(9) || '' ||
       chr(9) || '' || chr(9) || '' || chr(9) || '' || chr(9) || '' ||
       chr(9) || '' || chr(9) || '',
       'There are records in CUSTOMER table with no related record in CUSTOMER_LINK table!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (7,
       'DEPARTMENT_LINK table is correctly filled',
       'select b.customernumber, b.name customerName, departmentnumber, a.description departmentDesc, department_id, a.timestamp' ||
       chr(10) || 'from department a, customer b' || chr(10) ||
       'where a.customer_id = b.customer_id and' || chr(10) ||
       '      not exists (select x.department_id from department_link x where x.department_id = a.department_id)' ||
       chr(10) || 'order by 1, 3',
       'There are records in DEPARTMENT table with no related record in DEPARTMENT_LINK table!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (8,
       'DISTRIBUTIONPOINT_LINK table is correctly filled',
       'select customernumber, c.name customerName, departmentnumber, distributionpointnumber, distributionpoint_id, a.timestamp' ||
       chr(10) || 'from distributionpoint a, department b, customer c' ||
       chr(10) || 'where a.department_id = b.department_id and' || chr(10) ||
       '      b.customer_id = c.customer_id and' || chr(10) ||
       '      not exists (select x.distributionpoint_id from distributionpoint_link x where x.distributionpoint_id = a.distributionpoint_id)' ||
       chr(10) || 'order by 1, 3, 4',
       'There are records in DISTRIBUTIONPOINT table with no related record in DISTRIBUTIONPOINT_LINK table!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (9,
       'COSTCENTER_LINK table is correctly filled',
       'select customernumber, c.name customerName, a.code costCenterCode, a.description costCenterDesc, costcenter_id, a.timestamp' ||
       chr(10) || 'from costcenter a, customer c' || chr(10) ||
       'where a.customer_id = c.customer_id and' || chr(10) ||
       '      not exists (select x.costcenter_id from costcenter_link x where a.costcenter_id = x.costcenter_id)' ||
       chr(10) || 'order by 1, 3',
       'There are records in COSTCENTER table with no related record in COSTCENTER_LINK table!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (10,
       'DELIVERYPOINT_LINK table is correctly filled',
       'select customernumber, c.name customerName, a.code deliveryPointCode, a.description deliveryPointDesc, deliverypoint_id, a.timestamp' ||
       chr(10) || 'from deliverypoint a, customer c' || chr(10) ||
       'where a.customer_id = c.customer_id and' || chr(10) ||
       '      not exists (select x.deliverypoint_id from deliverypoint_link x where a.deliverypoint_id = x.deliverypoint_id)' ||
       chr(10) || 'order by 1, 3',
       'There are records in DELIVERYPOINT table with no related record in DELIVERYPOINT_LINK table!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (11,
       'PRODUCT_LINK table is correctly filled',
       'select a.code productCode, product_id, a.timestamp' || chr(10) ||
       'from product a' || chr(10) ||
       'where not exists (select x.product_id from product_link x where x.product_id = a.product_id)' ||
       chr(10) || 'order by 1',
       'There are records in PRODUCT table with no related record in PRODUCT_LINK table!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (12,
       'SIZEDEFINITION_LINK table is correctly filled',
       'select code sizeDefinitionCode, sizedefinition_id, timestamp' ||
       chr(10) || 'from sizedefinition a' || chr(10) ||
       'where not exists (select x.sizedefinition_id from sizedefinition_link x where x.sizedefinition_id = a.sizedefinition_id)' ||
       chr(10) || 'order by 1',
       'There are records in SIZEDEFINITION table with no related record in SIZEDEFINITION_LINK table!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (13,
       'WEAREREMPLOYMENT_LINK table is correctly filled',
       'select customernumber, c.name customerName, wearernumber, b.fullname wearerName, a.sequencenumber employment, weareremployment_id, a.timestamp' ||
       chr(10) || 'from weareremployment a, wearer b, customer c' ||
       chr(10) || 'where a.wearer_id = b.wearer_id and' || chr(10) || '' ||
       chr(9) || '' || chr(9) || '' || chr(9) ||
       'b.customer_id = c.customer_id and' || chr(10) ||
       '      not exists (select x.weareremployment_id from weareremployment_link x where x.weareremployment_id = a.weareremployment_id)' ||
       chr(10) || 'order by 1, 3, 5',
       'There are records in WEAREREMPLOYMENT table with no related record in WEAREREMPLOYMENT_LINK table!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (14,
       'WEIGHINGCATEGORY_LINK table is correctly filled',
       'select code weighingCategoryCode, weighingcategory_id, timestamp' ||
       chr(10) || 'from weighingcategory a' || chr(10) ||
       'where not exists (select x.weighingcategory_id from weighingcategory_link x where x.weighingcategory_id = a.weighingcategory_id)' ||
       chr(10) || 'order by 1',
       'There are records in WEIGHINGCATEGORY table with no related record in WEIGHINGCATEGORY_LINK table!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (15,
       'CLIENT_LINK table is correctly filled',
       'select customernumber, b.name customerName, clientnumber, a.name clientName, client_id, a.timestamp' ||
       chr(10) || 'from client a, customer b' || chr(10) ||
       'where a.customer_id = b.customer_id and' || chr(10) ||
       '      not exists (select x.client_id from client_link x where x.client_id = a.client_id)' ||
       chr(10) || 'order by 1, 3',
       'There are records in CLIENT table with no related record in CLIENT_LINK table!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (16,
       'Every consumption point has at least one standard delivery record',
       'select customernumber, name customername, departmentnumber, distributionpointnumber' ||
       chr(10) || 'from distributionpoint d, department dep, customer c' ||
       chr(10) || 'where d.department_id = dep.department_id and' ||
       chr(10) || '      dep.customer_id = c.customer_id and' || chr(10) ||
       '      not exists (select s.standarddelivery_id from standarddelivery s where s.distributionpoint_id = d.distributionpoint_id)' ||
       chr(10) || 'order by 1, 3, 4',
       'There ate consumption points with no standard delivery!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (17,
       'Every customer has at least one department',
       'select customernumber, c.name customerName' || chr(10) ||
       'from customer c ' || chr(10) ||
       'where not exists (select d.department_id from department d where d.customer_id = c.customer_id)' ||
       chr(10) || 'order by 1',
       'There are customers with no department!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (18,
       'Every department has at least one consumption point',
       'select customernumber, c.name customerName, departmentnumber' ||
       chr(10) || 'from customer c, department d' || chr(10) ||
       'where c.customer_id = d.customer_id and' || chr(10) ||
       '      not exists (select dip.distributionpoint_id from distributionpoint dip ' ||
       chr(10) ||
       '                  where dip.department_id = d.department_id)' ||
       chr(10) || 'order by 1, 3',
       'There are departments with no consumption point!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (19,
       'One default quality grade exists',
       'select count(q.qualitygrade_id)' || chr(10) ||
       'from qualitygrade q ' || chr(10) ||
       'where q.defaultqualitygrade = ''Y'' and (select count(*) from qualitygrade) > 0',
       'There is no default quality grade!',
       'Y',
       'There is more than one default quality grade!',
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (20,
       'Each product has at least one product size',
       'select p.code productcode' || chr(10) || 'from product p' ||
       chr(10) ||
       'where not exists (select ps.product_id from productsize ps where ps.product_id = p.product_id)' ||
       chr(10) || 'order by 1',
       'There are products with no product size!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (21,
       'Each defined tax group has a turnover group and a not allocable turnover group defined when UseTurnverGroup = ''Y''',
       'select tx.code taxCode, tx.description taxDescription, tx.turnovergroup_id, tx.notallocatableturnover_id' ||
       chr(10) ||
       'from taxgroup tx where tx.turnovergroup_id is null or tx.notallocatableturnover_id is null' ||
       chr(10) || 'order by 1',
       'There are tax groups with no turnover group or not allocable turnovergroup defined!',
       'N',
       null,
       'Y');

    insert into DBCHECKONSYSTEMSETTING
      (DBCONSISTENCYCHECK_ID, NAME, VALUE, TYPEOFVALUE)
    values
      (21, 'TAXDEFINITION', 'EU', 'S');
    insert into DBCHECKONSYSTEMSETTING
      (DBCONSISTENCYCHECK_ID, NAME, VALUE, TYPEOFVALUE)
    values
      (21, 'USETURNOVERGROUP', 'Y', 'B');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (22,
       'Product groups per customer have corresponding record in activities per customer',
       'select a.customer_id, a.productgroup_id, b.code, c.activity_id, c.code' ||
       chr(10) ||
       ' from productgrouppercustomer a, productgroup b, activity c' ||
       chr(10) ||
       ' where a.productgroup_id = b.productgroup_id and b.activity_id = c.activity_id and' ||
       chr(10) || ' not exists ' || chr(10) ||
       ' (select pgpc.productgroup_id' || chr(10) ||
       ' from productgrouppercustomer pgpc, productgroup pg, customeractivities ca' ||
       chr(10) || ' where pgpc.productgroup_id = pg.productgroup_id and' ||
       chr(10) || ' pg.activity_id = ca.activity_id and' || chr(10) ||
       ' pgpc.customer_id = ca.customer_id and' || chr(10) ||
       ' a.productgroup_id = pgpc.productgroup_id and' || chr(10) ||
       ' a.customer_id = pgpc.customer_id)',
       'There are productgrouppercustomer records with productsgroups that do not have activities in customeractivities table!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (23,
       'Type of merchandise should be equal for product and its models',
       'select p.product_id, p.code, p.typeofmerchandise, m.product_id, m.code, m.typeofmerchandise' ||
       chr(10) || ' from product p, product m' || chr(10) ||
       ' where p.product_id = m.parentproduct_id and' || chr(10) ||
       ' m.product_id != m.parentproduct_id and' || chr(10) ||
       ' p.typeofmerchandise != m.typeofmerchandise' || chr(10) ||
       ' order by 2, 5',
       'There are models with a different type of merchandise than parent product!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (24,
       'One default transport article exists',
       'select count(t.transportarticle_id)' || chr(10) ||
       'from transportarticle t' || chr(10) ||
       'where t.defaulttransportarticle = ''Y'' and (select count(*) from transportarticle) > 0',
       'There is no default transport article!',
       'Y',
       'There is more than one default transport article!',
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (25,
       'Check if there is more than one default paymentterms!',
       'select case when (select count(pt.paymentterms_id)' || chr(10) ||
       'from paymentterms pt' || chr(10) ||
       'where pt.defaultpaymentterm =''Y'') > 1 then 0' || chr(10) ||
       'when (select count(pt.paymentterms_id) from paymentterms pt) = 0 then 0  else 1 end countdefault from dual',
       'There is no record in paymentterms table!',
       'Y',
       'There is more than one default payment terms!',
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (26,
       'Only one country has the flag for define tax set',
       'select count(c.country_id)' || chr(10) || 'from country c' ||
       chr(10) ||
       'where c.definetax = ''Y'' and (select count(*) from country) > 0',
       'There is no country which has the flag for define tax set!',
       'Y',
       'There is more than one country which has the flag for define tax set!',
       'Y');

    insert into DBCHECKONSYSTEMSETTING
      (DBCONSISTENCYCHECK_ID, NAME, VALUE, TYPEOFVALUE)
    values
      (26, 'TAXDEFINITION', 'EU', 'S');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (27,
       'One default invoice frequency exists',
       'select count(f.invoicefrequency_id)' || chr(10) ||
       'from invoicefrequency f' || chr(10) ||
       'where f.defaultfrequency = ''Y'' and (select count(*) from invoicefrequency) > 0',
       'There is no default invoice frequency!',
       'Y',
       'There is more than one default invoice frequency!',
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (28,
       'Check if turnover group is defined for invoice line type - when it is a must',
       'select i.type, i.factorydescription' || chr(10) ||
       'from invoicelinetype i ' || chr(10) ||
       'where i.defineturnovergroup = ''Y'' and i.turnovergroup_id is null and i.invoicelinetype_id <> 15',
       'There are invoice line types where turnover group is not defined!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (29,
       'Check if taxgroup is defined for invoice line type - when it is a must',
       'select ilt.type, ilt.factorydescription' || chr(10) ||
       'from invoicelinetype ilt' || chr(10) ||
       'where ilt.taxtype != 0 and ' || chr(10) ||
       'not exists (select iltt.invoicelinetype_id from invoicelinetypetax iltt, country c' ||
       chr(10) ||
       '            where ilt.invoicelinetype_id = iltt.invoicelinetype_id and' ||
       chr(10) ||
       '                  iltt.country_id = c.country_id and c.definetax = ''Y'')',
       'There are invoice line types where taxgroup is not defined!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (30,
       'Check if a turnover group for credit squeeze is defined when UseTurnverGroup = ''Y''',
       'select p.code plantcode from plant p where p.creditsqueezeturnovergroup_id is null',
       'There are plants where no turnover group for credit squeeze is defined!',
       'N',
       null,
       'Y');
    insert into DBCHECKONSYSTEMSETTING
      (DBCONSISTENCYCHECK_ID, NAME, VALUE, TYPEOFVALUE)
    values
      (30, 'USETURNOVERGROUP', 'Y', 'B');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (31,
       'Check if per plant at least one invoice line type is defined',
       'select p.code plantcode from plant p ' || chr(10) ||
       'where not exists (select pilt.plant_id from plantinvoicelinetype pilt where p.plant_id = pilt.plant_id)',
       'There are plants where no invoice line type is defined!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (32,
       'Check if per plant at least one invoice frequency is defined',
       'select p.code plantcode from plant p ' || chr(10) ||
       'where not exists (select pif.plant_id from plantinvoicefrequency pif ' ||
       chr(10) ||
       '                  where p.plant_id = pif.plant_id and pif.documenttype = 1)',
       'There are plants where no invoice frequency is defined!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (33,
       'Check if per plant at least one statement frequency is defined',
       'select p.code plantcode from plant p ' || chr(10) ||
       'where not exists (select pif.plant_id from plantinvoicefrequency pif ' ||
       chr(10) ||
       '                  where p.plant_id = pif.plant_id and pif.documenttype = 2)',
       'There are plants where no invoice statement is defined!',
       'N',
       null,
       'Y');
    insert into DBCHECKONSYSTEMSETTING
      (DBCONSISTENCYCHECK_ID, NAME, VALUE, TYPEOFVALUE)
    values
      (33, 'TAXDEFINITION', 'EU', 'S');

    insert into DBCHECKONSYSTEMSETTING
      (DBCONSISTENCYCHECK_ID, NAME, VALUE, TYPEOFVALUE)
    values
      (33, 'USETURNOVERGROUP', 'Y', 'B');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (34,
       'If there are emblem templates defined check if the fabric has the flag UsedForEmblem checked',
       'select e.code emblemtemplatecode, e.description, c.customernumber, ff.code' ||
       chr(10) ||
       'from emblemtemplate e, emblemtemplateline el, customer c, fabric ff' ||
       chr(10) || 'where e.emblemtemplate_id = el.emblemtemplate_id and ' ||
       chr(10) || '      e.customer_id = c.customer_id and' || chr(10) ||
       '      el.fabric_id = ff.fabric_id and' || chr(10) ||
       '      ff.usedforemblem = ''N'' ' || chr(10) || 'order by 1, 2, 4 ',
       'There are emblem templates having UsedForEmblem flag unchecked for the fabric!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (35,
       'If there are emblem templates defined check if the size definition has the flag UsedForEmblem checked',
       'select c.customernumber, e.code emblemtemplatecode, e.description, ss.code' ||
       chr(10) ||
       'from emblemtemplate e, emblemtemplateline el, customer c, sizedefinition ss' ||
       chr(10) || 'where e.emblemtemplate_id = el.emblemtemplate_id and ' ||
       chr(10) || '      e.customer_id = c.customer_id and' || chr(10) ||
       '      el.sizedefinition_id = ss.sizedefinition_id and' || chr(10) ||
       '      ss.usedforemblem =  ''N'' ' || chr(10) || 'order by 1, 2, 4 ',
       'There are emblem templates having UsedForEmblem flag unchecked for the size definition!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (36,
       'If there are emblem templates defined check if the text color has the flag UsedForEmblem checked',
       'select e.code emblemtemplatecode, e.description, c.customernumber, cc.code' ||
       chr(10) ||
       'from emblemtemplate e, emblemtemplateline el, customer c, color cc' ||
       chr(10) || 'where e.emblemtemplate_id = el.emblemtemplate_id and ' ||
       chr(10) || '      e.customer_id = c.customer_id and' || chr(10) ||
       '      el.textcolor_id = cc.color_id and' || chr(10) ||
       '      cc.usedforemblem = ''N'' ',
       'There are emblem templates having UsedForEmblem flag unchecked for the text color!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (37,
       'If there are emblem templates defined check if the border color has the flag UsedForEmblem checked',
       'select e.code emblemtemplatecode, e.description, c.customernumber, cc.code' ||
       chr(10) ||
       'from emblemtemplate e, emblemtemplateline el, customer c, color cc' ||
       chr(10) || 'where e.emblemtemplate_id = el.emblemtemplate_id and ' ||
       chr(10) || '      e.customer_id = c.customer_id and' || chr(10) ||
       '      el.bordercolor_id = cc.color_id and' || chr(10) ||
       '      cc.usedforemblem = ''N'' ',
       'There are emblem templates having UsedForEmblem flag unchecked for the border color!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (38,
       'If there are emblem templates defined check if the background color has the flag UsedForEmblem checked',
       'select e.code emblemtemplatecode, e.description, c.customernumber, cc.code' ||
       chr(10) ||
       'from emblemtemplate e, emblemtemplateline el, customer c, color cc' ||
       chr(10) || 'where e.emblemtemplate_id = el.emblemtemplate_id and ' ||
       chr(10) || '      e.customer_id = c.customer_id and' || chr(10) ||
       '      el.bkgcolor_id = cc.color_id and' || chr(10) ||
       '      cc.usedforemblem = ''N'' ',
       'There are emblem templates having UsedForEmblem flag unchecked for the background color!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (39,
       'Check if for active wearer inventory lines active plpc records exist (also size *)',
       'select c.customernumber, w.wearernumber, we.sequencenumber, p.code productCode, s.code sizeCode, f.code finishingmethodCode,' ||
       'to_char(plpc.dateactive,''DD-MON-yyyy'') plpcDateactive, to_char(plpc.dateinactive,''DD-MON-yyyy'') plpcDateinactive, plpc.productlistpercustomer_id ' ||
       chr(10) ||
       'from wearerinventory wi, weareremployment we, wearer w, customer c, product p, sizedefinition s, finishingmethod f, productlistpercustomer plpc' ||
       chr(10) ||
       'where wi.weareremployment_id = we.weareremployment_id and ' ||
       chr(10) || '      we.wearer_id = w.wearer_id and' || chr(10) ||
       '      w.customer_id = c.customer_id and' || chr(10) ||
       '      wi.product_id = p.product_id and' || chr(10) ||
       '      wi.sizedefinition_id = s.sizedefinition_id and' || chr(10) ||
       '      wi.finishingmethod_id = f.finishingmethod_id and' || chr(10) ||
       '      sysdate between wi.dateactive and wi.dateinactive and' ||
       chr(10) || '       plpc.customer_id = c.customer_id and ' || chr(10) ||
       '       plpc.product_id = p.product_id and' || chr(10) ||
       '       plpc.sizedefinition_id = s.sizedefinition_id ' || chr(10) ||
       '       and not exists ' || chr(10) ||
       ' (select productlistpercustomer_id ' || chr(10) ||
       ' from productlistpercustomer ' || chr(10) ||
       ' where customer_id = c.customer_id ' || chr(10) ||
       ' and product_id = p.product_id ' || chr(10) ||
       ' and sizedefinition_id = ' || chr(10) ||
       ' (select ss.sizedefinition_id ' || chr(10) ||
       '  from sizedefinition ss ' || chr(10) ||
       '  where ss.code = ''*'')  ' || chr(10) ||
       '  and sysdate between dateactive and dateinactive) and' || chr(10) ||
       '        plpc.finishingmethod_id = f.finishingmethod_id and' ||
       chr(10) ||
       '        sysdate not between plpc.dateactive and plpc.dateinactive' ||
       chr(10) || 'union ' ||
       'select c.customernumber, w.wearernumber, we.sequencenumber, p.code productCode, s.code sizeCode, f.code finishingmethodCode,' ||
       'to_char(plpc.dateactive,''DD-MON-yyyy'') plpcDateactive, to_char(plpc.dateinactive,''DD-MON-yyyy'') plpcDateinactive, plpc.productlistpercustomer_id ' ||
       chr(10) ||
       'from wearerinventory wi, weareremployment we, wearer w, customer c, product p, sizedefinition s, finishingmethod f, productlistpercustomer plpc' ||
       chr(10) ||
       'where wi.weareremployment_id = we.weareremployment_id and ' ||
       chr(10) || '      we.wearer_id = w.wearer_id and' || chr(10) ||
       '      w.customer_id = c.customer_id and' || chr(10) ||
       '      wi.product_id = p.product_id and' || chr(10) ||
       '      wi.sizedefinition_id = s.sizedefinition_id and' || chr(10) ||
       '      wi.finishingmethod_id = f.finishingmethod_id and' || chr(10) ||
       '      sysdate between wi.dateactive and wi.dateinactive and' ||
       chr(10) || '       plpc.customer_id = c.customer_id and ' || chr(10) ||
       '       plpc.product_id = p.product_id and' || chr(10) ||
       '       plpc.sizedefinition_id = (select ss.sizedefinition_id from sizedefinition ss where ss.code = ''*'') ' ||
       chr(10) || '       and not exists ' || chr(10) ||
       ' (select productlistpercustomer_id ' || chr(10) ||
       ' from productlistpercustomer ' || chr(10) ||
       ' where customer_id = c.customer_id ' || chr(10) ||
       ' and product_id = p.product_id ' || chr(10) ||
       ' and sizedefinition_id =  s.sizedefinition_id ' || chr(10) ||
       ' and sysdate between dateactive and dateinactive) and' || chr(10) ||
       '        plpc.finishingmethod_id = f.finishingmethod_id and' ||
       chr(10) ||
       '        sysdate not between plpc.dateactive and plpc.dateinactive' ||
       chr(10) || 'union ' || chr(10) || 'select c.customernumber, w.wearernumber, we.sequencenumber, p.code productCode, s.code sizeCode, f.code finishingmethodCode,
       null, null, null ' || chr(10) ||
       'from wearerinventory wi, weareremployment we, wearer w, customer c, product p, sizedefinition s, finishingmethod f' ||
       chr(10) ||
       'where wi.weareremployment_id = we.weareremployment_id and ' ||
       chr(10) || '      we.wearer_id = w.wearer_id and' || chr(10) ||
       '      w.customer_id = c.customer_id and' || chr(10) ||
       '      wi.product_id = p.product_id and' || chr(10) ||
       '      wi.sizedefinition_id = s.sizedefinition_id and' || chr(10) ||
       '      wi.finishingmethod_id = f.finishingmethod_id and' || chr(10) ||
       '      sysdate between wi.dateactive and wi.dateinactive and' ||
       chr(10) ||
       '      not exists (select plpc.productlistpercustomer_id from productlistpercustomer plpc' ||
       chr(10) ||
       '                  where plpc.customer_id = c.customer_id and ' ||
       chr(10) ||
       '                        plpc.product_id = p.product_id and' ||
       chr(10) ||
       '                        (plpc.sizedefinition_id = s.sizedefinition_id or' ||
       chr(10) ||
       '                         plpc.sizedefinition_id = (select ss.sizedefinition_id from sizedefinition ss where ss.code = ''*'')) and' ||
       chr(10) ||
       '                        plpc.finishingmethod_id = f.finishingmethod_id )',
       'There are active wearer inventories line with no corresponding active product list per customer!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (40,
       'Check for overlapping product list per customer',
       'select c.customernumber, p.code productcode, s.code sizecode, f.code finishingmethodcode,' ||
       chr(10) ||
       'a.productlistpercustomer_id, a.dateactive, a.dateinactive, ' ||
       chr(10) ||
       'b.productlistpercustomer_id, b.dateactive, b.dateinactive, ' ||
       chr(10) || 'a.timestamp, b.timestamp' || chr(10) ||
       'from productlistpercustomer a, productlistpercustomer b, customer c, product p, sizedefinition s, finishingmethod f' ||
       chr(10) || 'where a.customer_id = b.customer_id and' || chr(10) ||
       'a.product_id = b.product_id and' || chr(10) ||
       'a.sizedefinition_id = b.sizedefinition_id and' || chr(10) ||
       'a.finishingmethod_id = b.finishingmethod_id and' || chr(10) ||
       'a.productlistpercustomer_id != b.productlistpercustomer_id and' ||
       chr(10) ||
       '(a.dateactive between b.dateactive and b.dateinactive or' ||
       chr(10) ||
       'a.dateinactive between b.dateactive and b.dateinactive) and' ||
       chr(10) || 'a.customer_id = c.customer_id and' || chr(10) ||
       'a.product_id = p.product_id and' || chr(10) ||
       'a.sizedefinition_id = s.sizedefinition_id and' || chr(10) ||
       'a.finishingmethod_id = f.finishingmethod_id' || chr(10) ||
       'order by c.customernumber, p.code, s.code, f.code',
       'There are overlapping product list per customer!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (41,
       'Check for overlapping standard delivery lines',
       'select cust.customernumber, dep.departmentnumber, dip.distributionpointnumber, ' ||
       chr(10) ||
       '       p.code productcode, s.code sizecode, fm.code finishingmethodcode,' ||
       chr(10) ||
       '       sdl1.standarddeliveryline_id, sdl1.dateactive, sdl1.dateinactive, ' ||
       chr(10) ||
       '       sdl2.standarddeliveryline_id, sdl2.dateactive, sdl2.dateinactive ' ||
       chr(10) ||
       'from standarddeliveryline sdl1, standarddeliveryline sdl2, productlistperdistribpoint plpdp, ' ||
       chr(10) || '     product p, sizedefinition s, finishingmethod fm, ' ||
       chr(10) ||
       '     distributionpoint dip, department dep, customer cust' ||
       chr(10) ||
       'where sdl1.standarddelivery_id = sdl2.standarddelivery_id and' ||
       chr(10) ||
       '      sdl1.productlistperdistribpoint_id = sdl2.productlistperdistribpoint_id and' ||
       chr(10) ||
       '      sdl1.standarddeliveryline_id < sdl2.standarddeliveryline_id and' ||
       chr(10) ||
       '      (((sdl1.dateactive <= sdl2.dateactive) and (sdl2.dateactive <= sdl1.dateinactive)) or' ||
       chr(10) ||
       '       ((sdl2.dateactive <= sdl1.dateactive) and (sdl1.dateactive <= sdl2.dateinactive))) and' ||
       chr(10) ||
       '      sdl1.productlistperdistribpoint_id = plpdp.productlistperdistribpoint_id and' ||
       chr(10) ||
       '      plpdp.distributionpoint_id = dip.distributionpoint_id and' ||
       chr(10) || '      dip.department_id = dep.department_id and' ||
       chr(10) || '      dep.customer_id = cust.customer_id and' || chr(10) ||
       '      plpdp.product_id = p.product_id and' || chr(10) ||
       '      plpdp.sizedefinition_id = s.sizedefinition_id and' || chr(10) ||
       '      sdl1.deliveryscheme_id=sdl2.deliveryscheme_id and' || chr(10) ||
       '      plpdp.finishingmethod_id = fm.finishingmethod_id ',
       'There are overlapping standard delivery lines!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (42,
       'Check if there are wearer employments linked to a wrong distribution point (linked to another customer than customer of the wearer)',
       'select c.customernumber, w.wearernumber, we.sequencenumber, cc.customernumber' ||
       chr(10) ||
       'from weareremployment we, wearer w, customer c, distributionpoint dip, department dep, customer cc' ||
       chr(10) || 'where we.wearer_id = w.wearer_id and' || chr(10) ||
       '      w.customer_id = c.customer_id and' || chr(10) ||
       '      we.distributionpoint_id = dip.distributionpoint_id and' ||
       chr(10) || '      dip.department_id = dep.department_id and' ||
       chr(10) || '      dep.customer_id = cc.customer_id and' || chr(10) ||
       '      c.customer_id != cc.customer_id',
       'There are wearer employments linked to a wrong distribution point!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (43,
       'Check if in wearer inventory only products with type of merchandise garments exist',
       'select c.customernumber, w.wearernumber, we.sequencenumber, p.code, p.typeofmerchandise' ||
       chr(10) ||
       'from wearerinventory wi, weareremployment we, wearer w, customer c, product p' ||
       chr(10) ||
       'where wi.weareremployment_id = we.weareremployment_id and' ||
       chr(10) || '      we.wearer_id = w.wearer_id and' || chr(10) ||
       '      w.customer_id = c.customer_id and' || chr(10) ||
       '      wi.product_id = p.product_id and' || chr(10) ||
       '      p.typeofmerchandise != 2',
       'There are products in wearer inventory with another type of merchandise than garments',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (44,
       'Check if wearer employments have only one of the following links filled: delivery point, locker, garment dispenser',
       'select c.customernumber, w.wearernumber, we.sequencenumber' ||
       chr(10) || 'from weareremployment we, wearer w, customer c' ||
       chr(10) || 'where we.wearer_id = w.wearer_id and' || chr(10) ||
       '      w.customer_id = c.customer_id and' || chr(10) ||
       '      ((we.deliverypoint_id is not null and we.locker_id is not null) or' ||
       chr(10) ||
       '       (we.deliverypoint_id is not null and we.garmentdispenser_id is not null) or ' ||
       chr(10) ||
       '       (we.locker_id is not null and we.garmentdispenser_id is not null))',
       'There are wearer employments having more than only one of the following links filled: delivery point, locker, garment dispenser!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (45,
       'Check if wearer employments have at least one of the following links filled: delivery point, locker, garment dispenser',
       'select c.customernumber, w.wearernumber, we.sequencenumber' ||
       chr(10) || 'from weareremployment we, wearer w, customer c' ||
       chr(10) || 'where we.wearer_id = w.wearer_id and' || chr(10) ||
       '      w.customer_id = c.customer_id and' || chr(10) ||
       '      we.deliverypoint_id is null and we.locker_id is null and we.garmentdispenser_id is null',
       'There are wearer employments having none of the following links filled: delivery point, locker, garment dispenser!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (46,
       'Check if every product group is linked to a packing department',
       'select pg.code prodgroupcode, pl.code plantcode' || chr(10) ||
       'from productgroup pg, plant pl' || chr(10) ||
       'where exists (select pd.productgroup_id' || chr(10) ||
       'from packingdepartmentdefinition pd' || chr(10) ||
       'where pd.productgroup_id = pg.productgroup_id and' || chr(10) ||
       'pd.plant_id = pl.plant_id and' || chr(10) ||
       'pd.plantdepartment_id is null) OR not exists' || chr(10) ||
       '(select pdd.productgroup_id' || chr(10) ||
       'from packingdepartmentdefinition pdd' || chr(10) ||
       'where pdd.productgroup_id = pg.productgroup_id and' || chr(10) ||
       'pdd.plant_id = pl.plant_id)',
       'There are product groups that are not linked to a packing department',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (47,
       'Check for non pool unique items the existence of UniqueItemNonPool table',
       'select u.primaryid' || chr(10) || 'from uniqueitem u' || chr(10) ||
       'where u.poolitem = 2 and' || chr(10) ||
       '      not exists (select uinp.uniqueitem_id from uniqueitemnonpool uinp where u.uniqueitem_id = uinp.uniqueitem_id)',
       'There are non pool items without a corresponding record in UniqueItemNonPoolTable!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (48,
       'Check correct filling of field poolitem regarding stay stock',
       'select u.primaryid, s.staytype, s.staynr, s.factorydescription' ||
       chr(10) || 'from uniqueitem u, stay s' || chr(10) ||
       'where u.poolitem = 0 and u.stay_id = s.stay_id and ' || chr(10) ||
       '      (s.staytype != 1 or s.staynr not in (10,26))',
       'There are unique items in stock where stay is not filled correctly!',
       'N',
       null,
       'Y');

    /*insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (SEQ_DBCONSISTENCYCHECK.nextval,
       'Check if turnover group is filled  for invoice line type when UseTurnoverGroup = ''Y''',
       'select i.type, i.factorydescription' || chr(10) ||
       'from invoicelinetype i where i.turnovergroup_id is null and i.defineturnovergroup = ''Y''',
       'Turnover group is not filled for the following invoice line types!',
       'N',
       null,
       'Y');
    insert into DBCHECKONSYSTEMSETTING
      (DBCONSISTENCYCHECK_ID, NAME, VALUE, TYPEOFVALUE)
    values
      (SEQ_DBCONSISTENCYCHECK.currval, 'USETURNOVERGROUP', 'Y', 'B');*/

    /*insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (SEQ_DBCONSISTENCYCHECK.nextval,
       'Check if there are invoices without VAT line but with taxable lines',
       'select i.invoicenumber, i.invoicedate, i.billtocustomernumber, i.billtocustomername, s.factorydescription status' ||
       chr(10) || 'from invoiceheader i, status s' || chr(10) ||
       'where not exists (select il.invoiceline_id from invoiceline il where i.invoiceheader_id = il.invoiceheader_id and il.invoicelinetype_id = 18) and' ||
       chr(10) ||
       '      exists (select il.invoiceline_id from invoiceline il where i.invoiceheader_id = il.invoiceheader_id and il.taxgroupcode is not null and il.amount <> 0) and' ||
       chr(10) || '      i.status_id = s.status_id',
       'There are invoices without VAT line but with taxable lines!',
       'N',
       null,
       'Y'); --502689*/

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (49,
       'Check if there are route controls with settled and not settled invoices',
       'select r.routenumber, r.drivingday_id, rc.drivingdate ' || chr(10) ||
       'from routecontrol rc, route r' || chr(10) ||
       'where rc.route_id = r.route_id and' || chr(10) ||
       '      exists (select ih.invoiceheader_id from invoiceheader ih, status s' ||
       chr(10) || '              where ih.status_id = s.status_id and ' ||
       chr(10) ||
       '                    ih.routecontrol_id = rc.routecontrol_id and' ||
       chr(10) || '                    s.code = 2) and' || chr(10) ||
       '      exists (select ih.invoiceheader_id from invoiceheader ih, status s' ||
       chr(10) || '              where ih.status_id = s.status_id and ' ||
       chr(10) ||
       '                    ih.routecontrol_id = rc.routecontrol_id and' ||
       chr(10) || '                    s.code = 1)',
       'There are route controls with settled and not settled invoices!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (50,
       'Check if there is a product list per customer record for unique items in circulation',
       'select b.code businessunitcode, count(ui.primaryid), ''Non pool'' as "NonPool/Inscanned/Outscanned",' ||
       '(select pr.code from product pr where pr.product_id = ui.product_id) productCode,  ' ||
       '(select cu.customernumber from customer cu where cu.customer_id = w.customer_id) customerNo,  ' ||
       '(select sz.code from sizedefinition sz where sz.sizedefinition_id = ui.sizedefinition_id) sizeCode  ' ||
       'from uniqueitem ui, uniqueitemnonpool uinp, weareremployment we, wearer w, status, businessunit b  ' ||
       'where ui.uniqueitem_id = uinp.uniqueitem_id and ui.poolitem = 2 and  ' ||
       'ui.status_id = status.status_id and status.code = ''20'' and ' ||
       'uinp.weareremployment_id = we.weareremployment_id and ' ||
       'we.wearer_id = w.wearer_id and ' ||
       'ui.businessunit_id = b.businessunit_id and ' ||
       'not exists (select plpc.productlistpercustomer_id from productlistpercustomer plpc ' ||
       '            where w.customer_id = plpc.customer_id and ' ||
       '                  ui.product_id = plpc.product_id and ' ||
       '                  (ui.sizedefinition_id = plpc.sizedefinition_id or  ' ||
       '                   plpc.sizedefinition_id = (select s.sizedefinition_id from sizedefinition s where s.code = ''*'')) and ' ||
       '                  ui.finishingmethod_id = plpc.finishingmethod_id ) ' ||
       'group by b.code , b.description, ui.product_id, w.customer_id, ui.sizedefinition_id ' ||
       'union all ' ||
       'select b.code businessunitcode, count(ui.primaryid), ''Pool inscanned'', ' ||
       '(select pr.code from product pr where pr.product_id = ui.product_id) productCode, ' ||
       '(select cu.customernumber from customer cu where cu.customer_id = dep.customer_id) customerNo, ' ||
       '(select sz.code from sizedefinition sz where sz.sizedefinition_id = ui.sizedefinition_id) sizeCode  ' ||
       'from uniqueitem ui, distributionpoint dip, department dep, status, businessunit b  ' ||
       'where ui.lastdistributionpoint_link_id = dip.distributionpoint_id and  ' ||
       'dip.department_id = dep.department_id and ui.poolitem = 1 and  ' ||
       'ui.status_id = status.status_id and status.code = ''20'' and  ' ||
       'ui.businessunit_id = b.businessunit_id and ' ||
       'not exists (select plpc.productlistpercustomer_id from productlistpercustomer plpc ' ||
       '            where dep.customer_id = plpc.customer_id and ' ||
       '                  ui.product_id = plpc.product_id and ' ||
       '                 (ui.sizedefinition_id = plpc.sizedefinition_id or  ' ||
       '                   plpc.sizedefinition_id = (select s.sizedefinition_id from sizedefinition s where s.code = ''*'')) and ' ||
       '                  ui.finishingmethod_id = plpc.finishingmethod_id ) ' ||
       'group by b.code , b.description, ui.product_id, dep.customer_id, ui.sizedefinition_id ' ||
       'union all ' ||
       'select b.code businessunitcode, count(ui.primaryid), ''Pool outscanned'', ' ||
       '(select pr.code from product pr where pr.product_id = ui.product_id) productCode, ' ||
       '(select cu.customernumber from customer cu where cu.customer_id = dep.customer_id) customerNo, ' ||
       '(select sz.code from sizedefinition sz where sz.sizedefinition_id = ui.sizedefinition_id) sizeCode ' ||
       'from uniqueitem ui, distributionpoint dip, department dep, status, businessunit b ' ||
       'where ui.distributionpoint_id = dip.distributionpoint_id and ' ||
       'dip.department_id = dep.department_id and ui.poolitem = 1 and  ' ||
       'ui.status_id = status.status_id and status.code = ''20'' and ' ||
       'ui.businessunit_id = b.businessunit_id and ' ||
       'not exists (select plpc.productlistpercustomer_id from productlistpercustomer plpc ' ||
       '            where dep.customer_id = plpc.customer_id and ' ||
       '                  ui.product_id = plpc.product_id and ' ||
       '                  (ui.sizedefinition_id = plpc.sizedefinition_id or  ' ||
       '                   plpc.sizedefinition_id = (select s.sizedefinition_id from sizedefinition s where s.code = ''*'')) and ' ||
       '                  ui.finishingmethod_id = plpc.finishingmethod_id ) ' ||
       'group by b.code , b.description, ui.product_id, dep.customer_id, ui.sizedefinition_id ' ||
       'order by 1, 5, 4, 6',
       'There is no active product list per customer record for the following unique items in circulation!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (51,
       'Check if there are missing customer delivery schemes (check in product list per customer, standard delivery line and standard delivery amount)',
       'select distinct c.customernumber, c.name, ds.code deliveryschemecode, sdlamnt.day_id' ||
       chr(10) ||
       'from productlistpercustomer plpc, standarddeliveryline sdl, standarddeliveryamount sdlamnt, deliveryscheme ds, customer c' ||
       chr(10) ||
       'where plpc.productlistpercustomer_id = sdl.productlistpercustomer_id and' ||
       chr(10) ||
       'sdl.standarddeliveryline_id = sdlamnt.standarddeliveryline_id and' ||
       chr(10) || 'sdlamnt.amount != 0 and' || chr(10) ||
       'sdl.deliveryscheme_id = ds.deliveryscheme_id and' || chr(10) ||
       'plpc.customer_id = c.customer_id and' || chr(10) ||
       'not exists (select cds.customer_id from customerdeliveryscheme cds' ||
       chr(10) ||
       '            where plpc.customer_id = cds.customer_id and' ||
       chr(10) ||
       '                  sdl.deliveryscheme_id = cds.deliveryscheme_id and' ||
       chr(10) || '                  sdlamnt.day_id = cds.day_id)',
       'There are misssing customer delivery schemes!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (52,
       'Check if there are missing customer delivery days.',
       'select distinct c.customernumber, c.name, cds.day_id' || chr(10) ||
       'from customerdeliveryscheme cds, customer c' || chr(10) ||
       'where cds.customer_id = c.customer_id and' || chr(10) ||
       'not exists (select cdd.customer_id from customerdeliveryday cdd ' ||
       chr(10) ||
       '            where cds.customer_id = cdd.customer_id and cds.day_id = cdd.day_id and cdd.typeofmerchadise = 1)' ||
       chr(10) || 'order by 1, 3',
       'There are missing customer delivery days!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (53,
       'Check if there are missing customer delivery stops.',
       'select distinct c.customernumber, c.name, ds.code deliveryschemecode, r.routenumber, cds.day_id, rs.stopnumber' ||
       chr(10) ||
       'from customerdeliveryscheme cds, routestop rs, route r, customer c, deliveryscheme ds' ||
       chr(10) || 'where cds.customer_id = rs.customer_id and' || chr(10) ||
       'rs.route_id = r.route_id and' || chr(10) ||
       'cds.customer_id = c.customer_id and' || chr(10) ||
       'cds.deliveryscheme_id = ds.deliveryscheme_id and' || chr(10) ||
       'cds.day_id = r.drivingday_id and' || chr(10) ||
       'not exists (select dss.customer_id' || chr(10) ||
       '            from deliveryschemesperstop dss, routestop rss' ||
       chr(10) ||
       '            where dss.routestop_id = rss.routestop_id and' ||
       chr(10) || '                  dss.customer_id = rss.customer_id and' ||
       chr(10) ||
       '                  cds.deliveryscheme_id = dss.deliveryscheme_id and' ||
       chr(10) || '                  cds.customer_id = rss.customer_id)',
       'There are missing customer delivery stops.',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (54,
       'If there are product emblems defined check if the fabric has the flag UsedForEmblem checked',
       'select p.code productemblemcode, ff.code fabriccode' || chr(10) ||
       'from product p, fabric ff' || chr(10) ||
       'where p.fabric_id = ff.fabric_id and p.typeofmerchandise = 4 and ' ||
       chr(10) || '      ff.usedforemblem = ''N'' ' || chr(10) ||
       'order by 1, 2 ',
       'There are product emblems having UsedForEmblem flag unchecked for the fabric!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (55,
       'If there are product emblems defined check if the background color has the flag UsedForEmblem checked',
       'select p.code productemblemcode, cc.code colorcode' || chr(10) ||
       'from product p, color cc' || chr(10) ||
       'where p.color_id = cc.color_id and ' || chr(10) ||
       '      p.typeofmerchandise = 4 and' || chr(10) ||
       '      cc.usedforemblem = ''N'' ',
       'There are product emblems having UsedForEmblem flag unchecked for the background color!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (56,
       'If there are product emblems defined check if the text color has the flag UsedForEmblem checked',
       'select p.code productemblemcode, cc.code colorcode' || chr(10) ||
       'from product p, emblemproduct ep, color cc' || chr(10) ||
       'where p.product_id = ep.product_id and p.typeofmerchandise = 4 and ' ||
       chr(10) ||
       '      ep.textcolor_id = cc.color_id and cc.usedforemblem = ''N'' ' ||
       chr(10) || 'order by 1, 2 ',
       'There are product emblems having UsedForEmblem flag unchecked for the text color!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (57,
       'If there are product emblems defined check if the border color has the flag UsedForEmblem checked',
       'select p.code productemblemcode, cc.code colorcode' || chr(10) ||
       'from product p, emblemproduct ep, color cc' || chr(10) ||
       'where p.product_id = ep.product_id and p.typeofmerchandise = 4 and ' ||
       chr(10) ||
       '      ep.bordercolor_id= cc.color_id and cc.usedforemblem = ''N'' ' ||
       chr(10) || 'order by 1, 2 ',
       'There are product emblems having UsedForEmblem flag unchecked for the border color!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (58,
       'Check if there are wearer inventory lines (circinventory > 0) without linked unique items or non unique items',
       'select c.customernumber, w.wearernumber, p.code productcode, s.code sizecode, f.code finishingmethodcode,
             sum(wi.circinventory) circInv,
             (select count(n.nonuniqueitem_id)
                           from   nonuniqueitem n
                           where  n.wearerinventory_id = wi.wearerinventory_id and
                                  n.freeitem = ''N'') +
                          (select count(u.uniqueitem_id)
                           from   uniqueitemnonpool u
                           where  u.wearerinventory_id = wi.wearerinventory_id and
                                  u.freeextragarment = ''N'') currentInv
        from wearerinventory wi, weareremployment we, wearer w, customer c, product p, sizedefinition s, finishingmethod f
        where wi.weareremployment_id = we.weareremployment_id and
              we.wearer_id = w.wearer_id and
              w.customer_id = c.customer_id and
              wi.product_id = p.product_id and
              wi.sizedefinition_id = s.sizedefinition_id and
              wi.finishingmethod_id = f.finishingmethod_id
        group by c.customernumber, w.wearernumber, p.code , s.code , f.code , wi.wearerinventory_id
        having sum(wi.circinventory) <> (select count(n.nonuniqueitem_id)
                           from   nonuniqueitem n
                           where  n.wearerinventory_id = wi.wearerinventory_id and
                                  n.freeitem = ''N'') +
                          (select count(u.uniqueitem_id)
                           from   uniqueitemnonpool u
                           where  u.wearerinventory_id = wi.wearerinventory_id and
                                  u.freeextragarment = ''N'')
        order by 1, 2, 3, 4, 5',
       'There are wearer inventory lines (circinventory > 0) without linked unique items or non unique items!',
       'N',
       null,
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (59,
       'Check if a sales journal group exists when turnover group used',
       'select salesjournalgroup_id, code from salesjournalgroup',
       'There is no sales journal group!',
       'Y',
       'OK',
       'Y');

    --LCO, todo 9311
    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (60,
       'Check if exists records in PLPC with Delayedevenexchange = 7 and Deedeliveryscheme_id = null',
       'select c.customernumber, p.code productcode
        from   productlistpercustomer l, customer c, product p
        where  l.deedeliveryscheme_id is null
        and    l.delayedevenexchange = 7
        and    l.customer_id = c.customer_id
        and    l.product_id = p.product_id
        order  by 1, 2',
       'Delayedevenexchange = 7 and deedeliveryscheme_id = null is not allowed, for the following customer, product combinations!',
       'N',
       null,
       'Y');

    -- LCO, todo 9730
    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (61,
       'Check if there are duplicate  rent prices defined in a general price list',
       'select g.code pricelist,
       p.code product,
       s.code sizecode,
       f.code finmethod,
       (select i.factorydescription from invoicefrequency i where i.invoicefrequencynumber = gr.invoicefrequencynumber) pricefrequency,
       gr.changesperweek,
       gr.startdate,
       gr.price,
       gr.timestamp,
       (select su.username from systemuser su where su.systemuser_id = gr.systemuser_id) systemuser,
       gr.systemuser_id,
       gr.generalrentprice_id,
       gr.generalpricelist_id,
       gr.product_id,
       gr.sizedefinition_id,
       gr.finishingmethod_id,
       gr.typeofrent,
       gr.invoicefrequencynumber
       from generalrentprice gr,
       generalpricelist g,
       product p,
       sizedefinition s,
       finishingmethod f
       where g.generalpricelist_id = gr.generalpricelist_id
       and p.product_id = gr.product_id
       and s.sizedefinition_id = gr.sizedefinition_id
       and f.finishingmethod_id = gr.finishingmethod_id
       and gr.typeofrent <> 8
       and exists (select 1
       from generalrentprice gr1
       where gr1.generalpricelist_id = gr.generalpricelist_id
       and gr1.product_id = gr.product_id
       and gr1.sizedefinition_id = gr.sizedefinition_id
       and gr1.finishingmethod_id = gr.finishingmethod_id
       and gr1.startdate = gr.startdate
       and gr1.typeofrent = gr.typeofrent
       and gr1.changesperweek = gr.changesperweek
        and gr1.invoicefrequencynumber <> gr.invoicefrequencynumber
        and gr1.generalrentprice_id <> gr.generalrentprice_id)
        order by gr.generalpricelist_id,
        gr.product_id,
        gr.sizedefinition_id,
        gr.finishingmethod_id,
        gr.typeofrent,
        gr.startdate,
        gr.generalrentprice_id',
       'There are duplicate rent prices defined for a general price list!',
       'N',
       'They need to be corrected manually!',
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (62,
       'Check if there are duplicate  customer rent prices defined for a customer',
       'select cu.customernumber customer,
       p.code product,
       s.code sizecode,
       f.code finmethod,
       (select i.factorydescription from invoicefrequency i where i.invoicefrequencynumber = cr.invoicefrequencynumber) pricefrequency,
       cr.changesperweek,
       cr.startdate,
       cr.price,
       cr.timestamp,
       (select su.username from systemuser su where su.systemuser_id = cr.systemuser_id) systemuser,
       cr.systemuser_id,
       cr.customerrentprice_id,
       cr.productlistpercustomer_id,
       plpc.customer_id,
       plpc.product_id,
       plpc.sizedefinition_id,
       plpc.finishingmethod_id,
       cr.typeofrent,
       cr.invoicefrequencynumber
       from customerrentprice cr,
       productlistpercustomer plpc,
       product p,
       sizedefinition s,
       finishingmethod f,
       customer cu
       where plpc.productlistpercustomer_id = cr.productlistpercustomer_id
       and p.product_id = plpc.product_id
       and s.sizedefinition_id = plpc.sizedefinition_id
       and f.finishingmethod_id = plpc.finishingmethod_id
       and cu.customer_id = plpc.customer_id
       and cr.typeofrent <> 8
       and exists (select 1
       from customerrentprice cr1
       where cr1.productlistpercustomer_id = cr.productlistpercustomer_id
       and cr1.startdate = cr.startdate
       and cr1.typeofrent = cr.typeofrent
       and cr1.changesperweek = cr.changesperweek
       and cr1.invoicefrequencynumber <> cr.invoicefrequencynumber
       and cr1.customerrentprice_id <> cr.customerrentprice_id)
       order by plpc.productlistpercustomer_id,
       plpc.product_id,
       plpc.sizedefinition_id,
       plpc.finishingmethod_id,
       cr.typeofrent,
       cr.startdate,
       cr.customerrentprice_id',
       'There are duplicate rent prices defined for a customer!',
       'N',
       'They need to be corrected manually!',
       'Y');

    -- order 502841
    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (63,
       'Check if the customer bank accounts are valid (matching the 11-proof)',
       'select cu.customernumber, cu.name, cbi.bankaccount, bi.idcode, bi.description, bi.internalidcode
        from customer cu, customerbillinginfo cbi, bankinstitution bi
        where cbi.customer_id = cu.customer_id
        and bi.bankinstitution_id = cbi.bankinstitution_id
        and bi.elevenproof = ''Y''
        and IsElevenProof(cbi.bankaccount) = 0',
       'There are bank accounts defined for a customer that do not match the 11-Proof!',
       'N',
       'They need to be corrected manually!',
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (64,
       'Check if the client bank accounts are valid (matching the 11-proof)',
       'select cu.customernumber, cu.name customername, cl.clientnumber, cl.name clientname,
       cbi.bankaccountnumber, bi.idcode, bi.description, bi.internalidcode
       from client cl, clientbillinginfo cbi, customer cu, bankinstitution bi
       where cbi.client_id = cl.client_id
       and cu.customer_id = cl.customer_id
       and bi.bankinstitution_id = cbi.bankinstitution_id
       and bi.elevenproof =''Y''
       and IsElevenProof(cbi.bankaccountnumber) = 0',
       'There are bank accounts defined for a client that do not match the 11-Proof!',
       'N',
       'They need to be corrected manually!',
       'Y');

    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (65,
       'Check if the laundry bank accounts are valid (matching the 11-proof)',
       'select bi.idcode, bi.description, bi.internalidcode, bi.laundrybankaccount
        from bankinstitution bi
        where bi.elevenproof = ''Y''
        and IsElevenProof(bi.laundrybankaccount) = 0',
       'There are laundry bank accounts defined for a bank institution that do not match the 11-Proof!',
       'N',
       'They need to be corrected manually!',
       'Y');
    -->ABS-11726
    insert into DBCONSISTENCYCHECK
      (DBCONSISTENCYCHECK_ID,
       DESCRIPTION,
       SQLSTATEMENT,
       ERRORMESSAGE,
       EXACTLYONEROW,
       ADDITIONALERRORMESSAGE,
       ACTIVE)
    values
      (66,
       'Check if STOCKCOUNTSCHEDULE _LINK table is correctly filled',
       'select code, description, customer_id, timestamp' || chr(10) ||
       'from stockcountschedule a' || chr(10) ||
       'where not exists (select x.stockcountschedule_id from stockcountschedule_link x ' ||
       chr(10) ||
       '                  where x.stockcountschedule_id = a.stockcountschedule_id)' ||
       chr(10) || 'order by 1' || chr(9) || '' || chr(9) || '' || chr(9) || '' ||
       chr(9) || '' || chr(9) || '' || chr(9) || '' || chr(9) || '' ||
       chr(9) || '' || chr(9) || '',
       'There are records in STOCKCOUNTSCHEDULE table with no related record in STOCKCOUNTSCHEDULE_LINK table!',
       'N',
       null,
       'Y');
    --<ABS-11726

    insert into dbcheckonsystemsetting
    values
      ((select db.dbconsistencycheck_id
         from dbconsistencycheck db
        where db.description =
              'Check for overlapping standard delivery lines'),
       'ALLOWDUPLICATECPL',
       'N',
       'B');

    -- form layout
    insert into FORMLAYOUT
      (FORMLAYOUT_ID,
       FORMTYPE,
       CODE,
       SYSTEMUSER_ID,
       REPORTNAME,
       TIMESTAMP,
       DEFAULTLAYOUT)
    values
      (SEQ_FORMLAYOUT.NEXTVAL,
       'DC',
       '1',
       systemUserID,
       'Standard layout',
       SYSDATE,
       'Y');
    insert into FORMLAYOUT
      (FORMLAYOUT_ID,
       FORMTYPE,
       CODE,
       SYSTEMUSER_ID,
       REPORTNAME,
       TIMESTAMP,
       DEFAULTLAYOUT)
    values
      (SEQ_FORMLAYOUT.NEXTVAL,
       'IC',
       '1',
       systemUserID,
       'Standard layout',
       SYSDATE,
       'Y');
    insert into FORMLAYOUT_DESC
      (FORMLAYOUT_ID, LANGUAGE_ID, DESCRIPTION, SYSTEMUSER_ID, TIMESTAMP)
      select FORMLAYOUT_ID, languageID, code, systemuser_id, timestamp
        from FORMLAYOUT;

    -- invoiceappendixdefinition
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (1,
       1,
       'Cost report',
       'CostReport.rpt',
       '',
       '',
       'Y',
       'Y',
       'Y',
       'Y',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (2,
       2,
       'Condensed cost report',
       'CondensedCostReport.rpt',
       '',
       '',
       'Y',
       'Y',
       'Y',
       'Y',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (3,
       3,
       'Note numbers',
       'NoteNumbersAppendix.rpt',
       '',
       '',
       'N',
       'Y',
       'Y',
       'N',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (4,
       4,
       'Garment charges',
       'GarmentCharges.rpt',
       '',
       'BKLBASIS',
       'N',
       'Y',
       'Y',
       'N',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (5,
       5,
       'Period report pieces',
       'PeriodReportDeliveredArticles.rpt',
       '',
       '',
       'N',
       'N',
       'Y',
       'Y',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (6,
       6,
       'Period report soil weights',
       'PeriodReportWeights.rpt',
       '',
       '',
       'N',
       'N',
       'Y',
       'Y',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (7,
       7,
       'Period report clean weights',
       'PeriodReportWeights.rpt',
       '',
       '',
       'N',
       'N',
       'Y',
       'N',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (8,
       8,
       'Month report pieces',
       'MonthReportDeliveredArticles.rpt',
       '',
       '',
       'N',
       'N',
       'Y',
       'Y',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (9,
       9,
       'Month report soil weights',
       'MonthReportWeights.rpt',
       '',
       '',
       'N',
       'N',
       'Y',
       'Y',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (10,
       10,
       'Month report clean weights',
       'MonthReportWeights.rpt',
       '',
       '',
       'N',
       'N',
       'Y',
       'N',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (11,
       11,
       'Delivery note (no prices)',
       'DeliveryNoteAppendix.rpt',
       '',
       '',
       'N',
       'Y',
       'Y',
       'N',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (12,
       12,
       'Delivery note (with prices)',
       'DeliveryNoteAppendix.rpt',
       '',
       '',
       'N',
       'Y',
       'Y',
       'N',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (13,
       13,
       'To be returned garments',
       'ToBeReturnedGarmentsAppendix.rpt',
       '',
       'BKLBASIS',
       'N',
       'Y',
       'Y',
       'N',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (14,
       14,
       'Week delivered products per customer',
       'WeekReportDeliveredProducts.rpt',
       '',
       '',
       'N',
       'N',
       'Y',
       'Y',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (15,
       15,
       'Week delivered prod. per consumpt. point',
       'WeekReportDeliveredProducts.rpt',
       '',
       '',
       'N',
       'N',
       'Y',
       'N',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (16,
       16,
       'Detailed stockroom transactions',
       'StockroomTransactions.rpt',
       '',
       'BKLBASIS',
       'N',
       'Y',
       'Y',
       'N',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (17,
       17,
       'Cost report per kontonumber',
       'KontoNumberAppendix.rpt',
       'BET',
       '',
       'Y',
       'Y',
       'Y',
       'N',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (18,
       18,
       'Acceptgiro',
       'AppendixAcceptgiro_CH.rpt',
       '',
       '',
       'Y',
       'Y',
       'Y',
       'Y',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (19,
       19,
       'Additional specification',
       'AdditionalSpecification.rpt',
       '',
       '',
       'N',
       'Y',
       'Y',
       'N',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (20,
       20,
       'Compressed cost report',
       'CompressedCostReport.rpt',
       '',
       '',
       'Y',
       'Y',
       'Y',
       'Y',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (21,
       21,
       'Unemployed wearers',
       '(Un)EmployedWearersAppendix.rpt',
       '',
       'BKLBASIS',
       'N',
       'Y',
       'Y',
       'N',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (22,
       22,
       'Costs specifications per wearer',
       'CostSpecificationPerWearer.rpt',
       '',
       'BKLBASIS',
       'N',
       'Y',
       'Y',
       'N',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (23,
       23,
       'Compressed delivery note with prices',
       'CompressedDeliveryNotesWithPrices.rpt',
       '',
       'POINTOFSALE',
       'N',
       'Y',
       'Y',
       'N',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (24,
       24,
       'Weekly summary delivery Angelica',
       'WeeklySummaryReport.rpt',
       '',
       'RPTWEEKLYSUMMARY',
       'Y',
       'Y',
       'Y',
       'N',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (25,
       25,
       'Costs specification per client',
       'CostsSpecificationPerClient.rpt',
       '',
       'PWBBASIS',
       'N',
       'Y',
       'N',
       'Y',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (26,
       26,
       'Sales Order Discount',
       'SalesOrderDiscount.rpt',
       '',
       'BKLBASIS',
       'N',
       'Y',
       'Y',
       'N',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (27,
       27,
       'Consignment Notes',
       'InvoiceAppendixConsignmentNotes.rpt',
       'WMA',
       null,
       'N',
       'N',
       'Y',
       'N',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (28,
       28,
       'Garment charges per cost center',
       'GarmentChargesCostCenter.rpt',
       '',
       'BKLBASIS',
       'N',
       'Y',
       'Y',
       'N',
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       REPORTTYPE,
       systemuser_id,
       timestamp)
    values
      (30,
       30,
       'CSV Export File',
       'CSV Export File',
       '',
       'EXPORTTOCSV',
       'Y',
       'Y',
       'Y',
       'N',
       2,
       systemUserID,
       sysdate);
    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       systemuser_id,
       timestamp)
    values
      (33,
       33,
       'Wearer changes',
       'AppendixWearerChanges.rpt',
       '',
       'CUSTOMERAUDITREPORTS',
       'N',
       'Y',
       'Y',
       'N',
       systemUserID,
       SYSDATE);

    --20011850

    INSERT INTO INVOICEAPPENDIXDEFINITION
      (INVOICEAPPENDIXDEFINITION_ID,
       INVOICEAPPENDIXTYPE,
       DESCRIPTION,
       REPORTNAME,
       CUSTOMERCODE,
       MODULE,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (34,
       34,
       'Condensed Loss charges/credit pool items',
       'CondensedInvoiceAppendixLossForPool.rpt',
       '',
       'LOSSFORPOOL',
       'N',
       'N',
       'Y',
       'N',
       systemUserID,
       SYSDATE);

    INSERT INTO INVOICEAPPENDIXDEFINITION
      (INVOICEAPPENDIXDEFINITION_ID,
       INVOICEAPPENDIXTYPE,
       DESCRIPTION,
       REPORTNAME,
       CUSTOMERCODE,
       MODULE,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (35,
       35,
       'Loss charges / credits for pool items',
       'InvoiceAppendixLossForPool.rpt',
       '',
       'LOSSFORPOOL',
       'N',
       'N',
       'Y',
       'N',
       systemUserID,
       SYSDATE);
    INSERT INTO INVOICEAPPENDIXDEFINITION
      (INVOICEAPPENDIXDEFINITION_ID,
       INVOICEAPPENDIXTYPE,
       DESCRIPTION,
       REPORTNAME,
       CUSTOMERCODE,
       MODULE,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       REPORTTYPE,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (36,
       36,
       'Client.csv',
       'Clientcsv',
       '',
       'EXPORTTOCSV',
       'N',
       'N',
       'N',
       'Y',
       2,
       systemUserID,
       SYSDATE);
    --20013755.60
    INSERT INTO INVOICEAPPENDIXDEFINITION
      (INVOICEAPPENDIXDEFINITION_ID,
       INVOICEAPPENDIXTYPE,
       DESCRIPTION,
       REPORTNAME,
       CUSTOMERCODE,
       MODULE,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       REPORTTYPE,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (37,
       37,
       'CostsPerWearer.CSV',
       'CostsPerWearerCSV',
       '',
       'WEARERINVOICECATEGORY',
       'N',
       'N',
       'Y',
       'N',
       2,
       systemUserID,
       SYSDATE);

    -- 20014063
    INSERT INTO INVOICEAPPENDIXDEFINITION
      (INVOICEAPPENDIXDEFINITION_ID,
       INVOICEAPPENDIXTYPE,
       DESCRIPTION,
       REPORTNAME,
       CUSTOMERCODE,
       MODULE,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       REPORTTYPE,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (38,
       38,
       'POD Numbers',
       'InvoiceAppendixPODNumbers.rpt',
       '',
       'OMDINTERFACE',
       'N',
       'Y',
       'Y',
       'N',
       0,
       systemUserID,
       SYSDATE);

    INSERT INTO INVOICEAPPENDIXDEFINITION
      (INVOICEAPPENDIXDEFINITION_ID,
       INVOICEAPPENDIXTYPE,
       DESCRIPTION,
       REPORTNAME,
       CUSTOMERCODE,
       MODULE,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       REPORTTYPE,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (39,
       39,
       'POD Numbers with Notes',
       'InvoiceAppendixPODNoteNumbers.rpt',
       '',
       'OMDINTERFACE',
       'N',
       'Y',
       'Y',
       'N',
       0,
       systemUserID,
       SYSDATE);

    INSERT INTO INVOICEAPPENDIXDEFINITION
      (INVOICEAPPENDIXDEFINITION_ID,
       INVOICEAPPENDIXTYPE,
       DESCRIPTION,
       REPORTNAME,
       CUSTOMERCODE,
       MODULE,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       REPORTTYPE,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (40,
       40,
       'POD Numbers with Notes and Prices',
       'InvoiceAppendixPODNoteNumbersPrices.rpt',
       '',
       'OMDINTERFACE',
       'N',
       'Y',
       'Y',
       'N',
       0,
       systemUserID,
       SYSDATE);

    INSERT INTO INVOICEAPPENDIXDEFINITION
      (INVOICEAPPENDIXDEFINITION_ID,
       INVOICEAPPENDIXTYPE,
       DESCRIPTION,
       REPORTNAME,
       CUSTOMERCODE,
       MODULE,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       REPORTTYPE,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (41,
       41,
       'Loss for Pool per Product',
       'InvoiceAppendixLossForPoolPerProduct.rpt',
       '',
       'LOSSFORPOOL',
       'N',
       'N',
       'Y',
       'N',
       0,
       systemUserID,
       SYSDATE);

    INSERT INTO INVOICEAPPENDIXDEFINITION
      (INVOICEAPPENDIXDEFINITION_ID,
       INVOICEAPPENDIXTYPE,
       DESCRIPTION,
       REPORTNAME,
       CUSTOMERCODE,
       MODULE,
       MANUAL,
       DIRECTINVOICE,
       OTHERSERVICES,
       RESIDENTIALSERVICES,
       REPORTTYPE,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (42,
       42,
       'Loss for Pool per Product and Department',
       'InvoiceAppendixLossForPoolPerProductDept.rpt',
       '',
       'LOSSFORPOOL',
       'N',
       'N',
       'Y',
       'N',
       0,
       systemUserID,
       SYSDATE);

    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       manual,
       directinvoice,
       otherservices,
       residentialservices,
       reporttype,
       systemuser_id,
       timestamp)
    values
      (43,
       43,
       'Loss for Pool per Product and Cons Point',
       'InvoiceAppendixLossForPoolPerProductCons.rpt',
       '',
       'LOSSFORPOOL',
       'N',
       'N',
       'Y',
       'N',
       0,
       systemUserID,
       sysdate);

    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       manual,
       directinvoice,
       otherservices,
       residentialservices,
       reporttype,
       systemuser_id,
       timestamp)
    values
      (44,
       44,
       'Garment Charges Wearer Product',
       'GarmentChargesWearerProduct.rpt',
       '',
       'BKLBASIS',
       'N',
       'Y',
       'Y',
       'N',
       0,
       systemUserID,
       sysdate);

    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       manual,
       directinvoice,
       otherservices,
       residentialservices,
       systemuser_id,
       timestamp)
    values
      (45,
       45,
       'Delivered Products',
       'DeliveredProducts.rpt',
       '',
       '',
       'N',
       'N',
       'Y',
       'N',
       systemUserID,
       sysdate);

    insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       manual,
       directinvoice,
       otherservices,
       residentialservices,
       systemuser_id,
       timestamp)
    values
      (46,
       46,
       'Cost Specification per dept individual',
       'DPCostSpecificationIndividual.rpt',
       '',
       'DPCOSTSPECIFICATION',
       'N',
       'Y',
       'N',
       'N',
       systemUserID,
       sysdate);

     insert into invoiceappendixdefinition
      (invoiceappendixdefinition_id,
       invoiceappendixtype,
       description,
       reportname,
       customercode,
       module,
       manual,
       directinvoice,
       otherservices,
       residentialservices,
       systemuser_id,
       timestamp)
    values
      (47,
       47,
       'Cost Specification per dept consolidated',
       'DPCostSpecificationConsolidated.rpt',
       '',
       'DPCOSTSPECIFICATION',
       'N',
       'Y',
       'N',
       'N',
       systemUserID,
       sysdate);

    ---locationtype
    insert into locationtype
      (locationtype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       pickinglocation,
       valuecontribution,
       priority,
       active)
    values
      (seq_locationtype.nextval,
       'INSPECT',
       'Inspection',
       systemUserID,
       sysdate,
       'N',
       'Y',
       0,
       'N');

    insert into locationtype
      (locationtype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       pickinglocation,
       valuecontribution,
       priority,
       active)
    values
      (seq_locationtype.nextval,
       'QA',
       'Quarantine',
       systemUserID,
       sysdate,
       'N',
       'Y',
       0,
       'N');

    insert into locationtype
      (locationtype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       pickinglocation,
       valuecontribution,
       priority,
       active)
    values
      (seq_locationtype.nextval,
       'BULK',
       'Bulk',
       systemUserID,
       sysdate,
       'N',
       'Y',
       0,
       'N');

    insert into locationtype
      (locationtype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       pickinglocation,
       valuecontribution,
       priority,
       active)
    values
      (seq_locationtype.nextval,
       'PICK',
       'Picking',
       systemUserID,
       sysdate,
       'Y',
       'Y',
       1,
       'Y');

    insert into locationtype
      (locationtype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       pickinglocation,
       valuecontribution,
       priority,
       active)
    values
      (seq_locationtype.nextval,
       'OVERFLOW',
       'Overflow',
       systemUserID,
       sysdate,
       'Y',
       'Y',
       2,
       'Y');

    insert into locationtype
      (locationtype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       pickinglocation,
       valuecontribution,
       priority,
       active)
    values
      (seq_locationtype.nextval,
       'DEFECT',
       'Defect',
       systemUserID,
       sysdate,
       'N',
       'Y',
       0,
       'Y');

    insert into locationtype
      (locationtype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       pickinglocation,
       valuecontribution,
       priority,
       active)
    values
      (seq_locationtype.nextval,
       'SHOP',
       'Shop Floor',
       systemUserID,
       sysdate,
       'N',
       'Y',
       0,
       'N');

    insert into locationtype
      (locationtype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       pickinglocation,
       valuecontribution,
       priority,
       active)
    values
      (seq_locationtype.nextval,
       'SERVICE',
       'Service Truck',
       systemUserID,
       sysdate,
       'N',
       'Y',
       0,
       'Y');

    insert into locationtype
      (locationtype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       pickinglocation,
       valuecontribution,
       priority,
       active)
    values
      (seq_locationtype.nextval,
       'REPAIR',
       'Repair',
       systemUserID,
       sysdate,
       'N',
       'Y',
       0,
       'N');

    insert into locationtype
      (locationtype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       pickinglocation,
       valuecontribution,
       priority,
       active)
    values
      (seq_locationtype.nextval,
       'RAG',
       'Ragged',
       systemUserID,
       sysdate,
       'N',
       'Y',
       0,
       'N');

    insert into locationtype
      (locationtype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       pickinglocation,
       valuecontribution,
       priority,
       active)
    values
      (seq_locationtype.nextval,
       'BLOCK',
       'Blocked',
       systemUserID,
       sysdate,
       'N',
       'Y',
       0,
       'Y');

    insert into locationtype
      (locationtype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       pickinglocation,
       valuecontribution,
       priority,
       active)
    values
      (seq_locationtype.nextval,
       'TRANSIT',
       'Transit',
       systemUserID,
       sysdate,
       'N',
       'Y',
       0,
       'Y');

    insert into locationtype
      (locationtype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       pickinglocation,
       valuecontribution,
       priority,
       active)
    values
      (seq_locationtype.nextval,
       'CHECKIN',
       'Check-in',
       systemUserID,
       sysdate,
       'N',
       'Y',
       0,
       'Y');

    insert into locationtype_desc
      (locationtype_id, language_id, description, systemuser_id, timestamp)
      select locationtype_id, languageid, code, systemuser_id, timestamp
        from locationtype;
    -----------
    insert into stocktype
      (stocktype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_stocktype.nextval, '01', 'New', systemUserID, sysdate, 'Y');
    insert into stocktype
      (stocktype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_stocktype.nextval, '02', 'Used', systemUserID, sysdate, 'Y');
    insert into stocktype
      (stocktype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_stocktype.nextval, '03', 'Defect', systemUserID, sysdate, 'Y');
    insert into stocktype
      (stocktype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_stocktype.nextval,
       '04',
       'Circulation',
       systemUserID,
       sysdate,
       'Y');
    insert into stocktype
      (stocktype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_stocktype.nextval,
       '05',
       'Service Truck',
       systemUserID,
       sysdate,
       'Y');
    insert into stocktype
      (stocktype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_stocktype.nextval, '06', 'Ragged', systemUserID, sysdate, 'Y');
    insert into stocktype
      (stocktype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_stocktype.nextval, '07', 'Sample', systemUserID, sysdate, 'Y');

    insert into stocktype_desc
      (stocktype_id, language_id, description, systemuser_id, timestamp)
      select stocktype_id, languageid, code, systemuser_id, timestamp
        from stocktype;
    -----
    insert into ledgeraccnttype
      (ledgeraccnttype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_ledgeraccnttype.nextval,
       'WESV',
       'Cost of material goods sold',
       systemUserID,
       sysdate,
       'Y');

    insert into ledgeraccnttype
      (ledgeraccnttype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_ledgeraccnttype.nextval,
       'GWG',
       'Cost of material low value goods',
       systemUserID,
       sysdate,
       'Y');

    insert into ledgeraccnttype
      (ledgeraccnttype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_ledgeraccnttype.nextval,
       'ABW',
       'Devaluation Stock',
       systemUserID,
       sysdate,
       'Y');

    insert into ledgeraccnttype
      (ledgeraccnttype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_ledgeraccnttype.nextval,
       'BEST',
       'General Stock',
       systemUserID,
       sysdate,
       'Y');

    insert into ledgeraccnttype
      (ledgeraccnttype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_ledgeraccnttype.nextval,
       'WESS',
       'Cost of material service contracts',
       systemUserID,
       sysdate,
       'Y');

    insert into ledgeraccnttype
      (ledgeraccnttype_id,
       code,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_ledgeraccnttype.nextval,
       'WESR',
       'Cost of material spare parts',
       systemUserID,
       sysdate,
       'Y');

    insert into ledgeraccnttype_desc
      (ledgeraccnttype_id,
       language_id,
       description,
       systemuser_id,
       timestamp)
      select ledgeraccnttype_id, languageID, code, systemuser_id, timestamp
        from ledgeraccnttype;
    ----
    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0001',
       'AB',
       'Issue Goods Sold',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0002',
       'AG',
       'Issue Rental Goods',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0003',
       'AR',
       'Issue Spare Parts',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0004',
       'AS',
       'Ragged',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0005',
       'AV',
       'Manual Issue',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0006',
       'AW',
       'Devaluation',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0007',
       'AX',
       'Issue MVG/FIBU',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0008',
       'AY',
       'Issue ABO',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0009',
       'EG',
       'Receive in stock',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0010',
       'I+',
       'Inventory +',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0011',
       'I-',
       'Inventory -',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0012',
       'RE',
       'Return Sold Goods',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0013',
       'RM',
       'Return Rental Goods',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0014',
       'RR',
       'Return Spare Parts',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0015',
       'RT',
       'Retour Depot/Depot',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0016',
       'RV',
       'Manual Return',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0017',
       'RX',
       'Return MVG/FIBU',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0018',
       'RY',
       'Return ABO',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0019',
       'SV',
       'Balance correction',
       systemUserID,
       sysdate,
       'N');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0020',
       'UB',
       'Stock Transfer',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0021',
       'UD',
       'Location update stockroom',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0022',
       'UF',
       'Location update related to truck',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0023',
       'UX',
       'Correction stock transfer',
       systemUserID,
       sysdate,
       'N');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0024',
       'ZG',
       'Receive from supplier',
       systemUserID,
       sysdate,
       'Y');

    insert into extstocktranstype
      (extstocktranstype_id,
       code,
       keycode,
       factorydescription,
       systemuser_id,
       timestamp,
       active)
    values
      (seq_extstocktranstype.nextval,
       '0025',
       'ZU',
       'Issue Sample Goods',
       systemUserID,
       sysdate,
       'N');

    insert into extstocktranstype_desc
      (extstocktranstype_id,
       language_id,
       description,
       systemuser_id,
       timestamp)
      select extstocktranstype_id,
             languageID,
             code,
             systemuser_id,
             timestamp
        from extstocktranstype;
    --employee function
    INSERT INTO EMPLOYEEFUNCTION
      (EMPLOYEEFUNCTION_ID,
       CODE,
       DESCRIPTION,
       ACTIVE,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_EMPLOYEEFUNCTION.NEXTVAL, '-', '-', 'Y', systemUserID, sysdate);

    insert into employeefunctiondialog
      (employeefunction_id,
       dialog_id,
       selectable,
       systemuser_id,
       timestamp)
      select e.employeefunction_id, d.dialog_id, 'Y', systemUserID, sysdate
        from employeefunction e, dialogs d
       where e.code = '-'
         and d.code in ('Route',
                        'Truck',
                        'RouteStatusControl',
                        'DeliveryNote',
                        'Customer',
                        'Contract',
                        'ProductListPerCustomer',
                        'Batch',
                        'OutscanSort',
                        'BatchDeliveryNote',
                        'StockRoom',
                        'WeighingTicket',
                        'CustomerActivities',
                        'StandardDelivery',
                        'WorkOrder',
                        'PostalCodesPerCountry');
    --20012126.80
    insert into employeefunctiondialog
      (employeefunction_id,
       dialog_id,
       selectable,
       systemuser_id,
       timestamp)
      select e.employeefunction_id, d.dialog_id, 'N', systemUserID, sysdate
        from employeefunction e, dialogs d
       where d.code in ('SalesOrder');
    --ABS-18462
    insert into employeefunctionauth
      (employeefunctionauth_id,
       employeefunction_id,
       ordertype,
       authorizationlevel,
       systemuser_id,
       timestamp)
      select seq_employeefunctionauth.nextval,
             e.employeefunction_id,
             ot.ordertype,
             2,
             systemUserID,
             sysdate
        from employeefunction e,
             (select rownum ordertype
                from user_tables
               where rownum between 1 and 3) ot;
    --district
    INSERT INTO DISTRICT
      (DISTRICT_ID, CODE, DESCRIPTION, SYSTEMUSER_ID, TIMESTAMP)
    VALUES
      (SEQ_DISTRICT.NEXTVAL, '-', '-', systemUserID, sysdate);

    INSERT INTO DISTRICTPLANT
      (DISTRICT_ID, PLANT_ID, EMPLOYEE_ID, SYSTEMUSER_ID, TIMESTAMP)
      (SELECT DD, PL, EMP, systemUserID, sysdate
         FROM (SELECT DISTRICT_ID DD FROM DISTRICT D WHERE D.CODE = '-'),
              (SELECT E.PLANT_ID PL, E.EMPLOYEE_ID EMP
                 FROM EMPLOYEE E, PLANT
                WHERE E.PLANT_ID = PLANT.PLANT_ID
                  AND E.EMPLOYEENUMBER =
                      (SELECT MIN(E.EMPLOYEENUMBER) FROM EMPLOYEE E)));
    ------employee
    insert into employee e
      (PLANT_ID,
       EMPLOYEE_ID,
       EMPLOYEENUMBER,
       NAME,
       SEARCHNAME,
       DATEACTIVE,
       SYSTEMUSER_ID,
       DATEINACTIVE,
       TIMESTAMP,
       PDANUMBER,
       MOBILEDEVICE_ID,
       WORKSPOT,
       EMPLOYEEFUNCTION_ID)
      select p.plant_id,
             seq_employee.nextval,
             1,
             '-',
             '-',
             sysdate,
             systemUserID,
             to_date('31-12-2099', 'dd-mm-yyyy'),
             sysdate,
             0,
             null,
             0,
             ef.employeefunction_id
        from plant p, employeefunction ef;
    ---DWH_SETTINGSPERTABLE (order 502383)
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('PRODUCTION_QUANTITIES',
       'Y',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       1);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('GARMENT_ISSUE',
       'Y',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('CLEAN_WEIGHT', 'Y', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('SOIL_WEIGHT', 'Y', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('WEIGHINGCATEGORY',
       'N',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('TURNOVERGROUP',
       'N',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('BUSINESSUNIT', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('ROUTE', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('QUALITYGRADE', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('PRODUCT', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('CHARGETYPE', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('DELIVERIES', 'Y', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('CURRENCY', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('INVOICE', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('GROWTHREASON', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('REVENUE_GROWTH',
       'Y',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('REASONCODE', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('REVENUE', 'Y', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('CUSTOMER', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('TIME', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('FINISHINGMETHOD',
       'N',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('CONTACTCATEGORY',
       'N',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('CLOSED_CONTACTS',
       'Y',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('DELIVERY_NOTE',
       'N',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('COSTS_PBA', 'Y', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('CREDITS', 'Y', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('STAY', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('TRANSACTION_TYPE',
       'N',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('STOCK_ROOM', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('SYSTEM_USER', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('SCANS', 'Y', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('ROUTE_HISTORY',
       'Y',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('WORKSPOT', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 1);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('SHIFT', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 1);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('HOUR_TYPE', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 1);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('ABSENCE_REASON',
       'N',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       1);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('PIMS_EMPLOYEE',
       'N',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       1);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('JOB_CODE', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 1);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('PIMS_BUSINESS_UNIT',
       'N',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       1);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('AR_AGING_SNAPSHOT',
       'Y',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('AR_TRANSACTION_TYPE',
       'N',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('AR_TRANSACTIONS',
       'Y',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('GARMENT_SALES',
       'Y',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('SOIL_COUNTS', 'Y', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('STOCK_TRANSACTIONS',
       'Y',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('CIRC_INV_SNAPSHOT',
       'Y',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('SETS_IN_CIRC_SNAPSHOT',
       'Y',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('REPAIR_TYPE', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('REPAIRS', 'Y', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('PRODUCTION_HOURS',
       'Y',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       1);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('ABSENCE_HOURS',
       'Y',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       1);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('WEARER_SNAPSHOT',
       'Y',
       'Y',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'),
       0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('WORKSTATION', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    insert into DWH_SETTINGSPERTABLE
      (TABLENAME, ISFACTYN, LOADYN, SYSTEMUSER_ID, TIMESTAMP, SOURCESYSTEM)
    values
      ('STATUS', 'N', 'Y', 1, to_date('01-01-2009', 'dd-mm-yyyy'), 0);
    ---DWH_STRINGS (order 502383)
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (1,
       'Yes',
       10,
       'General',
       null,
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (2,
       'No',
       10,
       'General',
       null,
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (3,
       'Unknown',
       10,
       'General',
       null,
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (4,
       'Not Applicable',
       30,
       'General',
       null,
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (5,
       'N/A',
       6,
       'General',
       null,
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (6,
       'Not Defined',
       30,
       'General',
       null,
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (7,
       'Obsolete',
       15,
       'General',
       null,
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (8,
       'Active',
       15,
       'General',
       null,
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (9,
       'Inactive',
       15,
       'General',
       null,
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (10,
       'All',
       15,
       'General',
       null,
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (20,
       'W',
       15,
       'Calendar Time',
       'Week Code',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (21,
       'Week',
       15,
       'Calendar Time',
       'Week Name',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (22,
       'P',
       15,
       'Calendar Time',
       'Period Code',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (23,
       'Period',
       15,
       'Calendar Time',
       'Period Name',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (24,
       'Q',
       15,
       'Calendar Time',
       'Quarter Code',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (25,
       'Quarter',
       15,
       'Calendar Time',
       'Quarter Name',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (30,
       'COD',
       30,
       'Customer',
       'Payment Method',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (31,
       'Charge',
       30,
       'Customer',
       'Payment Method',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (32,
       'Cash',
       30,
       'Customer',
       'Payment Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (33,
       'Check',
       30,
       'Customer',
       'Payment Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (34,
       'Credit Card',
       30,
       'Customer',
       'Payment Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (35,
       'Electronic Fund Transfer',
       30,
       'Customer',
       'Payment Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (36,
       'EDI',
       30,
       'Customer',
       'Payment Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (37,
       'Accept Giro',
       30,
       'Customer',
       'Payment Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (38,
       'Automatic Collection',
       30,
       'Customer',
       'Payment Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (39,
       'Via pay-by Customer',
       30,
       'Customer',
       'Payment Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (40,
       'Rent Billing Method Unknown',
       30,
       'Charge Type',
       'Charge Description',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (41,
       'Flat Rated Rent',
       30,
       'Charge Type',
       'Charge Description',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (42,
       'Minimum Based Rent',
       30,
       'Charge Type',
       'Charge Description',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (43,
       'Inventory Based Rent',
       30,
       'Charge Type',
       'Charge Description',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (44,
       'Piece Rated Rent',
       30,
       'Charge Type',
       'Charge Description',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (45,
       'Lease',
       30,
       'Charge Type',
       'Charge Description',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (46,
       'Unrelated Loan',
       30,
       'Charge Type',
       'Charge Description',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (50,
       'From Plant',
       30,
       'Route',
       'Depot',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (51,
       'Not linked to Route',
       30,
       'Route',
       'Route Description',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (60,
       'Non Garments',
       30,
       'Product',
       'Type of Merchandize',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (61,
       'Garments',
       30,
       'Product',
       'Type of Merchandize',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (62,
       'Sales-only Items/Disposables',
       30,
       'Product',
       'Type of Merchandize',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (63,
       'Emblems',
       30,
       'Product',
       'Type of Merchandize',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (64,
       'Residential Garments',
       30,
       'Product',
       'Type of Merchandize',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (65,
       'Not Soil Counted',
       20,
       'Product',
       'Soil Count Method',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (66,
       'Manual',
       20,
       'Product',
       'Soil Count Method',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (67,
       'Auto Return Assumed',
       20,
       'Product',
       'Soil Count Method',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (68,
       'Weight Based',
       20,
       'Product',
       'Soil Count Method',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (69,
       'Delayed Even Exchange',
       40,
       'Product',
       'Exchange Method',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (70,
       'Straight Even Exchange',
       40,
       'Product',
       'Exchange Method',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (71,
       'Delivery based on order/standards',
       40,
       'Product',
       'Exchange Method',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (80,
       'New',
       10,
       'Quality Grade',
       'New Used',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (81,
       'Used',
       10,
       'Quality Grade',
       'New Used',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (85,
       'New / Increase',
       30,
       'Growth Reason',
       'Growth Reason Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (86,
       'Quit / Decrease',
       30,
       'Growth Reason',
       'Growth Reason Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (91,
       'New/Quit Customer',
       30,
       'Growth Reason',
       'Net Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (92,
       'New/Quit Customer Product',
       30,
       'Growth Reason',
       'Net Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (93,
       'Changed Customer Product',
       30,
       'Growth Reason',
       'Net Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (94,
       'New/Quit Wearers',
       30,
       'Growth Reason',
       'Net Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (95,
       'New/Quit Wearer Products',
       30,
       'Growth Reason',
       'Net Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (96,
       'Wearer Inventory Changes',
       30,
       'Growth Reason',
       'Net Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (97,
       'Price Changes',
       30,
       'Growth Reason',
       'Net Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (101,
       'New Customer',
       30,
       'Growth Reason',
       'Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (102,
       'Quit Customer',
       30,
       'Growth Reason',
       'Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (103,
       'New Customer Product',
       30,
       'Growth Reason',
       'Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (104,
       'Quit Customer Product',
       30,
       'Growth Reason',
       'Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (105,
       'Increased Customer Product',
       30,
       'Growth Reason',
       'Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (106,
       'Decreased Customer Product',
       30,
       'Growth Reason',
       'Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (107,
       'New Wearer',
       30,
       'Growth Reason',
       'Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (108,
       'Quit Wearer',
       30,
       'Growth Reason',
       'Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (109,
       'New Wearer Product',
       30,
       'Growth Reason',
       'Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (110,
       'Quit Wearer Product',
       30,
       'Growth Reason',
       'Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (111,
       'Increased Wearer Inventory',
       30,
       'Growth Reason',
       'Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (112,
       'Decreased Wearer Inventory',
       30,
       'Growth Reason',
       'Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (113,
       'Price Increase',
       30,
       'Growth Reason',
       'Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (114,
       'Price Decrease',
       30,
       'Growth Reason',
       'Growth Reason',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (120,
       'Fscl W',
       15,
       'Fiscal Time',
       'Week Code',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (121,
       'Fiscal Week',
       15,
       'Fiscal Time',
       'Week Name',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (122,
       'Fscl P',
       15,
       'Fiscal Time',
       'Period Code',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (123,
       'Fiscal Period',
       15,
       'Fiscal Time',
       'Period Name',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (124,
       'Fscl Q',
       15,
       'Fiscal Time',
       'Quarter Code',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (125,
       'Fiscal Quarter',
       15,
       'Fiscal Time',
       'Quarter Name',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (200,
       'Delivery Standards',
       30,
       'Customer',
       'Standard Quantity Definition',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (201,
       'Usage Standards',
       30,
       'Customer',
       'Standard Quantity Definition',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (202,
       'This Customer',
       30,
       'Customer',
       'Containers Owned By',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (203,
       'Bill-to Customer',
       30,
       'Customer',
       'Containers Owned By',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (204,
       'Master Account',
       30,
       'Customer',
       'Containers Owned By',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (205,
       'Laundry',
       30,
       'Customer',
       'Containers Owned By',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (206,
       'Customer',
       30,
       'Customer',
       'Consignment Note Level',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (207,
       'Department',
       30,
       'Customer',
       'Consignment Note Level',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (208,
       'Delivery Point',
       30,
       'Customer',
       'Consignment Note Level',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (210,
       'No Sorting Info',
       30,
       'Customer',
       'Outscan Sort By',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (211,
       'Department',
       30,
       'Customer',
       'Outscan Sort By',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (212,
       'Bank / Locker',
       30,
       'Customer',
       'Outscan Sort By',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (213,
       'Garment Dispenser',
       30,
       'Customer',
       'Outscan Sort By',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (214,
       'Delivery Point',
       30,
       'Customer',
       'Outscan Sort By',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (215,
       'Service Team',
       30,
       'Customer',
       'Outscan Sort By',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (216,
       'Finishing Method',
       30,
       'Customer',
       'Outscan Sort By',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (217,
       'Size',
       30,
       'Customer',
       'Outscan Sort By',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (218,
       'Bank / Locker + Sticker',
       30,
       'Customer',
       'Outscan Sort By',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (219,
       'Sort Address',
       30,
       'Customer',
       'Outscan Sort By',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (230,
       'General Price List',
       30,
       'Customer',
       'Insurance Price Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (231,
       'Customer Specific Price',
       30,
       'Customer',
       'Insurance Price Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (235,
       'Charge Fixed # of Banks ',
       30,
       'Customer',
       'Locker Rent Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (236,
       'Charge per Occupied Locker',
       30,
       'Customer',
       'Locker Rent Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (237,
       'Charge # of Bank/Lockers ',
       30,
       'Customer',
       'Locker Service Charge Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (238,
       'Charge # of Pieces per Bank/Locker',
       30,
       'Customer',
       'Locker Service Charge Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (240,
       'Regular Mail',
       30,
       'Customer',
       'Send Invoice By',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (241,
       'E-mail',
       30,
       'Customer',
       'Send Invoice By',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (242,
       'Fax',
       30,
       'Customer',
       'Send Invoice By',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (243,
       'EDI',
       30,
       'Customer',
       'Send Invoice By',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (251,
       'Products by Wearer',
       30,
       'Customer',
       'Garment Rent Specification',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (252,
       'Products by Wearer Condensed',
       30,
       'Customer',
       'Garment Rent Specification',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (253,
       'Wearer Totals Only',
       30,
       'Customer',
       'Garment Rent Specification',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (254,
       'By Product',
       30,
       'Customer',
       'Garment Rent Specification',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (255,
       'Number of Men per Total Price',
       30,
       'Customer',
       'Garment Rent Specification',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (256,
       'Summary Person Billing with Total Code',
       30,
       'Customer',
       'Garment Rent Specification',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (260,
       'In Arrear',
       30,
       'Customer',
       'Rent Period',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (261,
       'In Advance (Correct Additions Only)',
       30,
       'Customer',
       'Rent Period',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (262,
       'In Advance',
       30,
       'Customer',
       'Rent Period',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (265,
       'No Split',
       30,
       'Customer',
       'Split Invoice',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (266,
       'Per product grouping code',
       30,
       'Customer',
       'Split Invoice',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (267,
       'Per Cost Center',
       30,
       'Customer',
       'Split Invoice',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (268,
       'Rent / Other services',
       30,
       'Customer',
       'Split Invoice',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (270,
       'Invoice',
       30,
       'Customer',
       'Finance Charge Put On',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (271,
       'Statement',
       30,
       'Customer',
       'Finance Charge Put On',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (275,
       'Other',
       30,
       'Customer',
       'Credit Card Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (281,
       'Always',
       30,
       'Customer',
       'Send Statement',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (282,
       'Only When Past Due',
       30,
       'Customer',
       'Send Statement',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (283,
       'Never',
       30,
       'Customer',
       'Send Statement',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (285,
       'Yes, Bulk Inscan Allowed',
       30,
       'Customer',
       'Residential Inscan',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (286,
       'Yes, but Not in Bulk',
       30,
       'Customer',
       'Residential Inscan',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (290,
       'Sequence# Delivery Note',
       30,
       'Customer',
       'Sort Order Residential Washes',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (291,
       'Client Number',
       30,
       'Customer',
       'Sort Order Residential Washes',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (292,
       'Client Search Name',
       30,
       'Customer',
       'Sort Order Residential Washes',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (293,
       'Department / Room#',
       30,
       'Customer',
       'Sort Order Residential Washes',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (301,
       'Next Visit',
       30,
       'Customer',
       'Return Residential Items',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (302,
       'Same Route Next Week',
       30,
       'Customer',
       'Return Residential Items',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (303,
       'Return Route',
       30,
       'Customer',
       'Return Residential Items',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (310,
       'no sorting info',
       30,
       'Customer',
       'Residential Outscan Sort by',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (311,
       'Departement#',
       30,
       'Customer',
       'Residential Outscan Sort by',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (312,
       'Room#',
       30,
       'Customer',
       'Residential Outscan Sort by',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (313,
       'Box#',
       30,
       'Customer',
       'Residential Outscan Sort by',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (314,
       'Delivery Point',
       30,
       'Customer',
       'Residential Outscan Sort by',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (315,
       'Service Team',
       30,
       'Customer',
       'Residential Outscan Sort by',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (316,
       'Client#',
       30,
       'Customer',
       'Residential Outscan Sort by',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (317,
       'Box# + Department#',
       30,
       'Customer',
       'Residential Outscan Sort by',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (322,
       'Automatic',
       30,
       'Customer',
       'Anniversary Price Adjustment',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (323,
       'Signal Only',
       30,
       'Customer',
       'Anniversary Price Adjustment',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (331,
       'Fixed (Dictated)',
       30,
       'Customer',
       'Master Account Relation',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (332,
       'Free',
       30,
       'Customer',
       'Master Account Relation',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (350,
       'High',
       10,
       'Contacts',
       'Priority',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (351,
       'Medium',
       10,
       'Contacts',
       'Priority',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (352,
       'Low',
       10,
       'Contacts',
       'Priority',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (360,
       'Charge',
       20,
       'Repairs',
       'Status',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (361,
       'Free of Charge',
       20,
       'Repairs',
       'Status',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (362,
       'Charge Cancelled',
       20,
       'Repairs',
       'Status',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (363,
       'No Repair Charge',
       20,
       'Repairs',
       'Status',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (364,
       'Reason Not Charged',
       20,
       'Garment Issue',
       'Status',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (365,
       'In Free Period',
       20,
       'Garment Issue',
       'Status',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (366,
       'No Charge Defined',
       20,
       'Garment Issue',
       'Status',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (401,
       'Flat Rated Rent',
       30,
       'Charge Type',
       'Billing Method',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (402,
       'Rent Based on Minimum',
       30,
       'Charge Type',
       'Billing Method',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (403,
       'Inventory Based',
       30,
       'Charge Type',
       'Billing Method',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (404,
       'Piece Rate Only ',
       30,
       'Charge Type',
       'Billing Method',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (405,
       'Lease',
       30,
       'Charge Type',
       'Billing Method',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (409,
       'Unrelated Loan',
       30,
       'Charge Type',
       'Billing Method',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (411,
       'Not Started',
       30,
       'Route History',
       'Status Columns',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (412,
       'In Progress',
       30,
       'Route History',
       'Status Columns',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (413,
       'Completed',
       30,
       'Route History',
       'Status Columns',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (414,
       'Processed',
       30,
       'Route History',
       'Status Columns',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (421,
       'No Put Up Printed',
       30,
       'Route History',
       'Packing Status',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (422,
       'Put Up Printed',
       30,
       'Route History',
       'Packing Status',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (430,
       'Not Exported',
       30,
       'Route History',
       'Status Columns',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (431,
       'Exported',
       30,
       'Route History',
       'Status Columns',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (432,
       'Imported',
       30,
       'Route History',
       'Status Columns',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (440,
       'Not Ready for Transfer',
       30,
       'Route History',
       'Sorting Status & PDA Status',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (441,
       'Ready for Transfer',
       30,
       'Route History',
       'Sorting Status & PDA Status',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (442,
       'Transferred',
       30,
       'Route History',
       'Sorting Status & PDA Status',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (450,
       'Packing Note generated based on Orders',
       40,
       'Delivery Note',
       'Origin',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (451,
       'Manually Added',
       40,
       'Delivery Note',
       'Origin',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (452,
       'Batch Delivery Note',
       40,
       'Delivery Note',
       'Origin',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (453,
       'Correction Ticket',
       40,
       'Delivery Note',
       'Origin',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (454,
       'Stock Delivery Note',
       40,
       'Delivery Note',
       'Origin',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (455,
       'Special Order',
       40,
       'Delivery Note',
       'Origin',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (456,
       'Bulk Note',
       40,
       'Delivery Note',
       'Origin',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (457,
       'Bin Note',
       40,
       'Delivery Note',
       'Origin',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (458,
       'Transfer Weights',
       40,
       'Delivery Note',
       'Origin',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (459,
       'Imported from external datawarehouse',
       40,
       'Delivery Note',
       'Origin',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (460,
       'Mounting Order',
       40,
       'Delivery Note',
       'Origin',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (461,
       'Generated',
       30,
       'Invoice',
       'Invoice Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (462,
       'Manual',
       30,
       'Invoice',
       'Invoice Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (463,
       'Credit',
       30,
       'Invoice',
       'Invoice Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (464,
       'Additional Generated',
       30,
       'Invoice',
       'Invoice Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (465,
       'Lost Customer Invoice',
       30,
       'Invoice',
       'Invoice Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (466,
       'Corrections Invoice',
       30,
       'Invoice',
       'Invoice Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (470,
       'Pieces',
       10,
       'Work Spot',
       'Pieces Weight',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (471,
       'Weight',
       10,
       'Work Spot',
       'Pieces Weight',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (480,
       'Permanent',
       20,
       'Employee',
       'Contract Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (481,
       'Temporary',
       20,
       'Employee',
       'Contract Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (482,
       'External',
       20,
       'Employee',
       'Contract Type',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (485,
       'Male',
       10,
       'Employee',
       'Gender',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (486,
       'Female',
       10,
       'Employee',
       'Gender',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (490,
       'Debit',
       20,
       'AR Transaction Type',
       'Debit Credit',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));
    insert into DWH_STRING
      (DWH_STRING_ID,
       FACTORYDESCRIPTION,
       MAXSTRINGLENGTH,
       DIMENSION_TABLE,
       DIMENSION_COLUMN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (491,
       'Credit',
       20,
       'AR Transaction Type',
       'Debit Credit',
       1,
       to_date('01-01-2009', 'dd-mm-yyyy'));

    insert into dwh_string_desc
      (dwh_string_id, languagecode, string, systemuser_id, timestamp)
      select i.dwh_string_id, 'EN_US', i.factorydescription, 1, sysdate
        from dwh_string i
       where i.dwh_string_id not in
             (select dwh_string_id
                from dwh_string_desc dd
               where dd.dwh_string_id = i.dwh_string_id
                 and dd.languagecode = 'EN_US');

    --plantpdfexport table--
    insert into plantpdfexport
      (plant_id,
       reportnumber,
       reportname,
       exportpdf,
       systemuser_id,
       timestamp)
      select p.plant_id, 1, 'Delivery Note', 'N', 0, sysdate from plant p;
    insert into plantpdfexport
      (plant_id,
       reportnumber,
       reportname,
       exportpdf,
       systemuser_id,
       timestamp)
      select p.plant_id, 2, 'Weighing Ticket', 'N', 0, sysdate
        from plant p;
    insert into plantpdfexport
      (plant_id,
       reportnumber,
       reportname,
       exportpdf,
       systemuser_id,
       timestamp)
      select p.plant_id, 3, 'Invoice', 'N', 0, sysdate from plant p;
    insert into plantpdfexport
      (plant_id,
       reportnumber,
       reportname,
       exportpdf,
       systemuser_id,
       timestamp)
      select p.plant_id, 4, 'Invoice Appendix', 'N', 0, sysdate
        from plant p;
    insert into plantpdfexport
      (plant_id,
       reportnumber,
       reportname,
       exportpdf,
       systemuser_id,
       timestamp)
      select p.plant_id, 5, 'Sales Note', 'N', 0, sysdate from plant p;
    insert into plantpdfexport
      (plant_id,
       reportnumber,
       reportname,
       exportpdf,
       systemuser_id,
       timestamp)
      select p.plant_id, 6, 'Client Delivery Note', 'N', 0, sysdate
        from plant p;

    --WebMenuGroup (order 20010966.50)
    insert into webmenugroup
      (webmenugroup_id,
       sequencenumber,
       factorydescription,
       systemuser_id,
       timestamp)
    values
      (seq_webmenugroup.nextval, 1, 'Linen', 1, sysdate);
    insert into webmenugroup
      (webmenugroup_id,
       sequencenumber,
       factorydescription,
       systemuser_id,
       timestamp)
    values
      (seq_webmenugroup.nextval, 2, 'Linen Reports', 1, sysdate);
    insert into webmenugroup
      (webmenugroup_id,
       sequencenumber,
       factorydescription,
       systemuser_id,
       timestamp)
    values
      (seq_webmenugroup.nextval, 3, 'Garments', 1, sysdate);
    insert into webmenugroup
      (webmenugroup_id,
       sequencenumber,
       factorydescription,
       systemuser_id,
       timestamp)
    values
      (seq_webmenugroup.nextval, 4, 'Garment Reports', 1, sysdate);
    insert into webmenugroup
      (webmenugroup_id,
       sequencenumber,
       factorydescription,
       systemuser_id,
       timestamp)
    values
      (seq_webmenugroup.nextval, 5, 'Cost Information', 1, sysdate);
    insert into webmenugroup
      (webmenugroup_id,
       sequencenumber,
       factorydescription,
       systemuser_id,
       timestamp)
    values
      (seq_webmenugroup.nextval, 6, 'Cost Reports', 1, sysdate);
    insert into webmenugroup
      (webmenugroup_id,
       sequencenumber,
       factorydescription,
       systemuser_id,
       timestamp)
    values
      (seq_webmenugroup.nextval, 7, 'Financial Information', 1, sysdate);
    insert into webmenugroup
      (webmenugroup_id,
       sequencenumber,
       factorydescription,
       systemuser_id,
       timestamp)
    values
      (seq_webmenugroup.nextval, 8, 'Delivery Documents', 1, sysdate);
    insert into webmenugroup
      (webmenugroup_id,
       sequencenumber,
       factorydescription,
       systemuser_id,
       timestamp)
    values
      (seq_webmenugroup.nextval, 9, 'Main', 1, sysdate);
    insert into WEBMENUGROUP_DESC
      select wmg.webmenugroup_id,
             l.language_id,
             wmg.factorydescription,
             1,
             sysdate
        from webmenugroup wmg, languages l
       where l.translatedescription = 'Y';

    --WebMenuDialog (order 20010966.50)
    --insert into Dialogs table
    ----dialogs of type 3
    insert into dialogs
      select seq_dialogs.nextval,
             'Ingave Patiëntendagen',
             'WebAdjPatientDaysEntry',
             'Adjusted Patient Days Entry',
             'Eintrag Patiententage',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Entrée jours d''hospitalisation',
             'Indtastning af Patientdage',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Toewijzen Leveringen',
             'WebAllocateDeliveries',
             'Allocate Deliveries',
             'Stationsverteilung',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Attribuer livraisons',
             'Tildel leveringer',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Budget Ingave',
             'WebBudgetEntry',
             'Budget Entry',
             'Budget Eingabe',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Entrée budget',
             'Budgetindtastning',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Wijzigen Relatie',
             'WebChangeCustomer',
             'Change Customer',
             'Ändern Kunde',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Changer client',
             'Ændre kunde',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Wijzigen E-Mail',
             'WebChangeEmail',
             'Change Email',
             'E-Mail ändern',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Changer émail',
             'Ændre Email',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Wijzigen Wachtwoord',
             'WebChangePassword',
             'Change Password',
             'Passwort ändern',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Modifier mot de passe',
             'Ændre adgangskode',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Voorraad telling/bestelling bevestigen',
             'WebConfirmStockOrder',
             'Confirm Stock Counts / Orders',
             'Bestätigen Lagerzählungen/ Bestell..',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Confirmer comptages stock/commandes',
             'Bekræft optællinger / bestillinger',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Toon Uitleveroverzicht',
             'WebConsignmentNotes',
             'View Consignment Notes',
             'Zeige Frachtbriefe',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Afficher liste livraisons',
             'Vis samlefølgesedler',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Gebruiker gedefinieerde informatie',
             'WebCustomInformation',
             'Custom Information',
             'Benutzerdefinierten Daten',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Information personnalisée',
             'Brugerdefineret data',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Toon Afleverbonnen',
             'WebDeliveryNotes',
             'View Delivery Notes',
             'Zeige Lieferscheine',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Afficher bulletins de livraison',
             'Vis følgesedler',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Financiële details',
             'WebFinancialDetails',
             'Financial Details',
             'Finanzielle Details',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Détails financiers',
             'Finansdetaljer',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Kleding',
             'WebGarment',
             'Garments',
             'Kleidung',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Vêtements',
             'Beklædning',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Kleding-bestellingen',
             'WebGarmentOrder',
             'Garment Orders',
             'Kleidungs- Bestellung',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Commandes vêtements',
             'Tøjbestilling',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Standaarddocumenten',
             'WebGenericDocuments',
             'Generic Documents',
             'Allgemeine Dokumente',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Documents génériques',
             'Standarddokumenter',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Toon Facturen',
             'WebInvoices',
             'View Invoices',
             'Ansehen Rechnungen',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Afficher factures',
             'Vis fakturaer',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Vakken',
             'WebLocker',
             'Lockers',
             'Fächer',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Casiers',
             'Skabe',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Afmelden',
             'WebLogOff',
             'Log Off',
             'Abmelden',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Déconnexion',
             'Log af',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Onderhoud Levernormen',
             'WebMaintainDelStandards',
             'Maintain Delivery Standards',
             'Wartung Lieferung Standards',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Gestion normes livraison',
             'Vedligehold af faste leveringer',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Onderhoud Voorraadnormen',
             'WebMaintainNormStockLevels',
             'Maintain Norm Stock Levels',
             'Wartung Liefernormen',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Gestion normes de niveaux stock',
             'Vedligehold af lagerstandarder',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Maand Definities',
             'WebMonthDefinition',
             'Month Definition',
             'Monats- Definitionen',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Définition mois',
             'Månedsdefinition',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Ingave Patiëntendagen',
             'WebPatientDaysEntry',
             'Patient Days Entry',
             'Eingabe Patiententage',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Entrée jours d''hospitalisation',
             'Indtastning af patientdage',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Ingave patiënten',
             'WebPatientsEntry',
             'Patients Entry',
             'Eingabe Patienten',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Entrée résidents',
             'Indtastning af patienter',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Toon betalingen',
             'WebPayments',
             'View Payments',
             'Zeige Zahlungen',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Afficher paiements',
             'Vis betalinger',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Toon Verzamelfacturen',
             'WebStatements',
             'View Statements',
             'Zeige Anweisungen',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Afficher factures regroupées',
             'Vis kontoudtog',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Voorraad Telling / Bestellingen',
             'WebStockCountOrder',
             'Stock Count / Order',
             'Bestandszählungen / Bestellungen',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Comptages stock / commandes',
             'Lageroptælling / Bestilling',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Dragers',
             'WebWearer',
             'Wearers',
             'Träger',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Porteurs',
             'Medarbejdere',
             3,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    ----dialogs of type 4
    insert into dialogs
      select seq_dialogs.nextval,
             'Toewijzingsformulier',
             'WebRptAllocationSheet',
             'AllocationSheet',
             'Zuteilungsblatt',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Feuille d''allocation',
             'Fordelingsskema',
             4,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Blanco bestel-formulier',
             'WebRptBlankOrderForm',
             'Blank Order Form',
             'leerer Bestellauftrag',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Feuille commande vide',
             'Tom bestillingsblanket',
             4,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Budgetkosten',
             'WebRptBudgetCosts',
             'Budget Costs',
             'Budgetkosten',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Coûts budget',
             'Budgetomkostninger',
             4,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Budget Bepaling',
             'WebRptBudgetDetermination',
             'Budget Determination',
             'Budget Bestimmung',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Définition budget',
             'Budgetbestemmelse',
             4,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Budget Afstemming',
             'WebRptBudgetReconcile',
             'Budget Reconciliation',
             'Budget Abstimmung',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Rapprochement budget',
             'Budgetafstemning',
             4,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Geleverde producten',
             'WebRptDeliveredProducts',
             'Delivered Products',
             'Gelieferte Produkte',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Produits livrés',
             'Leverede produkter',
             4,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Kleding bestellingen',
             'WebRptGarmentOrders',
             'Garment Orders',
             'Kleidungs- Auftrag',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Commandes vêtements',
             'Tøjbestillinger',
             4,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Kleding per drager',
             'WebRptGarmperWearer',
             'Garments per Wearer',
             'Kleidung pro Träger',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Vêtements par porteur',
             'Beklædning per medarbejder',
             4,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Inventaris Verbruik',
             'WebRptInventoryUtilisation',
             'Inventory Utilisation',
             'Inventar Nutzung',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Utilisation inventaire',
             'Beholdningsforbrug',
             4,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Maandelijks Verbruik',
             'WebRptMontlyUsage',
             'Monthly Usage',
             'Monatliche Nutzung',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Utilisation mensuelle',
             'Månedlig forbrug',
             4,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Tellingen / Bestellingen',
             'WebRptOrder',
             'Counts / Orders',
             'Zählungen / Bestellungen',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Comptages / commandes',
             'Optællinger / Bestillinger',
             4,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Ontvangen aantallen',
             'WebRptReceivedQuantities',
             'Received Quantities',
             'empfangene Mengen',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Quantités reçues',
             'Modtagede mængder',
             4,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Scans per drager',
             'WebRptScansperWearer',
             'Scans per Wearer',
             'Scannungen pro Träger',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Scans par porteur',
             'Scans per medarbejder',
             4,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Dragers',
             'WebRptWearer',
             'Wearers',
             'Träger',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Porteurs',
             'Medarbejder',
             4,
             0,
             '',
             0,
             '-',
             'N'
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Drager Inventaris',
             'WebRptWearerInventory',
             'Wearer Inventory',
             'Trägerbestand',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Inventaire porteur',
             'Medarbejderbeholdning',
             4,
             0,
             '',
             0,
             '-',
             'N'
        from dual;
    --insert into webmenudialog table
    --Linen
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Linen') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebStockCountOrder') dialog_id,
             1,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Linen') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebConfirmStockOrder') dialog_id,
             2,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Linen') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebMaintainDelStandards') dialog_id,
             3,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Linen') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebMaintainNormStockLevels') dialog_id,
             4,
             1,
             sysdate
        from dual;

    --Linen Reports
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Linen Reports') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebRptBlankOrderForm') dialog_id,
             1,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Linen Reports') webmenugroup_id,
             (select d.dialog_id from dialogs d where d.code = 'WebRptOrder') dialog_id,
             2,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Linen Reports') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebRptDeliveredProducts') dialog_id,
             3,
             1,
             sysdate
        from dual;

    --Garments
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Garments') webmenugroup_id,
             (select d.dialog_id from dialogs d where d.code = 'WebWearer') dialog_id,
             1,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Garments') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebGarmentOrder') dialog_id,
             2,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Garments') webmenugroup_id,
             (select d.dialog_id from dialogs d where d.code = 'WebGarment') dialog_id,
             3,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Garments') webmenugroup_id,
             (select d.dialog_id from dialogs d where d.code = 'WebLocker') dialog_id,
             4,
             1,
             sysdate
        from dual;

    --Garment Reports
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Garment Reports') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebRptWearer') dialog_id,
             1,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Garment Reports') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebRptWearerInventory') dialog_id,
             2,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Garment Reports') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebRptGarmperWearer') dialog_id,
             3,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Garment Reports') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebRptGarmentOrders') dialog_id,
             4,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Garment Reports') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebRptScansperWearer') dialog_id,
             5,
             1,
             sysdate
        from dual;

    --Cost information
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Cost Information') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebAllocateDeliveries') dialog_id,
             1,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Cost Information') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebRptAllocationSheet') dialog_id,
             2,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Cost Information') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebPatientDaysEntry') dialog_id,
             3,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Cost Information') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebAdjPatientDaysEntry') dialog_id,
             4,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Cost Information') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebPatientsEntry') dialog_id,
             5,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Cost Information') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebBudgetEntry') dialog_id,
             6,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Cost Information') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebMonthDefinition') dialog_id,
             7,
             1,
             sysdate
        from dual;

    --Cost Reports
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Cost Reports') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebRptMontlyUsage') dialog_id,
             1,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Cost Reports') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebRptReceivedQuantities') dialog_id,
             2,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Cost Reports') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebRptInventoryUtilisation') dialog_id,
             3,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Cost Reports') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebRptBudgetCosts') dialog_id,
             4,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Cost Reports') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebRptBudgetDetermination') dialog_id,
             5,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Cost Reports') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebRptBudgetReconcile') dialog_id,
             6,
             1,
             sysdate
        from dual;

    --Financial Information
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Financial Information') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebFinancialDetails') dialog_id,
             1,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Financial Information') webmenugroup_id,
             (select d.dialog_id from dialogs d where d.code = 'WebInvoices') dialog_id,
             2,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Financial Information') webmenugroup_id,
             (select d.dialog_id from dialogs d where d.code = 'WebPayments') dialog_id,
             3,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Financial Information') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebStatements') dialog_id,
             4,
             1,
             sysdate
        from dual;

    --Delivery Documents
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Delivery Documents') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebDeliveryNotes') dialog_id,
             1,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Delivery Documents') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebConsignmentNotes') dialog_id,
             2,
             1,
             sysdate
        from dual;

    --Main
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Main') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebGenericDocuments') dialog_id,
             1,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Main') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebCustomInformation') dialog_id,
             2,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Main') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebChangeEmail') dialog_id,
             3,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Main') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebChangePassword') dialog_id,
             4,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Main') webmenugroup_id,
             (select d.dialog_id
                from dialogs d
               where d.code = 'WebChangeCustomer') dialog_id,
             5,
             1,
             sysdate
        from dual;
    insert into webmenudialog
      (webmenudialog_id,
       webmenugroup_id,
       dialog_id,
       sequencenumber,
       systemuser_id,
       timestamp)
      select seq_webmenudialog.nextval,
             (select wmg.webmenugroup_id
                from webmenugroup wmg
               where wmg.factorydescription = 'Main') webmenugroup_id,
             (select d.dialog_id from dialogs d where d.code = 'WebLogOff') dialog_id,
             6,
             1,
             sysdate
        from dual;

    insert into WEBMENUDIALOG_DESC
      select wmd.webmenudialog_id,
             l.language_id,
             (select (case (substr(l.code, 1, 2))
                       when 'DK' then
                        nvl(d.dkdescription, d.endescription)
                       when 'FR' then
                        nvl(d.frdescription, d.endescription)
                       when 'DE' then
                        nvl(d.gedescription, d.endescription)
                       when 'NL' then
                        nvl(d.nldescription, d.endescription)
                       else
                        d.endescription
                     end)
                from dialogs d
               where d.dialog_id = wmd.dialog_id),
             1,
             sysdate
        from webmenudialog wmd, languages l
       where l.translatedescription = 'Y';

    --WebUserDialog
    -- Linen
    insert into WEBUSERDIALOG
      select seq_webuserdialog.nextval,
             w.webuser_id,
             wmd.webmenudialog_id,
             null,
             1,
             sysdate
        from webuser w, webmenudialog wmd, webmenugroup wmg
       where wmg.webmenugroup_id = wmd.webmenugroup_id
         and wmg.factorydescription in ('Linen', 'Linen Reports')
         and (w.accessnongarments = 'Y' or w.accesssalesitems = 'Y');

    -- Garments
    insert into WEBUSERDIALOG
      select seq_webuserdialog.nextval,
             w.webuser_id,
             wmd.webmenudialog_id,
             null,
             1,
             sysdate
        from webuser w, webmenudialog wmd, webmenugroup wmg, dialogs d
       where wmg.webmenugroup_id = wmd.webmenugroup_id
         and d.dialog_id = wmd.dialog_id
         and wmg.factorydescription in ('Garments', 'Garment Reports')
         and w.accessgarments = 'Y'
         and (d.code <> 'WebLockers' or w.allowlockerentry = 'Y');

    -- Financial Info
    insert into WEBUSERDIALOG
      select seq_webuserdialog.nextval,
             w.webuser_id,
             wmd.webmenudialog_id,
             null,
             1,
             sysdate
        from webuser w, webmenudialog wmd, webmenugroup wmg
       where wmg.webmenugroup_id = wmd.webmenugroup_id
         and wmg.factorydescription = 'Financial Information'
         and w.accessfinancialdetails = 'Y';

    -- Cost Information: Allocate Deliveries
    insert into WEBUSERDIALOG
      select seq_webuserdialog.nextval,
             w.webuser_id,
             wmd.webmenudialog_id,
             null,
             1,
             sysdate
        from webuser w, webmenudialog wmd, dialogs d
       where d.dialog_id = wmd.dialog_id
         and d.code = 'WebAllocateDeliveries'
         and w.allowdeliveryrealloc = 'Y';

    -- Cost Information: Patient Days Entry
    insert into WEBUSERDIALOG
      select seq_webuserdialog.nextval,
             w.webuser_id,
             wmd.webmenudialog_id,
             null,
             1,
             sysdate
        from webuser w, webmenudialog wmd, dialogs d
       where d.dialog_id = wmd.dialog_id
         and d.code = 'WebPatientDaysEntry'
         and w.allowpatientdayentry = 'Y';

    -- Cost Information: Adjusted Patient Days Entry for customer ANG only
    insert into WEBUSERDIALOG
      select seq_webuserdialog.nextval,
             w.webuser_id,
             wmd.webmenudialog_id,
             null,
             1,
             sysdate
        from webuser w, webmenudialog wmd, dialogs d
       where d.dialog_id = wmd.dialog_id
         and d.code = 'WebAdjPatientDaysEntry'
         and w.allowpatientdayentry = 'Y'
         and (select min(code) from databasesettings) = 'ANG';

    -- Cost Information: Budget Entry
    insert into WEBUSERDIALOG
      select seq_webuserdialog.nextval,
             w.webuser_id,
             wmd.webmenudialog_id,
             null,
             1,
             sysdate
        from webuser w, webmenudialog wmd, dialogs d
       where d.dialog_id = wmd.dialog_id
         and d.code = 'WebBudgetEntry'
         and w.allowbudgetentry = 'Y';

    -- Cost Reports
    insert into WEBUSERDIALOG
      select seq_webuserdialog.nextval,
             w.webuser_id,
             wmd.webmenudialog_id,
             null,
             1,
             sysdate
        from webuser w, webmenudialog wmd, webmenugroup wmg
       where wmg.webmenugroup_id = wmd.webmenugroup_id
         and wmg.factorydescription = 'Cost Reports'
         and w.allowcostreports = 'Y';

    -- Main
    insert into WEBUSERDIALOG
      select seq_webuserdialog.nextval,
             w.webuser_id,
             wmd.webmenudialog_id,
             null,
             1,
             sysdate
        from webuser w, webmenudialog wmd, webmenugroup wmg
       where wmg.webmenugroup_id = wmd.webmenugroup_id
         and wmg.factorydescription = 'Main';
    begin
      --PurgeTable (order 20010826.50)
      --1
      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         whereclause,
         datefieldname,
         businessunitfieldname,
         systemuser_id,
         timestamp)
        select seq_purgetable.nextval,
               'Contact',
               'Contacts',
               'Only closed contacts will be purged',
               'Status = 4',
               'NewDate',
               'BusinessUnit_ID',
               systemUserID,
               sysdate
          from dual;
      --2
      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         datefieldname,
         systemuser_id,
         timestamp)
        select seq_purgetable.nextval,
               'InternetOrder',
               'Internet / PDA Orders',
               'Warning: cleaned up for all plants',
               'OrderDate',
               systemUserID,
               sysdate
          from dual;
      --3
      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         whereclause,
         datefieldname,
         plantfieldname,
         systemuser_id,
         timestamp)
        select seq_purgetable.nextval,
               'RouteControl',
               'Route status control',
               'SettlementStatus = 3 or InvoicesGenerated = 3',
               'DrivingDate',
               'Plant_ID',
               systemUserID,
               sysdate
          from dual;
      --4
      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         whereclause,
         datefieldname,
         businessunitfieldname,
         systemuser_id,
         timestamp)
        select seq_purgetable.nextval,
               'WorkOrder',
               'Work orders',
               'Time filter based on date needed',
               'Origin < 6',
               'NeededDate',
               'BusinessUnit_ID',
               systemUserID,
               sysdate
          from dual;
      --5
      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         whereclause,
         datefieldname,
         businessunitfieldname,
         systemuser_id,
         timestamp)
        select seq_purgetable.nextval,
               'WorkOrder',
               'Sales / credit notes',
               'Time filter based on date needed',
               'Origin = 6 or Origin = 7',
               'NeededDate',
               'BusinessUnit_ID',
               systemUserID,
               sysdate
          from dual;
      --6
      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         whereclause,
         datefieldname,
         businessunitfieldname,
         systemuser_id,
         timestamp)
        select seq_purgetable.nextval,
               'WorkOrder',
               'Stock delivery / internal purchase order',
               'Time filter based on date needed',
               'Origin = 8 or Origin = 9',
               'NeededDate',
               'BusinessUnit_ID',
               systemUserID,
               sysdate
          from dual;
      --7
      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         whereclause,
         datefieldname,
         businessunitfieldname,
         systemuser_id,
         timestamp)
        select seq_purgetable.nextval,
               'WorkOrder',
               'Mounting / dismounting order',
               'Time filter based on date needed',
               'Origin = 10 or Origin = 11',
               'NeededDate',
               'BusinessUnit_ID',
               systemUserID,
               sysdate
          from dual;
      --8
      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         datefieldname,
         businessunitfieldname,
         systemuser_id,
         timestamp)
        select seq_purgetable.nextval,
               'ClientDeliveryNote',
               'Client delivery note',
               'Time filter based on date needed',
               'DeliveryDate',
               'ProcessBusinessUnit_ID',
               systemUserID,
               sysdate
          from dual;
      --9 (order 20010951.50)
      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         datefieldname,
         plantfieldname,
         systemuser_id,
         timestamp)
        select seq_purgetable.nextval,
               'WEBPortalEvent',
               'Web Portal Event',
               'Time filter based on Timestamp',
               'Timestamp',
               'Plant_ID',
               systemUserID,
               sysdate
          from dual;
      --10 (order 20013402.70)
      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         whereclause,
         datefieldname,
         systemuser_id,
         timestamp)
        select seq_purgetable.nextval,
               'Bagtag',
               'Bag tags',
               'Only detached bag tags are purged.',
               'Status = 1',
               'Lastscantimestamp',
               systemUserID,
               sysdate
          from dual;
      --todo 21231.50
      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         whereclause,
         datefieldname,
         plantfieldname,
         systemuser_id,
         timestamp)
        select seq_purgetable.nextval,
               'SortBatch',
               'Sort batches',
               'Only delivered sort batches are purged.',
               'Status = 5',
               'BatchDate',
               'Plant_ID',
               systemUserID,
               sysdate
          from dual;
      --20013655
      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         whereclause,
         datefieldname,
         hint,
         plantfieldname,
         businessunitfieldname,
         commitsize,
         systemuser_id,
         timestamp)
        select seq_purgetable.nextval,
               'RejectedScan',
               'Rejected Scans (multi read)',
               'Time filter based on scan timestamp',
               null,
               'Scantimestamp',
               null,
               null,
               'BusinessUnit_ID',
               5000,
               systemUserID,
               sysdate
          from dual;

      --todo 22640
      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         datefieldname,
         plantfieldname,
         whereclause,
         systemuser_id,
         timestamp)
        select seq_purgetable.nextval,
               'DeliveryScan',
               'Delivery scans',
               'ScanTimestamp',
               null,
               'PackingNote_ID is null and ((Select DateInactive from Customer where Customer_ID = DeliveryScan.Customer_Link_ID) < sysdate)',
               systemUserID,
               sysdate
          from dual;

      /*ABS-10959 Reducing the table size*/
      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         whereclause,
         datefieldname,
         hint,
         plantfieldname,
         businessunitfieldname,
         commitsize,
         systemuser_id,
         timestamp)
      values
        (seq_purgetable.nextval,
         'IssueHistory',
         'Issue History',
         null,
         null,
         'ASSIGNDATE',
         null,
         null,
         'PROCESSBUSINESSUNIT_ID',
         5000,
         systemUserID,
         sysdate);

      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         whereclause,
         datefieldname,
         hint,
         plantfieldname,
         businessunitfieldname,
         commitsize,
         systemuser_id,
         timestamp)
      values
        (seq_purgetable.nextval,
         'DeliveryHistory',
         'Delivery History',
         null,
         null,
         'DELIVERYDATE',
         null,
         null,
         'PROCESSBUSINESSUNIT_ID',
         5000,
         systemUserID,
         sysdate);

      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         whereclause,
         datefieldname,
         hint,
         plantfieldname,
         businessunitfieldname,
         commitsize,
         systemuser_id,
         timestamp)
      values
        (seq_purgetable.nextval,
         'DeliveryVariations',
         'Delivery Variations',
         'Warning: cleaned up for all plants!',
         'PROCESSED=''Y''',
         'DELIVERYDATE',
         null,
         null,
         null,
         5000,
         systemUserID,
         sysdate);

      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         whereclause,
         datefieldname,
         hint,
         plantfieldname,
         businessunitfieldname,
         commitsize,
         systemuser_id,
         timestamp)
      values
        (seq_purgetable.nextval,
         'PackingNote',
         'Packing Notes',
         'Only processed or cancelled packingnotes',
         'status_id in ( select st.status_id from status st where st.code in (''30'',''40''))',
         'DELIVERYDATE',
         null,
         null,
         'PROCESSBUSINESSUNIT_ID',
         5000,
         systemUserID,
         sysdate);

      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         whereclause,
         datefieldname,
         hint,
         plantfieldname,
         businessunitfieldname,
         commitsize,
         systemuser_id,
         timestamp)
      values
        (seq_purgetable.nextval,
         'WebServiceTransaction',
         'Web Service Transaction',
         'Warning: cleaned up for all plants!',
         'TIMESTAMP < TRUNC(SYSDATE-14)',
         'TIMESTAMP',
         null,
         null,
         null,
         9000,
         systemUserID,
         sysdate);

      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         whereclause,
         datefieldname,
         hint,
         plantfieldname,
         businessunitfieldname,
         commitsize,
         systemuser_id,
         timestamp)
      values
        (seq_purgetable.nextval,
         'OutOfStockHistory',
         'Out Of Stock History',
         null,
         null,
         'OUTOFSTOCKDATE',
         null,
         null,
         'PROCESSBUSINESSUNIT_ID',
         5000,
         systemUserID,
         sysdate);

      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         whereclause,
         datefieldname,
         hint,
         plantfieldname,
         businessunitfieldname,
         commitsize,
         systemuser_id,
         timestamp)
      values
        (seq_purgetable.nextval,
         'WeighingHistory',
         'Weighing History',
         null,
         null,
         'WEIGHINGDATE',
         null,
         null,
         'PROCESSBUSINESSUNIT_ID',
         5000,
         systemUserID,
         sysdate);

      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         whereclause,
         datefieldname,
         hint,
         plantfieldname,
         businessunitfieldname,
         commitsize,
         systemuser_id,
         timestamp)
      values
        (seq_purgetable.nextval,
         'OutOfCirculationHistory',
         'Out Of Circulation History',
         null,
         null,
         'OUTOFCIRCDATE',
         null,
         null,
         'PROCESSBUSINESSUNIT_ID',
         5000,
         systemuserid,
         sysdate);

      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         whereclause,
         datefieldname,
         hint,
         plantfieldname,
         businessunitfieldname,
         commitsize,
         systemuser_id,
         timestamp)
      values
        (seq_purgetable.nextval,
         'WeighingTicket',
         'Weighing Ticket',
         'Cleanup processed weighing tickets',
         'status_id in ( select st.status_id from status st where st.code in (''30'',''40''))',
         'WEIGHINGDATE',
         null,
         null,
         'PROCESSBUSINESSUNIT_ID',
         5000,
         systemuserid,
         sysdate);

      insert into purgetable
        (purgetable_id,
         tablename,
         description,
         remark,
         whereclause,
         datefieldname,
         hint,
         plantfieldname,
         businessunitfieldname,
         commitsize,
         systemuser_id,
         timestamp)
      values
        (seq_purgetable.nextval,
         'PrintQueue',
         'Printqueue',
         'Cleanup processed Print Queue records',
         '(PROCESSED = ''Y'' AND ((STATUS=0 AND INVOICEHEADER_ID IS NOT NULL) OR STATUS<>0))',
         'CREATIONDATE',
         null,
         null,
         'BUSINESSUNIT_ID',
         9000,
         systemuserid,
         sysdate);

      --ABS-7437
      insert into PURGETABLE
        (PURGETABLE_ID,
         TABLENAME,
         DESCRIPTION,
         REMARK,
         WHERECLAUSE,
         DATEFIELDNAME,
         HINT,
         PLANTFIELDNAME,
         BUSINESSUNITFIELDNAME,
         COMMITSIZE,
         SYSTEMUSER_ID,
         TIMESTAMP)
      values
        (seq_purgetable.nextval,
         'Productionprocessscanaggr',
         'Production Process Scan (Aggregated)',
         null,
         null,
         'SCANDATE',
         null,
         null,
         'BUSINESSUNIT_ID',
         5000,
         1,
         sysdate);

      insert into PURGETABLE
        (PURGETABLE_ID,
         TABLENAME,
         DESCRIPTION,
         REMARK,
         WHERECLAUSE,
         DATEFIELDNAME,
         HINT,
         PLANTFIELDNAME,
         BUSINESSUNITFIELDNAME,
         COMMITSIZE,
         SYSTEMUSER_ID,
         TIMESTAMP)
      values
        (seq_purgetable.nextval,
         'Prodprocessbuffersnapshot',
         'Production Process Buffer Snapshot',
         null,
         null,
         'SNAPSHOTLOCALDATE',
         null,
         'PLANT_ID',
         null,
         5000,
         1,
         sysdate);
      commit;
    exception
      when dup_val_on_index then
        null; --no problem script was already ran
    end;

insert into purgetable
  (purgetable_id,
   tablename,
   description,
   remark,
   whereclause,
   datefieldname,
   hint,
   plantfieldname,
   businessunitfieldname,
   commitsize,
   systemuser_id,
   timestamp)
  values (seq_purgetable.nextval,
         'DialogUseLog',
         'Dialog usage history',
         null,
         null,
         'LOGGEDDATE',
         null,
         null,
         null,
         5000,
         getminsystemuser(),
         sysdate);

    --webeventtype table (order 20010951.50)
    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 0, 'Log On', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 1, 'Log On after Session Time Out', systemUserID, sysdate
        from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 2, 'Log Off', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 3, 'Session Time Out', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 4, 'Select from Menu', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 5, 'Submit Report', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 6, 'Save Data', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 7, 'Select Customer', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 10, 'Confirm Stock Count', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 11, 'Revoke Confirmation', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 20, 'Add Wearer', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 21, 'Edit Wearer', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 22, 'Quit Wearer', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 23, 'Add Employment', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 24, 'Remove Employment', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 25, 'Add Inventory', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 26, 'Edit Inventory', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 27, 'Quit Inventory', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 28, 'Create Work Order', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 29, 'Cancel Work Order', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 30, 'Add Locker', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 31, 'Edit Locker', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 32, 'Delete Locker', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 33, 'Move Employment', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 40, 'Add Flag', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 41, 'Edit Flag', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 42, 'Remove Flag', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 80, 'Add Order', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 81, 'Edit Order', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 82, 'Confirm Order', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 83, 'Revoke Order Confirmation', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 84, 'Revoke Confirmation Failed', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 85, 'Planned Data entry', systemUserID, sysdate from dual;

    --Order 20010994.160
    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 100, 'Add Room', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 101, 'Edit Room', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 102, 'Remove Room', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 103, 'Add Client', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 104, 'Edit Client', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 105, 'Quit Client', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 106, 'Add Contact Person', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 107, 'Edit Contact Person', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 108, 'Remove Contact Person', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 109, 'Print Labels', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 110, 'Assign Labels', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 111, 'Add Flag', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 112, 'Edit Flag', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 113, 'Remove Flag', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 114, 'Take out of circulation', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 115, 'Move item to Client', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 116, 'Checkpoint scan', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 118, 'Move Client', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 150, 'Log in', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 151, 'Log out', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 152, 'ID code scan', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 200, 'Log in', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 201, 'Log out', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 202, 'Select customer', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 203, 'Add order', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 204, 'Edit order', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 205, 'Confirm order', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 206, 'Revoke order', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 207, 'Revoke Confirmation failed', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 300, 'Login', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 301, 'Automatic Log Out', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 302, 'Repair Logged', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 303, 'Lost and Found', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 304, 'Password Reset', systemUserID, sysdate from dual;

    insert into webeventtype
      (webeventtype_id, description, systemuser_id, timestamp)
      select 305, 'PIN Reset', systemUserID, sysdate from dual;

    --insert into dialogs table for reasoncodedialogs and ragreasondialogs tables
    insert into dialogs
      select seq_dialogs.nextval,
             'Afleverbonnen',
             'DeliveryNote',
             'Delivery Notes',
             'Lieferschein einzeln',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'Y',
             'Y',
             'Y',
             'N',
             'N',
             'Bulletins de livraisons',
             'Følgeseddel',
             0,
             0,
             '',
             1,
             'Albarán Entrega',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Openstaande mutaties',
             'DeliveryVariations',
             'Delivery Variations',
             'Offene Liefervariationen',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Livraisons ouvertes',
             'Leveringsvariationer',
             0,
             0,
             '',
             1,
             'Variaciones de Entrega',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Kledinguitgifte automaten',
             'GarmentDispenser',
             'Garment Dispensers',
             'Kleider Ausgabegerät (KAG)',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Distributeur vêtements',
             'Beklædningsdispensere',
             0,
             0,
             '',
             1,
             'Distribuidor de Ropas',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Afkeuren in batch',
             'RagInBatch',
             'Rag In Batch',
             'Aussondern in Massen',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Chiffonner en vrac',
             'Kassere i batch',
             0,
             0,
             '',
             1,
             'Desaprobar en Lote',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Afkeuren vanuit voorraad',
             'RagItemsFromStock',
             'Rag Items From Stock',
             'Aussondern Lagerteile',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'Y',
             'N',
             'Chiffonner articles de stock',
             'Kassere dele fra lager',
             0,
             0,
             '',
             0,
             'Desaprobar Artículos de Stock',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Ontvangst goederen van leverancier',
             'ReceiveItemsFromPO',
             'Receive Items From Purchase Order',
             'Einbuchen Lagerteile mit Bestellung',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Recevoir produits de commande d''achat',
             'Modtag dele fra indkøbsordre',
             1,
             0,
             '',
             0,
             'Recibir Artículos de Orden de Compra',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Ontvangst kleding in magazijn',
             'ReceiveItemsInStockNoPO',
             'Receive Items In Stock',
             'Einbuchen Lagerteile ohne Bestellung',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'Y',
             'Y',
             'N',
             'Recevoir articles en stock',
             'Beklædning til lager',
             1,
             0,
             '',
             0,
             'Recibir Artículos en Stock',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Vervangen / vernieuwen',
             'ReplacementRenewal',
             'Replacement/Renewal',
             'Ersetzen / Erneuern',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'Y',
             'N',
             'N',
             'Y',
             'Y',
             'N',
             'Remplacer / renouveler',
             'Udskiftning/Fornyelse',
             0,
             0,
             '',
             0,
             'Sustitución/Prorrogación',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Voorraadcorrectie niet-uniek',
             'StockCorrectionNonUnique',
             'Non-Unique Stock Correction',
             'Lagerkorrektur nicht einzelkodiert',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Correction de Stock Non-Unique',
             'Lagerkorrektion ikke-unik',
             0,
             0,
             '',
             0,
             'Corrección Stock No-único',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Correctie unieke voorraad',
             'StockCorrectionUnique',
             'Unique Stock Correction',
             'Lagerkorrektur einzelkodierte Teile',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Correction de stock unique',
             'Lagerkorrektion unik',
             0,
             0,
             '',
             0,
             'Corrección de Stock Único',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Dragers',
             'Wearer',
             'Wearers',
             'Träger',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'Y',
             'N',
             'Porteurs',
             'Medarbejdere',
             0,
             0,
             '',
             1,
             'Portadores',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Inzetopdrachten acceptatie',
             'WorkOrderApproval',
             'Work Orders waiting for Approval',
             'Kundenaufträge warten auf Genehmigung',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'Y',
             'N',
             'N',
             'N',
             'Y',
             'N',
             'Commandes client attendant autorisation',
             'Arbejdsordre afventende godkendelse',
             1,
             0,
             '',
             0,
             'Aprobación Orden de Trabajo',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Inzetopdracht',
             'WorkOrder',
             'Work Order',
             'Kundenauftrag einzeln',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Ordre de travail',
             'Arbejdsordre',
             1,
             0,
             '',
             0,
             'Orden de Trabajo',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Uit roulatie nemen',
             'ReturnToStock',
             'Take Items Out Of Circulation',
             'Zurücknahme Teile/Kleidung',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'Y',
             'N',
             'Reprise pièces/vêtements',
             'Tage beklædningsdele ud af cirkulation',
             0,
             0,
             '',
             1,
             'Retornar en Stock',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Ontvangen met demontage-opdracht',
             'ReceiveItemsFromDismountingOrder',
             'Receive Items from Dismounting Order',
             'Einbuchen über Demontage-Auftrag',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Recevoir articles d''ordre de démontage',
             'Modtag fra afmonteringsordre',
             0,
             0,
             '',
             0,
             '-',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Magazijnvoorraad verplaatsen',
             'MoveStock',
             'Move Stock',
             'Transfer Lagerbestand',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Déplacer stock',
             'Flyt lager',
             0,
             0,
             '',
             0,
             'Transferir Stock',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Verplaats voorraad binnen magazijn',
             'MoveStockWithinStockroom',
             'Move Stock within Stockroom',
             'Lagerbewegungen innerhalb eines Lagers',
             systemUserID,
             'Y',
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Déplacer Stock dans même magasin',
             'Flyt lagerbeholdning indenfor lager',
             0,
             0,
             '',
             0,
             'Transferir Stock dentro de Almacén',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Bevestig Sterilisatie',
             'ConfirmSterilization',
             'Confirm Sterilization',
             'Sterivorgang bestätigen',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Confirmer Stérilisation',
             'Bekræft Autoklavering',
             0,
             0,
             '',
             0,
             'Confirmar Esterilización',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Beheer sterilisaties',
             'SterilizationRunStatusControl',
             'Sterilization Run Status Control',
             'Verwaltung Sterilisationsvorgänge',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Sterilization Run Status Control',
             'Autoklavering Status Kontrol',
             0,
             0,
             '',
             0,
             'Gestión Control de Esterilización',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Distributiepunt logistiek (normen)',
             'StandardDelivery',
             'Consumption Point Logistics',
             'Verteilstelle Logistik (Normen)',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Normes de point de consommation',
             'Forbrugssteds logistik',
             0,
             0,
             '',
             1,
             'Punto de Consumo Logístico',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'OR Pack Status Control',
             'ORPackStatusControl',
             'OR Pack Status Control',
             'OR Pack Status Control',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Gestion Statut Paquets OP',
             'OP Pakke Status Kontrol',
             0,
             0,
             '',
             0,
             'Gestión de Estado de Empaquetar OR',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Directe kleding uitgifte',
             'IssueGarmentsDirect',
             'Direct Issue Garments',
             'Direkte Zuordnung Teile',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Sortie directe vêtements',
             'Direkte tildeling af beklædning',
             0,
             0,
             '',
             0,
             'Asignación Prenda Directamente',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Kledinguitgifte vanuit magazijn',
             'IssueGarmentsFromStock',
             'Issue Garments From Stock',
             'Zuordnen Teile vom Lager',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Sortie vêtements de stock',
             'Tildel beklædning fra lager',
             0,
             0,
             '',
             0,
             'Emisión de Ropas de Stock',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Correctiebon',
             'CorrectionTicket',
             'Correction Tickets',
             'Korrekturzettel',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Notes de correction',
             'Korrektionsnote',
             1,
             0,
             '',
             1,
             'Billete de Corrección',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Behandelingspartij controle',
             'TreatmentBatchControl',
             'Treatment Batch Control',
             '-',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'Y',
             'N',
             'N',
             'N',
             'Y',
             'N',
             'Contrôle traitement lot',
             'Behandlings batch kontrol',
             0,
             0,
             '',
             1,
             '-',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Ontvang items in magazijn via push-opdr.',
             'ReceiveItemsFromSDOPush',
             'Receive Items in Stock from Push Order',
             'Einbuchen Teile vom Push-Auftrag',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Recevoir articles de comm. push en stock',
             'Modtag til lager fra Push Ordre',
             1,
             0,
             '',
             0,
             'Recibir Art. en Stock por Orden Empuje',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Unieke kledingstukken',
             'UniqueItem',
             'Maintain Unique Items',
             'Wartung Einzelteile',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'Y',
             'N',
             'Articles uniques',
             'Vedlighold unikke dele',
             0,
             0,
             '',
             1,
             'Artículo Único',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Verkoopopdracht',
             'SalesOrder',
             'Sales Order',
             'Verkaufsauftrag',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Note de ventes',
             '-',
             1,
             0,
             '',
             1,
             'Nota de Venta',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Cliënt',
             'Client',
             'Client',
             'Bewohner',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Résident',
             'Beboer',
             1,
             0,
             '',
             0,
             'Habitante',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Rag Pool Multi Read',
             'RagPoolMultiRead',
             'Rag Pool Multi Read',
             'Rag Pool Multi Read',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Rag Pool Multi Read',
             'Rag Pool Multi Read',
             1,
             0,
             '',
             0,
             'Rag Pool Multi Read',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Bundel Sorteer Scan',
             'BundleSortScan',
             'Bundle Sort Scan',
             'Bündel Sortierung',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Scan tri paquet',
             'Scan bundt sortering',
             0,
             0,
             '',
             0,
             '-',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Inchecken items van inkooporder',
             'CheckInItemsFromPO',
             'Check-in items from Purchase Order',
             '-',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Check-in articles commande d`achat',
             'Check-in dele fra indkøbsordre',
             1,
             0,
             '',
             0,
             'Registración Artículos Orden de Compra',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Corrigeer ingecheckte items ink.order',
             'CorrectItemsCheckedInFromPO',
             'Correct items checked-in from PO',
             '-',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Corriger articles du check-in CdA',
             'Korriger dele indchecket fra indk.ordre',
             5,
             0,
             '',
             0,
             'Corregir artículos registrados OdC',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Maak unieke items ingech. items ink.ord.',
             'MakeUniqueItemsCheckedInFromPO',
             'Make unique items checked-in from PO',
             '-',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Codifier unique articles check-in CdA',
             'Dan unikke artikler via indkøbsordre',
             5,
             0,
             '',
             0,
             'Hacer único artículos registrados OdC',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Beheer Cleanroom Batches',
             'CleanroomBatchStatusControl',
             'Cleanroom Batch Status Control',
             '-',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'Y',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Gestion salle blanche',
             '-',
             0,
             0,
             '',
             0,
             '-',
             'N'
        from dual;
    insert into dialogs
      select seq_dialogs.nextval,
             'Cleanroom Batch',
             'CleanroomBatch',
             'Cleanroom Batch',
             '-',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Salle blanche',
             '-',
             1,
             0,
             '',
             0,
             '-',
             'N'
        from dual;
     insert into dialogs
      select seq_dialogs.nextval,
             'Verzendlijst Status Controle',
             'ShipmentListStatusControl',
             'Shipment List Status Control',
             'Versandlisten Statuskontrolle',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Gestion listes expédition',
             'Forsendelsesliste statuskontrol',
             1,
             0,
             '',
             0,
             'Gerencia Listas de Envío ',
             'N'
        from dual;
      insert into dialogs
      select seq_dialogs.nextval,
             'Consignatie voorraad OK pakketten',
             'DepositORPacks',
             'Deposit OR Packs',
             'Verwahrungslager OP-Pakete',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             '-',
             'Depot OP pakker',
             0,
             0,
             '',
             0,
             '-',
             'N'
        from dual;
      insert into dialogs
      select seq_dialogs.nextval,
             'Uitgifte verkoopartikelen',
             'IssueSalesItems',
             'Issue Sales Items',
             'Zuordnen Verkaufsaufträge',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Sortie articles de ventes',
             'Tildel salgsdele',
             0,
             0,
             '',
             1,
             'Emisión de Artículos de Venta',
             'N'
        from dual;
        insert into dialogs
      select seq_dialogs.nextval,
             'Uit roulatie nemen in batch',
             'ReturnToStockOrRagInBatch',
             'Take Items Out Of Circulation in Batch',
             'Zurücknahme Teile/Kleidung in Batch',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'Y',
             'N',
             'N',
             'Y',
             'N',
             'Reprise pièces/vêtements en groupe',
             'Tage beklædningsdele ud af cirkulation',
             0,
             0,
             '',
             1,
             'Retornar en Stock en Lote',
             'N'
        from dual;
        insert into dialogs
        select seq_dialogs.nextval,
             'Overwas Multi Read',
             'RewashMultiRead',
             'Rewash Multi Read',
             'Nachwäsche Multi-Read',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Rewash Multi Read',
             'Omvask Multi Read',
             0,
             0,
             '',
             0,
             'Rewash Multi Read',
             'N'
        from dual;
	insert into dialogs
        select seq_dialogs.nextval,
             'Wijzig Ontvangen items in magazijn via p',
             'CorrectReceivedItemsFromSDOPush',
             'Correct received items from SDO Push',
             'Korrektur Einbuchen Teile vom Push-Auftr',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Corriger Article Reçu depuis OLS',
             'Korriger artikel modtaget via push-ordre',
             5,
             0,
             '',
             0,
             'Corregir Art. Reci. en Stock por Orden',
             'N'
        from dual;

    --------REASONCODE tables----------
    insert into reasoncode
      (reasoncode_id,
       code,
       internetselectable,
       allowprepcharges,
       garmentreason,
       linenreason,
       exporttohandheld,
       cancelinvoice,
       affectsnextinvoice,
       affectscurrentinvoice,
       invoiceadjustment,
       firstissue,
       inventorytrigger,
       systemuser_id,
       timestamp,
       chargeresidualvalue,
       chargerestockingfee,
       reasonmakecoguniqueitem,
       processlostitems,
       invoicecategory,
       customerundelivered,
       sampleissue,
       extstocktranstype_id,
       regphysicalstocktrans,
       reasongroup,
       driversales,
       calculaterentonstock,
       servicetruck,
       orpackreason,
       defaultreasonforlabeling,
       defaultreasonundoreceivepo,
       defaultreceivesdopush,
       excludeexcesscharge,
       adjustcircfromfixeddelivery,
       stockinventorytransaction,
       residentialreason,
       reasonformainorder,
       excludescrutinycheck,
       chargeemblem,
       purchaseorderpriority_id)
      select seq_reasoncode.nextval,
             '-',
             'N',
             'N',
             'Y',
             'Y',
             'N',
             0,
             'N',
             'N',
             0,
             'N',
             0,
             systemUserId,
             sysdate,
             'N',
             'N',
             'N',
             'N',
             0,
             'N',
             'N',
             '',
             'N',
             '',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Y',
             ''
        from dual;

    INSERT INTO REASONCODEDIALOGS
      (REASONCODE_ID, DIALOG_ID, SELECTABLE, SYSTEMUSER_ID, TIMESTAMP)
      SELECT R.REASONCODE_ID, D.DIALOG_ID, 'Y', systemUserID, sysdate
        FROM REASONCODE R, DIALOGS D
       WHERE R.CODE = '-'
         AND D.CODE IN ('DeliveryNote',
                        'DeliveryVariations',
                        'GarmentDispenser',
                        'RagInBatch',
                        'RagItemsFromStock',
                        'ReceiveItemsFromPO',
                        'ReceiveItemsInStockNoPO',
                        'ReplacementRenewal',
                        'StockCorrectionNonUnique',
                        'StockCorrectionUnique',
                        'Wearer',
                        'WorkOrderApproval',
                        'WorkOrder',
                        'ReturnToStock',
                        'ReceiveItemsFromDismountingOrder',
                        'MoveStock',
                        'MoveStockWithinStockroom',
                        'ConfirmSterilization',
                        'SterilizationRunStatusControl',
                        'StandardDelivery',
                        'ORPackStatusControl',
                        'IssueGarmentsDirect',
                        'IssueGarmentsFromStock',
                        'CorrectionTicket',
                        'TreatmentBatchControl',
                        'ReceiveItemsFromSDOPush',
                        'UniqueItem',
                        'SalesOrder',
                        'Client',
                        'RagPoolMultiRead',
                        'BundleSortScan',
                        'CheckInItemsFromPO',
                        'CorrectItemsCheckedInFromPO',
                        'MakeUniqueItemsCheckedInFromPO',
                        'CleanroomBatchStatusControl',
                        'CleanroomBatch',
                        'ShipmentListStatusControl',
                        'DepositORPacks',
                        'ReturnToStockOrRagInBatch',
                        'RewashMultiRead',
                        'CorrectReceivedItemsFromSDOPush');

    --------RAGREASON tables---------
    insert into RAGREASON
      (RAGREASON_ID,
       CODE,
       SYSTEMUSER_ID,
       TIMESTAMP,
       ACTIVE,
       CHARGERESIDUALVALUE,
       ALLOWREISSUE,
       PROCESSLOSTITEMS,
       DEFAULTREASONUNDORECEIVEPO,
       CHARGERESIDUALINSURANCE,
       ORCONTENTSITEMS)
      select seq_ragreason.nextval,
             '-',
             systemUserID,
             sysdate,
             'Y',
             'N',
             'N',
             'N',
             'Y',
             0,
             'N'
        from dual;

    INSERT INTO RAGREASONDIALOGS
      (RAGREASON_ID, DIALOG_ID, SELECTABLE, SYSTEMUSER_ID, TIMESTAMP)
      SELECT R.RAGREASON_ID, D.DIALOG_ID, 'Y', systemUserID, sysdate
        FROM RAGREASON R, DIALOGS D
       WHERE D.CODE IN ('RagItemsFromStock',
                        'ReturnCreditItems',
                        'GarmentDispenser',
                        'ReturnToStock',
                        'StockCorrectionUnique',
                        'RagInBatch',
                        'RagPoolMultiRead',
                        'IssueSalesItems',
                        'ReturnToStockOrRagInBatch');

    --20013411.90
    insert into extrabags
      select bu.businessunit_id,
             1                  numberofbags,
             0                  numberofextrabags,
             systemUserID,
             sysdate
        from businessunit bu, dual;
    insert into extrabags
      select bu.businessunit_id,
             4                  numberofbags,
             1                  numberofextrabags,
             systemUserID,
             sysdate
        from businessunit bu, dual;
    insert into extrabags
      select bu.businessunit_id,
             12                 numberofbags,
             2                  numberofextrabags,
             systemUserID,
             sysdate
        from businessunit bu, dual;
    insert into extrabags
      select bu.businessunit_id,
             18                 numberofbags,
             3                  numberofextrabags,
             systemUserID,
             sysdate
        from businessunit bu, dual;
    insert into extrabags
      select bu.businessunit_id,
             24                 numberofbags,
             4                  numberofextrabags,
             systemUserID,
             sysdate
        from businessunit bu, dual;
    insert into extrabags
      select bu.businessunit_id,
             30                 numberofbags,
             5                  numberofextrabags,
             systemUserID,
             sysdate
        from businessunit bu, dual;
    insert into extrabags
      select bu.businessunit_id,
             36                 numberofbags,
             6                  numberofextrabags,
             systemUserID,
             sysdate
        from businessunit bu, dual;
    insert into extrabags
      select bu.businessunit_id,
             42                 numberofbags,
             7                  numberofextrabags,
             systemUserID,
             sysdate
        from businessunit bu, dual;
    insert into extrabags
      select bu.businessunit_id,
             48                 numberofbags,
             8                  numberofextrabags,
             systemUserID,
             sysdate
        from businessunit bu, dual;
    insert into extrabags
      select bu.businessunit_id,
             54                 numberofbags,
             9                  numberofextrabags,
             systemUserID,
             sysdate
        from businessunit bu, dual;
    insert into extrabags
      select bu.businessunit_id,
             60                 numberofbags,
             10                 numberofextrabags,
             systemUserID,
             sysdate
        from businessunit bu, dual;
    insert into extrabags
      select bu.businessunit_id,
             66                 numberofbags,
             11                 numberofextrabags,
             systemUserID,
             sysdate
        from businessunit bu, dual;
    insert into extrabags
      select bu.businessunit_id,
             72                 numberofbags,
             12                 numberofextrabags,
             systemUserID,
             sysdate
        from businessunit bu, dual;
    insert into extrabags
      select bu.businessunit_id,
             78                 numberofbags,
             13                 numberofextrabags,
             systemUserID,
             sysdate
        from businessunit bu, dual;
    insert into extrabags
      select bu.businessunit_id,
             84                 numberofbags,
             14                 numberofextrabags,
             systemUserID,
             sysdate
        from businessunit bu, dual;
    insert into extrabags
      select bu.businessunit_id,
             90                 numberofbags,
             15                 numberofextrabags,
             systemUserID,
             sysdate
        from businessunit bu, dual;
    insert into extrabags
      select bu.businessunit_id,
             96                 numberofbags,
             16                 numberofextrabags,
             systemUserID,
             sysdate
        from businessunit bu, dual;
    --MULTIREADEXCEPTIONREASON table
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (1, 'ID code not found in database', 'Y', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (2, 'Item is not in circulation', 'Y', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (3, 'Item scanned again within time interval', 'N', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (4, 'Item is ragged', 'Y', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (5, 'Pool item to be scanned on delivery note', 'Y', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (6, 'Not a pool item', 'Y', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (7, 'OR pack not allowed', 'Y', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (8, 'Item is part of a bundle, scan bundle', 'Y', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (9, 'Item is for a different customer', 'Y', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (10, 'Item has a flag that prohibits delivery', 'Y', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (11, 'No active contract found for product', 'Y', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (12, 'Already scanned at this delivery note', 'N', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (13, 'Pool item already scanned in', 'N', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (14, 'Duplicate ID Code found', 'Y', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (15, 'Scanned somewhere else in the meantime', 'Y', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (16, 'Item not scanned out', 'Y', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (17, 'Container ID not found in database', 'Y', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (18, 'Container inactive', 'Y', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (19, 'Container is for a different customer', 'Y', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (20, 'Container already scanned', 'Y', systemUserID, sysdate);
    insert into MULTIREADEXCEPTIONREASON
      (MULTIREADEXCEPTIONREASON_ID,
       FACTORYDESCRIPTION,
       STORELOGYN,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (21, 'Item is for a different department / cp', 'Y', systemUserID, sysdate);

    insert into multireadexceptionreason
      (multireadexceptionreason_id,
      factorydescription,
      storelogyn,
      systemuser_id,
      timestamp)
    values
      (22,
      'Container does not match packing note',
      'Y',
      systemUserID,
      sysdate);

    insert into multireadexceptionreason
      (multireadexceptionreason_id,
      factorydescription,
      storelogyn,
      systemuser_id,
      timestamp)
    values
      (23,
      'Container/exchange cart has deliverystop',
      'Y',
      systemUserID,
      sysdate);

    insert into multireadexceptionreason
      (multireadexceptionreason_id,
      factorydescription,
      storelogyn,
      systemuser_id,
      timestamp)
    values
      (24, 'Container is put on hold', 'Y', systemUserID, sysdate);

    insert into multireadexceptionreason
      (multireadexceptionreason_id,
      factorydescription,
      storelogyn,
      systemuser_id,
      timestamp)
    values
      (25,
      'Container is not exchangecart/substitute',
      'Y',
      systemUserID,
      sysdate);

    insert into multireadexceptionreason
      (multireadexceptionreason_id,
      factorydescription,
      storelogyn,
      systemuser_id,
      timestamp)
    values
      (26, 'Container is already scanned', 'Y', systemUserID, sysdate);

    insert into multireadexceptionreason
      (multireadexceptionreason_id,
      factorydescription,
      storelogyn,
      systemuser_id,
      timestamp)
    values
      (27, 'Different container scanned', 'Y', systemUserID, sysdate);

    insert into multireadexceptionreason
      (multireadexceptionreason_id,
      factorydescription,
      storelogyn,
      systemuser_id,
      timestamp)
    values
      (28,
      'Container not from this businessunit',
      'Y',
      systemUserID,
      sysdate);

    insert into multireadexceptionreason
      (multireadexceptionreason_id,
      factorydescription,
      storelogyn,
      systemuser_id,
      timestamp)
    values
      (29,
      'Item does not exist in Clean Room Batch',
      'Y',
      systemUserID,
      sysdate);

    insert into multireadexceptionreason
      (multireadexceptionreason_id,
      factorydescription,
      storelogyn,
      systemuser_id,
      timestamp)
    values
      (30,
      'Possible Stray Read',
      'Y',
      systemUserID,
      sysdate);

    insert into multireadexceptionreason
      (multireadexceptionreason_id,
      factorydescription,
      storelogyn,
      systemuser_id,
      timestamp)
    values
      (31,
      'Already scanned Rejected from Customer',
      'Y',
      systemUserID,
      sysdate);

    insert into multireadexceptionreason
      (multireadexceptionreason_id,
      factorydescription,
      storelogyn,
      systemuser_id,
      timestamp)
    values
      (32,
      'Already scanned as Clean Return',
      'Y',
      systemUserID,
      sysdate);

    insert into multireadexceptionreason
      (multireadexceptionreason_id,
      factorydescription,
      storelogyn,
      systemuser_id,
      timestamp)
    values
      (33,
      'Maximum number of rewashes',
      'Y',
      systemUserID,
      sysdate);

    insert into multireadexceptionreason
      (multireadexceptionreason_id,
      factorydescription,
      storelogyn,
      systemuser_id,
      timestamp)
    values
      (34,
      'Too many times rewashed',
      'Y',
      systemUserID,
      sysdate);

    insert into multireadexceptionreason_desc
      (multireadexceptionreason_id, language_id, description, systemuser_id, timestamp)
    select multireadexceptionreason_id, languageid, factorydescription, systemuser_id, timestamp
       from multireadexceptionreason;


    --garmentdispensermessage
    insert into garmentdispensermessage
      select seq_garmentdispensermessage.nextval,
             5,
             'G1',
             'Unknown error',
             'General Error Message, generated by Garment Dispenser (check the log files of the application for more information)',
             systemUserID,
             sysdate
        from dual;

    insert into garmentdispensermessage
      select seq_garmentdispensermessage.nextval,
             5,
             'G2',
             'IO Error',
             'file IO Error',
             systemUserID,
             sysdate
        from dual;

    insert into garmentdispensermessage
      select seq_garmentdispensermessage.nextval,
             5,
             'F1',
             'Field Count Error',
             null,
             systemUserID,
             sysdate
        from dual;

    insert into garmentdispensermessage
      select seq_garmentdispensermessage.nextval,
             5,
             'F2',
             'Field Format Error',
             'e.g. date format, or string when a number is expected, and so on',
             systemUserID,
             sysdate
        from dual;

    insert into garmentdispensermessage
      select seq_garmentdispensermessage.nextval,
             5,
             'F3',
             'Field Length Error',
             null,
             systemUserID,
             sysdate
        from dual;

    insert into garmentdispensermessage
      select seq_garmentdispensermessage.nextval,
             5,
             'F4',
             'Field Value Error',
             'e.g. smaller than the minimum or greater than  the maximum allowed value',
             systemUserID,
             sysdate
        from dual;

    insert into garmentdispensermessage
      select seq_garmentdispensermessage.nextval,
             5,
             'F5',
             'Invalid Characters',
             null,
             systemUserID,
             sysdate
        from dual;

    insert into garmentdispensermessage
      select seq_garmentdispensermessage.nextval,
             5,
             'T1',
             'Mandatory Field Missing',
             null,
             systemUserID,
             sysdate
        from dual;

    insert into garmentdispensermessage
      select seq_garmentdispensermessage.nextval,
             5,
             'T2',
             'In use',
             'In use or already defined',
             systemUserID,
             sysdate
        from dual;

    insert into garmentdispensermessage
      select seq_garmentdispensermessage.nextval,
             5,
             'T3',
             'Not defined',
             'Unknown field value (not defined)',
             systemUserID,
             sysdate
        from dual;

    insert into garmentdispensermessage
      select seq_garmentdispensermessage.nextval,
             5,
             'T4',
             'Type Error',
             'e.g. attempt to assign a PG garment to a Pool Wearer',
             systemUserID,
             sysdate
        from dual;

    --POSPLITCRITERIONTYPE table
    insert into POSPLITCRITERIONTYPE
    values
      (1,
       2,
       'WOCBU',
       'Work Order Creation Business Unit',
       systemUserID,
       sysdate,
       'N');

    insert into POSPLITCRITERIONTYPE
    values
      (2,
       2,
       'WOCUSTNO',
       'Work Order Customer Number',
       systemUserID,
       sysdate,
       'N');

    insert into POSPLITCRITERIONTYPE
    values
      (3, 2, 'WORC', 'Work Order Reason Code', systemUserID, sysdate, 'N');

    insert into POSPLITCRITERIONTYPE
    values
      (4,
       2,
       'WOEXBY',
       'Work Order Executed By',
       systemUserID,
       sysdate,
       'Y');

    insert into POSPLITCRITERIONTYPE
    values
      (5,
       2,
       'WOREQDEL',
       'Work Order Requested Delivery Date',
       systemUserID,
       sysdate,
       'Y');

    insert into POSPLITCRITERIONTYPE
    values
      (6,
       2,
       'WOPHASEDDEL',
       'Work Order Phased Delivery Allowed',
       systemUserID,
       sysdate,
       'Y');

    --UHF module
    ---UHFREADERMODEL table
    insert into UHFREADERBRAND
      (UHFREADERBRAND_ID, BRANDNUMBER, NAME, SYSTEMUSER_ID, TIMESTAMP)
    values
      (1, 25882, 'Impinj', 1, to_date('01-01-2011', 'dd-mm-yyyy'));

      INSERT INTO UHFREADERBRAND
        (UHFREADERBRAND_ID, BRANDNUMBER, NAME, SYSTEMUSER_ID, TIMESTAMP)
      VALUES
        (2, 38416, 'Nordic', systemUserID, sysdate);

      INSERT INTO UHFREADERBRAND
        (UHFREADERBRAND_ID, BRANDNUMBER, NAME, SYSTEMUSER_ID, TIMESTAMP)
      VALUES
        (3, 26554, 'M6', systemUserID, SYSDATE);

    insert into UHFREADERMODEL
      (UHFREADERMODEL_ID,
       MODELNUMBER,
       NAME,
       UHFREADERBRAND_ID,
       MAXSENSITIVITY,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (1, 1000000, 'R1000', 1, -80, 1, to_date('01-01-2011', 'dd-mm-yyyy'));
    insert into UHFREADERMODEL
      (UHFREADERMODEL_ID,
       MODELNUMBER,
       NAME,
       UHFREADERBRAND_ID,
       MAXSENSITIVITY,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (2, 1005000, 'R1005', 1, -80, 1, to_date('01-01-2011', 'dd-mm-yyyy'));
    insert into UHFREADERMODEL
      (UHFREADERMODEL_ID,
       MODELNUMBER,
       NAME,
       UHFREADERBRAND_ID,
       MAXSENSITIVITY,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (3, 2001001, 'R220', 1, -80, 1, to_date('01-01-2011', 'dd-mm-yyyy'));
    insert into UHFREADERMODEL
      (UHFREADERMODEL_ID,
       MODELNUMBER,
       NAME,
       UHFREADERBRAND_ID,
       MAXSENSITIVITY,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (4, 2001002, 'R420', 1, -80, 1, to_date('01-01-2011', 'dd-mm-yyyy'));
    insert into UHFREADERMODEL
      (UHFREADERMODEL_ID,
       MODELNUMBER,
       NAME,
       UHFREADERBRAND_ID,
       MAXSENSITIVITY,
       SYSTEMUSER_ID,
       TIMESTAMP)
    values
      (5, 2001003, 'R640', 1, -80, 1, to_date('01-01-2011', 'dd-mm-yyyy'));

      INSERT INTO UHFREADERMODEL
        (UHFREADERMODEL_ID,
         UHFREADERBRAND_ID,
         MODELNUMBER,
         NAME,
         MAXSENSITIVITY,
         SYSTEMUSER_ID,
         TIMESTAMP)
      VALUES
        (6, 2, 1, '813-S1A', -80, systemUserID, sysdate);
      INSERT INTO UHFREADERMODEL
        (UHFREADERMODEL_ID,
         MODELNUMBER,
         NAME,
         UHFREADERBRAND_ID,
         MAXSENSITIVITY,
         SYSTEMUSER_ID,
         TIMESTAMP)
      VALUES
        (7, 6, 'M6', 3, -80, systemUserID, SYSDATE);
      INSERT INTO UHFREADERMODEL
        (UHFREADERMODEL_ID,
         MODELNUMBER,
         NAME,
         UHFREADERBRAND_ID,
         MAXSENSITIVITY,
         SYSTEMUSER_ID,
         TIMESTAMP)
      VALUES
        (8, 2001009, 'R120', 1, -80, systemUserID, SYSDATE);

    ---UHFREGION table
    insert into UHFREGION
      (UHFREGION_ID,
       NAME,
       MAXPOWER,
       SYSTEMUSER_ID,
       TIMESTAMP,
       DISABLEFIXEDFREQMODE,
       MAXTOTALPOWER)
    values
      (0,
       ' Unspecified',
       32.5,
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       'N',
       33.0);
    insert into UHFREGION
      (UHFREGION_ID,
       NAME,
       MAXPOWER,
       SYSTEMUSER_ID,
       TIMESTAMP,
       DISABLEFIXEDFREQMODE,
       MAXTOTALPOWER)
    values
      (1,
       'FCC_Part_15',
       32.5,
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       'Y',
       36.0);
    insert into UHFREGION
      (UHFREGION_ID,
       NAME,
       MAXPOWER,
       SYSTEMUSER_ID,
       TIMESTAMP,
       DISABLEFIXEDFREQMODE,
       MAXTOTALPOWER)
    values
      (2,
       'ETSI_302_208',
       30,
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       'N',
       33.0);
    insert into UHFREGION
      (UHFREGION_ID,
       NAME,
       MAXPOWER,
       SYSTEMUSER_ID,
       TIMESTAMP,
       DISABLEFIXEDFREQMODE,
       MAXTOTALPOWER)
    values
      (3,
       'ETSI_300_220',
       32.5,
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       'N',
       33.0);
    insert into UHFREGION
      (UHFREGION_ID,
       NAME,
       MAXPOWER,
       SYSTEMUSER_ID,
       TIMESTAMP,
       DISABLEFIXEDFREQMODE,
       MAXTOTALPOWER)
    values
      (4,
       'Australia_LIPD_1W',
       32.5,
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       'Y',
       30.0);
    insert into UHFREGION
      (UHFREGION_ID,
       NAME,
       MAXPOWER,
       SYSTEMUSER_ID,
       TIMESTAMP,
       DISABLEFIXEDFREQMODE,
       MAXTOTALPOWER)
    values
      (5,
       'Australia_LIPD_4W',
       32.5,
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       'Y',
       36.0);
    insert into UHFREGION
      (UHFREGION_ID,
       NAME,
       MAXPOWER,
       SYSTEMUSER_ID,
       TIMESTAMP,
       DISABLEFIXEDFREQMODE,
       MAXTOTALPOWER)
    values
      (6,
       'Japan_ARIB_STD_T89',
       10,
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       'N',
       36.0);
    insert into UHFREGION
      (UHFREGION_ID,
       NAME,
       MAXPOWER,
       SYSTEMUSER_ID,
       TIMESTAMP,
       DISABLEFIXEDFREQMODE,
       MAXTOTALPOWER)
    values
      (7,
       'Hong_Kong_OFTA_1049',
       32.5,
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       'N',
       36.0);
    insert into UHFREGION
      (UHFREGION_ID,
       NAME,
       MAXPOWER,
       SYSTEMUSER_ID,
       TIMESTAMP,
       DISABLEFIXEDFREQMODE,
       MAXTOTALPOWER)
    values
      (8,
       'Taiwan_DGT_LP0002',
       32.5,
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       'N',
       30.0);
    insert into UHFREGION
      (UHFREGION_ID,
       NAME,
       MAXPOWER,
       SYSTEMUSER_ID,
       TIMESTAMP,
       DISABLEFIXEDFREQMODE,
       MAXTOTALPOWER)
    values
      (9,
       'Korea_MIC_Article_5_2',
       32.5,
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       'N',
       36.0);

    ---UHFANTENNAMODEL table
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
    values
      (1,
       'Laird Technologies S9028PC L/R',
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       6);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
    values
      (2,
       'Laird Technologies S8658PC L/R ',
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       3.85);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
    values
      (3,
       'Impinj IPJ-A0301-USA (Mini-Guardrail)',
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       15);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
    values
      (4,
       'Impinj IPJ-A0310-USA (Threshold-T Antenna) ',
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       6);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
    values
      (5,
       'Impinj  IPJ-A0400-USA, CSL CS-777-2 (Brickyard',
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       2);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
    values
      (6,
       'Impinj  IPJ-A0400-EU1, CSL CS-777-1 (Brickyard) ',
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       0);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
    values
      (7,
       'Impinj  IPJ-A0401-USA or IPJ-A0402-USA (both Guardwall)',
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       6);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
    values
      (8,
       'MA/COM MAAN-000246-FL1 integrated RFID floor-mounted stand',
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       6);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
    values
      (9,
       'MA/COM MAAN-000246-WL1 integrated RFID wall-mounted stand',
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       6);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
    values
      (10,
       'MTI MT-262006/TLH  or MT-262006/TRH',
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       6);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
    values
      (11,
       'MTI MT-262013/NLH or MT-262013/NRH',
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       4.5);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
    values
      (12,
       'MTI MT-262013/TLH or MT-262013/TRH',
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       4.5);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
    values
      (13,
       'MTI MT-242032/NLH or MT-242032/NRH',
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       1.85);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
    values
      (14,
       'Sensormatic Electronics Corp.  IDANT20CNA25 with 25 ft cable',
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       5.5);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
    values
      (15,
       'Sensormatic Electronics Corp.  IDANT10CNA25 with 25 ft cable',
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       3.5);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
    values
      (16,
       'Sensormatic Electronics Corp.  IDANT10CNA25 with 6 ft cable',
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       5.4);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
    values
      (17,
       'Sensormatic Electronics Corp.  IDANT10CEU25 with 6 ft cable',
       1,
       to_date('01-01-2011', 'dd-mm-yyyy'),
       3.25);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, GAIN, SYSTEMUSER_ID, TIMESTAMP)
    values
      (18, 'Datamars UHF Drop Chute', 0, 1, sysdate);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, GAIN, SYSTEMUSER_ID, TIMESTAMP)
    values
      (19, 'Impinj IPJ-A0311-EU1 (Threshold-FS Antenna)', 5, 1, sysdate);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, GAIN, SYSTEMUSER_ID, TIMESTAMP)
    values
      (20, 'TagSys SRU500NF Internal Antenna', 0, 1, sysdate);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, GAIN, SYSTEMUSER_ID, TIMESTAMP)
    values
      (21, 'Times-7 SlimLine A7030C FCC', 6, 1, sysdate);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, GAIN, SYSTEMUSER_ID, TIMESTAMP)
    values
      (22, 'Times-7 SlimLine A7030C ETSI', 5, 1, sysdate);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, GAIN, SYSTEMUSER_ID, TIMESTAMP)
    values
      (23, 'Times-7 SlimLine A6034', 9, 1, sysdate);
    insert into UHFANTENNAMODEL
      (UHFANTENNAMODEL_ID, NAME, GAIN, SYSTEMUSER_ID, TIMESTAMP)
    values
      (24, 'Times-7 SlimLine A6031', 4, 1, sysdate);
    insert into uhfantennamodel
      (uhfantennamodel_id, name, gain, systemuser_id, timestamp)
    values
      (25, 'MTI MT-242027/NRH or MT-242027/NLH', 8.5, 1, SYSDATE);
    insert into uhfantennamodel
      (uhfantennamodel_id, name, gain, systemuser_id, timestamp)
    values
      (26, 'Times-7 SlimLine A8060', 5, 1, SYSDATE);
    insert into uhfantennamodel
      (uhfantennamodel_id, name, gain, systemuser_id, timestamp)
    values
      (27, 'Times-7 GroundAntenna A6590C', 9, 1, SYSDATE);
    insert into uhfantennamodel
      (uhfantennamodel_id, name, gain, systemuser_id, timestamp)
    values
      (28, 'Times-7 SlimLine A6034S', 9, 1, SYSDATE);
    insert into uhfantennamodel
      (uhfantennamodel_id, name, gain, systemuser_id, timestamp)
    values
      (29, 'Times-7 SlimLine A6032', 7, 1, SYSDATE);
    insert into uhfantennamodel
      (uhfantennamodel_id, name, gain, systemuser_id, timestamp)
    values
      (30, 'Times-7 GroundMat A5530', 10, 1, SYSDATE);
    insert into uhfantennamodel
      (uhfantennamodel_id, name, gain, systemuser_id, timestamp)
    values
      (31, 'Times-7 SlimLine A5010', 8.3, 1, SYSDATE);
    insert into uhfantennamodel
      (uhfantennamodel_id, name, gain, systemuser_id, timestamp)
    values
      (32, 'Times-7 SlimLine A4030L', 7.5, 1, SYSDATE);
    insert into UHFANTENNAMODEL
      (uhfantennamodel_id, name, gain, systemuser_id, timestamp)
    values
      (33, 'Impinj xPortal.', 5.5, 1, sysdate);
insert into UHFANTENNAMODEL
  (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
values
  (34,
   'NORDIC ID SAMPO S Integrated standard antenna variant',
   systemUserID,
   sysdate,
   8);
insert into UHFANTENNAMODEL
  (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
values
  (35, 'Kathrein WIRA-30-circular-ETSI', systemUserID, sysdate, 11.5);
insert into UHFANTENNAMODEL
  (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
values
  (36, 'Kathrein WIRA-30-circular-FCC', systemUserID, sysdate, 11);
insert into UHFANTENNAMODEL
  (UHFANTENNAMODEL_ID, NAME, SYSTEMUSER_ID, TIMESTAMP, GAIN)
values
  (37, 'TagItron IPRO Panel Patch IINDO', systemUserID, sysdate, 4);

    --OrderPriority table
    insert into orderpriority
      select seq_orderpriority.nextval,
             1,
             '-',
             'Standard priority',
             1,
             'ffffff',
             'Y',
             'Y',
             'Y',
             systemUserID,
             sysdate,
             0,
             'N'
        from dual;

    insert into orderpriority
      select seq_orderpriority.nextval,
             2,
             '-',
             'Standard priority',
             1,
             'ffffff',
             'Y',
             'Y',
             'N',
             systemUserID,
             sysdate,
             0,
             'N'
        from dual;

    insert into orderpriority
      select seq_orderpriority.nextval,
             3,
             '-',
             'Standard priority',
             1,
             'ffffff',
             'Y',
             'Y',
             'N',
             systemUserID,
             sysdate,
             0,
             'N'
        from dual;

    --Order 20015011.110
    insert into appservercluster
      select seq_appservercluster.nextval,
             'PHYSICAL1',
             'Physical Cluster1',
             null,
             systemUserID,
             sysdate,
             1,
             null
        from dual;

    insert into appserverclustercontent
      select appsc.appservercluster_id,
             apps.applicationserver_id,
             0,
             systemUserID,
             sysdate,
             appsc.clustertype
        from appservercluster appsc, applicationserver apps
       where appsc.code = 'PHYSICAL1';

    insert into appservercluster
      select seq_appservercluster.nextval,
             'PHYSICAL2',
             'Physical Cluster2',
             null,
             systemUserID,
             sysdate,
             1,
             null
        from dual;

    insert into dialogs
      select seq_dialogs.nextval,
             'Relaties',
             'Customer',
             'Customers',
             'Kundenstamm',
             systemUserID,
             'Y',
             sysdate,
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'N',
             'Clients',
             'Kunder',
             0,
             0,
             '',
             1,
             'Cliente',
             'N'
        from dual;

    insert into fieldsperdialog
      (fieldsperdialog_id, dialog_id, field, timestamp)
    values
      (seq_fieldsperdialog.nextval,
       (select d.dialog_id from dialogs d where d.code = 'Customer'),
       'txtName',
       sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'lblName', sysdate);

    insert into fieldsperdialog
      (fieldsperdialog_id, dialog_id, field, timestamp)
    values
      (seq_fieldsperdialog.nextval,
       (select d.dialog_id from dialogs d where d.code = 'Customer'),
       'txtLegalName',
       sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'lblLegalName', sysdate);

    insert into fieldsperdialog
      (fieldsperdialog_id, dialog_id, field, timestamp)
    values
      (seq_fieldsperdialog.nextval,
       (select d.dialog_id from dialogs d where d.code = 'Customer'),
       'txtLegacyCode',
       sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'lblLegacyCode', sysdate);

    insert into fieldsperdialog
      (fieldsperdialog_id, dialog_id, field, timestamp)
    values
      (seq_fieldsperdialog.nextval,
       (select d.dialog_id from dialogs d where d.code = 'Customer'),
       'srfAccountReceivable',
       sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'lblAccountReceivable', sysdate);

    insert into fieldsperdialog
      (fieldsperdialog_id, dialog_id, field, timestamp)
    values
      (seq_fieldsperdialog.nextval,
       (select d.dialog_id from dialogs d where d.code = 'Customer'),
       'cmbNationalAccount',
       sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'lblNationalAccount', sysdate);

    insert into fieldsperdialog
      (fieldsperdialog_id, dialog_id, field, timestamp)
    values
      (seq_fieldsperdialog.nextval,
       (select d.dialog_id from dialogs d where d.code = 'Customer'),
       'txtMasterAccount',
       sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'lblMasterAccount', sysdate);

    insert into fieldsperdialog
      (fieldsperdialog_id, dialog_id, field, timestamp)
    values
      (seq_fieldsperdialog.nextval,
       (select d.dialog_id from dialogs d where d.code = 'Customer'),
       'txtCocNumber',
       sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'lblCocNumber', sysdate);

    insert into fieldsperdialog
      (fieldsperdialog_id, dialog_id, field, timestamp)
    values
      (seq_fieldsperdialog.nextval,
       (select d.dialog_id from dialogs d where d.code = 'Customer'),
       'btnCommentOnStatement',
       sysdate);

    insert into fieldsperdialog
      (fieldsperdialog_id, dialog_id, field, timestamp)
    values
      (seq_fieldsperdialog.nextval,
       (select d.dialog_id from dialogs d where d.code = 'Customer'),
       'rbPaymentMethod',
       sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'lblPaymentMethod', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'cmbPaymentType', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'lblPayByCustomer', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'srfPayByCustomer', sysdate);

    insert into fieldsperdialog
      (fieldsperdialog_id, dialog_id, field, timestamp)
    values
      (seq_fieldsperdialog.nextval,
       (select d.dialog_id from dialogs d where d.code = 'Customer'),
       'txtAddress1US',
       sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'lblStreetHouseUS', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'lblAddress1US', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'txtHouseNrExtUS', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'txtHouseUS', sysdate);

    insert into fieldsperdialog
      (fieldsperdialog_id, dialog_id, field, timestamp)
    values
      (seq_fieldsperdialog.nextval,
       (select d.dialog_id from dialogs d where d.code = 'Customer'),
       'txtAddress2US',
       sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'lblAddress2US', sysdate);

    insert into fieldsperdialog
      (fieldsperdialog_id, dialog_id, field, timestamp)
    values
      (seq_fieldsperdialog.nextval,
       (select d.dialog_id from dialogs d where d.code = 'Customer'),
       'txtZipCodeUS',
       sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'txtCityUS', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'lblCity_State_ZipCodeUS', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'txtStateUS', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'txtCountyUS', sysdate);

    insert into fieldsperdialog
      (fieldsperdialog_id, dialog_id, field, timestamp)
    values
      (seq_fieldsperdialog.nextval,
       (select d.dialog_id from dialogs d where d.code = 'Customer'),
       'rbTax',
       sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'txtCertificateUS', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'btnGoUS', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'btnOpenUS', sysdate);
    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'txtTaxExemptCodeUS', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'cmbCountyUS', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'cbCountyUS', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'cmbCityUS', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'cbCityUS', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'lblCertifRecDateUS', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'dfCertifRecDateUS', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'lblStateUS', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      (seq_fieldsperdialog.currval, 'cmbStatesUS', sysdate);

    insert into fieldsrelations
      (fieldsperdialog_id, field_successor, timestamp)
    values
      ((select fieldsperdialog_id
         from fieldsperdialog
        where field = 'txtCocNumber'),
       'txtPnNumber',
       sysdate);

    insert into fieldsperdialog
      (fieldsperdialog_id, dialog_id, field, timestamp)
    values
      (seq_fieldsperdialog.nextval,
       (select d.dialog_id from dialogs d where d.code = 'Customer'),
       'deliverySchemesPerStopTable',
       sysdate);

    insert into accessrightfieldlists a
      select f.fieldsperdialog_id,
             arl.accessrightslist_id,
             0,
             systemUserID,
             sysdate
        from fieldsperdialog f, accessrightslist arl
       where f.field = 'deliverySchemesPerStopTable';

    --  CONTRACTATTRIBUTE
    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (1,
       1,
       1,
       'CustomerRelated',
       'cmbCustomerRelated',
       systemUserID,
       sysdate,
       2);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (5,
       2,
       1,
       'AllowAutomaticSales',
       'cbAllowAutomaticSales',
       systemUserID,
       sysdate,
       2);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (39,
       4,
       1,
       'ChargePrepCharge',
       'cbGeneralPrepCharge',
       systemUserID,
       sysdate,
       2);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (51,
       7,
       1,
       'InvoiceFrequencyCode',
       'cmbInvoiceFrequency',
       systemUserID,
       sysdate,
       0);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (53,
       7,
       3,
       'MinimumInvoiceAmount',
       'txtMinInvoiceAmount',
       systemUserID,
       sysdate,
       2);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (55,
       7,
       5,
       'SplitInvoicesPerActivity',
       'cbSplitInvoicesPerActivity',
       systemUserID,
       sysdate,
       2);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (63,
       7,
       13,
       'ChargeLossForPoolItems',
       'cbChargeLossForPoolAfterXDays',
       systemUserID,
       sysdate,
       2);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (64,
       7,
       14,
       'ChargeLossForUniquePoolDays',
       'sfChargeLossForPoolNoDays',
       systemUserID,
       sysdate,
       2);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (73,
       7,
       23,
       'SendStatement',
       'rbSendStatement',
       systemUserID,
       sysdate,
       2);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (74,
       7,
       24,
       'StatementFrequencyCode',
       'cmbFrequencyStatement',
       systemUserID,
       sysdate,
       1);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (75,
       7,
       26,
       'AttachInvoiceCopies',
       'cbAttachInvoice',
       systemUserID,
       sysdate,
       2);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (76,
       7,
       27,
       'StatementPerCustomer',
       'cbStatementPerCustomer',
       systemUserID,
       sysdate,
       2);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (77,
       7,
       28,
       'InvoiceComments',
       'btnCommentOnInvoice',
       systemUserID,
       sysdate,
       1);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (79,
       7,
       30,
       'StatementComments',
       'btnCommentOnStatement',
       systemUserID,
       sysdate,
       1);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (83,
       8,
       4,
       'PaymentTermsCode',
       'cmbPaymentTerms',
       systemUserID,
       sysdate,
       0);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (88,
       8,
       9,
       'FinanceChargeDays',
       'sfFinancialChargeDays',
       systemUserID,
       sysdate,
       2);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (89,
       8,
       10,
       'PutFinanceChargeOn',
       'cbFinancialCharge',
       systemUserID,
       sysdate,
       2);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (96,
       7,
       25,
       'SendStatementByE-mail',
       'cbSendByEmailStat',
       systemUserID,
       sysdate,
       2);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (97,
       7,
       26,
       'SendStatementByFax',
       'cbSendByFaxStat',
       systemUserID,
       sysdate,
       2);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (98, 1, 5, 'SoilCount', 'cbSoilCounted', systemUserID, sysdate, 2);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (99,
       1,
       6,
       'InternetOrdering',
       'cbInternetOrdering',
       systemUserID,
       sysdate,
       2);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (104,
       4,
       12,
       'CustomGarmentCharge',
       'cbCustomGarmentCharge',
       systemUserID,
       sysdate,
       2);

    INSERT INTO CONTRACTATTRIBUTE
      (CONTRACTATTRIBUTE_ID,
       GROUPNUMBER,
       SEQUENCENUMBER,
       FACTORYNAME,
       INTERNALNAME,
       SYSTEMUSER_ID,
       TIMESTAMP,
       NOVALUERULE)
    VALUES
      (105,
       4,
       13,
       'Budget Protection',
       'customerBudgetProtectionField',
       systemUserID,
       sysdate,
       0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (100, 10, 0, 'ContractProductBilling', 'Table_CONTRACTPRODUCTBILLING', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (101, 11, 0, 'ContractProductPricing', 'ContractProductPricing', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (102, 12, 0, 'ContractProductLogistics', 'Table_CONTRACTPRODUCTORDERDELIVERY', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (103, 13, 0, 'ContractProductMiscellaneous', 'Table_CONTRACTPRODUCTMISCELLANEOUS', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (106, 14, 0, 'ContractProductBudgetProtection', 'Table_CONTRACTPRODUCTBGPROTECTION', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (107, 10, 1, 'BillingMethod', 'cmbBillingMethod', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (108, 10, 2, 'ChangesPerWeek', 'rbChangesPerWeek', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (109, 10, 3, 'ChargeOverUse', 'cbChargeOveruse1', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (110, 10, 4, 'RentPricePerFrequency', 'cbDelFreqRelatedPricing', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (111, 10, 5, 'ChargeWashesOnlyForCOG', 'cbChargeWashesOnlyCOG', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (112, 10, 6, 'InventoryBillingType', 'btnGroupInvBillingType', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (113, 10, 7, 'MinimumTurnAround', 'rbMinTurnArround', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (114, 10, 8, 'MinimumFrequency', 'cmbCalcRentEvery', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (115, 10, 9, 'ChargeLossForPool_YN', 'cbChargeLossForPool', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (116, 10, 10, 'ChargeLossUniquePoolDays', 'spAfterDays', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (117, 10, 11, 'PriceUsage', 'rbPriceUsage', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (118, 10, 12, 'ChargeRentNoReturnPoolWeeksAfterWks', 'spAfterWeeks', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (119, 10, 13, 'ChargeRentNotReturned', 'cmbChargeRentNotReturned', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (120, 10, 14, 'PercentageAfterDepreciation', 'spAfterDeprecCharge', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (121, 10, 15, 'InvoiceFreqRelatedPrice', 'cbInvoiceFrequencyRelatedRentPrice', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (122, 10, 16, 'InvWashBasedOnSoilCount', 'cbInvWashBasedOnSoil', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (123, 10, 17, 'ChargeWashesPack', 'cmbChargeWashesFor4', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (124, 10, 18, 'ReturnStockAllowed', 'cbReturnStockAllowed5', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (125, 10, 19, 'SeasonType_ID', 'cbSeasonRelated', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (126, 10, 20, 'SeasonalRent', 'cmbSeasonalRent', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (127, 10, 21, 'ChargeWashInactiveSeason', 'cbChargeRentInactive', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (128, 10, 22, 'ResidualValueScheme_ID', 'cmbResidualValueScheme', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (129, 10, 23, 'SRCMethod', 'cbrbSystematicReplacement', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (130, 10, 24, 'SCRPercentageSoilCount', 'dfPercOfSoilCount', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (131, 10, 25, 'SRCPercentageInventory', 'dfPercOfCircInv', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (132, 10, 26, 'SRCPercentageBilledQty', 'dfPercOfBilledQty', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (133, 10, 27, 'SRCFrequency', 'cmbCalculateEvery', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (134, 10, 28, 'SRCChargeRent', 'cbSRCChargeRent', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (135, 10, 29, 'ShowFOCRentOnInvoice', 'cbShowFOCInv', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (136, 10, 30, 'ResetRVUponReIssue', 'cbResetRvUponReissue', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (137, 10, 31, 'DeliverReplacementQty', 'cbDeliverReplaceQty', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (138, 11, 1, 'RentPrice', 'RentPrice', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (139, 11, 2, 'WashPrice', 'WashPrice', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (140, 11, 3, 'SalesPrice', 'SalesPrice', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (141, 11, 4, 'ReplacementPrice', 'ReplacementPrice', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (142, 11, 5, 'InsurancePrice', 'InsurancePrice', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (143, 11, 6, 'RentDiscount', 'RentDiscount', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (144, 11, 7, 'WashDiscount', 'WashDiscount', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (145, 12, 1, 'DelayedEvenExchange', 'rbDelayedEvenExchange', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (146, 12, 2, 'DEEDeliveryFrequency', 'cbDeeDeliveryFrequency', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (147, 12, 3, 'StraightEvenExchange', 'cbStraightEvenExchange', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (148, 12, 4, 'OrderViaWeb', 'cbOrderViaWeb', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (149, 12, 5, 'SoilCountMethod', 'cmbSoilCountMethod', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (150, 12, 6, 'CleanCount', 'cbCleanCounted', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (151, 12, 7, 'CodeUniquely', 'cbCodeUniquely', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (152, 12, 8, 'OnSiteInventoryCount', 'cbOnSiteInventoryCount', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (153, 12, 9, 'AutomaticSales', 'cbAutomaticSales', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (154, 12, 10, 'CustomerRelatedGarments', 'cbCustomerRelated', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (155, 12, 11, 'AutoReplAfterLifeTime', 'cbAutoReplAfterLifeTime', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (156, 12, 12, 'AllowReturnToStock', 'cmbAllowReturnToStock', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (157, 12, 13, 'RaggedItemAction', 'cmbRaggedItemAction', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (158, 13, 1, 'CustomCode', 'txtCode', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (159, 13, 2, 'CustomDescription', 'txtDescription', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (160, 13, 3, 'EANNumber', 'dfEANNumber', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (161, 13, 4, 'NANNumber', 'txtNANNumber', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (162, 13, 5, 'SalesEmployee_ID', 'srfSalesPerson', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (163, 13, 6, 'CommissionPayable', 'cbCommissionPayable', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (164, 13, 7, 'SalesEmployee2_ID', 'srfSalesEmployee2', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (165, 13, 8, 'ContractPurchaseOrder_ID', 'cmbPurchaseOrderNumber', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (166, 13, 9, 'ContractPurchaseOrderLine_ID', 'cmbPurchaseOrderLine', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (167, 13, 10, 'GainReason_ID', 'cmbGainReason', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (168, 13, 11, 'GainCompetitor_ID', 'cmbGainCompetitor', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (169, 13, 12, 'LostReason_ID', 'cmbLostReason', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (170, 13, 13, 'LostCompetitor_ID', 'cmbLostCompetitor', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (171, 13, 14, 'Remark', 'txtRemark', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (172, 4, 14, 'UseProdSizeSurchargePricing', 'cbUseProdSizeSurchargePricing', systemUserID, sysdate, 2);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (173, 14, 1, 'BudgetProtection', 'PLPCBudgetProtection', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (174, 15, 0, 'ImageCare', 'ContractProductImageCare', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (175, 15, 1, 'PLPCImageCare', 'plpcImageCareField', systemUserID, sysdate, 0);

INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (176, 2, 16, 'AutoSoilPercentage', 'txtAutoSoil', systemUserID, sysdate, 0);

  INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (177, 12, 14, 'PLPCAutoSoilPercentage', 'PLPCAutoSoilPercentage', systemUserID, sysdate, 0);

  INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (178, 10, 32, 'PORequired', 'PORequired', systemUserID, sysdate, 2);

  INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (179, 2, 19, 'NameLabelLayout', 'cmbNameLabelLayout', systemUserID, sysdate, 2);

  INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (180, 16, 0, 'EmblemTemplate', 'Table_CONTRACTEMBTEMP', systemUserID, sysdate, 0);

  INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (181, 17, 0, 'WearerFunction', 'Table_CONTRACTWEARERFUNCTION', systemUserID, sysdate, 0);

  INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (247, 4, 15, 'GarmentRentSpecification', 'cmbGarmentRentSpecification', systemUserID, sysdate, 2);

  INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (248, 4, 16, 'SpecialSizeCharge', 'cbSpecialSizeCharge', systemUserID, sysdate, 2);

  INSERT INTO CONTRACTATTRIBUTE
  (CONTRACTATTRIBUTE_ID, GROUPNUMBER, SEQUENCENUMBER, FACTORYNAME, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP, NOVALUERULE)
VALUES
  (250, 4, 17, 'MerchandiseBuyoutCharge', 'cbMerchandiseBuyoutCharge', systemUserID, sysdate, 2);

      --  CONTRACTATTRIBUTEDEPEND
INSERT INTO CONTRACTATTRIBUTEDEPEND
  (CONTRACTATTRIBUTE_ID, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP)
VALUES
  (108, 'cbChargeOveruse3', systemUserID, sysdate);

INSERT INTO CONTRACTATTRIBUTEDEPEND
  (CONTRACTATTRIBUTE_ID, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP)
VALUES
  (108, 'cbChargeOveruse1', systemUserID, sysdate);

INSERT INTO CONTRACTATTRIBUTEDEPEND
  (CONTRACTATTRIBUTE_ID, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP)
VALUES
  (112, 'spMinTurnArround', systemUserID, sysdate);

INSERT INTO CONTRACTATTRIBUTEDEPEND
  (CONTRACTATTRIBUTE_ID, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP)
VALUES
  (112, 'TxtMinTurnAround', systemUserID, sysdate);

INSERT INTO CONTRACTATTRIBUTEDEPEND
  (CONTRACTATTRIBUTE_ID, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP)
VALUES
  (115, 'spAfterDaysCOG4', systemUserID, sysdate);

INSERT INTO CONTRACTATTRIBUTEDEPEND
  (CONTRACTATTRIBUTE_ID, INTERNALNAME, SYSTEMUSER_ID, TIMESTAMP)
VALUES
  (115, 'spAfterDaysBM2', systemUserID, sysdate);

    --OOSAction
    INSERT INTO OOSACTION O
      (O.OOSACTION_ID, O.FACTORYDESCRIPTION, O.SYSTEMUSER_ID, O.TIMESTAMP)
    VALUES
      (1, 'Purchasing', systemUserID, SYSDATE);

    INSERT INTO OOSACTION O
      (O.OOSACTION_ID, O.FACTORYDESCRIPTION, O.SYSTEMUSER_ID, O.TIMESTAMP)
    VALUES
      (2, 'Receive items on Stock', systemUserID, SYSDATE);

    INSERT INTO OOSACTION O
      (O.OOSACTION_ID, O.FACTORYDESCRIPTION, O.SYSTEMUSER_ID, O.TIMESTAMP)
    VALUES
      (4, 'Reserve items from stockroom', systemUserID, SYSDATE);

    INSERT INTO OOSACTION O
      (O.OOSACTION_ID, O.FACTORYDESCRIPTION, O.SYSTEMUSER_ID, O.TIMESTAMP)
    VALUES
      (5, 'MaintainUI- Change stock location', systemUserID, SYSDATE);

    INSERT INTO OOSACTION O
      (O.OOSACTION_ID, O.FACTORYDESCRIPTION, O.SYSTEMUSER_ID, O.TIMESTAMP)
    VALUES
      (6, 'MaintainUI – Change product/Size/Grad', systemUserID, SYSDATE);

    INSERT INTO OOSACTION O
      (O.OOSACTION_ID, O.FACTORYDESCRIPTION, O.SYSTEMUSER_ID, O.TIMESTAMP)
    VALUES
      (10, 'Allocate items for Backorder', systemUserID, SYSDATE);

    INSERT INTO OOSACTION O
      (O.OOSACTION_ID, O.FACTORYDESCRIPTION, O.SYSTEMUSER_ID, O.TIMESTAMP)
    VALUES
      (11, 'Order items for stock replenishment', systemUserID, SYSDATE);

    --OOSRESTRICTION
    INSERT INTO OOSRESTRICTION
      (OOSRESTRICTION_ID, FACTORYDESCRIPTION, SYSTEMUSER_ID, TIMESTAMP)
    VALUES
      (1, 'Always allowed', systemUserID, SYSDATE);

    INSERT INTO OOSRESTRICTION
      (OOSRESTRICTION_ID, FACTORYDESCRIPTION, SYSTEMUSER_ID, TIMESTAMP)
    VALUES
      (2, 'Never allowed', systemUserID, SYSDATE);

    INSERT INTO OOSRESTRICTION
      (OOSRESTRICTION_ID, FACTORYDESCRIPTION, SYSTEMUSER_ID, TIMESTAMP)
    VALUES
      (3, 'Only allowed blocked locations', systemUserID, SYSDATE);

    INSERT INTO OOSRESTRICTION
      (OOSRESTRICTION_ID, FACTORYDESCRIPTION, SYSTEMUSER_ID, TIMESTAMP)
    VALUES
      (4,
       'Only allowed blocked-and picking locations',
       systemUserID,
       SYSDATE);

    INSERT INTO OOSRESTRICTION
      (OOSRESTRICTION_ID, FACTORYDESCRIPTION, SYSTEMUSER_ID, TIMESTAMP)
    VALUES
      (5, 'Maximum available quantity', systemUserID, SYSDATE);

    --OOSACTIONRESTRICTION
    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 1, 1, systemUserID, SYSDATE);

    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 1, 2, systemUserID, SYSDATE);

    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 2, 1, systemUserID, SYSDATE);

    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 2, 2, systemUserID, SYSDATE);

    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 2, 3, systemUserID, SYSDATE);

    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 2, 4, systemUserID, SYSDATE);

    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 4, 1, systemUserID, SYSDATE);

    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 4, 2, systemUserID, SYSDATE);

    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 4, 5, systemUserID, SYSDATE);

    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 5, 1, systemUserID, SYSDATE);

    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 5, 2, systemUserID, SYSDATE);

    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 5, 3, systemUserID, SYSDATE);

    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 5, 4, systemUserID, SYSDATE);

    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 6, 1, systemUserID, SYSDATE);

    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 6, 2, systemUserID, SYSDATE);

    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 10, 2, systemUserID, SYSDATE);

    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 10, 5, systemUserID, SYSDATE);

    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 11, 1, systemUserID, SYSDATE);

    INSERT INTO OOSACTIONRESTRICTION
      (OOSACTIONRESTRICTION_ID,
       OOSACTION_ID,
       OOSRESTRICTION_ID,
       SYSTEMUSER_ID,
       TIMESTAMP)
    VALUES
      (SEQ_OOSACTIONRESTRICTION.NEXTVAL, 11, 2, systemUserID, SYSDATE);

    --SERVICECHARGEEVENT
    INSERT INTO SERVICECHARGEEVENT
      (SERVICECHARGEEVENT_ID, FACTORYDESCRIPTION, SYSTEMUSER_ID, TIMESTAMP)
    VALUES
      (1, 'Rag LOG items with RV', systemUserID, SYSDATE);

    INSERT INTO SERVICECHARGEEVENT
      (SERVICECHARGEEVENT_ID, FACTORYDESCRIPTION, SYSTEMUSER_ID, TIMESTAMP)
    VALUES
      (2, 'Rag LOG items without RV', systemUserID, SYSDATE);

    INSERT INTO SERVICECHARGEEVENT
      (SERVICECHARGEEVENT_ID, FACTORYDESCRIPTION, SYSTEMUSER_ID, TIMESTAMP)
    VALUES
      (3, 'Rag COG items', systemUserID, SYSDATE);

    INSERT INTO SERVICECHARGEEVENT
      (SERVICECHARGEEVENT_ID, FACTORYDESCRIPTION, SYSTEMUSER_ID, TIMESTAMP)
    VALUES
      (4, 'Return LOG items to stock with RV', systemUserID, SYSDATE);

    INSERT INTO SERVICECHARGEEVENT
      (SERVICECHARGEEVENT_ID, FACTORYDESCRIPTION, SYSTEMUSER_ID, TIMESTAMP)
    VALUES
      (5, 'Return LOG items to stock without RV', systemUserID, SYSDATE);

    INSERT INTO SERVICECHARGEEVENT
      (SERVICECHARGEEVENT_ID, FACTORYDESCRIPTION, SYSTEMUSER_ID, TIMESTAMP)
    VALUES
      (6, 'Return COG items to stock', systemUserID, SYSDATE);
    INSERT INTO SERVICECHARGEEVENT
      (SERVICECHARGEEVENT_ID, FACTORYDESCRIPTION, SYSTEMUSER_ID, TIMESTAMP)
    VALUES
      (7, 'Loss for Unique Pool Items', systemUserID, SYSDATE);

    INSERT INTO SERVICECHARGEEVENT_DESC
      (SERVICECHARGEEVENT_ID,
       LANGUAGE_ID,
       DESCRIPTION,
       SYSTEMUSER_ID,
       TIMESTAMP)
      SELECT SERVICECHARGEEVENT_ID,
             LANGUAGE_ID,
             FACTORYDESCRIPTION,
             systemUserID,
             SYSDATE
        FROM SERVICECHARGEEVENT, LANGUAGES;

    --- preference table ---
    insert into preference p
    select seq_preference.nextval,
       'FONT_SIZE',
       'Compact',
       systemUserID,
       sysdate
       from dual;

    insert into preference p
    select seq_preference.nextval,
       'MENU_TYPE',
       'Static',
       systemUserID,
       sysdate
       from dual;

    insert into preference p
    select seq_preference.nextval,
       'CURRENT_BU',
       null,
       systemUserID,
       sysdate
       from dual;

    insert into preference p
    select seq_preference.nextval,
       'CURRENT_WORKSPOT',
       null,
       systemUserID,
       sysdate
       from dual;

    insert into preference p
    select seq_preference.nextval,
       'CURRENT_WORKSTATION',
       null,
       systemUserID,
       sysdate
       from dual;

    -- applicationservermessage --
    insert into applicationservermessage
    select 1,
       1,
       'The Server Application to which you are connected will be shut down at scheduled time:',
       systemUserID,
       sysdate
       from dual;

    insert into applicationservermessage
    select 2,
       2,
       'A new license file has been activated for the active Business Unit. Please restart your client application',
       systemUserID,
       sysdate
       from dual;

    -- licensetranstype --
    insert into licensetranstype(licensetranstype_id,description,systemuser_id,timestamp)
    select 1,
       'New module added',
       systemUserID,
       sysdate
       from dual;

    insert into licensetranstype(licensetranstype_id,description,systemuser_id,timestamp)
    select 2,
       'Module removed',
       systemUserID,
       sysdate
       from dual;

    insert into licensetranstype(licensetranstype_id,description,systemuser_id,timestamp)
    select 3,
       'Module parameter changed',
       systemUserID,
       sysdate
       from dual;

    insert into licensetranstype(licensetranstype_id,description,systemuser_id,timestamp)
    select 4,
       'Module demo end date changed',
       systemUserID,
       sysdate
       from dual;

    insert into licensetranstype(licensetranstype_id,description,systemuser_id,timestamp)
    select 5,
       'Number of full task users changed',
       systemUserID,
       sysdate
       from dual;

    insert into licensetranstype(licensetranstype_id,description,systemuser_id,timestamp)
    select 6,
       'Number of single task users changed',
       systemUserID,
       sysdate
       from dual;

    insert into licensetranstype(licensetranstype_id,description,systemuser_id,timestamp)
    select 7,
       'Plant added',
       systemUserID,
       sysdate
       from dual;

    insert into licensetranstype(licensetranstype_id,description,systemuser_id,timestamp)
    select 8,
       'Plant removed',
       systemUserID,
       sysdate
       from dual;

    insert into licensetranstype(licensetranstype_id,description,systemuser_id,timestamp)
    select 9,
       'License expiration date changed',
       systemUserID,
       sysdate
       from dual;

    insert into licensetranstype(licensetranstype_id,description,systemuser_id,timestamp)
    select 10,
       'New License',
       systemUserID,
       sysdate
       from dual;

    -- helptext table --
    insert into helptext(helptext_id, screenid, screenname, helptext, systemuser_id, timestamp)
    select
       seq_helptext.nextval,
       1,
       'Kiosk Login',
       'Kiosk Login',
       systemUserID,
       sysdate
       from dual;

    insert into helptext(helptext_id, screenid, screenname, helptext, systemuser_id, timestamp)
    select
       seq_helptext.nextval,
       2,
       'Phone Login',
       'Phone Login',
       systemUserID,
       sysdate
       from dual;

    insert into helptext(helptext_id, screenid, screenname, helptext, systemuser_id, timestamp)
    select
       seq_helptext.nextval,
       3,
       'My Repairs',
       'My Repairs',
       systemUserID,
       sysdate
       from dual;

    insert into helptext(helptext_id, screenid, screenname, helptext, systemuser_id, timestamp)
    select
       seq_helptext.nextval,
       4,
       'My Profile',
       'My Profile',
       systemUserID,
       sysdate
       from dual;

     insert into helptext(helptext_id, screenid, screenname, helptext, systemuser_id, timestamp)
     select
       seq_helptext.nextval,
       5,
       'My Profile Phone Number',
       'This number is optional and will not be shared with any 3rd parties.  It will only be used by the laundry to communicate with you if you log some lost items.',
       systemUserID,
       sysdate
       from dual;

     insert into helptext(helptext_id, screenid, screenname, helptext, systemuser_id, timestamp)
     select
       seq_helptext.nextval,
       6,
       'Lost and Found',
       'Lost and Found',
       systemUserID,
       sysdate
       from dual;

     insert into helptext(helptext_id, screenid, screenname, helptext, systemuser_id, timestamp)
     select
       seq_helptext.nextval,
       7,
       'My Garments',
       'My Garments',
       systemUserID,
       sysdate
       from dual;

     insert into helptext(helptext_id, screenid, screenname, helptext, systemuser_id, timestamp)
     select
       seq_helptext.nextval,
       8,
       'My Satisfaction',
       'My Satisfaction',
       systemUserID,
       sysdate
       from dual;

     insert into helptext(helptext_id, screenid, screenname, helptext, systemuser_id, timestamp)
     select
       seq_helptext.nextval,
       9,
       'My Orders',
       'My Orders',
       systemUserID,
       sysdate
       from dual;

     insert into helptext(helptext_id, screenid, screenname, helptext, systemuser_id, timestamp)
     select
       seq_helptext.nextval,
       10,
       'My Points',
       'My Points',
       systemUserID,
       sysdate
       from dual;

     insert into helptext(helptext_id, screenid, screenname, helptext, systemuser_id, timestamp)
     select
       seq_helptext.nextval,
       11,
       'My Notifications',
       'My Notifications',
       systemUserID,
       sysdate
       from dual;

     insert into helptext(helptext_id, screenid, screenname, helptext, systemuser_id, timestamp)
     select
       seq_helptext.nextval,
       12,
       'Quick View',
       'Quick View',
       systemUserID,
       sysdate
       from dual;

     insert into helptext_desc(helptext_id, language_id, helptext, systemuser_id, timestamp)
     select
        h.helptext_id,
        languageID,
        h.helptext,
        systemUserID,
        sysdate
     from helptext h;

     insert into muasettings(muasettings_id, name, displayname, type, defaultvalue, description, systemuser_id, timestamp)
     select
       seq_muasettings.nextval,
       'TWOFACTORAUTHEN',
       'Two Factor Login Authentication Needed',
       0,
       'Y',
       'Y = PIN number requested after scanning / entering garment ID',
       systemuserid,
       sysdate
       from dual;

     insert into muasettings(muasettings_id, name, displayname, type, defaultvalue, description, systemuser_id, timestamp)
     select
       seq_muasettings.nextval,
       'WELCOMEMETHOD',
       'Wearer Welcome Communication Method',
       1,
       '0',
       '0 = none
        1 = email
        2 = csv',
       systemuserid,
       sysdate
       from dual;

     insert into muasettings(muasettings_id, name, displayname, type, defaultvalue, description, systemuser_id, timestamp)
     select
       seq_muasettings.nextval,
       'PASSWORDCOMPLEXITY',
       'Password Complexity',
       1,
       '0',
       '0 = no complexity
        1 = complexity check
        >4 = minimum length, no other complexity check',
       systemuserid,
       sysdate
       from dual;

     insert into muasettings(muasettings_id, name, displayname, type, defaultvalue, description, systemuser_id, timestamp)
     select
       seq_muasettings.nextval,
       'SECONDAYUNIQUEIDUSED',
       'Secondary ID used',
       0,
       'N',
       'Y = check for unique id will be on primary and secondary',
       systemuserid,
       sysdate
       from dual;

     insert into muasettings(muasettings_id, name, displayname, type, defaultvalue, description, systemuser_id, timestamp)
     select
       seq_muasettings.nextval,
       'TIMEOUT',
       'System Timeout',
       1,
       '10',
       'Timeout in minutes that a wearer is logged out for no activity',
       systemuserid,
       sysdate
       from dual;

     insert into muasettings(muasettings_id, name, displayname, type, defaultvalue, description, systemuser_id, timestamp)
     select
       seq_muasettings.nextval,
       'GARMENTTILE',
       'Garment Tile',
       0,
       'Y',
       'If My Garment tile is shown',
       systemuserid,
       sysdate
       from dual;

     insert into muasettings(muasettings_id, name, displayname, type, defaultvalue, description, systemuser_id, timestamp)
     select
       seq_muasettings.nextval,
       'PROFILETILE',
       'Profile Tile',
       0,
       'Y',
       'If My Profile tile is shown',
       systemuserid,
       sysdate
       from dual;

     insert into muasettings(muasettings_id, name, displayname, type, defaultvalue, description, systemuser_id, timestamp)
     select
       seq_muasettings.nextval,
       'REPAIRSTILE',
       'Repairs Tile',
       0,
       'Y',
       'If My Repairs tile is shown',
       systemuserid,
       sysdate
       from dual;

     insert into muasettings(muasettings_id, name, displayname, type, defaultvalue, description, systemuser_id, timestamp)
     select
       seq_muasettings.nextval,
       'LOSTANDFOUNDTILE',
       'Lost and Found Tile',
       0,
       'Y',
       'If My Lost and Found tile is shown',
       systemuserid,
       sysdate
       from dual;

     insert into muasettings(muasettings_id, name, displayname, type, defaultvalue, description, systemuser_id, timestamp)
     select
       seq_muasettings.nextval,
       'PHONECONTACT',
       'Lost and Found Phone contact compulsory',
       0,
       'N',
       'If phone number is compulsory in Lost and Found',
       systemuserid,
       sysdate
       from dual;

     insert into muasettings(muasettings_id, name, displayname, type, defaultvalue, description, systemuser_id, timestamp)
     select
       seq_muasettings.nextval,
       'NUMBEROFLASTDIGITS',
       'Number of last digits of ID code for uniqueness',
       1,
       '5',
       'This is the number of least significant digits (last digits) of a garment ID code that need to be entered.  This can vary due to the spread of codes the customer has.',
       systemuserid,
       sysdate
       from dual;

     insert into muasettings(muasettings_id, name, displayname, type, defaultvalue, description, systemuser_id, timestamp)
     select
       seq_muasettings.nextval,
       'SYSTEMUSERNAME',
       'System user name used for the ABSSolute session',
       1,
       '5',
       'Automatically generated as the customer number when the customer is switch to MUA on and is used for the ABSSolute session for all wearers.',
       systemuserid,
       sysdate
       from dual;

      insert into globalsetting(globalsetting_id, name, groupname, stringvalue, numbervalue, booleanvalue, typeofvalue, systemuser_id, timestamp, active, description)
      select
             seq_globalsetting.nextval,
             'ONLINELICENSE',
             'Online License',
             null,
             null,
             'N',
             'B',
             systemuserid,
             sysdate,
             'Y',
             'Use Online License mechanism.'
      from dual;

      insert into globalsetting(globalsetting_id, name, groupname, stringvalue, numbervalue, booleanvalue, typeofvalue, systemuser_id, timestamp, active, description)
      select
             seq_globalsetting.nextval,
             'LICENSECHECKINTERVAL',
             'Online License',
             null,
             60,
             null,
             'I',
             systemuserid,
             sysdate,
             'Y',
             'Number of seconds after the other application servers are syncronized on activation new license and clients receive notifcation. Only used with Online license.'
      from dual;

      insert into globalsetting(globalsetting_id, name, groupname, stringvalue, numbervalue, booleanvalue, typeofvalue, systemuser_id, timestamp, active, description)
      select
             seq_globalsetting.nextval,
             'ENVIRONMENTCHECK',
             'Licensing General',
             null,
             null,
             'N',
             'B',
             systemUserID,
             sysdate,
             'Y',
             'Use environment (Production / test) check to avoid test licenses being installed on a live environment.'
      from dual;

      insert into emailsettingreplparam(emailsettingreplparam_id, documenttype, replaceableparameter, systemuser_id, timestamp)
      select seq_emailsettingreplparam.nextval,
       1,
       'Parameter #B is replaced by the Customer Number of the Bill to customer
        Parameter #D is replaced by the Customer Number of the Deliver to customer
        Parameter #N is replaced by the Invoice Number',
       systemUserID,
       sysdate
       from dual;

       insert into emailsettingreplparam(emailsettingreplparam_id, documenttype, replaceableparameter, systemuser_id, timestamp)
       select seq_emailsettingreplparam.nextval,
       4,
       'Parameter # is replaced by the WebUsers password',
       systemUserID,
       sysdate
       from dual;

       insert into emailsettingreplparam(emailsettingreplparam_id, documenttype, replaceableparameter, systemuser_id, timestamp)
       select seq_emailsettingreplparam.nextval,
       16,
       'Parameter #P is replaced by the WebUsers password',
       systemUserID,
       sysdate
       from dual;

       insert into emailsettingreplparam(emailsettingreplparam_id, documenttype, replaceableparameter, systemuser_id, timestamp)
       select seq_emailsettingreplparam.nextval,
       25,
       'Parameter #C is replaced by the customer number
        Parameter #W is replaced by the department number
        Parameter #D is replaced by the consumption point number
        Parameter #P is replaced by the product code
        Parameter #S is replaced by the size code
        Parameter #F is replaced by the finishing method code
        Parameter #Q is replaced by the free-of-charge contract quantity
        Parameter #R is replaced by the total delivered quantity for the contract period
        Parameter #O is replaced by the overuse quantity
        Parameter #L is replaced by the comparison quantity
        Parameter #T is replaced by the delivery note number',
       systemUserID,
       sysdate
       from dual;

       insert into emailsettingreplparam(emailsettingreplparam_id, documenttype, replaceableparameter, systemuser_id, timestamp)
       select seq_emailsettingreplparam.nextval,
       26,
       'No change, only used in PLSQL for now',
       systemUserID,
       sysdate
       from dual;

       insert into emailsettingreplparam(emailsettingreplparam_id, documenttype, replaceableparameter, systemuser_id, timestamp)
       select seq_emailsettingreplparam.nextval,
       27,
       'Parameter #N is replaced by the PIN number
        Parameter #W is replaced by the wearer’s full name',
       systemUserID,
       sysdate
       from dual;

       insert into emailsettingreplparam(emailsettingreplparam_id, documenttype, replaceableparameter, systemuser_id, timestamp)
       select seq_emailsettingreplparam.nextval,
       28,
       'Parameter #W is replaced by the wearer’s full name
        Parameter #P is replaced by the wearer’s password',
       systemUserID,
       sysdate
       from dual;

       insert into emailsettingreplparam(emailsettingreplparam_id, documenttype, replaceableparameter, systemuser_id, timestamp)
       select seq_emailsettingreplparam.nextval,
       30,
       'Parameter #W is replaced by the wearer’s full name',
       systemUserID,
       sysdate
       from dual;

       insert into emailsettingreplparam(emailsettingreplparam_id, documenttype, replaceableparameter, systemuser_id, timestamp)
       select seq_emailsettingreplparam.nextval,
       31,
       'Parameter #W is replaced by the wearer’s full name
        Parameter #L is replaced by the URL of the web page
        Parameter #N is replaced by the PIN number
        Parameter #P is replaced by the wearer’s password',
       systemUserID,
       sysdate
       from dual;

       insert into emailsettingreplparam(emailsettingreplparam_id, documenttype, replaceableparameter, systemuser_id, timestamp)
       select seq_emailsettingreplparam.nextval,
       32,
       'Parameter #W is replaced by the wearer’s full name
        Parameter #U is replaced by the new username',
       systemUserID,
       sysdate
       from dual;

    if (FPsLastScriptOfCurrentVersion is not null) then
      begin
        select substr(FPsLastScriptOfCurrentVersion,
                      instr(FPsLastScriptOfCurrentVersion, '.', -1) - 2,
                      2),
               substr(FPsLastScriptOfCurrentVersion,
                      1,
                      instr(FPsLastScriptOfCurrentVersion, '.', -1) - 3)
          into lastScriptNo, prefixScript
          from dual;
        for i in 1 .. lastScriptNo loop
          insert into sqlscript
            (scriptname, issuccessful, createddate)
          values
            (prefixScript || lpad(i, 2, '0') || '.sql', 'Y', sysdate);
        end loop;
      exception
        when others then
          null;
      end;
    end if;

  end;

  procedure createNoteSequence(FPsSequenceName           in varchar2,
                               FPsExtraCode              in varchar2,
                               FPsTableName              in varchar2,
                               FPsNoteColumnName         in varchar2,
                               FPsBusinessUnitCode       in businessunit.code%type,
                               FPnMinValue               in integer,
                               FPnMaxValue               in integer,
                               FPsBusinessUnitColumnName in varchar2,
                               FPsFilter                 in varchar2) is
    --noterowsfetched   integer;
    sequenceName     varchar2(150);
    selectStatement  varchar2(500);
    numberNotesFound integer;
    errorMessage     varchar2(500);
  begin
    sequenceName := FPsSequenceName || '_' || FPsBusinessUnitCode;
    if FPsExtraCode is not null then
      sequenceName := sequenceName || '_' || FPsExtraCode;
    end if;
    -- get maximum note number  current BU
    numberNotesFound := 0;
    begin
      selectStatement := 'select COUNT(a.' || FPsNoteColumnName || ') ' ||
                         'from ' || FPsTableName || ' a, businessunit b ' ||
                         'where a.' || FPsBusinessUnitColumnName ||
                         '(+) = b.businessunit_id ' || ' and b.code = ''' ||
                         FPsBusinessUnitCode || ''' ' || ' and a.' ||
                         FPsNoteColumnName || '>=' || FPnMinValue ||
                         ' and a.' || FPsNoteColumnName || '<=' ||
                         FPnMaxValue || FPsFilter;

      --dbms_output.put_line(selectStatement);
      begin
        execute immediate selectStatement
          into numberNotesFound;
      exception
        when others then
          dbms_output.put_line('Select failed.' || sqlerrm);
          RAISE_APPLICATION_ERROR(-20070, sqlerrm);
          return;
      end;

    exception
      when others then
        dbms_output.put_line('select failed.' || sqlerrm);
        RAISE_APPLICATION_ERROR(-20070, sqlerrm);
        return;
    end;

    -- sequence is not created if maxNoteNumber >= FPnNoteNumber
    if numberNotesFound > 0 then
      errorMessage := 'Cannot create ' || sequenceName ||
                      ' sequence inside range(' || FPnMinValue || ', ' ||
                      FPnMaxValue || ')!  ' || numberNotesFound || ' ' ||
                      FPsTableName || 's exist in this range !';
      dbms_output.put_line(errorMessage);
      RAISE_APPLICATION_ERROR(-20070, errorMessage);
      --raise no_data_found;
    end if;

    -- drop sequence
    begin
      execute immediate 'drop sequence ' || sequenceName;
    exception
      when others then
        errorMessage := 'Sequence ' || sequenceName || FPsBusinessUnitCode ||
                        ' cannot be droped.' || sqlerrm;
        --    dbms_output.put_line(errorMessage);
      --   RAISE_APPLICATION_ERROR(-20070, errorMessage);
    end;

    begin
      execute immediate 'create sequence ' || sequenceName || ' minvalue ' ||
                        FPnMinValue || ' maxvalue ' || FPnMaxValue ||
                        ' start with ' || FPnMinValue ||
                        ' increment by 1 nocache';
      dbms_output.put_line('Sequence ' || sequenceName || ' created.');
    exception
      when others then
        errorMessage := 'Sequence ' || sequenceName || ' failed.' ||
                        sqlerrm;
        dbms_output.put_line(errorMessage);
        RAISE_APPLICATION_ERROR(-20070, errorMessage);
    end;

  exception
    when others then
      RAISE_APPLICATION_ERROR(-20070, errorMessage);
  end;
  procedure createIdCodeSequence(FPsSequenceName           in varchar2,
                                 FPsExtraCode              in varchar2,
                                 FPsTableName              in varchar2,
                                 FPsNoteColumnName         in varchar2,
                                 FPsBusinessUnitCode       in businessunit.code%type,
                                 FPsMinValue               in varchar2,
                                 FPsMaxValue               in varchar2,
                                 FPsBusinessUnitColumnName in varchar2,
                                 FPsFilter                 in varchar2) is
    --noterowsfetched   integer;
    sequenceName     varchar2(150);
    selectStatement  varchar2(500);
    numberNotesFound integer;
    errorMessage     varchar2(500);
  begin
    sequenceName := FPsSequenceName || '_' || FPsBusinessUnitCode;
    if FPsExtraCode is not null then
      sequenceName := sequenceName || '_' || FPsExtraCode;
    end if;
    -- get maximum note number for current BU
    numberNotesFound := 0;
    begin
      selectStatement := 'select COUNT(a.' || FPsNoteColumnName || ') ' ||
                         'from ' || FPsTableName || ' a, businessunit b ' ||
                         'where a.' || FPsBusinessUnitColumnName ||
                         '(+) = b.businessunit_id ' || ' and b.code = ''' ||
                         FPsBusinessUnitCode || ''' ' || ' and a.' ||
                         FPsNoteColumnName || '>= ''' || FPsMinValue || '''' ||
                         ' and a.' || FPsNoteColumnName || '<=''' ||
                         FPsMaxValue || '''' || ' and length(' ||
                         FPsNoteColumnName || ')= length(''' || FPsMinValue ||
                         ''')' || FPsFilter;

      dbms_output.put_line(selectStatement);
      begin
        execute immediate selectStatement
          into numberNotesFound;
      exception
        when others then
          dbms_output.put_line('Select failed.' || sqlerrm);
          RAISE_APPLICATION_ERROR(-20070, sqlerrm);
          return;
      end;

    exception
      when others then
        dbms_output.put_line('select failed.' || sqlerrm);
        RAISE_APPLICATION_ERROR(-20070, sqlerrm);
        return;
    end;

    -- sequence is not created if maxNoteNumber >= FPnNoteNumber
    if numberNotesFound > 0 then
      errorMessage := 'Cannot create ' || sequenceName ||
                      ' sequence inside range(' || FPsMinValue || ', ' ||
                      FPsMaxValue || ')!  ' || numberNotesFound || ' ' ||
                      FPsTableName || 's exist in this range !';
      dbms_output.put_line(errorMessage);
      RAISE_APPLICATION_ERROR(-20070, errorMessage);
      --raise no_data_found;
    end if;

    -- drop sequence
    begin
      execute immediate 'drop sequence ' || sequenceName;
    exception
      when others then
        errorMessage := 'Sequence ' || sequenceName || FPsBusinessUnitCode ||
                        ' cannot be droped.' || sqlerrm;
        -- dbms_output.put_line(errorMessage);
    end;

    begin
      execute immediate 'create sequence ' || sequenceName || ' minvalue ' ||
                        FPsMinValue || ' maxvalue ' || FPsMaxValue ||
                        ' start with ' || FPsMinValue ||
                        ' increment by 1 nocache';
      dbms_output.put_line('Sequence ' || sequenceName || ' created.');
    exception
      when others then
        errorMessage := 'Sequence ' || sequenceName || ' failed.' ||
                        sqlerrm;
        dbms_output.put_line(errorMessage);
    end;

  exception
    when others then
      RAISE_APPLICATION_ERROR(-20070, errorMessage);
  end;

  function GetDayNumber(FPdtDate date) return int is
    sunday date := to_date('16/02/2003', 'dd/mm/yyyy');
    monday date := to_date('17/02/2003', 'dd/mm/yyyy');
    diff   int;
  begin
    if to_char(sunday, 'd') = 1 then
      diff := 1;
    end if;
    if to_char(monday, 'd') = 1 then
      diff := 0;
    end if;
    return to_char(FPdtDate, 'd') - diff;
  end;

  procedure CreateDialogDescription(DialogID      in dialogs.dialog_id%type,
                                    Endescription in dialogs.endescription%type,
                                    Nldescription in dialogs.nldescription%type,
                                    Frdescription in dialogs.frdescription%type,
                                    Dedescription in dialogs.gedescription%type,
                                    Dkdescription in dialogs.dkdescription%type,
                                    Esdescription in dialogs.spdescription%type) is
    doInsert      number;
    LanguageID_EN number;
    LanguageID_GB number;
    LanguageID_NL number;
    LanguageID_FR number;
    LanguageID_DE number;
    LanguageID_DK number;
    LanguageID_ES number;
    count_DK      number;
    count_EN      number;
    count_GB      number;
    count_NL      number;
    count_FR      number;
    count_DE      number;
    count_ES      number;
  begin
    doInsert := 1;
    -----check if US - English translation exists

    select count(1)
      into count_EN
      from dialogs_desc dd
     where dd.dialog_id = DialogID
       and dd.language_id =
           (select l.language_id from languages l where l.code = 'EN_US');
    if count_EN = 0 then
      begin

        begin
          select l.language_id
            into LanguageID_EN
            from languages l
           where l.code = 'EN_US';
        exception
          when no_data_found then
            doInsert := 0;
        end;
        if doInsert = 1 then
          insert into dialogs_desc dd
            (dialog_id, language_id, description, systemuser_id, timestamp)
          values
            (DialogID, LanguageID_EN, Endescription, 1, sysdate);
        end if;
      end;
    end if;

    -----check if GB - English translation exists

    select count(1)
      into count_GB
      from dialogs_desc dd
     where dd.dialog_id = DialogID
       and dd.language_id =
           (select l.language_id from languages l where l.code = 'EN_GB');
    if count_GB = 0 then
      begin
        begin
          select l.language_id
            into LanguageID_GB
            from languages l
           where l.code = 'EN_GB';
        exception
          when no_data_found then
            doInsert := 0;
        end;
        if doInsert = 1 then
          insert into dialogs_desc dd
            (dialog_id, language_id, description, systemuser_id, timestamp)
          values
            (DialogID, LanguageID_GB, Endescription, 1, sysdate);
        end if;
      end;
    end if;

    -----check if Dutch (NL) translation exists
    select count(1)
      into count_NL
      from dialogs_desc dd
     where dd.dialog_id = DialogID
       and dd.language_id =
           (select l.language_id from languages l where l.code = 'NL_NL');
    if count_NL = 0 then
      begin
        begin
          select l.language_id
            into LanguageID_NL
            from languages l
           where l.code = 'NL_NL';
        exception
          when no_data_found then
            doInsert := 0;
        end;
        if doInsert = 1 then
          insert into dialogs_desc dd
            (dialog_id, language_id, description, systemuser_id, timestamp)
          values
            (DialogID, LanguageID_NL, Nldescription, 1, sysdate);
        end if;
      end;
    end if;

    -----check if French (FR) translation exists
    select count(1)
      into count_FR
      from dialogs_desc dd
     where dd.dialog_id = DialogID
       and dd.language_id =
           (select l.language_id from languages l where l.code = 'FR_FR');
    if count_FR = 0 then
      begin
        begin
          select l.language_id
            into LanguageID_FR
            from languages l
           where l.code = 'FR_FR';
        exception
          when no_data_found then
            doInsert := 0;
        end;
        if doInsert = 1 then
          insert into dialogs_desc dd
            (dialog_id, language_id, description, systemuser_id, timestamp)
          values
            (DialogID, LanguageID_FR, Frdescription, 1, sysdate);
        end if;
      end;
    end if;

    -----check if German (DE_DE) translation exists
    select count(1)
      into count_DE
      from dialogs_desc dd
     where dd.dialog_id = DialogID
       and dd.language_id =
           (select l.language_id from languages l where l.code = 'DE_DE');
    if count_DE = 0 then
      begin
        begin
          select l.language_id
            into LanguageID_DE
            from languages l
           where l.code = 'DE_DE';
        exception
          when no_data_found then
            doInsert := 0;
        end;
        if doInsert = 1 then
          insert into dialogs_desc dd
            (dialog_id, language_id, description, systemuser_id, timestamp)
          values
            (DialogID, LanguageID_DE, Dedescription, 1, sysdate);
        end if;
      end;
    end if;

    -----check if Danish (DA_DK) translation exists
    select count(1)
      into count_DK
      from dialogs_desc dd
     where dd.dialog_id = DialogID
       and dd.language_id =
           (select l.language_id from languages l where l.code = 'DA_DK');
    if count_DK = 0 then
      begin
        begin
          select l.language_id
            into LanguageID_DK
            from languages l
           where l.code = 'DA_DK';
        exception
          when no_data_found then
            doInsert := 0;
        end;
        if doInsert = 1 then
          insert into dialogs_desc dd
            (dialog_id, language_id, description, systemuser_id, timestamp)
          values
            (DialogID, LanguageID_DK, Dkdescription, 1, sysdate);
        end if;
      end;
    end if;

    -----check if Spanish (ES_ES) translation exists
    select count(1)
      into count_ES
      from dialogs_desc dd
     where dd.dialog_id = DialogID
       and dd.language_id =
           (select l.language_id from languages l where l.code = 'ES_ES');
    if count_ES = 0 then
      begin
        begin
          select l.language_id
            into LanguageID_ES
            from languages l
           where l.code = 'ES_ES';
        exception
          when no_data_found then
            doInsert := 0;
        end;
        if doInsert = 1 then
          insert into dialogs_desc dd
            (dialog_id, language_id, description, systemuser_id, timestamp)
          values
            (DialogID, LanguageID_ES, Esdescription, 1, sysdate);
        end if;
      end;
    end if;
  end;

procedure InsertReasonCodeDialogs(p_reasoncode_id      in reasoncode.reasoncode_id%type,
                                                    rc_garmentreason     in reasoncode.garmentreason%type,
                                                    rc_linenreason       in reasoncode.linenreason%type,
                                                    rc_orpackreason      in reasoncode.orpackreason%type,
                                                    rc_residentialreason in reasoncode.residentialreason%type,
                                                    systemUserID         in systemuser.systemuser_id%type) is

  begin

  if (rc_garmentreason = 'Y') then
    insert into reasoncodedialogs
      (reasoncode_id, dialog_id, selectable, systemuser_id, timestamp)
      select p_reasoncode_id, d.dialog_id, 'Y', systemUserID, sysdate
        from dialogs d
       where d.code in ('DeliveryVariations',
                        'GarmentDispenser',
                        'RagInBatch',
                        'RagItemsFromStock',
                        'ReceiveItemsFromPO',
                        'ReceiveItemsInStockNoPO',
                        'ReplacementRenewal',
                        'StockCorrectionNonUnique',
                        'StockCorrectionUnique',
                        'Wearer',
                        'WorkOrderApproval',
                        'WorkOrder',
                        'ReturnToStock',
                        'MoveStock',
                        'MoveStockWithinStockroom',
                        'IssueGarmentsDirect',
                        'IssueGarmentsFromStock',
                        'CorrectionTicket',
                        'TreatmentBatchControl',
                        'ReceiveItemsFromSDOPush',
                        'UniqueItem',
                        'SalesOrder',
                        'RagPoolMultiRead',
                        'BundleSortScan',
                        'CheckInItemsFromPO',
                        'CorrectItemsCheckedInFromPO',
                        'MakeUniqueItemsCheckedInFromPO',
                        'DeliveryNote',
                        'ReturnToStockOrRagInBatch')
         and not exists (select 1
                from reasoncodedialogs rcd
               where rcd.reasoncode_id = p_reasoncode_id
                 and rcd.dialog_id = d.dialog_id);
  end if;

  if (rc_linenreason = 'Y') then
    insert into reasoncodedialogs
      (reasoncode_id, dialog_id, selectable, systemuser_id, timestamp)
      select p_reasoncode_id, d.dialog_id, 'Y', systemUserID, sysdate
        from dialogs d
       where d.code in ('DeliveryVariations',
                        'RagInBatch',
                        'RagItemsFromStock',
                        'ReceiveItemsFromPO',
                        'ReceiveItemsInStockNoPO',
                        'ReplacementRenewal',
                        'StockCorrectionNonUnique',
                        'StockCorrectionUnique',
                        'WorkOrderApproval',
                        'WorkOrder',
                        'ReturnToStock',
                        'ReceiveItemsFromDismountingOrder',
                        'MoveStock',
                        'MoveStockWithinStockroom',
                        'StandardDelivery',
                        'CorrectionTicket',
                        'TreatmentBatchControl',
                        'ReceiveItemsFromSDOPush',
                        'UniqueItem',
                        'SalesOrder',
                        'RagPoolMultiRead',
                        'BundleSortScan',
                        'CheckInItemsFromPO',
                        'CorrectItemsCheckedInFromPO',
                        'MakeUniqueItemsCheckedInFromPO',
                        'DeliveryNote',
                        'ReturnToStockOrRagInBatch')
         and not exists (select 1
                from reasoncodedialogs rcd
               where rcd.reasoncode_id = p_reasoncode_id
                 and rcd.dialog_id = d.dialog_id);

  end if;

  if (rc_orpackreason = 'Y') then
    insert into reasoncodedialogs
      (reasoncode_id, dialog_id, selectable, systemuser_id, timestamp)
      select p_reasoncode_id, d.dialog_id, 'Y', systemUserID, sysdate
        from dialogs d
       where d.code in ('DeliveryVariations',
                        'RagInBatch',
                        'RagItemsFromStock',
                        'ReceiveItemsInStockNoPO',
                        'StockCorrectionUnique',
                        'WorkOrderApproval',
                        'WorkOrder',
                        'ReturnToStock',
                        'MoveStock',
                        'MoveStockWithinStockroom',
                        'ConfirmSterilization',
                        'SterilizationRunStatusControl',
                        'ORPackStatusControl',
                        'CorrectionTicket',
                        'UniqueItem',
                        'CleanRoomBatchStatusControl',
                        'CleanRoomBatch',
                        'DeliveryNote',
                        'ReturnToStockOrRagInBatch')
         and not exists (select 1
                from reasoncodedialogs rcd
               where rcd.reasoncode_id = p_reasoncode_id
                 and rcd.dialog_id = d.dialog_id);

  end if;

  if (rc_residentialreason = 'Y') then
    insert into reasoncodedialogs
      (reasoncode_id, dialog_id, selectable, systemuser_id, timestamp)
      select p_reasoncode_id, d.dialog_id, 'Y', systemUserID, sysdate
        from dialogs d
       where d.code in ('Client')
         and not exists (select 1
                from reasoncodedialogs rcd
               where rcd.reasoncode_id = p_reasoncode_id
                 and rcd.dialog_id = d.dialog_id);

  end if;

  end;

  procedure InsertRagReasonCodeDialogs(p_ragreason_id in ragreason.ragreason_id%type,
                                                       systemUserID   in systemuser.systemuser_id%type) is
  begin

  insert into ragreasondialogs
    (ragreason_id, dialog_id, selectable, systemuser_id, timestamp)
    select p_ragreason_id, d.dialog_id, 'Y', systemUserID, sysdate
      from dialogs d
     where d.code in ('RagItemsFromStock',
                      'ReturnCreditItems',
                      'GarmentDispenser',
                      'ReturnToStock',
                      'StockCorrectionUnique',
                      'RagInBatch',
                      'RagPoolMultiRead',
                      'IssueSalesItems',
                      'RagPoolMultiRead',
                      'ReturnToStockOrRagInBatch')
       and not exists (select 1
              from ragreasondialogs rcd
             where rcd.ragreason_id = p_ragreason_id
               and rcd.dialog_id = d.dialog_id);
  end;

end PACK_UTILITIES;
/
