This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
a.fil_in_codigo, | |
a.not_in_numero, | |
a.ser_st_codigo, | |
a.not_dt_emissao, | |
a.not_ch_situacaonfe, | |
b.mds_bo_cancelado, | |
b.mds_ch_situacaonota, | |
a.acaom_in_sequencia | |
FROM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace FUNCTION F_VALIDA_CHAVE | |
( | |
pRCB_ST_CHAVEACESSO IN MGADM.EST_RECEBIMENTO.RCB_ST_CHAVEACESSOCTE%TYPE, | |
pUF_ST_SIGLA IN MGGLO.GLO_AGENTES.UF_ST_SIGLA%TYPE, | |
pRCB_DT_DOCUMENTO IN MGADM.EST_RECEBIMENTO.RCB_DT_DOCUMENTO%TYPE, | |
pAGN_ST_CGC IN MGGLO.GLO_AGENTES.AGN_ST_CGC%TYPE, | |
pTDF_IN_CODIGO IN MGADM.EST_RECEBIMENTO.TDF_IN_CODIGO%TYPE, | |
pSER_ST_CODIGO IN MGADM.EST_RECEBIMENTO.SER_ST_CODIGO%TYPE, | |
pRCB_ST_NOTA IN MGADM.EST_RECEBIMENTO.RCB_ST_NOTA%TYPE | |
) RETURN VARCHAR2 AS -- Retorna 'S' caso seja válido |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace TRIGGER T_CLI_EST_INVENTARIO_ITENS_RSV | |
BEFORE UPDATE OF ITI_RE_QTCONTADA ON MGADM.EST_ITENSINVENTARIO | |
REFERENCING OLD AS OLD NEW AS NEW | |
FOR EACH ROW | |
WHEN (NVL(NEW.MVS_IN_RESERVA,0) <> 0) | |
DECLARE | |
vITI_RE_QTCONTADA MGADM.EST_ITENSINVENTARIO.ITI_RE_QTCONTADA%TYPE; | |
BEGIN | |
CASE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace TRIGGER MGCLI.T_CLI_PRO_ORIGEM_AGN_TAU | |
BEFORE INSERT ON MGMAN.PRO_ORIGEM | |
REFERENCING OLD AS OLD NEW AS NEW | |
FOR EACH ROW | |
WHEN (NEW.ORI_CH_TIPOORIGEM IN ('T')) -- T = Agente de Terceiro | |
DECLARE | |
vTPO_CH_TPPERFILMATTERC MGMAN.PRO_TIPOORDENS.TPO_CH_TPPERFILMATTERC%TYPE; | |
/** | |
Perfil de Operação | |
Perfil de Operação Material de Terceiro |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
SEQ.RESULT SER_ST_CODIGO, 'INSERT INTO MGTRF.TRF_SERIEDOCFIS(ser_st_codigo, ser_st_descricao,ser_st_seriesintegra) ' | |
|| 'SELECT '''|| | |
SEQ.RESULT | |
||''' SER_ST_CODIGO, ''Série '|| LPAD(SEQ.RESULT,3,'0') || ''' SER_ST_DESCRICAO, '''|| SEQ.RESULT ||''' SER_ST_SERIESINTEGRA ' | |
|| 'FROM DUAL WHERE '''|| SEQ.RESULT ||''' NOT IN (SELECT T.SER_ST_CODIGO FROM MGTRF.TRF_SERIEDOCFIS T); COMMIT;' | |
"INS" | |
FROM MGTRF.TRF_SERIEDOCFIS A | |
RIGHT JOIN ( | |
select result from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace TRIGGER MGCLI.T_CLI_GLO_AGENDAINTMULTI | |
BEFORE INSERT OR UPDATE ON MGGLO.GLO_AGENDAINTMULTI | |
REFERENCING OLD AS OLD NEW AS NEW | |
FOR EACH ROW | |
BEGIN | |
:NEW.AIM_IN_USUARIOINTEGRA := 1; | |
END; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace TRIGGER T_CLI_EST_RECEB_NFE_CANCELADA | |
BEFORE INSERT OR UPDATE ON MGADM.EST_RECEBIMENTO | |
REFERENCING OLD AS OLD NEW AS NEW | |
FOR EACH ROW | |
WHEN (NEW.RCB_ST_CHAVEACESSO IS NOT NULL AND SUBSTR(NEW.RCB_ST_CHAVEACESSO,21,2) IN ('55', '65')) | |
DECLARE | |
vORIGEM VARCHAR2(200) := '[MGCLI.T_CLI_EST_RECEB_NFE_CANCELADA]'; | |
--N;Nenhuma Operação Realizada | |
cStatManCienciaOp constant char(1) := 'I'; -- I;Ciência da Operação |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FORCE VIEW "MGCLI"."CLI_VW_EST_MOVSUM_RESERVA" ("RN", "FIL_IN_CODIGO", "PRO_IN_CODIGO", "MVS_IN_RESERVA", "MVS_RE_QUANTIDADE", "RSV_CH_ORIGEM", "RSV_CH_ORIGEMDESC", "RSV_ST_DOCUMENTO", "RSV_DT_DOCUMENTO", "RSV_DT_MOVIMENTO", "RSV_ST_SITUACAO") AS | |
SELECT | |
"RN", | |
"FIL_IN_CODIGO", | |
"PRO_IN_CODIGO", | |
"MVS_IN_RESERVA", | |
"MVS_RE_QUANTIDADE", | |
"RSV_CH_ORIGEM", | |
CASE rsv_ch_origem |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE PACKAGE "MGCLI"."CLI_PCK_API_RECEITAWS" AS | |
-- https://www.receitaws.com.br/v1/cnpj/[cnpj] | |
FUNCTION F_CNPJ(pCNPJ MGGLO.GLO_AGENTES.AGN_ST_CGC%TYPE) RETURN CLOB; | |
-- https://www.receitaws.com.br/v1/cnpj/[cnpj] | |
PROCEDURE P_CNPJ(pCNPJ MGGLO.GLO_AGENTES.AGN_ST_CGC%TYPE); | |
END CLI_PCK_API_RECEITAWS; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE TRIGGER "MGCLI"."T_CLI_GLO_AGENTES_ID" | |
BEFORE UPDATE ON MGGLO.GLO_AGENTES_ID | |
REFERENCING OLD AS OLD NEW AS NEW | |
FOR EACH ROW | |
BEGIN | |
FOR cMOV IN ( | |
SELECT MOV_DT_EMISSAO, MOV_ST_TABELA FROM ( | |
SELECT FRE_DT_EMISSAO MOV_DT_EMISSAO, 'Financeiro - Contas a Receber' MOV_ST_TABELA FROM mgfin.fin_faturareceber WHERE agn_in_codigo = :NEW.AGN_IN_CODIGO and agn_tau_st_codigo = :new.agn_tau_st_codigo AND fre_dt_emissao < :NEW.AGN_DT_INICIOMOV AND fre_dt_emissao = (SELECT MIN(fre_dt_emissao) from mgfin.fin_faturareceber where agn_in_codigo = :NEW.agn_in_codigo and agn_tau_st_codigo = :NEW.agn_tau_st_codigo) and rownum <= 1 |