Exemplo n.º 1
0
        /// <summary>
        /// Si la fecha de fin no tiene la parte de tiempo entonces se interpreta como el inicio de día del siguiente día:
        /// Sección XBRL 2.1 4.7.2
        /// A date, with no time part, in the endDate or instant element is defined to be equivalent to specifying a dateTime
        /// of the same date plus P1D and with a time part of T00:00:00. This represents midnight at the end of the day.
        /// The reason for defining it thus, i.e. as midnight at the start of the next day, is that [XML Schema Datatypes]
        /// mandates this representation by prohibiting the value of 24 in the "hours" part of a time specification, which is ISO 8601 syntax.
        /// </summary>
        /// <returns></returns>
        public DateTime ObtenerFechaFinEfectiva()
        {
            var ret = FechaFin;

            if (!TieneFechaFinParteTiempo())
            {
                ret = FechaFin.AddDays(1);
            }
            return(ret);
        }
Exemplo n.º 2
0
        private void EvaluarObjetivoDoce()
        {
            //Alcanzar un % de cobro de clientes corporativos para un período determinado en los próximos x días
            try
            {
                DateTime FechaCobroInicio = FechaInicio.AddDays(Dias);
                DateTime FechaCobroFin    = FechaFin.AddDays(Dias);

                DataSet ds = new DataSet();
                ds.Tables.Add("Datos");
                //ds.Tables[0] = new DataTable();

                SqlParameter pFechaInicio      = new SqlParameter("@FechaInicio", Utiles.BaseDatos.FechaToSql(FechaInicio));
                SqlParameter pFechaFin         = new SqlParameter("@FechaFin", Utiles.BaseDatos.FechaToSql(FechaFin));
                SqlParameter pFechaInicioCobro = new SqlParameter("@FechaInicioCobro", Utiles.BaseDatos.FechaToSql(FechaCobroInicio));
                SqlParameter pFechaFinCobro    = new SqlParameter("@FechaFinCobro", Utiles.BaseDatos.FechaToSql(FechaCobroFin));

                Config.Conexion.LlenarTypeDataSet(ds.Tables[0], System.Data.CommandType.StoredProcedure, "EvaluarObjetivoDocePersonal", pFechaInicio, pFechaFin, pFechaInicioCobro, pFechaFinCobro);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    System.Data.DataRow dr = ds.Tables[0].Rows[0];
                    this.ValorAlcanzado = Convert.ToDouble(dr[0]) * 100;
                }
                else
                {
                    this.ValorAlcanzado = 0;
                }

                //ValorAlcanzado = 100 * (Convert.ToDouble(Config.Conexion.EjecutarResultadoUnico("EvaluarObjetivoDocePersonal", Utiles.BaseDatos.FechaToSql(FechaInicio), Utiles.BaseDatos.FechaToSql(FechaFin),Utiles.BaseDatos.FechaToSql(FechaCobroInicio), Utiles.BaseDatos.FechaToSql(FechaCobroFin))));
                PorcentajeAlcanzado = ValorAlcanzado;               //porcentaje alcanzado respecto al objetivo?
                PorcentajeAlcanzadoRespectoPonderacion = Convert.ToDouble(PorcentajeAlcanzado * Ponderacion / 100);
                Cumplio = PorcentajeAlcanzado >= Valor ? true : false;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }