Пример #1
0
        protected void CabRelatorio(pdfDocument myDoc, pdfPage myPage, int top, string nNuOs, string nNuDemanda)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;

            //myDoc.addImageReference(EnderecoLogoOrion, "logo1");
            //myPage.addImage(myDoc.getImageReference("logo1"), leftMargin, getTop(myPage, top));

            //if (EnderecoLogoObra != "")
            //{
            //    myDoc.addImageReference(EnderecoLogoObra, "logo2");
            //    myPage.addImage(myDoc.getImageReference("logo2"), 530, getTop(myPage, top));
            //}

            //top += 10;

            myPage.addText("ORDEM DE SERVIÇO", 235, getTop(myPage, 30), myDoc.getFontReference(strFont), 12, pdfColor.Black);

            pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 9, pdfColor.Black, pdfColor.White));

            top += 20;

            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);

            int cl = 0;

            myTable.tableHeader.rowHeight = 20;
            myTable.tableHeader.addColumn(570, predefinedAlignment.csLeft);
            myTable.tableHeader[cl].addText("Obra: " + DadosObra);
            myPage.addTable(myTable);

            myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 9, pdfColor.Black, pdfColor.White));
            top           += 20;
            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);

            cl = 0;
            myTable.tableHeader.rowHeight = 20;
            myTable.tableHeader.addColumn(285, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("Nº ORDEM DE SERVIÇO: " + nNuOs.ToString());
            top += 20;

            myTable.tableHeader.rowHeight = 20;
            myTable.tableHeader.addColumn(285, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("Nº DEMANDA CLIENTE: " + nNuDemanda.ToString());
            myPage.addTable(myTable);
        }
Пример #2
0
        protected static void SubCabRelatorio(pdfDocument myDoc, pdfPage myPage, int top, DataRow row)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;

            pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 9, pdfColor.Black, new pdfColor("FFFFFF")),
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 8, pdfColor.Black, pdfColor.White));

            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);

            int cl = 0;

            myTable.tableHeader.rowHeight = 20;

            myTable.tableHeader.addColumn(110, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("ATIVIDADE");

            myTable.tableHeader.addColumn(60, predefinedAlignment.csCenter);
            myTable.tableHeader[cl++].addText("DATA");

            myTable.tableHeader.addColumn(80, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("Nº PREVENTIVA");

            myTable.tableHeader.addColumn(90, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("PERIODICIDADE");

            myTable.tableHeader.addColumn(100, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("SITUAÇÃO");

            myTable.tableHeader.addColumn(110, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("TIPO PREVENTIVA");

            top += 20;
            cl   = 0;
            pdfTableRow myRow = myTable.createRow();

            myRow.rowStyle = myTable.rowStyle;

            myRow[cl++].addText(row["cmpDcTipoAtividade"].ToString().TrimEnd());
            myRow[cl++].addText(row["cmpDtReprogramacaoPreventivaAgenda"].ToString().Substring(0, 10));
            myRow[cl++].addText(row["cmpNuPreventivaAgenda"].ToString().TrimEnd());
            myRow[cl++].addText(row["cmpDcPeriodicidade"].ToString().TrimEnd());
            myRow[cl++].addText(row["EstadoManutencaoPreventiva"].ToString().TrimEnd());
            myRow[cl++].addText(row["TPPREVENTIVA"].ToString().TrimEnd());

            myTable.addRow(myRow);

            myPage.addTable(myTable);
        }
Пример #3
0
        protected static void CabRelatorio(pdfDocument myDoc, pdfPage myPage, int top, string NomeObra, string Atividade, string Periodicidade)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;

            myPage.addText("Formulário de Manutenção Preventiva", 200, getTop(myPage, top),
                           myDoc.getFontReference(strFont), 12, pdfColor.Black);
            top += 15;
            myPage.addText("OBRA: " + NomeObra.TrimEnd(), leftMargin, getTop(myPage, top),
                           myDoc.getFontReference(strFont), 10, pdfColor.Black);
            top += 15;
            myPage.addText("TIPO ATIVIDADE: " + Atividade.TrimEnd() + "                                    " + "PERIODICIDADE : " + Periodicidade.TrimEnd(), leftMargin, getTop(myPage, top),
                           myDoc.getFontReference(strFont), 10, pdfColor.Black);
        }
        // Constructor
        public ReportWriter(string releaseVersion)
        {
            strFont      = "Helvetica";
            leftMargin   = 60;
            rightMargin  = 60;
            topMargin    = 60;
            bottomMargin = 60;
            lineHeight   = 20;
            myDoc        = new pdfDocument("Stormwater Calculator Report", "swc");
            int strWidth = myDoc.getFontReference(strFont).getWordWidth("Page x Of x", 10);
            int left     = 612 - rightMargin - strWidth;

            myDoc.pageMarker = new pdfPageMarker(left, bottomMargin - lineHeight, predefinedMarkerStyle.csArabic,
                                                 myDoc.getFontReference(strFont), 10);
            footer = footer + releaseVersion;
        }
Пример #5
0
        public virtual int CabRelatorio(pdfDocument myDoc, pdfPage myPage, int top)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;

            myPage.addText("Formulário de Manutenção Preventiva de Equipamento", 200, getTop(myPage, top),
                           myDoc.getFontReference(strFont), 12, pdfColor.Black);
            top += 15;
            myPage.addText("OBRA: " + cmpNoObra, leftMargin, getTop(myPage, top),
                           myDoc.getFontReference(strFont), 10, pdfColor.Black);
            top += 15;
            myPage.addText("TIPO ATIVIDADE: " + cmpDcTipoAtividade + "                                                  " + "PERIODICIDADE : " + cmpDcPeriodicidade, leftMargin, getTop(myPage, top),
                           myDoc.getFontReference(strFont), 10, pdfColor.Black);
            top += 20;
            myPage.addText("Dados do Equipamento", 230, getTop(myPage, top), myDoc.getFontReference(strFont), 12, pdfColor.Black);

            return(top += 15);
        }
Пример #6
0
        protected static void ImprimeGrupo(pdfDocument myDoc, pdfPage myPage, int top, string GrupoAtividade)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;

            pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 9, pdfColor.Black, new pdfColor("FFFFFF")),
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 8, pdfColor.Black, pdfColor.White));

            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);
            int cl = 0;

            myTable.tableHeader.addColumn(550, predefinedAlignment.csLeft);
            myTable.tableHeader.rowHeight = 20;
            myTable.tableHeader[cl++].addText("GRUPO DE ATIVIDADE: " + GrupoAtividade);
            myPage.addTable(myTable);
        }
Пример #7
0
        /// <summary>
        /// Código da Ordem de Serviço
        /// </summary>
        //public string cmpIdOS { get; set; }
        /// <summary>
        /// Código da Obra
        /// </summary>
        //public string cmpCoObra { get; set; }
        /// <summary>
        /// Documento PDF
        /// </summary>
        //public pdfDocument myDoc { get; set; }

        #endregion

        #region Base Functions

        protected static pdfTable CabRelatorio(pdfDocument myDoc, pdfPage myPage, int top, string DadosObra, string DataInicial, string DataFinal)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;

            // Cabeçalho Relatório
            myPage.addText("Atendimentos Realizados  -  Período : " + DataInicial + " a " + DataFinal, leftMargin, getTop(myPage, 30),
                           myDoc.getFontReference(strFont), 15, pdfColor.Black);

            pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 11, pdfColor.Black, new pdfColor("FFFFFF")),
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 11, pdfColor.Black, pdfColor.White));

            top += 20;

            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);

            int cl = 0;

            myTable.tableHeader.rowHeight = 30;
            myTable.tableHeader.addColumn(550, predefinedAlignment.csLeft);
            myTable.tableHeader[cl].addText("Obra: " + DadosObra.ToString());
            myPage.addTable(myTable);

            top    += 30;
            myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 8, pdfColor.Black, pdfColor.White));

            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);

            cl = 0;
            myTable.tableHeader.rowHeight = 10;
            myTable.tableHeader.addColumn(450, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("Descrição da Solicitação");

            myTable.tableHeader.addColumn(100, predefinedAlignment.csCenter);
            myTable.tableHeader[cl++].addText("Data da Conclusão");
            top = +15;

            return(myTable);
        }
Пример #8
0
        protected static pdfTable ItemAtividade(pdfDocument myDoc, pdfPage myPage, int top, DataRow r)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;

            pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 12, pdfColor.Black, new pdfColor("FFFFFF")),
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 12, pdfColor.Black, pdfColor.White));

            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);
            int cl = 0;

            myTable.tableHeader.addColumn(550, predefinedAlignment.csCenter);
            myTable.tableHeader.rowHeight = 20;
            myTable.tableHeader[cl++].addText("Itens da Manutenção");

            myPage.addTable(myTable);

            top += 20;

            myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White));

            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);
            cl             = 0;

            myTable.tableHeader.addColumn(20, predefinedAlignment.csLeft);
            myTable.tableHeader.rowHeight = 10;
            myTable.tableHeader[cl++].addText("");

            myTable.tableHeader.addColumn(530, predefinedAlignment.csLeft);
            myTable.tableHeader.rowHeight = 10;
            myTable.tableHeader[cl++].addText(TiraCaractEspecial(r["cmpDcItemAtividadePreventiva"].ToString().TrimEnd()));

            return(myTable);
        }
