예제 #1
0
        public ENSCTRCotizaciones Cotizar2(ENSCTRCotizaciones cotizacion)
        {
            ENSCTRCotizaciones oENSCTRCotizaciones = null;

            if (ModelState.IsValid)
            {
                LNSCTRCotizaciones.Cotizar(cotizacion);
                ViewBag.CodigoDpto   = new SelectList(LNUbigeoDpto.ObtenerDpto().ToList(), "CodigoDpto", "DescripcionDpto");
                ViewBag.CodigoProv   = new SelectList(LNUbigeoProv.ObtenerProv(cotizacion.CodigoDpto).ToList(), "CodigoProv", "DescripcionProv");
                ViewBag.CodigoDist   = new SelectList(LNUbigeoDist.ObtenerDist(cotizacion.CodigoDpto, cotizacion.CodigoProv).ToList(), "CodigoDist", "DescripcionDist");
                ViewBag.CodigoDptoR  = new SelectList(LNUbigeoDpto.ObtenerDpto().ToList(), "CodigoDpto", "DescripcionDpto");
                ViewBag.CodigoProvR  = new SelectList(LNUbigeoProv.ObtenerProv(cotizacion.CodigoDptoR).ToList(), "CodigoProv", "DescripcionProv");
                ViewBag.CodigoDistR  = new SelectList(LNUbigeoDist.ObtenerDist(cotizacion.CodigoDptoR, cotizacion.CodigoProvR).ToList(), "CodigoDist", "DescripcionDist");
                ViewBag.GrupoCIIU    = new SelectList(LNCIIUPrincipal.ObtenerCIIUPrincipal().ToList(), "CodigoCIIU", "DescripcionCIIU");
                ViewBag.CodigoCIIU   = new SelectList(LNCIIUEspecifica.ObtenerCIIUEspecifica(cotizacion.GrupoCIIU).ToList(), "CodigoCIIU", "DescripcionCIIU");
                ViewBag.CodigoMoneda = new SelectList(LNMonedas.ObtenerTodos().ToList(), "CodigoMoneda", "DescripcionMoneda");
                oENSCTRCotizaciones  = new ENSCTRCotizaciones();
                // Traer datos de cotizacion y copiar en oENSCTRCotizaciones
                //Obteniendo propiedades de la clase - declarando lista
                PropertyInfo[] lstProp = typeof(ENSCTRCotizaciones).GetProperties();
                foreach (PropertyInfo oProperty in lstProp)
                {
                    string NombreAtributo = oProperty.Name;
                    string Tipo           = oProperty.PropertyType.Name.ToString();

                    var val1 = cotizacion.GetType().GetProperty(NombreAtributo).GetValue(cotizacion, null);

                    if (val1 != null)
                    {
                        if (Tipo == "Int32")
                        {
                            int valor = Convert.ToInt32(oProperty.GetValue(cotizacion));
                            oProperty.SetValue(oENSCTRCotizaciones, valor);
                        }
                        if (Tipo == "String")
                        {
                            string valor = oProperty.GetValue(cotizacion).ToString();
                            oProperty.SetValue(oENSCTRCotizaciones, valor);
                        }
                        if (Tipo == "DateTime")
                        {
                            DateTime valor = DateTime.Parse(oProperty.GetValue(cotizacion).ToString());
                            oProperty.SetValue(oENSCTRCotizaciones, valor);
                        }
                        if (Tipo == "Double")
                        {
                            Double valor = Convert.ToDouble(oProperty.GetValue(cotizacion));
                            oProperty.SetValue(oENSCTRCotizaciones, valor);
                        }
                    }
                }
            }
            // return View(oENSCTRCotizaciones);
            //return View(cotizacion);
            return(oENSCTRCotizaciones);
        }
예제 #2
0
        public ActionResult ValoresIniciales(ENSCTRCotizaciones cotizacion)

        {
            ViewBag.CodigoDpto   = new SelectList(LNUbigeoDpto.ObtenerDpto().ToList(), "CodigoDpto", "DescripcionDpto");
            ViewBag.CodigoProv   = new SelectList(LNUbigeoProv.ObtenerProv(cotizacion.CodigoDpto).ToList(), "CodigoProv", "DescripcionProv");
            ViewBag.CodigoDist   = new SelectList(LNUbigeoDist.ObtenerDist(cotizacion.CodigoDpto, cotizacion.CodigoProv).ToList(), "CodigoDist", "DescripcionDist");
            ViewBag.CodigoDptoR  = new SelectList(LNUbigeoDpto.ObtenerDpto().ToList(), "CodigoDpto", "DescripcionDpto");
            ViewBag.CodigoProvR  = new SelectList(LNUbigeoProv.ObtenerProv(cotizacion.CodigoDptoR).ToList(), "CodigoProv", "DescripcionProv");
            ViewBag.CodigoDistR  = new SelectList(LNUbigeoDist.ObtenerDist(cotizacion.CodigoDptoR, cotizacion.CodigoProvR).ToList(), "CodigoDist", "DescripcionDist");
            ViewBag.GrupoCIIU    = new SelectList(LNCIIUPrincipal.ObtenerCIIUPrincipal().ToList(), "CodigoCIIU", "DescripcionCIIU");
            ViewBag.CodigoCIIU   = new SelectList(LNCIIUEspecifica.ObtenerCIIUEspecifica(cotizacion.GrupoCIIU).ToList(), "CodigoCIIU", "DescripcionCIIU");
            ViewBag.CodigoMoneda = new SelectList(LNMonedas.ObtenerTodos().ToList(), "CodigoMoneda", "DescripcionMoneda");
            return(View());
        }
