Exemplo n.º 1
0
        public JsonResult RemoveIssueDetail(int id)
        {
            var item = InventoryIssueDetail.Find(id);

            using (var scope = new TransactionScope()) {
                item.DeleteAndFlush();
            }

            return(Json(new {
                id = id,
                result = true
            }));
        }
Exemplo n.º 2
0
        public JsonResult EditIssueDetailQuantity(int id, decimal value)
        {
            var detail = InventoryIssueDetail.Find(id);

            if (value >= 0)
            {
                detail.Quantity = value;

                using (var scope = new TransactionScope()) {
                    detail.UpdateAndFlush();
                }
            }

            return(Json(new {
                id = id,
                value = detail.Quantity
            }));
        }
Exemplo n.º 3
0
        public JsonResult AddIssueDetail(int movement, int product)
        {
            var p = Product.Find(product);

            var item = new InventoryIssueDetail {
                Issue       = InventoryIssue.Find(movement),
                Product     = p,
                ProductCode = p.Code,
                ProductName = p.Name,
                Quantity    = 1
            };

            using (var scope = new TransactionScope()) {
                item.CreateAndFlush();
            }

            return(Json(new {
                id = item.Id
            }));
        }
Exemplo n.º 4
0
        public JsonResult AddIssueDetail(int movement, int product)
        {
            var p = Product.Find (product);

            var item = new InventoryIssueDetail {
                Issue = InventoryIssue.Find (movement),
                Product = p,
                ProductCode = p.Code,
                ProductName = p.Name,
                Quantity = 1
            };

            using (var scope = new TransactionScope ()) {
                item.CreateAndFlush ();
            }

            return Json (new {
                id = item.Id
            });
        }
Exemplo n.º 5
0
 public ActionResult GetIssueItem(int id)
 {
     return(PartialView("Issues/_DetailEditView", InventoryIssueDetail.Find(id)));
 }
Exemplo n.º 6
0
        public ActionResult ConfirmReturn(int id)
        {
            var item = SupplierReturn.Find (id);

            var qry = from x in item.Details
                  where x.Order.Id == id
                  group x by x.Warehouse into g
                  select new { Warehouse = g.Key, Details = g.ToList () };

            var dt = DateTime.Now;
            var employee = CurrentUser.Employee;

            using (var scope = new TransactionScope ()) {
                foreach (var x in qry) {
                    var master = new InventoryIssue {
                        Return = item,
                        Warehouse = x.Warehouse,
                        CreationTime = dt,
                        ModificationTime = dt,
                        Creator = employee,
                        Updater = employee,
                        Comment = string.Format (Resources.Message_SupplierReturn, item.Supplier.Name, item.PurchaseOrder.Id, item.Id)
                    };

                    master.Create ();

                    foreach (var y in x.Details) {
                        var detail = new InventoryIssueDetail {
                            Issue = master,
                            Product = y.Product,
                            Quantity = y.Quantity,
                            ProductCode = y.ProductCode,
                            ProductName = y.ProductName
                        };

                        detail.Create ();
                    }
                }

                item.IsCompleted = true;
                item.UpdateAndFlush ();
            }

            return RedirectToAction ("Index");
        }