Пример #9
0
        protected void CabRelatorio(pdfDocument myDoc, pdfPage myPage, int top, string DadosObra, string DtInicial, string DtFinal)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;

            //myDoc.addImageReference(EnderecoLogoOrion, "logo1");
            //myPage.addImage(myDoc.getImageReference("logo1"), leftMargin, getTop(myPage, top));

            //if (EnderecoLogoObra != "")
            //{
            //    myDoc.addImageReference(EnderecoLogoObra, "logo2");
            //    myPage.addImage(myDoc.getImageReference("logo2"), 530, getTop(myPage, top));
            //}

            //top += 20;

            myPage.addText("AGENDA MANUTENÇÃO PREVENTIVA", 235, getTop(myPage, top),
                           myDoc.getFontReference(strFont), 12, pdfColor.Black);

            pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 8, pdfColor.Black, pdfColor.White));

            top += 10;

            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);

            int cl = 0;

            myTable.tableHeader.rowHeight = 20;
            myTable.tableHeader.addColumn(350, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("Obra: " + DadosObra.ToString().TrimEnd());

            myTable.tableHeader.addColumn(200, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("Período: " + DtInicial + " a " + DtFinal);

            myPage.addTable(myTable);
        }
Пример #10
0
        protected static pdfTable SubCabRelatorio(pdfDocument myDoc, pdfPage myPage, int top)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;

            pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 7, pdfColor.Black, new pdfColor("FFFFFF")),
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 6, pdfColor.Black, pdfColor.White));

            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);

            int cl = 0;

            myTable.tableHeader.rowHeight = 10;
            myTable.tableHeader.addColumn(40, predefinedAlignment.csCenter);
            myTable.tableHeader[cl++].addText("Nº O.S");

            myTable.tableHeader.addColumn(80, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("Solicitante");

            myTable.tableHeader.addColumn(200, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("Detalhamento Serviço");

            myTable.tableHeader.addColumn(100, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("Local");

            myTable.tableHeader.addColumn(40, predefinedAlignment.csCenter);
            myTable.tableHeader[cl++].addText("Abertura");

            myTable.tableHeader.addColumn(40, predefinedAlignment.csCenter);
            myTable.tableHeader[cl++].addText("Conclusão");

            myTable.tableHeader.addColumn(50, predefinedAlignment.csRight);
            myTable.tableHeader[cl++].addText("Total Material");

            return(myTable);
        }
Пример #11
0
        protected static void SubCabRelatorio(pdfDocument myDoc, pdfPage myPage, int top, string CoObra, string cmpCoPreventiva)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;

            pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 7, pdfColor.Black, new pdfColor("FFFFFF")),
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 6, pdfColor.Black, pdfColor.White));

            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);
            int cl = 0;

            myTable.tableHeader.addColumn(200, predefinedAlignment.csCenter);
            myTable.tableHeader.rowHeight = 20;
            myTable.tableHeader[cl++].addText("Atividades da Manutenção Preventiva");
            myPage.addTable(myTable);

            myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 7, pdfColor.Black, new pdfColor("FFFFFF")),
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 5, pdfColor.Black, pdfColor.White));

            top            = 70;
            myTable.coordX = 220;
            myTable.coordY = getTop(myPage, top);
            cl             = 0;
            myTable.tableHeader.addColumn(352, predefinedAlignment.csCenter);
            myTable.tableHeader.rowHeight = 10;
            myTable.tableHeader[cl++].addText("Pavimentos");
            myPage.addTable(myTable);

            myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 5, pdfColor.Black, new pdfColor("FFFFFF")),
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 3, pdfColor.Black, pdfColor.White));

            top           += 10;
            myTable.coordX = 220;
            myTable.coordY = getTop(myPage, top);
            cl             = 0;
            myTable.tableHeader.rowHeight = 10;
            DataTable table = tblPreventivaAtividade.RetornaFormPreventivaPivot(Global.GetConnection(), cmpCoPreventiva, CoObra);

            for (int i = 2; i <= 23; ++i)
            {
                myTable.tableHeader.addColumn(16, predefinedAlignment.csCenter);
                if (i <= table.Columns.Count - 1)
                {
                    myTable.tableHeader[cl++].addText(table.Columns[i].ColumnName.ToString());
                }
                else
                {
                    myTable.tableHeader[cl++].addText("");
                }
            }

            myPage.addTable(myTable);
        }
Пример #12
0
        protected static void CabRelatorio(pdfDocument myDoc, pdfPage myPage, int top, string DadosObra)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;

            myPage.addText("Plano de Manutenção Preventiva", leftMargin, getTop(myPage, 30), myDoc.getFontReference(strFont), 12, pdfColor.Black);

            pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 11, pdfColor.Black, new pdfColor("FFFFFF")),
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 11, pdfColor.Black, pdfColor.White));

            top += 10;

            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);

            int cl = 0;

            myTable.tableHeader.rowHeight = 25;
            myTable.tableHeader.addColumn(550, predefinedAlignment.csLeft);
            myTable.tableHeader[cl].addText("Obra: " + DadosObra.ToString());

            myPage.addTable(myTable);
        }
        protected int GetCenteredOffset(pdfPage myPage, string text, int fontSize)
        {
            // Get width of string
            int strWidth = myDoc.getFontReference(strFont).getWordWidth(text, fontSize);

            // Find left coordinate
            return((myPage.width - strWidth) / 2);
        }
Пример #14
0
        public static pdfDocument ImprimeFechamento(DataTable table, string DataInicial, string DataFinal)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;
            int    pg         = 1;
            int    top        = 40;
            //Tamanho da lin em pixel
            int nTamLinPixel = 19;

            // Variaveis de controle para quebra de linha de campos
            int QtdCaracterLinha = 80;
            int Tamanho;
            int QtdLin;
            int StrInicio;
            int StrFim;
            int cl;

            // Adiciona Página
            pdfDocument myDoc  = new pdfDocument("Horizon", "Orion");
            pdfPage     myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);

            string DadosObra = (table.Rows[0]["cmpNoObra"].ToString().Trim() + (table.Rows[0]["cmpNuContrato"] != null ? " -> Contrato nº " + table.Rows[0]["cmpNuContrato"].ToString() : ""));

            CabRelatorio(myDoc, myPage, top, DadosObra, DataInicial, DataFinal);
            top += 30;

            pdfTable myTable = SubCabRelatorio(myDoc, myPage, top);

            top += 10;

            // Imprimir linhas de detalhes
            pdfTableRow myRow = myTable.createRow();

            int cont = 0;

            foreach (DataRow row in table.Rows)
            {
                cl             = 0;
                myRow          = myTable.createRow();
                myRow.rowStyle = myTable.rowStyle;

                myRow[cl++].addText(row["cmpNuOs"].ToString());
                myRow[cl++].addText(row["cmpNoSolicitante"].ToString().TrimEnd());

                row["cmpDcObservacoes"] = TiraCaractEspecial(row["cmpDcObservacoes"].ToString().ToUpper());

                Tamanho = row["cmpDcObservacoes"].ToString().Length;

                if (Tamanho > 0)
                {
                    QtdLin    = (Tamanho % QtdCaracterLinha == 0 ? Tamanho / QtdCaracterLinha : (Tamanho / QtdCaracterLinha) + 1);
                    StrInicio = 0;

                    for (int Linha = 1; Linha <= QtdLin; Linha++)
                    {
                        StrFim = Linha == QtdLin ? Tamanho - StrInicio : QtdCaracterLinha;
                        if (Linha == 1)
                        {
                            myRow[cl++].addText(row["cmpDcObservacoes"].ToString().Substring(StrInicio, StrFim).Trim());
                            if (row["cmpDcLocal"] != null)
                            {
                                cont++;
                                //System.Diagnostics.Debug.WriteLine(cont.ToString());
                                myRow[cl++].addText(TiraCaractEspecial(row["cmpDcLocal"].ToString()));
                            }
                            else
                            {
                                myRow[cl++].addText(" ");
                            }
                            myRow[cl++].addText(row["cmpDtAbertura"].ToString().Substring(0, 10));
                            myRow[cl++].addText(row["cmpDtConclusaoAtendimento"].ToString() == "" ? "" : row["cmpDtConclusaoAtendimento"].ToString().Substring(0, 10));
                        }
                        else
                        {
                            cl             = 0;
                            myRow          = myTable.createRow();
                            myRow.rowStyle = myTable.rowStyle;
                            myRow[cl++].addText("");
                            myRow[cl++].addText("");
                            myRow[cl++].addText(row["cmpDcObservacoes"].ToString().Substring(StrInicio, StrFim).Trim());
                            myRow[cl++].addText("");
                            myRow[cl++].addText("");
                            myRow[cl++].addText("");
                        }
                        myTable.addRow(myRow);
                        StrInicio += QtdCaracterLinha;
                        top       += nTamLinPixel;
                    }
                }
                else
                {
                    myRow[cl++].addText(row["cmpDcDescricaoSolicitacao"].ToString().TrimEnd());
                    myRow[cl++].addText(row["cmpDcLocal"].ToString());
                    myRow[cl++].addText(row["cmpDtAbertura"].ToString().Substring(0, 10));
                    myRow[cl++].addText(row["cmpDtConclusaoAtendimento"].ToString() == "" ? "" : row["cmpDtConclusaoAtendimento"].ToString().Substring(0, 10));
                    myTable.addRow(myRow);
                    top += nTamLinPixel;
                }

                if (top > 1230)
                {
                    myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 10, pdfColor.Black);
                    myPage.addTable(myTable);

                    // Adiciona uma página
                    myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);
                    top    = 30;
                    CabRelatorio(myDoc, myPage, top, DadosObra, DataInicial, DataFinal);
                    top    += 30;
                    myTable = SubCabRelatorio(myDoc, myPage, top);
                    top     = +10;
                }
            }

            if (top < 1230)
            {
                myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 10, pdfColor.Black);
                myPage.addTable(myTable);
            }

            return(myDoc);
        }
