This file contains 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 * from AccountingBalanceSheet; | |
desc AccountingBalanceSheet; | |
select * from AccountingBalanceSheetAccountBalance;DELIMITER $$ | |
CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_teste`() | |
BEGIN | |
-- declarando variaveis | |
DECLARE fim INT DEFAULT false; | |
DECLARE var_id_dado_coletado INT; | |
DECLARE var_valor_identificador varchar(45); | |
DECLARE var_pergunta varchar(100); |
This file contains 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 COUNT(1) FROM erp_parceiro_classificacoes where id_classificacao = 8 and cast(replace(replace(replace(replace(value,"R$","")," ",""),".",""),",",".") AS decimal(10,2)) BETWEEN 150 AND 1000; | |
SELECT id_parceiro, id_classificacao, cast(replace(replace(replace(replace(value,"R$","")," ",""),".",""),",",".") AS decimal(10,2)) FROM erp_parceiro_classificacoes where id_classificacao = 8 and cast(replace(replace(replace(replace(value,"R$","")," ",""),".",""),",",".") AS decimal(10,2)) BETWEEN 150 AND 1000; |
This file contains 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 | |
pe.id_parceiro, | |
'VALE DA ESPERANCA' as nucleo, | |
concat('R$ ', MAX(cast(replace(replace(replace(replace(c.value,"R$","")," ",""),".",""),",",".") AS decimal(10,2)))) as valor_total_em_aberto, | |
DATE_FORMAT(NOW(),'%d/%m/%Y') as data_atualizacao_valor_total, | |
pe.uc, | |
pf.cpf as cpf_titular, | |
pf.nome as titular, | |
m.des as municipio, | |
pf.cpf as cpf_beneficiado, |
This file contains 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 DEFINER=`root`@`localhost` PROCEDURE `importacao_lancamentos`() | |
BEGIN | |
DECLARE fim INT DEFAULT false; | |
DECLARE var_id_lancamento_contabil_item int; | |
DECLARE var_id_lancamento_contabil int; | |
DECLARE var_id_conta_debito int; | |
DECLARE var_id_conta_credito int; | |
DECLARE var_valor_debito decimal(20,2); | |
DECLARE var_valor_credito decimal(20,2); | |
DECLARE var_stat tinyint; |
This file contains 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
insert into AccountingTransaction (id_transacao_contabil,id_empresa,id_parceiro_principal,id_parceiro_operacional,id_descricao_transacao_contabil,dt_contabil,somatorio_lancamentos,stat_fechamento,des_complemento,tipo_lancamento_sped,stat) | |
select a.id_lancamento_contabil,a.id_empresa,null,a.id_parceiro,null,a.dt_contabil,a.somatorio_lancamentos,a.status_fechamento,a.des,a.tipo_lancto_sped,a.stat from con_lancamento_contabil a |
This file contains 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 DEFINER=`root`@`localhost` PROCEDURE `new_procedure`() | |
BEGIN | |
DECLARE fim INT DEFAULT false; | |
DECLARE var_id_lancamento_contabil_item int; | |
DECLARE var_id_lancamento_contabil int; | |
DECLARE var_id_conta_debito int; | |
DECLARE var_id_conta_credito int; | |
DECLARE var_valor_debito decimal(20,2); | |
DECLARE var_valor_credito decimal(20,2); | |
DECLARE var_stat tinyint; |
This file contains 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 DEFINER=`root`@`localhost` PROCEDURE `new_procedure`() | |
BEGIN | |
declare var_id_usuario int; | |
set var_id_usuario = 108; | |
BLOCK1: begin | |
DECLARE fim INT DEFAULT false; | |
declare var_id_documento int; | |
declare cursor1 cursor for | |
select | |
id_documento_tipo |
This file contains 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
<?php | |
$query = "SELECT | |
dc.id_dado_coletado, | |
dc.id_projeto_elemento, | |
dc.valor_identificador, | |
d.caminho_file, | |
proj.nome as projeto, | |
pre.des_status as processo | |
FROM erp_dado_coletado dc | |
INNER JOIN erp_dado_coletado_item dci ON dci.id_dado_coletado = dc.id_dado_coletado AND dci.tabela_registro = 'Document' |
This file contains 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 | |
DCB, | |
Count(*) | |
FROM | |
Document d | |
INNER JOIN DocumentOrigin o ON o.id_documento = d.id_documento | |
GROUP BY DCB | |
HAVING Count(*) > 1; |
This file contains 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
update Document set stat = 0 where id_documento in ( | |
select id_documento from ( | |
select | |
d.id_documento | |
from | |
DocumentOrigin o | |
inner join Document d on d.id_documento = o.id_documento | |
where | |
o.id_registro in( | |
SELECT |
OlderNewer