--ABS-9491
-----------------------PLANT-------------------------
ALTER TABLE PLANT
  	ADD (REMITBATCHTIMELIMIT DATE DEFAULT TO_DATE('31-12-2099','DD-MM-YYYY') NOT NULL);

-----------------------REMIT BATCH-------------------------
ALTER TABLE REMITBATCH
DROP CONSTRAINT PAYMENTTYPE_VALID;

ALTER TABLE REMITBATCH ADD CONSTRAINT PAYMENTTYPE_valid CHECK 
((PAYMENTTYPE IN (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)) OR (PAYMENTTYPE IS NULL));

COMMENT ON COLUMN REMITBATCH.PAYMENTTYPE IS '0 = Cash
1 = Check
2 = Credit card
3 = EFT
4 = EDI
5 = Acceptgiro
6 = Automatic collection
7 = Pay-by customer
8 = Credit Card Portal
9 = Not applicable
';


-----------------------AR TRANSACTION-------------------------
ALTER TABLE ARTRANSACTION
DROP CONSTRAINT ORIGIN_VALID1;

ALTER TABLE ARTRANSACTION ADD CONSTRAINT ORIGIN_VALID1 CHECK (ORIGIN IN (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11));

COMMENT ON COLUMN ARTRANSACTION.ORIGIN IS 'This field is only used internally for trouble shooting. It identifies where the ARTransaction is created. 
0 = Undefined 
1 = Finalize invoices 
2 = Consolidated invoices 
3 = Settlement 
4 = Generate statement 
5 = Cash application - Manual added 
6 = Cash application - Generated (apply) 
7 = DB Procedure ProcessPaymentTransaction 
8 = DB Procedure ProcessUnappliedCredit 
9 = Credit card transactions - cancel / refund 
10 = Process credit card transactions
11 = Credit Card Portal
';

COMMENT ON COLUMN ARTRANSACTION.PAYMENTTYPE IS 'DebitCredit = C 
0 = Cash 
1 = Check 
2 = Credit card 
3 = EFT 
4 = EDI 
5 = Acceptgiro 
6 = Automatic collection 
7 = Pay-by customer 
8 = Credit Card Portal
9 = Not applicable 
DebitCredit = D 
0 = COD 
1 = Charge 
9 = Not applicable
';

-----------------------PROCESS SCHEDULER-------------------------

INSERT INTO PROCESS(PROCESS_ID,DESCRIPTION,ACTIVE) VALUES ('135','Close remit batch portal','Y');
COMMIT;