Пример #15
0
        public static pdfDocument ImprimePlano(DataTable table, string NoObra)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;
            int    pg         = 1;
            int    top        = 40;
            //Tamanho da lin em pixel
            int nTamLinPixel = 12;

            // Variaveis de controle para quebra de linha de campos
            int QtdCaracterLinha = 120;
            int Tamanho;
            int QtdLin;
            int StrInicio;
            int StrFim;
            int cl;

            // Adiciona Página
            pdfDocument myDoc  = new pdfDocument("Horizon", "Orion");
            pdfPage     myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);

            CabRelatorio(myDoc, myPage, top, NoObra);
            top += 40;

            // Create Table
            pdfTable myTable;

            // Create Table Row
            pdfTableRow myRow;

            string TipoAtividade  = table.Rows[0]["cmpCoTipoAtividade"].ToString();
            string GrupoAtividade = table.Rows[0]["cmpCoGrupoAtividade"].ToString();
            string Periodicidade  = table.Rows[0]["cmpCoPeriodicidade"].ToString();

            myTable = SubCabRelatorio(myDoc, myPage, top, table.Rows[0]["cmpDcTipoAtividade"].ToString(), table.Rows[0]["cmpDcGrupoAtividade"].ToString(), table.Rows[0]["cmpDcPeriodicidade"].ToString());
            top    += 90;

            int i = 1;

            foreach (DataRow row in table.Rows)
            {
                cl = 0;
                if (TipoAtividade != row["cmpCoTipoAtividade"].ToString() ||
                    GrupoAtividade != row["cmpCoGrupoAtividade"].ToString() ||
                    Periodicidade != row["cmpCoPeriodicidade"].ToString())
                {
                    TipoAtividade  = row["cmpCoTipoAtividade"].ToString();
                    GrupoAtividade = row["cmpCoGrupoAtividade"].ToString();
                    Periodicidade  = row["cmpCoPeriodicidade"].ToString();

                    myPage.addTable(myTable);

                    if (pg == 2 && i == 0)
                    {
                        break;
                    }

                    top += 20;

                    myTable = SubCabRelatorio(myDoc, myPage, top, row["cmpDcTipoAtividade"].ToString(), row["cmpDcGrupoAtividade"].ToString(), row["cmpDcPeriodicidade"].ToString());
                    top    += 90;
                    cl      = 0;
                    i++;
                }

                myRow          = myTable.createRow();
                myRow.rowStyle = myTable.rowStyle;

                row["cmpDcItemAtividadePreventiva"] = TiraCaractEspecial(row["cmpDcItemAtividadePreventiva"].ToString());

                Tamanho = row["cmpDcItemAtividadePreventiva"].ToString().Length;

                if (Tamanho > 0)
                {
                    QtdLin    = (Tamanho % QtdCaracterLinha == 0 ? Tamanho / QtdCaracterLinha : (Tamanho / QtdCaracterLinha) + 1);
                    StrInicio = 0;

                    for (int Linha = 1; Linha <= QtdLin; Linha++)
                    {
                        StrFim = Linha == QtdLin ? Tamanho - StrInicio : QtdCaracterLinha;
                        if (Linha == 1)
                        {
                            myRow[cl++].addText(row["cmpDcItemAtividadePreventiva"].ToString().Substring(StrInicio, StrFim).Trim());
                        }
                        else
                        {
                            cl             = 0;
                            myRow          = myTable.createRow();
                            myRow.rowStyle = myTable.rowStyle;
                            myRow[cl++].addText(row["cmpDcItemAtividadePreventiva"].ToString().Substring(StrInicio, StrFim).Trim());
                        }
                        myTable.addRow(myRow);
                        StrInicio += QtdCaracterLinha;
                        top       += nTamLinPixel;
                        //if (top % 3 == 0)
                        //    top -= 3;
                    }
                }

                if (top > 700)       //(top > 1230)
                {
                    myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 10, pdfColor.Black);
                    myPage.addTable(myTable);

                    // Adiciona uma página
                    myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);
                    top    = 40;
                    CabRelatorio(myDoc, myPage, top, NoObra);
                    top += 40;

                    myTable = SubCabRelatorio(myDoc, myPage, top, row["cmpDcTipoAtividade"].ToString(), row["cmpDcGrupoAtividade"].ToString(), row["cmpDcPeriodicidade"].ToString());
                    top     = +90;

                    if (pg == 2)
                    {
                        i = 0;
                    }
                }
                //if (pg == 3)
                //    break;
            }

            return(myDoc);
        }
Пример #16
0
        public static pdfDocument ImprimeCapaRostoOS(DataTable table, string DataInicial, string DataFinal)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;
            int    pg         = 1;
            int    top        = 40;
            //Tamanho da lin em pixel
            int nTamLinPixel = 19;

            // Variaveis de controle para quebra de linha de campos
            int QtdCaracterLinha = 50;
            int Tamanho;
            int QtdLin;
            int StrInicio;
            int StrFim;
            int cl;

            DataTable DtTotMatOs;
            decimal   TotMatOs = 0;

            TotMaterial totalMat = new TotMaterial();

            totalMat.Adicionar(table);

            decimal ValorBdiLucro   = totalMat.Valor * decimal.Parse(table.Rows[0]["cmpPeBDILucro"].ToString()) / 100;
            decimal ValorBdiTributo = totalMat.Valor * decimal.Parse(table.Rows[0]["cmpPeBDITributos"].ToString()) / 100;

            decimal TotalMaterialLucroTributo = totalMat.Valor + ValorBdiLucro + ValorBdiTributo;

            // Adiciona Página
            pdfDocument myDoc  = new pdfDocument("Horizon", "Orion");
            pdfPage     myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);

            string DadosObra = (table.Rows[0]["cmpNoObra"].ToString().Trim() + (table.Rows[0]["cmpNuContrato"] != null ? " -> Contrato nº " + table.Rows[0]["cmpNuContrato"].ToString() : ""));

            CabRelatorio(myDoc, myPage, top, DadosObra, DataInicial, DataFinal);
            top += 30;

            #region Resultado Financeiro
            //Imprime Total Geral de Material
            pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White));
            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);

            cl = 0;
            myTable.tableHeader.rowHeight = 10;
            myTable.tableHeader.addColumn(400, predefinedAlignment.csRight);
            myTable.tableHeader[cl++].addText("Total do Material R$ ");

            myTable.tableHeader.addColumn(150, predefinedAlignment.csRight);
            myTable.tableHeader[cl++].addText(totalMat.Valor.ToString("0,0.00"));
            top += 20;

            // Create Table Row
            pdfTableRow myRow = myTable.createRow();
            cl    = 0;
            myRow = myTable.createRow();
            myRow[cl].columnAlign = predefinedAlignment.csRight;
            myRow[cl++].addText("Lucro + Despesas Administrativas (" + table.Rows[0]["cmpPeBDILucro"].ToString() + "%)");
            myRow[cl++].addText(ValorBdiLucro.ToString("0,0.00"));
            myTable.addRow(myRow);

            top  += 20;
            cl    = 0;
            myRow = myTable.createRow();
            myRow[cl].columnAlign = predefinedAlignment.csRight;
            myRow[cl++].addText("Tributos (" + table.Rows[0]["cmpPeBDITributos"].ToString() + "%)");
            myRow[cl++].addText(ValorBdiTributo.ToString("0,0.00"));
            myTable.addRow(myRow);

            top  += 20;
            cl    = 0;
            myRow = myTable.createRow();
            myRow[cl].columnAlign = predefinedAlignment.csRight;
            myRow[cl++].addText("Total (Material + Lucro + Tributos)");
            myRow[cl++].addText(TotalMaterialLucroTributo.ToString("0,0.00"));
            myTable.addRow(myRow);

            myPage.addTable(myTable);
            #endregion

            top    += 10;
            myTable = SubCabRelatorio(myDoc, myPage, top);
            top    += 10;

            // Imprimir linhas de detalhes
            myRow = myTable.createRow();

            foreach (DataRow row in table.Rows)
            {
                DtTotMatOs = tblOSMaterial.RetornarTotalMatOS(Global.GetConnection(), row["cmpIdOs"].ToString());
                TotMatOs   = DtTotMatOs.Rows[0]["TotalMaterial"].ToString() != "" ? decimal.Parse(DtTotMatOs.Rows[0]["TotalMaterial"].ToString()) : 0;

                cl             = 0;
                myRow          = myTable.createRow();
                myRow.rowStyle = myTable.rowStyle;

                myRow[cl++].addText(row["cmpNuOs"].ToString());
                myRow[cl++].addText(row["cmpNoSolicitante"].ToString().TrimEnd());

                row["cmpDcObservacoes"] = TiraCaractEspecial(row["cmpDcObservacoes"].ToString().ToUpper());

                Tamanho = row["cmpDcObservacoes"].ToString().Length;

                if (Tamanho > 0)
                {
                    QtdLin    = (Tamanho % QtdCaracterLinha == 0 ? Tamanho / QtdCaracterLinha : (Tamanho / QtdCaracterLinha) + 1);
                    StrInicio = 0;

                    for (int Linha = 1; Linha <= QtdLin; Linha++)
                    {
                        StrFim = Linha == QtdLin ? Tamanho - StrInicio : QtdCaracterLinha;
                        if (Linha == 1)
                        {
                            myRow[cl++].addText(row["cmpDcObservacoes"].ToString().Substring(StrInicio, StrFim).Trim());
                            myRow[cl++].addText(row["cmpDcLocal"].ToString());
                            myRow[cl++].addText(row["cmpDtAbertura"].ToString().Substring(0, 10));
                            myRow[cl++].addText(row["cmpDtConclusaoAtendimento"].ToString() == "" ? "" : row["cmpDtConclusaoAtendimento"].ToString().Substring(0, 10));
                            myRow[cl++].addText(TotMatOs.ToString("0,0.00"));
                        }
                        else
                        {
                            cl             = 0;
                            myRow          = myTable.createRow();
                            myRow.rowStyle = myTable.rowStyle;
                            myRow[cl++].addText("");
                            myRow[cl++].addText("");
                            myRow[cl++].addText(row["cmpDcObservacoes"].ToString().Substring(StrInicio, StrFim).Trim());
                            myRow[cl++].addText("");
                            myRow[cl++].addText("");
                            myRow[cl++].addText("");
                            myRow[cl++].addText("");
                        }
                        myTable.addRow(myRow);
                        StrInicio += QtdCaracterLinha;
                        top       += nTamLinPixel;
                    }
                }
                else
                {
                    myRow[cl++].addText(row["cmpDcDescricaoSolicitacao"].ToString().TrimEnd());
                    myRow[cl++].addText(row["cmpDcLocal"].ToString());
                    myRow[cl++].addText(row["cmpDtAbertura"].ToString().Substring(0, 10));
                    myRow[cl++].addText(row["cmpDtConclusaoAtendimento"].ToString() == "" ? "" : row["cmpDtConclusaoAtendimento"].ToString().Substring(0, 10));
                    myRow[cl++].addText(TotMatOs.ToString("0,0.00"));
                    myTable.addRow(myRow);
                    top += nTamLinPixel;
                }

                if (top > 1230)
                {
                    myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 10, pdfColor.Black);
                    myPage.addTable(myTable);

                    // Adiciona uma página
                    myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);
                    top    = 30;
                    CabRelatorio(myDoc, myPage, top, DadosObra, DataInicial, DataFinal);
                    top    += 30;
                    myTable = SubCabRelatorio(myDoc, myPage, top);
                    top     = +10;
                }
            }

            if (top < 1230)
            {
                //Imprime Total Geral de Material
                myRow          = myTable.createRow();
                myRow.rowStyle = myTable.rowStyle;
                cl             = 0;
                myRow[cl++].addText("");
                myRow[cl++].addText("");
                myRow[cl++].addText("");
                myRow[cl++].addText("");
                myRow[cl++].addText("");
                myRow[cl++].addText("Total ==>");
                myRow[cl++].addText(totalMat.Valor.ToString("0,0.00"));
                myTable.addRow(myRow);

                myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 10, pdfColor.Black);
                myPage.addTable(myTable);
            }

            return(myDoc);
        }
