--From PVD
--order 502356

-- Add/modify columns 
alter table I_PRODUCT add FULFILLMENTGROUP number;


-- Add/modify columns 
alter table I_INVOICEHEADER add PAYMENTTERMSDUEDATE date;
-- Add comments to the columns 
comment on column I_INVOICEHEADER.PAYMENTTERMSDUEDATE
  is 'DUE DATE';

-- Add columns 
alter table I_CUSTOMER add SPLITINVOICESPERACTIVITY VARCHAR2(1) default 'N' not null;
-- Add comments to the columns 
comment on column I_CUSTOMER.SPLITINVOICESPERACTIVITY
  is 'Possible values ''N'' and ''Y''';
-- Create check constraints 
alter table I_CUSTOMER
  add constraint I_CUST_YN_SPLITINVOICESPERACT
  check (SPLITINVOICESPERACTIVITY IN ('Y','N'));

 
-- Add columns 
alter table I_DELIVERYDAYS add DELIVERYPOINTCODE VARCHAR2(12);


-- Create table
create table I_DELIVERYPOINT
(
  CUSTOMERNUMBER           NUMBER not null,
  DELIVERYPOINTCODE        VARCHAR2(12) not null,
  DELIVERYPOINTDESCRIPTION VARCHAR2(30) default '-',
  DELIVERYADDRESS_STREET   VARCHAR2(30),
  DELIVERYADDRESS_ZIPCODE  VARCHAR2(15),
  DELIVERYADDRESS_STREET2  VARCHAR2(30),
  SORTADDRESS              VARCHAR2(6),
  MONDAYOPEN               DATE,
  MONDAYCLOSED             DATE,
  TUESDAYOPEN              DATE,
  TUESDAYCLOSED            DATE,
  WEDNESDAYOPEN            DATE,
  WEDNESDAYCLOSED          DATE,
  THURSDAYOPEN             DATE,
  THURSDAYCLOSED           DATE,
  FRIDAYOPEN               DATE,
  FRIDAYCLOSED             DATE,
  SATERDAYOPEN             DATE,
  SATERDAYCLOSED           DATE,
  BREAKFROM                DATE,
  BREAKTO                  DATE
);
-- Add comments to the columns 
comment on column I_DELIVERYPOINT.CUSTOMERNUMBER
  is 'Linked to i_customer';
comment on column I_DELIVERYPOINT.DELIVERYPOINTCODE
  is 'Delivery point code';
comment on column I_DELIVERYPOINT.DELIVERYADDRESS_STREET
  is 'Delivery point address can be left empty';
comment on column I_DELIVERYPOINT.MONDAYOPEN
  is 'Time fields date is always 01-01-1900';
-- Create primary and foreign key constraints 
alter table I_DELIVERYPOINT
  add constraint PK_I_DELIVERYPOINT primary key (CUSTOMERNUMBER, DELIVERYPOINTCODE);
alter table I_DELIVERYPOINT
  add constraint FK_I_DELIVERYPOINT_CUST foreign key (CUSTOMERNUMBER)
  references I_CUSTOMER (CUSTOMERNUMBER) on delete cascade;