ALTER TABLE ITCOMANDAVEN ADD IDORIGPEDCMD VARCHAR2(3) DEFAULT 'FOS' NULL
   CONSTRAINT CKC_IDORIGPEDCMD_ITCOMANDAVEN CHECK (IDORIGPEDCMD IN ('FOS','MOB')) 
/

ALTER TABLE ITCOMANDAVEN ADD DSOBSPEDDIGCMD VARCHAR2(2000) NULL
/

ALTER TABLE ITCOMANDAEST ADD DSOBSPEDDIGEST VARCHAR2(2000) NULL
/
 
ALTER TABLE ITEMVENDA ADD DTHRPEDIDO DATE NULL 
/ 

ALTER TABLE ITEMVENDA ADD CDCAIXAPEDVEN VARCHAR2(3) NULL 
/ 

ALTER TABLE ITEMVENDA ADD IDORIGPEDVEN VARCHAR2(3) DEFAULT 'FOS' NULL
   CONSTRAINT CKC_IDORIGPEDVEN_ITEMVENDA CHECK (IDORIGPEDVEN IN ('FOS','MOB'))
/

ALTER TABLE ITEMVENDA ADD DSOBSPEDDIGITA VARCHAR2(2000) NULL
/

ALTER TABLE ITEMVENDA ADD NRSEQPRODCOMIT VARCHAR2(3) NULL
/

ALTER TABLE ITEMVENDAEST ADD DSOBSPEDDIGITE VARCHAR2(2000) NULL
/

ALTER TABLE ITPEDIDOFOS ADD NRTEMPOPRODIT VARCHAR2(6) NULL
/

ALTER TABLE ITPEDIDOFOS ADD NRTEMPOEXIBIT VARCHAR2(6) NULL
/

CREATE TABLE ITPEDIDOFOSREL (
   CDFILIAL         VARCHAR2(4)    NOT NULL,
   NRPEDIDOFOS      VARCHAR2(10)   NOT NULL,
   NRITPEDIDOFOS    VARCHAR2(10)   NOT NULL,
   NRSEQITPEDREL    VARCHAR2(10)   NOT NULL,
   NRVENDAREST      VARCHAR2(10)   NOT NULL,
   NRCOMANDA        VARCHAR2(10)   NOT NULL,
   NRPRODCOMVEN     VARCHAR2(6)    NOT NULL,
   QTPRODPEFOS      FLOAT          NOT NULL,
   IDSITITPEDFOS    VARCHAR2(1)    NOT NULL,
   DTULTATU         DATE           NULL,
   NRORG            NUMBER         DEFAULT 1 NULL,
   DTINCLUSAO       DATE           NULL,
   NRORGINCLUSAO    NUMBER         DEFAULT 1 NULL,
   CDOPERINCLUSAO   VARCHAR2(12)   DEFAULT '1' NULL,
   NRORGULTATU      NUMBER         DEFAULT 1 NULL,
   CDOPERULTATU     VARCHAR2(12)   DEFAULT '1' NULL,
   CONSTRAINT PK_ITPEDIDOFOSREL PRIMARY KEY (CDFILIAL, NRPEDIDOFOS, NRITPEDIDOFOS, NRSEQITPEDREL)
)
/