---ABS-100317

---LASTCUSTOMERPRICEUSED TABLE 
CREATE SEQUENCE SEQ_LASTCUSTOMERPRICEUSED
START WITH 1
INCREMENT BY 1;

CREATE TABLE LASTCUSTOMERPRICEUSED
(
  LASTCUSTOMERPRICEUSED_ID NUMBER NOT NULL,
  CUSTOMER_LINK_ID NUMBER NOT NULL,
  TYPE NUMBER DEFAULT  0 NOT NULL CONSTRAINT CHK_LASTCUSTPRICEUSED_TYPE CHECK (TYPE in (0)),
  PRICE NUMBER(15,6) NOT NULL,
  PRICELISTTYPE NUMBER DEFAULT 1 NOT NULL CONSTRAINT CHK_LASTCUSTPRICEUSED_PRICETYPE CHECK (PRICELISTTYPE in (1)),
  INVOICEHEADER_ID NUMBER NULL,
  CREATIONINVOICEHEADER_ID NUMBER NOT NULL,
  SYSTEMUSER_ID NUMBER NOT NULL,
  TIMESTAMP DATE NOT NULL
);
COMMENT ON COLUMN LASTCUSTOMERPRICEUSED.TYPE IS '0 = Statement Fee';
COMMENT ON COLUMN LASTCUSTOMERPRICEUSED.PRICELISTTYPE IS '1 = Customer Specific';

ALTER TABLE LASTCUSTOMERPRICEUSED ADD CONSTRAINT XPKLASTCUSTOMERPRICEUSED PRIMARY KEY (LASTCUSTOMERPRICEUSED_ID);

CREATE INDEX XIF1LASTCUSTOMERPRICEUSED ON LASTCUSTOMERPRICEUSED (CUSTOMER_LINK_ID ASC);
CREATE INDEX XIF2LASTCUSTOMERPRICEUSED ON LASTCUSTOMERPRICEUSED (INVOICEHEADER_ID ASC);
CREATE INDEX XIF3LASTCUSTOMERPRICEUSED ON LASTCUSTOMERPRICEUSED (CREATIONINVOICEHEADER_ID ASC);

ALTER TABLE LASTCUSTOMERPRICEUSED
  ADD CONSTRAINT LASTCUSTOMERPRICEUSED_CUST FOREIGN KEY (CUSTOMER_LINK_ID)
  REFERENCES CUSTOMER_LINK (CUSTOMER_LINK_ID);

ALTER TABLE LASTCUSTOMERPRICEUSED
  ADD CONSTRAINT LASTCUSTOMERPRICEUSED_IH FOREIGN KEY (INVOICEHEADER_ID)
  REFERENCES INVOICEHEADER (INVOICEHEADER_ID) ON DELETE SET NULL;

ALTER TABLE LASTCUSTOMERPRICEUSED
  ADD CONSTRAINT LASTCUSTOMERPRICEUSED_IH_2 FOREIGN KEY (CREATIONINVOICEHEADER_ID)
  REFERENCES INVOICEHEADER (INVOICEHEADER_ID) ON DELETE CASCADE;

---LASTPRODUCTPRICEUSED TABLE 
CREATE SEQUENCE SEQ_LASTPRODUCTPRICEUSED
START WITH 1
INCREMENT BY 1;

CREATE TABLE LASTPRODUCTPRICEUSED
(
  LASTPRODUCTPRICEUSED_ID NUMBER NOT NULL,
  CUSTOMER_LINK_ID NUMBER NOT NULL,
  INVOICELINETYPE_ID NUMBER NOT NULL,
  INVOICELINESUBTYPE NUMBER NULL,
  PRODUCT_ID NUMBER NOT NULL,
  SIZEDEFINITION_ID NUMBER NOT NULL,
  FINISHINGMETHOD_ID NUMBER NULL,
  PRICE NUMBER(15,6) NOT NULL,
  GENERALPRICELIST_ID NUMBER NULL,
  PRICELISTTYPE NUMBER NOT NULL CONSTRAINT CHK_LASTPRPRICEUSED_PRICETYPE CHECK (PRICELISTTYPE in (1, 2, 3)),
  INVOICEHEADER_ID NUMBER NULL,
  CREATIONINVOICEHEADER_ID NUMBER NOT NULL,
  CHANGESPERWEEK NUMBER DEFAULT 0 NOT NULL,
  SYSTEMUSER_ID NUMBER NOT NULL,
  TIMESTAMP DATE NOT NULL
);

