Esempio n. 1
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Creates this document</summary>
        private void FontTest()
        {
            FontProp fp_Title = new FontPropMM(fontDef, 12);

            fp_Title.bBold = true;

            fp        = new FontPropMM(fontDef, 6);
            fp_Small  = new FontPropMM(fontDef, 1.4);
            fp_XSmall = new FontPropMM(fontDef, 0.8);
            bp        = new BrushProp(this, Color.FromArgb(200, 200, 200));

            page_Cur = new Page(this);
            page_Cur.AddCB_MM(30, new RepString(fp_Title, "Font Test"));

            rX = 300;
            rY = 40;
            for (Int32 i = 32; i < 127; i++)
            {
                PrintCharacter(i);
            }
            for (Int32 i = 161; i < 256; i++)
            {
                PrintCharacter(i);
            }
            PrintCharacter('€');
        }
Esempio n. 2
0
        public void CreatePDFObjects()
        {
            FontDef fdNew;

            foreach (var itm in pdfCtrls)
            {
                if (itm.GetType().Equals(typeof(PDFLabel)))
                {
                    PDFLabel tempPDFLbl = (PDFLabel)itm;
                    try
                    {
                        fdNew = new FontDef(rpt, tempPDFLbl.FontNameType);
                        fd    = fdNew;
                    }
                    catch
                    {
                    }
                    FontProp fp = new FontPropMM(fd, tempPDFLbl.FontSize / 10);
                    page.Add(tempPDFLbl.X_Coord, tempPDFLbl.Y_Coord, new RepString(fp, tempPDFLbl.Text));
                }
                else if (itm.GetType().Equals(typeof(PDFLine)))
                {
                    PDFLine tempPDFLine = (PDFLine)itm;
                    PenProp pp          = new PenProp(rpt, tempPDFLine.thickness);
                    page.Add(tempPDFLine.X_Coord, tempPDFLine.Y_Coord, new RepLine(pp, tempPDFLine.endX, tempPDFLine.endY));
                }
            }
        }
Esempio n. 3
0
        static protected void RenderToPDF(ControllerContext ctx, string pathToView)
        {
            Report   report = new Report(new PdfFormatter());
            FontDef  fd     = new FontDef(report, "Courier");
            FontProp fp     = new FontPropMM(fd, 11 / 4);
            Page     page   = new Page(report);

            string html = RenderViewToString(ctx, pathToView, null, true);

            string[] lines  = html.Split('\n');
            int      lineNo = 0;

            foreach (var line in lines)
            {
                page.AddLT_MM(0, lineNo, new RepString(fp, line));
                lineNo += (int)(4 * 1.5);
            }

#if DEBUG
            RT.ViewPDF(report);
#else
            RT.ResponsePDF(report, System.Web.HttpContext.Current.Response);
            //RT.ResponsePDF(report, page);
#endif
        }
Esempio n. 4
0
        //------------------------------------------------------------------------------------------20.03.2004
        /// <summary>Creates this report.</summary>
        /// <remarks>
        /// The method <see cref="Root.Reports.Report.Create"/> of class <see cref="Root.Reports.Report"/> must
        /// be overridden to create the contents of the report.
        /// </remarks>
        protected override void Create()
        {
            FontDef  fontDef  = new FontDef(this, FontDef.StandardFont.Helvetica);
            FontProp fontProp = new FontPropMM(fontDef, 20);

            new Page(this);
            page_Cur.AddCB_MM(120, new RepString(fontProp, "Start Template"));
        }
Esempio n. 5
0
        private Double rPosBottom = 278; // millimeters

        //------------------------------------------------------------------------------------------31.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()
        {
            fd = new FontDef(this, FontDef.StandardFont.Helvetica);
            FontProp fp_Title = new FontPropMM(fd, 7.8);

            fp_Title.bBold = true;
            FontProp fp = new FontPropMM(fd, 2.1);

            fp.rLineFeedMM *= 0.85; // reduce line height by 15%
            FontProp fp_Bold = new FontPropMM(fd, 2.1);

            fp_Bold.rLineFeedMM *= 0.85;
            fp_Bold.bBold        = true;

            FlowLayoutManager flm = new FlowLayoutManager();

            flm.rContainerWidthMM  = rPosRight - rPosLeft;
            flm.rContainerHeightMM = rPosBottom - rPosTop;
            flm.eNewContainer     += new FlowLayoutManager.NewContainerEventHandler(Flm_NewContainer);

            // generate random text
            StringBuilder sb     = new StringBuilder(20000);
            Random        random = new Random(unchecked ((Int32)DateTime.Now.Ticks));

            for (Int32 iItem = 0; iItem < 2000; iItem++)
            {
                Int32 iLength = (Int32)Math.Sqrt(random.NextDouble() * 200) + 2;
                for (Int32 iWord = 0; iWord < iLength; iWord++)
                {
                    sb.Append((Char)(random.Next((Int32)'z' - (Int32)'a' + 1) + (Int32)'a'));
                }
                sb.Append(" ");
                Int32 iOp = random.Next(40);
                if (iOp == 0)
                {
                    flm.Add(new RepString(fp_Bold, sb.ToString())); // append random text with bold font
                    sb.Length = 0;
                }
                else if (iOp < 5)
                {
                    flm.Add(new RepString(fp, sb.ToString())); // append random text with normal font
                    sb.Length = 0;
                }
                if (iOp == 1)
                {
                    flm.NewLine(fp.rLineFeed * 1.5); // new line
                }
            }

            // 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(fp, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
                page.AddRT_MM(rPosRight, rY, new RepString(fp, page.iPageNo + " / " + iPageCount));
            }
        }
Esempio n. 6
0
 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")));
 }
Esempio n. 7
0
 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();
 }
Esempio n. 8
0
 //----------------------------------------------------------------------------------------------------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");
 }
Esempio n. 9
0
		public double AddTextMM(double startX,double startY,string sText,double size,Color colorTx,bool bBold)
		{
			
			FontProp fp = new FontPropMM(fd, size); 
			fp.color = colorTx;
			fp.bBold = bBold;
            
			RepString repS = new RepString(fp,sText);
			rptPage.AddMM(startX,startY,repS);	
			return  repS.rWidthMM;
		}
Esempio n. 10
0
        protected override void Create()
        {
            new Page(this);
            this.sAuthor = this.projectOwner;
            this.sTitle  = this.projectName;
            switch (this.function.AreaFormat)
            {
            case AreaFormat.A3_Vertical:
                page_Cur.rWidthMM  = 297;
                page_Cur.rHeightMM = 420;
                break;

            case AreaFormat.A3_Horizontal:
                page_Cur.SetLandscape();
                page_Cur.rWidthMM  = 420;
                page_Cur.rHeightMM = 297;
                break;

            case AreaFormat.A4_Vertical:
                page_Cur.rWidthMM  = 210;
                page_Cur.rHeightMM = 297;
                break;

            case AreaFormat.A4_Horizontal:
                page_Cur.SetLandscape();
                page_Cur.rWidthMM  = 297;
                page_Cur.rHeightMM = 210;
                break;
            }
            //The temporary image of the diagram is created
            string         tempFile = Path.GetTempFileName();
            ImageCodecInfo jpgCodec = ProjectManager.GetEncoder("image/jpeg");
            //Parameters are configured
            EncoderParameters encoderParameters = new EncoderParameters(1);

            encoderParameters.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L);
            //The image is saved
            this.function.DiagramBitmap.Save(tempFile, jpgCodec, encoderParameters);
            //the zoom is calculated
            double zoom = (page_Cur.rWidth - 60) / this.function.Surface.Width;
            //Puts the title bar
            FontProp font = new FontPropMM(new FontDef(this, FontDef.StandardFont.Helvetica), 3);

            //The Project Name is included
            page_Cur.Add(30, 50, new RepString(font, this.projectName));
            //The date is included
            page_Cur.AddCB(50, new RepString(font, DateTime.Now.ToShortDateString()));
            //The name of the creator is included
            page_Cur.AddRight(page_Cur.rWidth - 30, 50, new RepString(font, this.projectOwner));
            //Puts the picture in the PDF
            page_Cur.AddCB(page_Cur.rHeight - 40, new RepImage(tempFile, this.function.Surface.Width * zoom, this.function.Surface.Size.Height * zoom));
        }
        public void Tlm_NewContainer(Object oSender, TableLayoutManager.NewContainerEventArgs ea)
        {
            new Page(this);

            if (page_Cur.iPageNo == 1)
            {
                FontProp fp_Titulo = new FontPropMM(fd, 7);
                fp_Titulo.bBold = true;
                page_Cur.AddCT_MM(rPosIzquierda + (rPosDerecha - rPosIzquierda) / 2, rPosSuperior,
                                  new RepString(fp_Titulo, "Ordenes de Compras"));
                ea.container.rHeightMM -= fp_Titulo.rLineFeedMM;
            }
            page_Cur.AddMM(rPosIzquierda, rPosInferior - ea.container.rHeightMM, ea.container);
        }
Esempio n. 12
0
        public void PDFOutput(string path = PATH)
        {
            var subjects = UploadFile(path);

            Report   report = new Report(new PdfFormatter());
            FontDef  fd     = new FontDef(report, "Helvetica");
            FontProp fp     = new FontPropMM(fd, 5);
            Page     page   = new Page(report);
            int      row    = 40;

            foreach (var subj in subjects)
            {
                page.AddCenteredMM(row += 10, new RepString(fp, subj.ToString()));
            }
            report.Save("Marks.pdf");
        }
Esempio n. 13
0
        //------------------------------------------------------------------------------------------31.10.2004
        /// <summary>Creates a new page.</summary>
        /// <param name="oSender">Sender</param>
        /// <param name="ea">Event argument</param>
        /// <remarks>
        /// The first page has a caption . The following pages have no caption and therefore the text area can be made higher.
        /// </remarks>
        private void Flm_NewContainer(Object oSender, FlowLayoutManager.NewContainerEventArgs ea)
        {
            new Page(this);

            // first page with caption
            if (page_Cur.iPageNo == 1)
            {
                FontProp fp_Title = new FontPropMM(fd, 7);
                fp_Title.bBold = true;
                page_Cur.AddCT_MM(rPosLeft + (rPosRight - rPosLeft) / 2, rPosTop, new RepString(fp_Title, "Flow Layout Manager Sample"));
                ea.container.rHeightMM -= fp_Title.rLineFeedMM; // reduce height of table container for the first page
            }

            // the new container must be added to the current page
            page_Cur.AddMM(rPosLeft, rPosBottom - ea.container.rHeightMM, ea.container);
        }
