--ABS-6276
-----------------------ROUTECONTROL-------------------------

ALTER TABLE ROUTECONTROL ADD CONSTRAINT SETTLEMENTSTATUS_valid CHECK (SETTLEMENTSTATUS IN (1, 2, 3 , 4));
COMMENT ON COLUMN ROUTECONTROL.SETTLEMENTSTATUS IS '1 = Not started
2 = In progress
3 = Completed
4 = Done, there are still unsettled invoices';

UPDATE ROUTECONTROL R
SET R.SETTLEMENTSTATUS = 1
WHERE R.SETTLEMENTSTATUS NOT IN (1,2,3,4);

COMMIT;

-----------------------INVOICEHEADER-------------------------

ALTER TABLE INVOICEHEADER 
	ADD (SETTLEMENTREJECTREASON NUMBER NULL CONSTRAINT SETTLEMENTREJREASON_valid CHECK (SETTLEMENTREJECTREASON IN (0, 1, 2, 3)));

COMMENT ON COLUMN INVOICEHEADER.SETTLEMENTREJECTREASON IS '0 = Reason not specified
1 = No valid PO found or PO is expired
2 = Price does not match PO line
3 = No turnover Group
';