COMMENT ON COLUMN LASTPRODUCTPRICEUSED.PRICELISTTYPE IS '1 = Customer Specific
2 = General Price List
3 = Contract Price List
';

COMMENT ON COLUMN LASTPRODUCTPRICEUSED.CHANGESPERWEEK IS 'Used for changes per week and for delivery frequency pricing.
NOTE: -1 corresponds to *'
;

ALTER TABLE LASTPRODUCTPRICEUSED ADD CONSTRAINT XPKLASTPRODUCTPRICEUSED PRIMARY KEY (LASTPRODUCTPRICEUSED_ID);

CREATE INDEX XIF1LASTPRODUCTPRICEUSED ON LASTPRODUCTPRICEUSED (CUSTOMER_LINK_ID ASC);
CREATE INDEX XIF2LASTPRODUCTPRICEUSED ON LASTPRODUCTPRICEUSED (INVOICELINETYPE_ID ASC);
CREATE INDEX XIF3LASTPRODUCTPRICEUSED ON LASTPRODUCTPRICEUSED (PRODUCT_ID ASC);
CREATE INDEX XIF4LASTPRODUCTPRICEUSED ON LASTPRODUCTPRICEUSED (SIZEDEFINITION_ID ASC);
CREATE INDEX XIF5LASTPRODUCTPRICEUSED ON LASTPRODUCTPRICEUSED (FINISHINGMETHOD_ID ASC);
CREATE INDEX XIF6LASTPRODUCTPRICEUSED ON LASTPRODUCTPRICEUSED (GENERALPRICELIST_ID ASC);
CREATE INDEX XIF7LASTPRODUCTPRICEUSED ON LASTPRODUCTPRICEUSED (INVOICEHEADER_ID ASC);
CREATE INDEX XIF8LASTPRODUCTPRICEUSED ON LASTPRODUCTPRICEUSED (CREATIONINVOICEHEADER_ID ASC);


ALTER TABLE LASTPRODUCTPRICEUSED 
  ADD CONSTRAINT LASTPRODPRICEUSED_CUST FOREIGN KEY (CUSTOMER_LINK_ID)
  REFERENCES CUSTOMER_LINK (CUSTOMER_LINK_ID);

ALTER TABLE LASTPRODUCTPRICEUSED 
  ADD CONSTRAINT LASTPRODPRICEUSED_INVLNTYPE FOREIGN KEY (INVOICELINETYPE_ID)
  REFERENCES INVOICELINETYPE (INVOICELINETYPE_ID);

ALTER TABLE LASTPRODUCTPRICEUSED 
  ADD CONSTRAINT LASTPRODPRICEUSED_PROD FOREIGN KEY (PRODUCT_ID)
  REFERENCES PRODUCT (PRODUCT_ID);

ALTER TABLE LASTPRODUCTPRICEUSED 
  ADD CONSTRAINT LASTPRODPRICEUSED_SIZE FOREIGN KEY (SIZEDEFINITION_ID)
  REFERENCES SIZEDEFINITION (SIZEDEFINITION_ID);

ALTER TABLE LASTPRODUCTPRICEUSED 
  ADD CONSTRAINT LASTPRODPRICEUSED_FM FOREIGN KEY (FINISHINGMETHOD_ID)
  REFERENCES FINISHINGMETHOD (FINISHINGMETHOD_ID);

ALTER TABLE LASTPRODUCTPRICEUSED 
  ADD CONSTRAINT LASTPRODPRICEUSED_GENP FOREIGN KEY (GENERALPRICELIST_ID)
  REFERENCES GENERALPRICELIST (GENERALPRICELIST_ID) ON DELETE SET NULL;

ALTER TABLE LASTPRODUCTPRICEUSED 
  ADD CONSTRAINT LASTPRODPRICEUSED_IH FOREIGN KEY (INVOICEHEADER_ID)
  REFERENCES INVOICEHEADER (INVOICEHEADER_ID) ON DELETE SET NULL;

ALTER TABLE LASTPRODUCTPRICEUSED 
  ADD CONSTRAINT LASTPRODPRICEUSED_IH_2 FOREIGN KEY (CREATIONINVOICEHEADER_ID)
  REFERENCES INVOICEHEADER (INVOICEHEADER_ID) ON DELETE CASCADE;


---LASTPREPCHARGEPRICEUSED TABLE 
CREATE SEQUENCE SEQ_LASTPREPCHARGEPRICEUSED
START WITH 1
INCREMENT BY 1;

