예제 #1
0
        public ActionResult Diario(DiarioStockModel model)
        {
            var aux    = model as IToolbar;
            var helper = ContextService.GetUrlHelper();

            aux.Toolbar                  = new ToolbarListadosModel();
            aux.Toolbar.Titulo           = "Diario de stock";
            aux.Toolbar.Acciones         = HelpItem();
            aux.Toolbar.CustomAction     = true;
            aux.Toolbar.CustomActionName = helper.Action("Index");
            model.Context                = ContextService;
            Session["_diario_"]          = model;
            return(View(model));
        }
        public static IQueryable <Diariostock> GetMovimientos(DiarioStockModel model)
        {
            var list = DB(model.Context).Diariostock.Where(f => model.Context.Empresa == f.empresa);

            list = string.IsNullOrEmpty(model.Fkarticulos) ? list : list.Where(f => f.fkarticulos == model.Fkarticulos);
            list = string.IsNullOrEmpty(model.Lote) ? list : list.Where(f => (f.lote) == model.Lote);
            list = (model.Categoria == CategoriaMovimientos.Principal) ? list.Where(f => f.categoriamovimiento == (int)CategoriaMovimientos.Principal) : list;

            list = !model.FechaDesde.HasValue ? list : list.Where(f => f.fecha >= model.FechaDesde.Value);

            if (model.FechaHasta.HasValue)
            {
                var fechahasta = model.FechaHasta.Value.AddDays(1);
                list = list.Where(f => f.fecha <= fechahasta);
            }


            if (model.Tipodealmacenlote.HasValue)
            {
                list = list.Where(f => f.tipoalmacenlote == (int?)model.Tipodealmacenlote);
            }

            return(list);
        }