--------Order 20013412.60 - Filter print Client Delivery Note per FM

----------------------------TABLE PLANTDEPARTMENTFINMETHOD--------------------

CREATE TABLE PLANTDEPARTMENTFINMETHOD
(
	PLANTDEPARTMENT_ID   NUMBER NOT NULL ,
	FINISHINGMETHOD_ID   NUMBER NOT NULL ,
	SYSTEMUSER_ID        NUMBER NOT NULL ,
	TIMESTAMP            DATE NOT NULL 
);

ALTER TABLE PLANTDEPARTMENTFINMETHOD
ADD CONSTRAINT  XPKPLANTDEPARTMENTFINMETHOD PRIMARY KEY (PLANTDEPARTMENT_ID,FINISHINGMETHOD_ID);

ALTER TABLE PLANTDEPARTMENTFINMETHOD
ADD CONSTRAINT PLANTDEP_PLANTDEPFINMETH FOREIGN KEY (PLANTDEPARTMENT_ID) REFERENCES PLANTDEPARTMENT (PLANTDEPARTMENT_ID) ON DELETE CASCADE;

CREATE  INDEX XIF1PLANTDEPARTMENTFINMETHOD ON PLANTDEPARTMENTFINMETHOD
(PLANTDEPARTMENT_ID   ASC);

ALTER TABLE PLANTDEPARTMENTFINMETHOD
ADD CONSTRAINT PLANTDEP_FINISHINGMETH FOREIGN KEY (FINISHINGMETHOD_ID) REFERENCES FINISHINGMETHOD (FINISHINGMETHOD_ID) ON DELETE CASCADE;

CREATE  INDEX XIF2PLANTDEPARTMENTFINMETHOD ON PLANTDEPARTMENTFINMETHOD
(FINISHINGMETHOD_ID   ASC);
