Ejemplo n.º 1
0
        public Table GeraCabecalho2(bool bVendedor, string vendedor, string observacao)
        {
            Table table = new Table(6);

            table.TableFitsPage   = true;
            table.BorderWidth     = 1;
            table.Padding         = 4;
            table.WidthPercentage = 100;
            table.Alignment       = Element.ALIGN_LEFT;
            table.AddCell(Celula2("Cliente", 1, true));
            table.AddCell(Celula2(cab2.cliente, 3, false));
            table.AddCell(Celula2("CPF/CNPJ", 1, true));
            table.AddCell(Celula2(cab2.cnpj, 1, false));
            table.AddCell(Celula2("Endereço", 1, true));
            table.AddCell(Celula2(cab2.endereco.Trim() + " " +
                                  cab2.numero.Trim() + " - " +
                                  cab2.compl.Trim() + "\r\n" +
                                  cab2.bairro.Trim() + " - " +
                                  cab2.cidade.Trim() + " - " +
                                  cab2.estado.Trim() + " - " +
                                  "CEP " + CEP.PoeEdicao(cab2.cep), 3, false));
            table.AddCell(Celula2("IE", 1, true));
            table.AddCell(Celula2(cab2.ie, 1, false));

            table.AddCell(Celula2("Local Entrega", 1, true));
            if (cab2.entrega.Trim().Length > 0)
            {
                table.AddCell(Celula2(cab2.entrega.Trim() + " " +
                                      cab2.numero_entrega.Trim() + " - " +
                                      cab2.compl_entrega.Trim() + "\r\n" +
                                      cab2.bairro_entrega.Trim() + " - " +
                                      cab2.cidade_entrega.Trim() + " - " +
                                      cab2.estado_entrega.Trim() + " - " +
                                      "CEP " + CEP.PoeEdicao(cab2.cep), 3, false));
            }
            else
            {
                table.AddCell(Celula2(cab2.endereco.Trim() + " " +
                                      cab2.numero.Trim() + " - " +
                                      cab2.compl.Trim() + "\r\n" +
                                      cab2.bairro.Trim() + " - " +
                                      cab2.cidade.Trim() + " - " +
                                      cab2.estado.Trim() + " - " +
                                      "CEP " + CEP.PoeEdicao(cab2.cep), 3, false));
            }
            table.AddCell(Celula2("IM", 1, true));
            table.AddCell(Celula2(cab2.im, 1, false));

            table.AddCell(Celula2("Contato", 1, true));
            table.AddCell(Celula2(cab2.contato, 1, false));

            table.AddCell(Celula2("Fone", 1, true));
            string fones = FONES.Concatena(cab2.fone, cab2.fone2, cab2.celular, cab2.fone1_parceiro, cab2.fone2_parceiro, cab2.celular_parceiro);

            table.AddCell(Celula2(fones, 1, false));

            table.AddCell(Celula2("email", 1, true));
            table.AddCell(Celula2(cab2.email, 1, false));
            if (bVendedor)
            {
                table.AddCell(Celula2("Vendedor", 1, true));
                table.AddCell(Celula2(vendedor, 5, false));
                table.AddCell(Celula2("Observações", 1, true));
                table.AddCell(Celula2Bold(observacao, 5, false));
            }
            return(table);
            //doc.Add(table);
        }