Пример #17
0
        public static pdfDocument ImprimePlano(DataTable table, string NoObra)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;
            int    pg         = 1;
            int    top        = 40;
            //Tamanho da lin em pixel
            int nTamLinPixel = 19;

            // Variaveis de controle para quebra de linha de campos
            int QtdCaracterLinha = 100;
            int Tamanho;
            int QtdLin;
            int StrInicio;
            int StrFim;
            int cl;

            // Adiciona Página
            pdfDocument myDoc  = new pdfDocument("Horizon", "Orion");
            pdfPage     myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);

            string DadosObra = NoObra;

            CabRelatorio(myDoc, myPage, top, DadosObra);
            top += 30;

            pdfTable myTable = SubCabRelatorio(myDoc, myPage, top);

            top += 10;

            string TipoAtividade  = "";
            string GrupoAtividade = "";
            string Periodicidade  = "";

            // Imprimir linhas de detalhes
            pdfTableRow myRow = myTable.createRow();

            try
            {
                foreach (DataRow row in table.Rows)
                {
                    cl             = 0;
                    myRow          = myTable.createRow();
                    myRow.rowStyle = myTable.rowStyle;

                    if (TipoAtividade != row["cmpCoTipoAtividade"].ToString())
                    {
                        row["cmpDcTipoAtividade"] = TiraCaractEspecial(row["cmpDcTipoAtividade"].ToString());
                        myRow[cl++].addText(row["cmpDcTipoAtividade"].ToString().TrimEnd());
                        TipoAtividade = row["cmpCoTipoAtividade"].ToString();
                    }
                    else
                    {
                        myRow[cl++].addText("");
                    }

                    if (GrupoAtividade != row["cmpCoGrupoAtividade"].ToString())
                    {
                        row["cmpDcGrupoAtividade"] = TiraCaractEspecial(row["cmpDcGrupoAtividade"].ToString());
                        myRow[cl++].addText(row["cmpDcGrupoAtividade"].ToString().TrimEnd());
                        GrupoAtividade = row["cmpCoGrupoAtividade"].ToString();
                    }
                    else
                    {
                        myRow[cl++].addText("");
                    }

                    if (Periodicidade != row["cmpCoPeriodicidade"].ToString())
                    {
                        myRow[cl++].addText(row["cmpDcPeriodicidade"].ToString());
                        Periodicidade = row["cmpCoPeriodicidade"].ToString();
                    }
                    else
                    {
                        myRow[cl++].addText("");
                    }

                    row["cmpDcItemAtividadePreventiva"] = TiraCaractEspecial(row["cmpDcItemAtividadePreventiva"].ToString());

                    Tamanho = row["cmpDcItemAtividadePreventiva"].ToString().Length;

                    if (Tamanho > 0)
                    {
                        QtdLin    = (Tamanho % QtdCaracterLinha == 0 ? Tamanho / QtdCaracterLinha : (Tamanho / QtdCaracterLinha) + 1);
                        StrInicio = 0;

                        for (int Linha = 1; Linha <= QtdLin; Linha++)
                        {
                            StrFim = Linha == QtdLin ? Tamanho - StrInicio : QtdCaracterLinha;
                            if (Linha == 1)
                            {
                                myRow[cl++].addText(row["cmpDcItemAtividadePreventiva"].ToString().Substring(StrInicio, StrFim).Trim());
                            }
                            else
                            {
                                cl             = 0;
                                myRow          = myTable.createRow();
                                myRow.rowStyle = myTable.rowStyle;
                                myRow[cl++].addText("");
                                myRow[cl++].addText("");
                                myRow[cl++].addText("");
                                myRow[cl++].addText(row["cmpDcItemAtividadePreventiva"].ToString().Substring(StrInicio, StrFim).Trim());
                            }
                            myTable.addRow(myRow);
                            StrInicio += QtdCaracterLinha;
                            top       += nTamLinPixel;
                        }
                    }
                    //else
                    //{
                    //    myRow[cl++].addText(row["cmpDcDescricaoSolicitacao"].ToString().TrimEnd());
                    //    myRow[cl++].addText(row["cmpDcLocal"].ToString());
                    //    myRow[cl++].addText(row["cmpDtAbertura"].ToString().Substring(0, 10));
                    //    myRow[cl++].addText(row["cmpDtConclusaoAtendimento"].ToString() == "" ? "" : row["cmpDtConclusaoAtendimento"].ToString().Substring(0, 10));
                    //    myTable.addRow(myRow);
                    //    top += nTamLinPixel;
                    //}

                    if (top > 1250)
                    {
                        myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 10, pdfColor.Black);
                        myPage.addTable(myTable);

                        // Adiciona uma página
                        myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);
                        top    = 30;
                        CabRelatorio(myDoc, myPage, top, DadosObra);
                        top    += 30;
                        myTable = SubCabRelatorio(myDoc, myPage, top);
                        top     = +10;
                    }
                }

                if (top < 1250)
                {
                    myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 10, pdfColor.Black);
                    myPage.addTable(myTable);
                }
            }
            catch (Exception ex)
            {
                Global.ShowError(Global.Title, ex);
            }

            return(myDoc);
        }
Пример #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HzConexao c = new HzConexao(@"192.168.200.170\desenv", "sa", "rona3007", "HzManutencao", "System.Data.SqlClient");

            String strFont      = "Helvetica";
            int    leftMargin   = 30;
            int    topMargin    = 30;
            int    bottomMargin = 30;
            int    lineHeight   = 20;
            int    linesPerPage;

            pdfDocument myDoc = new pdfDocument("Horizon", "Orion");
            // Add a page
            pdfPage myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);

            // Load an image (I was able to load JPEG, GIF, TIFF, and BMP formats)
            //myDoc.addImageReference(Server.MapPath("~/Assets/Images/Sample.gif"), "ex");
            //myPage.addImage(myDoc.getImageReference("ex"), leftMargin, getTop(myPage, 120));

            // Header Text
            myPage.addText("Ordem de Serviço", leftMargin, getTop(myPage, 30),
                           myDoc.getFontReference(strFont), 15, pdfColor.Black);

            // Body Text
            //myPage.addText("Divisão de Administração Predial, Obras e Instalações", leftMargin, getTop(myPage, 50),
            //               myDoc.getFontReference(strFont), 10, pdfColor.Black);
            //myPage.addText("Relatório emitido em: " + DateTime.Now.ToShortDateString(), leftMargin, getTop(myPage, 70),
            //               myDoc.getFontReference(strFont), 10, pdfColor.Black);

            //pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
            //                                new pdfTableStyle(myDoc.getFontReference(strFont),
            //                                10, pdfColor.Black, new pdfColor("d9d1b3")),
            //                                new pdfTableStyle(myDoc.getFontReference(strFont),
            //                                10, pdfColor.Black, pdfColor.White),
            //                                new pdfTableStyle(myDoc.getFontReference(strFont),
            //                                10, pdfColor.Black, pdfColor.White));

            int q   = 0;
            int pg  = 1;
            int top = 40;

            using (DataTable table = c.loadDataTable("select * from HzManutencao..vwATE_OS where cmpIdOS = 1"))
            {
                if (table != null && table.Rows.Count > 0)
                {
                    DataRow r = table.Rows[0];

                    pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                                    new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White));

                    myTable.coordX = leftMargin;
                    myTable.coordY = getTop(myPage, top);

                    //// Create table's header
                    int cl = 0;
                    myTable.tableHeader.rowHeight = 10;
                    myTable.tableHeader.addColumn(150, predefinedAlignment.csLeft);
                    myTable.tableHeader[cl++].addText("Nº O.S.");

                    myTable.tableHeader.addColumn(420, predefinedAlignment.csLeft);
                    myTable.tableHeader[cl].columnAlign = predefinedAlignment.csLeft;
                    myTable.tableHeader[cl++].addText(r["cmpNuOS"].ToString());

                    // Create Table Row
                    pdfTableRow myRow = myTable.createRow();
                    cl    = 0;
                    myRow = myTable.createRow();
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Data Solicitação:");
                    myRow[cl++].addText(r["cmpDtAbertura"].ToString().Trim());
                    myTable.addRow(myRow);

                    cl    = 0;
                    myRow = myTable.createRow();
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Obra:");
                    myRow[cl++].addText(r["cmpNoObra"].ToString().Trim() + (r["cmpNuContrato"] != null ? " -> Contrato nº " + r["cmpNuContrato"].ToString() : ""));
                    myTable.addRow(myRow);

                    cl    = 0;
                    myRow = myTable.createRow();
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Soliciante:");
                    myRow[cl++].addText(r["cmpNoSolicitante"].ToString().Trim());
                    myTable.addRow(myRow);

                    cl    = 0;
                    myRow = myTable.createRow();
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Local:");
                    myRow[cl++].addText(r["cmpDcLocal"].ToString().Trim());
                    myTable.addRow(myRow);

                    cl    = 0;
                    myRow = myTable.createRow();
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Setor:");
                    myRow[cl++].addText(r["cmpNoSetor"].ToString().Trim());
                    myTable.addRow(myRow);

                    cl    = 0;
                    myRow = myTable.createRow();
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Data Início:");
                    myRow[cl++].addText(r["cmpDtInicioAtendimento"].ToString() != "" ? DateTime.Parse(r["cmpDtInicioAtendimento"].ToString()).ToString("dd/MM/yyyy HH:mm") : "");
                    myTable.addRow(myRow);

                    cl    = 0;
                    myRow = myTable.createRow();
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Data Conclusão:");
                    myRow[cl++].addText(r["cmpDtConclusaoAtendimento"].ToString() != "" ? DateTime.Parse(r["cmpDtConclusaoAtendimento"].ToString()).ToString("dd/MM/yyyy HH:mm") : "");
                    myTable.addRow(myRow);

                    cl    = 0;
                    myRow = myTable.createRow();
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Descrição do Serviço:");
                    myRow[cl++].addText(r["cmpDcDescricaoSolicitacao"].ToString().Trim());
                    myTable.addRow(myRow);

                    cl                    = 0;
                    myRow                 = myTable.createRow();
                    myRow.rowHeight       = 50;
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Verificação do Serviço:");
                    myRow[cl++].addText(r["cmpDcObservacaoConclusao"].ToString().Trim());
                    myTable.addRow(myRow);
                    top += 10 * 9;

                    myPage.addTable(myTable);

                    top += 100;
                    myPage.addText("Material Utilizado", leftMargin, this.getTop(myPage, top), myDoc.getFontReference(strFont), 10, pdfColor.Black);
                    top += 12;

                    string sql = "select * from HzManutencao..vwATE_OSMaterial where cmpIdOS = " + r["cmpIdOS"].ToString();
                    using (DataTable tblMat = Global.GetConnection().loadDataTable(sql))
                    {
                        if (tblMat != null && tblMat.Rows.Count > 0)
                        {
                            myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 8, pdfColor.Black, new pdfColor("FFFFFF")),
                                                   new pdfTableStyle(myDoc.getFontReference(strFont), 8, pdfColor.Black, pdfColor.White));

                            myTable.coordX = leftMargin;
                            //top = 210;
                            myTable.coordY = getTop(myPage, top);

                            //// Create table's header
                            cl = 0;
                            myTable.tableHeader.rowHeight = 10;
                            myTable.tableHeader.addColumn(350, predefinedAlignment.csLeft);
                            myTable.tableHeader[cl++].addText("Descrição");

                            myTable.tableHeader.addColumn(30, predefinedAlignment.csCenter);
                            myTable.tableHeader[cl].columnAlign = predefinedAlignment.csCenter;
                            myTable.tableHeader[cl++].addText("Unid");

                            myTable.tableHeader.addColumn(50, predefinedAlignment.csRight);
                            myTable.tableHeader[cl].columnAlign = predefinedAlignment.csRight;
                            myTable.tableHeader[cl++].addText("Qtd.");

                            myTable.tableHeader.addColumn(50, predefinedAlignment.csRight);
                            myTable.tableHeader[cl].columnAlign = predefinedAlignment.csRight;
                            myTable.tableHeader[cl++].addText("Preço");

                            myTable.tableHeader.addColumn(90, predefinedAlignment.csRight);
                            myTable.tableHeader[cl].columnAlign = predefinedAlignment.csRight;
                            myTable.tableHeader[cl++].addText("Sub-Total");
                            top += 15;

                            float total = 0f;
                            foreach (DataRow row in tblMat.Rows)
                            {
                                // Create Table Row
                                myRow = myTable.createRow();
                                cl    = 0;
                                myRow = myTable.createRow();
                                myRow[cl].columnAlign = predefinedAlignment.csLeft;
                                myRow[cl++].addText(row["DcMaterial"].ToString().Trim());
                                myRow[cl++].addText(row["cmpDcUnidade"].ToString().Trim());
                                myRow[cl++].addText(decimal.Parse(row["cmpQtMaterial"].ToString()).ToString("0,0.00"));
                                myRow[cl++].addText(decimal.Parse(row["cmpVlMaterial"].ToString()).ToString("0,0.00"));
                                myRow[cl++].addText(decimal.Parse(row["cmpVlSubTotal"].ToString()).ToString("0,0.00"));
                                total += float.Parse(row["cmpVlSubTotal"].ToString());
                                myTable.addRow(myRow);
                                top += 12;
                            }
                            myPage.addTable(myTable);
                            top += 3;

                            myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                                   new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White));

                            myTable.coordX = leftMargin;
                            myTable.coordY = getTop(myPage, top);

                            //// Create table's header
                            cl = 0;
                            myTable.tableHeader.rowHeight = 10;
                            myTable.tableHeader.addColumn(570, predefinedAlignment.csRight);
                            //IFormatProvider fp = new CultureInfo("pt-BR", true);
                            myTable.tableHeader[cl++].addText("Total: " + total.ToString("0,0.00"));
                            top += 17;
                            myPage.addTable(myTable);
                        }
                    }


                    myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                           new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White));

                    myTable.coordX = leftMargin;
                    myTable.coordY = getTop(myPage, top);

                    //// Create table's header
                    cl = 0;
                    myTable.tableHeader.rowHeight        = 30;
                    myTable.tableHeader.rowVerticalAlign = predefinedVerticalAlignment.csTop;
                    myTable.tableHeader.addColumn(570, predefinedAlignment.csLeft);
                    myTable.tableHeader[cl].columnVerticalAlign = predefinedVerticalAlignment.csTop;
                    myTable.tableHeader[cl++].addText("Conclusão/Aceite do Solicitante");
                    top += 30;

                    cl                    = 0;
                    myRow                 = myTable.createRow();
                    myRow.rowHeight       = 10;
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Data: " + DateTime.Now.ToShortDateString() + " às " + DateTime.Now.ToShortTimeString());
                    myTable.addRow(myRow);
                    top += 15;

                    cl                    = 0;
                    myRow                 = myTable.createRow();
                    myRow.rowHeight       = 10;
                    myRow[cl].columnAlign = predefinedAlignment.csLeft;
                    myRow[cl++].addText("Satisfeito com o serviço: " + "__Sim         __Não");
                    myTable.addRow(myRow);
                    top += 15;

                    myPage.addTable(myTable);

                    myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                           new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White));

                    myTable.coordX = leftMargin;
                    myTable.coordY = getTop(myPage, top);

                    cl = 0;
                    myTable.tableHeader.rowHeight        = 50;
                    myTable.tableHeader.rowVerticalAlign = predefinedVerticalAlignment.csBottom;
                    myTable.tableHeader.addColumn(285, predefinedAlignment.csCenter);
                    myTable.tableHeader[cl].columnVerticalAlign = predefinedVerticalAlignment.csBottom;
                    myTable.tableHeader[cl++].addText("De acordo Empresa");

                    myTable.tableHeader.addColumn(285, predefinedAlignment.csCenter);
                    myTable.tableHeader[cl].columnVerticalAlign = predefinedVerticalAlignment.csBottom;
                    myTable.tableHeader[cl].addText("De acordo Gestor");

                    myPage.addTable(myTable);

                    myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 5, pdfColor.Black);
                    //string nomepdf = "c:\\Horizon\\Ocr\\Relatorios\\" + "Relatorio_" + (txtPlacaRelatorio.Text != "" ? txtPlacaRelatorio.Text : "Todas") + "_" + retornaDataRelatorio(txtDataInicial.Text) + "_" + retornaDataRelatorio(txtDataFinal.Text) + ".pdf";
                    string nomepdf = Server.MapPath("pdf" + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Millisecond.ToString() + ".pdf");
                    myDoc.createPDF(nomepdf);
                    System.Diagnostics.Process.Start(nomepdf);
                }
            }
            ++q;

            //if (q == 30)
            //{
            //    myPage.addText("Pág. " + pg++, leftMargin, 10,
            //                    myDoc.getFontReference(strFont), 5, pdfColor.Black);
            //    myPage.addTable(myTable);
            //    myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);
            //    q = 0;
            //    myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 5,
            //                                    new pdfTableStyle(myDoc.getFontReference(strFont),
            //                                    10, pdfColor.Black, new pdfColor("d9d1b3")),
            //                                    new pdfTableStyle(myDoc.getFontReference(strFont),
            //                                    10, pdfColor.Black, pdfColor.White),
            //                                    new pdfTableStyle(myDoc.getFontReference(strFont),
            //                                    10, pdfColor.Black, pdfColor.White));
            //    myTable.coordX = leftMargin;
            //    myTable.coordY = getTop(myPage, 100);

            //    // Create table's header
            //    myTable.tableHeader.rowHeight = 10;
            //    c = 0;
            //    myTable.tableHeader.addColumn(100, predefinedAlignment.csCenter);
            //    myTable.tableHeader[c++].addText("Placa");
            //    if (rdbAcesso.IsChecked.Value)
            //    {
            //        myTable.tableHeader.addColumn(200, predefinedAlignment.csLeft);
            //        myTable.tableHeader[c++].addText("Nome");
            //    }
            //    myTable.tableHeader.addColumn(150, predefinedAlignment.csCenter);
            //    myTable.tableHeader[c++].addText("Data");
            //    if (rdbAcesso.IsChecked.Value)
            //    {
            //        myTable.tableHeader.addColumn(100, predefinedAlignment.csCenter);
            //        myTable.tableHeader[c].addText("Cancela");
            //    }

            //    myPage.addText("Procuradoria Geral da República", leftMargin, getTop(myPage, 30),
            //                    myDoc.getFontReference(strFont), 20, pdfColor.Black);

            //    // Body Text
            //    myPage.addText("Relatório dos Acessos à Garagem", leftMargin, getTop(myPage, 50),
            //                   myDoc.getFontReference(strFont), 10, pdfColor.Black);
            //    myPage.addText("Relatório emitido em: " + DateTime.Now.ToShortDateString(), leftMargin, getTop(myPage, 70),
            //                   myDoc.getFontReference(strFont), 10, pdfColor.Black);
            //}
        }
Пример #19
0
        public static pdfDocument ImprimeAtividades(DataTable table, string NomeObra, string TipoAtividade, string Periodicidade)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;
            int    pg         = 1;
            int    top        = 20;
            //Tamanho da lin em pixel
            int nTamLinPixel = 19;

            // Variaveis de controle para quebra de linha de campos
            int QtdCaracterLinha = 50;
            int Tamanho;
            int QtdLin;
            int StrInicio;
            int StrFim;
            int cl;

            // Adiciona Página
            pdfDocument myDoc  = new pdfDocument("Horizon", "Orion");
            pdfPage     myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);

            CabRelatorio(myDoc, myPage, top, NomeObra, TipoAtividade, Periodicidade);
            top += 50;

            SubCabRelatorio(myDoc, myPage, top, table.Rows[0]["cmpCoObra"].ToString(), table.Rows[0]["cmpCoPreventiva"].ToString());
            top += 20;

            DataTable table2 = tblPreventivaAtividade.RetornaFormPreventivaPivot(Global.GetConnection(), table.Rows[0]["cmpCoPreventiva"].ToString(), table.Rows[0]["cmpCoObra"].ToString());

            pdfTable myTable;

            string GrupoAtividade = "";

            foreach (DataRow row in table2.Rows)
            {
                row["cmpDcGrupoAtividade"] = TiraCaractEspecial(row["cmpDcGrupoAtividade"].ToString().TrimEnd());

                if (row["cmpDcGrupoAtividade"].ToString() != GrupoAtividade)
                {
                    GrupoAtividade = row["cmpDcGrupoAtividade"].ToString();
                    ImprimeGrupo(myDoc, myPage, top, GrupoAtividade);
                    top += 10;
                }

                // Imprimir Itens do grupo atividade
                myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                       new pdfTableStyle(myDoc.getFontReference(strFont), 5, pdfColor.Black, new pdfColor("FFFFFF")),
                                       new pdfTableStyle(myDoc.getFontReference(strFont), 5, pdfColor.Black, pdfColor.White));

                myTable.coordX = leftMargin;
                myTable.coordY = getTop(myPage, top);
                cl             = 0;
                myTable.tableHeader.addColumn(190, predefinedAlignment.csLeft);
                myTable.tableHeader.rowHeight = 10;
                myTable.tableHeader[cl].addText(TiraCaractEspecial(row["cmpDcItemAtividadePreventiva"].ToString()));

                for (int i = 2; i <= 23; ++i)
                {
                    myTable.tableHeader.addColumn(16, predefinedAlignment.csCenter);
                    myTable.tableHeader[cl++].addText("");
                }

                myPage.addTable(myTable);
                top += 10;
            }

            top    += 20;
            myTable = ConclusaoRelatorio(myDoc, myPage, top);

            myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 10, pdfColor.Black);
            myPage.addTable(myTable);

            return(myDoc);
        }
