コード例 #1
0
ファイル: cPrint.cs プロジェクト: PaoloMisson/GATEvolution
 public cPrint(Report objrpt, string strCN)
 {
     rpt = objrpt;
     rptPage = new Root.Reports.Page(rpt);
     fd = new FontDef(rpt, "Arial");
     _sqlCn = new SqlConnection(strCN);
 }
コード例 #2
0
 public cDataReport(string strCN)
 {
     rpt = new Report();
     rptPage = new Root.Reports.Page(rpt);
     fd = new FontDef(rpt, "Arial");
     sqlCn = new SqlConnection(strCN);
 }
コード例 #3
0
ファイル: BaseTemplate.cs プロジェクト: nachovz/FVSL-Prueba
 public BaseTemplate()
 {
     report = new Report(new PdfFormatter());
     FontDef fd = new FontDef(report, "Helvetica");
     standardFont = new FontPropMM(fd, 5);
     page = new Root.Reports.Page(report);
     setHeader();
     setFooter();
 }
コード例 #4
0
ファイル: HelloWorld.cs プロジェクト: nachovz/FVSL-Prueba
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Starts the "Hello World" sample.</summary>
 public static void Main()
 {
     Report report = new Report(new PdfFormatter());
     FontDef fd = new FontDef(report, "Helvetica");
     FontProp fp = new FontPropMM(fd, 25);
     Page page = new Page(report);
     page.AddCenteredMM(80, new RepString(fp, "Hello World!"));
     RT.ViewPDF(report, "HelloWorld.pdf");
 }
コード例 #5
0
ファイル: ReportNet.cs プロジェクト: PaoloMisson/GATEvolution
 private void StampaHello()
 {
     FontDef fd = new FontDef(this, FontDef.StandardFont.Helvetica);
     FontProp fp = new FontPropMM(fd, 10);
     new Root.Reports.Page(this);
     page_Cur.AddCB_MM(80, new RepString(fp, "Hello World by Paolo Misson"));
     fp.rSizeMM = 7;
     page_Cur.AddCB_MM(120, new RepString(fp, DateTime.Now.ToString("g")));
 }
コード例 #6
0
ファイル: cReport.cs プロジェクト: PaoloMisson/GATEvolution
		public cReport(Report objRpt,Root.Reports.Page objRptPage)
		{
			rpt = objRpt;
			rptPage= objRptPage;
			try
			{
				fd = new FontDef(rpt, FontDef.StandardFont.Helvetica);
			}
			catch
			{
			
			}
		}
コード例 #7
0
ファイル: BaseTemplate.cs プロジェクト: nachovz/FVSL-Prueba
 public BaseTemplate()
 {
     report = new Report(new PdfFormatter());
     FontDef fd = new FontDef(report, "Helvetica");
     standardFont = new FontPropMM(fd, 5);
     page = new Root.Reports.Page(report);
     FontDef fss = new FontDef(report, "Arial");
     arialFont = new FontPropMM(fss, 6);
     flm = new FlowLayoutManager(null);
     flm2 = new FlowLayoutManager(null);
     flm.rContainerHeightMM = 120;
     flm2.rContainerHeightMM = 120;
     flm.rContainerWidthMM = 95;
     flm2.rContainerWidthMM = 95;
     flm.eNewContainer += new FlowLayoutManager.NewContainerEventHandler(LeftContainer);
     flm2.eNewContainer += new FlowLayoutManager.NewContainerEventHandler(RightContainer);
     setHeader();
     setFooter();
 }
コード例 #8
0
ファイル: BaseTemplate.cs プロジェクト: nachovz/FVSL-Prueba
 public BaseTemplate()
 {
     report = new Report(new PdfFormatter());
     FontDef fd = new FontDef(report, "Helvetica");
     standardFont = new FontPropMM(fd, 5);
     page = new Root.Reports.Page(report);
     FontDef fss = new FontDef(report, "Arial");
     arialFont = new FontPropMM(fss, 6);
     flm = new FlowLayoutManager(null);
     flm2 = new FlowLayoutManager(null);
     flm.rContainerHeightMM = 120;
     flm2.rContainerHeightMM = 120;
     flm.rContainerWidthMM = 95;
     flm2.rContainerWidthMM = 95;
     flm.eNewContainer += new FlowLayoutManager.NewContainerEventHandler(LeftContainer);
     flm2.eNewContainer += new FlowLayoutManager.NewContainerEventHandler(RightContainer);
     //str = "C:\\Documents and Settings\\Administrador\\Escritorio\\asp-workspace\\MAPA_FVSL\\PDFExport\\PDFExport\\Images\\";
     str = "D:\\WORK\\mapsvsl\\asp-workspace\\MAPA_FVSL\\PDFExport\\PDFExport\\Images\\";
     setHeader();
     setFooter();
 }