예제 #3
0
        public ActionResult Crear(string id = "")
        {
            ENSCTRCotizaciones oENSCTRCotizaciones = null;

            if (id != "")
            {
                oENSCTRCotizaciones  = LNSCTRCotizaciones.ObtenerUnoConDetalle(id);
                ViewBag.CodigoDpto   = new SelectList(LNUbigeoDpto.ObtenerDpto().ToList(), "CodigoDpto", "DescripcionDpto", oENSCTRCotizaciones.CodigoDpto);
                ViewBag.CodigoProv   = new SelectList(LNUbigeoProv.ObtenerProv(oENSCTRCotizaciones.CodigoDpto).ToList(), "CodigoProv", "DescripcionProv", oENSCTRCotizaciones.CodigoProv);
                ViewBag.CodigoDist   = new SelectList(LNUbigeoDist.ObtenerDist(oENSCTRCotizaciones.CodigoDpto, oENSCTRCotizaciones.CodigoProv).ToList(), "CodigoDist", "DescripcionDist", oENSCTRCotizaciones.CodigoDist);
                ViewBag.CodigoDptoR  = new SelectList(LNUbigeoDpto.ObtenerDpto().ToList(), "CodigoDpto", "DescripcionDpto", oENSCTRCotizaciones.CodigoDpto);
                ViewBag.CodigoProvR  = new SelectList(LNUbigeoProv.ObtenerProv(oENSCTRCotizaciones.CodigoDpto).ToList(), "CodigoProv", "DescripcionProv", oENSCTRCotizaciones.CodigoProv);
                ViewBag.CodigoDistR  = new SelectList(LNUbigeoDist.ObtenerDist(oENSCTRCotizaciones.CodigoDpto, oENSCTRCotizaciones.CodigoProv).ToList(), "CodigoDist", "DescripcionDist", oENSCTRCotizaciones.CodigoDist);
                ViewBag.GrupoCIIU    = new SelectList(LNCIIUPrincipal.ObtenerCIIUPrincipal().ToList(), "CodigoCIIU", "DescripcionCIIU", oENSCTRCotizaciones.GrupoCIIU);
                ViewBag.CodigoCIIU   = new SelectList(LNCIIUEspecifica.ObtenerCIIUEspecifica(oENSCTRCotizaciones.GrupoCIIU).ToList(), "CodigoCIIU", "DescripcionCIIU", oENSCTRCotizaciones.CodigoCIIU);
                ViewBag.CodigoMoneda = new SelectList(LNMonedas.ObtenerTodos().ToList(), "CodigoMoneda", "DescripcionMoneda", oENSCTRCotizaciones.CodigoMoneda);
                //Guardar Codigo Cliente para Emisión
                System.Web.HttpContext.Current.Session["codigocliente"] = oENSCTRCotizaciones.CodigoCliente;
            }
            else
            {
                ViewBag.CodigoDpto   = new SelectList(LNUbigeoDpto.ObtenerDpto().ToList(), "CodigoDpto", "DescripcionDpto");
                ViewBag.CodigoProv   = new SelectList(LNUbigeoProv.ObtenerProv("15").ToList(), "CodigoProv", "DescripcionProv");
                ViewBag.CodigoDist   = new SelectList(LNUbigeoDist.ObtenerDist("15", "01").ToList(), "CodigoDist", "DescripcionDist");
                ViewBag.CodigoDptoR  = new SelectList(LNUbigeoDpto.ObtenerDpto().ToList(), "CodigoDpto", "DescripcionDpto");
                ViewBag.CodigoProvR  = new SelectList(LNUbigeoProv.ObtenerProv("15").ToList(), "CodigoProv", "DescripcionProv");
                ViewBag.CodigoDistR  = new SelectList(LNUbigeoDist.ObtenerDist("15", "01").ToList(), "CodigoDist", "DescripcionDist");
                ViewBag.GrupoCIIU    = new SelectList(LNCIIUPrincipal.ObtenerCIIUPrincipal().ToList(), "CodigoCIIU", "DescripcionCIIU");
                ViewBag.CodigoCIIU   = new SelectList(LNCIIUEspecifica.ObtenerCIIUEspecifica("17120").ToList(), "CodigoCIIU", "DescripcionCIIU");
                ViewBag.CodigoMoneda = new SelectList(LNMonedas.ObtenerTodos().ToList(), "CodigoMoneda", "DescripcionMoneda");
                oENSCTRCotizaciones  = new ENSCTRCotizaciones();
                oENSCTRCotizaciones.dtm_FechaInicio = DateTime.Now;                 // valores default para nuevos
                oENSCTRCotizaciones.dtm_FechaFin    = DateTime.Parse("31/12/2021"); // valores default para nuevos
                //Solo Para pruebas
                oENSCTRCotizaciones.EmpresaRUC               = "20508863475";
                oENSCTRCotizaciones.EmpresaNombre            = "GLINFOSAC";
                oENSCTRCotizaciones.Direccion                = "SANTA CRUZ 376";
                oENSCTRCotizaciones.DetMontoPlanillaAdm      = 20000;
                oENSCTRCotizaciones.DetMontoPlanillaOpe      = 15000;
                oENSCTRCotizaciones.DetNumeroTrabajadoresAdm = 20;
                oENSCTRCotizaciones.DetNumeroTrabajadoresOpe = 15;
            }
            return(View(oENSCTRCotizaciones));
        }