Пример #20
0
        protected static pdfTable ConclusaoRelatorio(pdfDocument myDoc, pdfPage myPage, int top)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;

            pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White));

            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);
            int cl = 0;

            myTable.tableHeader.rowHeight = 15;
            myTable.tableHeader.addColumn(550, predefinedAlignment.csCenter);
            myTable.tableHeader[cl].addText("Responsável pela Execução dos Serviços");
            myPage.addTable(myTable);

            top    += 15;
            myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White));
            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);
            cl             = 0;
            myTable.tableHeader.rowHeight = 15;
            myTable.tableHeader.addColumn(275, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("Nome do Técnico:");
            myTable.tableHeader.rowHeight = 15;
            myTable.tableHeader.addColumn(275, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("Data: _____________________________, ____/____/" + DateTime.Now.Year);
            myPage.addTable(myTable);

            top    += 15;
            myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White));
            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);
            cl             = 0;
            myTable.tableHeader.rowHeight = 15;
            myTable.tableHeader.addColumn(275, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("Hora de Entrada: ________________");
            myTable.tableHeader.rowHeight = 15;
            myTable.tableHeader.addColumn(275, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("Hora da Saída: ______________");
            myPage.addTable(myTable);

            top    += 30;
            myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White));
            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);
            cl             = 0;
            myTable.tableHeader.rowHeight = 15;
            myTable.tableHeader.addColumn(550, predefinedAlignment.csCenter);
            myTable.tableHeader[cl].addText("Conclusão / Aceite do Cliente");
            myPage.addTable(myTable);

            top    += 15;
            myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White));

            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);
            cl             = 0;
            myTable.tableHeader.rowHeight = 15;
            myTable.tableHeader.addColumn(550, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("Nome do Cliente:                                                                                                    Data:");

            pdfTableRow myRow;

            cl             = 0;
            myRow          = myTable.createRow();
            myRow.rowStyle = myTable.rowStyle;
            myRow[cl].addText("Satisfeito com o serviço? _________ Sim    _________ Não");
            myTable.addRow(myRow);
            myRow = myTable.createRow();
            myRow[cl].addText("Comentários: ");
            myTable.addRow(myRow);
            myRow = myTable.createRow();
            myRow[cl].addText("");
            myTable.addRow(myRow);
            myRow = myTable.createRow();
            myRow[cl].addText("");
            myTable.addRow(myRow);
            myRow = myTable.createRow();
            myRow[cl].addText("");
            myTable.addRow(myRow);
            myRow = myTable.createRow();
            myRow[cl].addText("");
            myTable.addRow(myRow);
            myRow = myTable.createRow();
            myRow[cl].addText("");
            myTable.addRow(myRow);
            myRow = myTable.createRow();
            myRow[cl].addText("");
            myTable.addRow(myRow);
            myRow = myTable.createRow();
            myRow[cl].addText("");
            myTable.addRow(myRow);

            return(myTable);
        }
Пример #21
0
        public pdfDocument ImprimeAgenda(DataTable table, string NoObra, string DtInicial, string DtFinal)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;
            int    pg         = 1;
            int    top        = 40;
            //Tamanho da lin em pixel
            int nTamLinPixel = 12;

            // Variaveis de controle para quebra de linha de campos
            int QtdCaracterLinha = 145;
            int Tamanho;
            int QtdLin;
            int StrInicio;
            int StrFim;
            int cl;

            // Adiciona Página
            pdfDocument myDoc  = new pdfDocument("Horizon", "Orion");
            pdfPage     myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);
            pdfTable    myTable;
            pdfTableRow myRow;

            DataTable  table2;
            DataColumn column;

            string DadosObra = NoObra;
            int    qtdReg;

            foreach (DataRow row in table.Rows)
            {
                top = 40;
                CabRelatorio(myDoc, myPage, top, DadosObra, DtInicial, DtFinal);
                top += 55;

                SubCabRelatorio(myDoc, myPage, top, row);
                top += 32;

                column = table.Columns["cmpCoPreventiva"];

                table2 = tblPreventivaAtividade.Get(Global.GetConnection(), row[column].ToString());

                string GrupoAtividade = "";
                qtdReg = 0;

                foreach (DataRow row2 in table2.Rows)
                {
                    row2["cmpDcGrupoAtividade"] = TiraCaractEspecial(row2["cmpDcGrupoAtividade"].ToString());

                    if (row2["cmpDcGrupoAtividade"].ToString() != GrupoAtividade)
                    {
                        qtdReg         = 0;
                        GrupoAtividade = row2["cmpDcGrupoAtividade"].ToString();
                        ImprimeGrupo(myDoc, myPage, top, GrupoAtividade);
                        top += 20;

                        ItensAtividade(myDoc, myPage, top);
                        top += 20;
                    }

                    cl = 0;
                    row2["cmpDcItemAtividadePreventiva"] = TiraCaractEspecial(row2["cmpDcItemAtividadePreventiva"].ToString());
                    Tamanho = row2["cmpDcItemAtividadePreventiva"].ToString().Length;

                    if (Tamanho > 0)
                    {
                        QtdLin    = (Tamanho % QtdCaracterLinha == 0 ? Tamanho / QtdCaracterLinha : (Tamanho / QtdCaracterLinha) + 1);
                        StrInicio = 0;

                        cl = 0;
                        for (int Linha = 1; Linha <= QtdLin; Linha++)
                        {
                            myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                                   new pdfTableStyle(myDoc.getFontReference(strFont), 8, pdfColor.Black, new pdfColor("FFFFFF")),
                                                   new pdfTableStyle(myDoc.getFontReference(strFont), 8, pdfColor.Black, pdfColor.White));

                            myTable.coordX = leftMargin;
                            myTable.coordY = getTop(myPage, top);
                            myTable.tableHeader.rowHeight = 10;
                            myTable.tableHeader.addColumn(550, predefinedAlignment.csLeft);

                            StrFim = Linha == QtdLin ? Tamanho - StrInicio : QtdCaracterLinha;

                            myTable.tableHeader[cl].addText(row2["cmpDcItemAtividadePreventiva"].ToString().Substring(StrInicio, StrFim).Trim());

                            myPage.addTable(myTable);

                            StrInicio += QtdCaracterLinha;
                            top       += nTamLinPixel;
                            qtdReg++;

                            if (top > 700)
                            {
                                myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 10, pdfColor.Black);

                                // Adiciona uma página
                                myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);

                                top = 40;
                                CabRelatorio(myDoc, myPage, top, DadosObra, DtInicial, DtFinal);
                                top += 30;
                                if (qtdReg <= table2.Rows.Count)
                                {
                                    SubCabRelatorio(myDoc, myPage, top, row);
                                    top += 32;
                                    ImprimeGrupo(myDoc, myPage, top, GrupoAtividade);
                                    top += 20;
                                    ItensAtividade(myDoc, myPage, top);
                                    top += 20;
                                }
                            }
                        }
                    }
                }
                myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 10, pdfColor.Black);
                myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);
            }

            //if (top < 700)
            //{
            //    myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 10, pdfColor.Black);
            //}
            return(myDoc);
        }
Пример #22
0
        public virtual pdfDocument ImprimeAtividades(DataTable table)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;
            int    pg         = 1;
            int    top        = 20;
            int    RegItemAtv;
            //Tamanho da lin em pixel
            int nTamLinPixel = 19;

            // Variaveis de controle para quebra de linha de campos
            //int QtdCaracterLinha = 50;
            //int Tamanho;
            //int QtdLin;
            //int StrInicio;
            //int StrFim;
            int cl;

            // Adiciona Página
            pdfDocument myDoc  = new pdfDocument("Horizon", "Orion");
            pdfPage     myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);

            ImprimeFormPrevEquipamento Cab = new ImprimeFormPrevEquipamento();

            Cab.cmpNoObra          = table.Rows[0]["cmpNoObra"].ToString().TrimEnd();
            Cab.cmpDcTipoAtividade = table.Rows[0]["cmpDcTipoAtividade"].ToString().TrimEnd();
            Cab.cmpDcPeriodicidade = table.Rows[0]["cmpDcPeriodicidade"].ToString().TrimEnd();

            top = Cab.CabRelatorio(myDoc, myPage, top);
            top = Cab.SubCabRelatorio(myDoc, myPage, top, table.Rows[0]);
            pdfTable myTable = ItemAtividade(myDoc, myPage, top, table.Rows[0]);

            top       += 40;
            RegItemAtv = 0;

            int IdEquipamento = int.Parse(table.Rows[0]["cmpIdEquipamentoObra"].ToString());

            // Imprimir linhas de detalhes
            pdfTableRow myRow = myTable.createRow();

            foreach (DataRow row in table.Rows)
            {
                if (IdEquipamento != int.Parse(row["cmpIdEquipamentoObra"].ToString()))
                {
                    IdEquipamento = int.Parse(row["cmpIdEquipamentoObra"].ToString());

                    myPage.addTable(myTable);

                    myTable = ConclusaoRelatorio(myDoc, myPage, top);

                    myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 10, pdfColor.Black);
                    myPage.addTable(myTable);

                    // Adiciona uma página
                    myPage  = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);
                    pg      = 1;
                    top     = 30;
                    top     = Cab.CabRelatorio(myDoc, myPage, top);
                    top     = Cab.SubCabRelatorio(myDoc, myPage, top, row);
                    myTable = ItemAtividade(myDoc, myPage, top, row);
                    top    += 40;
                }
                else
                {
                    if (RegItemAtv == 0)
                    {
                        RegItemAtv = 1;
                    }
                    else
                    {
                        cl             = 0;
                        myRow          = myTable.createRow();
                        myRow.rowStyle = myTable.rowStyle;
                        myRow[cl++].addText("");
                        myRow[cl++].addText(row["cmpDcItemAtividadePreventiva"].ToString().TrimEnd());
                        myTable.addRow(myRow);
                        top += nTamLinPixel;
                    }
                }
                if (top > 1000)
                {
                    myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 10, pdfColor.Black);
                    myPage.addTable(myTable);

                    // Adiciona uma página
                    myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);

                    top     = 30;
                    top     = Cab.CabRelatorio(myDoc, myPage, top);
                    top     = Cab.SubCabRelatorio(myDoc, myPage, top, row);
                    myTable = ItemAtividade(myDoc, myPage, top, row);
                    top    += 40;
                }
            }

            if (top < 1000)
            {
                myPage.addTable(myTable);

                myTable = ConclusaoRelatorio(myDoc, myPage, top);
                myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 10, pdfColor.Black);
                myPage.addTable(myTable);
            }
            return(myDoc);
        }