Esempio n. 14
0
        public JournalReport(Journal j)
        {
            this.j                 = j;
            fd                     = new FontDef(this, FontDef.StandardFont.Helvetica);
            fp                     = new FontPropMM(fd, 2.1);
            fp_Bold                = new FontPropMM(fd, 2.1, System.Drawing.Color.Blue);
            fp_Bold.bBold          = true;
            fp_Header              = new FontPropMM(fd, 2.6);
            flm                    = new FlowLayoutManager();
            flm.rContainerWidthMM  = rPosRight - rPosLeft;
            flm.rContainerHeightMM = rPosBottom - rPosTop;
            flm.eNewContainer     += new FlowLayoutManager.NewContainerEventHandler(Flm_NewContainer);

            userIcon      = GetType().Assembly.GetManifestResourceStream("EF.ljArchive.PDF.res.userinfo.jpg");
            communityIcon = GetType().Assembly.GetManifestResourceStream("EF.ljArchive.PDF.res.community.jpg");
        }
Esempio n. 15
0
        //------------------------------------------------------------------------------------------30.10.2004
        /// <summary>Creates a new page.</summary>
        /// <param name="oSender">Sender</param>
        /// <param name="ea">Event argument</param>
        /// <remarks>
        /// The first page has a caption. The following pages have no caption and therefore the table can be made higher.
        /// </remarks>
        public void Tlm_NewContainer(Object oSender, TableLayoutManager.NewContainerEventArgs ea) // only "public" for NDoc, should be "private"
        {
            new Page(this);

            // first page with caption
            if (page_Cur.iPageNo == 1)
            {
                FontProp fontProp_Title = new FontPropMM(fontDef_Helvetica, 7);
                fontProp_Title.bBold = true;
                page_Cur.AddCT_MM(rPosLeft + (rPosRight - rPosLeft) / 2, rPosTop, new RepString(fontProp_Title, "Customer List"));
                ea.container.rHeightMM -= fontProp_Title.rLineFeedMM; // reduce height of table container for the first page
            }

            // the new container must be added to the current page
            page_Cur.AddMM(rPosLeft, rPosBottom - ea.container.rHeightMM, ea.container);
        }
Esempio n. 16
0
 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();
 }
Esempio n. 17
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Creates this report</summary>
        protected override void Create()
        {
            FontDef  fd       = new FontDef(this, FontDef.StandardFont.Helvetica);
            FontProp fp       = new FontPropMM(fd, 4);
            FontProp fp_Title = new FontPropMM(fd, 11);

            fp_Title.bBold = true;

            Page page = new Page(this);

            page.AddCB_MM(40, new RepString(fp_Title, "PDF Properties Sample"));
            fp_Title.rSizeMM = 8;
            page.AddCB_MM(100, new RepString(fp_Title, "First Page"));
            page.AddCB_MM(120, new RepString(fp, "Choose <Document Properties, Summary> from the"));
            page.AddCB_MM(126, new RepString(fp, "File menu to display the document properties"));

            page = new Page(this);
            page.AddCB_MM(100, new RepString(fp_Title, "Second Page"));
        }
Esempio n. 18
0
 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();
 }
        //------------------------------------------------------------------------------------------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));
            }
        }
Esempio n. 20
0
        public void StampaAllClienti()
        {
            _sTitolo = "Stampa complessiva di tutti i clienti";
            FontProp fp = new FontPropMM(fd, 1.9);
            FontProp fp_Header = new FontPropMM(fd, 1.9);
            fp_Header.bBold = true;
            fp_Header.color = HeaderForeColor;

            // create table
            using (TableLayoutManager tlm = new TableLayoutManager(fp_Header))
            {
                tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table
                tlm.headerCellDef.rAlignV = RepObj.rAlignCenter;  // set vertical alignment of all header cells
                tlm.headerCellDef.bp_Back.color = HeaderBackColor;

                tlm.cellDef.pp_LineBottom = new PenProp(rpt, 0.05, Color.LightGray);
                tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

                // define columns
                TableLayoutManager.Column col;
                col = new TableLayoutManager.ColumnMM(tlm, "ID", 8);
                col = new TableLayoutManager.ColumnMM(tlm, "Ragione sociale", 40);
                col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
                col = new TableLayoutManager.ColumnMM(tlm, "Indirizzo", 36);
                col = new TableLayoutManager.ColumnMM(tlm, "Località", 30);
                col = new TableLayoutManager.ColumnMM(tlm, "Cap", 12);
                col = new TableLayoutManager.ColumnMM(tlm, "Prov", 8);
                col = new TableLayoutManager.ColumnMM(tlm, "Telefono", 25);
                col = new TableLayoutManager.ColumnMM(tlm, "Fax", 25);

                //				Ritorna il dataset
                string strWhere = "SELECT * FROM Clienti;";
                SqlCommand cmd = new SqlCommand(strWhere, sqlCn);
                SqlDataAdapter adap = new SqlDataAdapter(cmd);
                DataTable DT = new DataTable();
                adap.Fill(DT);

                //				read rows
                for (int r = 0; r < DT.Rows.Count; r++)
                {
                    tlm.NewRow();
                    tlm.Add(0, new RepString(fp, DT.Rows[r]["IDCliente"].ToString()));
                    tlm.Add(1, new RepString(fp, DT.Rows[r]["RagioneSoc"].ToString()));
                    tlm.Add(2, new RepString(fp, DT.Rows[r]["Indirizzo"].ToString()));
                    tlm.Add(3, new RepString(fp, DT.Rows[r]["Localita"].ToString()));
                    tlm.Add(4, new RepString(fp, DT.Rows[r]["Cap"].ToString()));
                    tlm.Add(5, new RepString(fp, DT.Rows[r]["Provincia"].ToString()));
                    tlm.Add(6, new RepString(fp, DT.Rows[r]["Telefono"].ToString()));
                    tlm.Add(7, new RepString(fp, DT.Rows[r]["Fax"].ToString()));
                }
            }


            // print page number and current date/time
            foreach (Root.Reports.Page page in rpt.enum_Page)
            {
                Double rY = rPosBottom + 1.5;
                page.AddLT_MM(rPosLeft, rY, new RepString(fp, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
                page.AddRT_MM(rPosRight, rY, new RepString(fp, page.iPageNo.ToString() + " / " + rpt.iPageCount.ToString()));
            }
        }
Esempio n. 21
0
		public void	AddText(double startX,double startY,string sText,double size,Color colorTx,bool bBold){
			
			FontProp fp = new FontPropMM(fd, size); 
			fp.color = colorTx;
			fp.bBold = bBold;
			RepString repS = new RepString(fp,sText);
			rptPage.Add(startX,startY,repS);				
		}
Esempio n. 22
0
		public void AddCheckBoxMM(string sText,bool bCheked,double size,Color colorTx,bool bBold, double startX, double startY, double dLenghtText)
		{
            try
            {
                double sizePen = 0.5;
                FontProp fp = new FontPropMM(fd, size);
                fp.color = colorTx;
                fp.bBold = bBold;
                RepString repS = new RepString(fp, sText);
                rptPage.AddMM(startX, startY, repS);

                //Disegno il Quadrato
                double startXBox = repS.rWidthMM + startX + 20;
                double dLenghtBox = repS.rHeightMM + 0.4;
                //Se il valore di dLenghtText!=0 allora lo imposto
                if (dLenghtText != 0)
                {
                    startXBox = startX + dLenghtText;
                }
                PenProp objProp = new PenProp(rpt, sizePen, colorTx);
                Root.Reports.RepRectMM objRect = new RepRectMM(objProp, dLenghtBox, dLenghtBox);
                rptPage.AddMM(startXBox, startY, objRect);

                //Inserisco la X all'interno se attivo
                if (bCheked)
                {
                    AddLineaMM(startXBox, startY, dLenghtBox, dLenghtBox, sizePen, colorTx);
                    AddLineaMM(startXBox, (startY - dLenghtBox), dLenghtBox, (dLenghtBox * -1), sizePen, colorTx);
                }
            }
            catch
            {
                AddTextMM(startX, startY, "Errore.. " + sText, size, colorTx, true);
            }
		}
        //------------------------------------------------------------------------------------------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));
            }
        }
Esempio n. 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;
        }
        /// <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.Helvetica);
            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, "Level", 30);

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


                TlmColumn col_Phone = new TlmColumnMM(tlm, "Email", 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;

                // open data set
                foreach (var user in users)
                {
                    tlm.NewRow();
                    switch (user.Level)
                    {
                    case 1:
                    {
                        tlm.Add(0, new RepString(fontProp_Text, Levels.Novice.ToString()));
                        break;
                    }

                    case 2:
                    {
                        tlm.Add(0, new RepString(fontProp_Text, Levels.Intermediate.ToString()));
                        break;
                    }

                    case 3:
                    {
                        tlm.Add(0, new RepString(fontProp_Text, Levels.Advanced.ToString()));
                        break;
                    }
                    }

                    tlm.Add(1, new RepString(fontProp_Text, user.Login));
                    tlm.Add(2, new RepString(fontProp_Text, user.Email));
                }
            }

            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() + "                                                             generated by Knowledge Management System"));
                page.AddRT_MM(rPosRight, rY, new RepString(fontProp_Text, page.iPageNo + " / " + iPageCount));
            }
        }
Esempio n. 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;
            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);
        }
Esempio n. 27
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);
        }
        protected override void Create()
        {
            fd = new FontDef(this, "Arial");

            FontProp fp            = new FontPropMM(fd, 1.9);
            FontProp fp_Encabezado = new FontPropMM(fd, 1.9);

            fp_Encabezado.bBold = true;

            TableLayoutManager tlm = new TableLayoutManager(fp_Encabezado);

            tlm.rContainerHeightMM    = rPosInferior - rPosSuperior;
            tlm.headerCellDef.rAlignV = RepObj.rAlignCenter;
            tlm.cellDef.pp_LineBottom = new PenProp(this, 0.05, Color.LightGray);

            tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

            TableLayoutManager.Column col;

            col = new TableLayoutManager.ColumnMM(tlm, "Nro.", 15);
            col = new TableLayoutManager.ColumnMM(tlm, "Fecha", 18);
            col.cellDef.rAlignH = RepObj.rAlignRight;
            col = new TableLayoutManager.ColumnMM(tlm, "Proveedor", 54);
            col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
            col = new TableLayoutManager.ColumnMM(tlm, "Partida", 22);
            col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
            col = new TableLayoutManager.ColumnMM(tlm, "Unidad Solicitante", 69);
            col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
            col = new TableLayoutManager.ColumnMM(tlm, "Observaciones", 69);
            col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
            col = new TableLayoutManager.ColumnMM(tlm, "Monto", 23);
            col.cellDef.rAlignH = RepObj.rAlignRight;

            BrushProp bp_Anulada = new BrushProp(this, Color.FromArgb(255, 255, 200));

            rDatos = ComprasSuministrosBD.ObtenerOrdenesCompras(rSector, rDesde, rHasta);

            while (rDatos.Read())
            {
                tlm.cellDef.bp_Back = ((rDatos["Indi_Anulacion"].ToString() == "1") ? bp_Anulada : null);
                tlm.NewRow();
                tlm.Add(0, new RepString(fp, rDatos["Nro_Comp"].ToString()));
                tlm.Add(1, new RepString(fp, rDatos["Fecha_Orden"].ToString().Substring(0, 10)));
                tlm.Add(2, new RepString(fp, rDatos["Nombre"].ToString()));
                tlm.Add(3, new RepString(fp, rDatos["Codigo"].ToString()));
                tlm.Add(4, new RepString(fp, rDatos["Direccion"].ToString()));
                tlm.Add(5, new RepString(fp, rDatos["Observacion"].ToString()));
                tlm.Add(6, new RepString(fp, rDatos["Monto"].ToString()));
            }

            rDatos.Close();

            //tlm.

            foreach (Page page in enum_Page)
            {
                Double rY = rPosInferior + 1.5;
                page.SetLandscape();
                page.AddLT_MM(rPosIzquierda, rY, new RepString(fp, DateTime.Now.ToShortDateString() +
                                                               " " + DateTime.Now.ToShortTimeString()));
                page.AddRT_MM(rPosDerecha, rY, new RepString(fp, page.iPageNo + " / " + iPageCount));
            }
        }
