Example #1
0
 public TextoSimples(Estilo estilo, string texto) : base(estilo)
 {
     Texto = texto;
     AlinhamentoHorizontal = AlinhamentoHorizontal.Esquerda;
     AlinhamentoVertical   = AlinhamentoVertical.Topo;
     TamanhoFonte          = 6;
 }
Example #2
0
 public Campo(string cabecalho, string conteudo, Estilo estilo, AlinhamentoHorizontal alinhamentoHorizontalConteudo = AlinhamentoHorizontal.Esquerda) : base(estilo)
 {
     Cabecalho = cabecalho;
     Conteudo  = conteudo;
     AlinhamentoHorizontalConteudo = alinhamentoHorizontalConteudo;
     IsConteudoNegrito             = true;
     Height = DanfeConstantes.CampoAltura;
 }
Example #3
0
        public Tabela(Estilo estilo) : base(estilo)
        {
            Colunas               = new List <TabelaColuna>();
            Linhas                = new List <List <string> >();
            LinhaAtual            = 0;
            TamanhoFonteCabecalho = 6;

            PaddingHorizontal = 0.6F;
            PaddingSuperior   = 0.75F;
            PaddingInferior   = 0.3F;

            // 7.7.7 Conteúdo dos Campos do Quadro “Dados dos Produtos/Serviços”
            // Deverá ter tamanho mínimo de seis(6) pontos, ou 17 CPP.

            FonteCorpo     = estilo.CriarFonteRegular(6F);
            FonteCabecalho = estilo.CriarFonteRegular(6F);
        }
Example #4
0
        public Barcode128C(string code, Estilo estilo, float largura = 75F) : base(estilo)
        {
            if (string.IsNullOrWhiteSpace(code))
            {
                throw new ArgumentException("O código não pode ser vazio.", "code");
            }

            if (!Regex.IsMatch(code, @"^\d+$"))
            {
                throw new ArgumentException("O código deve apenas conter digítos numéricos.", "code");
            }

            if (code.Length % 2 != 0)
            {
                Code = "0" + code;
            }
            else
            {
                Code = code;
            }

            Largura = largura;
        }
Example #5
0
        public override void Draw(Gfx gfx)
        {
            base.Draw(gfx);

            if (!string.IsNullOrWhiteSpace(Texto))
            {
                var r = BoundingBox.InflatedRetangle(0.75F);

                var tb = new TextBlock(Texto, Estilo.CriarFonteRegular(TamanhoFonte));
                tb.AlinhamentoHorizontal = AlinhamentoHorizontal;
                tb.Width = r.Width;

                var y = r.Y;

                if (AlinhamentoVertical == AlinhamentoVertical.Centro)
                {
                    y += (r.Height - tb.Height) / 2F;
                }

                tb.SetPosition(r.X, y);
                tb.Draw(gfx);
            }
        }
Example #6
0
        public override void Draw(Gfx gfx)
        {
            base.Draw(gfx);

            var r = BoundingBox.InflatedRetangle(1);

            var f1 = Estilo.CriarFonteNegrito(14);
            var f2 = Estilo.CriarFonteNegrito(11F);

            gfx.DrawString("NF-e", r, f1, AlinhamentoHorizontal.Centro);

            r = r.CutTop(f1.AlturaLinha);

            TextStack ts = new TextStack(r)
            {
                AlinhamentoHorizontal = AlinhamentoHorizontal.Centro,
                AlinhamentoVertical   = AlinhamentoVertical.Centro,
                LineHeightScale       = 1F
            }
            .AddLine($"Nº.: {NfNumero}", f2)
            .AddLine($"Série: {NfSerie}", f2);

            ts.Draw(gfx);
        }
