/******************************************************************************/
/***               Generated by IBExpert 12/03/2019 15:39:12                ***/
/******************************************************************************/

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

CREATE GENERATOR PQ_PD_PARCELAS_HISTORICO;

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



CREATE TABLE PD_PARCELAS_HISTORICO (
    SEQ            INTEGER NOT NULL,
    SEQPEDIDO      INTEGER NOT NULL,
    NRDOC          VARCHAR(11) NOT NULL,
    DTEMISSAO      DATE,
    DTVENCTO       DATE,
    VALOR          NUMERIC(14,2),
    PARCELA        INTEGER,
    PAGO           CHAR(1),
    EMPRESA        INTEGER,
    TERMINAL       INTEGER NOT NULL,
    FORMA          INTEGER,
    VALORPAGO      NUMERIC(14,2),
    VALORRECEBIDO  NUMERIC(14,4) default 0
);




/******************************************************************************/
/***                              Primary Keys                              ***/
/******************************************************************************/

ALTER TABLE PD_PARCELAS_HISTORICO ADD PRIMARY KEY (SEQ);



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


SET TERM ^ ;



/******************************************************************************/
/***                          Triggers for tables                           ***/
/******************************************************************************/



/* Trigger: INSPEDIDOSPARCELAS */
CREATE OR ALTER TRIGGER INSPD_PARCELAS_HISTORICO FOR PD_PARCELAS_HISTORICO
ACTIVE BEFORE INSERT POSITION 0
AS
begin
   new.seq=gen_id(PQ_PD_PARCELAS_HISTORICO,1);
end
^


SET TERM ; ^



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