コード例 #9
0
    private void generarPDF(
               string CODIGO_TERRITORIO,
               string FECHA_INCRIPCION,
               string CAMPAÑA_INCRIPCION,
               string CODIGO_CONSULTORA_RECOMIENDA,
               string TIPO_CONTACTO,
               string SOLICITANTE_APELLIDO_PATERNO,
               string SOLICITANTE_APELLIDO_MATERNO,
               string SOLICITANTE_NOMBRES,
               string SOLICITANTE_FECHA_NACIMIENTO,
               string SOLICITANTE_TIPO_DOCUMENTO,
               string SOLICITANTE_NUMERO_DOCUMENTO,
               string SOLICITANTE_ESTADO_CIVIL,
               string SOLICITANTE_NIVEL_EDUCATIVO,
               string SOLICITANTE_VENDE_OTRAS_MARCAS,
               string SOLICITANTE_TELEFONO_CASA,
               string SOLICITANTE_TELEFONO_CELULAR,
               string SOLICITANTE_CORREO_ELECTRONICO,
               string SOLICITANTE_DIRECCION,
               string SOLICITANTE_REFERENCIA,
               string SOLICITANTE_CODIGO_POSTAL,
               string SOLICITANTE_PUEBLO,
               string SOLICITANTE_ESTADO,
               string SOLICITANTE_MUNICIPIO,
               string SOLICITANTE_CIUDAD,
               string SOLICITANTE_PROVINCIA,
               string DIRECCION_ENTREGA_DIRECCION,
               string DIRECCION_ENTREGA_PUEBLO,
               string DIRECCION_ENTREGA_CODIGO_POSTAL,
               string DIRECCION_ENTREGA_REFERENCIA,
               string REFERENCIA_FAMILIAR_APELLIDO_PATERNO,
               string REFERENCIA_FAMILIAR_APELLIDO_MATERNO,
               string REFERENCIA_FAMILIAR_APELLIDO_NOMBRES,
               string REFERENCIA_FAMILIAR_DIRECCION,
               string REFERENCIA_FAMILIAR_TELEFONO_RESIDENCIA,
               string REFERENCIA_FAMILIAR_TELEFONO_CELULAR,
               string REFERENCIA_FAMILIAR_TIPO_VINCULO,
               string REFERENCIA_NO_FAMILIAR_APELLIDO_PATERNO,
               string REFERENCIA_NO_FAMILIAR_APELLIDO_MATERNO,
               string REFERENCIA_NO_FAMILIAR_APELLIDO_NOMBRES,
               string REFERENCIA_NO_FAMILIAR_DIRECCION,
               string REFERENCIA_NO_FAMILIAR_TELEFONO_RESIDENCIA,
               string REFERENCIA_NO_FAMILIAR_TELEFONO_CELULAR,
               string REFERENCIA_NO_FAMILIAR_TIPO_VINCULO
       )
    {
        int m = 30;//margen
        Report report = new Report(new PdfFormatter());
        FontDef fd = new FontDef(report, "Helvetica");
        FontProp fp = new FontPropMM(fd, 2, System.Drawing.Color.Black);
        FontProp fp1 = new FontPropMM(fd, 2, System.Drawing.Color.Black);
        FontProp fp2 = new FontPropMM(fd, 2, System.Drawing.Color.Black);
        FontProp fp_Title = new FontPropMM(fd, 4);
        Root.Reports.Page page = new Root.Reports.Page(report);
        fp_Title.bBold = true;
        fp1.bBold = true;
        fp2.bBold = true;
        fp2.bItalic = true;
        Double rX = 10;
        Double rY = 20;

        //Double rYTemp, rYContinue;
        Double rYcopy = rY;
        //centrado al medio del dpdf
        page.AddCB_MM(10, new RepString(fp_Title, "Visitas de Seguimiento"));
        rY += fp_Title.rLineFeedMM;

        page.AddMM(rX, rY - 12, new RepString(fp, "CÓDIGO TERRITORIAL:"));
        page.AddRightMM(rX + 4, rY - 9, new RepString(fp1, CODIGO_TERRITORIO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 50, rY - 17, new RepString(fp, "FECHA DE INSCRIPCIÓN:"));
        page.AddRightMM(rX + 64, rY - 14, new RepString(fp1, FECHA_INCRIPCION));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 120, rY - 21, new RepString(fp, "CAMPAÑA DE INSCRIPCIÒN:"));
        page.AddRightMM(rX + 130, rY - 18, new RepString(fp1, CAMPAÑA_INCRIPCION));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY - 15, new RepString(fp, "CÓDIGO CONSULTORA QUE RECOMIENDA:"));
        page.AddRightMM(rX + 18, rY - 12, new RepString(fp1, CODIGO_CONSULTORA_RECOMIENDA));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 100, rY - 19, new RepString(fp, "TIPO DE CONTACTO:"));
        page.AddRightMM(rX + 116, rY - 16, new RepString(fp1, TIPO_CONTACTO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY - 11, new RepString(fp2, "DATOS SOLICITANTE"));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY - 9, new RepString(fp, "APELLIDO PATERNO:"));
        page.AddRightMM(rX + 8, rY - 5, new RepString(fp1, SOLICITANTE_APELLIDO_PATERNO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 70, rY - 13, new RepString(fp, "APELLIDO MATERNO:"));
        page.AddRightMM(rX + 80, rY - 9, new RepString(fp1, SOLICITANTE_APELLIDO_MATERNO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 130, rY - 17, new RepString(fp, "NOMBRES:"));
        page.AddRightMM(rX + 152, rY - 13, new RepString(fp1, SOLICITANTE_NOMBRES));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY - 11, new RepString(fp, "FECHA DE NACIMIENTO:"));
        page.AddRightMM(rX + 14, rY - 7, new RepString(fp1, SOLICITANTE_FECHA_NACIMIENTO));
        rY += fp.rLineFeedMM;
        page.AddMM(rX + 70, rY - 15, new RepString(fp, "NUMERO DE DOCUMENTO DE IDENTIDAD:"));
        page.AddRightMM(rX + 73, rY - 12, new RepString(fp1, SOLICITANTE_TIPO_DOCUMENTO));
        page.AddRightMM(rX + 92, rY - 12, new RepString(fp1, SOLICITANTE_NUMERO_DOCUMENTO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY - 8, new RepString(fp, "ESTADO CIVIL:"));
        page.AddRightMM(rX + 9, rY - 5, new RepString(fp1, SOLICITANTE_ESTADO_CIVIL));
        rY += fp.rLineFeedMM;
        page.AddMM(rX + 50, rY - 12, new RepString(fp, "NIVEL EDUCATIVO:"));
        page.AddRightMM(rX + 67, rY - 9, new RepString(fp1, SOLICITANTE_NIVEL_EDUCATIVO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 100, rY - 16, new RepString(fp, "¿VENDE OTRAS MARCAS?:"));
        page.AddRightMM(rX + 105, rY - 13, new RepString(fp1, SOLICITANTE_VENDE_OTRAS_MARCAS));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY - 10, new RepString(fp, "TELÉFONO CASA:"));
        page.AddRightMM(rX + 15, rY - 7, new RepString(fp1, SOLICITANTE_TELEFONO_CASA));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 70, rY - 14, new RepString(fp, "TELÉFONO CELULAR:"));
        page.AddRightMM(rX + 85, rY + -11, new RepString(fp1, SOLICITANTE_TELEFONO_CELULAR));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY - 8, new RepString(fp, "CORREO ELECTRÓNICO:"));
        page.AddRightMM(rX + 30, rY - 4, new RepString(fp1, SOLICITANTE_CORREO_ELECTRONICO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY, new RepString(fp, "DIRECCIÓN:"));
        page.AddRightMM(rX + 15, rY + 4, new RepString(fp1, SOLICITANTE_DIRECCION));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 8, new RepString(fp, "REFERENCIA:"));
        page.AddRightMM(rX + 16, rY + 12, new RepString(fp1, SOLICITANTE_REFERENCIA));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 70, rY + 4, new RepString(fp, "CÓDIGO POSTAL:"));
        page.AddRightMM(rX + 86, rY + 8, new RepString(fp1, SOLICITANTE_CODIGO_POSTAL));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 12, new RepString(fp, "PUEBLO:"));
        page.AddRightMM(rX + 11, rY + 16, new RepString(fp1, SOLICITANTE_PUEBLO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 70, rY + 8, new RepString(fp, "ESTADO:"));
        page.AddRightMM(rX + 81, rY + 12, new RepString(fp1, SOLICITANTE_ESTADO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 130, rY + 4, new RepString(fp, "MUNICIPIO:"));
        page.AddRightMM(rX + 144, rY + 8, new RepString(fp1, SOLICITANTE_MUNICIPIO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 12, new RepString(fp, "CIUDAD:"));
        page.AddRightMM(rX + 11, rY + 16, new RepString(fp1, SOLICITANTE_CIUDAD));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 70, rY + 8, new RepString(fp, "PROVINCIA:"));
        page.AddRightMM(rX + 84, rY + 12, new RepString(fp1, SOLICITANTE_PROVINCIA));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 18, new RepString(fp2, "DIRECCIÓN ENTREGA"));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 19, new RepString(fp, "DIRECCIÓN:"));
        page.AddRightMM(rX + 14, rY + 23, new RepString(fp1, DIRECCION_ENTREGA_DIRECCION));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 68, rY + 15, new RepString(fp, "PUEBLO:"));
        page.AddRightMM(rX + 79, rY + 19, new RepString(fp1, DIRECCION_ENTREGA_PUEBLO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 130, rY + 12, new RepString(fp, "CÓDIGO POSTAL:"));
        page.AddRightMM(rX + 146, rY + 15, new RepString(fp1, DIRECCION_ENTREGA_CODIGO_POSTAL));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 16, new RepString(fp, "REFERENCIA:"));
        page.AddRightMM(rX + 16, rY + 20, new RepString(fp1, DIRECCION_ENTREGA_REFERENCIA));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 25, new RepString(fp2, " REFERENCIA FAMILIAR"));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 26, new RepString(fp, "APELLIDO PATERNO:"));
        page.AddRightMM(rX + 12, rY + 29, new RepString(fp1, REFERENCIA_FAMILIAR_APELLIDO_PATERNO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 70, rY + 22, new RepString(fp, "APELLIDO MATERNO:"));
        page.AddRightMM(rX + 82, rY + 25, new RepString(fp1, REFERENCIA_FAMILIAR_APELLIDO_MATERNO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 130, rY + 18, new RepString(fp, "NOMBRES:"));
        page.AddRightMM(rX + 143, rY + 21, new RepString(fp1, REFERENCIA_FAMILIAR_APELLIDO_NOMBRES));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 22, new RepString(fp, "DIRECCIÓN:"));
        page.AddRightMM(rX + 14, rY + 25, new RepString(fp1, REFERENCIA_FAMILIAR_DIRECCION));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 27, new RepString(fp, "TELÉFONO RESIDENCIA:"));
        page.AddRightMM(rX + 15, rY + 31, new RepString(fp1, REFERENCIA_FAMILIAR_TELEFONO_RESIDENCIA));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 70, rY + 24, new RepString(fp, "TELÉFONO CELULAR:"));
        page.AddRightMM(rX + 83, rY + 27, new RepString(fp1, REFERENCIA_FAMILIAR_TELEFONO_CELULAR));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 29, new RepString(fp, "TIPO VÍNCULO:"));
        page.AddRightMM(rX + 15, rY + 32, new RepString(fp1, REFERENCIA_FAMILIAR_TIPO_VINCULO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 36, new RepString(fp2, " REFERENCIA NO FAMILIAR"));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 38, new RepString(fp, "APELLIDO PATERNO:"));
        page.AddRightMM(rX + 13, rY + 41, new RepString(fp1, REFERENCIA_NO_FAMILIAR_APELLIDO_PATERNO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 70, rY + 34, new RepString(fp, "APELLIDO MATERNO:"));
        page.AddRightMM(rX + 83, rY + 37, new RepString(fp1, REFERENCIA_NO_FAMILIAR_APELLIDO_MATERNO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 130, rY + 31, new RepString(fp, "NOMBRES:"));
        page.AddRightMM(rX + 145, rY + 34, new RepString(fp1, REFERENCIA_NO_FAMILIAR_APELLIDO_NOMBRES));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 35, new RepString(fp, "DIRECCIÓN:"));
        page.AddRightMM(rX + 15, rY + 38, new RepString(fp1, REFERENCIA_NO_FAMILIAR_DIRECCION));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 41, new RepString(fp, "TELÉFONO RESIDENCIA:"));
        page.AddRightMM(rX + 14, rY + 45, new RepString(fp1, REFERENCIA_NO_FAMILIAR_TELEFONO_RESIDENCIA));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 70, rY + 36, new RepString(fp, "TELÉFONO CELULAR:"));
        page.AddRightMM(rX + 82, rY + 41, new RepString(fp1, REFERENCIA_NO_FAMILIAR_TELEFONO_CELULAR));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 45, new RepString(fp, "TIPO VÍNCULO:"));
        page.AddRightMM(rX + 14, rY + 49, new RepString(fp1, REFERENCIA_NO_FAMILIAR_TIPO_VINCULO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 51, new RepString(fp2, "ADICIONAL"));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 54, new RepString(fp, "PROFESIÓN:"));
        page.AddRightMM(rX + 14, rY + 58, new RepString(fp1, REFERENCIA_NO_FAMILIAR_TIPO_VINCULO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX+30, rY + 50, new RepString(fp, "LUGAR DE TRABAJO:"));
        page.AddRightMM(rX + 44, rY + 54, new RepString(fp1, REFERENCIA_NO_FAMILIAR_TIPO_VINCULO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 66, rY + 46, new RepString(fp, "TELÉFONO DE TRABAJO:"));
        page.AddRightMM(rX + 80, rY + 50, new RepString(fp1, REFERENCIA_NO_FAMILIAR_TIPO_VINCULO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 106, rY + 42, new RepString(fp, "HORA DE VISITA:"));
        page.AddRightMM(rX + 121, rY + 46, new RepString(fp1, REFERENCIA_NO_FAMILIAR_TIPO_VINCULO));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 48, new RepString(fp, "NÚMERO DE HIJOS:"));
        page.AddRightMM(rX + 30, rY + 48, new RepString(fp1, "5"));
        rY += fp.rLineFeedMM;

        page.AddMM(rX, rY + 48, new RepString(fp, "INFANTES:"));
        page.AddRightMM(rX + 17, rY + 48, new RepString(fp1, "1"));
        rY += fp.rLineFeedMM;

        page.AddMM(rX +25, rY + 44, new RepString(fp, "ESCOLARES:"));
        page.AddRightMM(rX + 45, rY + 44, new RepString(fp1, "2"));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 55, rY + 40, new RepString(fp, "NIVEL SUPERIOR:"));
        page.AddRightMM(rX + 82, rY + 40, new RepString(fp1, "1"));
        rY += fp.rLineFeedMM;

        page.AddMM(rX + 89, rY + 36, new RepString(fp, "ADULTOS INDEPENDIENTES:"));
        page.AddRightMM(rX + 131, rY + 36, new RepString(fp1, "1"));
        rY += fp.rLineFeedMM;

        page = new Root.Reports.Page(report);
        //FontDef fdb = new FontDef(report, "Helvetica");
        FontProp fpb = new FontPropMM(fd, 2, System.Drawing.Color.Black);
        FontProp fpb2 = new FontPropMM(fd, 2, System.Drawing.Color.Black);
        FontProp fpb3 = new FontPropMM(fd, 2, System.Drawing.Color.Black);
        Double _rX = 10;
        Double _rY = 20;
        fpb.bBold = true;
        fpb.bItalic = true;
        fpb2.bBold = true;
        page.AddMM(_rX, _rY, new RepString(fpb, " VISITAS"));
        _rY += fpb.rLineFeedMM;

        page.AddMM(_rX + 20, _rY-4, new RepString(fpb2, "REGIÓN: 00"));
        page.AddRightMM(_rX + 55, _rY-4, new RepString(fpb2, "ZONA: 0000"));
        _rY += fpb.rLineFeedMM;

        page.AddMM(_rX + 5, _rY - 1, new RepString(fpb2, "FECHA"));
        page.AddRightMM(_rX + 43, _rY - 1, new RepString(fpb2, "OBSERVACIÓN"));
        _rY += fpb.rLineFeedMM;

        page.AddMM(_rX + 5, _rY , new RepString(fpb3, "20/10/2010"));
        page.AddRightMM(_rX + 51, _rY , new RepString(fpb3, "Observación de visita 1"));
        _rY += fpb.rLineFeedMM;

        page.AddMM(_rX + 5, _rY+2, new RepString(fpb3, "12/11/2010"));
        page.AddRightMM(_rX + 51, _rY+2, new RepString(fpb3, "Observación de visita 2"));
        _rY += fpb.rLineFeedMM;

        page.AddMM(_rX + 5, _rY+4, new RepString(fpb3, "08/12/2010"));
        page.AddRightMM(_rX + 51, _rY+4, new RepString(fpb3, "Observación de visita 3"));
        _rY += fpb.rLineFeedMM;

         /*   Report report = new Report(new PdfFormatter());
        FontDef fd = new FontDef(report, "Helvetica");
        FontProp fp = new FontPropMM(fd, 2, System.Drawing.Color.Black);
        FontProp fp1 = new FontPropMM(fd, 2, System.Drawing.Color.Black);
        FontProp fp2 = new FontPropMM(fd, 2, System.Drawing.Color.Black);
        FontProp fp_Title = new FontPropMM(fd, 4);
        Root.Reports.Page page = new Root.Reports.Page(report);*/

        //fp1.bBold = true;
        //fp2.bBold = true;
        //fp2.bItalic = true;
        //Double rX = 10;
        //Double rY = 20;

        /*page.AddMM(rX, rY, new RepString(fp, "Año:"));
         page.AddRightMM(rX + 80, rY, new RepString(fp, "falta año")); //falta de donde sacar año
         rY += fp.rLineFeedMM;

         page.AddMM(rX, rY, new RepString(fp, "CAMP."));
         page.AddRightMM(rX + 80, rY, new RepString(fp, "aa"));
         rY += fp.rLineFeedMM;

         page.AddMM(rX, rY, new RepString(fp, "Código consultora que recomienda:"));
         page.AddRightMM(rX + 80, rY, new RepString(fp, "aa"));
         rY += fp.rLineFeedMM;

         page.AddMM(rX, rY, new RepString(fp, "Consultora que recomienda :"));
         page.AddRightMM(rX + 80, rY, new RepString(fp, "falta nombre consultora")); //falta obtener nombre consultora recomienda
         rY += fp.rLineFeedMM;

         page.AddMM(rX, rY, new RepString(fp, "Selección Premio:"));
         page.AddRightMM(rX + 80, rY, new RepString(fp, "falta sacar premio")); //falta de donde sacar premio
         // rY += fp.rLineFeedMM;

         rX = 20;
         rY += 10;
         rYTemp = rY;
         page.AddMM(rX, rY, new RepString(fp, "Primer Apellido:"));
         page.AddRightMM(rX + 80, rY, new RepString(fp, "aa"));
         rY += fp.rLineFeedMM;
         page.AddMM(rX, rY, new RepString(fp, "Primer Nombre:"));
         page.AddRightMM(rX + 80, rY, new RepString(fp, "aa"));
         rY += fp.rLineFeedMM;
         page.AddMM(rX, rY, new RepString(fp, "Fecha nacimiento:"));
         page.AddRightMM(rX + 80, rY, new RepString(fp, "aa"));
         rY += fp.rLineFeedMM;
         page.AddMM(rX, rY, new RepString(fp, "Estado civil:"));
         page.AddRightMM(rX + 80, rY, new RepString(fp, "aa"));
         rY += fp.rLineFeedMM;
         page.AddMM(rX, rY, new RepString(fp, "Nivel Educativo :"));
         page.AddRightMM(rX + 80, rY, new RepString(fp, "aa"));
         rY += fp.rLineFeedMM;
         //page.AddMM(rX, rY, new RepString(fp, "Selección Premio:"));
         //page.AddRightMM(rX + 80, rY, new RepInt32(fp, 0, "$#;($#);Zero"));
         //rYContinue = rY;

         rX += 90;
         rY = rYTemp;
         page.AddMM(rX, rY, new RepString(fp, "Segundo apellido:"));
         page.AddRightMM(rX + 80, rY, new RepString(fp, "aa"));
         rY += fp.rLineFeedMM;
         page.AddMM(rX, rY, new RepString(fp, "Segundo Nombre:"));
         page.AddRightMM(rX + 80, rY, new RepString(fp, "aa"));
         rY += fp.rLineFeedMM;
         page.AddMM(rX, rY, new RepString(fp, "Doc de identidad:"));
         page.AddRightMM(rX + 80, rY, new RepString(fp, "aa"));
         rY += fp.rLineFeedMM;
         page.AddMM(rX, rY, new RepString(fp, "Número:"));
         page.AddRightMM(rX + 80, rY, new RepString(fp, "aa"));
         rY += fp.rLineFeedMM;
         page.AddMM(rX, rY, new RepString(fp, "Vendes otras Marcas :"));
         page.AddRightMM(rX + 80, rY, new RepString(fp, "aa"));
         rY += fp.rLineFeedMM;
         //page.AddMM(rX, rY, new RepString(fp, "Selección Premio:"));
         //page.AddRightMM(rX + 80, rY, new RepInt32(fp, 0, "$#;($#);Zero"));
         */

        string archivo = "sc" + DateTime.Now.Second + DateTime.Now.Millisecond;
        //report.Save(@"C:\Bcaribe\" + archivo + ".pdf");

        //return archivo;
        RT.ViewPDF(report, "Visitas de Seguimiento.pdf");
    }
