--Order 20013618.60

----EMAILSETTINGS table----

COMMENT ON COLUMN EMAILSETTING.DOCUMENTTYPE
  IS '1 = Invoice
2 = Statement
3 = Purchase order
4 = E-service password reminder
5 = Work order via web
6 = Invoice job checklist
7 = Customer
8 = Log Message
9 = Delivery Note / Consignment Note
10 = Stock Count / Order
11 = Wash List
12 = POD (Proof of delivery)
13 = On site soil scan list';

ALTER TABLE EMAILSETTING
  DROP CONSTRAINT DOCUMENTTYPEEMAILSETT_VALID;
ALTER TABLE EMAILSETTING
  ADD CONSTRAINT DOCUMENTTYPEEMAILSETT_VALID
  CHECK (DOCUMENTTYPE BETWEEN 1 AND 13);

----CUSTOMER table----

ALTER TABLE CUSTOMER ADD (ROUTEASSISTANTONSITESOILSCAN VARCHAR2(1) DEFAULT 'N' NOT NULL
						CONSTRAINT YN_VALIDATIONFIELD111 CHECK (ROUTEASSISTANTONSITESOILSCAN IN ('Y', 'N')));

COMMENT ON COLUMN CUSTOMER.ROUTEASSISTANTONSITESOILSCAN
  IS 'Only used for module ROUTEASSISTANTSOILSCAN.';

----SCAN table----

CREATE INDEX XIE7SCAN ON SCAN (BATCHNUMBER ASC);


----TRANSACTIONTYPE table----

insert into transactiontype
  (transactiontype_id, factorydescription, systemuser_id, timestamp)
  select 75,
         'Onsite soil scan (PDA)',
         getminsystemuser(),
         sysdate
    from dual;
commit;

insert into transactiontype_desc
  (transactiontype_id, language_id, description, systemuser_id, timestamp)
  select transactiontype_id,
         getminlanguage(),
         factorydescription,
         systemuser_id,
         timestamp
    from transactiontype
   where transactiontype.transactiontype_id = 75 ;
commit;


