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
| update lancamentocontabil | |
| set datacadastro = lancamentocontabil.datalancamento, | |
| datalancamento = lcto.datamovimentacao::date | |
| from lancamentocontabil t1 | |
| join lancamentocontabil_lote lcto on lcto.id = t1.id | |
| where t1.datalancamento::date <> lcto.datamovimentacao::date | |
| and t1.empresa_id = 225 | |
| and lancamentocontabil.id = t1.id; |
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
| with q as ( | |
| select sum(case tipo | |
| when 'D' then valor | |
| else 0 | |
| end) debito, | |
| sum(case tipo | |
| when 'C' then valor | |
| else 0 | |
| end) credito, | |
| sum(valor) valor, |
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
| update lancamentocontabil | |
| set datacadastro = l1.datalancamento, | |
| datalancamento = l2.datamovimentacao | |
| from lancamentocontabil l1 | |
| join lancamentocontabil_lote l2 on l2.id = l1.id | |
| where lancamentocontabil.id = l1.id | |
| and l1.empresa_id = 225 | |
| and l1.datacadastro is null |
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
| INSERT INTO MovimentacaoContabil (id, avulsa, datamovimentacao, filial, lote, valor, dataalteracao, datacadastro, usuarioalteracao_id, usuariocadastro_id, empresa_id) | |
| SELECT * FROM dblink ('hostaddr=192.168.0.10 dbname=grubermaicon user=postgres password=admin', | |
| 'with q as( | |
| select * | |
| from notafiscal | |
| where datacriacao::date = ''2014-03-22''::date | |
| and empresa_id = 1476 | |
| and numero not in (883922,902052,1175,10185) | |
| ) |
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 pg_terminate_backend(pg_stat_activity.procpid) | |
| FROM pg_stat_activity | |
| WHERE pg_stat_activity.datname = 'gruberdev' | |
| AND procpid <> pg_backend_pid(); |
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
| with x as ( | |
| select lancamentocontabil_lote.id id_lcto, | |
| get_planoconta_id(cta.id, ativo.empresa_id) conta_empresa_ativo | |
| from ativopermanente ativo | |
| join lancamentocontabil_lote on lancamentocontabil_lote.mov_id = ativo.injecaocreditoicms_id | |
| join planoconta cta on cta.id = lancamentocontabil_lote.conta_id) | |
| update lancamentocontabil lcto | |
| set conta_id = x.conta_empresa_ativo | |
| from x | |
| where lcto.id = x.id_lcto; |
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
| /* | |
| * ==================================================================== | |
| * Licensed to the Apache Software Foundation (ASF) under one | |
| * or more contributor license agreements. See the NOTICE file | |
| * distributed with this work for additional information | |
| * regarding copyright ownership. The ASF licenses this file | |
| * to you under the Apache License, Version 2.0 (the | |
| * "License"); you may not use this file except in compliance | |
| * with the License. You may obtain a copy of the License at | |
| * |
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
| sudo ip addr add 192.168.0.183/24 dev eth0 #Configura o ip | |
| ip route add default via 192.168.0.106 #Configura o proxy | |
| sudo ip link set dev eth0 up #Sobe a interface | |
| # Verificar o arquivo /etc/resolv.conf, deve conter as seguintes linhas | |
| nameserver 8.8.8.8 | |
| nameserver 8.8.4.4 | |
| #Subir o postgres | |
| su - postgres #Loga como superuser postgres |
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
| #!/bin/bash | |
| # Por precaucao, nao deixa apagar a base gruber | |
| if ["$2" == ""]; then | |
| oldbase="gruber" | |
| newbase="$1" | |
| elif ["$2" == "gruber"]; then | |
| exit 2 | |
| else | |
| oldbase="$1" |
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
| #!/bin/bash | |
| oldbase="gruber" | |
| newbase="gruberteste" | |
| nomearquivo="$oldbase-$(date +%d%m%Y-%H%M%S).sql" | |
| outputfile="/home/gts/sql-base-fiscal/$nomearquivo" | |
| httpserver="/var/www/" | |
| db_user="admin" | |
| echo "===========================================" |