Esempio n. 29
0
        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.Helvetica);
            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("ReportSamples.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", 36);

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

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

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

                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("ReportSamples.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));
            }
        }
Esempio n. 30
0
    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");
    }
Esempio n. 31
0
        /// <summary>Creates a new page</summary>
        /// <param name="oSender">Sender</param>
        /// <param name="ea">Event argument</param>
        private void Tlm_NewContainer(Object oSender, TableLayoutManager.NewContainerEventArgs ea)
        {

            if (bfirstPas)
                new Root.Reports.Page(rpt);
            bfirstPas = true;
            // first page with heading
            if (rpt.page_Cur.iPageNo == 1)
            {
                FontProp fp_Title = new FontPropMM(fd, 6);
                fp_Title.bBold = true;
                rpt.page_Cur.AddCT_MM(rPosLeft + (rPosRight - rPosLeft) / 2, rPosTop, new RepString(fp_Title, _sTitolo));
                ea.container.rHeightMM -= fp_Title.rLineFeedMM;  // reduce height of table container for the first page
            }

            // the new container must be added to the current page
            rpt.page_Cur.AddMM(rPosLeft, rPosBottom - ea.container.rHeightMM, ea.container);
        }
        //------------------------------------------------------------------------------------------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));
            }
        }
Esempio n. 33
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);
        }
Esempio n. 34
0
        protected override void Create()
        {
            FontDef  fd       = new FontDef(this, "Arial");
            FontProp fp       = new FontPropMM(fd, 2.1);
            FontProp fp_Title = new FontPropMM(fd, 18);

            fp_Title.bBold = true;
            BrushProp bp = new BrushProp(this, System.Drawing.Color.LightGray);
            PenProp   pp = new PenProp(this, 0.2, Color.FromArgb(235, 235, 235));

            new Page(this);
            Double rY = 40;

            //exception
            page_Cur.AddCenteredMM(rY, new RepString(fp_Title, "Image Sample"));
            fp_Title.rSizeMM = 4;

            System.IO.Stream stream = GetType().Assembly.GetManifestResourceStream("ReportSamples.Image.jpg");

            page_Cur.AddMM(20, 90, new RepImageMM(stream, 40, Double.NaN));
            page_Cur.AddMM(20, 95, new RepString(fp, "W = 40mm, H = auto."));
            page_Cur.AddMM(67, 90, new RepImageMM(stream, 40, 20));
            page_Cur.AddMM(67, 95, new RepString(fp, "W = 40mm, H = 20mm"));
            page_Cur.AddMM(114, 90, new RepImageMM(stream, Double.NaN, 30));
            page_Cur.AddMM(114, 95, new RepString(fp, "W = auto., H = 30mm"));
            page_Cur.AddMM(161, 90, new RepImageMM(stream, 30, 30));
            page_Cur.AddMM(161, 95, new RepString(fp, "W = 30mm, H = 30mm"));
            rY += 150;

            // adjust the size of a bounding rectangle
            RepRect dr = new RepRectMM(bp, 80, 60);

            page_Cur.AddMM(20, rY, dr);
            RepImage di = new RepImageMM(stream, 70, Double.NaN);

            page_Cur.AddMM(25, rY - 5, di);
            dr.rHeightMM = di.rHeightMM + 10;

            // rotated image
            di = new RepImageMM(stream, 40, 30);
            di.RotateTransform(-15);
            page_Cur.AddMM(120, rY - 33, di);

            // rotated image with rectangle
            StaticContainer sc = new StaticContainer(RT.rMM(45), RT.rMM(35));

            page_Cur.AddMM(145, rY - 35, sc);
            sc.RotateTransform(15);
            sc.AddMM(0, 35, new RepRectMM(bp, 45, 35));
            sc.AddMM(1.25, 33.75, new RepLineMM(pp, 42.5, 0));
            sc.AddMM(1.25, 1.25, new RepLineMM(pp, 42.5, 0));
            sc.AddAlignedMM(22.5, RepObj.rAlignCenter, 17.5, RepObj.rAlignCenter, new RepImageMM(stream, 40, 30));
            rY += 30;

            // alignment sample
            page_Cur.AddMM(20, rY, new RepString(fp_Title, "Alignment"));
            rY += 18;
            Int32  rX = 100;
            Double rD = 20;

            bp.color = Color.DarkSalmon;
            page_Cur.AddMM(rX, rY + rD, new RepRectMM(bp, rD, rD));
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignBottom, new RepImageMM(stream, 20, Double.NaN));
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY + rD, RepObj.rAlignTop, new RepImageMM(stream, 20, Double.NaN));
            page_Cur.AddMM(rX + rD, rY, new RepImageMM(stream, 20, Double.NaN));  // default
            page_Cur.AddAlignedMM(rX + rD, RepObj.rAlignLeft, rY + rD, RepObj.rAlignTop, new RepImageMM(stream, 20, Double.NaN));
            page_Cur.AddAlignedMM(rX + rD / 2, RepObj.rAlignCenter, rY + rD / 2, RepObj.rAlignCenter, new RepImageMM(stream, 10, Double.NaN));
        }
Esempio n. 35
0
 public void addTitle(float x, float y, String text)
 {
     standardFont = new FontPropMM(new FontDef(report, "Times-Roman"), 5);
     standardFont.color = System.Drawing.Color.Black;
     standardFont.bBold = true;
     this.page.AddLT_MM(x, y, new RepString(standardFont, text));
 }
