Example #1
0
        public BlocoTransportador(DanfeViewModel viewModel, Estilo campoEstilo) : base(viewModel, campoEstilo)
        {
            var transportadora = viewModel.Transportadora;

            AdicionarLinhaCampos()
            .ComCampo(Strings.RazaoSocial, transportadora.RazaoSocial)
            .ComCampo("Frete", transportadora.ModalidadeFreteString, AlinhamentoHorizontal.Centro)
            .ComCampo("Código ANTT", transportadora.CodigoAntt, AlinhamentoHorizontal.Centro)
            .ComCampo("Placa do Veículo", transportadora.Placa, AlinhamentoHorizontal.Centro)
            .ComCampo(Strings.UF, transportadora.VeiculoUf, AlinhamentoHorizontal.Centro)
            .ComCampo(Strings.CnpjCpf, Formatador.FormatarCnpj(transportadora.CnpjCpf), AlinhamentoHorizontal.Centro)
            .ComLarguras(0, LarguraFrete, LarguraCampoCodigoAntt, LarguraCampoPlacaVeiculo, LarguraCampoUf, LarguraCampoCnpj);

            AdicionarLinhaCampos()
            .ComCampo(Strings.Endereco, transportadora.EnderecoLogadrouro)
            .ComCampo(Strings.Municipio, transportadora.Municipio)
            .ComCampo(Strings.UF, transportadora.EnderecoUf, AlinhamentoHorizontal.Centro)
            .ComCampo(Strings.InscricaoEstadual, transportadora.Ie, AlinhamentoHorizontal.Centro)
            .ComLarguras(0, LarguraCampoPlacaVeiculo + LarguraCampoCodigoAntt, LarguraCampoUf, LarguraCampoCnpj);

            var l = (float)(LarguraCampoCodigoAntt + LarguraCampoPlacaVeiculo + LarguraCampoUf + LarguraCampoCnpj) / 3F;

            AdicionarLinhaCampos()
            .ComCampoNumerico(Strings.Quantidade, transportadora.QuantidadeVolumes, 3)
            .ComCampo("Espécie", transportadora.Especie)
            .ComCampo("Marca", transportadora.Marca)
            .ComCampo("Numeração", transportadora.Numeracao)
            .ComCampoNumerico("Peso Bruto", transportadora.PesoBruto, 3)
            .ComCampoNumerico("Peso Líquido", transportadora.PesoLiquido, 3)
            .ComLarguras(20F / 200F * 100, 0, 0, l, l, l);
        }
Example #2
0
        public BlocoDestinatarioRemetente(DanfeViewModel viewModel, Estilo estilo) : base(viewModel, estilo)
        {
            var destinatario = viewModel.Destinatario;

            AdicionarLinhaCampos()
            .ComCampo(Strings.RazaoSocial, destinatario.RazaoSocial)
            .ComCampo(Strings.CnpjCpf, Formatador.FormatarCpfCnpj(destinatario.CnpjCpf), AlinhamentoHorizontal.Centro)
            .ComCampo("Data de Emissão", viewModel.DataHoraEmissao.Formatar(), AlinhamentoHorizontal.Centro)
            .ComLarguras(0, 45F / 200F * 100, 30F / 200F * 100);

            AdicionarLinhaCampos()
            .ComCampo(Strings.Endereco, destinatario.EnderecoLinha1)
            .ComCampo("Bairro / Distrito", destinatario.EnderecoBairro)
            .ComCampo("Cep", Formatador.FormatarCEP(destinatario.EnderecoCep), AlinhamentoHorizontal.Centro)
            .ComCampo("Data Entrada / Saída", ViewModel.DataSaidaEntrada.Formatar(), AlinhamentoHorizontal.Centro)
            .ComLarguras(0, 45F / 200 * 100F, 25F / 200F * 100, 30F / 200F * 100);

            AdicionarLinhaCampos()
            .ComCampo(Strings.Municipio, destinatario.Municipio)
            .ComCampo("Fone / Fax", Formatador.FormatarTelefone(destinatario.Telefone), AlinhamentoHorizontal.Centro)
            .ComCampo(Strings.UF, destinatario.EnderecoUf, AlinhamentoHorizontal.Centro)
            .ComCampo(Strings.InscricaoEstadual, destinatario.Ie, AlinhamentoHorizontal.Centro)
            .ComCampo("Hora Entrada / Saída", ViewModel.HoraSaidaEntrada.Formatar(), AlinhamentoHorizontal.Centro)
            .ComLarguras(0, 35F / 200F * 100, 7F / 200F * 100, 40F / 200F * 100, 30F / 200F * 100);
        }
