--Order 20011825.110 - (CR22I) - Report: Cost reports


CREATE TABLE COSTREPORTEXTRAINFO
(
	INVOICELINE_ID       NUMBER NOT NULL ,
	COSTCENTER_LINK_ID   NUMBER NOT NULL ,
	YEAR                 NUMBER NOT NULL ,
	WEEK                 NUMBER NOT NULL ,
	STANDARDQUANTITY     NUMBER DEFAULT  0  NOT NULL ,
	SYSTEMUSER_ID        NUMBER NOT NULL ,
	TIMESTAMP            DATE NOT NULL 
);


ALTER TABLE COSTREPORTEXTRAINFO
ADD CONSTRAINT  XPKCOSTREPORTEXTRAINFO PRIMARY KEY (INVOICELINE_ID,COSTCENTER_LINK_ID,YEAR,WEEK);

CREATE  INDEX XIF1COSTREPORTEXTRAINFO ON COSTREPORTEXTRAINFO
(INVOICELINE_ID   ASC);

ALTER TABLE COSTREPORTEXTRAINFO
ADD CONSTRAINT COSTREPEXTRAINFO_INVOICELINE FOREIGN KEY (INVOICELINE_ID) REFERENCES INVOICELINE (INVOICELINE_ID) ON DELETE CASCADE;


CREATE  INDEX XIF2COSTREPORTEXTRAINFO ON COSTREPORTEXTRAINFO
(COSTCENTER_LINK_ID   ASC);

ALTER TABLE COSTREPORTEXTRAINFO
ADD CONSTRAINT COSTREPEXTRAINFO_COSTCENTER_LK FOREIGN KEY (COSTCENTER_LINK_ID) REFERENCES COSTCENTER_LINK (COSTCENTER_LINK_ID);