Esempio n. 36
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Creates this report</summary>
        protected override void Create()
        {
            FontDef  fd       = new FontDef(this, FontDef.StandardFont.Helvetica);
            FontProp fp       = new FontPropMM(fd, 3);
            FontProp fp_Title = new FontPropMM(fd, 20);

            fp_Title.bBold = true;
            FontProp  fp_Small = new FontPropMM(fd, 1.3);
            PenProp   pp       = new PenPropMM(this, 0.2, Color.Blue);
            BrushProp bp       = new BrushProp(this, Color.FromArgb(240, 240, 240));

            #region Page 1
            Page page = new Page(this);
            page.AddCB_MM(40, new RepString(fp_Title, "Text Sample"));
            fp_Title.rSizeMM     = 4;
            fp_Title.rLineFeedMM = 8;

            // font sample
            Double rX = 20;
            Double rY = 60;
            page.AddMM(rX, rY, new RepString(fp_Title, "Fonts"));
            rY += fp_Title.rLineFeedMM;
            FontDef[] aFontDef = { new FontDef(this, FontDef.StandardFont.Courier), fd, new FontDef(this, FontDef.StandardFont.TimesRoman) };
            foreach (FontDef fontDef in aFontDef)
            {
                FontProp fp_Test = new FontPropMM(fontDef, 2.8);
                page.AddMM(rX, rY, new RepString(fp_Test, fontDef.sFontName));
                fp_Test.bBold = true;
                page.AddMM(rX + 30, rY, new RepString(fp_Test, fontDef.sFontName + " Bold"));
                fp_Test.bBold   = false;
                fp_Test.bItalic = true;
                page.AddMM(rX + 72, rY, new RepString(fp_Test, fontDef.sFontName + " Italic"));
                fp_Test.bItalic    = false;
                fp_Test.bUnderline = true;
                page.AddMM(rX + 120, rY, new RepString(fp_Test, fontDef.sFontName + " Underline"));
                rY += fp.rLineFeedMM;
            }

            rY      += 3;
            aFontDef = new FontDef[] { new FontDef(this, "Symbol"), new FontDef(this, "ZapfDingbats") };
            foreach (FontDef fontDef in aFontDef)
            {
                FontProp fp_Test = new FontPropMM(fontDef, 3);
                page.AddMM(rX, rY, new RepString(fp, fontDef.sFontName));
                page.AddMM(rX + 30, rY, new RepString(fp_Test, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
                rY += fp.rLineFeedMM;
            }
            rY += 10;

            // Int32 sample
            rX = 20;
            Double rYcopy = rY;
            page.AddMM(rX, rY, new RepString(fp_Title, "Int32 Values"));
            rY += fp_Title.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "no format string"));
            page.AddRightMM(rX + 80, rY, new RepInt32(fp, 12345));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"0000000\""));
            page.AddRightMM(rX + 80, rY, new RepInt32(fp, 12345, "0000000"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"$#,#\""));
            page.AddRightMM(rX + 80, rY, new RepInt32(fp, 12345, "$#,#"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"$#;($#);Zero\""));
            page.AddRightMM(rX + 80, rY, new RepInt32(fp, 12345, "$#;($#);Zero"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"$#;($#);Zero\""));
            page.AddRightMM(rX + 80, rY, new RepInt32(fp, -12345, "$#;($#);Zero"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"$#;($#);Zero\""));
            page.AddRightMM(rX + 80, rY, new RepInt32(fp, 0, "$#;($#);Zero"));

            // Single / Double sample
            rX = 115;
            rY = rYcopy;
            page.AddMM(rX, rY, new RepString(fp_Title, "Single / Double Values"));
            rY += fp_Title.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "no format string"));
            page.AddRightMM(rX + 80, rY, new RepReal64(fp, 123.456));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"0.0000\""));
            page.AddRightMM(rX + 80, rY, new RepReal64(fp, 123.456, "0.0000"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"$#,#0.00\""));
            page.AddRightMM(rX + 80, rY, new RepReal64(fp, 123.456, "$#,#0.00"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"$#.0;($#.0);Zero\""));
            page.AddRightMM(rX + 80, rY, new RepReal64(fp, 123.456, "$#.0;($#.0);Zero"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"$#.0;($#.0);Zero\""));
            page.AddRightMM(rX + 80, rY, new RepReal64(fp, -123.456, "$#.0;($#.0);Zero"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"$#.0;($#.0);Zero\""));
            page.AddRightMM(rX + 80, rY, new RepReal64(fp, 0, "$#.0;($#.0);Zero"));
            rY += fp.rLineFeedMM + 10;

            // DateTime sample
            rX     = 20;
            rYcopy = rY;
            page.AddMM(rX, rY, new RepString(fp_Title, "DateTime Values"));
            rY += fp_Title.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "no format string"));
            page.AddRightMM(rX + 80, rY, new RepDateTime(fp, DateTime.Now));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"D\""));
            page.AddRightMM(rX + 80, rY, new RepDateTime(fp, DateTime.Now, "D"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"t\""));
            page.AddRightMM(rX + 80, rY, new RepDateTime(fp, DateTime.Now, "t"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"dd.MM.yyyy\""));
            page.AddRightMM(rX + 80, rY, new RepDateTime(fp, DateTime.Now, "dd.MM.yyyy"));

            // color sample
            StaticContainer sc = new StaticContainer(RT.rPointFromMM(100), RT.rPointFromMM(100));
            page.AddMM(115, rYcopy + 5, sc);
            sc.RotateTransform(-8);
            sc.AddAlignedMM(-2, RepObj.rAlignLeft, -6, RepObj.rAlignTop, new RepRectMM(bp, 85, 33));
            rY = 0;
            sc.AddMM(0, rY, new RepString(fp_Title, "Colors"));
            rY += fp_Title.rLineFeedMM;
            sc.AddMM(0, rY, new RepString(fp, "Red"));
            fp.color = Color.Red;  fp.bUnderline = true;
            sc.AddRightMM(80, rY, new RepString(fp, "ABCDEFGHIJKLM"));
            fp.color = Color.Black;  fp.bUnderline = false;
            rY      += fp.rLineFeedMM;
            sc.AddMM(0, rY, new RepString(fp, "Green"));
            fp.color = Color.Green;  fp.bUnderline = true;
            sc.AddRightMM(80, rY, new RepString(fp, "ABCDEFGHIJKLM"));
            fp.color = Color.Black;  fp.bUnderline = false;
            rY      += fp.rLineFeedMM;
            sc.AddMM(0, rY, new RepString(fp, "Blue"));
            fp.color = Color.Blue;  fp.bUnderline = true;
            sc.AddRightMM(80, rY, new RepString(fp, "ABCDEFGHIJKLM"));
            fp.color = Color.Black;  fp.bUnderline = false;
            rY      += fp.rLineFeedMM;
            sc.AddMM(0, rY, new RepString(fp, "RGB(255,180,255)"));
            fp.color = Color.FromArgb(200, 200, 255);  fp.bUnderline = true;
            sc.AddRightMM(80, rY, new RepString(fp, "ABCDEFGHIJKLM"));
            fp.color = Color.Black;  fp.bUnderline = false;
            rY      += rYcopy + fp.rLineFeedMM + 10;

            // alignment sample
            rX = 20;
            String s = "Alignment";
            page.AddMM(rX, rY, new RepString(fp_Title, s));
            Double rLengthMM = fp_Title.rGetTextWidthMM(s);
            page.AddMM(rX, rY + 3, new RepLineMM(pp, rLengthMM, 0));
            page.AddMM(rX, rY + 2, new RepLineMM(pp, 0, 2));
            page.AddMM(rX + rLengthMM, rY + 2, new RepLineMM(pp, 0, 2));
            page.AddAlignedMM(rX + rLengthMM / 2, RepObj.rAlignCenter, rY + 4, RepObj.rAlignTop, new RepReal64(fp_Small, rLengthMM, "0.0 mm"));
            rX  = 100;
            rY += fp_Title.rLineFeedMM;
            Double rD = 15;
            bp.color = Color.LightSkyBlue;
            page.AddMM(rX, rY + rD, new RepRectMM(bp, rD, rD));
            page.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignBottom, new RepString(fp, "right - bottom"));
            page.AddAlignedMM(rX, RepObj.rAlignRight, rY + rD, RepObj.rAlignTop, new RepString(fp, "right - top"));
            page.AddMM(rX + rD, rY, new RepString(fp, "left - bottom")); // default
            page.AddAlignedMM(rX + rD, RepObj.rAlignLeft, rY + rD, RepObj.rAlignTop, new RepString(fp, "left - top"));
            page.AddAlignedMM(rX + rD / 2, RepObj.rAlignCenter, rY + rD / 2, RepObj.rAlignCenter, new RepString(fp, "center"));
            rY += 30;

            // rotated string
            rX = 60;
            page.AddMM(20, rY, new RepString(fp_Title, "Rotated Strings"));
            rY    += fp_Title.rLineFeedMM + 10;
            rYcopy = rY;
            rD     = 10;
            page.AddMM(rX, rY + rD, new RepRectMM(bp, rD, rD));
            fp.rAngle = 45;
            page.AddAlignedMM(rX + rD, RepObj.rAlignLeft, rY + rD, RepObj.rAlignTop, new RepString(fp, "[45°]"));
            fp.rAngle = 135;
            page.AddMM(rX, rY + rD, new RepString(fp, "[135°]"));
            fp.rAngle = 225;
            page.AddAlignedMM(rX, RepObj.rAlignLeft, rY, RepObj.rAlignTop, new RepString(fp, "[225°]"));
            fp.rAngle = 315;
            page.AddMM(rX + rD, rY, new RepString(fp, "[315°]"));
            fp.rAngle = 0;

            rX            = 155;
            rY            = rYcopy;
            fp.bUnderline = true;
            page.AddMM(rX, rY + rD, new RepRectMM(bp, rD, rD));
            fp.rAngle = 45;
            page.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignBottom, new RepString(fp, "1/4 * PI"));
            fp.rAngle = 135;
            page.AddAlignedMM(rX + rD, RepObj.rAlignRight, rY, RepObj.rAlignTop, new RepString(fp, "3/4 * PI"));
            fp.rAngle = 225;
            page.AddAlignedMM(rX + rD, RepObj.rAlignRight, rY + rD, RepObj.rAlignBottom, new RepString(fp, "5/4 * PI"));
            fp.rAngle = 315;
            page.AddAlignedMM(rX, RepObj.rAlignRight, rY + rD, RepObj.rAlignTop, new RepString(fp, "7/4 * PI"));
            fp.rAngle     = 0.0;
            fp.bUnderline = false;
            rY           += 35;
            #endregion

            #region Page 2
            rX = 20;
            rY = 60;
            String sText = "Once upon a time there was a miller who was poor, but he had a beautiful daughter." + Environment.NewLine +
                           "Now it happened that he was talking with the king one time, and in order to make himself seem important, " +
                           "he said to the king, \"I have a daughter who can spin straw into gold.\"";
            page = new Page(this);
            page.AddMM(rX, rY, new RepString(fp_Title, "Best Fitting Font"));
            rY += fp_Title.rLineFeedMM;

            page.AddLT_MM(rX, rY, new RepRectMM(bp, 80, 40));
            FontProp fp_BestFit = fp_Title.fontProp_GetBestFitMM(sText, 80, 40, 1);
            rY += fp_BestFit.rLineFeedMM;
            Int32 iStart = 0;
            while (iStart <= sText.Length)
            {
                String sLine = fp_BestFit.sGetTextLine(sText, RT.rPointFromMM(80), ref iStart, TextSplitMode.Line);
                page.AddMM(rX, rY, new RepString(fp_BestFit, sLine));
                rY += fp_BestFit.rLineFeedMM;
            }
            rY += 10;

            page.AddLT_MM(rX, rY, new RepRectMM(bp, 40, 40));
            fp_BestFit = fp.fontProp_GetBestFitMM(sText, 40, 40, 1);
            rY        += fp_BestFit.rLineFeedMM;
            iStart     = 0;
            while (iStart <= sText.Length)
            {
                String sLine = fp_BestFit.sGetTextLine(sText, RT.rPointFromMM(40), ref iStart, TextSplitMode.Line);
                page.AddMM(rX, rY, new RepString(fp_BestFit, sLine));
                rY += fp_BestFit.rLineFeedMM;
            }
            rY += 10;

            page.AddLT_MM(rX, rY, new RepRectMM(bp, 30, 30));
            fp_BestFit = fp.fontProp_GetBestFitMM(sText, 30, 30, 1);
            rY        += fp_BestFit.rLineFeedMM;
            iStart     = 0;
            while (iStart <= sText.Length)
            {
                String sLine = fp_BestFit.sGetTextLine(sText, RT.rPointFromMM(30), ref iStart, TextSplitMode.Line);
                page.AddMM(rX, rY, new RepString(fp_BestFit, sLine));
                rY += fp_BestFit.rLineFeedMM;
            }
            #endregion
        }