Пример #23
0
        private pdfPage getNewPage(ref double yPos)
        {
            yPos = topMargin;
            if (document == null)
            {
                document = new pdfDocument(myInterface.GetCompetitions()[0].Name, "Allberg Winshooter");
                font     = document.getFontReference(predefinedFont.csTimes);
                fontCompetitionHeader = document.getFontReference(predefinedFont.csTimesBold);
                fontHeader            = document.getFontReference(predefinedFont.csTimesBold);
            }

            //double xsize = 210/conversionPixelsToMM; // A4 = 210*297mm (35,3*35,3 mm)
            //double ysize = 297/conversionPixelsToMM;
            bottomMargin = (int)((297 - 20));
            //pdfPage myPage = document.addPage((int)ysize, (int)xsize);
            pdfPage myPage = document.addPage(predefinedPageSize.csA4Page);

            sharpPDF.Fonts.pdfAbstractFont headerFont = document.getFontReference(predefinedFont.csTimes);

            // Add copyright text
            addText(myPage, "WinShooter",
                    leftMargin, (int)((bottomMargin + 3)), headerFont, 10);

            //addText(myPage, "©" + settings.PrinterSettings.Copyright,
            //	leftMargin+155, (int)((bottomMargin+3)), headerFont, 10);

            // Add club logo
            Image image = settings.Logo;

            int logoHeight = image.Height;
            int logoWidth  = image.Width;

            calculateLogoSize(image, 60, 200, out logoHeight, out logoWidth);

            int logoX = myPage.width - 20 - logoWidth;
            int logoY = myPage.height - 20 - logoHeight;

            try
            {
                sharpPDF.Elements.pdfImageReference imageRef = document.getImageReference("logo");
                myPage.addImage(imageRef, logoX, logoY, logoHeight, logoWidth);
            }
            catch (sharpPDF.Exceptions.pdfImageNotLoadedException)
            {
                document.addImageReference((System.Drawing.Image)image, "logo");
                sharpPDF.Elements.pdfImageReference imageRef = document.getImageReference("logo");
                myPage.addImage(imageRef, logoX, logoY, logoHeight, logoWidth);
            }

            // Add Winshooter logo
            image = settings.GetWinshooterLogo(1000, 1000);

            logoHeight = image.Height;
            logoWidth  = image.Width;

            calculateLogoSize(image, 50, 200, out logoHeight, out logoWidth);

            logoX = myPage.width - 20 - logoWidth;
            logoY = 10;

            try
            {
                sharpPDF.Elements.pdfImageReference imageRef = document.getImageReference("WinShooterLogo");
                myPage.addImage(imageRef, logoX, logoY, logoHeight, logoWidth);
            }
            catch (sharpPDF.Exceptions.pdfImageNotLoadedException)
            {
                document.addImageReference((System.Drawing.Image)image, "WinShooterLogo");
                sharpPDF.Elements.pdfImageReference imageRef = document.getImageReference("WinShooterLogo");
                myPage.addImage(imageRef, logoX, logoY, logoHeight, logoWidth);
            }

            //
            TextStart = 20 + conversionPixelsToMM * logoHeight;

            return(myPage);
        }
Пример #24
0
        public virtual int SubCabRelatorio(pdfDocument myDoc, pdfPage myPage, int top, DataRow r)
        {
            String strFont    = "Helvetica";
            int    leftMargin = 30;
            //Tamanho da lin em pixel
            int nTamLinPixel = 19;

            pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                            new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White));

            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);

            //// Create table's header
            int cl = 0;

            myTable.tableHeader.rowHeight = 10;
            myTable.tableHeader.addColumn(150, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("Descrição do Equipamento");

            myTable.tableHeader.addColumn(400, predefinedAlignment.csLeft);
            myTable.tableHeader[cl].columnAlign = predefinedAlignment.csLeft;
            myTable.tableHeader[cl++].addText(r["cmpDcEquipamentoObra"].ToString());

            top += nTamLinPixel;

            myPage.addTable(myTable);

            myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White));

            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);

            //// Create table's header
            cl = 0;
            myTable.tableHeader.rowHeight = 10;
            myTable.tableHeader.addColumn(150, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("Código do Equipamento");

            myTable.tableHeader.addColumn(125, predefinedAlignment.csLeft);
            myTable.tableHeader[cl].columnAlign = predefinedAlignment.csLeft;
            myTable.tableHeader[cl++].addText(r["CodEquipamento"].ToString().TrimEnd());

            myTable.tableHeader.rowHeight = 10;
            myTable.tableHeader.addColumn(115, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("Tipo do Equipamento");

            myTable.tableHeader.addColumn(160, predefinedAlignment.csLeft);
            myTable.tableHeader[cl].columnAlign = predefinedAlignment.csLeft;
            myTable.tableHeader[cl++].addText(r["cmpDcTipoAtividade"].ToString().TrimEnd());

            top += nTamLinPixel;
            // Create Table Row - 1ª linha
            pdfTableRow myRow = myTable.createRow();

            myRow = myTable.createRow();
            cl    = 0;
            myRow[cl].columnAlign = predefinedAlignment.csLeft;
            myRow[cl++].addText("Capacidade do Equipamento");
            myRow[cl++].addText(r["DcCapacidade"].ToString().TrimEnd());

            myRow[cl].columnAlign = predefinedAlignment.csLeft;
            myRow[cl++].addText("Marca / Modelo");
            myRow[cl++].addText(r["cmpDcMarcaModeloEquipamento"].ToString().TrimEnd());
            myTable.addRow(myRow);
            top += nTamLinPixel;

            // Create Table Row - 2ª linha
            myRow = myTable.createRow();
            cl    = 0;
            myRow[cl].columnAlign = predefinedAlignment.csLeft;
            myRow[cl++].addText("Número de Série");
            myRow[cl++].addText(r["cmpNuSerieEquipamento"].ToString().TrimEnd());

            myRow[cl].columnAlign = predefinedAlignment.csLeft;
            myRow[cl++].addText("Número do Patrimônio");
            myRow[cl++].addText(r["cmpNuPatrimonio"].ToString().TrimEnd());
            myTable.addRow(myRow);
            top += nTamLinPixel;

            // Create Table Row - 3ª linha
            myRow = myTable.createRow();
            cl    = 0;
            myRow[cl].columnAlign = predefinedAlignment.csLeft;
            myRow[cl++].addText("Pavimento");
            myRow[cl++].addText(r["cmpDcPavimento"].ToString().TrimEnd());

            myRow[cl].columnAlign = predefinedAlignment.csLeft;
            myRow[cl++].addText("Localização");
            myRow[cl++].addText(r["cmpDcLocalEquipamento"].ToString().TrimEnd());
            myTable.addRow(myRow);
            top += nTamLinPixel;

            myPage.addTable(myTable);

            return(top);
        }
Пример #25
0
        public static pdfDocument ImprimeResumoOS(DataTable table, string DataInicial, string DataFinal)
        {
            String  strFont    = "Helvetica";
            int     leftMargin = 30;
            int     pg         = 1;
            int     top        = 40;
            TotalOS totalos    = new TotalOS();
            //Tamanho da lin em pixel
            int nTamLinPixel = 19;

            // Variaveis de controle para quebra de linha de campos
            int QtdCaracterLinha = 120;
            int Tamanho;
            int QtdLin;
            int StrInicio;
            int StrFim;
            int cl;

            // Adiciona Página
            pdfDocument myDoc  = new pdfDocument("Horizon", "Orion");
            pdfPage     myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);

            string   DadosObra = (table.Rows[0]["cmpNoObra"].ToString().Trim() + (table.Rows[0]["cmpNuContrato"] != null ? " -> Contrato nº " + table.Rows[0]["cmpNuContrato"].ToString() : ""));
            pdfTable myTable   = CabRelatorio(myDoc, myPage, top, DadosObra, DataInicial, DataFinal);

            // Imprimir linhas de detalhes
            pdfTableRow myRow = myTable.createRow();

            foreach (DataRow row in table.Rows)
            {
                totalos.Adicionar(row["cmpDcOrigemOS"].ToString());
                cl = 0;
                row["cmpDcObservacoes"] = TiraCaractEspecial(row["cmpDcObservacoes"].ToString());

                Tamanho = row["cmpDcObservacoes"].ToString().Length;

                if (Tamanho > 0)
                {
                    QtdLin    = (Tamanho % QtdCaracterLinha == 0 ? Tamanho / QtdCaracterLinha : (Tamanho / QtdCaracterLinha) + 1);
                    StrInicio = 0;

                    for (int Linha = 1; Linha <= QtdLin; Linha++)
                    {
                        StrFim = Linha == QtdLin ? Tamanho - StrInicio : QtdCaracterLinha;
                        if (Linha == 1)
                        {
                            myRow          = myTable.createRow();
                            myRow.rowStyle = myTable.rowStyle;
                            myRow[cl++].addText(row["cmpDcObservacoes"].ToString().Substring(StrInicio, StrFim).Trim());
                            myRow[cl++].addText(row["cmpDtAbertura"].ToString());
                        }
                        else
                        {
                            cl             = 0;
                            myRow          = myTable.createRow();
                            myRow.rowStyle = myTable.rowStyle;
                            myRow[cl++].addText(row["cmpDcObservacoes"].ToString().Substring(StrInicio, StrFim).Trim());
                            myRow[cl++].addText("");
                        }
                        myTable.addRow(myRow);
                        StrInicio += QtdCaracterLinha;
                        top       += nTamLinPixel;
                    }
                }
                else
                {
                    myRow          = myTable.createRow();
                    myRow.rowStyle = myTable.rowStyle;
                    myRow[cl++].addText(row["cmpDcDescricaoSolicitacao"].ToString().TrimEnd());
                    myRow[cl++].addText(row["cmpDtAbertura"].ToString());
                    myTable.addRow(myRow);
                    top += nTamLinPixel;
                }
                if (top > 980)
                {
                    myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 10, pdfColor.Black);
                    myPage.addTable(myTable);

                    // Adiciona uma página
                    myPage  = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);
                    top     = 40;
                    myTable = CabRelatorio(myDoc, myPage, top, DadosObra, DataInicial, DataFinal);
                    top     = +15;
                }
            }

            if (top < 980)
            {
                myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 10, pdfColor.Black);
                myPage.addTable(myTable);

                // Adiciona uma página
                myPage  = myDoc.addPage(predefinedPageSize.csSharpPDFFormat);
                top     = 40;
                myTable = CabRelatorio(myDoc, myPage, top, DadosObra, DataInicial, DataFinal);
                top     = +120;
            }

            // Imprimir Resumo dos atendimentos
            myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 12, pdfColor.Black, new pdfColor("FFFFFF")),
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White));

            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);

            cl = 0;
            myTable.tableHeader.rowHeight = 30;
            myTable.tableHeader.addColumn(300, predefinedAlignment.csCenter);
            myTable.tableHeader[cl++].addText("RESUMO DAS ATIVIDADES REALIZADAS");
            myPage.addTable(myTable);

            top += 30;

            myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2,
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")),
                                   new pdfTableStyle(myDoc.getFontReference(strFont), 8, pdfColor.Black, pdfColor.White));

            myTable.coordX = leftMargin;
            myTable.coordY = getTop(myPage, top);

            cl = 0;
            myTable.tableHeader.rowHeight = 12;
            myTable.tableHeader.addColumn(200, predefinedAlignment.csLeft);
            myTable.tableHeader[cl++].addText("Tipo de Atendimento");

            myTable.tableHeader.addColumn(100, predefinedAlignment.csRight);
            myTable.tableHeader[cl++].addText("Quantidade");

            cl             = 0;
            myRow          = myTable.createRow();
            myRow.rowStyle = myTable.rowStyle;
            myRow[cl++].addText("Eventuais");
            myRow[cl++].addText(totalos.Eventual.ToString());
            myTable.addRow(myRow);

            cl             = 0;
            myRow          = myTable.createRow();
            myRow.rowStyle = myTable.rowStyle;
            myRow[cl++].addText("Interno");
            myRow[cl++].addText(totalos.Interno.ToString());
            myTable.addRow(myRow);

            cl             = 0;
            myRow          = myTable.createRow();
            myRow.rowStyle = myTable.rowStyle;
            myRow[cl++].addText("Preventiva");
            myRow[cl++].addText(totalos.Preventiva.ToString());
            myTable.addRow(myRow);

            cl             = 0;
            myRow          = myTable.createRow();
            myRow.rowStyle = myTable.rowStyle;
            myRow[cl++].addText("Externo");
            myRow[cl++].addText(totalos.Externa.ToString());
            myTable.addRow(myRow);

            cl             = 0;
            myRow          = myTable.createRow();
            myRow.rowStyle = myTable.rowStyle;
            myRow[cl++].addText("Fora de Escopo");
            myRow[cl++].addText(totalos.ForaEscopo.ToString());
            myTable.addRow(myRow);

            myPage.addText("Pág. " + pg++, leftMargin, 10, myDoc.getFontReference(strFont), 10, pdfColor.Black);
            myPage.addTable(myTable);

            return(myDoc);
        }