Example #7
0
 public CampoNumerico(string cabecalho, double?conteudoNumerico, Estilo estilo, int casasDecimais = 2) : base(cabecalho, null, estilo, AlinhamentoHorizontal.Direita)
 {
     CasasDecimais    = casasDecimais;
     ConteudoNumerico = conteudoNumerico;
 }
        public override void Draw(Gfx gfx)
        {
            base.Draw(gfx);

            // 7.7.6 Conteúdo do Quadro Dados do Emitente
            // Deverá estar impresso em negrito.A razão social e/ ou nome fantasia deverá ter tamanho
            // mínimo de doze(12) pontos, ou 17 CPP e os demais dados do emitente, endereço,
            // município, CEP, fone / fax deverão ter tamanho mínimo de oito(8) pontos, ou 17 CPP.

            var   rp = BoundingBox.InflatedRetangle(0.75F);
            float alturaMaximaLogoHorizontal = 14F;

            Fonte f2 = Estilo.CriarFonteNegrito(12);
            Fonte f3 = Estilo.CriarFonteRegular(8);

            if (Logo == null)
            {
                var f1 = Estilo.CriarFonteRegular(6);
                gfx.DrawString("IDENTIFICAÇÃO DO EMITENTE", rp, f1, AlinhamentoHorizontal.Centro);
                rp = rp.CutTop(f1.AlturaLinha);
            }
            else
            {
                RectangleF rLogo;

                //Logo Horizontal
                if (Logo.Size.Width > Logo.Size.Height)
                {
                    rLogo = new RectangleF(rp.X, rp.Y, rp.Width, alturaMaximaLogoHorizontal);
                    rp    = rp.CutTop(alturaMaximaLogoHorizontal);
                }
                //Logo Vertical/Quadrado
                else
                {
                    float lw = rp.Height * Logo.Size.Width / Logo.Size.Height;
                    rLogo = new RectangleF(rp.X, rp.Y, lw, rp.Height);
                    rp    = rp.CutLeft(lw);
                }

                gfx.ShowXObject(Logo, rLogo);
            }

            var emitente = ViewModel.Emitente;
            var nome     = emitente.RazaoSocial;
            var nome2    = emitente.NomeFantasia.TrimVip();

            if (ViewModel.PreferirEmitenteNomeFantasia)
            {
                nome  = emitente.NomeFantasia.IsNotNullOrEmpty() ? emitente.NomeFantasia : emitente.RazaoSocial;
                nome2 = emitente.RazaoSocial;
            }
            var ts = new TextStack(rp)
            {
                LineHeightScale = 1
            }
            .AddLine(nome, f2)
            .AddLine(nome2, f3)
            .AddLine(emitente.EnderecoLinha1.Trim(), f3)
            .AddLine(emitente.EnderecoLinha2.Trim(), f3)
            .AddLine(emitente.EnderecoLinha3.Trim(), f3);

            ts.AlinhamentoHorizontal = AlinhamentoHorizontal.Centro;
            ts.AlinhamentoVertical   = AlinhamentoVertical.Centro;
            ts.Draw(gfx);
        }
 public IdentificacaoEmitente(Estilo estilo, DanfeViewModel viewModel) : base(estilo)
 {
     ViewModel = viewModel;
     Logo      = null;
 }
Example #10
0
 public LinhaCampos(Estilo estilo)
 {
     Estilo = estilo;
 }