Esempio n. 37
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Creates this report</summary>
        protected override void Create()
        {
            FontDef  fd       = new FontDef(this, FontDef.StandardFont.Helvetica);
            FontProp fp       = new FontPropMM(fd, 2.1);
            FontProp fp_Title = new FontPropMM(fd, 15);

            fp_Title.bBold = true;
            FontProp fp_SubTitle = new FontPropMM(fd, 4);

            fp_SubTitle.bBold = true;
            BrushProp bp       = new BrushProp(this, Color.LightGray);
            PenProp   pp       = new PenProp(this, 0.2, Color.FromArgb(235, 235, 235));
            PenProp   pp_Black = new PenProp(this, 0.2, Color.Black);
            Double    rY       = 40;

            new Page(this);
            page_Cur.AddCB_MM(rY, new RepString(fp_Title, "Image Sample"));

            System.IO.Stream stream = GetType().Assembly.GetManifestResourceStream("ReportSamples.Image.jpg");

            page_Cur.AddMM(20, 90, new RepImageMM(stream, 40, Double.NaN));
            page_Cur.AddMM(20, 95, new RepString(fp, "W = 40mm, H = auto."));
            page_Cur.AddMM(67, 90, new RepImageMM(stream, 40, 20));
            page_Cur.AddMM(67, 95, new RepString(fp, "W = 40mm, H = 20mm"));
            page_Cur.AddMM(114, 90, new RepImageMM(stream, Double.NaN, 30));
            page_Cur.AddMM(114, 95, new RepString(fp, "W = auto., H = 30mm"));
            page_Cur.AddMM(161, 90, new RepImageMM(stream, 30, 30));
            page_Cur.AddMM(161, 95, new RepString(fp, "W = 30mm, H = 30mm"));
            rY += 150;

            // adjust the size of a bounding rectangle
            RepRect dr = new RepRectMM(bp, 80, 60);

            page_Cur.AddMM(20, rY, dr);
            RepImage di = new RepImageMM(stream, 70, Double.NaN);

            page_Cur.AddMM(25, rY - 5, di);
            dr.rHeightMM = di.rHeightMM + 10;

            // rotated image
            di = new RepImageMM(stream, 40, 30);
            di.RotateTransform(-15);
            page_Cur.AddMM(120, rY - 33, di);

            // rotated image with rectangle
            StaticContainer sc = new StaticContainer(RT.rPointFromMM(45), RT.rPointFromMM(35));

            page_Cur.AddMM(145, rY - 35, sc);
            sc.RotateTransform(15);
//      sc.AddMM(0, 35, new RepRectMM(bp, 45, 35));
            sc.AddMM(1.25, 33.75, new RepLineMM(pp, 42.5, 0));
            sc.AddMM(1.25, 1.25, new RepLineMM(pp, 42.5, 0));
            sc.AddAlignedMM(22.5, RepObj.rAlignCenter, 17.5, RepObj.rAlignCenter, new RepImageMM(stream, 40, 30));
            rY += 30;

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            // alignment sample
            page_Cur.AddMM(20, rY, new RepString(fp_SubTitle, "Alignment"));
            rY += 18;
            Int32  rX = 40;
            Double rD = 20;

            bp.color = Color.DarkSalmon;
            page_Cur.AddMM(rX, rY + rD, new RepRectMM(bp, rD, rD));
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignBottom, new RepImageMM(stream, 20, Double.NaN));
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY + rD, RepObj.rAlignTop, new RepImageMM(stream, 20, Double.NaN));
            page_Cur.AddMM(rX + rD, rY, new RepImageMM(stream, 20, Double.NaN)); // default
            page_Cur.AddAlignedMM(rX + rD, RepObj.rAlignLeft, rY + rD, RepObj.rAlignTop, new RepImageMM(stream, 20, Double.NaN));
            page_Cur.AddAlignedMM(rX + rD / 2, RepObj.rAlignCenter, rY + rD / 2, RepObj.rAlignCenter, new RepImageMM(stream, 10, Double.NaN));

            // rotated
            rX = 140;
            page_Cur.AddMM(rX, rY + rD, new RepRectMM(bp, rD, rD));
            RepImage repImage = new RepImageMM(stream, 20, Double.NaN);

            repImage.RotateTransform(15);
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignBottom, repImage);
            repImage = new RepImageMM(stream, 20, Double.NaN);
            repImage.RotateTransform(15);
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY + rD, RepObj.rAlignTop, repImage);
            repImage = new RepImageMM(stream, 20, Double.NaN);
            repImage.RotateTransform(15);
            page_Cur.AddMM(rX + rD, rY, repImage); // default
            repImage = new RepImageMM(stream, 20, Double.NaN);
            repImage.RotateTransform(15);
            page_Cur.AddAlignedMM(rX + rD, RepObj.rAlignLeft, rY + rD, RepObj.rAlignTop, repImage);
            repImage = new RepImageMM(stream, 10, Double.NaN);
            repImage.RotateTransform(15);
            page_Cur.AddAlignedMM(rX + rD / 2, RepObj.rAlignCenter, rY + rD / 2, RepObj.rAlignCenter, repImage);

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            new Page(this);
            rY = 30;

            page_Cur.AddCB_MM(rY, new RepString(fp_Title, "Ellipse Sample"));
            rY += 15;

            // arc
            page_Cur.AddLT_MM(20, rY, new RepString(fp_SubTitle, "Arc"));
            page_Cur.AddLT_MM(50, rY, new RepRectMM(pp_Black, 40, 30));
            page_Cur.AddLT_MM(50, rY, new RepArcMM(pp_Black, 40, 30, 45, 270));
            page_Cur.AddLT_MM(100, rY, new RepArcMM(pp_Black, 15, 135, 270));
            page_Cur.AddLT_MM(150, rY, new RepArcMM(pp_Black, 40, 30, 150, 130));
            rY += 35;

            // circle
            page_Cur.AddLT_MM(20, rY, new RepString(fp_SubTitle, "Circle"));
            page_Cur.AddLT_MM(50, rY, new RepRectMM(pp_Black, 30, 30));
            page_Cur.AddLT_MM(50, rY, new RepCircleMM(pp_Black, bp, 15));
            page_Cur.AddLT_MM(100, rY, new RepCircleMM(pp_Black, 15));
            page_Cur.AddLT_MM(150, rY, new RepCircleMM(bp, 15));
            rY += 35;

            // ellipse
            page_Cur.AddLT_MM(20, rY, new RepString(fp_SubTitle, "Ellipse"));
            page_Cur.AddLT_MM(50, rY, new RepRectMM(pp_Black, 40, 30));
            page_Cur.AddLT_MM(50, rY, new RepEllipseMM(pp_Black, bp, 40, 30));
            page_Cur.AddLT_MM(100, rY, new RepEllipseMM(pp_Black, 40, 30));
            page_Cur.AddLT_MM(150, rY, new RepEllipseMM(bp, 40, 30));
            rY += 35;

            // pie ellipse
            page_Cur.AddLT_MM(20, rY, new RepString(fp_SubTitle, "Pie Ellipse"));
            page_Cur.AddLT_MM(50, rY, new RepRectMM(pp_Black, 40, 30));
            page_Cur.AddLT_MM(50, rY, new RepPieMM(pp_Black, bp, 40, 30, -135, 225));
            page_Cur.AddLT_MM(100, rY, new RepPieMM(pp_Black, 40, 30, 45, 270));
            page_Cur.AddLT_MM(150, rY, new RepPieMM(bp, 40, 30, 135, 225));
            rY += 35;

            // pie circle
            page_Cur.AddLT_MM(20, rY, new RepString(fp_SubTitle, "Pie Circle"));
            page_Cur.AddLT_MM(50, rY, new RepRectMM(pp_Black, 30, 30));
            page_Cur.AddLT_MM(50, rY, new RepPieMM(pp_Black, bp, 15, -135, 225));
            page_Cur.AddLT_MM(100, rY, new RepPieMM(pp_Black, 15, 45, 270));
            page_Cur.AddLT_MM(150, rY, new RepPieMM(bp, 15, 135, 225));
            rY += 45;

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            // Pie alignment sample
            page_Cur.AddMM(20, rY, new RepString(fp_SubTitle, "Pie Alignment"));
            page_Cur.AddMM(105, rY, new RepString(fp_SubTitle, "rotated 30°"));
            rY      += 25;
            rX       = 50;
            rD       = 20;
            bp.color = Color.DarkSalmon;
            page_Cur.AddAlignedMM(rX, RepObj.rAlignCenter, rY, RepObj.rAlignCenter, new RepRectMM(bp, rD, rD));
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignBottom, new RepPieMM(pp_Black, bp, rD, rD, 100, 250));
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignTop, new RepPieMM(pp_Black, bp, rD, rD, 10, 250));
            page_Cur.AddMM(rX, rY, new RepPieMM(pp_Black, bp, rD, rD, 190, 250)); // default
            page_Cur.AddAlignedMM(rX, RepObj.rAlignLeft, rY, RepObj.rAlignTop, new RepPieMM(pp_Black, bp, rD, rD, -80, 250));
            page_Cur.AddAlignedMM(rX, RepObj.rAlignCenter, rY, RepObj.rAlignCenter, new RepCircleMM(pp_Black, bp, rD / 2));

            rX = 150;
            page_Cur.AddAlignedMM(rX, RepObj.rAlignCenter, rY, RepObj.rAlignCenter, new RepRectMM(bp, rD, rD));

            RepPie pie = new RepPieMM(pp_Black, bp, rD, rD, 100, 250);

            pie.RotateTransform(30);
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignBottom, pie);
            RepRect rect = new RepRectMM(pp_Black, rD, rD);

            rect.RotateTransform(30);
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignBottom, rect);

            pie = new RepPieMM(pp_Black, bp, rD, rD, 10, 250);
            pie.RotateTransform(30);
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignTop, pie);
            rect = new RepRectMM(pp_Black, rD, rD);
            rect.RotateTransform(30);
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignTop, rect);

            pie = new RepPieMM(pp_Black, bp, rD, rD, 190, 250);
            pie.RotateTransform(30);
            page_Cur.AddMM(rX, rY, pie); // default
            rect = new RepRectMM(pp_Black, rD, rD);
            rect.RotateTransform(30);
            page_Cur.AddMM(rX, rY, rect);

            pie = new RepPieMM(pp_Black, bp, rD, rD, -80, 250);
            pie.RotateTransform(30);
            page_Cur.AddAlignedMM(rX, RepObj.rAlignLeft, rY, RepObj.rAlignTop, pie);
            rect = new RepRectMM(pp_Black, rD, rD);
            rect.RotateTransform(30);
            page_Cur.AddAlignedMM(rX, RepObj.rAlignLeft, rY, RepObj.rAlignTop, rect);

            page_Cur.AddAlignedMM(rX, RepObj.rAlignCenter, rY, RepObj.rAlignCenter, new RepCircleMM(pp_Black, bp, rD / 2));
        }
Esempio n. 38
0
        public void Run()
        {
            MemoryStream stream;
            MemoryStream refbg = loadImageFile("\\art\\reference.png");

            FontDef   fd       = new FontDef(this, FontDef.StandardFont.Courier);
            FontProp  fp       = new FontPropMM(fd, 2.1);
            BrushProp bp       = new BrushProp(this, Color.LightGray);
            PenProp   pp       = new PenProp(this, 0.2, Color.FromArgb(235, 235, 235));
            PenProp   pp_Black = new PenProp(this, 0.2, Color.Black);

            bool deckdbl = decklist.doublesided;

            List <Card>   cards        = decklist.Values.ToList();
            List <string> cardArts     = new List <string>();
            List <string> cardArtsBack = new List <string>();

            foreach (Card c in cards)
            {
                for (int i = 0; i < c.cardQty; i++)
                {
                    cardArts.Add(c.filePathFront);
                    // if the card has a flip but we're not doing double sided
                    if (c.twin && !deckdbl)
                    {
                        cardArts.Add(c.filePathBack);
                    }
                    // if the card has a flip and we're doing double sided
                    else if (c.twin && deckdbl)
                    {
                        cardArtsBack.Add(c.filePathBack);
                    }
                    // if the card doesn't have a flip and we're doing double sided
                    else if (!c.twin && deckdbl)
                    {
                        cardArtsBack.Add("\\art\\pback.png");
                    }
                }
            }

            int cardid     = 0;
            int cardidback = 0;

            for (int pageNum = 0; pageNum < decklist.getPageCount(); pageNum++)
            {
                // Make a page
                new Page(this);
                page_Cur.rWidthMM  = 215.9;
                page_Cur.rHeightMM = 279.4;
                page_Cur.AddMM(0, 279.4, new RepImageMM(refbg, 215.9, 279.4));
                page_Cur.AddAlignedMM(215.9 / 2, RepObj.rAlignCenter, 27.5, RepObj.rAlignTop, new RepString(fp, "Print on 12pt Matte -- No Scaling -- Full Color -- One Copy"));
                page_Cur.AddAlignedMM(215.9 / 2, RepObj.rAlignCenter, 22.5, RepObj.rAlignTop, new RepString(fp, "Print Coated 3 -- Maximum Printer Density -- 100% Color"));

                // Layout the Cards
                for (int cardPos = 0; cardPos < decklist.getCardsOnPage(pageNum); cardPos++)
                {
                    if (cardArts[cardid] == null)
                    {
                        cardid++;
                    }
                    stream = loadImageFile(cardArts[cardid]);
                    if (stream != null)
                    {
                        AddCardToPage(stream, Center(cardPos));
                    }
                    cardid++;
                }

                if (deckdbl)
                {
                    page_Cur.AddAlignedMM(215.9 / 2, RepObj.rAlignCenter, 279.4 - 27.5, RepObj.rAlignTop, new RepString(fp, "Double sided -- Flipped on Short Edge"));

                    // Make a page
                    new Page(this);
                    page_Cur.rWidthMM  = 215.9;
                    page_Cur.rHeightMM = 279.4;
                    page_Cur.AddMM(0, 279.4, new RepImageMM(refbg, 215.9, 279.4));
                    page_Cur.AddAlignedMM(215.9 / 2, RepObj.rAlignCenter, 27.5, RepObj.rAlignTop, new RepString(fp, "Print on 12pt Matte -- No Scaling -- Full Color -- One Copy"));

                    // Layout the Cards
                    for (int cardPos = 0; cardPos < decklist.getCardsOnPage(pageNum); cardPos++)
                    {
                        stream = loadImageFile(cardArtsBack[cardidback]);
                        AddCardToPage(stream, CenterBackA(cardPos), 3.75);
                        cardidback++;
                    }

                    page_Cur.AddAlignedMM(215.9 / 2, RepObj.rAlignCenter, 279.4 - 27.5, RepObj.rAlignTop, new RepString(fp, "Double sided -- Flipped on Short Edge"));
                }
            }
        }