CREATE TABLE LASTPREPCHARGEPRICEUSED
(
  LASTPREPCHARGEPRICEUSED_ID NUMBER NOT NULL,
  CUSTOMER_LINK_ID NUMBER NOT NULL,
  REASONCODE_ID NUMBER NULL,
  PRICE NUMBER(15,6) NOT NULL,
  PRICELISTTYPE NUMBER DEFAULT 1 NOT NULL CONSTRAINT CHK_LASTPREPPRICEUSED_PRICETYPE CHECK (PRICELISTTYPE in (1)),
  INVOICEHEADER_ID NUMBER NULL,
  CREATIONINVOICEHEADER_ID NUMBER NOT NULL,
  SYSTEMUSER_ID NUMBER NOT NULL,
  TIMESTAMP DATE NOT NULL
);
COMMENT ON COLUMN LASTPREPCHARGEPRICEUSED.REASONCODE_ID IS 'Only used for pre charge when prep charge is defined by reason code';
COMMENT ON COLUMN LASTPREPCHARGEPRICEUSED.PRICELISTTYPE IS '1 = Customer Specific';

ALTER TABLE LASTPREPCHARGEPRICEUSED ADD CONSTRAINT XPKLASTPREPCHARGEPRICEUSED PRIMARY KEY (LASTPREPCHARGEPRICEUSED_ID);

CREATE INDEX XIF1LASTPREPCHARGEPRICEUSED ON LASTPREPCHARGEPRICEUSED (CUSTOMER_LINK_ID ASC);
CREATE INDEX XIF2LASTPREPCHARGEPRICEUSED ON LASTPREPCHARGEPRICEUSED (REASONCODE_ID ASC);
CREATE INDEX XIF3LASTPREPCHARGEPRICEUSED ON LASTPREPCHARGEPRICEUSED (INVOICEHEADER_ID ASC);
CREATE INDEX XIF4LASTPREPCHARGEPRICEUSED ON LASTPREPCHARGEPRICEUSED (CREATIONINVOICEHEADER_ID ASC);

ALTER TABLE LASTPREPCHARGEPRICEUSED
  ADD CONSTRAINT LASTPREPPRICEUSED_CUST FOREIGN KEY (CUSTOMER_LINK_ID)
  REFERENCES CUSTOMER_LINK (CUSTOMER_LINK_ID);

ALTER TABLE LASTPREPCHARGEPRICEUSED 
  ADD CONSTRAINT LASTPREPPRICEUSED_RC FOREIGN KEY (REASONCODE_ID)
  REFERENCES REASONCODE (REASONCODE_ID) ON DELETE SET NULL;

ALTER TABLE LASTPREPCHARGEPRICEUSED
  ADD CONSTRAINT LASTPREPPRICEUSED_IH FOREIGN KEY (INVOICEHEADER_ID)
  REFERENCES INVOICEHEADER (INVOICEHEADER_ID) ON DELETE SET NULL;
  
ALTER TABLE LASTPREPCHARGEPRICEUSED
  ADD CONSTRAINT LASTPREPPRICEUSED_IH_2 FOREIGN KEY (CREATIONINVOICEHEADER_ID)
  REFERENCES INVOICEHEADER (INVOICEHEADER_ID) ON DELETE CASCADE;


---LASTEMBLEMPRICEUSED TABLE 
CREATE SEQUENCE SEQ_LASTEMBLEMPRICEUSED
START WITH 1
INCREMENT BY 1;

CREATE TABLE LASTEMBLEMPRICEUSED
(
  LASTEMBLEMPRICEUSED_ID NUMBER NOT NULL,
  CUSTOMER_LINK_ID NUMBER NOT NULL,
  EMBLEMTEMPLATELINE_ID NUMBER NOT NULL,
  PRICE NUMBER(15,6) NOT NULL,
  PRICELISTTYPE NUMBER DEFAULT 1 NOT NULL CONSTRAINT CHK_LASTEMBPRICEUSED_PRICETYPE CHECK (PRICELISTTYPE in (1)),
  INVOICEHEADER_ID NUMBER NULL,
  CREATIONINVOICEHEADER_ID NUMBER NOT NULL,
  SYSTEMUSER_ID NUMBER NOT NULL,
  TIMESTAMP DATE NOT NULL
);

COMMENT ON COLUMN LASTEMBLEMPRICEUSED.PRICELISTTYPE IS '1 = Customer Specific';

