Ao atualizar para a versão 1.10.6 o sistema faz um calculo de acréscimos e descontos incorretos, onde todas as notas assumem o valor de desconto conforme o que estiver no acréscimo.

Para correção do problema pode ser feito um recalculo de descontos e acréscimos.

Baixe o tutorial completo em Corrige Desconto e Acréscimo.rar

- Abra o IBExpert
- Vá até o F12 e desative duas triggers, uma de cada vez:

ALTER TRIGGER a02anfsv_au2 INACTIVE
ALTER TRIGGER A02ANFSV_BUL INACTIVE

- Dê um commit
- Rode a seguinte sql:

2 - Recalcula Acréscimos e Descontos.sql

 execute block
  as
  declare variable EMP integer;
  declare variable SEQ integer;
  declare variable TOTAL_ITENS numeric(15,2);
  begin
    FOR
      select nvemp, nvnfseq, Sum(nvtotal)
      from a02anfsv
      where (nvdesc > 0) and (nvacre = nvdesc) 
      group by 1, 2
    INTO :EMP, :SEQ, :TOTAL_ITENS
    DO
    BEGIN
      update a02anfsv set nvdesc = 0 where nvemp = :EMP and nvnfseq = :SEQ;

      update a02anfcl set nftotdesc = 0,  nfsubtotal = :TOTAL_ITENS, nftotal = (nfsubtotal - nftotdesc + nftotacre)
      where nfemp = :EMP and nfseq = :SEQ;
    END
  end

- Dê um Commit.
- Ative as triggers novamente

ALTER TRIGGER a02anfsv_au2 ACTIVE
ALTER TRIGGER A02ANFSV_BUL ACTIVE

- Dê um commit

Verifique as notas com acréscimo e desconto, o erro deve ter corrigido.

Se o erro persistir, contate um facilitador.

Tags: Erro de desconto que assume o mesmo valor de acréscimo, acréscimo na versão 1.10.6, erro de acréscimo, erro de desconto.
Veja o tutorial em Vídeo: 




Ao gerar uma nota de saída o sistema faz o calculo total das mercadorias diferente do total da nota


Na emissão da nota o sistema também leva o total das mercadorias, onde o mesmo deveria levar o total da nota.

Para correção do erro, baixe a Correção de Arredondamento de Centavos.rar e faça os passos a seguir:
- Extraia as 4 sqls que estão no arquivo
- Vá até o IBExpert e no CTRL+F12 rode as mesmas na sequência


01_SPI_TRUNC_2.sql

SET TERM ^ ;

CREATE OR ALTER procedure SPI_TRUNC_2 (
    VALOR numeric(15,5))
returns (
    RESULT numeric(15,2))
as
declare variable INTEIRO integer;
declare variable FRAC numeric(15,5);
declare variable STR varchar(20);
declare variable pos integer;
begin

  str = cast(valor as varchar(20));
  pos = position('.' in str);
  if (pos = 0) then
    pos = position(',' in str);

  if (pos = 0) then
  begin
    result = cast(valor as numeric(15,2));
    suspend;
  end
  else
  begin
    str = substring(str from 1 for pos - 1);
    inteiro = cast(str as integer);
    --inteiro = cast(valor as integer);
    frac = valor - inteiro;
    str = cast(frac as varchar(20));
    str = substring(str from 1 for 4);
    frac = cast(str as numeric(15,2));

    result = inteiro + frac;
    suspend;
  end
end^

SET TERM ; ^

02_A02ANFSV_BI1.sql

SET TERM ^ ;

CREATE OR ALTER trigger a02anfsv_bi1 for a02anfsv
active before insert position 1
AS
   declare variable codcfo integer;
   declare variable xser varchar(3);
   declare variable parencerrante char(1);
BEGIN
  if (current_user <> 'REPLICATOR') then
  BEGIN
    IF ((NEW.nvtotal IS NULL) OR (NEW.nvtotal = 0)) THEN
      NEW.nvtotal = NEW.nvqtd * NEW.nvunit;
    IF (NEW.nvitem IS NULL) THEN
      NEW.nvitem = 0;
    IF (NEW.nvitem = 0) THEN
    BEGIN
      SELECT MAX(nvitem)+1 FROM a02anfsv
          WHERE nvemp = NEW.nvemp AND nvnfseq = NEW.nvnfseq
            INTO NEW.nvitem;
      IF (NEW.nvitem IS NULL) THEN
        NEW.nvitem = 1;
    END
    SELECT a02amerc.menome, a02apre.mepven
           FROM a02amerc
           LEFT JOIN a02apre ON a02apre.mecod = a02amerc.mecod
            WHERE a02amerc.mecod = NEW.nvcodm AND a02apre.meemp = NEW.nvemp
            INTO NEW.nvnmerc, NEW.nvprctab;
    select nfoper, nfser from a02anfcl where
      nfemp = new.nvemp and nfseq = new.nvnfseq
      into :codcfo, :xser;
    if (:xser = 'CX') then
    begin
      select parencerrante from sisapar where parcod = new.nvemp into :parencerrante;
      if (:parencerrante = 'R') then
            exception ex_naopermitido;
    end
    if (new.nvcfo is null) then
      new.nvcfo = :codcfo;

    select result from spi_trunc_2(new.nvtotal) into new.nvtotal;
    --new.nvtotal = cast(new.nvtotal * 100 as numeric(15,2)) / 100;
  END