Example #3
0
 public override string ToString()
 {
     if (TipoNFReferenciada == TipoNFReferenciada.refCTe || TipoNFReferenciada == TipoNFReferenciada.refNFe)
     {
         string chaveAcesso = Item.ToString();
         return($"{Utils.TipoDFeDeChaveAcesso(chaveAcesso)} Ref.: {Formatador.FormatarChaveAcesso(Item.ToString())}");
     }
     else
     {
         return(Item.ToString());
     }
 }
        public BlocoIdentificacaoEmitenteNFC(DanfeViewModel viewModel, Estilo estilo, PrimitiveComposer primitiveComposer) : base(viewModel, estilo)
        {
            primitiveComposer.BeginLocalState();
            primitiveComposer.SetFont(estilo.FonteCampoTituloNegrito.FonteInterna, estilo.FonteCampoTituloNegrito.Tamanho);
            int y = 0;

            var emitente = viewModel.Emitente;

            if (emitente.RazaoSocial.Length > 39)
            {
                primitiveComposer.ShowText(emitente.RazaoSocial.Substring(0, 39), new PointF(140, 10), XAlignmentEnum.Center, YAlignmentEnum.Top, 0);
                primitiveComposer.ShowText(emitente.RazaoSocial.Substring(39), new PointF(140, 20), XAlignmentEnum.Center, YAlignmentEnum.Top, 0);

                primitiveComposer.ShowText($"CNPJ - {Formatador.FormatarCnpj(emitente.CnpjCpf)}", new PointF(140, 30), XAlignmentEnum.Center, YAlignmentEnum.Top, 0);

                y = 30;
            }
            else
            {
                primitiveComposer.ShowText(emitente.RazaoSocial, new PointF(140, 10), XAlignmentEnum.Center, YAlignmentEnum.Top, 0);
                primitiveComposer.ShowText($"CNPJ - {Formatador.FormatarCnpj(emitente.CnpjCpf)}", new PointF(140, 20), XAlignmentEnum.Center, YAlignmentEnum.Top, 0);

                y = 20;
            }

            primitiveComposer.SetFont(estilo.FonteCampoConteudoNegrito.FonteInterna, estilo.FonteCampoConteudoNegrito.Tamanho);

            if (!string.IsNullOrWhiteSpace(emitente.EnderecoLogadrouro) &&
                !string.IsNullOrWhiteSpace(emitente.EnderecoNumero) &&
                !string.IsNullOrWhiteSpace(emitente.EnderecoBairro) &&
                !string.IsNullOrWhiteSpace(emitente.Municipio))
            {
                if (emitente.EnderecoLogadrouro.Length >= 25)
                {
                    primitiveComposer.ShowText($"{emitente.EnderecoLogadrouro.Substring(0, 25)}, {emitente.EnderecoNumero} - {emitente.EnderecoBairro} - {emitente.Municipio} - {emitente.EnderecoUf}",
                                               new PointF(140, y + 10), XAlignmentEnum.Center, YAlignmentEnum.Top, 0);
                }
                else
                {
                    primitiveComposer.ShowText($"{emitente.EnderecoLogadrouro}, {emitente.EnderecoNumero} - {emitente.EnderecoBairro} - {emitente.Municipio} - {emitente.EnderecoUf}",
                                               new PointF(140, y + 10), XAlignmentEnum.Center, YAlignmentEnum.Top, 0);
                }
            }
            primitiveComposer.DrawLine(new PointF(15, y + 20), new PointF(265, y + 20));
            primitiveComposer.SetLineDash(new org.pdfclown.documents.contents.LineDash(new double[] { 3, 2 }));
            primitiveComposer.Stroke();
            primitiveComposer.End();

            Y_NFC = y + 20;
        }
        public BlocoIdentificacaoEmitente(DanfeViewModel viewModel, Estilo estilo) : base(viewModel, estilo)
        {
            var textoConsulta = new TextoSimples(Estilo, Strings.TextoConsulta)
            {
                Height = 8,
                AlinhamentoHorizontal = AlinhamentoHorizontal.Centro,
                AlinhamentoVertical   = AlinhamentoVertical.Centro,
                TamanhoFonte          = 9
            };

            var campoChaveAcesso = new Campo("Chave de Acesso", Formatador.FormatarChaveAcesso(ViewModel.ChaveAcesso), estilo, AlinhamentoHorizontal.Centro)
            {
                Height = Constantes.CampoAltura
            };
            var codigoBarras = new Barcode128C(viewModel.ChaveAcesso, Estilo)
            {
                Height = AlturaLinha1 - textoConsulta.Height - campoChaveAcesso.Height
            };

            var coluna3 = new VerticalStack();

            coluna3.Add(codigoBarras, campoChaveAcesso, textoConsulta);

            ifdNfe     = new NumeroNfSerie2(estilo, ViewModel);
            idEmitente = new IdentificacaoEmitente(Estilo, ViewModel);

            FlexibleLine fl = new FlexibleLine()
            {
                Height = coluna3.Height
            }
            .ComElemento(idEmitente)
            .ComElemento(ifdNfe)
            .ComElemento(coluna3)
            .ComLarguras(0, 15, 46.5F);

            MainVerticalStack.Add(fl);

            AdicionarLinhaCampos()
            .ComCampo("Natureza da operação", ViewModel.NaturezaOperacao)
            .ComCampo("Protocolo de autorização", ViewModel.ProtocoloAutorizacao, AlinhamentoHorizontal.Centro)
            .ComLarguras(0, 46.5F);

            AdicionarLinhaCampos()
            .ComCampo("Inscrição Estadual", ViewModel.Emitente.Ie, AlinhamentoHorizontal.Centro)
            .ComCampo("Inscrição Estadual do Subst. Tributário", ViewModel.Emitente.IeSt, AlinhamentoHorizontal.Centro)
            .ComCampo("Cnpj", Formatador.FormatarCnpj(ViewModel.Emitente.CnpjCpf), AlinhamentoHorizontal.Centro)
            .ComLargurasIguais();
        }