ALTER TABLE LASTEMBLEMPRICEUSED ADD CONSTRAINT XPKLASTEMBLEMPRICEUSED PRIMARY KEY (LASTEMBLEMPRICEUSED_ID);

CREATE INDEX XIF1LASTEMBLEMPRICEUSED ON LASTEMBLEMPRICEUSED (CUSTOMER_LINK_ID ASC);
CREATE INDEX XIF2LASTEMBLEMPRICEUSED ON LASTEMBLEMPRICEUSED (EMBLEMTEMPLATELINE_ID ASC);
CREATE INDEX XIF3LASTEMBLEMPRICEUSED ON LASTEMBLEMPRICEUSED (INVOICEHEADER_ID ASC);
CREATE INDEX XIF4LASTEMBLEMPRICEUSED ON LASTEMBLEMPRICEUSED (CREATIONINVOICEHEADER_ID ASC);

ALTER TABLE LASTEMBLEMPRICEUSED 
  ADD CONSTRAINT LASTEMBPRICEUSED_CUST FOREIGN KEY (CUSTOMER_LINK_ID)
  REFERENCES CUSTOMER_LINK (CUSTOMER_LINK_ID);

ALTER TABLE LASTEMBLEMPRICEUSED 
  ADD CONSTRAINT LASTEMBPRICEUSED_RC FOREIGN KEY (EMBLEMTEMPLATELINE_ID)
  REFERENCES EMBLEMTEMPLATELINE (EMBLEMTEMPLATELINE_ID);

ALTER TABLE LASTEMBLEMPRICEUSED 
  ADD CONSTRAINT LASTEMBPRICEUSED_IH FOREIGN KEY (INVOICEHEADER_ID)
  REFERENCES INVOICEHEADER (INVOICEHEADER_ID) ON DELETE SET NULL;

ALTER TABLE LASTEMBLEMPRICEUSED 
  ADD CONSTRAINT LASTEMBPRICEUSED_IH_2 FOREIGN KEY (CREATIONINVOICEHEADER_ID)
  REFERENCES INVOICEHEADER (INVOICEHEADER_ID) ON DELETE CASCADE;

---LASTSPECIALCHARGEPRICEUSED TABLE 
CREATE SEQUENCE SEQ_LASTSPECIALCHARGEPRICEUSED
START WITH 1
INCREMENT BY 1;

CREATE TABLE LASTSPECIALCHARGEPRICEUSED
(
  LASTSPECIALCHARGEPRICEUSED_ID NUMBER NOT NULL,
  CUSTOMER_LINK_ID NUMBER NOT NULL,
  SPECIALCHARGE_ID NUMBER NOT NULL,
  PRICE NUMBER(15,6) NOT NULL,
  GENERALPRICELIST_ID NUMBER NULL,
  PRICELISTTYPE NUMBER NOT NULL CONSTRAINT CHK_LASTSCPRICEUSED_PRICETYPE CHECK (PRICELISTTYPE in (1, 2, 3, 4)),
  INVOICEHEADER_ID NUMBER NULL,
  CREATIONINVOICEHEADER_ID NUMBER NOT NULL,
  SYSTEMUSER_ID NUMBER NOT NULL,
  TIMESTAMP DATE NOT NULL
);

COMMENT ON COLUMN LASTSPECIALCHARGEPRICEUSED.PRICELISTTYPE IS '1 = Customer Specific
2 = General Price List
3 = Contract Price List
4 = Default price
';

ALTER TABLE LASTSPECIALCHARGEPRICEUSED ADD CONSTRAINT XPKLASTSPECIALCHARGEPRICEUSED PRIMARY KEY (LASTSPECIALCHARGEPRICEUSED_ID);

CREATE INDEX XIF1LASTSPECIALCHARGEPRICEUSED ON LASTSPECIALCHARGEPRICEUSED (CUSTOMER_LINK_ID ASC);
CREATE INDEX XIF2LASTSPECIALCHARGEPRICEUSED ON LASTSPECIALCHARGEPRICEUSED (SPECIALCHARGE_ID ASC);
CREATE INDEX XIF3LASTSPECIALCHARGEPRICEUSED ON LASTSPECIALCHARGEPRICEUSED (GENERALPRICELIST_ID ASC);
CREATE INDEX XIF4LASTSPECIALCHARGEPRICEUSED ON LASTSPECIALCHARGEPRICEUSED (INVOICEHEADER_ID ASC);
CREATE INDEX XIF5LASTSPECIALCHARGEPRICEUSED ON LASTSPECIALCHARGEPRICEUSED (CREATIONINVOICEHEADER_ID ASC);