コード例 #10
0
        // Add detailed information about each individual device, starting on the current page and adding new pages as necessary.
        private void InsertDetailsList(Report report, FontDef fontDefinition, Page page, double verticalMillimeters, DateTime now, int pageNumber)
        {
            const double ColumnPaddingMillimeters = 10.0D;
            const double RowPaddingMillimeters = 2.0D;
            const double SignalIndentMillimeters = 25.4D;

            double[] deviceColumnWidthMillimeters;
            double[] signalColumnWidthMillimeters;
            double listWidthMillimeters;
            double horizontalMillimeters;

            FontProp deviceHeaderFont = new FontPropMM(fontDefinition, 0.0D);
            FontProp deviceRowFont = new FontPropMM(fontDefinition, 0.0D);
            FontProp signalHeaderFont = new FontPropMM(fontDefinition, 0.0D);
            FontProp signalRowFont = new FontPropMM(fontDefinition, 0.0D);

            List<DeviceStats> badDevices;
            List<SignalStats> badSignals;

            int deviceIndex;
            int signalIndex;
            string[] deviceHeaders;
            string[] signalHeaders;
            string[][] deviceDetails;
            string[][][] signalDetails;

            // Set up fonts to be used in the details list
            deviceHeaderFont.rSizePoint = 12.0D;
            deviceRowFont.rSizePoint = 12.0D;
            signalHeaderFont.rSizePoint = 10.0D;
            signalRowFont.rSizePoint = 10.0D;
            deviceHeaderFont.bBold = true;
            signalHeaderFont.bBold = true;

            // Set up the column header and the initial values for the column widths
            deviceHeaders = new string[] { "Name", "Correctness" };
            signalHeaders = new string[] { "Name", "Latched", "Unreasonable", "Total" };
            deviceColumnWidthMillimeters = deviceHeaders.Select(deviceHeaderFont.rGetTextWidthMM).ToArray();
            signalColumnWidthMillimeters = signalHeaders.Select(deviceHeaderFont.rGetTextWidthMM).ToArray();

            badDevices = m_deviceStatsList
                .Where(dev => dev.GetMeasurementsLatched(ReportDays - 1) + dev.GetMeasurementsUnreasonable(ReportDays - 1) > 0)
                .OrderByDescending(dev => (dev.GetMeasurementsLatched(ReportDays - 1) + dev.GetMeasurementsUnreasonable(ReportDays - 1)) / dev.MeasurementsExpected[ReportDays - 1])
                .ToList();

            deviceIndex = 0;
            deviceDetails = new string[badDevices.Count][];
            signalDetails = new string[badDevices.Count][][];

            foreach (DeviceStats deviceStats in badDevices)
            {
                deviceDetails[deviceIndex] = new string[2];
                deviceDetails[deviceIndex][0] = deviceStats.Name;
                deviceDetails[deviceIndex][1] = deviceStats.GetCorrectness(ReportDays - 1).ToString("0.##") + "%";
                deviceColumnWidthMillimeters = deviceColumnWidthMillimeters.Zip(deviceDetails[deviceIndex], (currentWidth, text) => Math.Max(currentWidth, deviceRowFont.rGetTextWidthMM(text))).ToArray();

                badSignals = deviceStats.SignalStatsLookup.Values
                    .Where(stats => stats.MeasurementsLatched[ReportDays - 1] + stats.MeasurementsUnreasonable[ReportDays - 1] > 0)
                    .OrderByDescending(stats => stats.MeasurementsLatched[ReportDays - 1] + stats.MeasurementsUnreasonable[ReportDays - 1])
                    .ToList();

                signalIndex = 0;
                signalDetails[deviceIndex] = new string[badSignals.Count][];

                foreach (SignalStats signalStats in badSignals)
                {
                    signalDetails[deviceIndex][signalIndex] = new string[4];
                    signalDetails[deviceIndex][signalIndex][0] = signalStats.Name;
                    signalDetails[deviceIndex][signalIndex][1] = signalStats.MeasurementsLatched[ReportDays - 1].ToString("#,##0");
                    signalDetails[deviceIndex][signalIndex][2] = signalStats.MeasurementsUnreasonable[ReportDays - 1].ToString("#,##0");
                    signalDetails[deviceIndex][signalIndex][3] = (signalStats.MeasurementsLatched[ReportDays - 1] + signalStats.MeasurementsUnreasonable[ReportDays - 1]).ToString("#,##0");
                    signalColumnWidthMillimeters = signalColumnWidthMillimeters.Zip(signalDetails[deviceIndex][signalIndex], (currentWidth, text) => Math.Max(currentWidth, signalRowFont.rGetTextWidthMM(text))).ToArray();

                    signalIndex++;
                }

                deviceIndex++;
            }

            // Determine the total width of the list so that it can be centered
            listWidthMillimeters = Math.Max(deviceColumnWidthMillimeters.Sum(width => width + ColumnPaddingMillimeters) - ColumnPaddingMillimeters, SignalIndentMillimeters + signalColumnWidthMillimeters.Sum(width => width + ColumnPaddingMillimeters) - ColumnPaddingMillimeters);

            for (deviceIndex = 0; deviceIndex < deviceDetails.Length; deviceIndex++)
            {
                // If the height of the device header, plus the device row, plus the signal header, plus one signal row reaches beyond the bottom of the page, start a new page
                if (verticalMillimeters + deviceHeaderFont.rSizeMM + deviceRowFont.rSizeMM + signalHeaderFont.rSizeMM + signalRowFont.rSizeMM + 4.0D * RowPaddingMillimeters > PageHeightMillimeters - PageMarginMillimeters - FooterHeightMillimeters - SpacingMillimeters)
                {
                    // Insert footer on the current page first
                    InsertFooter(fontDefinition, page, now, pageNumber);

                    // Increment the page number and create a new page
                    page = CreatePage(report);
                    pageNumber++;

                    // Add the report date to the top of the page
                    verticalMillimeters = PageMarginMillimeters;
                    verticalMillimeters += InsertReportDate(fontDefinition, page, PageMarginMillimeters) + SpacingMillimeters;
                }

                // Add the device header to the page
                horizontalMillimeters = (PageWidthMillimeters - listWidthMillimeters) / 2.0D;

                for (int i = 0; i < deviceHeaders.Length; i++)
                {
                    page.AddMM(horizontalMillimeters, verticalMillimeters + deviceHeaderFont.rSizeMM, new RepString(deviceHeaderFont, deviceHeaders[i]));
                    horizontalMillimeters += deviceColumnWidthMillimeters[i] + ColumnPaddingMillimeters;
                }

                verticalMillimeters += deviceHeaderFont.rSizeMM + RowPaddingMillimeters;

                // Add the device row to the page
                horizontalMillimeters = (PageWidthMillimeters - listWidthMillimeters) / 2.0D;

                for (int i = 0; i < deviceDetails[deviceIndex].Length; i++)
                {
                    page.AddMM(horizontalMillimeters, verticalMillimeters + deviceRowFont.rSizeMM, new RepString(deviceRowFont, deviceDetails[deviceIndex][i]));
                    horizontalMillimeters += deviceColumnWidthMillimeters[i] + ColumnPaddingMillimeters;
                }

                verticalMillimeters += deviceRowFont.rSizeMM + RowPaddingMillimeters * 2.0D;

                // Add the signal header to the page
                horizontalMillimeters = (PageWidthMillimeters - listWidthMillimeters) / 2.0D + SignalIndentMillimeters;

                for (int i = 0; i < signalHeaders.Length; i++)
                {
                    page.AddMM(horizontalMillimeters, verticalMillimeters + signalHeaderFont.rSizeMM, new RepString(signalHeaderFont, signalHeaders[i]));
                    horizontalMillimeters += signalColumnWidthMillimeters[i] + ColumnPaddingMillimeters;
                }

                verticalMillimeters += signalHeaderFont.rSizeMM + RowPaddingMillimeters;

                // Each signal is on its own row in the details list
                foreach (string[] row in signalDetails[deviceIndex])
                {
                    // If the height of the row reaches beyond the bottom of the page, start a new page
                    if (verticalMillimeters + signalRowFont.rSizeMM > PageHeightMillimeters - PageMarginMillimeters - FooterHeightMillimeters - SpacingMillimeters)
                    {
                        // Insert footer on the current page first
                        InsertFooter(fontDefinition, page, now, pageNumber);

                        // Increment the page number and create a new page
                        page = CreatePage(report);
                        pageNumber++;

                        // Add the report date to the top of the page
                        verticalMillimeters = PageMarginMillimeters;
                        verticalMillimeters += InsertReportDate(fontDefinition, page, PageMarginMillimeters) + SpacingMillimeters;

                        // Add the device header to the new page
                        horizontalMillimeters = (PageWidthMillimeters - listWidthMillimeters) / 2.0D;

                        for (int i = 0; i < deviceHeaders.Length; i++)
                        {
                            page.AddMM(horizontalMillimeters, verticalMillimeters + deviceHeaderFont.rSizeMM, new RepString(deviceHeaderFont, deviceHeaders[i]));
                            horizontalMillimeters += deviceColumnWidthMillimeters[i] + ColumnPaddingMillimeters;
                        }

                        verticalMillimeters += deviceHeaderFont.rSizeMM + RowPaddingMillimeters;

                        // Add the device row to the new page
                        horizontalMillimeters = (PageWidthMillimeters - listWidthMillimeters) / 2.0D;

                        for (int i = 0; i < deviceDetails[deviceIndex].Length; i++)
                        {
                            page.AddMM(horizontalMillimeters, verticalMillimeters + deviceRowFont.rSizeMM, new RepString(deviceRowFont, deviceDetails[deviceIndex][i]));
                            horizontalMillimeters += deviceColumnWidthMillimeters[i] + ColumnPaddingMillimeters;
                        }

                        verticalMillimeters += deviceRowFont.rSizeMM + RowPaddingMillimeters * 2.0D;

                        // Add the signal header to the new page
                        horizontalMillimeters = (PageWidthMillimeters - listWidthMillimeters) / 2.0D + SignalIndentMillimeters;

                        for (int i = 0; i < signalHeaders.Length; i++)
                        {
                            page.AddMM(horizontalMillimeters, verticalMillimeters + signalHeaderFont.rSizeMM, new RepString(signalHeaderFont, signalHeaders[i]));
                            horizontalMillimeters += signalColumnWidthMillimeters[i] + ColumnPaddingMillimeters;
                        }

                        verticalMillimeters += signalHeaderFont.rSizeMM + RowPaddingMillimeters;
                    }

                    // Add the signal row to the details list
                    horizontalMillimeters = (PageWidthMillimeters - listWidthMillimeters) / 2.0D + SignalIndentMillimeters;

                    for (int i = 0; i < row.Length; i++)
                    {
                        page.AddMM(horizontalMillimeters, verticalMillimeters + signalRowFont.rSizeMM, new RepString(signalRowFont, row[i]));
                        horizontalMillimeters += signalColumnWidthMillimeters[i] + ColumnPaddingMillimeters;
                    }

                    verticalMillimeters += signalRowFont.rSizeMM + RowPaddingMillimeters;
                }

                // Add space between devices
                verticalMillimeters += RowPaddingMillimeters * 3;
            }

            // Insert the footer on the last page of the report
            InsertFooter(fontDefinition, page, now, pageNumber);
        }
