Пример #1
0
        public HttpResponseMessage GenerateFiniquitoReport(string accountId)
        {
            var student    = _studentRepository.GetByAccountNumber(accountId);
            var totalHours = _studentRepository.GetStudentHours(accountId);

            student.Finiquiteado = true;
            _studentRepository.Update(student);
            _studentRepository.Save();
            var doc   = _textDoucmentServices.CreaDocument();
            var page1 = _textDoucmentServices.CreatePage(doc);

            _textDoucmentServices.SetPageMArgins(page1, 35f, 71f, 85f, 85f);
            var header          = _textDoucmentServices.CreateHeader(doc);
            var headerParagraph = _textDoucmentServices.CreateHeaderParagraph(header);

            _textDoucmentServices.AppendPictureToHeader(headerParagraph, Properties.Resources.UnitecFullLogo, 51f, 151f, 430f, -12f);

            var footer          = _textDoucmentServices.CreaFooter(doc);
            var footerParagraph = _textDoucmentServices.CreateFooterParagraph(footer);
            var footerBody      = "Elaborado y revisado por:\r\n" +
                                  "Andrea Cecilia Orellana Zelaya\r\n" +
                                  "Jefe de Vinculación y Emprendimiento\r\n\r\n";

            _textDoucmentServices.AppendTextToFooter(footerParagraph, footerBody, "Segoe UI", 10f);

            var p0      = _textDoucmentServices.CreateParagraph(page1);
            var p0Style = _textDoucmentServices.CreateParagraphStyle(doc, "FiniquitoTitle", "Segoe UI", 14f, true);

            _textDoucmentServices.AddTextToParagraph("\r\n\r\n\r\nCARTA DE FINIQUITO DEFINITIVO", p0, p0Style, doc, HorizontalAlignment.Center, 13.8f);
            _textDoucmentServices.AddTextToParagraph("\r\nPROGRAMA DE SERVICIO SOCIAL\r\n", p0, p0Style, doc, HorizontalAlignment.Center, 13.8f);

            var p2      = _textDoucmentServices.CreateParagraph(page1);
            var p2Style = _textDoucmentServices.CreateParagraphStyle(doc, "FiniquitoBody", "Segoe UI", 12f, false);
            var body1   = "Yo, Rafael Antonio Delgado Elvir, Director de Desarrollo Institucional de UNITEC\r\n" +
                          "Campus SPS, hago constar que en los registros figura que el estudiante: ";

            var textInfo  = new CultureInfo("en-US", false).TextInfo;
            var finalName = textInfo.ToTitleCase(student.Name.ToLower());

            var textInfo2 = new CultureInfo("en-US", false).TextInfo;
            var majorName = textInfo2.ToTitleCase(student.Major.Name.ToLower());

            var body2 = " con número de cuenta N° " + accountId + ", estudiante de la carrera de " +
                        "\"" + majorName + "\", realizó un total de ";

            var bodyHoras = "" + totalHours + " horas";

            var body3 = " de vinculación, cumpliendo así con el requerimiento de horas que estipula el Reglamento General del Programa de Servicio Social.";

            _textDoucmentServices.AddTextToParagraph("\r\n" + body1, p2, p2Style, doc, HorizontalAlignment.Justify, 13.8f);
            var text = _textDoucmentServices.AddTextToParagraph(finalName, p2, p2Style, doc,
                                                                HorizontalAlignment.Justify, 13.8f);

            text.CharacterFormat.Bold = true;
            _textDoucmentServices.AddTextToParagraph(body2, p2, p2Style, doc, HorizontalAlignment.Justify, 13.8f);
            var hoursText = _textDoucmentServices.AddTextToParagraph(bodyHoras, p2, p2Style, doc, HorizontalAlignment.Justify, 13.8f);

            hoursText.CharacterFormat.Bold = true;
            _textDoucmentServices.AddTextToParagraph(body3, p2, p2Style, doc, HorizontalAlignment.Justify, 13.8f);

            var p4 = _textDoucmentServices.CreateParagraph(page1);

            _textDoucmentServices.AddTextToParagraph("\r\nSe extiende la presente constancia para los fines que al interesado convengan el ", p4, p2Style, doc, HorizontalAlignment.Justify, 13.8f);
            var month     = DateTime.Now.ToString("MMMM", new CultureInfo("es-ES"));
            var fechaText = _textDoucmentServices.AddTextToParagraph("" + DateTime.Now.Day + " de " + char.ToUpper(month[0]) + month.Substring(1) + " del " + DateTime.Now.Year + ".", p4, p2Style, doc, HorizontalAlignment.Justify, 13.8f);

            fechaText.CharacterFormat.Bold = true;

            var ending = " ______________________________________\r\n" +
                         "Director de Desarrollo Institucional\r\n" +
                         "UNITEC San Pedro Sula";

            var p5 = _textDoucmentServices.CreateParagraph(page1);

            _textDoucmentServices.AddTextToParagraph("\r\n\r\n\r\n" + ending, p5, p2Style, doc, HorizontalAlignment.Justify, 13.8f);
            return(_downloadbleFile.ToHttpResponseMessage(doc, "Finiquito_" + accountId + "_" + finalName.Replace(" ", "") + ".docx"));
        }
