CREATE OR REPLACE PACKAGE TEKNISA_RFP AS
    K_APPLICATION_ERROR    CONSTANT NUMBER       := -20999;
    K_STATUS_PENDENTE      CONSTANT VARCHAR2(08) := 'PENDENTE';
    K_STATUS_INCONSISTENTE CONSTANT VARCHAR2(13) := 'INCONSISTENTE';
    K_STATUS_GERADO        CONSTANT VARCHAR2(06) := 'GERADO';

    K_MARCA1_INATIVA       CONSTANT VARCHAR2(30) := 'MARCA1_INATIVA';
    K_MARCA2_INATIVA       CONSTANT VARCHAR2(30) := 'MARCA2_INATIVA';
    K_MARCA3_INATIVA       CONSTANT VARCHAR2(30) := 'MARCA3_INATIVA';
    K_MARCA4_INATIVA       CONSTANT VARCHAR2(30) := 'MARCA4_INATIVA';
    K_MARCA5_INATIVA       CONSTANT VARCHAR2(30) := 'MARCA5_INATIVA';
    K_MARCA1_N_CADASTRADA  CONSTANT VARCHAR2(30) := 'MARCA1_NAO_CADASTRADA';
    K_MARCA2_N_CADASTRADA  CONSTANT VARCHAR2(30) := 'MARCA2_NAO_CADASTRADA';
    K_MARCA3_N_CADASTRADA  CONSTANT VARCHAR2(30) := 'MARCA3_NAO_CADASTRADA';
    K_MARCA4_N_CADASTRADA  CONSTANT VARCHAR2(30) := 'MARCA4_NAO_CADASTRADA';
    K_MARCA5_N_CADASTRADA  CONSTANT VARCHAR2(30) := 'MARCA5_NAO_CADASTRADA';

    K_PRECO1_N_INFORMADO   CONSTANT VARCHAR2(30) := 'PRECO1_NAO_INFORMADO';
    K_PRECO2_N_INFORMADO   CONSTANT VARCHAR2(30) := 'PRECO2_NAO_INFORMADO';
    K_PRECO3_N_INFORMADO   CONSTANT VARCHAR2(30) := 'PRECO3_NAO_INFORMADO';
    K_PRECO4_N_INFORMADO   CONSTANT VARCHAR2(30) := 'PRECO4_NAO_INFORMADO';
    K_PRECO5_N_INFORMADO   CONSTANT VARCHAR2(30) := 'PRECO5_NAO_INFORMADO';
    K_PRECO1_IGUAL_ZERO    CONSTANT VARCHAR2(30) := 'PRECO1_IGUAL_ZERO';
    K_PRECO2_IGUAL_ZERO    CONSTANT VARCHAR2(30) := 'PRECO2_IGUAL_ZERO';
    K_PRECO3_IGUAL_ZERO    CONSTANT VARCHAR2(30) := 'PRECO3_IGUAL_ZERO';
    K_PRECO4_IGUAL_ZERO    CONSTANT VARCHAR2(30) := 'PRECO4_IGUAL_ZERO';
    K_PRECO5_IGUAL_ZERO    CONSTANT VARCHAR2(30) := 'PRECO5_IGUAL_ZERO';
    
    K_CENTRAL_N_PARAM      CONSTANT VARCHAR2(30) := 'CENTRAL_NAO_PARAMETRIZADA';
    K_COMPRADOR_N_CADAST   CONSTANT VARCHAR2(30) := 'COMPRADOR_NAO_CADASTRADO';
    K_ITENS_INCONSISTENTES CONSTANT VARCHAR2(30) := 'TODOS_ITENS_INCONSISTENTES';

    K_IMP_INCONSISTENTE    CONSTANT VARCHAR2(30) := 'ARQUIVO_INCONSISTENTE';
    K_IMP_EFETUADA         CONSTANT VARCHAR2(30) := 'ARQUIVO_GERADO';
    K_COT_SUCESSO          CONSTANT VARCHAR2(30) := 'COTACAO_GERADA_SUCESSO';
    K_COT_ERROR            CONSTANT VARCHAR2(30) := 'ERRO_GERACAO_COTACAO';    

    K_PZOPGTPRFO           CONSTANT VARCHAR2(30) := 'PZOPGTPRFO';
    K_PRAZOPGTFORN         CONSTANT VARCHAR2(30) := 'PRAZOPGTFORN';

 
    PROCEDURE CHECK_RFPMAIN(P_NRRFPMAIN IN RFPMAIN.NRRFPMAIN%TYPE);

    PROCEDURE CHECK_RFPFORNECEDOR(P_NRRFPMAIN IN RFPMAIN.NRRFPMAIN%TYPE,
                                  P_RFPMAIN   IN RFPMAIN%ROWTYPE   DEFAULT NULL,  
                                  P_PARASUPRI IN PARASUPRI%ROWTYPE DEFAULT NULL);

    PROCEDURE CHECK_RFPREGIAO(P_NRRFPMAIN IN RFPMAIN.NRRFPMAIN%TYPE);

    PROCEDURE CHECK_RFPREGIAO_FORNECEDOR(P_NRRFPMAIN IN RFPMAIN.NRRFPMAIN%TYPE);


    FUNCTION CHECK_PRECO(P_PRECO   IN NUMBER,
                         P_VRPRECO IN NUMBER) RETURN VARCHAR2;
       
    PROCEDURE CHECK_RFPPRODMARCA(P_NRRFPMAIN IN RFPMAIN.NRRFPMAIN%TYPE,
                                 P_PARASUPRI IN PARASUPRI%ROWTYPE DEFAULT NULL);


    PROCEDURE CHECK_IMPORT(P_NRRFPMAIN IN RFPMAIN.NRRFPMAIN%TYPE);
    
    PROCEDURE IMPORTA_RFP(P_NRRFPMAIN    IN RFPMAIN.NRRFPMAIN%TYPE,
                          P_IDDISMONTLIS IN COLETAPR.IDDISMONTLIS%TYPE,
                          P_CDOPERINCL   IN OPERADOR.CDOPERADOR%TYPE,
                          P_MESSAGE     OUT VARCHAR2,
                          P_ERROR       OUT VARCHAR2);

END TEKNISA_RFP;
/