コード例 #11
0
        // Inserts the five-day summary table on the given page.
        private double InsertFiveDaySummary(Report report, FontDef fontDefinition, Page page, double verticalMillimeters)
        {
            const double TableHeightMillimeters = 30.0D;
            const double ColumnPadding = 5.0D;
            const double RowPadding = 2.0D;
            const int RowCount = 5;

            double horizontalMillimeters;
            double tableWidthMillimeters;
            double rowHeightMillimeters;

            double measurementsExpected;
            double measurementsReceived;
            double measurementsLatched;
            double measurementsUnreasonable;

            string[] labelText;
            FontProp[] labelFonts;
            double labelsWidthMillimeters;

            string[] dayOneText;
            FontProp[] dayOneFonts;
            double dayOneWidthMillimeters;

            string[] dayTwoText;
            FontProp[] dayTwoFonts;
            double dayTwoWidthMillimeters;

            string[] dayThreeText;
            FontProp[] dayThreeFonts;
            double dayThreeWidthMillimeters;

            string[] dayFourText;
            FontProp[] dayFourFonts;
            double dayFourWidthMillimeters;

            string[] dayFiveText;
            FontProp[] dayFiveFonts;
            double dayFiveWidthMillimeters;

            // Determine the height of each row in the table
            rowHeightMillimeters = (TableHeightMillimeters - ((RowCount - 1) * RowPadding)) / RowCount;

            // Get the text for the labels in the first column of the table
            labelText = new string[]
            {
                "",
                "Good",
                "Latched",
                "Unreasonable",
            };

            labelFonts = labelText
                .Select(text =>
                {
                    FontProp font = new FontPropMM(fontDefinition, rowHeightMillimeters * 0.8D);
                    font.bBold = true;
                    return font;
                })
                .ToArray();

            labelsWidthMillimeters = labelText
                .Zip(labelFonts, (text, font) => font.rGetTextWidthMM(text))
                .Max();

            // Get the text for the measurement counts in the second column of the table
            measurementsExpected = m_deviceStatsList.Sum(deviceStats => deviceStats.MeasurementsExpected[ReportDays - 5]);
            measurementsReceived = m_deviceStatsList.Sum(deviceStats => deviceStats.MeasurementsReceived[ReportDays - 5]);
            measurementsLatched = m_deviceStatsList.Sum(deviceStats => deviceStats.GetMeasurementsLatched(ReportDays - 5));
            measurementsUnreasonable = m_deviceStatsList.Sum(deviceStats => deviceStats.GetMeasurementsUnreasonable(ReportDays - 5));

            dayOneText = new string[]
            {
                (m_reportDate - TimeSpan.FromDays(4.0D)).ToString("MM/dd"),
                ((measurementsReceived - measurementsLatched - measurementsUnreasonable) / measurementsExpected).ToString("0.00%"),
                (measurementsLatched / measurementsExpected).ToString("0.00%"),
                (measurementsUnreasonable / measurementsExpected).ToString("0.00%")
            };

            dayOneFonts = dayOneText
                .Select((text, index) =>
                {
                    FontProp font = new FontPropMM(fontDefinition, rowHeightMillimeters * 0.8D);
                    font.bBold = index == 0;
                    return font;
                })
                .ToArray();

            dayOneWidthMillimeters = dayOneText
                .Zip(dayOneFonts, (text, font) => font.rGetTextWidthMM(text))
                .Max();

            // Get the text for the measurement counts in the third column of the table
            measurementsExpected = m_deviceStatsList.Sum(deviceStats => deviceStats.MeasurementsExpected[ReportDays - 4]);
            measurementsReceived = m_deviceStatsList.Sum(deviceStats => deviceStats.MeasurementsReceived[ReportDays - 4]);
            measurementsLatched = m_deviceStatsList.Sum(deviceStats => deviceStats.GetMeasurementsLatched(ReportDays - 4));
            measurementsUnreasonable = m_deviceStatsList.Sum(deviceStats => deviceStats.GetMeasurementsUnreasonable(ReportDays - 4));

            dayTwoText = new string[]
            {
                (m_reportDate - TimeSpan.FromDays(3.0D)).ToString("MM/dd"),
                ((measurementsReceived - measurementsLatched - measurementsUnreasonable) / measurementsExpected).ToString("0.00%"),
                (measurementsLatched / measurementsExpected).ToString("0.00%"),
                (measurementsUnreasonable / measurementsExpected).ToString("0.00%")
            };

            dayTwoFonts = dayTwoText
                .Select((text, index) =>
                {
                    FontProp font = new FontPropMM(fontDefinition, rowHeightMillimeters * 0.8D);
                    font.bBold = index == 0;
                    return font;
                })
                .ToArray();

            dayTwoWidthMillimeters = dayTwoText
                .Zip(dayTwoFonts, (text, font) => font.rGetTextWidthMM(text))
                .Max();

            // Get the text for the measurement counts in the fourth column of the table
            measurementsExpected = m_deviceStatsList.Sum(deviceStats => deviceStats.MeasurementsExpected[ReportDays - 3]);
            measurementsReceived = m_deviceStatsList.Sum(deviceStats => deviceStats.MeasurementsReceived[ReportDays - 3]);
            measurementsLatched = m_deviceStatsList.Sum(deviceStats => deviceStats.GetMeasurementsLatched(ReportDays - 3));
            measurementsUnreasonable = m_deviceStatsList.Sum(deviceStats => deviceStats.GetMeasurementsUnreasonable(ReportDays - 3));

            dayThreeText = new string[]
            {
                (m_reportDate - TimeSpan.FromDays(2.0D)).ToString("MM/dd"),
                ((measurementsReceived - measurementsLatched - measurementsUnreasonable) / measurementsExpected).ToString("0.00%"),
                (measurementsLatched / measurementsExpected).ToString("0.00%"),
                (measurementsUnreasonable / measurementsExpected).ToString("0.00%")
            };

            dayThreeFonts = dayThreeText
                .Select((text, index) =>
                {
                    FontProp font = new FontPropMM(fontDefinition, rowHeightMillimeters * 0.8D);
                    font.bBold = index == 0;
                    return font;
                })
                .ToArray();

            dayThreeWidthMillimeters = dayThreeText
                .Zip(dayThreeFonts, (text, font) => font.rGetTextWidthMM(text))
                .Max();

            // Get the text for the measurement counts in the fifth column of the table
            measurementsExpected = m_deviceStatsList.Sum(deviceStats => deviceStats.MeasurementsExpected[ReportDays - 2]);
            measurementsReceived = m_deviceStatsList.Sum(deviceStats => deviceStats.MeasurementsReceived[ReportDays - 2]);
            measurementsLatched = m_deviceStatsList.Sum(deviceStats => deviceStats.GetMeasurementsLatched(ReportDays - 2));
            measurementsUnreasonable = m_deviceStatsList.Sum(deviceStats => deviceStats.GetMeasurementsUnreasonable(ReportDays - 2));

            dayFourText = new string[]
            {
                (m_reportDate - TimeSpan.FromDays(1.0D)).ToString("MM/dd"),
                ((measurementsReceived - measurementsLatched - measurementsUnreasonable) / measurementsExpected).ToString("0.00%"),
                (measurementsLatched / measurementsExpected).ToString("0.00%"),
                (measurementsUnreasonable / measurementsExpected).ToString("0.00%")
            };

            dayFourFonts = dayFourText
                .Select((text, index) =>
                {
                    FontProp font = new FontPropMM(fontDefinition, rowHeightMillimeters * 0.8D);
                    font.bBold = index == 0;
                    return font;
                })
                .ToArray();

            dayFourWidthMillimeters = dayFourText
                .Zip(dayFourFonts, (text, font) => font.rGetTextWidthMM(text))
                .Max();

            // Get the text for the measurement counts in the sixth column of the table
            measurementsExpected = m_deviceStatsList.Sum(deviceStats => deviceStats.MeasurementsExpected[ReportDays - 1]);
            measurementsReceived = m_deviceStatsList.Sum(deviceStats => deviceStats.MeasurementsReceived[ReportDays - 1]);
            measurementsLatched = m_deviceStatsList.Sum(deviceStats => deviceStats.GetMeasurementsLatched(ReportDays - 1));
            measurementsUnreasonable = m_deviceStatsList.Sum(deviceStats => deviceStats.GetMeasurementsUnreasonable(ReportDays - 1));

            dayFiveText = new string[]
            {
                (m_reportDate).ToString("MM/dd"),
                ((measurementsReceived - measurementsLatched - measurementsUnreasonable) / measurementsExpected).ToString("0.00%"),
                (measurementsLatched / measurementsExpected).ToString("0.00%"),
                (measurementsUnreasonable / measurementsExpected).ToString("0.00%")
            };

            dayFiveFonts = dayFiveText
                .Select((text, index) =>
                {
                    FontProp font = new FontPropMM(fontDefinition, rowHeightMillimeters * 0.8D);
                    font.bBold = index == 0;
                    return font;
                })
                .ToArray();

            dayFiveWidthMillimeters = dayFiveText
                .Zip(dayFiveFonts, (text, font) => font.rGetTextWidthMM(text))
                .Max();

            // Determine the full width of the table
            tableWidthMillimeters = labelsWidthMillimeters + ColumnPadding
                + dayOneWidthMillimeters + ColumnPadding
                + dayTwoWidthMillimeters + ColumnPadding
                + dayThreeWidthMillimeters + ColumnPadding
                + dayFourWidthMillimeters + ColumnPadding
                + dayFiveWidthMillimeters;

            // Add the table to the page
            for (int i = 0; i < labelText.Length; i++)
            {
                horizontalMillimeters = (PageWidthMillimeters - tableWidthMillimeters) / 2;

                page.AddMM(horizontalMillimeters, verticalMillimeters + rowHeightMillimeters * 0.9D, new RepString(labelFonts[i], labelText[i]));
                horizontalMillimeters += labelsWidthMillimeters + ColumnPadding;

                page.AddMM(horizontalMillimeters + dayOneWidthMillimeters - dayOneFonts[i].rGetTextWidthMM(dayOneText[i]), verticalMillimeters + rowHeightMillimeters * 0.9D, new RepString(dayOneFonts[i], dayOneText[i]));
                horizontalMillimeters += dayOneWidthMillimeters + ColumnPadding;

                page.AddMM(horizontalMillimeters + dayTwoWidthMillimeters - dayTwoFonts[i].rGetTextWidthMM(dayTwoText[i]), verticalMillimeters + rowHeightMillimeters * 0.9D, new RepString(dayTwoFonts[i], dayTwoText[i]));
                horizontalMillimeters += dayTwoWidthMillimeters + ColumnPadding;

                page.AddMM(horizontalMillimeters + dayThreeWidthMillimeters - dayThreeFonts[i].rGetTextWidthMM(dayThreeText[i]), verticalMillimeters + rowHeightMillimeters * 0.9D, new RepString(dayThreeFonts[i], dayThreeText[i]));
                horizontalMillimeters += dayThreeWidthMillimeters + ColumnPadding;

                page.AddMM(horizontalMillimeters + dayFourWidthMillimeters - dayFourFonts[i].rGetTextWidthMM(dayFourText[i]), verticalMillimeters + rowHeightMillimeters * 0.9D, new RepString(dayFourFonts[i], dayFourText[i]));
                horizontalMillimeters += dayFourWidthMillimeters + ColumnPadding;

                page.AddMM(horizontalMillimeters + dayFiveWidthMillimeters - dayFiveFonts[i].rGetTextWidthMM(dayFiveText[i]), verticalMillimeters + rowHeightMillimeters * 0.9D, new RepString(dayFiveFonts[i], dayFiveText[i]));
                verticalMillimeters += rowHeightMillimeters + RowPadding;
            }

            return TableHeightMillimeters;
        }
コード例 #12
0
 // Inserts the page footer onto the given page, which includes the time of report generation as well as the page number.
 private double InsertFooter(FontDef fontDefinition, Page page, DateTime now, int pageNumber)
 {
     FontProp font = new FontProp(fontDefinition, 0.0D);
     font.rSizePoint = 12.0D;
     page.AddMM(PageMarginMillimeters, PageHeightMillimeters - PageMarginMillimeters, new RepString(font, now.ToShortDateString() + " " + now.ToShortTimeString()));
     page.AddMM(PageWidthMillimeters - PageMarginMillimeters - font.rGetTextWidthMM(pageNumber.ToString()), PageHeightMillimeters - PageMarginMillimeters, new RepString(font, pageNumber.ToString()));
     return font.rSizeMM;
 }
コード例 #13
0
 // Inserts the report date onto the given page.
 private double InsertReportDate(FontDef fontDefinition, Page page, double verticalMillimeters)
 {
     FontProp font = new FontProp(fontDefinition, 0.0D);
     font.rSizePoint = 14.0D;
     page.AddCB_MM(verticalMillimeters + font.rSizeMM, new RepString(font, m_reportDate.ToLongDateString()));
     return font.rSizeMM;
 }