ALTER TABLE LASTSPECIALCHARGEPRICEUSED
  ADD CONSTRAINT LASTSCPRICEUSED_CUST FOREIGN KEY (CUSTOMER_LINK_ID)
  REFERENCES CUSTOMER_LINK (CUSTOMER_LINK_ID);

ALTER TABLE LASTSPECIALCHARGEPRICEUSED
  ADD CONSTRAINT LASTSCPRICEUSED_SCH FOREIGN KEY (SPECIALCHARGE_ID)
  REFERENCES SPECIALCHARGE (SPECIALCHARGE_ID);

ALTER TABLE LASTSPECIALCHARGEPRICEUSED
  ADD CONSTRAINT LASTSCPRICEUSED_GENPRICE FOREIGN KEY (GENERALPRICELIST_ID)
  REFERENCES GENERALPRICELIST (GENERALPRICELIST_ID) ON DELETE SET NULL;

ALTER TABLE LASTSPECIALCHARGEPRICEUSED
  ADD CONSTRAINT LASTSCPRICEUSED_IH FOREIGN KEY (INVOICEHEADER_ID)
  REFERENCES INVOICEHEADER (INVOICEHEADER_ID) ON DELETE SET NULL;

ALTER TABLE LASTSPECIALCHARGEPRICEUSED
  ADD CONSTRAINT LASTSCPRICEUSED_IH_2 FOREIGN KEY (CREATIONINVOICEHEADER_ID)
  REFERENCES INVOICEHEADER (INVOICEHEADER_ID) ON DELETE CASCADE;

---LASTREPAIRPRICEUSED TABLE 
CREATE SEQUENCE SEQ_LASTREPAIRPRICEUSED
START WITH 1
INCREMENT BY 1;

CREATE TABLE LASTREPAIRPRICEUSED
(
  LASTREPAIRPRICEUSED_ID NUMBER NOT NULL,
  CUSTOMER_LINK_ID NUMBER NOT NULL,
  REPAIRTYPE_ID NUMBER NOT NULL,
  PRICE NUMBER(15,6) NOT NULL,
  GENERALPRICELIST_ID NUMBER NULL,
  PRICELISTTYPE NUMBER NOT NULL CONSTRAINT CHK_LASTREPPRICEUSED_PRICETYPE CHECK (PRICELISTTYPE in (1, 2, 3)),
  INVOICEHEADER_ID NUMBER NULL,
  CREATIONINVOICEHEADER_ID NUMBER NOT NULL,
  SYSTEMUSER_ID NUMBER NOT NULL,
  TIMESTAMP DATE NOT NULL
);

COMMENT ON COLUMN LASTREPAIRPRICEUSED.PRICELISTTYPE IS '1 = Customer Specific
2 = General Price List
3 = Contract Price List
';

ALTER TABLE LASTREPAIRPRICEUSED ADD CONSTRAINT XPKLASTREPAIRPRICEUSED PRIMARY KEY (LASTREPAIRPRICEUSED_ID);

CREATE INDEX XIF1LASTREPAIRPRICEUSED ON LASTREPAIRPRICEUSED (CUSTOMER_LINK_ID ASC);
CREATE INDEX XIF2LASTREPAIRPRICEUSED ON LASTREPAIRPRICEUSED (REPAIRTYPE_ID ASC);
CREATE INDEX XIF3LASTREPAIRPRICEUSED ON LASTREPAIRPRICEUSED (GENERALPRICELIST_ID ASC);
CREATE INDEX XIF4LASTREPAIRPRICEUSED ON LASTREPAIRPRICEUSED (INVOICEHEADER_ID ASC);
CREATE INDEX XIF5LASTREPAIRPRICEUSED ON LASTREPAIRPRICEUSED (CREATIONINVOICEHEADER_ID ASC);

ALTER TABLE LASTREPAIRPRICEUSED 
  ADD CONSTRAINT LASTREPPRICEUSED_CUST FOREIGN KEY (CUSTOMER_LINK_ID)
  REFERENCES CUSTOMER_LINK (CUSTOMER_LINK_ID);

ALTER TABLE LASTREPAIRPRICEUSED 
  ADD CONSTRAINT LASTREPPRICEUSED_REP FOREIGN KEY (REPAIRTYPE_ID)
  REFERENCES REPAIRTYPE (REPAIRTYPE_ID) ON DELETE CASCADE;