Example #6
0
        public static string MontaTextoTabela(ref int semMudanca, DadosBCB dadosBCB, DadosBCB dadoRecuperadosBCB)
        {
            string texto = string.Empty;
            List <LinhaDadosBCB> listaMudancas = new List <LinhaDadosBCB>();

            listaMudancas = dadoRecuperadosBCB != null?dadoRecuperadosBCB.RetonaListaDiferentes(dadosBCB) : dadosBCB.Linhas.ToList();

            foreach (LinhaDadosBCB linhaMudada in listaMudancas)
            {
                texto += "<tr>" + Formatador.PrintaLinha(linhaMudada) + "</tr>";
            }

            if ((listaMudancas.Count() > 0))
            {
                semMudanca++;
            }

            return(texto);
        }
Example #7
0
        public static StringBuilder MontaTexoNormas()
        {
            int                l          = 0;
            Crawler            crawler    = new Crawler();
            BinaryFormatter    binario    = new BinaryFormatter();
            HtmlNodeCollection noNormas   = crawler.RetornaNodeNormas(out string url);
            StringBuilder      textoFinal = new StringBuilder(string.Format(ConstStringHtml.tituloEUrl, "Normas", url));

            while (noNormas == null)
            {
                noNormas = crawler.RetornaNodeNormas(out url);
                if (l == 5)
                {
                    break;
                }
                l++;
            }

            string[] linhasHtml = noNormas.Select(ol => ol
                                                  .Elements("li")
                                                  .Select(li => li.InnerText.Trim())
                                                  .ToArray()).First();

            foreach (string texto in linhasHtml)
            {
                string textoNorma = texto.Replace(".", ". ");

                string comunicado  = Formatador.RetornaTextoIntervalo(ConstNormas.camposNorma[0], ConstNormas.camposNorma[1], textoNorma);
                string dataHora    = Formatador.RetornaTextoIntervalo(ConstNormas.camposNorma[1], ConstNormas.camposNorma[2], textoNorma);
                string assunto     = Formatador.RetornaTextoIntervalo(ConstNormas.camposNorma[2], ConstNormas.camposNorma[3], textoNorma);
                string responsavel = Formatador.RetornaTextoIntervalo(ConstNormas.camposNorma[3], textoNorma);

                Norma norma = new Norma(comunicado, dataHora, assunto, responsavel);

                textoFinal.Append(norma.MontaTexto());
            }

            return(textoFinal);
        }
        public BlocoLocalEntregaRetirada(DanfeViewModel viewModel, Estilo estilo, LocalEntregaRetiradaViewModel localModel) : base(viewModel, estilo)
        {
            Model = localModel ?? throw new ArgumentNullException(nameof(localModel));

            AdicionarLinhaCampos()
            .ComCampo(Strings.NomeRazaoSocial, Model.NomeRazaoSocial)
            .ComCampo(Strings.CnpjCpf, Formatador.FormatarCpfCnpj(Model.CnpjCpf), AlinhamentoHorizontal.Centro)
            .ComCampo(Strings.InscricaoEstadual, Model.InscricaoEstadual, AlinhamentoHorizontal.Centro)
            .ComLarguras(0, 45F * Proporcao, 30F * Proporcao);

            AdicionarLinhaCampos()
            .ComCampo(Strings.Endereco, Model.Endereco)
            .ComCampo(Strings.BairroDistrito, Model.Bairro)
            .ComCampo(Strings.Cep, Formatador.FormatarCEP(Model.Cep), AlinhamentoHorizontal.Centro)
            .ComLarguras(0, 45F * Proporcao, 30F * Proporcao);

            AdicionarLinhaCampos()
            .ComCampo(Strings.Municipio, Model.Municipio)
            .ComCampo(Strings.UF, Model.Uf, AlinhamentoHorizontal.Centro)
            .ComCampo(Strings.FoneFax, Formatador.FormatarTelefone(Model.Telefone), AlinhamentoHorizontal.Centro)
            .ComLarguras(0, 7F * Proporcao, 30F * Proporcao);
        }
