-- 20011755.70 Square meter billing by weighing Categories

-----------------------------------------INVOICELINESUBTYPE TABLE------------------------------------


INSERT INTO INVOICELINESUBTYPE I
  (I.INVOICELINESUBTYPE_ID,
   SUBTYPE,
   INVOICELINETYPE_ID,
   FACTORYDESCRIPTION,
   SYSTEMUSER_ID,
   TIMESTAMP)
  SELECT SEQ_INVOICELINESUBTYPE.NEXTVAL,
         0,
         4,
         'Weight recording',
         GETMINSYSTEMUSER(),
         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',
         GETMINSYSTEMUSER(),
         SYSDATE
  FROM   DUAL; 


-----------------------------------------PACKINGNOTECONTAINER TABLE------------------------------------

ALTER TABLE PACKINGNOTECONTAINER
	ADD (SPECIALQUANTITY NUMBER(6,0) NULL,
	     SPECIALLENGTH NUMBER(6,0) NULL,
	     SPECIALWIDTH NUMBER(6,0) NULL);


-----------------------------------------WEIGHINGCATEGORY TABLE------------------------------------

ALTER TABLE WEIGHINGCATEGORY
	ADD (WEIGHINGUSE NUMBER  DEFAULT 0 NOT NULL CONSTRAINT WEIGHINGUSE_valid CHECK (WEIGHINGUSE IN (0, 1)),
	     EXTRAINPUT VARCHAR2(1)  DEFAULT 'N' NOT NULL CONSTRAINT EXTRAINPUT_valid CHECK (EXTRAINPUT IN ('Y', 'N')),
	     REGISTRATIONUNIT_ID NUMBER NULL);


COMMENT ON COLUMN WEIGHINGCATEGORY.WEIGHINGUSE IS '0 = NORMAL USE
1= SPECIAL USE';

CREATE  INDEX XIF4WEIGHINGCATEGORY ON WEIGHINGCATEGORY
(REGISTRATIONUNIT_ID   ASC);

ALTER TABLE WEIGHINGCATEGORY
ADD CONSTRAINT WEIGHINGCATEGORY_REGUNIT FOREIGN KEY (REGISTRATIONUNIT_ID) REFERENCES REGISTRATIONUNIT (REGISTRATIONUNIT_ID);


