Exemplo n.º 1
0
        public ActionResult ProductConfirmedWithSupplier(int orderId)
        {
            var item = _da.GetStorageWarehousingItem(orderId);

            if (item.DateRecive == null)
            {
                return(View(new List <TotalProductToDayItem>()));
            }

            // get productid in order
            var productids = _da.GetProductInOrder(orderId);
            var products   = _productToDayDa.GetListByToDay(item.DateRecive.Value, productids);


            // lay tong so don hang đã chốt với nhà cung câp

            // lay tong số đơn hang đã chốt với khách hàng

            var productConfirmCustomer = _da.GetProductSummaryConfirm(productids, item.DateRecive.Value);

            foreach (var totalProductToDayItem in productConfirmCustomer)
            {
                var product = products.FirstOrDefault(m => m.ProductId == totalProductToDayItem.ProductId);
                if (product != null)
                {
                    product.Quantity -= totalProductToDayItem.Quantity;
                }
            }

            return(View(products));
        }