Ir para conteúdo
  • Cadastre-se

dev botao

Erro de UF vazio e campos populados que vem zerado


  • Este tópico foi criado há 2716 dias atrás.
  • Talvez seja melhor você criar um NOVO TÓPICO do que postar uma resposta aqui.

Recommended Posts

Estou tendo 2 problemas no caso, o primeiro é que quando vou assinar a NFCe, recebo uma mensagem: "UF não pode ser vazio" , sendo que estou preenchendo o campo de UF(ou ao menos acho que estou):

       Ide.cUF       := UFtoCUF('MT');

       Emit.EnderEmit.xMun    := nfceConfig.ReadString('EMITENTE', 'CIDADE', '');

 

O outro problema é que fiz esse algoritmo para fazer a verificação de qual CRT está selecionado no sistema, porém ao assinar e gravar a NFCe, o CST nos produtos estão vindo zerados, reparem que tem um ShowMessage, ele mostra na tela o campo do componente alimentado, porém no XML não está.

 

Spoiler

with Imposto do
           begin
             // lei da transparencia nos impostos
             vTotTrib := RoundTo(CalculaIBPT(vNCM, (QrItens.FieldByName('Preco_Venda').AsFloat * QrItens.FieldByName('Quantidade').AsFloat)), -2);
             F := TIniFile.Create(ExtractFilePath(Application.ExeName) + '\NFCe.ini');

             sCSOSN:= F.ReadString('REGIME_TRIBUTARIO', 'COD_CSOSN','');
             if (sCSOSN = '') then
               sCSOSN := '0';

             iTipoRegime:= StrToInt(F.ReadString('REGIME_TRIBUTARIO', 'TIPO',''));
             sCST:= QrItens.FieldByName('ICMS_CST').AsString;

             if (ACBrNFe.NotasFiscais.Add.NFe.Emit.CRT = crtSimplesNacional) then
             begin
               with ICMS do                   
               begin
                 if (sCSOSN = '900') then
                   CSOSN:= csosn900
                 else if (sCSOSN = '500') then
                   CSOSN:= csosn500
                 else if (sCSOSN = '102') then
                   CSOSN:= csosn102
                 else if (sCSOSN = '101') then
                   CSOSN:= csosn101
                 else if (sCSOSN = '103') then
                   CSOSN:= csosn103
                 else if (sCSOSN = '201') then
                   CSOSN:= csosn201
                 else if (sCSOSN = '202') then
                   CSOSN:= csosn202
                 else if (sCSOSN = '203') then
                   CSOSN:= csosn203
                 else if (sCSOSN = '300') then
                   CSOSN:= csosn300
                 else if (sCSOSN = '400') then
                   CSOSN:= csosn400
                 else if (sCSOSN = '0') then
                   CSOSN:= csosnVazio
                 else
                   CSOSN:= csosn900;

                 if (sCST = '00') or (sCST = '000') then
                   CST:= cst00
                 else if (sCST = '10') or (sCST = '010') then
                   CST:= cst10
                 else if (sCST = '20') or
                 (sCST = '020') then
                   CST:= cst20
                 else if (sCST = '30') or
                 (sCST = '030') then
                   CST:= cst30
                 else if (sCST = '40') or
                 (sCST = '040') then
                   CST:= cst40
                 else if (sCST = '41') or
                 (sCST = '041') then
                   CST:= cst41
                 else if (sCST = '45') or
                 (sCST = '045') then
                   CST:= cst45
                 else if (sCST = '50') or
                 (sCST = '050') then
                   CST:= cst50
                 else if (sCST = '51') or
                 (sCST = '051') then
                   CST:= cst51
                 else if (sCST = '60') or
                 (sCST = '060') then
                   CST:= cst60
                 else if (sCST = '70') or
                 (sCST = '070') then
                   CST:= cst70
                 else if (sCST = '80') or
                 (sCST = '080') then
                   CST:= cst80
                 else if (sCST = '90') or
                 (sCST = '090') then
                   CST:= cst90
                 else
                   CST:= cst41;

                 ICMS.orig    := oeNacional;
                 ICMS.modBC   := dbiValorOperacao;
                 ICMS.vBC     := 0;
                 ICMS.pICMS   := 0;
                 ICMS.vICMS   := 0;
                 ICMS.modBCST := dbisMargemValorAgregado;
                 ICMS.pMVAST  := 0;
                 ICMS.pRedBCST:= 0;
                 ICMS.vBCST   := 0;
                 ICMS.pICMSST := 0;
                 ICMS.vICMSST := 0;
                 ICMS.pRedBC  := 0;
               end;
             end
             else if (ACBrNFe.NotasFiscais.Add.NFe.Emit.CRT = crtRegimeNormal) then
             begin
               with PIS do
               begin
                 if (sCST = '01') then
                   CST := pis01
                 else if (sCST = '02') then
                   CST := pis02
                 else if (sCST = '03') then
                   CST := pis03
                 else if (sCST = '04') then
                   CST := pis04
                 else if (sCST = '05') then
                   CST := pis05
                 else if (sCST = '06') then
                   CST := pis06
                 else if (sCST = '07') then
                   CST := pis07
                 else if (sCST = '08') then
                   CST := pis08
                 else if (sCST = '09') then
                   CST := pis09
                 else if (sCST = '49') then
                   CST := pis49
                 else if (sCST = '50') then
                   CST := pis50
                 else if (sCST = '51') then
                   CST := pis51
                 else if (sCST = '52') then
                   CST := pis52
                 else if (sCST = '53') then
                   CST := pis53
                 else if (sCST = '54') then
                   CST := pis54
                 else if (sCST = '55') then
                   CST := pis55
                 else if (sCST = '56') then
                   CST := pis56
                 else if (sCST = '60') then
                   CST := pis60
                 else if (sCST = '61') then
                   CST := pis61
                 else if (sCST = '62') then
                   CST := pis62
                 else if (sCST = '63') then
                   CST := pis63
                 else if (sCST = '64') then
                   CST := pis64
                 else if (sCST = '65') then
                   CST := pis65
                 else if (sCST = '66') then
                   CST := pis66
                 else if (sCST = '67') then
                   CST := pis67
                 else if (sCST = '70') then
                   CST := pis70
                 else if (sCST = '71') then
                   CST := pis71
                 else if (sCST = '72') then
                   CST := pis72
                 else if (sCST = '73') then
                   CST := pis73
                 else if (sCST = '74') then
                   CST := pis74
                 else if (sCST = '75') then
                   CST := pis75
                 else if (sCST = '98') then
                   CST := pis98
                 else
                   CST := pis99;

                 showmessage(CSTPISToStr(CST));

                 vBC  := 0;
                 pPIS := 0;
                 vPIS := 0;

                 qBCProd   := 0;
                 vAliqProd := 0;
                 vPIS      := 0;
               end;

               with COFINS do
               begin
                 if (sCST = '01') then
                   CST := cof01
                 else if (sCST = '02') then
                   CST := cof02
                 else if (sCST = '03') then
                   CST := cof03
                 else if (sCST = '04') then
                   CST := cof04
                 else if (sCST = '05') then
                   CST := cof05
                 else if (sCST = '06') then
                   CST := cof06
                 else if (sCST = '07') then
                   CST := cof07
                 else if (sCST = '08') then
                   CST := cof08
                 else if (sCST = '09') then
                   CST := cof09
                 else if (sCST = '49') then
                   CST := cof49
                 else if (sCST = '50') then
                   CST := cof50
                 else if (sCST = '51') then
                   CST := cof51
                 else if (sCST = '52') then
                   CST := cof52
                 else if (sCST = '53') then
                   CST := cof53
                 else if (sCST = '54') then
                   CST := cof54
                 else if (sCST = '55') then
                   CST := cof55
                 else if (sCST = '56') then
                   CST := cof56
                 else if (sCST = '60') then
                   CST := cof60
                 else if (sCST = '61') then
                   CST := cof61
                 else if (sCST = '62') then
                   CST := cof62
                 else if (sCST = '63') then
                   CST := cof63
                 else if (sCST = '64') then
                   CST := cof64
                 else if (sCST = '65') then
                   CST := cof65
                 else if (sCST = '66') then
                   CST := cof66
                 else if (sCST = '67') then
                   CST := cof67
                 else if (sCST = '70') then
                   CST := cof70
                 else if (sCST = '71') then
                   CST := cof71
                 else if (sCST = '72') then
                   CST := cof72
                 else if (sCST = '73') then
                   CST := cof73
                 else if (sCST = '74') then
                   CST := cof74
                 else if (sCST = '75') then
                   CST := cof75
                 else if (sCST = '98') then
                   CST := cof98
                 else
                   CST := cof99;

                 vBC     := 0;
                 pCOFINS := 0;
                 vCOFINS := 0;

                 qBCProd   := 0;
                 vAliqProd := 0;
             end;

 

 

 

