Example #1
0
        public void DesenharCabecalho(Gfx gfx)
        {
            var   ml = Colunas.Max(c => c.Cabecalho.Length);
            float ac = ml * FonteCabecalho.AlturaLinha + 2F;

            float x = X;

            _DY = Y;

            foreach (var coluna in Colunas)
            {
                float w = (Width * coluna.PorcentagemLargura) / 100F;
                var   r = new RectangleF(x, _DY, w, ac);

                var tb = new TextStack(r.InflatedRetangle(1F));
                tb.AlinhamentoVertical   = AlinhamentoVertical.Centro;
                tb.AlinhamentoHorizontal = AlinhamentoHorizontal.Centro;

                foreach (var item in coluna.Cabecalho)
                {
                    tb.AddLine(item, FonteCabecalho);
                }

                tb.Draw(gfx);

                x += w;

                gfx.DrawRectangle(r);
                gfx.DrawRectangle(r.X, BoundingBox.Y, r.Width, BoundingBox.Height);
            }

            _DY += ac;

            gfx.Stroke();
        }
Example #2
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 #3
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 = (float)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(Formatador.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);
        }
        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;

            string nome = emitente.RazaoSocial;

            if (ViewModel.PreferirEmitenteNomeFantasia)
            {
                nome = !string.IsNullOrWhiteSpace(emitente.NomeFantasia) ? emitente.NomeFantasia : emitente.RazaoSocial;
            }
            var ts = new TextStack(rp)
            {
                LineHeightScale = 1
            }
            .AddLine(nome, f2)
            .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);
        }