END^

SET TERM ; ^

03_A02ANFSV_BU0.sql

SET TERM ^ ;

CREATE OR ALTER trigger a02anfsv_bu0 for a02anfsv
active before update position 0
as
begin
  new.NVDTALTERACAO = cast('NOW' as date);
  if (new.NVACRE is null) then
    new.NVACRE = 0;
  if (new.NVDESC is null) then
    new.NVDESC = 0;
  if (new.NVSIT is null) then
    new.NVSIT = 'A';
  if ((new.NVTOTAL is null) or (new.NVTOTAL = 0)) then
    new.NVTOTAL = new.NVQTD * new.NVUNIT;
  if ((old.NVCODM <> new.NVCODM) or (new.nvnmerc is null))  then
  begin
    select A02AMERC.MENOME, A02APRE.MEPVEN
    from A02AMERC
    left join A02APRE on A02APRE.MECOD = A02AMERC.MECOD
    where A02AMERC.MECOD = new.NVCODM and
          A02APRE.MEEMP = new.NVEMP
    into new.NVNMERC, new.NVPRCTAB;
  end
  if ((NEW.nvencerrante IS NULL) AND (NEW.nvabaseq IS NOT NULL)) then
  BEGIN
     SELECT ABAENCERRANTE FROM A02AABA
     WHERE ABAEMP = NEW.nvemp AND ABASEQ = NEW.nvabaseq
     INTO NEW.nvencerrante;
  END
  select result from spi_trunc_2(new.nvtotal) into new.nvtotal;
--  new.nvtotal = cast(new.nvtotal * 100 as numeric(15,2)) / 100;
END^

SET TERM ; ^

RODAR NO F12:
04_Corrigir Erro Arredondamento.sql

update a02anfsv a set
  nvtotal = (select result from spi_trunc_2(nvqtd * nvunit))
where a.nvemp = :Empresa
  and a.nvnfseq in (select nf.nfseq from a02anfcl nf
                    where cast(nf.nfemis as date) between :DataIni and :DataFim
                      and nf.nfemp = :Empresa)

Ao executar as sql gere a nota novamente

Se o erro persistir, contate um facilitador.

Tags: Correção de arredondamento de centavos em notas , arredeondamente de notas, arredondamento de centavos, diferença de centavos na nota, nota com diferença de centavos, total da mercadoria difere do total da nota, total da mercadoria diferente do total da nota, total da nota difere do total da mercadoria, total da nota diferente do total da mercadoria
Veja o tutorial em Vídeo:



Erro ao validar sped contribuições 
Registro 0140:













Para ajuste deste erro, vá até a pasta C:\ARQUIVOS DE PROGRAMAS\SOFTPLUS\SPISPED\SPED_EPC

procure a "SPED_EPC_0140.sql", abra a mesma com bloco de notas e altere para a seguinte sql:


select distinct '0140' reg,
  e.emcod cod_emp,
  e.emcod cod_est,
  e.emnome nome,
  e.emcgc cnpj,
  e.emuf uf,
  case trim(e.emins) when 'ISENTO' then '' else trim(e.emins) end ie,
  e.emcodmun cod_mun,
  e.eminscmun im,
  cast('' as varchar(9)) suframa
from sisaemp e
left join sped_epc_all_b(e.emcod, :dataini, :datafim) a on e.emcgc like (substr((select emcgc from sisaemp where emcod = :cod_emp), 1,8) || '%')
where (e.emspedpc='S') and e.emcgc like (substr((select emcgc from sisaemp where emcod = :cod_emp), 1,8) || '%')

Salve a mesma, feche o sped.

Faça a geração e validação novamente.

Se o erro persistir, contate um facilitador.

Tags: 
Sped Contribuições Reg 0140, registro 0140 Reg0140, R0140 sped pis cofins 0140