Example #11
0
        public override void Draw(Gfx gfx)
        {
            base.Draw(gfx);

            // 7.7.4 Conteúdo do Bloco de Campos de Identificação do Documento
            // O conteúdo dos campos “DANFE”, “entrada ou saída”, “número”, “série” e “folhas do
            // documento” deverá ser impresso em caixa alta(maiúsculas). Além disto:
            //         a descrição “DANFE” deverá estar impressa em negrito e ter tamanho mínimo de
            //         doze(12) pontos, ou 10 CPP;
            //
            //         a série e número da NF-e, o número de ordem da folha, o total de folhas do
            //         DANFE e o número identificador do tipo de operação(se “ENTRADA” ou
            //         “SAÍDA”, conforme tag “tpNF”) deverão estar impressos em negrito e ter
            //          tamanho mínimo de dez(10) pontos, ou 10 CPP;
            //
            //         a identificação “DOCUMENTO AUXILIAR DA NOTA FISCAL ELETRÔNICA” e as
            //         descrições do tipo de operação, “ENTRADA” ou “SAÍDA” deverão ter tamanho
            //         mínimo de oito(8) pontos, ou 17 CPP.

            float paddingHorizontal = ViewModel.Orientacao == Orientacao.Retrato ? 2.5F : 5F;

            var rp1 = BoundingBox.InflatedRetangle(1F, 0.5F, paddingHorizontal);
            var rp2 = rp1;

            var f1  = Estilo.CriarFonteNegrito(12);
            var f1h = f1.AlturaLinha;

            gfx.DrawString("DANFE", rp2, f1, AlinhamentoHorizontal.Centro);

            rp2 = rp2.CutTop(f1h + 0.5F);

            var f2  = Estilo.CriarFonteRegular(8F);
            var f2h = f2.AlturaLinha;

            var ts = new TextStack(rp2)
            {
                AlinhamentoVertical = AlinhamentoVertical.Topo
            }
            .AddLine("Documento Auxiliar da", f2)
            .AddLine("Nota Fiscal Eletrônica", f2);

            ts.Draw(gfx);

            rp2 = rp2.CutTop(2F * f2h + 1.5F);

            ts = new TextStack(rp2)
            {
                AlinhamentoVertical   = AlinhamentoVertical.Topo,
                AlinhamentoHorizontal = AlinhamentoHorizontal.Esquerda
            }
            .AddLine("0 - ENTRADA", f2)
            .AddLine("1 - SAÍDA", f2);
            ts.Draw(gfx);

            float rectEsSize = 1.75F * f2h;
            var   rectEs     = new RectangleF(rp2.Right - rectEsSize, rp2.Y + (2F * f2h - rectEsSize) / 2F, rectEsSize, rectEsSize);

            gfx.StrokeRectangle(rectEs, 0.25F);

            gfx.DrawString(ViewModel.TipoNF.ToString(), rectEs, Estilo.FonteNumeroFolhas, AlinhamentoHorizontal.Centro, AlinhamentoVertical.Centro);

            var f4  = Estilo.FonteNumeroFolhas;
            var f4h = Estilo.FonteNumeroFolhas.AlturaLinha;

            rp2.Height = 2F * f4h * TextStack.DefaultLineHeightScale + f2h;
            rp2.Y      = rp1.Bottom - rp2.Height;

            ts = new TextStack(rp2)
            {
                AlinhamentoVertical   = AlinhamentoVertical.Topo,
                AlinhamentoHorizontal = AlinhamentoHorizontal.Centro
            }
            .AddLine("Nº.: " + ViewModel.NfNumero.ToString(DanfeHelper.FormatoNumeroNF), f4)
            .AddLine($"Série: {ViewModel.NfSerie}", f4);

            ts.Draw(gfx);

            RetanguloNumeroFolhas = new RectangleF(rp1.Left, rp1.Bottom - Estilo.FonteNumeroFolhas.AlturaLinha, rp1.Width, Estilo.FonteNumeroFolhas.AlturaLinha);
        }
Example #12
0
 public Duplicata(Estilo estilo, DuplicataViewModel viewModel) : base(estilo)
 {
     ViewModel = viewModel;
     FonteA    = estilo.CriarFonteRegular(7.5F);
     FonteB    = estilo.CriarFonteNegrito(7.5F);
 }
Example #13
0
 public NumeroNfSerie(Estilo estilo, string nfNumero, string nfSerie) : base(estilo)
 {
     NfNumero = nfNumero;
     NfSerie  = nfSerie;
 }
Example #14
0
 public CabecalhoBloco(Estilo estilo, string cabecalho) : base(estilo)
 {
     Cabecalho = cabecalho ?? throw new ArgumentNullException(cabecalho);
 }
Example #15
0
 protected ElementoBase(Estilo estilo)
 {
     Estilo = estilo ?? throw new ArgumentNullException(nameof(estilo));
 }
Example #16
0
 public LinhaCampos(Estilo estilo, float width, float height = DanfeConstantes.CampoAltura)
 {
     Estilo = estilo;
     SetSize(width, height);
 }
Example #17
0
 public CampoMultilinha(string cabecalho, string conteudo, Estilo estilo, AlinhamentoHorizontal alinhamentoHorizontalConteudo = AlinhamentoHorizontal.Esquerda, bool isBold = false)
     : base(cabecalho, conteudo, estilo, alinhamentoHorizontalConteudo)
 {
     _tbConteudo       = new TextBlock(conteudo, isBold ? estilo.FonteCampoConteudoNegrito : estilo.FonteCampoConteudo);
     IsConteudoNegrito = isBold;
 }
Example #18
0
 public NumeroNfSerie2(Estilo estilo, DanfeViewModel viewModel) : base(estilo)
 {
     ViewModel = viewModel;
 }