Ejemplo n.º 2
0
        private void CabecalhoCliente(string COD_FORNECEDOR, DateTime DAT_ORCAMENTO, short COD_ORCAMENTO, bool servico)
        {
            cPedidos   pedido     = new cPedidos();
            cPedidoPDF pedido_pdf = new cPedidoPDF();

            pedido_pdf.cab2 = pedido.DadosCabecalho2(COD_FORNECEDOR, DAT_ORCAMENTO, COD_ORCAMENTO, servico);

            Tabela table = new Tabela(6);

            table.AddCell(Celula2("Cliente", 1, true));
            table.AddCell(Celula2(pedido_pdf.cab2.cliente, 3, false));
            table.AddCell(Celula2("CPF/CNPJ", 1, true));
            table.AddCell(Celula2(pedido_pdf.cab2.cnpj, 1, false));

            table.AddCell(Celula2("Endereço", 1, true));
            table.AddCell(Celula2(pedido_pdf.cab2.endereco.Trim() + " " +
                                  pedido_pdf.cab2.numero.Trim() + " - " +
                                  pedido_pdf.cab2.compl.Trim() + "\r\n" +
                                  pedido_pdf.cab2.bairro.Trim() + " - " +
                                  pedido_pdf.cab2.cidade.Trim() + " - " +
                                  pedido_pdf.cab2.estado.Trim() + " - " +
                                  "CEP " + CEP.PoeEdicao(pedido_pdf.cab2.cep), 3, false));
            table.AddCell(Celula2("IE", 1, true));
            table.AddCell(Celula2(pedido_pdf.cab2.ie, 1, false));

            table.AddCell(Celula2("Local Entrega", 1, true));
            if (pedido_pdf.cab2.entrega.Trim().Length > 0)
            {
                table.AddCell(Celula2(pedido_pdf.cab2.entrega.Trim() + " " +
                                      pedido_pdf.cab2.numero_entrega.Trim() + " - " +
                                      pedido_pdf.cab2.compl_entrega.Trim() + "\r\n" +
                                      pedido_pdf.cab2.bairro_entrega.Trim() + " - " +
                                      pedido_pdf.cab2.cidade_entrega.Trim() + " - " +
                                      pedido_pdf.cab2.estado_entrega.Trim() + " - " +
                                      "CEP " + CEP.PoeEdicao(pedido_pdf.cab2.cep), 3, false));
            }
            else
            {
                table.AddCell(Celula2(pedido_pdf.cab2.endereco.Trim() + " " +
                                      pedido_pdf.cab2.numero.Trim() + " - " +
                                      pedido_pdf.cab2.compl.Trim() + "\r\n" +
                                      pedido_pdf.cab2.bairro.Trim() + " - " +
                                      pedido_pdf.cab2.cidade.Trim() + " - " +
                                      pedido_pdf.cab2.estado.Trim() + " - " +
                                      "CEP " + CEP.PoeEdicao(pedido_pdf.cab2.cep), 3, false));
            }
            table.AddCell(Celula2("IM", 1, true));
            table.AddCell(Celula2(pedido_pdf.cab2.im, 1, false));

            table.AddCell(Celula2("Contato", 1, true));
            table.AddCell(Celula2(pedido_pdf.cab2.contato, 1, false));

            table.AddCell(Celula2("Fone", 1, true));
            string fones = FONES.Concatena(pedido_pdf.cab2.fone, pedido_pdf.cab2.fone2, pedido_pdf.cab2.celular, pedido_pdf.cab2.fone1_parceiro, pedido_pdf.cab2.fone2_parceiro, pedido_pdf.cab2.celular_parceiro);

            table.AddCell(Celula2(fones, 1, false));

            table.AddCell(Celula2("email", 1, true));
            table.AddCell(Celula2(pedido_pdf.cab2.email, 1, false));
            doc.Add(table);
        }
