--ABS-157521
ALTER TABLE ERP_I_PRODUCT ADD (MMPDEFAULTPERCENTAGE NUMBER DEFAULT 0 NULL
 CONSTRAINT CHK_ERPIPRODUCT_MMPDEFAULTPERCENT CHECK (MMPDEFAULTPERCENTAGE BETWEEN 0 AND 100));
COMMENT ON COLUMN ERP_I_PRODUCT.MMPDEFAULTPERCENTAGE
IS 'Material Maintenance Protection (MMP) default percentage. 0 default value.
Must be filled with a value between 0 and 100.0 
Only used for module BPMMPENHANCED';

ALTER TABLE ERP_U_CUSTOMER ADD( 
  EMAIL                       VARCHAR2(300) NULL,
  PHONENO                     VARCHAR2(30) NULL,
  MAILADDRESS                 VARCHAR2(40) NULL,
  MAILADDRESS2                VARCHAR2(40) NULL,
  MAILZIPCODE                 VARCHAR2(15) NULL,
  MAILCITY                    VARCHAR2(30) NULL,
  MAILCOUNTY                  VARCHAR2(20) NULL,
  VISITADDRESS                VARCHAR2(40) NULL,
  VISITADDRESS2               VARCHAR2(40) NULL,
  VISITZIPCODE                VARCHAR2(15) NULL,
  VISITCITY                   VARCHAR2(30) NULL,
  VISITSTATE                  VARCHAR2(20) NULL,
  VISITCOUNTY                 VARCHAR2(20) NULL,
  INVOICEADDRESS              VARCHAR2(40) NULL,
  INVOICEADDRESS2             VARCHAR2(40) NULL,
  INVOICEZIPCODE              VARCHAR2(15) NULL,
  INVOICECITY                 VARCHAR2(30) NULL,
  INVOICESTATE                VARCHAR2(20) NULL,
  INVOICECOUNTY               VARCHAR2(20) NULL,
  PAYMENTTERMSCODE            VARCHAR2(6) NULL,
  NATIONALACCOUNTCODE         VARCHAR2(15) NULL,  
  FINANCECHARGEDAYS           NUMBER NULL CONSTRAINT CHK_ERP_U_CUST_FINANCEDAYS CHECK (FINANCECHARGEDAYS BETWEEN 0 AND 999),  
  SENDSTATEMENT               NUMBER NULL CONSTRAINT CHK_ERPUCUST_SENDSTATEMENT CHECK (SENDSTATEMENT IN (1,2,3,4)),
  STATEMENTFREQUENCY          NUMBER NULL,
  USEPRODSIZESURCHARGEPRICING VARCHAR2(1) DEFAULT 'N' NULL CONSTRAINT CHK_ERP_U_CUST_USPRDSZSRCHRGPC CHECK (USEPRODSIZESURCHARGEPRICING IN ('Y','N')),
  INVOICECOPIES               NUMBER(1) NULL,
  SENDSTATEMENTBYEMAIL        VARCHAR2(1) NULL CONSTRAINT CHK_ERPU_CUS_SNDSTATBMAIL CHECK (SENDSTATEMENTBYEMAIL IN ('Y','N'))
  );
ALTER TABLE ERP_U_CUSTOMER ADD CONSTRAINT FKERP_U_CUST_STATEFREQ FOREIGN KEY (STATEMENTFREQUENCY) REFERENCES INVOICEFREQUENCY (INVOICEFREQUENCY_ID);
COMMENT ON COLUMN ERP_U_CUSTOMER.SENDSTATEMENT IS
'1=Always
2=Only if pas due
3=Never
4=Monthly (only visible under the MONTHLYSTATEMENT module)';

ALTER TABLE ERP_I_PRODUCTLISTPERCUSTOMER ADD(
  SRCPERCENTAGEBILLEDQTY NUMBER(15,2) NULL,
  MLPSPECIFICPERCENTAGE  NUMBER DEFAULT 100 NULL CONSTRAINT CHK_ERP_I_PLPC_MMPSPECIFICPERC CHECK ((MLPSPECIFICPERCENTAGE BETWEEN 0.0 AND 100.0))
  );
COMMENT ON COLUMN ERP_I_PRODUCTLISTPERCUSTOMER.MLPSPECIFICPERCENTAGE IS
'Material Loss Protection (MLP) specific percentage. If empty (Null) then take the percentage defined on Customer or Product level. If on customer level is defined 0.0 (no MLP) then must be set to Null.';

ALTER TABLE ERP_U_PLPC ADD(
  FIXEDQUANTITY          NUMBER NULL,
  MINIMUMTURNAROUND      NUMBER NULL,
  MINIMUMQUANTITY        NUMBER NULL,
  SRCMETHOD              NUMBER NULL CONSTRAINT CHK_ERP_U_PLPC_SRCMETHOD CHECK (SRCMETHOD IN (0,1,2,3,4)),
  SRCFREQUENCY           NUMBER NULL CONSTRAINT CHK_ERP_U_PLPC_SRCFREQUENCY CHECK (SRCFREQUENCY IN (0, 1, 2, 3)),
  SRCPERCENTAGESOILCOUNT NUMBER NULL,
  SRCPERCENTAGEINVENTORY NUMBER NULL,
  SRCQUANTITY            NUMBER NULL,
  AUTOSOILPERCENTAGE     NUMBER NULL CONSTRAINT CHK_ERP_U_PLPC_CAUTOSOILPERC CHECK (AUTOSOILPERCENTAGE BETWEEN 0.0 AND 100.0),
  LOSSCHARGEPERCENTAGE   NUMBER(5,2) NULL CONSTRAINT CHK_ERP_U_PLPC_LOSSCHARGEPERC CHECK (LOSSCHARGEPERCENTAGE BETWEEN 0.00 AND 999.99)
  );
COMMENT ON COLUMN ERP_U_PLPC.FIXEDQUANTITY IS
'For billing method 1 Flat rated rent.
Note: Only fill it when customer does not have departments. Else export at lower level in delivery standards';
COMMENT ON COLUMN ERP_U_PLPC.MINIMUMTURNAROUND IS
'For billing method 2 rent based on minimum. Percentage of Inventory defined as minimum. 0 if not applicable';
COMMENT ON COLUMN ERP_U_PLPC.SRCMETHOD IS 
'0-No Systematic Replacement Charge. 1-Percentage of Soil Count, 2-Percentage of Circulating inventory. 3-Fixed Quantity';
COMMENT ON COLUMN ERP_U_PLPC.SRCFREQUENCY IS
'For SRCMETHOD 0 or 1: 0-Not applicable For SRCMETHOD 2 or 3: 1-Every Delivery 2-Every Week First Delivery 3-Every Week Last Delivery';