Example #9
0
        public void atualizarListV()
        {
            this.listView1.Items.Clear();
            List <PetTratamento> listaDeTratamentos = new List <PetTratamento>();
            DAOPetTratamento     petTratamento      = new DAOPetTratamento();

            listaDeTratamentos = petTratamento.getListTratamentos();
            Formatador f = new Formatador();

            for (int i = 0; i < listaDeTratamentos.Count; i++)
            {
                ListViewItem item       = new ListViewItem();
                Pet          pet        = new Pet();
                Tratamento   tratamento = new Tratamento();
                Cliente      cliente    = new Cliente();
                pet        = new DAOPet().localizar(listaDeTratamentos[i].IdPet);
                tratamento = new DAOTratamento().localizar(listaDeTratamentos[i].IdTratamento);
                cliente    = new DAOCliente().localizar(pet.Dono);

                String  data   = listaDeTratamentos[i].DataHora;
                Boolean estado = listaDeTratamentos[i].Estado;

                if (estado == true)
                {
                    item.Text = pet.Nome;
                    item.SubItems.Add(pet.RGA);
                    item.SubItems.Add(cliente.Nome);
                    item.SubItems.Add(cliente.Telefone);
                    item.SubItems.Add(tratamento.Nome);
                    item.SubItems.Add(tratamento.Preco);
                    item.SubItems.Add(listaDeTratamentos[i].DataHora);
                    item.SubItems.Add(f.calcularTermino(listaDeTratamentos[i].DataHora, tratamento.DuracaoMedia));
                    item.SubItems.Add("Em Andamento");

                    this.listView1.Items.Add(item);
                }
            }
        }