Пример #2
0
        public HttpResponseMessage GenerateFinalReport(ProjectFinalReportModel model)
        {
            var            doc     = _textDoucmentServices.CreaDocument();
            var            page1   = _textDoucmentServices.CreatePage(doc);
            var            pblank  = _textDoucmentServices.CreateParagraph(page1);
            ParagraphStyle p0Style = _textDoucmentServices.CreateParagraphStyle(doc, "HeaderStyle", "Times New Roman",
                                                                                14f, true);

            _textDoucmentServices.AddTextToParagraph("\r\n\r\n", pblank, p0Style, doc);
            var titleHeader = "   UNIVERSIDAD TECNOLOGICA CENTROAMERICANA\r\n " +
                              "                                              UNITEC\r\n " +
                              "       Dirección de Investigación y Vinculación Universitaria\r\n" +
                              "                      Evaluación de Proyecto de Vinculación";
            var p0 = _textDoucmentServices.CreateParagraph(page1);

            _textDoucmentServices.AddTextToParagraph(titleHeader, p0, p0Style, doc);
            _textDoucmentServices.AddImageToParagraph(p0, Properties.Resources.UnitecLogo, 59F, 69F,
                                                      TextWrappingStyle.Square);
            var            p1 = _textDoucmentServices.CreateParagraph(page1);
            ParagraphStyle tableHeadersStyle = _textDoucmentServices.CreateParagraphStyle(doc, "GeneralInfo",
                                                                                          "Times New Roman", 12f, true);

            _textDoucmentServices.AddTextToParagraph("Información General", p1, tableHeadersStyle, doc);
            var table1 = _textDoucmentServices.CreateTable(page1);

            string[][] table1Data =
            {
                new[] { "Codigo",                                model.SectionProject.Id.ToString()                                                       },
                new[] { "Nombre del producto entregado",         model.Project.Name                                                                       },
                new[] { "Nombre de la organización beneficiada", model.Project.BeneficiarieOrganization                                                   },
                new[] { "Nombre de la asignatura",               model.Section.Class.Name                                                                 },
                new[] { "Nombre de la carrera",                  model.MajorsOfStudents                                                                   },
                new[] { "Nombre del catedrático",                model.ProfessorName                                                                      },
                new[]
                { "Periodo del Proyecto",                  "Desde   " + model.Section.Period.FromDate + "   Hasta   " + model.Section.Period.ToDate }
            };
            table1.ResetCells(table1Data.Length, 2);
            _textDoucmentServices.AddDataToTable(table1, table1Data, "Times New Roman", 12, 0);

            var p2 = _textDoucmentServices.CreateParagraph(page1);

            _textDoucmentServices.AddTextToParagraph("\r\nCaracterísticas del Proyecto", p2, tableHeadersStyle, doc);

            var table2 = _textDoucmentServices.CreateTable(page1);

            string[][] table2Data =
            {
                new[] { "Grupo(s) meta beneficiado(s) con el producto entregado", model.BeneficiarieGroups            },
                new[] { "Número de personas beneficiadas",                        model.BeneficiarieGroups.ToString() }
            };
            table2.ResetCells(table2Data.Length, 2);
            _textDoucmentServices.AddDataToTable(table2, table2Data, "Times New Roman", 12, 0);

            var p3 = _textDoucmentServices.CreateParagraph(page1);

            _textDoucmentServices.AddTextToParagraph("\r\nTiempo y valor del producto ", p3, tableHeadersStyle, doc);

            var table3        = _textDoucmentServices.CreateTable(page1);
            var studentsHours = model.StudentsHours;
            var totalHours    = 0;

            string[][] table4Data = new string[studentsHours.Count][];
            var        i          = 0;

            foreach (var sh in studentsHours)
            {
                table4Data[i] = new[] { (i + 1).ToString(), sh.Key.AccountId, sh.Key.Name, sh.Value.ToString(), "" };
                i++;
                totalHours += sh.Value;
            }

            string[][] table3Data =
            {
                new[] { "Horas de trabajo de campo alumnos ",      model.FieldHours.ToString()                                      },
                new[] { "Horas de trabajo en clase alumnos ",      (totalHours - model.FieldHours).ToString()                       },
                new[] { "Total Horas de Trabajo del Proyecto",     totalHours.ToString()                                            },
                new[] { "Nota asignada al proyecto (%)*",          model.Calification + "%"                                         },
                new[] { "Valor en el mercado del producto (Lps.)", model.SectionProject.Cost.ToString(CultureInfo.InvariantCulture) },
            };
            table3.ResetCells(table3Data.Length, 2);
            _textDoucmentServices.AddDataToTable(table3, table3Data, "Times New Roman", 12, 0);
            var            p4      = _textDoucmentServices.CreateParagraph(page1);
            ParagraphStyle p4Style = _textDoucmentServices.CreateParagraphStyle(doc, "3tableStyle", "Times New Roman", 8,
                                                                                false);

            _textDoucmentServices.AddTextToParagraph(
                "*Se refiere a la evaluación que hace el catedrático sobre la calidad del proyecto", p4, p4Style, doc);

            var p5 = _textDoucmentServices.CreateParagraph(page1);

            _textDoucmentServices.AddTextToParagraph("\r\n\r\nEstudiantes Involucrados en el Proyecto de Vinculación",
                                                     p5, tableHeadersStyle, doc);

            var table4 = _textDoucmentServices.CreateTable(page1);

            string[] headerTable4 = { "No.", "Cuenta", "Nombre y Apellidos", "Horas por alumno", "Firma del estudiante" };
            _textDoucmentServices.AddDataToTableWithHeader(table4, headerTable4, table4Data, 5, "Times New Roman", 12);
            var            p6      = _textDoucmentServices.CreateParagraph(page1);
            ParagraphStyle p6Style = _textDoucmentServices.CreateParagraphStyle(doc, "lastParagraphStyle",
                                                                                "Times New Roman", 12f, false);

            _textDoucmentServices.AddTextToParagraph(
                "\r\n\r\n\r\n\r\nFirma del docente__________________________	Fecha de entrega___________________", p6,
                p6Style, doc);
            return(_downloadbleFile.ToHttpResponseMessage(doc, "FinalReport.docx"));
        }