Esempio n. 39
0
    public void StampaSca15gg(int iIDGruppo)
    {
        _sTitolo = "Scadenze 31gg e già scadute";
        FontProp fp = new FontPropMM(fd, 1.9);
        FontProp fp_Header = new FontPropMM(fd, 1.9);

        //imposto le informazioni per HEADER della tabella
        fp_Header.bBold = true;
        fp_Header.color = HeaderForeColor;

        // create table
        using (TableLayoutManager tlm = new TableLayoutManager(fp_Header))
        {
            tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table

            //Imposto le informazioni di allineamento e di sfondo del HEADER
            tlm.headerCellDef.rAlignV = RepObj.rAlignCenter;  // set vertical alignment of all header cells
            tlm.headerCellDef.bp_Back.color = HeaderBackColor;

            tlm.cellDef.pp_LineBottom = new PenProp(rpt, 0.05, Color.LightGray);

            //Creo l'eento per ogni nuova pagina
            tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

            // Definizione dell colonne
            TableLayoutManager.Column col;
            col = new TableLayoutManager.ColumnMM(tlm, "Ragione sociale", 55);
            col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
            col = new TableLayoutManager.ColumnMM(tlm, "Tipologia", 40);
            col = new TableLayoutManager.ColumnMM(tlm, "Scadenza", 17);
            col = new TableLayoutManager.ColumnMM(tlm, "Marca", 25);
            col = new TableLayoutManager.ColumnMM(tlm, "Tipo", 30);
            col = new TableLayoutManager.ColumnMM(tlm, "Matricola", 30);


            //Ritorna il dataset
            string strWhere = @"SELECT     tblScadenze.DataScadenza, Clienti.RagioneSoc, Clienti.bElimina, Marche.Marca, Tipo.Tipo, tblScadenze.Tipologia, tblScadenze.NumeroDiSerie, 
                      tblScadenze.IDGruppoScadenza
FROM         Tipo INNER JOIN
                      Marche INNER JOIN
                      Strumenti INNER JOIN
                      Clienti INNER JOIN
                      tblScadenze ON Clienti.IDCliente = tblScadenze.IDCliente ON Strumenti.idStrumenti = tblScadenze.IdStrumento ON 
                      Marche.IDMarca = Strumenti.IDMarca ON Tipo.IDTipo = Strumenti.IDTipo
WHERE     (tblScadenze.bScadenzaAnnullata = @bScaAnnullata)
GROUP BY tblScadenze.DataScadenza, Clienti.RagioneSoc, Clienti.bElimina, Marche.Marca, Tipo.Tipo, tblScadenze.Tipologia, Clienti.bElimina, 
                      tblScadenze.NumeroDiSerie, tblScadenze.IDGruppoScadenza
HAVING      (tblScadenze.DataScadenza < @DataLimite) AND (Clienti.bElimina = @bElimina) AND (tblScadenze.IDGruppoScadenza = @IDGruppo)
ORDER BY tblScadenze.DataScadenza";
            SqlCommand cmd = new SqlCommand(strWhere, _sqlCn);

            SqlParameter parDate = new SqlParameter("@DataLimite", SqlDbType.DateTime);
            parDate.Value = DateTime.Now.AddDays(31); ;
            cmd.Parameters.Add(parDate);
            SqlParameter parElimati = new SqlParameter("@bElimina", SqlDbType.Bit);
            parElimati.Value = 0;
            cmd.Parameters.Add(parElimati);
            SqlParameter parScaAnnullata = new SqlParameter("@bScaAnnullata", SqlDbType.Bit);
            parScaAnnullata.Value = 0;
            cmd.Parameters.Add(parScaAnnullata);
            SqlParameter parGruppo = new SqlParameter("@IDGruppo", SqlDbType.Int);
            parGruppo.Value = iIDGruppo;
            cmd.Parameters.Add(parGruppo);

            SqlDataAdapter adap = new SqlDataAdapter(cmd);
            DataTable DT = new DataTable();
            adap.Fill(DT);

            //				read rows
            string ripRag = "";
            string ripTipologia = "";
            string s = "";
            for (int r = 0; r < DT.Rows.Count; r++)
            {
                tlm.NewRow();

                if (ripRag == DT.Rows[r]["RagioneSoc"].ToString())
                    s = "";
                else
                {
                    s = ripRag = DT.Rows[r]["RagioneSoc"].ToString();
                    ripTipologia = "";
                }
                tlm.Add(0, new RepString(fp, s));


                if (ripTipologia == DT.Rows[r]["Tipologia"].ToString())
                    s = "";
                else
                    s = ripTipologia = DT.Rows[r]["Tipologia"].ToString();

                tlm.Add(1, new RepString(fp, s));
                tlm.Add(2, new RepString(fp, ((DateTime)DT.Rows[r]["DataScadenza"]).ToShortDateString()));
                tlm.Add(3, new RepString(fp, DT.Rows[r]["Marca"].ToString()));
                tlm.Add(4, new RepString(fp, DT.Rows[r]["Tipo"].ToString()));
                tlm.Add(5, new RepString(fp, DT.Rows[r]["NumeroDiSerie"].ToString()));
            }
        }


        // print page number and current date/time
        foreach (Root.Reports.Page page in rpt.enum_Page)
        {
            Double rY = rPosBottom + 1.5;
            page.AddLT_MM(rPosLeft, rY, new RepString(fp, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
            page.AddRT_MM(rPosRight, rY, new RepString(fp, page.iPageNo.ToString() + " / " + rpt.iPageCount.ToString()));
        }
    }
Esempio n. 40
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);
        }
Esempio n. 41
0
    public Report StampaRigheRapportino(int IDRapportino)
    {
        _sTitolo = "";

        rPosLeft = 3;
        rPosRight = 215;
        rPosTop = 142;
        rPosBottom = 230;

        mMarginLeft = 10;
        mMarginRight = 190;
        mMarginTop = 140;
        mMarginBottom = 200;



        rPosTop = rPosTop + 30;

        FontProp fp = new FontPropMM(fd, 2);
        FontProp fp_Header = new FontPropMM(fd, 2);

        //imposto le informazioni per HEADER della tabella
        fp_Header.bBold = true;
        fp_Header.color = HeaderForeColor;

        // create table
        using (TableLayoutManager tlm = new TableLayoutManager(fp_Header))
        {
            tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table
            
            //Imposto le informazioni di allineamento e di sfondo del HEADER
            tlm.headerCellDef.rAlignV = RepObj.rAlignLeft;  // set vertical alignment of all header cells
            tlm.headerCellDef.bp_Back.color = HeaderBackColor;

            tlm.cellDef.pp_LineBottom = new PenProp(rpt, 0.05, Color.LightGray);

            //Creo l'eento per ogni nuova pagina
            tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

            // Definizione delle colonne
            TableLayoutManager.Column col;

            col = new TableLayoutManager.ColumnMM(tlm, "Q.ta", 15);
            col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
            col = new TableLayoutManager.ColumnMM(tlm, "Modello", 25);
            col = new TableLayoutManager.ColumnMM(tlm, "Descrizione", 103);
            col = new TableLayoutManager.ColumnMM(tlm, "Prezzo Unitario", 30);
            col = new TableLayoutManager.ColumnMM(tlm, "Importo", 30);

            //Ritorna il dataset
            string strWhere = @"SELECT     IDRapportinoRighe, IDRapportino,IDArticolo, Descrizione, PrezzoUnitario, Quantita, Totale
                                    FROM         dbo.RapportinoRighe
                                    WHERE     (IDRapportino = @Rapportino)";
            SqlCommand cmd = new SqlCommand(strWhere, _sqlCn);


            SqlParameter parIDRapportino = new SqlParameter("@Rapportino", SqlDbType.Int);
            parIDRapportino.Value = IDRapportino;
            cmd.Parameters.Add(parIDRapportino);

            SqlDataAdapter adap = new SqlDataAdapter(cmd);
            DataTable DT = new DataTable();
            adap.Fill(DT);

            //Imposto intestazione
            cReport objReport = new cReport(rpt, rptPage);

            //				read rows
            for (int r = 0; r < DT.Rows.Count; r++)
            {
                tlm.NewRow();
                float f = 0;
                float.TryParse(DT.Rows[r]["Quantita"].ToString(), out f);
                tlm.Add(0, new RepString(fp, f.ToString("0.##")));
                
                tlm.Add(1, new RepString(fp, DT.Rows[r]["IDArticolo"].ToString()));
                tlm.Add(2, new RepString(fp, DT.Rows[r]["Descrizione"].ToString()));
                float.TryParse(DT.Rows[r]["PrezzoUnitario"].ToString(), out f);
                tlm.Add(3, new RepString(fp, f.ToString("0.00")));
                float.TryParse(DT.Rows[r]["Totale"].ToString(), out f);
                tlm.Add(4, new RepString(fp, f.ToString("0.00")));

            }
            if (DT.Rows.Count == 0)
            {
                tlm.NewRow();
                tlm.Add(0, new RepString(fp, ""));
                tlm.Add(1, new RepString(fp, ""));
                tlm.Add(2, new RepString(fp, ""));
                tlm.Add(3, new RepString(fp, ""));
                tlm.Add(4, new RepString(fp, ""));
            }

        }


        // print page number and current date/time
        foreach (Root.Reports.Page page in rpt.enum_Page)
        {
            Double rY = rPosBottom + 1.5;
            //page.AddLT_MM(rPosLeft, rY, new RepString(fp, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
            page.AddRT_MM(rPosRight, rY, new RepString(fp, page.iPageNo.ToString() + " / " + rpt.iPageCount.ToString()));
        }
        return rpt;
    }
