Beispiel #1
0
        /// <summary>
        /// Obtiene el total de dias objetivos por modelo
        /// </summary>
        /// <param name="source">Fuente de datos del Modelo</param>
        /// <returns>Cantidad de Dias objetivos por modelo</returns>
        private int CountDiasObjetivo(ConsultarDetalladoRDSucursalDS.ModeloRow source)
        {
            int result = 0;
            int limit2 = this.GetDaysInMonth();

            if (source == null)
            {
                source = (this.GetCurrentRow() as DataRowView).Row as ConsultarDetalladoRDSucursalDS.ModeloRow;
                if (source == null)
                {
                    throw new Exception(String.Format("La fila de datos actual no corresponde a una fila de tipo {0}", typeof(ConsultarDetalladoRDSucursalDS.ModeloRow)));
                }
            }

            ConsultarDetalladoRDSucursalDS.ConsultarDetalladoRDSucursalRow[] detallesRow = source.GetConsultarDetalladoRDSucursalRows();
            foreach (ConsultarDetalladoRDSucursalDS.ConsultarDetalladoRDSucursalRow detalleRow in detallesRow)
            {
                if (EnFlota(detalleRow))
                {
                    result += limit2 - this.CountFromHistorial(detalleRow, EEstatusHistorial.FueraFlota, null);
                }
                else
                {
                    result += (this.CountFromHistorial(detalleRow, EEstatusHistorial.Rentado, null) + this.CountFromHistorial(detalleRow, EEstatusHistorial.Disponible, null));
                }
            }

            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// Evento que se ejecuta cuando se obtiene el número de días objetivo de un equipo
        /// </summary>
        /// <param name="sender">Objeto que genero el evento</param>
        /// <param name="e">Argumentos asociados al evento</param>
        public void DiasObjetivo_GetValue(object sender, DevExpress.XtraReports.UI.GetValueEventArgs e)
        {
            ConsultarDetalladoRDSucursalDS.ModeloRow source = (e.Row as DataRowView).Row as ConsultarDetalladoRDSucursalDS.ModeloRow;
            if (source == null)
            {
                source = (this.GetCurrentRow() as DataRowView).Row as ConsultarDetalladoRDSucursalDS.ModeloRow;
                if (source == null)
                {
                    throw new Exception(String.Format("La fila de datos actual no corresponde a una fila de tipo {0}", typeof(ConsultarDetalladoRDSucursalDS.ModeloRow)));
                }
            }

            ConsultarDetalladoRDSucursalDS.ConsultarDetalladoRDSucursalRow[] detallesRow = source.GetConsultarDetalladoRDSucursalRows();
            List <String> numeroChasis = new List <String>();

            foreach (var row in detallesRow)
            {
                if (!numeroChasis.Any(x => x.ToUpper() == row.Serie.ToUpper()))
                {
                    numeroChasis.Add(row.Serie);
                }
            }

            if (this._totalesDiasObjetivo == null)
            {
                this._totalesDiasObjetivo = new Dictionary <String, int>();
            }
            Int32 totalDiasObjetivo = CountDiasObjetivo(source);

            if (!this._totalesDiasObjetivo.Any(x => x.Key == source.Nombre))
            {
                this._totalesDiasObjetivo.Add(source.Nombre, totalDiasObjetivo);
            }

            e.Value = totalDiasObjetivo;
        }
Beispiel #3
0
        /// <summary>
        /// Realiza un conteo de unidades por modelo tomando como base el estatus de historial de una unidad
        /// </summary>
        /// <param name="source">Fila de datos a evaluar</param>
        /// <param name="estatusToCompare">Estatus de Historial a comparar, si se omiten se cuentan todas las unidades</param>
        /// <param name="dayOfMonth">Día del mes a procesar, si se omite se procesa todo el mes</param>
        /// <returns>Conteo de unidades por modelo tomando como base su estatus de historial</returns>
        private int CountFromModelo(ConsultarDetalladoRDSucursalDS.ModeloRow source, EEstatusHistorial?estatusToCompare, int?dayOfMonth)
        {
            int result = 0;
            int limit1 = 0;
            int limit2 = 0;

            if (dayOfMonth.HasValue)
            {
                limit1 = dayOfMonth.Value;
                limit2 = dayOfMonth.Value;
            }
            else
            {
                limit1 = 1;
                limit2 = this.GetDaysInMonth();
            }

            if (source == null)
            {
                source = (this.GetCurrentRow() as DataRowView).Row as ConsultarDetalladoRDSucursalDS.ModeloRow;
                if (source == null)
                {
                    throw new Exception(String.Format("La fila de datos actual no corresponde a una fila de tipo {0}", typeof(ConsultarDetalladoRDSucursalDS.ModeloRow)));
                }
            }

            ConsultarDetalladoRDSucursalDS.ConsultarDetalladoRDSucursalRow[] detallesRow = source.GetConsultarDetalladoRDSucursalRows();
            foreach (ConsultarDetalladoRDSucursalDS.ConsultarDetalladoRDSucursalRow detalleRow in detallesRow)
            {
                for (int i = limit1; i <= limit2; i++)
                {
                    String rowIndex = String.Format("EstatusHistorial_{0}", i);
                    if (detalleRow.IsNull(rowIndex))
                    {
                        continue;
                    }

                    EEstatusHistorial?estatusHistorial = (EEstatusHistorial)Enum.ToObject(typeof(EEstatusHistorial), detalleRow[rowIndex]);
                    if (estatusToCompare.HasValue)
                    {
                        if (estatusHistorial == estatusToCompare)
                        {
                            result++;
                        }
                    }
                    else
                    {
                        if (estatusHistorial != EEstatusHistorial.FueraFlota)
                        {
                            result++;
                        }
                    }
                }
            }

            return(result);
        }