Ejemplo n.º 3
0
        public bool Gera(DataGridView grid, string arquivo, bool idtI, DateTime dataI, bool idtF, DateTime dataF, string titulo)
        {
            /*
             * FbCommand cmd;
             * FbDataReader reader;
             *
             * cmd =  new FbCommand("select " +
             *                   "a.NRO_NF," +
             *                   "a.SEQ_TITULO," +
             *                   "a.COD_CLIENTE," +
             *                   "b.DES_NATUREZA," +
             *                   "a.DAT_EMISSAO," +
             *                   "a.DAT_VENCIMENTO," +
             *                   "a.VLR_PREVISTO," +
             *                   "a.VLR_RECEBIDO," +
             *                   "a.DAT_RECEBIMENTO," +
             *                   "c.DES_FORMA," +
             *                   "a.TXT_OBSERVACAO " +
             *                                       "from TITULOS_RECEBER a " +
             *                                       "left outer join NATUREZAS_RECEBIMENTO b " +
             *                                       "on b.COD_NATUREZA = a.COD_NATUREZA " +
             *                                       "left outer join FORMAS_RECEBIMENTO c " +
             *                                       "on c.COD_FORMA = a.COD_FORMA " +
             *                   where + " " +
             *                   "order by a.DAT_VENCIMENTO",
             *                   Globais.bd);
             * reader = cmd.ExecuteReader(CommandBehavior.Default);
             */

            PDF pdf = new PDF(arquivo);

            pdf.Abre();

            /*
             * pdf.CriaTabela(2, 0);
             * pdf.AdicionaCelula("imagens\\logo_rel.jpg", 1000, 1000);
             * pdf.AdicionaCelula(titulo, BaseFont.HELVETICA_BOLD, 16);
             * pdf.AdicionaTabela();
             */
            Parte1(pdf, titulo);

            pdf.CriaTabela(11, 0);

            pdf.AdicionaCelula("Responsável", BaseFont.HELVETICA_BOLD, 6, /*Color.LIGHT_GRAY,*/ Element.ALIGN_LEFT, 2);
            pdf.AdicionaCelula("Previsão", BaseFont.HELVETICA_BOLD, 6, /*Color.LIGHT_GRAY,*/ Element.ALIGN_LEFT, 2);
            pdf.AdicionaCelula("Realização", BaseFont.HELVETICA_BOLD, 6, /*Color.LIGHT_GRAY,*/ Element.ALIGN_LEFT, 1);
            pdf.AdicionaCelula("Usuário", BaseFont.HELVETICA_BOLD, 6, /*Color.LIGHT_GRAY,*/ Element.ALIGN_LEFT, 3);
            pdf.AdicionaCelula("Pri", BaseFont.HELVETICA_BOLD, 6, /*Color.LIGHT_GRAY,*/ Element.ALIGN_LEFT, 1);
            pdf.AdicionaCelula("Natureza", BaseFont.HELVETICA_BOLD, 6, /*Color.LIGHT_GRAY,*/ Element.ALIGN_LEFT, 2);

            pdf.AdicionaCelula("", BaseFont.HELVETICA_BOLD, 6, /*Color.LIGHT_GRAY,*/ Element.ALIGN_LEFT, 2);
            pdf.AdicionaCelula("Parceiro", BaseFont.HELVETICA_BOLD, 6, /*Color.LIGHT_GRAY,*/ Element.ALIGN_LEFT, 3);
            pdf.AdicionaCelula("Endereço", BaseFont.HELVETICA_BOLD, 6, /*Color.LIGHT_GRAY,*/ Element.ALIGN_LEFT, 4);
            pdf.AdicionaCelula("Fone", BaseFont.HELVETICA_BOLD, 6, /*Color.LIGHT_GRAY,*/ Element.ALIGN_LEFT, 2);

            pdf.AdicionaCelula("", BaseFont.HELVETICA_BOLD, 6, /*Color.LIGHT_GRAY,*/ Element.ALIGN_LEFT, 2);
            pdf.AdicionaCelula("Contato", BaseFont.HELVETICA_BOLD, 6, /*Color.LIGHT_GRAY,*/ Element.ALIGN_LEFT, 3);
            pdf.AdicionaCelula("Papel", BaseFont.HELVETICA_BOLD, 6, /*Color.LIGHT_GRAY,*/ Element.ALIGN_LEFT, 4);
            pdf.AdicionaCelula("Fone", BaseFont.HELVETICA_BOLD, 6, /*Color.LIGHT_GRAY,*/ Element.ALIGN_LEFT, 2);

            pdf.AdicionaCelula("", BaseFont.HELVETICA_BOLD, 6, /*Color.LIGHT_GRAY,*/ Element.ALIGN_LEFT, 2);
            pdf.AdicionaCelula("Descrição", BaseFont.HELVETICA_BOLD, 6, /*Color.LIGHT_GRAY,*/ Element.ALIGN_LEFT, 9);

            pdf.AdicionaCelulaLinha("", BaseFont.HELVETICA_BOLD, 6, /*Color.LIGHT_GRAY,*/ Element.ALIGN_LEFT, 2);
            pdf.AdicionaCelulaLinha("Solução", BaseFont.HELVETICA_BOLD, 6, /*Color.LIGHT_GRAY,*/ Element.ALIGN_LEFT, 9);

            foreach (DataGridViewRow row in  grid.Rows)
            {
                DateTime data = DateTime.Parse(row.Cells["Data"].Value.ToString());
                if (idtI && (data.Date < dataI.Date))
                {
                    continue;
                }
                if (idtF && (data.Date > dataF.Date))
                {
                    continue;
                }

                data = DateTime.Parse(row.Cells["Data"].Value.ToString());
                pdf.AdicionaCelula(row.Cells["Responsável"].Value.ToString().Trim(), BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 2);
                pdf.AdicionaCelula(data.ToString("d/M/yyyy HH:mm"), BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 2);
                if ((row.Cells["Data Solução"].Value != null) && (!row.Cells["Data Solução"].Value.ToString().Trim().Equals("")))
                {
                    data = DateTime.Parse(row.Cells["Data Solução"].Value.ToString());
                    pdf.AdicionaCelula(data.ToString("d/M/yyyy"), BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 1);
                }
                else
                {
                    pdf.AdicionaCelula("", BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 1);
                }
                pdf.AdicionaCelula(row.Cells["Usuário"].Value.ToString().Trim(), BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 3);
                switch (row.Cells["Prioridade"].Value.ToString()[0])
                {
                case '0': pdf.AdicionaCelula("Urgente", BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 1); break;

                case '1': pdf.AdicionaCelula("Importante", BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 1); break;

                case '2': pdf.AdicionaCelula("Normal", BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 1); break;
                }
                pdf.AdicionaCelula(row.Cells["Natureza"].Value.ToString().Trim(), BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 2);


                pdf.AdicionaCelula("", BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 2);
                if (row.Cells["Razão"].Value != null)
                {
                    pdf.AdicionaCelula(row.Cells["Razão"].Value.ToString().Trim(), BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 3);
                }
                else
                {
                    pdf.AdicionaCelula("", BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 2);
                }
                string endereco = "";
                if ((row.Cells["RuaEntrega"].Value != null) && (!row.Cells["RuaEntrega"].Value.ToString().Trim().Equals("")))
                {
                    endereco = row.Cells["RuaEntrega"].Value.ToString().Trim() + " - " +
                               row.Cells["NroEntrega"].Value.ToString().Trim() + " - " +
                               row.Cells["ComplEntrega"].Value.ToString().Trim() + " - " +
                               row.Cells["BairroEntrega"].Value.ToString().Trim();
                }
                else
                {
                    endereco = row.Cells["Rua"].Value.ToString().Trim() + " - " +
                               row.Cells["Nro"].Value.ToString().Trim() + " - " +
                               row.Cells["Compl"].Value.ToString().Trim() + " - " +
                               row.Cells["Bairro"].Value.ToString().Trim();
                }
                pdf.AdicionaCelula(endereco, BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 4);

                string fones = FONES.Concatena(row.Cells["Fone"].Value, row.Cells["Celular"].Value);
                pdf.AdicionaCelula(fones, BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 2);

                pdf.AdicionaCelula("", BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 2);
                if (row.Cells["NomeContato"].Value != null)
                {
                    pdf.AdicionaCelula(row.Cells["NomeContato"].Value.ToString().Trim(), BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 3);
                    pdf.AdicionaCelula(row.Cells["Papel"].Value.ToString().Trim(), BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 4);

                    fones = FONES.Concatena(row.Cells["FoneContato"].Value, row.Cells["CelularContato"].Value);
                    pdf.AdicionaCelula(fones, BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 2);
                }
                else
                {
                    pdf.AdicionaCelula("", BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 9);
                }

                pdf.AdicionaCelula("", BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 2);
                pdf.AdicionaCelula(row.Cells["Pendência"].Value.ToString().Trim(), BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 9);

                pdf.AdicionaCelula("", BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 2);
                if (row.Cells["Solução"].Value != null)
                {
                    pdf.AdicionaCelula(row.Cells["Solução"].Value.ToString().Trim(), BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 9);
                }
                else
                {
                    pdf.AdicionaCelula("", BaseFont.HELVETICA, 6, Element.ALIGN_LEFT, 9);
                }

                pdf.AdicionaTabela();

                pdf.CriaTabela(128, 0);
                for (int i = 0; i < 128; i++)
                {
                    Cell cell = new Cell(new Paragraph(""));
                    cell.BorderWidthBottom = i % 2;
                    pdf.tabela.AddCell(cell);
                }

                pdf.AdicionaTabela();
                pdf.CriaTabela(11, 0);
            }
            pdf.AdicionaTabela();
            pdf.Fecha();
            return(true);
        }