Esempio n. 42
0
        public void StampaStrForClientiInGrid(string sIDcli)
        {
            _sTitolo = "Stampa strumenti per cliente";
            FontProp fp = new FontPropMM(fd, 1.9);
            FontProp fp_Header = new FontPropMM(fd, 1.9);
            fp_Header.bBold = true;
            fp_Header.color = HeaderForeColor;

            //Carico la matrice delle tipologie di strumenti disponibili

            string[] sTipologia = null;//gestData.tipologiaStringGet();

            foreach (string sActualTipologia in sTipologia)
            {

                // create table
                using (TableLayoutManager tlm = new TableLayoutManager(fp_Header))
                {
                    tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table
                    tlm.headerCellDef.rAlignV = RepObj.rAlignCenter;  // set vertical alignment of all header cells
                    tlm.headerCellDef.bp_Back.color = HeaderBackColor;

                    tlm.cellDef.pp_LineBottom = new PenProp(rpt, 0.05, Color.LightGray);
                    tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

                    // define columns
                    TableLayoutManager.Column col;
                    col = new TableLayoutManager.ColumnMM(tlm, "Tipo", 20);
                    col = new TableLayoutManager.ColumnMM(tlm, "Marca", 25);
                    col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
                    col = new TableLayoutManager.ColumnMM(tlm, "Modello", 30);
                    col = new TableLayoutManager.ColumnMM(tlm, "Matricola", 20);
                    col = new TableLayoutManager.ColumnMM(tlm, "Omologazione 1", 30);
                    col = new TableLayoutManager.ColumnMM(tlm, "Omologazione 2", 30);
                    col = new TableLayoutManager.ColumnMM(tlm, "Num. serie rulli", 20);
                    col = new TableLayoutManager.ColumnMM(tlm, "Num. serie pesa", 20);
                    col = new TableLayoutManager.ColumnMM(tlm, "P.E.F.", 10);
                    col = new TableLayoutManager.ColumnMM(tlm, "Data scadenza", 20);

                    //	Ritorna il dataset
                    string strWhere = "SELECT tblScadenze.Tipologia, tblScadenze.DataScadenza, tblScadenze.IDSca," +
                        " Clienti.RagioneSoc, tblScadenze.IDCliente, qryStrumenti.Marca, qryStrumenti.Tipo," +
                        " tblScadenze.DataAttivazione,tblScadenze.Omologazione1,tblScadenze.Omologazione2," +
                        " qryStrumenti.Nome , tblScadenze.NumeroDiSerie, tblScadenze.PEF, tblScadenze.NumSerieRulli," +
                        " tblScadenze.NumSeriePesa , tblScadenze.TipoCalibratore, tblScadenze.NumSerCalibratore" +

                        " FROM (Clienti INNER JOIN tblScadenze ON Clienti.IDCliente = tblScadenze.IDCliente) INNER JOIN qryStrumenti ON tblScadenze.IdStrumento = qryStrumenti.idStrumenti  " +
                        " WHERE (((tblScadenze.Tipologia)='" + sActualTipologia + "') AND ((tblScadenze.IDCliente)=" + sIDcli + "))  " +
                        " ORDER BY tblScadenze.Tipologia DESC , tblScadenze.DataScadenza DESC , Clienti.RagioneSoc DESC";

                    DataSet objDS = null;// gestData.CreateDataSet(strWhere);				

                    DataTable DT = objDS.Tables[0];

                    //				read rows
                    for (int r = 0; r < DT.Rows.Count; r++)
                    {
                        tlm.NewRow();
                        tlm.Add(0, new RepString(fp, DT.Rows[r]["Tipo"].ToString()));
                        tlm.Add(1, new RepString(fp, DT.Rows[r]["Marca"].ToString()));
                        tlm.Add(2, new RepString(fp, DT.Rows[r]["Nome"].ToString()));
                        tlm.Add(3, new RepString(fp, DT.Rows[r]["NumeroDiSerie"].ToString()));
                        tlm.Add(4, new RepString(fp, DT.Rows[r]["Omologazione1"].ToString()));
                        tlm.Add(5, new RepString(fp, DT.Rows[r]["Omologazione2"].ToString()));
                        tlm.Add(6, new RepString(fp, DT.Rows[r]["NumSerieRulli"].ToString()));
                        tlm.Add(7, new RepString(fp, DT.Rows[r]["NumSeriePesa"].ToString()));
                        tlm.Add(8, new RepString(fp, DT.Rows[r]["PEF"].ToString()));
                        tlm.Add(9, new RepString(fp, DT.Rows[r]["DataScadenza"].ToString()));
                    }
                }
            }

            // print page number and current date/time
            foreach (Root.Reports.Page page in rpt.enum_Page)
            {
                Double rY = rPosBottom + 1.5;
                page.AddLT_MM(rPosLeft, rY, new RepString(fp, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
                page.AddRT_MM(rPosRight, rY, new RepString(fp, page.iPageNo.ToString() + " / " + rpt.iPageCount.ToString()));
            }
        }
Esempio n. 43
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;
        }
Esempio n. 44
0
    public Report StampaScadenzeClientePerPianificazione(int IDCliente)
    {
        _sTitolo = "";

        rPosLeft = 10;
        rPosRight = 190;
        rPosTop = 150;
        rPosBottom = 288;

        mMarginLeft = 20;
        mMarginRight = 190;
        mMarginTop = 150;
        mMarginBottom = 278;



        rPosTop = rPosTop + 30;

        FontProp fp = new FontPropMM(fd, 1.6);
        FontProp fp_Header = new FontPropMM(fd, 1.6);

        //imposto le informazioni per HEADER della tabella
        fp_Header.bBold = true;
        fp_Header.color = HeaderForeColor;

        // create table
        using (TableLayoutManager tlm = new TableLayoutManager(fp_Header))
        {
            tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table

            //Imposto le informazioni di allineamento e di sfondo del HEADER
            tlm.headerCellDef.rAlignV = RepObj.rAlignLeft;  // set vertical alignment of all header cells
            tlm.headerCellDef.bp_Back.color = HeaderBackColor;

            tlm.cellDef.pp_LineBottom = new PenProp(rpt, 0.05, Color.LightGray);

            //Creo l'eento per ogni nuova pagina
            tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

            // Definizione delle colonne
            TableLayoutManager.Column col;

            col = new TableLayoutManager.ColumnMM(tlm, "Tipologia", 20);
            col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
            col = new TableLayoutManager.ColumnMM(tlm, "Tipo", 23);
            col = new TableLayoutManager.ColumnMM(tlm, "Marca", 23);
            col = new TableLayoutManager.ColumnMM(tlm, "Modello", 25);
            col = new TableLayoutManager.ColumnMM(tlm, "Matricola", 18);
            col = new TableLayoutManager.ColumnMM(tlm, "Omologazione", 35);
            col = new TableLayoutManager.ColumnMM(tlm, "Pef", 8);
            col = new TableLayoutManager.ColumnMM(tlm, "Data scadenza", 17);
            col = new TableLayoutManager.ColumnMM(tlm, "Nuova data", 21);



            //Ritorna il dataset
            string strWhere = @"SELECT     tblScadenze.DataScadenza, Clienti.RagioneSoc, Clienti.bElimina, Marche.Marca, Tipo.Tipo, tblScadenze.Tipologia, Clienti.IDCliente, 
                      tblScadenze.NumeroDiSerie, Strumenti.Nome, tblScadenze.Omologazione1, tblScadenze.PEF, Clienti.Localita, Clienti.Provincia, Clienti.Telefono, 
                      Clienti.Cap, Clienti.Indirizzo, Clienti.Fax, Clienti.Cellulare, Clienti.Mail, Clienti.kmDistanza, Clienti.Note
                        FROM         Tipo INNER JOIN
                      Marche INNER JOIN
                      Strumenti INNER JOIN
                      Clienti INNER JOIN
                      tblScadenze ON Clienti.IDCliente = tblScadenze.IDCliente ON Strumenti.idStrumenti = tblScadenze.IdStrumento ON 
                      Marche.IDMarca = Strumenti.IDMarca ON Tipo.IDTipo = Strumenti.IDTipo
                        GROUP BY tblScadenze.DataScadenza, Clienti.RagioneSoc, Clienti.bElimina, Marche.Marca, Tipo.Tipo, tblScadenze.Tipologia, Clienti.bElimina, Clienti.IDCliente, 
                      tblScadenze.NumeroDiSerie, Strumenti.Nome, tblScadenze.Omologazione1, tblScadenze.PEF, Clienti.Localita, Clienti.Provincia, Clienti.Telefono, 
                      Clienti.Cap, Clienti.Indirizzo, Clienti.Fax, Clienti.Cellulare, Clienti.Mail, Clienti.kmDistanza, Clienti.Note
                        HAVING      (Clienti.IDCliente = @IDCliente)
                        ORDER BY tblScadenze.Tipologia";
            SqlCommand cmd = new SqlCommand(strWhere, _sqlCn);
            SqlParameter parIDCliente = new SqlParameter("@IDCliente", SqlDbType.Int);
            parIDCliente.Value = IDCliente;
            cmd.Parameters.Add(parIDCliente);

            SqlDataAdapter adap = new SqlDataAdapter(cmd);
            DataTable DT = new DataTable();
            adap.Fill(DT);

            //Imposto intestazione
            cReport objReport = new cReport(rpt, rptPage);

            string ripTipologia = "";
            string s = "";
            for (int r = 0; r < DT.Rows.Count; r++)
            {
                tlm.NewRow();


                if (ripTipologia == DT.Rows[r]["Tipologia"].ToString())
                    s = "";
                else
                    s = ripTipologia = DT.Rows[r]["Tipologia"].ToString();

                tlm.Add(0, new RepString(fp, s));
                tlm.Add(1, new RepString(fp, DT.Rows[r]["Tipo"].ToString()));
                tlm.Add(2, new RepString(fp, DT.Rows[r]["Marca"].ToString()));
                tlm.Add(3, new RepString(fp, DT.Rows[r]["Nome"].ToString()));
                tlm.Add(4, new RepString(fp, DT.Rows[r]["NumeroDiSerie"].ToString()));
                tlm.Add(5, new RepString(fp, DT.Rows[r]["Omologazione1"].ToString()));
                tlm.Add(6, new RepString(fp, DT.Rows[r]["Pef"].ToString()));
                string sDate = ((DateTime)DT.Rows[r]["DataScadenza"]).ToShortDateString();
                tlm.Add(7, new RepString(fp, sDate));
            }

        }


        // print page number and current date/time
        foreach (Root.Reports.Page page in rpt.enum_Page)
        {
            Double rY = rPosBottom + 1.5;
            page.AddLT_MM(rPosLeft, rY, new RepString(fp, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
            page.AddRT_MM(rPosRight, rY, new RepString(fp, page.iPageNo.ToString() + " / " + rpt.iPageCount.ToString()));
        }
        return rpt;
    }
        //------------------------------------------------------------------------------------------30.10.2004
        /// <summary>Creates a new page.</summary>
        /// <param name="oSender">Sender</param>
        /// <param name="ea">Event argument</param>
        /// <remarks>
        /// The first page has a caption. The following pages have no caption and therefore the table can be made higher.
        /// </remarks>
        public void Tlm_NewContainer(Object oSender, TableLayoutManager.NewContainerEventArgs ea)
        {  // only "public" for NDoc, should be "private"
            new Page(this);

            // first page with caption
            if (page_Cur.iPageNo == 1)
            {
                FontProp fontProp_Title = new FontPropMM(fontDef_Helvetica, 4);
                fontProp_Title.bBold = true;
                page_Cur.AddCT_MM(rPosLeft + (rPosRight - rPosLeft) / 2, rPosTop, new RepString(fontProp_Title, "SGS - Relatório Assistido"));
                ea.container.rHeightMM -= fontProp_Title.rLineFeedMM;  // reduce height of table container for the first page
            }

            // the new container must be added to the current page
            page_Cur.AddMM(rPosLeft, rPosBottom - ea.container.rHeightMM, ea.container);
        }
    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));
      }
    }