ALTER TABLE LASTREPAIRPRICEUSED 
  ADD CONSTRAINT LASTREPPRICEUSED_GENPRICE FOREIGN KEY (GENERALPRICELIST_ID)
  REFERENCES GENERALPRICELIST (GENERALPRICELIST_ID) ON DELETE SET NULL;

ALTER TABLE LASTREPAIRPRICEUSED 
  ADD CONSTRAINT LASTREPPRICEUSED_IH FOREIGN KEY (INVOICEHEADER_ID)
  REFERENCES INVOICEHEADER (INVOICEHEADER_ID) ON DELETE SET NULL;
  
ALTER TABLE LASTREPAIRPRICEUSED 
  ADD CONSTRAINT LASTREPPRICEUSED_IH_2 FOREIGN KEY (CREATIONINVOICEHEADER_ID)
  REFERENCES INVOICEHEADER (INVOICEHEADER_ID) ON DELETE CASCADE;


---TABLE INVOICEPRICEINCREASEMESSAGE
CREATE TABLE INVOICEPRICEINCREASEMESSAGE
(
  INVOICEHEADER_ID NUMBER NOT NULL,
  INVOICELINETYPE_ID NUMBER NOT NULL,
 INVOICEPRICEINCREASEMESSAGE VARCHAR2(150) NOT NULL,
  SYSTEMUSER_ID NUMBER NOT NULL,
  TIMESTAMP DATE NOT NULL
);

ALTER TABLE INVOICEPRICEINCREASEMESSAGE ADD CONSTRAINT XPKINVOICEPRICEINCREASEMESSAGE PRIMARY KEY (INVOICEHEADER_ID, INVOICELINETYPE_ID);

CREATE INDEX XIF1INVOICEPRICEINCREASEMESSAGE ON INVOICEPRICEINCREASEMESSAGE (INVOICEHEADER_ID ASC);
CREATE INDEX XIF2INVOICEPRICEINCREASEMESSAGE ON INVOICEPRICEINCREASEMESSAGE (INVOICELINETYPE_ID ASC);

ALTER TABLE INVOICEPRICEINCREASEMESSAGE 
  ADD CONSTRAINT INVPRICEMSG_IH FOREIGN KEY (INVOICEHEADER_ID)
  REFERENCES INVOICEHEADER (INVOICEHEADER_ID) ON DELETE CASCADE;

ALTER TABLE INVOICEPRICEINCREASEMESSAGE 
  ADD CONSTRAINT INVPRICEMSG_ILTY FOREIGN KEY (INVOICELINETYPE_ID)
  REFERENCES INVOICELINETYPE (INVOICELINETYPE_ID);

--TABLE INVOICELINEEXTRAINFO

ALTER TABLE INVOICELINEEXTRAINFO ADD (GENERALPRICELIST_ID NUMBER NULL,
PRICELISTTYPE NUMBER DEFAULT 0 NOT NULL CONSTRAINT CHK_INVLINEEXT_PRICETYPE CHECK (PRICELISTTYPE in (0, 1, 2, 3, 4)));

COMMENT ON COLUMN INVOICELINEEXTRAINFO.GENERALPRICELIST_ID IS 'Used only under the INVOICEDPRICEAUDIT module';

COMMENT ON COLUMN INVOICELINEEXTRAINFO.PRICELISTTYPE IS '0 = Not used
1 = Customer Specific
2 = General Price List
3 = Contract Price List
4 = Default (only used for special charges)
Used only under the INVOICEDPRICEAUDIT module
';

CREATE INDEX XIF1INVOICELINEEXTRAINFO ON INVOICELINEEXTRAINFO (GENERALPRICELIST_ID ASC);

ALTER TABLE INVOICELINEEXTRAINFO 
  ADD CONSTRAINT INVLINEEXTRAINFO_GENPRICE FOREIGN KEY (GENERALPRICELIST_ID)
  REFERENCES GENERALPRICELIST (GENERALPRICELIST_ID) ON DELETE SET NULL;

--TABLE PLANTINVOICELINETYPE

ALTER TABLE PLANTINVOICELINETYPE ADD (PRICEINCREASEMESSAGE VARCHAR2(150) NULL);

COMMENT ON COLUMN PLANTINVOICELINETYPE.PRICEINCREASEMESSAGE IS 'Only used under the INVOICEDPRICEAUDIT module. Text field for price increase message to be used on an invoice.';
