Example #1
0
        private void ReporteMantenimientoRealizadoUnidadRPT_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            ReporteRendimientoUnidadGraficaRPT subGlobalReport = this.srReporteRendimientoCamion.ReportSource as ReporteRendimientoUnidadGraficaRPT;
            ReporteRendimientoUnidadDS         data            = subGlobalReport.DataSource as ReporteRendimientoUnidadDS;

            subGlobalReport.BindToDatasource(data);
            subGlobalReport.CreateAxisX();
        }
        /// <summary>
        /// Se ejecuta antes de la impresion de cada detalle
        /// </summary>
        private void Detail_BeforePrint(object sender, PrintEventArgs e)
        {
            var unidadId = this.GetCurrentColumnValue <int>("UnidadID");
            var mes      = this.GetCurrentColumnValue <int>("Mes");
            var Anio     = this.GetCurrentColumnValue <int>("Anio");

            ReporteRendimientoUnidadDS dataSource = (ReporteRendimientoUnidadDS)this.DataSource;
            var row = Enumerable.AsEnumerable(dataSource.Meses).Where(x => x.Mes == mes && x.Anio == Anio).FirstOrDefault();

            if (row != null)
            {
                this.xrlMesAnio.Text = row.NombreMes.ToString() + " - " + row.Anio.ToString();
            }
        }
        /// <summary>
        /// Crea las cordenadas del eje x, usando las primeras letras del mes
        /// </summary>
        public void CreateAxisX()
        {
            XYDiagram diagram = (this.xrcGraficaRendimiento.Diagram as XYDiagram);

            diagram.AxisX.CustomLabels.Clear();

            ReporteRendimientoUnidadDS dataSet = this.DataSource as ReporteRendimientoUnidadDS;

            foreach (ReporteRendimientoUnidadDS.MesesRow row in dataSet.Meses.Rows)
            {
                CustomAxisLabel customAxisLabel = new CustomAxisLabel();
                customAxisLabel.Name      = row.NombreMes.Substring(0, 1).ToUpper();
                customAxisLabel.AxisValue = String.Format("{0}-{1}", row.Anio, row.Mes);
                customAxisLabel.Visible   = true;
                diagram.AxisX.CustomLabels.Add(customAxisLabel);
            }
        }