Example #10
0
        private void ListadePets_Load(object sender, EventArgs e)
        {
            List <PetTratamento> listaDeTratamentos = new List <PetTratamento>();
            DAOPetTratamento     petTratamento      = new DAOPetTratamento();

            listaDeTratamentos = petTratamento.getListTratamentos();
            Formatador f = new Formatador();

            for (int i = 0; i < listaDeTratamentos.Count; i++)
            {
                ListViewItem item       = new ListViewItem();
                Pet          pet        = new Pet();
                Tratamento   tratamento = new Tratamento();
                Cliente      cliente    = new Cliente();
                pet        = new DAOPet().localizar(listaDeTratamentos[i].IdPet);
                tratamento = new DAOTratamento().localizar(listaDeTratamentos[i].IdTratamento);
                cliente    = new DAOCliente().localizar(pet.Dono);

                String  data   = listaDeTratamentos[i].DataHora;
                Boolean estado = listaDeTratamentos[i].Estado;

                if (estado == false)
                {
                    item.Text = pet.Nome;
                    item.SubItems.Add(pet.RGA);
                    item.SubItems.Add(cliente.Nome);
                    item.SubItems.Add(cliente.Telefone);
                    item.SubItems.Add(tratamento.Nome);
                    item.SubItems.Add(listaDeTratamentos[i].DataHora);
                    item.SubItems.Add(f.calcularTermino(listaDeTratamentos[i].DataHora, tratamento.DuracaoMedia));
                    item.SubItems.Add("Finalizado");

                    this.listView2.Items.Add(item);
                }
            }
        }
Example #11
0
 public string MontaTexto()
 {
     return(Formatador.PrintaNormas(this));
 }
Example #12
0
 public override string ToString()
 {
     return($"NF Ref.: Série: {serie} Número: {nNF} Emitente: {Formatador.FormatarCnpj(CNPJ)} Modelo: {mod}");
 }
Example #13
0
        public override string ToString()
        {
            String cpfCnpj = !String.IsNullOrWhiteSpace(CNPJ) ? CNPJ : CPF;

            return($"NFP Ref.: Série: {serie} Número: {nNF} Emitente: {Formatador.FormatarCpfCnpj(cpfCnpj)} Modelo: {mod} IE: {IE}");
        }
 public void ListaContemClienteCerto() => page.Clientes.Single().Should().BeEquivalentTo(new ClienteCadastrado
 {
     Nome      = c.Nome,
     CPF       = Formatador.CPF(c.CPF),
     Sobrenome = c.Sobrenome
 });