Пример #3
0
        public HttpResponseMessage GenerateFiniquitoReport(string accountId)
        {
            var student = _studentRepository.GetByAccountNumber(accountId);

            student.Finiquiteado = true;
            _studentRepository.Update(student);
            _studentRepository.Save();
            var doc   = _textDoucmentServices.CreaDocument();
            var page1 = _textDoucmentServices.CreatePage(doc);

            _textDoucmentServices.SetPageMArgins(page1, 35f, 71f, 85f, 85f);
            var header          = _textDoucmentServices.CreateHeader(doc);
            var headerParagraph = _textDoucmentServices.CreateHeaderParagraph(header);

            _textDoucmentServices.AppendPictureToHeader(headerParagraph, Properties.Resources.LaurateLogo, 39f, 122f, 15f, -2f);
            _textDoucmentServices.AppendPictureToHeader(headerParagraph, Properties.Resources.UnitecFullLogo, 51f, 151f, 430f, -12f);

            var footer          = _textDoucmentServices.CreaFooter(doc);
            var footerParagraph = _textDoucmentServices.CreateFooterParagraph(footer);
            var footerBody      = "Elaborado y revisado por:\r\n" +
                                  "Andrea Cecilia Orellana Zelaya\r\n" +
                                  "Jefe de Vinculación y Emprendimiento\r\n\r\n";

            _textDoucmentServices.AppendTextToFooter(footerParagraph, footerBody, "Segoe UI", 10f);

            var p0      = _textDoucmentServices.CreateParagraph(page1);
            var p0Style = _textDoucmentServices.CreateParagraphStyle(doc, "FiniquitoTitle", "Segoe UI", 14f, true);

            _textDoucmentServices.AddTextToParagraph("\r\n\r\n\r\nCARTA DE FINIQUITO DEFINITIVO DE SERVICIO SOCIAL", p0, p0Style, doc, HorizontalAlignment.Center, 13.8f);

            var p1    = _textDoucmentServices.CreateParagraph(page1);
            var month = DateTime.Now.ToString("MMMM", new CultureInfo("es-ES"));

            _textDoucmentServices.AddTextToParagraph("\r\n\r\n\r\nFecha: " + DateTime.Now.Day + " de " + char.ToUpper(month[0]) + month.Substring(1) + " del " +
                                                     +DateTime.Now.Year, p1, p0Style, doc, HorizontalAlignment.Left, 13.8f);

            var p2      = _textDoucmentServices.CreateParagraph(page1);
            var p2Style = _textDoucmentServices.CreateParagraphStyle(doc, "FiniquitoBody", "Segoe UI", 12f, false);
            var body1   = "Yo, Rafael Antonio Delgado Elvir, Director de Desarrollo Institucional de UNITEC\r\n" +
                          "Campus SPS, hago constar que en los registros figura que el estudiante\r\n";
            var studentName = student.Name.ToUpper();
            var body2       = ", con número de cuenta: " + accountId + ", estudiante de la carrera de \r\n" +
                              "\"" + student.Major.Name + "\", completó con todas las\r\n" +
                              "horas referentes a su Programa de Servicio Social.";

            _textDoucmentServices.AddTextToParagraph("\r\n" + body1, p2, p2Style, doc, HorizontalAlignment.Justify, 13.8f);
            var text = _textDoucmentServices.AddTextToParagraph(studentName, p2, p2Style, doc,
                                                                HorizontalAlignment.Justify, 13.8f);

            text.CharacterFormat.Bold = true;
            _textDoucmentServices.AddTextToParagraph(body2, p2, p2Style, doc, HorizontalAlignment.Justify, 13.8f);

            var p3 = _textDoucmentServices.CreateParagraph(page1);

            _textDoucmentServices.AddTextToParagraph("\r\nEl número total de horas de trabajo fue de: 100 Horas.", p3, p2Style, doc, HorizontalAlignment.Justify, 13.8f);

            var p4 = _textDoucmentServices.CreateParagraph(page1);

            _textDoucmentServices.AddTextToParagraph("\r\nSe extiende la presente constancia para los fines que al interesado convengan.", p4, p2Style, doc, HorizontalAlignment.Justify, 13.8f);

            var ending = " ______________________________________\r\n" +
                         "Director de Desarrollo Institucional\r\n" +
                         "UNITEC San Pedro Sula";

            var p5 = _textDoucmentServices.CreateParagraph(page1);

            _textDoucmentServices.AddTextToParagraph("\r\n\r\n\r\n" + ending, p5, p2Style, doc, HorizontalAlignment.Justify, 13.8f);
            return(_downloadbleFile.ToHttpResponseMessage(doc, "Finiquito.docx"));
        }