OBS: os fontes do ACBR estão atualizados.

Desde já agradeço.

Link para o comentário
Compartilhar em outros sites

  • Moderadores

Anexe o XML em q o problema ocorre. Veja tbm os fontes do ACBrMonitor pra não precisar desse monte de IF para informar os CSTs.

djsystem-logo.png
 youtube.png facebook.png instagram.png linkedin.png
André Ferreira de Moraes | Analista de Sistemas
www.djsystem.com.br | www.djpdv.com.br
www.tefhouse.com.br | www.lambretinha.com.br
Link para o comentário
Compartilhar em outros sites

  • Moderadores

Aparentemente o XML está correto, falta apenas as informações do QrCode.

Qual a exata mensagem de erro? Poste um passo-a-passo de como simular o problema utilizando o demo do componente.

djsystem-logo.png
 youtube.png facebook.png instagram.png linkedin.png
André Ferreira de Moraes | Analista de Sistemas
www.djsystem.com.br | www.djpdv.com.br
www.tefhouse.com.br | www.lambretinha.com.br
Link para o comentário
Compartilhar em outros sites

no caso o CST era vindo como zero, sendo que o CST do produto é 50, estou fazendo os passos pelo emissor DEMO do acbr e postarei aqui, pois esse fiz no emissor do sistema em que trabalho, peguei já feito, porém com algumas coisas para fazer e ainda estou aprendendo sobre o componente

Link para o comentário
Compartilhar em outros sites

  • Moderadores
41 minutos atrás, lavaprato disse:

fui emitir pelo demo do acbr e me mostrou esse erro:

  Mostrar conteúdo oculto

 

 

Não veio oque gostaria de mostrar

Consultor SAC ACBr Juliomar Marchetti
 

Projeto ACBr

skype: juliomar
telegram: juliomar
e-mail: [email protected]
http://www.juliomarmarchetti.com.br
MVP_NewLogo_100x100_Black-02.png
 

 

Link para o comentário
Compartilhar em outros sites

  • Este tópico foi criado há 2716 dias atrás.
  • Talvez seja melhor você criar um NOVO TÓPICO do que postar uma resposta aqui.

Crie uma conta ou entre para comentar

Você precisar ser um membro para fazer um comentário

Criar uma conta

Crie uma nova conta em nossa comunidade. É fácil!

Crie uma nova conta

Entrar

Já tem uma conta? Faça o login.

Entrar Agora
×
×
  • Criar Novo...

Informação Importante

Colocamos cookies em seu dispositivo para ajudar a tornar este site melhor. Você pode ajustar suas configurações de cookies, caso contrário, assumiremos que você está bem para continuar.