コード例 #14
0
        //------------------------------------------------------------------------------------------30.10.2004
        /// <summary>Creates this report.</summary>
        /// <remarks>
        /// This method overrides the method <see cref="Root.Reports.Report.Create"/> of the base class <see cref="Root.Reports.Report"/>.
        /// </remarks>
        protected override void Create()
        {
            fontDef_Helvetica = new FontDef(this, FontDef.StandardFont.TimesRoman);
            FontProp fontProp_Text = new FontPropMM(fontDef_Helvetica, 1.9);  // standard font
            FontProp fontProp_Header = new FontPropMM(fontDef_Helvetica, 1.9);  // font of the table header
            fontProp_Header.bBold = true;

            // create table
            TableLayoutManager tlm;
            using (tlm = new TableLayoutManager(fontProp_Header))
            {
                tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table
                tlm.tlmCellDef_Header.rAlignV = RepObj.rAlignCenter;  // set vertical alignment of all header cells
                tlm.tlmCellDef_Default.penProp_LineBottom = new PenProp(this, 0.05, Color.LightGray);  // set bottom line for all cells
                tlm.tlmHeightMode = TlmHeightMode.AdjustLast;
                tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

                // define columns
                TlmColumn col;


                col = new TlmColumnMM(tlm, "Nome Plano", 35);
                col.tlmCellDef_Default.tlmTextMode = TlmTextMode.MultiLine;

                col = new TlmColumnMM(tlm, "Data Início", 25);

                col = new TlmColumnMM(tlm, "Data Fim", 25);

                col = new TlmColumnMM(tlm, "Valor Orçamento", 30);

                col = new TlmColumnMM(tlm, "Valor Gasto", 30);

                col = new TlmColumnMM(tlm, "Saldo Orçamento", 30);

                List<Orcamento> listaOrcamento = (List<Orcamento>)RelatorioDTO.DadosRelatorio;
                foreach (Orcamento orcamento in listaOrcamento)
                {
                    tlm.NewRow();
                    tlm.Add(0, new RepString(fontProp_Text, orcamento.NomePlano));

                    tlm.Add(1, new RepString(fontProp_Text, orcamento.InicioVigencia.Value.ToString("dd/MM/yyyy") ));

                    tlm.Add(2, new RepString(fontProp_Text, orcamento.FimVigencia.Value.ToString("dd/MM/yyyy")));

                    tlm.Add(3, new RepString(fontProp_Text, String.Format("{0:C2}", orcamento.ValorOrcamento.Value)));

                    tlm.Add(4, new RepString(fontProp_Text, String.Format("{0:C2}", orcamento.ValorFinanceiroReal)));

                    tlm.Add(5, new RepString(fontProp_Text, String.Format("{0:C2}", orcamento.SaldoDisponivelOrcamento)));
                }
            }

            //page_Cur.AddCT_MM(rPosLeft + tlm.rWidthMM / 2, rPosTop + tlm.rCurY_MM + 2, new RepString(fontProp_Text, "- end of table -"));

            // print page number and current date/time
            Double rY = rPosBottom + 1.5;
            foreach (Page page in enum_Page)
            {
                page.AddLT_MM(rPosLeft, rY, new RepString(fontProp_Text, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
                page.AddRT_MM(rPosRight, rY, new RepString(fontProp_Text, page.iPageNo + " / " + iPageCount));
            }
        }
コード例 #15
0
ファイル: cPrint.cs プロジェクト: PaoloMisson/GATEvolution
 public cPrint()
 {
     rpt = new Report();
     rptPage = new Root.Reports.Page(rpt);
     fd = new FontDef(rpt, "Arial");
 }
    private Double rPosBottom = 278;  // millimeters

    //------------------------------------------------------------------------------------------30.10.2004
    /// <summary>Creates this report.</summary>
    /// <remarks>
    /// This method overrides the method <see cref="Root.Reports.Report.Create"/> of the base class <see cref="Root.Reports.Report"/>.
    /// </remarks>
    protected override void Create() {  
      fontDef_Helvetica = new FontDef(this, FontDef.StandardFont.TimesRoman);
      FontProp fontProp_Text = new FontPropMM(fontDef_Helvetica, 1.9);  // standard font
      FontProp fontProp_Header = new FontPropMM(fontDef_Helvetica, 1.9);  // font of the table header
      fontProp_Header.bBold = true;

      Stream stream_Phone = GetType().Assembly.GetManifestResourceStream("SGS.Componentes.Phone.jpg");
      Random random = new Random(6);

      // create table
      TableLayoutManager tlm;
      using (tlm = new TableLayoutManager(fontProp_Header)) { 
        tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table
        tlm.tlmCellDef_Header.rAlignV = RepObj.rAlignCenter;  // set vertical alignment of all header cells
        tlm.tlmCellDef_Default.penProp_LineBottom = new PenProp(this, 0.05, Color.LightGray);  // set bottom line for all cells
        tlm.tlmHeightMode = TlmHeightMode.AdjustLast;
        tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

        // define columns
        TlmColumn col;
        col = new TlmColumnMM(tlm, "ID", 13);

        col = new TlmColumnMM(tlm, "Company Name", 40);
        col.tlmCellDef_Default.tlmTextMode = TlmTextMode.MultiLine;

        col = new TlmColumnMM(tlm, "Address", 30);

        col = new TlmColumnMM(tlm, "City", 22);

        col = new TlmColumnMM(tlm, "Postal Code", 16);

        col = new TlmColumnMM(tlm, "Country", 18);

        //col = new TlmColumnMM(tlm, "Pais", 24);

        TlmColumn col_Phone = new TlmColumnMM(tlm, "Phone", rPosRight - rPosLeft - tlm.rWidthMM);
        col_Phone.fontProp_Header = new FontPropMM(fontDef_Helvetica, 1.9, Color.Brown);
        col_Phone.tlmCellDef_Header.rAlignH = RepObj.rAlignRight;
        col_Phone.tlmCellDef_Default.rAlignH = RepObj.rAlignRight;
        BrushProp brushProp_Phone = new BrushProp(this, Color.FromArgb(255, 255, 200));
        col_Phone.tlmCellDef_Default.brushProp_Back = brushProp_Phone;
        BrushProp brushProp_USA = new BrushProp(this, Color.FromArgb(255, 180, 180));

        // open data set
        DataSet dataSet = new DataSet();
        using (Stream stream_Customers = GetType().Assembly.GetManifestResourceStream("SGS.Componentes.Customers.xml"))
        {
          dataSet.ReadXml(stream_Customers);
        }
        DataTable dataTable_Customers = dataSet.Tables[0];

        foreach (DataRow dr in dataTable_Customers.Rows) {
          String sCountry = (String)dr["Country"];
          tlm.tlmCellDef_Default.brushProp_Back = (sCountry == "USA" ? brushProp_USA : null);
          col_Phone.tlmCellDef_Default.brushProp_Back = (sCountry == "USA" ? new BrushProp(this, Color.FromArgb(255, 227, 50)) : brushProp_Phone);
          tlm.NewRow();
          tlm.Add(0, new RepString(fontProp_Text, (String)dr["CustomerID"]));
          tlm.Add(1, new RepString(fontProp_Text, (String)dr["CompanyName"]));
          tlm.Add(2, new RepString(fontProp_Text, (String)dr["Address"]));
          tlm.Add(3, new RepString(fontProp_Text, (String)dr["City"]));
          tlm.Add(4, new RepString(fontProp_Text, (String)dr["PostalCode"]));
          tlm.Add(5, new RepString(fontProp_Text, sCountry));
          tlm.Add(6, new RepString(fontProp_Text, (String)dr["Phone"]));
          if (random.NextDouble() < 0.2) {  // mark randomly selected row with a phone icon
            tlm.tlmRow_Cur.aTlmCell[col_Phone].AddMM(1, 0.25, new RepImageMM(stream_Phone, 2.1, 2.3));
          }
        }
      }
      page_Cur.AddCT_MM(rPosLeft + tlm.rWidthMM / 2, rPosTop + tlm.rCurY_MM + 2, new RepString(fontProp_Text, "- end of table -"));

      // print page number and current date/time
      Double rY = rPosBottom + 1.5;
      foreach (Page page in enum_Page) {
        page.AddLT_MM(rPosLeft, rY, new RepString(fontProp_Text, DateTime.Now.ToShortDateString()  + "  " + DateTime.Now.ToShortTimeString()));
        page.AddRT_MM(rPosRight, rY, new RepString(fontProp_Text, page.iPageNo + " / " + iPageCount));
      }
    }
コード例 #17
0
ファイル: cReport.cs プロジェクト: PaoloMisson/GATEvolution
		public cReport() {
			rpt = new Report();
			rptPage = new Root.Reports.Page(rpt); 
			fd = new FontDef(rpt, FontDef.StandardFont.Helvetica);
		}
コード例 #18
0
        /// <summary>
        /// Generates the report.
        /// </summary>
        /// <returns>The report that was generated.</returns>
        public Report GenerateReport()
        {
            DateTime now = DateTime.Now;
            Report report = new Report();
            FontDef fontDefinition = new FontDef(report, "Helvetica");
            Page pageOne = CreatePage(report);
            Page pageTwo = CreatePage(report);
            double verticalMillimeters;

            ReadStatistics();

            // Page one
            verticalMillimeters = PageMarginMillimeters;
            verticalMillimeters += InsertTitle(fontDefinition, pageOne, verticalMillimeters) + SpacingMillimeters;
            verticalMillimeters += InsertReportDate(fontDefinition, pageOne, verticalMillimeters) + 2.0D * SpacingMillimeters;

            verticalMillimeters += InsertSectionHeader(fontDefinition, pageOne, verticalMillimeters, "5-day Device Data Completeness");
            verticalMillimeters += InsertFiveDaySummary(report, fontDefinition, pageOne, verticalMillimeters) + SpacingMillimeters;

            verticalMillimeters += InsertSectionHeader(fontDefinition, pageOne, verticalMillimeters, "Percent of Devices with Acceptable Quality (30 days)");
            verticalMillimeters += InsertBarChart(pageOne, verticalMillimeters) + SpacingMillimeters;

            verticalMillimeters += InsertSectionHeader(fontDefinition, pageOne, verticalMillimeters, "Definitions");
            verticalMillimeters += InsertDefinitions(fontDefinition, pageOne, verticalMillimeters) + SpacingMillimeters;
            InsertFooter(fontDefinition, pageOne, now, 1);

            // Page two
            verticalMillimeters = PageMarginMillimeters;
            verticalMillimeters += InsertReportDate(fontDefinition, pageTwo, verticalMillimeters) + SpacingMillimeters;

            verticalMillimeters += InsertSectionHeader(fontDefinition, pageTwo, verticalMillimeters, "Data Completeness Breakdown");
            verticalMillimeters += InsertPieChart(fontDefinition, pageTwo, verticalMillimeters) + SpacingMillimeters;

            InsertDetailsList(report, fontDefinition, pageTwo, verticalMillimeters, now, 2);

            return report;
        }
コード例 #19
0
        /// <summary>
        /// Generates the report.
        /// </summary>
        /// <returns>The report that was generated.</returns>
        public Report GenerateReport()
        {
            DateTime now = DateTime.Now;
            Report report = new Report();
            FontDef fontDefinition = new FontDef(report, "Helvetica");
            Page pageOne = CreatePage(report);
            Page pageTwo = CreatePage(report);
            double verticalMillimeters;

            ReadStatistics();

            // Page one
            verticalMillimeters = PageMarginMillimeters;
            verticalMillimeters += InsertTitle(fontDefinition, pageOne, verticalMillimeters) + SpacingMillimeters;
            verticalMillimeters += InsertReportDate(fontDefinition, pageOne, verticalMillimeters) + 2.0D * SpacingMillimeters;

            verticalMillimeters += InsertSectionHeader(fontDefinition, pageOne, verticalMillimeters, "5-day Correctness Summary");
            verticalMillimeters += InsertFiveDaySummary(report, fontDefinition, pageOne, verticalMillimeters) + SpacingMillimeters;

            verticalMillimeters += InsertSectionHeader(fontDefinition, pageOne, verticalMillimeters, "30-day Correctness Overview");
            verticalMillimeters += InsertBarChart(pageOne, verticalMillimeters) + SpacingMillimeters;

            verticalMillimeters += InsertSectionHeader(fontDefinition, pageOne, verticalMillimeters, "Definitions");
            verticalMillimeters += InsertDefinitions(fontDefinition, pageOne, verticalMillimeters) + SpacingMillimeters;
            InsertFooter(fontDefinition, pageOne, now, 1);

            // Page two
            verticalMillimeters = PageMarginMillimeters;
            verticalMillimeters += InsertReportDate(fontDefinition, pageTwo, verticalMillimeters) + SpacingMillimeters;

            verticalMillimeters += InsertSectionHeader(fontDefinition, pageTwo, verticalMillimeters, "Data Correctness Breakdown");
            InsertDetailsList(report, fontDefinition, pageTwo, verticalMillimeters, now, 2);

            return report;
        }
コード例 #20
0
        // Inserts the five-day summary table on the given page.
        private double InsertFiveDaySummary(Report report, FontDef fontDefinition, Page page, double verticalMillimeters)
        {
            const double TableHeightMillimeters = 40.0D;
            const double ColumnPadding = 5.0D;
            const double RowPadding = 2.0D;
            const int RowCount = 7;

            List<DeviceStats>[] levels;
            string[] levelAliases;
            double horizontalMillimeters;
            double tableWidthMillimeters;
            double rowHeightMillimeters;

            string[] labelText;
            FontProp[] labelFonts;
            double labelsWidthMillimeters;

            string[] dayOneText;
            FontProp[] dayOneFonts;
            double dayOneWidthMillimeters;

            string[] dayTwoText;
            FontProp[] dayTwoFonts;
            double dayTwoWidthMillimeters;

            string[] dayThreeText;
            FontProp[] dayThreeFonts;
            double dayThreeWidthMillimeters;

            string[] dayFourText;
            FontProp[] dayFourFonts;
            double dayFourWidthMillimeters;

            string[] dayFiveText;
            FontProp[] dayFiveFonts;
            double dayFiveWidthMillimeters;

            // Get level data and level aliases
            levels = GetLevels(ReportDays - 4);
            levelAliases = GetLevelAliases();

            // Determine the height of each row in the table
            rowHeightMillimeters = (TableHeightMillimeters - ((RowCount - 1) * RowPadding)) / RowCount;

            // Get the text for the labels in the first column of the table
            labelText = new string[] { "" }
                .Concat(Enumerable.Range(0, 5).Select(level => string.Format("L{0}: {1}", level, levelAliases[level])).Reverse())
                .Concat(new string[] { "Total" })
                .ToArray();

            labelFonts = labelText
                .Select(text =>
                {
                    FontProp font = new FontPropMM(fontDefinition, rowHeightMillimeters * 0.8D);
                    font.bBold = true;
                    return font;
                })
                .ToArray();

            labelsWidthMillimeters = labelText
                .Zip(labelFonts, (text, font) => font.rGetTextWidthMM(text))
                .Max();

            // Get the text for the device counts in the second column of the table
            dayOneText = new string[] { (m_reportDate - TimeSpan.FromDays(4.0D)).ToString("MM/dd") }
                .Concat(levels.Select(level => level.Count.ToString()).Reverse())
                .Concat(new string[] { levels.Sum(level => level.Count).ToString() })
                .ToArray();

            dayOneFonts = dayOneText
                .Select((text, index) =>
                {
                    FontProp font = new FontPropMM(fontDefinition, rowHeightMillimeters * 0.8D);
                    font.bBold = index == 0;
                    return font;
                })
                .ToArray();

            dayOneWidthMillimeters = dayOneText
                .Zip(dayOneFonts, (text, font) => font.rGetTextWidthMM(text))
                .Max();

            // Get the text for the device counts in the third column of the table
            levels = GetLevels(ReportDays - 3);

            dayTwoText = new string[] { (m_reportDate - TimeSpan.FromDays(3.0D)).ToString("MM/dd") }
                .Concat(levels.Select(level => level.Count.ToString()).Reverse())
                .Concat(new string[] { levels.Sum(level => level.Count).ToString() })
                .ToArray();

            dayTwoFonts = dayTwoText
                .Select((text, index) =>
                {
                    FontProp font = new FontPropMM(fontDefinition, rowHeightMillimeters * 0.8D);
                    font.bBold = index == 0;
                    return font;
                })
                .ToArray();

            dayTwoWidthMillimeters = dayTwoText
                .Zip(dayTwoFonts, (text, font) => font.rGetTextWidthMM(text))
                .Max();

            // Get the text for the device counts in the fourth column of the table
            levels = GetLevels(ReportDays - 2);

            dayThreeText = new string[] { (m_reportDate - TimeSpan.FromDays(2.0D)).ToString("MM/dd") }
                .Concat(levels.Select(level => level.Count.ToString()).Reverse())
                .Concat(new string[] { levels.Sum(level => level.Count).ToString() })
                .ToArray();

            dayThreeFonts = dayThreeText
                .Select((text, index) =>
                {
                    FontProp font = new FontPropMM(fontDefinition, rowHeightMillimeters * 0.8D);
                    font.bBold = index == 0;
                    return font;
                })
                .ToArray();

            dayThreeWidthMillimeters = dayThreeText
                .Zip(dayThreeFonts, (text, font) => font.rGetTextWidthMM(text))
                .Max();

            // Get the text for the device counts in the fifth column of the table
            levels = GetLevels(ReportDays - 1);

            dayFourText = new string[] { (m_reportDate - TimeSpan.FromDays(1.0D)).ToString("MM/dd") }
                .Concat(levels.Select(level => level.Count.ToString()).Reverse())
                .Concat(new string[] { levels.Sum(level => level.Count).ToString() })
                .ToArray();

            dayFourFonts = dayFourText
                .Select((text, index) =>
                {
                    FontProp font = new FontPropMM(fontDefinition, rowHeightMillimeters * 0.8D);
                    font.bBold = index == 0;
                    return font;
                })
                .ToArray();

            dayFourWidthMillimeters = dayFourText
                .Zip(dayFourFonts, (text, font) => font.rGetTextWidthMM(text))
                .Max();

            // Get the text for the device counts in the sixth column of the table
            levels = GetLevels(ReportDays);

            dayFiveText = new string[] { (m_reportDate).ToString("MM/dd") }
                .Concat(levels.Select(level => level.Count.ToString()).Reverse())
                .Concat(new string[] { levels.Sum(level => level.Count).ToString() })
                .ToArray();

            dayFiveFonts = dayFiveText
                .Select((text, index) =>
                {
                    FontProp font = new FontPropMM(fontDefinition, rowHeightMillimeters * 0.8D);
                    font.bBold = index == 0;
                    return font;
                })
                .ToArray();

            dayFiveWidthMillimeters = dayFiveText
                .Zip(dayFiveFonts, (text, font) => font.rGetTextWidthMM(text))
                .Max();

            // Determine the full width of the table
            tableWidthMillimeters = labelsWidthMillimeters + ColumnPadding
                + dayOneWidthMillimeters + ColumnPadding
                + dayTwoWidthMillimeters + ColumnPadding
                + dayThreeWidthMillimeters + ColumnPadding
                + dayFourWidthMillimeters + ColumnPadding
                + dayFiveWidthMillimeters;

            // Add the table to the page
            for (int i = 0; i < labelText.Length; i++)
            {
                horizontalMillimeters = (PageWidthMillimeters - tableWidthMillimeters) / 2;

                page.AddMM(horizontalMillimeters, verticalMillimeters + rowHeightMillimeters * 0.9D, new RepString(labelFonts[i], labelText[i]));
                horizontalMillimeters += labelsWidthMillimeters + ColumnPadding;

                page.AddMM(horizontalMillimeters + dayOneWidthMillimeters - dayOneFonts[i].rGetTextWidthMM(dayOneText[i]), verticalMillimeters + rowHeightMillimeters * 0.9D, new RepString(dayOneFonts[i], dayOneText[i]));
                horizontalMillimeters += dayOneWidthMillimeters + ColumnPadding;

                page.AddMM(horizontalMillimeters + dayTwoWidthMillimeters - dayTwoFonts[i].rGetTextWidthMM(dayTwoText[i]), verticalMillimeters + rowHeightMillimeters * 0.9D, new RepString(dayTwoFonts[i], dayTwoText[i]));
                horizontalMillimeters += dayTwoWidthMillimeters + ColumnPadding;

                page.AddMM(horizontalMillimeters + dayThreeWidthMillimeters - dayThreeFonts[i].rGetTextWidthMM(dayThreeText[i]), verticalMillimeters + rowHeightMillimeters * 0.9D, new RepString(dayThreeFonts[i], dayThreeText[i]));
                horizontalMillimeters += dayThreeWidthMillimeters + ColumnPadding;

                page.AddMM(horizontalMillimeters + dayFourWidthMillimeters - dayFourFonts[i].rGetTextWidthMM(dayFourText[i]), verticalMillimeters + rowHeightMillimeters * 0.9D, new RepString(dayFourFonts[i], dayFourText[i]));
                horizontalMillimeters += dayFourWidthMillimeters + ColumnPadding;

                page.AddMM(horizontalMillimeters + dayFiveWidthMillimeters - dayFiveFonts[i].rGetTextWidthMM(dayFiveText[i]), verticalMillimeters + rowHeightMillimeters * 0.9D, new RepString(dayFiveFonts[i], dayFiveText[i]));
                verticalMillimeters += rowHeightMillimeters + RowPadding;
            }

            page.AddMM((PageWidthMillimeters - tableWidthMillimeters) / 2, verticalMillimeters - rowHeightMillimeters - (1.5D * RowPadding), new RepRectMM(new BrushProp(report, Color.Black), labelsWidthMillimeters + ColumnPadding + dayOneWidthMillimeters + ColumnPadding + dayTwoWidthMillimeters + ColumnPadding + dayThreeWidthMillimeters + ColumnPadding + dayFourWidthMillimeters + ColumnPadding + dayFiveWidthMillimeters, 0.1D));

            return TableHeightMillimeters;
        }
コード例 #21
0
 // Inserts the given text as a section header (16-pt, bold).
 private double InsertSectionHeader(FontDef fontDefinition, Page page, double verticalMillimeters, string text)
 {
     FontProp font = new FontProp(fontDefinition, 0.0D);
     font.rSizePoint = 16.0D;
     font.bBold = true;
     page.AddCB_MM(verticalMillimeters + font.rSizeMM, new RepString(font, text));
     return 2.0D * font.rSizeMM;
 }
コード例 #22
0
        // Insert the list of definitions on the given page.
        private double InsertDefinitions(FontDef fontDefinition, Page page, double verticalMillimeters)
        {
            const double FontSize = 8.0D;
            const double FooterWidthMillimeters = 6.5D * 25.4D;

            FontProp font = new FontProp(fontDefinition, 0.0D);
            StringBuilder builder;
            int lengthWithoutWord;
            double lineHeightMillimeters;

            string definitionsText = string.Format("Level 4: {0} - Devices which are reporting as expected, with a completeness of at least {1:0.##}% on the report date.", m_level4Alias, m_level4Threshold) + Environment.NewLine +
                string.Format("Level 3: {0} - Devices with a completeness of at least {1:0.##}% on the report date.", m_level3Alias, m_level3Threshold) + Environment.NewLine +
                string.Format("Level 2: Poor - Devices which reported on the report date, but had an completeness below {0:0.##}%.", m_level3Threshold) + Environment.NewLine +
                "Level 1: Offline - Devices which did not report on the report date, but have reported at some time during the 30 days prior to the report date." + Environment.NewLine +
                "Level 0: Failed - Devices which have not reported during the 30 days prior to the report date." + Environment.NewLine +
                "Completeness: Percentage of measurements received over total measurements expected, per device." + Environment.NewLine +
                "Acceptable Quality: Devices which are in Level 4 or Level 3.";

            // Break the definitions text into lines
            string[] lines = definitionsText.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

            // Set font size and line spacing
            font.rSizePoint = FontSize;
            lineHeightMillimeters = 1.5D * font.rSizeMM;

            foreach (string line in lines)
            {
                // String builder will be used to determine if the line is too wide to fit
                // on the page, and to break the line into multiple lines if necessary
                builder = new StringBuilder();

                // Break the line into words
                foreach (string word in line.Split())
                {
                    // Store the length of the line without an additional word so we can restore
                    // the original line if the additional word makes the line too long to fit
                    lengthWithoutWord = builder.Length;

                    // Add white space if this is not the first word in the line
                    if (builder.Length > 0)
                        builder.Append(' ');

                    // Add the word to the line
                    builder.Append(word);

                    // If the line is too long, put the original line onto the page and
                    // trim the string builder down to only the word we just added
                    if (font.rGetTextWidthMM(builder.ToString()) > FooterWidthMillimeters)
                    {
                        page.AddMM(PageMarginMillimeters, verticalMillimeters + font.rSizeMM, new RepString(font, builder.ToString(0, lengthWithoutWord)));
                        builder.Remove(0, lengthWithoutWord);
                        builder.Insert(0, "             ");
                        verticalMillimeters += lineHeightMillimeters;
                    }
                }

                // Add the remainder of the line to the page.
                page.AddMM(PageMarginMillimeters, verticalMillimeters + font.rSizeMM, new RepString(font, builder.ToString()));
                verticalMillimeters += 1.5D * lineHeightMillimeters;
            }

            return 0.0D;
        }
コード例 #23
0
        // Inserts the title and company text on the given page.
        private double InsertTitle(FontDef fontDefinition, Page page, double verticalMillimeters)
        {
            FontProp titleFont = new FontProp(fontDefinition, 0.0D);
            FontProp companyFont = new FontProp(fontDefinition, 0.0D);

            titleFont.rSizePoint = 20.0D;
            companyFont.rSizePoint = 14.0D;
            titleFont.bBold = true;
            companyFont.bBold = true;

            // Title
            page.AddCB_MM(verticalMillimeters + titleFont.rSizeMM, new RepString(titleFont, m_titleText));
            verticalMillimeters += 1.5D * titleFont.rSizeMM;

            // Company
            page.AddCB_MM(verticalMillimeters + companyFont.rSizeMM, new RepString(companyFont, m_companyText));

            return (1.5D * titleFont.rSizeMM) + companyFont.rSizeMM;
        }
コード例 #24
0
        // Inserts the pie chart to the given page, which includes the level summary for the report date beside it.
        private double InsertPieChart(FontDef fontDefinition, Page page, double verticalMillimeters)
        {
            const double ChartWidthMillimeters = (300.0D / 96.0D) * 25.4D;
            const double ChartHeightMillimeters = (300.0D / 96.0D) * 25.4D;
            const double ColumnPadding = 10.0D;

            List<DeviceStats>[] levels = GetLevels(ReportDays);
            Color[] colors = GetLevelColors();
            double verticalStart = verticalMillimeters;

            double totalWidthMillimeters;
            double horizontalMillimeters;
            double rowHeightMillimeters;

            string[] labelText;
            FontProp[] labelFonts;
            double labelsWidthMillimeters;

            string[] countText;
            FontProp[] countFonts;
            double countsWidthMillimeters;

            using (Chart chart = GetPieChart())
            {
                // Determine the height of each row of the level summary
                rowHeightMillimeters = (ChartHeightMillimeters * 0.8D) / levels.Length;

                // Add vertical indent of 10% of the chart height
                verticalMillimeters += ChartHeightMillimeters * 0.1D;

                // Get the text for the labels in the first column of the table
                labelText = levels
                    .Select((level, index) => "Level " + index)
                    .Reverse()
                    .ToArray();

                labelFonts = labelText
                    .Select(text =>
                    {
                        FontProp font = new FontPropMM(fontDefinition, rowHeightMillimeters * 0.6D);
                        font.bBold = true;
                        return font;
                    })
                    .Reverse()
                    .ToArray();

                labelsWidthMillimeters = labelText
                    .Zip(labelFonts, (text, font) => font.rGetTextWidthMM(text))
                    .Max();

                // Get the text for the device counts in the second column of the table
                countText = levels
                    .Select(level => level.Count.ToString())
                    .Reverse()
                    .ToArray();

                countFonts = countText
                    .Select((text, level) => (FontProp)new FontPropMM(fontDefinition, rowHeightMillimeters * 0.6D, colors[level]))
                    .Reverse()
                    .ToArray();

                countsWidthMillimeters = countText
                    .Zip(countFonts, (text, font) => font.rGetTextWidthMM(text))
                    .Max();

                // Determine the total width of the pie chart and level summary,
                // then set horizontalMillimeters such that the pie chart and level
                // summary are centered on the page
                totalWidthMillimeters = labelsWidthMillimeters + ColumnPadding + countsWidthMillimeters + ColumnPadding + ChartWidthMillimeters;
                horizontalMillimeters = (PageWidthMillimeters - totalWidthMillimeters) / 2.0D;

                // Add the table to the page
                for (int i = 0; i < levels.Length; i++)
                {
                    page.AddMM(horizontalMillimeters, verticalMillimeters + rowHeightMillimeters * 0.8D, new RepString(labelFonts[i], labelText[i]));
                    page.AddMM(horizontalMillimeters + labelsWidthMillimeters + ColumnPadding + countsWidthMillimeters - countFonts[i].rGetTextWidthMM(countText[i]), verticalMillimeters + rowHeightMillimeters * 0.8D, new RepString(countFonts[i], countText[i]));
                    verticalMillimeters += rowHeightMillimeters;
                }

                // Add the pie chart to the page
                verticalMillimeters = verticalStart;
                page.AddMM(horizontalMillimeters + labelsWidthMillimeters + ColumnPadding + countsWidthMillimeters + ColumnPadding, verticalMillimeters + ChartHeightMillimeters, new RepImageMM(ChartToImage(chart), ChartWidthMillimeters, ChartHeightMillimeters));
            }

            return ChartHeightMillimeters;
        }
コード例 #25
0
        // Insert the list of definitions on the given page.
        private double InsertDefinitions(FontDef fontDefinition, Page page, double verticalMillimeters)
        {
            const double FontSize = 8.0D;
            const double FooterWidthMillimeters = 6.5D * 25.4D;

            FontProp font = new FontProp(fontDefinition, 0.0D);
            StringBuilder builder;
            int lengthWithoutWord;
            double lineHeightMillimeters;

            string definitionsText = "Good: Measurements received which are neither latched nor unreasonable." + Environment.NewLine +
                                     "Latched: Measurements received which have maintained the same value for an extended period of time." + Environment.NewLine +
                                     "Unreasonable: Measurements received whose values have fallen outside of the range defined by reasonability constraints." + Environment.NewLine +
                                     "Correctness: Percentage of good measurements over total measurements expected, per device.";

            // Break the definitions text into lines
            string[] lines = definitionsText.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

            // Set font size and line spacing
            font.rSizePoint = FontSize;
            lineHeightMillimeters = 1.5D * font.rSizeMM;

            foreach (string line in lines)
            {
                // String builder will be used to determine if the line is too wide to fit
                // on the page, and to break the line into multiple lines if necessary
                builder = new StringBuilder();

                // Break the line into words
                foreach (string word in line.Split())
                {
                    // Store the length of the line without an additional word so we can restore
                    // the original line if the additional word makes the line too long to fit
                    lengthWithoutWord = builder.Length;

                    // Add white space if this is not the first word in the line
                    if (builder.Length > 0)
                        builder.Append(' ');

                    // Add the word to the line
                    builder.Append(word);

                    // If the line is too long, put the original line onto the page and
                    // trim the string builder down to only the word we just added
                    if (font.rGetTextWidthMM(builder.ToString()) > FooterWidthMillimeters)
                    {
                        page.AddMM(PageMarginMillimeters, verticalMillimeters + font.rSizeMM, new RepString(font, builder.ToString(0, lengthWithoutWord)));
                        builder.Remove(0, lengthWithoutWord);
                        builder.Insert(0, "             ");
                        verticalMillimeters += lineHeightMillimeters;
                    }
                }
                
                // Add the remainder of the line to the page.
                page.AddMM(PageMarginMillimeters, verticalMillimeters + font.rSizeMM, new RepString(font, builder.ToString()));
                verticalMillimeters += 1.5D * lineHeightMillimeters;
            }

            return 0.0D;
        }
コード例 #26
0
        // Add detailed information about each individual device, starting on the current page and adding new pages as necessary.
        private void InsertDetailsList(Report report, FontDef fontDefinition, Page page, double verticalMillimeters, DateTime now, int pageNumber)
        {
            const double ColumnPaddingMillimeters = 10.0D;
            const double RowPaddingMillimeters = 2.0D;

            double[] columnWidthMillimeters;
            double listWidthMillimeters;
            double horizontalMillimeters;

            FontProp levelFont = new FontPropMM(fontDefinition, 0.0D);
            FontProp columnHeaderFont = new FontPropMM(fontDefinition, 0.0D);
            FontProp rowFont = new FontPropMM(fontDefinition, 0.0D);

            List<DeviceStats>[] levels = GetLevels(ReportDays);
            string[][][] levelDetails = new string[levels.Length][][];
            string[][] deviceDetails;
            string[] columnHeaders;

            // Set up fonts to be used in the details list
            levelFont.rSizePoint = 12.0D;
            columnHeaderFont.rSizePoint = 10.0D;
            rowFont.rSizePoint = 10.0D;
            levelFont.bBold = true;
            columnHeaderFont.bBold = true;

            // Set up the column header and the initial values for the column widths
            columnHeaders = new string[] { "Name", "Completeness", "Data Errors", "Time Errors" };
            columnWidthMillimeters = columnHeaders.Select(columnHeaderFont.rGetTextWidthMM).ToArray();

            for (int level = 0; level < levels.Length; level++)
            {
                // Set up the device details array for the current level
                deviceDetails = new string[levels[level].Count][];
                levelDetails[level] = deviceDetails;

                // Sort the devices in this level by name
                levels[level].Sort((device1, device2) => string.Compare(device1.Name, device2.Name, StringComparison.Ordinal));

                for (int device = 0; device < levels[level].Count; device++)
                {
                    // Populate the device details with data for each device
                    deviceDetails[device] = new string[]
                    {
                        levels[level][device].Name,
                        (levels[level][device].MeasurementsReceived[ReportDays - 1] / levels[level][device].MeasurementsExpected[ReportDays - 1]).ToString("0.##%"),
                        levels[level][device].DataQualityErrors[ReportDays - 1].ToString("#,##0"),
                        levels[level][device].TimeQualityErrors[ReportDays - 1].ToString("#,##0")
                    };

                    // Update the column widths if they need to be widened to accomodate the data
                    columnWidthMillimeters = columnWidthMillimeters.Zip(deviceDetails[device], (currentWidth, text) => Math.Max(currentWidth, rowFont.rGetTextWidthMM(text))).ToArray();
                }
            }

            // Determine the total width of the list so that it can be centered
            listWidthMillimeters = columnWidthMillimeters.Sum(width => width + ColumnPaddingMillimeters) - ColumnPaddingMillimeters;

            for (int level = 0; level < levels.Length; level++)
            {
                // Get the device details for the current level
                deviceDetails = levelDetails[level];

                // If the level has no data, don't bother adding it to the details list
                if (deviceDetails.Length > 0)
                {
                    // If the height of the level header, plus the column header, plus one row of data reaches beyond the bottom of the page, start a new page
                    if (verticalMillimeters + levelFont.rSizeMM + columnHeaderFont.rSizeMM + rowFont.rSizeMM > PageHeightMillimeters - PageMarginMillimeters - FooterHeightMillimeters - SpacingMillimeters)
                    {
                        // Insert footer on the current page first
                        InsertFooter(fontDefinition, page, now, pageNumber);

                        // Increment the page number and create a new page
                        page = CreatePage(report);
                        pageNumber++;

                        // Add the report date to the top of the page
                        verticalMillimeters = PageMarginMillimeters;
                        verticalMillimeters += InsertReportDate(fontDefinition, page, PageMarginMillimeters) + SpacingMillimeters;
                    }

                    // Add the level header to the page
                    horizontalMillimeters = (PageWidthMillimeters - listWidthMillimeters) / 2.0D;
                    page.AddMM(horizontalMillimeters, verticalMillimeters + levelFont.rSizeMM, new RepString(levelFont, "Level " + level));
                    verticalMillimeters += levelFont.rSizeMM + RowPaddingMillimeters;

                    // Add the column header to the page
                    for (int i = 0; i < columnHeaders.Length; i++)
                    {
                        page.AddMM(horizontalMillimeters, verticalMillimeters + columnHeaderFont.rSizeMM, new RepString(columnHeaderFont, columnHeaders[i]));
                        horizontalMillimeters += columnWidthMillimeters[i] + ColumnPaddingMillimeters;
                    }

                    verticalMillimeters += columnHeaderFont.rSizeMM + RowPaddingMillimeters;

                    // Each device is on its own row in the details list
                    foreach (string[] row in deviceDetails)
                    {
                        // If the height of the row reaches beyond the bottom of the page, start a new page
                        if (verticalMillimeters + rowFont.rSizeMM > PageHeightMillimeters - PageMarginMillimeters - FooterHeightMillimeters - SpacingMillimeters)
                        {
                            // Insert footer on the current page first
                            InsertFooter(fontDefinition, page, now, pageNumber);

                            // Increment the page number and create a new page
                            page = CreatePage(report);
                            pageNumber++;

                            // Add the report date to the top of the page
                            verticalMillimeters = PageMarginMillimeters;
                            verticalMillimeters += InsertReportDate(fontDefinition, page, PageMarginMillimeters) + SpacingMillimeters;

                            // Add the level header again, designated with the abbreviation "contd."
                            horizontalMillimeters = (PageWidthMillimeters - listWidthMillimeters) / 2.0D;
                            page.AddMM(horizontalMillimeters, verticalMillimeters + levelFont.rSizeMM, new RepString(levelFont, "Level " + level + " (contd.)"));
                            verticalMillimeters += levelFont.rSizeMM + RowPaddingMillimeters;

                            // Add the column header again to the top of the new page
                            for (int i = 0; i < columnHeaders.Length; i++)
                            {
                                page.AddMM(horizontalMillimeters, verticalMillimeters + columnHeaderFont.rSizeMM, new RepString(columnHeaderFont, columnHeaders[i]));
                                horizontalMillimeters += columnWidthMillimeters[i] + ColumnPaddingMillimeters;
                            }

                            verticalMillimeters += columnHeaderFont.rSizeMM + RowPaddingMillimeters;
                        }

                        // Add the device data, on its own row, to the details list
                        horizontalMillimeters = (PageWidthMillimeters - listWidthMillimeters) / 2.0D;

                        for (int column = 0; column < row.Length; column++)
                        {
                            page.AddMM(horizontalMillimeters, verticalMillimeters + rowFont.rSizeMM, new RepString(rowFont, row[column]));
                            horizontalMillimeters += columnWidthMillimeters[column] + ColumnPaddingMillimeters;
                        }

                        verticalMillimeters += rowFont.rSizeMM + RowPaddingMillimeters;
                    }

                    // Add space between levels
                    verticalMillimeters += levelFont.rSizeMM;
                }
            }

            // Insert the footer on the last page of the report
            InsertFooter(fontDefinition, page, now, pageNumber);
        }
コード例 #27
0
        //------------------------------------------------------------------------------------------30.10.2004
        /// <summary>Creates this report.</summary>
        /// <remarks>
        /// This method overrides the method <see cref="Root.Reports.Report.Create"/> of the base class <see cref="Root.Reports.Report"/>.
        /// </remarks>
        protected override void Create()
        {
            fontDef_Helvetica = new FontDef(this, FontDef.StandardFont.TimesRoman);
            FontProp fontProp_Text = new FontPropMM(fontDef_Helvetica, 1.9);  // standard font
            FontProp fontProp_Header = new FontPropMM(fontDef_Helvetica, 1.9);  // font of the table header
            fontProp_Header.bBold = true;

            // create table
            TableLayoutManager tlm;
            using (tlm = new TableLayoutManager(fontProp_Header))
            {
                tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table
                tlm.tlmCellDef_Header.rAlignV = RepObj.rAlignCenter;  // set vertical alignment of all header cells
                tlm.tlmCellDef_Default.penProp_LineBottom = new PenProp(this, 0.05, Color.LightGray);  // set bottom line for all cells
                tlm.tlmHeightMode = TlmHeightMode.AdjustLast;
                tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

                // define columns
                TlmColumn col;
                

                col = new TlmColumnMM(tlm, "Assistido", 50);
                col.tlmCellDef_Default.tlmTextMode = TlmTextMode.MultiLine;

                col = new TlmColumnMM(tlm, "Dt. Nascimento", 24);

                col = new TlmColumnMM(tlm, "Dt. Entrada", 20);

                col = new TlmColumnMM(tlm, "Dt. Saída", 20);

                col = new TlmColumnMM(tlm, "Estado Saúde", 22);

                col = new TlmColumnMM(tlm, "Status", 26);

                col = new TlmColumnMM(tlm, "Ativo", 15);

                System.Collections.Generic.List<Assistido> listaAssistido = (System.Collections.Generic.List<Assistido>)RelatorioDTO.DadosRelatorio;
                foreach (Assistido assistido in listaAssistido)
                {
                    tlm.NewRow();
                    tlm.Add(0, new RepString(fontProp_Text, assistido.Nome));

                    if (assistido.DataNascimento.HasValue) tlm.Add(1, new RepString(fontProp_Text, assistido.DataNascimento.Value.ToString("dd/MM/yyyy")));
                    else tlm.Add(1, new RepString(fontProp_Text, ""));
                    
                    tlm.Add(2, new RepString(fontProp_Text, assistido.DataEntrada.Value.ToString("dd/MM/yyyy")));

                    if (assistido.DataSaida.HasValue) tlm.Add(3, new RepString(fontProp_Text, assistido.DataSaida.Value.ToString("dd/MM/yyyy")));
                    else tlm.Add(3, new RepString(fontProp_Text, ""));
                    
                    tlm.Add(4, new RepString(fontProp_Text, assistido.EstadoSaude));

                    tlm.Add(5, new RepString(fontProp_Text, assistido.StatusAssistido));

                    tlm.Add(6, new RepString(fontProp_Text, assistido.AssistidoAtivo));
                }
            }
            //page_Cur.AddCT_MM(rPosLeft + tlm.rWidthMM / 2, rPosTop + tlm.rCurY_MM + 2, new RepString(fontProp_Text, "- end of table -"));

            // print page number and current date/time
            Double rY = rPosBottom + 1.5;
            foreach (Page page in enum_Page)
            {
                page.AddLT_MM(rPosLeft, rY, new RepString(fontProp_Text, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
                page.AddRT_MM(rPosRight, rY, new RepString(fontProp_Text, page.iPageNo + " / " + iPageCount));
            }
        }
コード例 #28
0
        //------------------------------------------------------------------------------------------30.10.2004
        /// <summary>Creates this report.</summary>
        /// <remarks>
        /// This method overrides the method <see cref="Root.Reports.Report.Create"/> of the base class <see cref="Root.Reports.Report"/>.
        /// </remarks>
        protected override void Create()
        {
            fontDef_Helvetica = new FontDef(this, FontDef.StandardFont.TimesRoman);
            FontProp fontProp_Text = new FontPropMM(fontDef_Helvetica, 1.9);  // standard font
            FontProp fontProp_Header = new FontPropMM(fontDef_Helvetica, 1.9);  // font of the table header
            fontProp_Header.bBold = true;

            // create table
            TableLayoutManager tlm;
            using (tlm = new TableLayoutManager(fontProp_Header))
            {
                tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table
                tlm.tlmCellDef_Header.rAlignV = RepObj.rAlignCenter;  // set vertical alignment of all header cells
                tlm.tlmCellDef_Default.penProp_LineBottom = new PenProp(this, 0.05, Color.LightGray);  // set bottom line for all cells
                tlm.tlmHeightMode = TlmHeightMode.AdjustLast;
                tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

                // define columns
                TlmColumn col;

                col = new TlmColumnMM(tlm, "Natureza Lançamento", 80);
                col.tlmCellDef_Default.tlmTextMode = TlmTextMode.MultiLine;

                col = new TlmColumnMM(tlm, "Tipo", 40);

                col = new TlmColumnMM(tlm, "Data", 30);

                col = new TlmColumnMM(tlm, "Valor", 30);


                 List<Financas> listaFinancas = (List<Financas>)RelatorioDTO.DadosRelatorio;
                Decimal valorTotal = 0;
                foreach (Financas financas in listaFinancas)
                {
                    tlm.NewRow();
                    tlm.Add(0, new RepString(fontProp_Text, financas.NaturezaLancamento.NomeNatureza));

                    tlm.Add(1, new RepString(fontProp_Text, financas.TipoLancamento));

                    tlm.Add(2, new RepString(fontProp_Text, financas.DataLancamento.Value.ToString("dd/MM/yyyy")));

                    tlm.Add(3, new RepString(fontProp_Text, String.Format("{0:C2}", financas.Valor.Value)));

                    valorTotal += financas.Valor.Value;
                }

                if (listaFinancas.Count > 0)
                {
                    tlm.NewRow();
                    tlm.Add(0, new RepString(fontProp_Text, ""));
                    tlm.Add(1, new RepString(fontProp_Text, ""));
                    tlm.Add(2, new RepString(fontProp_Text, "Total:"));
                    tlm.Add(3, new RepString(fontProp_Text, String.Format("{0:C2}", valorTotal)));
                }

            }


            //page_Cur.AddCT_MM(rPosLeft + tlm.rWidthMM / 2, rPosTop + tlm.rCurY_MM + 2, new RepString(fontProp_Text, "- end of table -"));

            // print page number and current date/time
            Double rY = rPosBottom + 1.5;
            foreach (Page page in enum_Page)
            {
                page.AddLT_MM(rPosLeft, rY, new RepString(fontProp_Text, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
                page.AddRT_MM(rPosRight, rY, new RepString(fontProp_Text, page.iPageNo + " / " + iPageCount));
            }
        }
コード例 #29
0
ファイル: wsGet.cs プロジェクト: mborja/mkpy_bccar
    private string crearPdf(
        string APPID,
        string PIN,
        string IMSI,
        string ZONA,
        string CAMPAÑA,
        string IDPAIS,
        string IDOTRASMARCAS,
        string IDNIVELEDUCATIVO,
        string IDESTADOCIVIL,
        string IDTIPOCONTACTO,
        string IDTIPODOCUMENTO,
        string CODIGOTERRITORIO,
        string CODIGOCONSULTORARECOMIENDA,
        string APELLIDOPATERNO,
        string APELLIDOMATERNO,
        string PRIMERNOMBRE,
        string SEGUNDONOMBRE,
        string FECHANACIMIENTO,
        string NRODOCUMENTO,
        string RECORD_LONG,
        string RECORD_LAT,
        string MARGEN,
        string satelites,
        string VERIFICADO,
        string TIPOACCION,
        string TELEFONOCASA,
        string TELEFONOCELULAR,
        string CORREOELEC,
        string NOTIENECORREO,
        string SOLICITANTE_DIRECCION,
        string SOLICITANTE_REFERENCIA,
        string SOLICITANTE_CPOSTAL,
        string SOLICITANTE_PUEBLO,
        string SOLICITANTE_ESTADO,
        string SOLICITANTE_MUNICIPIO,
        string SOLICITANTE_CIUDAD,
        string SOLICITANTE_PROVINCIA,
        string REFFAM_NOMBRES,
        string REFFAM_APELLIDOPATERNO,
        string REFFAM_APELLIDOMATERNO,
        string REFFAM_DIRECCION,
        string REFFAM_TELEFONO,
        string REFFAM_CELULAR,
        string REFFAM_IDTIPOVINCULO,
        string REFNOFAM_NOMBRES,
        string REFNOFAM_APELLIDOPATERNO,
        string REFNOFAM_APELLIDOMATERNO,
        string REFNOFAM_DIRECCION,
        string REFNOFAM_TELEFONO,
        string REFNOFAM_CELULAR,
        string REFNOFAM_IDTIPOVINCULO,
        string ENTREGA_DIRECCION,
        string ENTREGA_PUEBLO,
        string ENTREGA_CPOSTAL,
        string ENTREGA_REFERENCIA,
        string RECORD_IMSI,
        string RECORD_PIN,
        string RECORD_OBSERVACION,
        string RECORD_FECHAVISITA
        )
    {
        int m = 30;//margen
        Report report = new Report(new PdfFormatter());
        FontDef fd = new FontDef(report, "Helvetica");
        FontProp fp1 = new FontPropMM(fd, 2, System.Drawing.Color.Black);
        FontProp fp2 = new FontPropMM(fd, 2, System.Drawing.Color.Black);
        fp2.bBold = true;
        FontProp fp_Title = new FontPropMM(fd, 4);
        Root.Reports.Page page = new Root.Reports.Page(report);
        fp_Title.bBold = true;
        Double rX = 60;
        Double rY = 20;
        Double rYTemp, rYContinue;
        Double rYcopy = rY;
        //centrado al medio del dpdf
        page.AddCB_MM(10, new RepString(fp_Title, "Solicitud de Credito"));
        rY += fp_Title.rLineFeedMM;

        page.AddMM(rX, rY, new RepString(fp1, "Código territorial:"));
        page.AddRightMM(rX + 80, rY, new RepString(fp2, CODIGOTERRITORIO));
        rY += fp1.rLineFeedMM;
        page.AddMM(rX, rY, new RepString(fp1, "Año:"));
        page.AddRightMM(rX + 80, rY, new RepString(fp2, "falta año")); //falta de donde sacar año
        rY += fp1.rLineFeedMM;
        page.AddMM(rX, rY, new RepString(fp1, "CAMP."));
        page.AddRightMM(rX + 80, rY, new RepString(fp2, CAMPAÑA));
        rY += fp1.rLineFeedMM;
        page.AddMM(rX, rY, new RepString(fp1, "Código consultora que recomienda:"));
        page.AddRightMM(rX + 80, rY, new RepString(fp2, CODIGOCONSULTORARECOMIENDA));
        rY += fp1.rLineFeedMM;
        page.AddMM(rX, rY, new RepString(fp1, "Consultora que recomienda :"));
        page.AddRightMM(rX + 80, rY, new RepString(fp2, "falta nombre consultora")); //falta obtener nombre consultora recomienda
        rY += fp1.rLineFeedMM;
        page.AddMM(rX, rY, new RepString(fp1, "Selección Premio:"));
        page.AddRightMM(rX + 80, rY, new RepString(fp2, "falta sacar premio")); //falta de donde sacar premio
        // rY += fp.rLineFeedMM;

        rX = 20;
        rY += 10;
        rYTemp = rY;
        page.AddMM(rX, rY, new RepString(fp1, "Primer Apellido:"));
        page.AddRightMM(rX + 80, rY, new RepString(fp2, APELLIDOPATERNO));
        rY += fp1.rLineFeedMM;
        page.AddMM(rX, rY, new RepString(fp1, "Primer Nombre:"));
        page.AddRightMM(rX + 80, rY, new RepString(fp2, PRIMERNOMBRE));
        rY += fp1.rLineFeedMM;
        page.AddMM(rX, rY, new RepString(fp1, "Fecha nacimiento:"));
        page.AddRightMM(rX + 80, rY, new RepString(fp2, FECHANACIMIENTO));
        rY += fp1.rLineFeedMM;
        page.AddMM(rX, rY, new RepString(fp1, "Estado civil:"));
        page.AddRightMM(rX + 80, rY, new RepString(fp2, IDESTADOCIVIL));
        rY += fp1.rLineFeedMM;
        page.AddMM(rX, rY, new RepString(fp1, "Nivel Educativo :"));
        page.AddRightMM(rX + 80, rY, new RepString(fp2, IDNIVELEDUCATIVO));
        rY += fp1.rLineFeedMM;
        //page.AddMM(rX, rY, new RepString(fp, "Selección Premio:"));
        //page.AddRightMM(rX + 80, rY, new RepInt32(fp, 0, "$#;($#);Zero"));
        //rYContinue = rY;

        rX += 90;
        rY = rYTemp;
        page.AddMM(rX, rY, new RepString(fp1, "Segundo apellido:"));
        page.AddRightMM(rX + 80, rY, new RepString(fp2, APELLIDOMATERNO));
        rY += fp1.rLineFeedMM;
        page.AddMM(rX, rY, new RepString(fp1, "Segundo Nombre:"));
        page.AddRightMM(rX + 80, rY, new RepString(fp2, SEGUNDONOMBRE));
        rY += fp1.rLineFeedMM;
        page.AddMM(rX, rY, new RepString(fp1, "Doc de identidad:"));
        page.AddRightMM(rX + 80, rY, new RepString(fp2, IDTIPODOCUMENTO));
        rY += fp1.rLineFeedMM;
        page.AddMM(rX, rY, new RepString(fp1, "Número:"));
        page.AddRightMM(rX + 80, rY, new RepString(fp2, NRODOCUMENTO));
        rY += fp1.rLineFeedMM;
        page.AddMM(rX, rY, new RepString(fp1, "Vendes otras Marcas :"));
        page.AddRightMM(rX + 80, rY, new RepString(fp2, IDOTRASMARCAS));
        rY += fp1.rLineFeedMM;
        //page.AddMM(rX, rY, new RepString(fp, "Selección Premio:"));
        //page.AddRightMM(rX + 80, rY, new RepInt32(fp, 0, "$#;($#);Zero"));

        string archivo = "sc" + DateTime.Now.Second + DateTime.Now.Millisecond;
        report.Save(@"C:\Bcaribe\" + archivo + ".pdf");

        return archivo;
        // RT.ViewPDF(report, "MiInforme.pdf");
    }
コード例 #30
0
        /// <summary>
        /// Crea un reporte
        /// </summary>
        /// <returns></returns>
        public Report Generar()
        {
            // Inicialización de los componentes del documento
            Report rReporte = new Report(new PdfFormatter());
            FontDef fd = new FontDef(rReporte, _sFont);
            FontProp fp = new FontProp(fd, _iSize);
            Page pPagina = new Page(rReporte);
            cUDGDFSOLICITUDNegocios sSolicitudes = new cUDGDFSOLICITUDNegocios(0, "", 0, "");
            DataTable dtSolicitudes;
            String[] sUsuarios;
            int iContadorUsuarios = 1;

            // Obtiene las solicitudes aprobadas dentro del rango de fechas
            dtSolicitudes = sSolicitudes.SeleccionarAprobadas(_sfechainicio, _sfechafin);

            // Imprime el documento
            // Encabezado del documento
            InsertarTitulo("Reporte de reservaciones", fp, pPagina, rReporte);
            InsertarTitulo(_sfechainicio.ToShortDateString() + " - " + _sfechafin.ToShortDateString(), fp, pPagina, rReporte);
            InsertarLinea("", fp, pPagina, rReporte);

            // Resumen del documento
            InsertarSubtitulo("Resumen de reservaciones", fp, pPagina, rReporte);
            foreach (Instalacion insLocal in GenerarResumen(dtSolicitudes))
            {
                InsertarLinea("Reservaciones para " + insLocal.sInstalacion + ": " + insLocal.iContador + ".", fp, pPagina, rReporte);
            }
            InsertarLinea("", fp, pPagina, rReporte);
            InsertarDivisor(fp, pPagina, rReporte);
            InsertarLinea("", fp, pPagina, rReporte);

            // Imprime cada solicitud
            InsertarSubtitulo("Solicitudes aprobadas dentro del rango de fechas", fp, pPagina, rReporte);
            InsertarLinea("", fp, pPagina, rReporte);

            foreach (DataRow drRow in dtSolicitudes.Rows)
            {
                InsertarLinea("Identificacion de solicitud: " + drRow[0].ToString(), fp, pPagina, rReporte);
                InsertarLinea("", fp, pPagina, rReporte);
                InsertarLinea("Fecha inicio: " + DateTime.Parse(drRow[2].ToString()).ToShortDateString(), fp, pPagina, rReporte);
                InsertarLinea("", fp, pPagina, rReporte);
                InsertarLinea("Fecha fin: " + DateTime.Parse(drRow[3].ToString()).ToShortDateString(), fp, pPagina, rReporte);
                InsertarLinea("", fp, pPagina, rReporte);
                InsertarLinea("Fecha de la solicitud: " + DateTime.Parse(drRow[4].ToString()).ToShortDateString(), fp, pPagina, rReporte);
                InsertarLinea("", fp, pPagina, rReporte);
                InsertarLinea("Hora inicio: " + drRow[5].ToString(), fp, pPagina, rReporte);
                InsertarLinea("", fp, pPagina, rReporte);
                InsertarLinea("Hora fin: " + drRow[6].ToString(), fp, pPagina, rReporte);
                InsertarLinea("", fp, pPagina, rReporte);
                InsertarLinea("Nombre de encargado: " + drRow[7].ToString(), fp, pPagina, rReporte);
                InsertarLinea("", fp, pPagina, rReporte);
                InsertarLinea("Nombre de institucion/grupo: " + drRow[8].ToString(), fp, pPagina, rReporte);
                InsertarLinea("", fp, pPagina, rReporte);
                InsertarLinea("Identificacion encargado: " + drRow[9].ToString(), fp, pPagina, rReporte);
                InsertarLinea("", fp, pPagina, rReporte);
                InsertarLinea("Tipo de Solicitante: " + drRow[20].ToString(), fp, pPagina, rReporte);
                InsertarLinea("", fp, pPagina, rReporte);
                InsertarLinea("Observaciones: " + drRow[11].ToString(), fp, pPagina, rReporte);
                InsertarLinea("", fp, pPagina, rReporte);
                InsertarLinea("Razon de uso: " + drRow[12].ToString(), fp, pPagina, rReporte);
                InsertarLinea("", fp, pPagina, rReporte);
                InsertarLinea("Correo solicitante: " + drRow[14].ToString(), fp, pPagina, rReporte);
                InsertarLinea("", fp, pPagina, rReporte);
                InsertarLinea("Usuarios:", fp, pPagina, rReporte);
                sUsuarios = drRow[16].ToString().Split(',');
                foreach (String sLocal in sUsuarios)
                {
                    InsertarLinea(iContadorUsuarios + ". " + sLocal, fp, pPagina, rReporte);
                    iContadorUsuarios++;
                }
                InsertarLinea("", fp, pPagina, rReporte);
                InsertarLinea("Cantidad de usuarios hombres: " + drRow[17].ToString(), fp, pPagina, rReporte);
                InsertarLinea("", fp, pPagina, rReporte);
                InsertarLinea("Cantidad de usuarios mujeres: " + drRow[18].ToString(), fp, pPagina, rReporte);
                InsertarLinea("", fp, pPagina, rReporte);
                InsertarDivisor(fp, pPagina, rReporte);
                InsertarLinea("", fp, pPagina, rReporte);
            }

            // retorna el documento para poder ser presentado al usuario
            return rReporte;
        }