Пример #26
0
        //Onglet Recapitulatif
        private void btnCreeReca_Click(object sender, EventArgs e)
        {
            try
            {
                //Initialisation des variables
                connec.Open();
                string         mois             = dtpReca.Value.Month.ToString();
                string         annee            = dtpReca.Value.Year.ToString();
                string         text             = "____________________________________________________";
                string         typeNull         = "Type NULL";
                float          montant          = 0;
                int            recette          = 0;
                int            percu            = 0;
                int            indentation      = 20;
                int            hauteurDesLignes = 720;
                List <string>  un            = new List <string>();
                List <string>  de            = new List <string>();
                List <string>  tr            = new List <string>();
                List <string>  qu            = new List <string>();
                List <string>  ci            = new List <string>();
                List <string>  si            = new List <string>();
                List <Boolean> nbTransaction = new List <Boolean>();
                pdfDocument    myDoc         = new pdfDocument("Recapitulatif_" + mois + "_" + annee, "Pique_Sous");
                pdfPage        myPage        = myDoc.addPage();

                //SQL
                OleDbCommand    cd1 = new OleDbCommand("SELECT [Transaction].* FROM [Transaction] WHERE MONTH([dateTransaction]) = " + dtpReca.Value.Month.ToString(), connec);
                OleDbDataReader dr1 = cd1.ExecuteReader();

                //Lecture de la base
                while (dr1.Read())
                {
                    nbTransaction.Add(dr1.GetBoolean(4));
                    if (dr1.GetBoolean(4) == true)
                    {
                        recette++;
                    }
                    if (dr1.GetBoolean(5) == true)
                    {
                        percu++;
                    }
                    montant = montant + dr1.GetFloat(3);

                    un.Add(dr1[1].ToString().Substring(0, 11));
                    de.Add(dr1[2].ToString());
                    tr.Add(dr1[3].ToString());
                    qu.Add(dr1[4].ToString());
                    ci.Add(dr1[5].ToString());

                    if (dr1[6].ToString() != "")
                    {
                        si.Add(dr1[6].ToString());
                    }
                    else
                    {
                        si.Add(typeNull);
                    }
                }
                for (int i = 0; i < si.Count; i++)
                {
                    if (si[i] != typeNull)
                    {
                        //Pour eviter de faire une requette avec une jointure
                        OleDbCommand    cd2 = new OleDbCommand("SELECT [TypeTransaction].* FROM [TypeTransaction] where [codeType] = " + si[i], connec);
                        OleDbDataReader dr2 = cd2.ExecuteReader();
                        while (dr2.Read())
                        {
                            si[i] = dr2[1].ToString();
                        }
                    }
                }

                //Creation du text dans le PDF
                myPage.addText("Recapitulatif du : " + mois + "_" + annee, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText("Dépenses", indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - (30 + 25 * un.Count);
                myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText("Recette : " + recette.ToString(), indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText(" Depenses : " + montant.ToString(), indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText("Reste a persevoir : " + percu.ToString(), indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText("Somme total dépensée : -" + montant.ToString(), indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText("nombres de transactions : " + nbTransaction.Count.ToString(), indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
                hauteurDesLignes = hauteurDesLignes - 30;
                myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20);

                //Initiallisation tableau PDF
                pdfTable myTable = new pdfTable(myDoc);
                myTable.borderSize  = 1;
                myTable.borderColor = sharpPDF.pdfColor.Black;
                myTable.tableHeader.addColumn(90);
                myTable.tableHeader.addColumn(120);
                myTable.tableHeader.addColumn(70);
                myTable.tableHeader.addColumn(70);
                myTable.tableHeader.addColumn(70);
                myTable.tableHeader.addColumn(110);
                pdfTableRow myRow = myTable.createRow();

                //Remplissage de la première ligne du tableau
                myRow[0].addText("Date Transaction");
                myRow[1].addText("Description");
                myRow[2].addText("Montant");
                myRow[3].addText("Recette ?");
                myRow[4].addText("Perçu ?");
                myRow[5].addText("Type de dépence ?");
                myTable.addRow(myRow);

                //Remplissage des ligne du tableau
                for (int i = 0; i < un.Count; i++)
                {
                    myRow = myTable.createRow();
                    myRow[0].addText(un[i]);
                    myRow[1].addText(de[i]);
                    myRow[2].addText(tr[i]);
                    myRow[3].addText(qu[i]);
                    myRow[4].addText(ci[i]);
                    myRow[5].addText(si[i]);
                    myTable.addRow(myRow);
                }

                //Place le tableau
                myTable.coordY = 650;
                myTable.coordX = 20;
                myPage.addTable(myTable);

                //creer le PDF
                FolderBrowserDialog fbd = new FolderBrowserDialog();
                if (fbd.ShowDialog() == DialogResult.OK)
                {
                    myDoc.createPDF(fbd.SelectedPath + @"\Recapitulatif_" + mois + "_" + annee + ".pdf");
                }
                myPage = null;
                myDoc  = null;
                connec.Close();
                MessageBox.Show("PDF créé");
            }
            catch (InvalidOperationException erreur)
            {
                MessageBox.Show("Erreur de chaine de connexion ! pdf");
                MessageBox.Show(erreur.Message);
            }
            catch (OleDbException erreur)
            {
                MessageBox.Show("Erreur de requete SQL ! pdf");
                MessageBox.Show(erreur.Message);
            }
        }
Пример #27
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            string date1 = Date1.Text;
            string date2 = Date2.Text;

            string[] dateSeparator = { "/" };
            string[] wordDate1     = date1.Split(dateSeparator, StringSplitOptions.RemoveEmptyEntries);
            string[] wordDate2     = date2.Split(dateSeparator, StringSplitOptions.RemoveEmptyEntries);

            string        text   = "";
            XmlTextReader reader = new XmlTextReader("calendar.xml");

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:     // Узел является элементом.
                    text = text + "<" + reader.Name + ">";
                    break;

                case XmlNodeType.Text:     // Вывести текст в каждом элементе.
                    text = text + reader.Value;
                    break;

                case XmlNodeType.EndElement:     // Вывести конец элемента.
                    text = text + "</" + reader.Name + ">";
                    break;
                }
            }

            string[] separator = { "<", ">", " " };
            string[] word      = text.Split(separator, StringSplitOptions.RemoveEmptyEntries);// Разделение текста на слова



            int         i       = 0;
            pdfDocument myDoc   = new pdfDocument("TUTORIAL", "ME");
            string      newText = "";

            while (i < word.Length)
            {
                int j = i + 1;

                if (word[i] == "First")
                {
                    while (word[j] != "/First")
                    {
                        newText = newText + word[j] + " ";
                        j       = j + 1;
                    }
                    newText = newText + ";   ";
                }

                if (word[i] == "Check")
                {
                    while (word[j] != "/Check")
                    {
                        newText = newText + word[j] + " ";
                        j       = j + 1;
                    }
                    newText = newText + ";   ";
                }

                if (word[i] == "Date")
                {
                    string[] currentDate = word[i + 1].Split(dateSeparator, StringSplitOptions.RemoveEmptyEntries);
                    if (Convert.ToInt32(currentDate[2]) >= Convert.ToInt32(wordDate1[2]) && Convert.ToInt32(currentDate[2]) <= Convert.ToInt32(wordDate2[2]))
                    {
                        if (Convert.ToInt32(currentDate[0]) >= Convert.ToInt32(wordDate1[0]) && Convert.ToInt32(currentDate[0]) <= Convert.ToInt32(wordDate2[0]))
                        {
                            if (Convert.ToInt32(currentDate[1]) >= Convert.ToInt32(wordDate1[1]) && Convert.ToInt32(currentDate[1]) <= Convert.ToInt32(wordDate2[1]))
                            {
                                while (word[j] != "/Date")
                                {
                                    newText = newText + word[j] + " ";
                                    j       = j + 1;
                                }
                                newText = newText + ".";
                                pdfPage myPage = myDoc.addPage();
                                myPage.addText(newText, 20, 700, myDoc.getFontReference(predefinedFont.csCourier), 14);
                                myDoc.createPDF(@"Dairy.pdf");
                                myPage  = null;
                                newText = "";
                            }
                            else
                            {
                                newText = "";
                            }
                        }
                        else
                        {
                            newText = "";
                        }
                    }
                    else
                    {
                        newText = "";
                    }
                }
                i++;
            }
            myDoc = null;
        }