Example #15
0
        public static bool MontaTextoESalvaArquivo(IRelatorio relatorio, ref string textoTabelas)
        {
            int             i           = 0;
            int             somaMudadas = 0;
            BinaryFormatter binario     = new BinaryFormatter();

            textoTabelas += string.Format(ConstStringHtml.tituloEUrl, relatorio.Nome, relatorio.Url);

            foreach (HtmlNodeCollection noTabela in Crawler.RetornaNodeHTML(relatorio))
            {
                int mudadas = 0;

                string textoTabela = string.Format(ConstStringHtml.tituloTabela, relatorio.NomeTabelas[i]);

                //Não mova esse i++ de lugar!!
                i++;

                if (noTabela == null)
                {
                    textoTabela += Formatador.PrintaLinha(new LinhaDadosBCB("Erro na leitura do nó", "Verifique o serviço", "Tabela " + i.ToString()));
                    somaMudadas++;
                    continue;
                }

                relatorio.Html = noTabela;

                string nomeArquivo = string.Format(ConstStringHtml.nomeBin, relatorio.Nome, i);

                DadosBCB dadosBCB = new DadosBCB(relatorio);

                if (!File.Exists(nomeArquivo))
                {
                    Stream tmp = File.Create(nomeArquivo);
                    tmp.Close();
                }

                using (Stream stream = File.OpenRead(nomeArquivo))
                {
                    DadosBCB dadoRecuperadosBCB = null;

                    if (!(stream.Length == 0))
                    {
                        dadoRecuperadosBCB = (DadosBCB)binario.Deserialize(stream);
                    }

                    textoTabela += ConstStringHtml.abreTabela + ConstStringHtml.abreTR;

                    textoTabela += Formatador.PrintaCabecalho(relatorio.Cabecalho);

                    textoTabela += "</tr>";
                    textoTabela += MontaTextoTabela(ref mudadas, dadosBCB, dadoRecuperadosBCB);
                    textoTabela += "</table>";
                }

                using (Stream stream = File.OpenWrite(nomeArquivo))
                {
                    binario.Serialize(stream, dadosBCB);
                }

                somaMudadas += mudadas;
                if (mudadas == 0)
                {
                    textoTabela = string.Empty;

                    if (i == relatorio.NumeroTabelas && somaMudadas == 0)
                    {
                        textoTabela = string.Format(ConstStringHtml.nenuhmaAlteracao, relatorio.Nome);
                    }
                }

                textoTabelas += textoTabela;
            }

            return(!(somaMudadas == 0));
        }
Example #16
0
        private static string MontaTabelasESalvaArquivos(IRelatorio relatorio, StringBuilder textoTabelas, BinaryFormatter binario)
        {
            int     i           = 0;
            int     somaMudadas = 0;
            Crawler crawler     = new Crawler();

            foreach (HtmlNodeCollection noTabela in crawler.RetornaNodeRelatorio(relatorio))
            {
                int mudadas = 0;

                StringBuilder textoTabela = new StringBuilder(string.Format(ConstStringHtml.tituloTabela, relatorio.NomeTabelas[i]));

                //Não mova esse i++ de lugar!!
                i++;

                if (noTabela == null)
                {
                    return(string.Empty);
                }

                relatorio.Html = noTabela;

                string nomeArquivo = string.Format(ConstStringHtml.nomeBinTabelas, relatorio.Nome, i);

                DadosBCB dadosBCB = new DadosBCB(relatorio);

                if (!File.Exists(nomeArquivo))
                {
                    Stream tmp = File.Create(nomeArquivo);
                    tmp.Close();
                }

                using (Stream stream = File.OpenRead(nomeArquivo))
                {
                    DadosBCB dadoRecuperadosBCB = null;

                    if (!(stream.Length == 0))
                    {
                        dadoRecuperadosBCB = (DadosBCB)binario.Deserialize(stream);
                    }

                    textoTabela.Append(ConstStringHtml.abreTabela + ConstStringHtml.abreTR);

                    textoTabela.Append(Formatador.PrintaCabecalho(relatorio.Cabecalho) + "</tr>");

                    textoTabela.Append(Formatador.RetornaTextoTabela(ref mudadas, dadosBCB, dadoRecuperadosBCB) + "</table>");
                }

                using (Stream stream = File.OpenWrite(nomeArquivo))
                {
                    binario.Serialize(stream, dadosBCB);
                }

                somaMudadas += mudadas;
                if (mudadas == 0)
                {
                    textoTabela.Clear();

                    if (i == relatorio.NumeroTabelas && somaMudadas == 0)
                    {
                        textoTabela.Append(string.Format(ConstStringHtml.nenuhmaAlteracao, relatorio.Nome));
                    }
                }

                textoTabelas.Append(textoTabela);
            }

            return(textoTabelas.ToString());
        }
Example #17
0
 public DAOPet()
 {
     this.con      = new Conexao().Con;
     this.formatar = new Formatador();
 }
 public void ListaContemFabricanteCerto() => page.Fabricante.Single().Should().BeEquivalentTo(new FabricanteCadastrado
 {
     Nome     = f.Nome,
     CNPJ     = Formatador.CNPJ(f.CNPJ),
     Endereco = f.Endereco
 });