Skip to content

Instantly share code, notes, and snippets.

@primogf
primogf / converter xlsx para csv
Last active April 27, 2018 12:30
Importacao Marvel
libreoffice --headless --convert-to csv claim_rioclaro.xlsx --outdir .
@primogf
primogf / ajuste_numero_nf_pedido.sql
Created October 18, 2017 17:09
procedure atualiza numero da nota no pedido
CREATE PROCEDURE `ajuste_numero_nf_pedido` ()
BEGIN
DECLARE fim INT DEFAULT false;
DECLARE var_id_documento int;
DECLARE var_id_registro int;
DECLARE var_numero_nfe int;
DECLARE var_id_lancamento_contabil int;
DECLARE var_id_conta_debito int;
DECLARE var_id_conta_credito int;
drop table DocumentNFS;
CREATE TABLE IF NOT EXISTS `DocumentNFS` (
`id_documento` BIGINT(18) NOT NULL,
`id_parceiro_prestador` BIGINT(18) NULL,
`id_parceiro_tomador` BIGINT(18) NULL,
`id_servico` BIGINT(18) NULL,
`id_nbsfiscal_municipio` BIGINT(18) NULL,
`id_nbsfiscal` BIGINT(18) NULL,
`fe_tipo_emissao` BIGINT(18) NULL,
select
t.id_transacao_contabil,
t.somatorio_lancamentos,
sum(ti.valor) as somaValores
from
AccountingTransaction t
inner join AccountingTransactionItem ti on ti.id_transacao_contabil = t.id_transacao_contabil and ti.stat <> 0 and ti.natureza = 'D'
where
t.stat <> 0
group by t.id_transacao_contabil order by t.id_transacao_contabil;
@primogf
primogf / habilitar_desabilitar_campos_form
Created May 16, 2017 18:14
codigo jquery para habilitar e desabilitar todos os campos do formulario
//desabilita
$("#form :input").prop("disabled", true);
//habilita
$("#form :input").prop("disabled", false);
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 (
128417,
128426,
128427,
128458,
128473,
128494,
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
SELECT
DCB,
Count(*)
FROM
Document d
INNER JOIN DocumentOrigin o ON o.id_documento = d.id_documento
GROUP BY DCB
HAVING Count(*) > 1;
<?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'
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