Esempio 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
            }));
        }
Esempio 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
            }));
        }
Esempio 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
            }));
        }
Esempio 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
            });
        }
Esempio n. 5
0
 public ActionResult GetIssueItem(int id)
 {
     return(PartialView("Issues/_DetailEditView", InventoryIssueDetail.Find(id)));
 }
Esempio 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");
        }