Esempio n. 47
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");
    }
Esempio n. 48
0
        private Double rWidth      = 175; // millimeters

        //------------------------------------------------------------------------------------------13.11.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  fd = new FontDef(this, FontDef.StandardFont.Helvetica);
            FontProp fp = new FontPropMM(fd, 1.9);
            Double   rY = 40; // vertical position in millimeters

            new Page(this);
            FontProp fp_Title = new FontPropMM(fd, 8);

            page_Cur.AddCB_MM(rY, new RepString(fp_Title, "List Layout Manager Sample"));
            rY += 18;

            // create list
            ListLayoutManager llm = null;

            using (llm = new ListLayoutManager(this)) {
                PenProp pp_BorderLine = new PenPropMM(this, 0.4, Color.Blue);
                PenProp pp_GridLine   = new PenPropMM(this, 0.1, Color.Blue);

                llm.tlmColumnDef_Default.penProp_BorderH = pp_BorderLine;
                llm.tlmCellDef_Default.penProp_Line      = pp_GridLine;

                TlmColumn col_Number = new TlmColumnMM(llm, 10);
                col_Number.tlmCellDef_Default.rAlignH          = RepObj.rAlignCenter;
                col_Number.tlmCellDef_Default.rAlignV          = RepObj.rAlignCenter;
                col_Number.tlmCellDef_Default.penProp_LineLeft = pp_BorderLine;

                TlmColumn col_Text = new TlmColumnMM(llm, 100);
                col_Text.tlmCellDef_Default.tlmTextMode = TlmTextMode.MultiLine;

                TlmColumn col_Author = new TlmColumnMM(llm, rWidth - llm.rWidthMM);
                col_Author.tlmCellDef_Default.penProp_LineRight = pp_BorderLine;
                col_Author.tlmCellDef_Default.brushProp_Back    = new BrushProp(this, Color.FromArgb(255, 210, 210));

                llm.container_CreateMM(page_Cur, rMarginLeft, rY); // immediately creates a container

                // first row
                llm.NewRow();
                col_Number.Add(new RepString(fp, "1."));
                col_Text.Add(new RepString(fp, "Rapunzel "));
                col_Author.Add(new RepString(fp, "Gebrüder Grimm"));

                TlmRow row = llm.tlmRow_New();
                col_Text.Add(new RepString(fp, "There once was a woman and a man that lived next to a witch. They were very happy. The lady saw rapunzel in the witch’s garden and she really wanted to eat it. When she ate it, she liked it. "));

                // second row
                llm.tlmCellDef_Default.penProp_LineTop = pp_BorderLine;
                row = llm.tlmRow_New();
                row.aTlmCell[col_Text].penProp_Line     = new PenPropMM(this, 0.5, Color.Red);
                row.aTlmCell[col_Text].iOrderLineRight  = 1;
                row.aTlmCell[col_Text].iOrderLineBottom = 1;
                col_Number.Add(new RepString(fp, "2."));
                col_Text.Add(new RepString(fp, "The Princess and the Pea"));
                col_Author.Add(new RepString(fp, "Hans Christian Andersen"));

                llm.tlmCellDef_Default.penProp_LineTop = pp_GridLine;
                llm.NewRow();
                col_Text.Add(new RepString(fp, "In a far away land, there lived a prince who wanted a real princess to be his wife. He traveled around the world to find her. He returned alone and unhappy to his kingdom."));
                col_Text.NewLine();
                col_Text.Add(new RepString(fp, "One stormy night, a princess arrived at the door. The lightening was flashing. Torrents of rain were rushing down. The princess's clothes were soaked. Water was running into the heels of her shoes and out the toes. It was a dreadful storm."));

                // third row
                llm.tlmCellDef_Default.penProp_LineTop = pp_BorderLine;
                llm.NewRow();
                col_Number.Add(new RepString(fp, "3."));
                col_Text.Add(new RepString(fp, "Hansel and Gretel"));
                col_Author.Add(new RepString(fp, "Gebrüder Grimm"));

                llm.tlmCellDef_Default.penProp_LineTop = pp_GridLine;
                llm.NewRow();
                col_Text.Add(new RepString(fp, "Once upon a time in a vast forest lived a poor family. Since there was a famine, they had zero food."));
                col_Text.NewLineMM(fp.rLineFeedMM + 1);
                col_Text.Add(new RepString(fp, "There was a woodcutter who had a mean wife and a boy named Hansel and a girl named Gretel. The mean wife decided to get rid of Hansel and Gretel so she could have more food. The children overheard her plan to leave them in the forest. Hansel gathered pebbles from his yard."));
            }
            rY        += llm.rCurY_MM + 1.5;
            fp.rSizeMM = 1.5;
            page_Cur.AddRT_MM(rMarginLeft + rWidth, rY, new RepString(fp, "End of list"));
        }
Esempio n. 49
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;
        }
Esempio n. 50
0
        public void StampaScaDA_A(DateTime dataDA, DateTime dataA)
        {
            _sTitolo = "Scadenze Dal:" + dataDA.ToShortDateString() + " A:" + dataA.ToShortDateString();
            FontProp fp = new FontPropMM(fd, 1.9);
            FontProp fp_Header = new FontPropMM(fd, 1.9);

            //imposto le informazioni per HEADER della tabella
            fp_Header.bBold = true;
            fp_Header.color = HeaderForeColor;

            // create table
            using (TableLayoutManager tlm = new TableLayoutManager(fp_Header))
            {
                tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table

                //Imposto le informazioni di allineamento e di sfondo del HEADER
                tlm.headerCellDef.rAlignV = RepObj.rAlignCenter;  // set vertical alignment of all header cells
                tlm.headerCellDef.bp_Back.color = HeaderBackColor;

                tlm.cellDef.pp_LineBottom = new PenProp(rpt, 0.05, Color.LightGray);

                //Creo l'eento per ogni nuova pagina
                tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

                // Definizione dell colonne
                TableLayoutManager.Column col;
                col = new TableLayoutManager.ColumnMM(tlm, "Ragione sociale", 70);
                col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
                col = new TableLayoutManager.ColumnMM(tlm, "Localita", 25);
                col = new TableLayoutManager.ColumnMM(tlm, "Prov", 10);
                col = new TableLayoutManager.ColumnMM(tlm, "Telefono", 20);
                col = new TableLayoutManager.ColumnMM(tlm, "Tipologia", 30);
                col = new TableLayoutManager.ColumnMM(tlm, "Scadenza", 20);

                string sDA = dataDA.Month + "/" + dataDA.Day + "/" + dataDA.Year;
                string sA = dataA.Month + "/" + dataA.Day + "/" + dataA.Year;

                //Ritorna il dataset
                string strWhere = @"SELECT tblScadenze.DataScadenza, Clienti.RagioneSoc, Clienti.Localita, Clienti.Provincia, Clienti.Telefono, Clienti.bElimina, tblScadenze.Tipologia
FROM Tipo INNER JOIN ((Marche INNER JOIN Strumenti ON Marche.IDMarca = Strumenti.IDMarca) INNER JOIN (Clienti INNER JOIN tblScadenze ON Clienti.IDCliente = tblScadenze.IDCliente) ON Strumenti.idStrumenti = tblScadenze.IdStrumento) ON Tipo.IDTipo = Strumenti.IDTipo
GROUP BY tblScadenze.DataScadenza, Clienti.RagioneSoc, Clienti.Localita, Clienti.Provincia, Clienti.Telefono, Clienti.bElimina, tblScadenze.Tipologia, Clienti.bElimina
						HAVING (tblScadenze.DataScadenza Between #" + sDA + "# And #" + sA + "#) AND (Clienti.bElimina=False)" +
                        " ORDER BY tblScadenze.DataScadenza";
                SqlCommand cmd = new SqlCommand(strWhere, sqlCn);
                SqlDataAdapter adap = new SqlDataAdapter(cmd);
                DataTable DT = new DataTable();
                adap.Fill(DT);

                //				read rows
                string ripRag = "";
                string ripTipologia = "";
                string s = "";
                for (int r = 0; r < DT.Rows.Count; r++)
                {
                    tlm.NewRow();

                    if (ripRag == DT.Rows[r]["RagioneSoc"].ToString())
                        s = "";
                    else
                    {
                        s = ripRag = DT.Rows[r]["RagioneSoc"].ToString();
                        ripTipologia = "";
                    }
                    tlm.Add(0, new RepString(fp, s));


                    if (ripTipologia == DT.Rows[r]["Tipologia"].ToString())
                        s = "";
                    else
                        s = ripTipologia = DT.Rows[r]["Tipologia"].ToString();

                    tlm.Add(1, new RepString(fp, DT.Rows[r]["Localita"].ToString()));
                    tlm.Add(2, new RepString(fp, DT.Rows[r]["Provincia"].ToString()));
                    tlm.Add(3, new RepString(fp, DT.Rows[r]["Telefono"].ToString()));
                    tlm.Add(4, new RepString(fp, s));
                    DateTime dtData = (DateTime)DT.Rows[r]["DataScadenza"];
                    tlm.Add(5, new RepString(fp, dtData.ToShortDateString()));

                }
            }


            // print page number and current date/time
            foreach (Root.Reports.Page page in rpt.enum_Page)
            {
                Double rY = rPosBottom + 1.5;
                page.AddLT_MM(rPosLeft, rY, new RepString(fp, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
                page.AddRT_MM(rPosRight, rY, new RepString(fp, page.iPageNo.ToString() + " / " + rpt.iPageCount.ToString()));
            }
        }