예제 #1
0
        public ActionResult MovimientoInv(int? id = null, int? idTipo = null)
        {
            if (!this.currentUser()) { return RedirectToAction("Ingresar"); }
            ViewBag.Title = "Movimiento de Inventario";

            int tipo = 1;
            if (idTipo != null) { tipo = idTipo.GetValueOrDefault(); }
            MenuNavBarSelected(9, tipo - 1);

            UsuarioDTO user = getCurrentUser();

            MovimientoInvBL objBL = new MovimientoInvBL();

            ViewBag.lstTipoMovimientoInv = objBL.getTipoMovimientoInv();
            ViewBag.lstFormaMovimiento = objBL.getFormaMovimientoInvPorTipo(tipo);
            //ViewBag.lstItems = objBL.getItemsEnEmpresa(user.IdEmpresa);
            ViewBag.lstItems = objBL.getItemsEnEmpresa_PorTipoMov(user.IdEmpresa, (int)idTipo);
            ViewBag.lstProveedores = objBL.getProveedoresEnEmpresa(user.IdEmpresa);
            //Lotes de salida Lista
            ViewBag.lstLotes = objBL.getLotesEnEmpresa(user.IdEmpresa);
            //Ubicaciones
            ViewBag.lstUbicaciones = objBL.getUbicacionesEnEmpresa(user.IdEmpresa);

            var objSent = TempData["MovimientoInv"];
            if (objSent != null) { TempData["MovimientoInv"] = null; return View(objSent); }

            MovimientoInvDTO obj;
            if (id != null && id != 0)
            {
                obj = objBL.getMovimientoInvEnEmpresa((int)user.IdEmpresa, (int)id);
                if (obj == null) return RedirectToAction("MovimientoInvs");
                if (obj.IdEmpresa != user.IdEmpresa) return RedirectToAction("MovimientoInvs");
                obj.UsuarioCreacion = user.IdUsuario;

                //lstLotes.Add(new Select2DTO_B() { text = obj.SerieLote });
                ViewBag.lstLotes = objBL.getLotesEnEmpresa(user.IdEmpresa, obj.IdItem, obj.SerieLote);
                
                if (idTipo.GetValueOrDefault() == 1) { ViewBag.lstUbicaciones = objBL.getUbicacionesEnEmpresa(user.IdEmpresa); }
                else if (idTipo.GetValueOrDefault() == 2) { ViewBag.lstUbicaciones = objBL.getUbicacionesEnEmpresa(user.IdEmpresa, obj.SerieLote); }

                return View(obj);
            }
            obj = new MovimientoInvDTO();
            obj.IdTipoMovimientoInv = tipo;
            obj.IdEmpresa = user.IdEmpresa;
            obj.UsuarioCreacion = user.IdUsuario;
            obj.FechaInicial = DateTime.Now;

            //if (idTipo.GetValueOrDefault() == 1) { ViewBag.lstUbicaciones = objBL.getUbicacionesEnEmpresa(user.IdEmpresa); }
            //else if (idTipo.GetValueOrDefault() == 2) { ViewBag.lstUbicaciones = new List<Select2DTO_B>(); }

            return View(obj);
        }
예제 #2
0
        public ActionResult Proforma(int? id)
        {
            if (!this.currentUser()) { return RedirectToAction("Ingresar", "Admin", new { Area = string.Empty }); }
            ViewBag.Title += "Proforma";
            MenuNavBarSelected(12);

            UsuarioDTO user = getCurrentUser();


            EntidadResponsableBL entBL = new EntidadResponsableBL();
            ViewBag.lstClientes = entBL.getEntidadesResponsablesActivasPorTipoEnEmpresa(user.IdEmpresa, 1);
            EmpresaBL empBL = new EmpresaBL();
            ViewBag.lstMonedas = empBL.getListaMonedasAll();
            MovimientoInvBL movItmBL = new MovimientoInvBL();
            ViewBag.lstItems = movItmBL.getItemsEnEmpresa_PorTipoMov(user.IdEmpresa, 1);
            CuentaBancariaBL cbBL = new CuentaBancariaBL();
            ViewBag.lstCuentasBancarias = cbBL.getCuentasBancariasActivasPorTipoEnEmpresa(user.IdEmpresa, 1);
            ViewBag.lstContactos = new List<ContactoDTO>();

            var objSent = TempData["Proforma"];
            if (objSent != null) { TempData["Proforma"] = null; return View(objSent); }

            ProformaDTO obj;
            if(id != null && id > 0)
            {
                obj = new ProformaBL().getProformaId((int)id);
                return View(obj);
            }
            obj = new ProformaDTO();
            obj.IdEmpresa = user.IdEmpresa;
            obj.FechaProforma = DateTime.Now;
            obj.DetalleProforma = new List<DetalleProformaDTO>();

            return View(obj);
        }