/******************************************************************************/
/***               Generated by IBExpert 12/03/2019 15:36:37                ***/
/******************************************************************************/

/******************************************************************************/
/***      Following SET SQL DIALECT is just for the Database Comparer       ***/
/******************************************************************************/
SET SQL DIALECT 3;



/******************************************************************************/
/***                                 Tables                                 ***/
/******************************************************************************/



CREATE TABLE PEDIDOS_HISTORICO (
    SEQ            INTEGER NOT NULL,
    NRDOC          VARCHAR(11) NOT NULL,
    DTEMISSAO      DATE,
    DTALTERACAO    DATE,
    CAIXAEMISSAO   INTEGER,
    DESCONTO       NUMERIC(12,4),
    ACRESCIMO      NUMERIC(12,4),
    SUBTOTAL       NUMERIC(12,4),
    CODCLI         INTEGER,
    VENDEDOR       INTEGER,
    TOTAL          NUMERIC(12,4),
    NRPARCELAS     INTEGER,
    OBS            BLOB SUB_TYPE 0 SEGMENT SIZE 80,
    FORMA          INTEGER,
    INTERVALODIAS  INTEGER,
    VLENTRADA      NUMERIC(12,2),
    TABELA         VARCHAR(8),
    EMPRESA        INTEGER,
    TERMINAL       INTEGER NOT NULL,
    ENTREGA        VARCHAR(5),
    NRCAIXA        INTEGER,
    NRCUPOM        VARCHAR(6) CHARACTER SET WIN1252,
    NOMECLI        VARCHAR(50) CHARACTER SET WIN1252,
    ENDECLI        VARCHAR(50) CHARACTER SET WIN1252,
    BAIRRCLI       VARCHAR(40) CHARACTER SET WIN1252,
    CIDACLI        VARCHAR(50) CHARACTER SET WIN1252,
    UFCLI          VARCHAR(2) CHARACTER SET WIN1252,
    CEPCLI         VARCHAR(10) CHARACTER SET WIN1252,
    CPFCLI         VARCHAR(20) CHARACTER SET WIN1252,
    RGINSCLI       VARCHAR(25) CHARACTER SET WIN1252,
    TABPRE         INTEGER,
    NRNOTA         VARCHAR(8) CHARACTER SET WIN1252,
    CODCOBR        INTEGER,
    DESBLOQUEIO    VARCHAR(5) CHARACTER SET WIN1252,
    DESBLRESP      VARCHAR(20) CHARACTER SET WIN1252,
    ITENS          INTEGER,
    USUARIO        VARCHAR(20),
    IDPEDIDOSITE   INTEGER default 0,
    VALDINHEIRO    NUMERIC(14,2),
    VALCARTAO      NUMERIC(14,2),
    CHAVE          VARCHAR(50),
    HRALTERACAO    TIME,
    HRINCLUSAO     TIME,
    CODUSUINCL     INTEGER,
    CODUSUALTE     INTEGER,
    DATAALTERACAO  DATE,
    DATAINCLUSAO   DATE,
    TIPONOTA       INTEGER,
    DTCUPOM        DATE,
    EFETIVADO      D_BOOLEAN default 1 /* D_BOOLEAN = SMALLINT CHECK (VALUE = 0 OR VALUE = 1) */,
    CONDICIONAL    D_BOOLEAN DEFAULT 0 NOT NULL /* D_BOOLEAN = SMALLINT CHECK (VALUE = 0 OR VALUE = 1) */,
    HAVER          CHAR(1),
    TIPOPRECO      INTEGER DEFAULT 0 NOT NULL,
    ENDERECOSAT    SMALLINT DEFAULT 0,
    NUMCLI         VARCHAR(10),
    COMPLEMENTO    VARCHAR(30),
    FORMASAT       INTEGER,
    PORC_COMIS     NUMERIC(12,2),
    BOLETO         SMALLINT
);






/******************************************************************************/
/***                                Triggers                                ***/
/******************************************************************************/


SET TERM ^ ;





/******************************************************************************/
/***                               Privileges                               ***/
/******************************************************************************/

