//
        // GET: /BillOfMaterial/

        public ActionResult Add(string ID)
        {
            ViewBag.FinishedProductList    = ProductLogic.GetFinishedProducts();
            ViewBag.RawMaterialProductList = ProductLogic.GetRawMaterialProducts();
            ViewBag.BOMProcessList         = BOMProcessLogic.BOMProcessByID(0);
            ViewBag.UnitList      = ProductUnitLogic.GetProductUnitByID(0);
            ViewBag.LabParameters = LabParameterLogic.GetLabParameterByID(0);
            ViewBag.UserType      = currUser.Type;
            if (Convert.ToInt32(ID) > 0)
            {
                var bom = BillOfMaterialLogic.GetBillOfMaterialByID(Convert.ToInt32(ID)).FirstOrDefault();
                ViewBag.ShadeList = ShadeLogic.GetShadeByProductID(Convert.ToInt32(bom.ProductID)).Select(x => new { x.ShadeID, x.ShadeName }).Distinct();
                //var productShades = ShadeLogic.GetShadeByProductID(bom.ProductID);
                //if (productShades != null && productShades.Count() > 0)
                //{
                //    foreach (var productShade in productShades.Select(x => x.ShadeID).Distinct())
                //    {
                //        ViewBag.ShadeList = ShadeLogic.GetShadeByID(Convert.ToInt32(productShade));
                //    }
                //}
                //else
                //{
                //    ViewBag.ShadeList = null;
                //}
                return(View(bom));
            }
            else
            {
                ViewBag.ShadeList = null;
                return(View(new BillOfMaterial()));
            }
        }
 public ActionResult Conversion(int ID)
 {
     ViewBag.Products = ProductLogic.GetFinishedProducts();
     if (ID > 0)
     {
         var conversion = ProductLogic.GetConversionByID(ID).FirstOrDefault();
         ViewBag.FromShades   = ShadeLogic.GetShadeByProductID(conversion.FromProductId);
         ViewBag.FromPackings = PackingLogic.GetPackingByProductID(Convert.ToInt32(conversion.FromProductId));
         if (conversion.FromProductId == conversion.ToProductId)
         {
             ViewBag.ToShades = ViewBag.FromShades;
         }
         else
         {
             ViewBag.ToShades = ShadeLogic.GetShadeByProductID(conversion.ToProductId);
         }
         ViewBag.ToPackings = ViewBag.FromPackings;
         return(View(conversion));
     }
     else
     {
         var conversion = new ProductConversion();
         conversion.DocNo = ProductLogic.GetNewConverstionDocNo();
         return(View(conversion));
     }
 }
        public ActionResult GetOrderDetail(int ID, int DispatchID)
        {
            var order = OrderLogic.GetOrderByID(ID).FirstOrDefault();

            ViewBag.Parties    = PartyLogic.GetPartyByID(order.PartyID);
            ViewBag.Transports = TransportLogic.GetTransportByID(0);
            ViewBag.Products   = ProductLogic.GetFinishedProducts();
            ViewBag.Addresses  = PartyAddressLogic.GetPartyAddress(order.PartyID);
            var dispatch = new Dispatch();

            if (DispatchID == 0)
            {
                dispatch.DONo   = DispatchLogic.GetMaxDispatchNo();
                dispatch.DODate = DateTime.Now;
            }
            else
            {
                dispatch = DispatchLogic.GetDispatchByID(DispatchID).FirstOrDefault();
            }
            dispatch.order   = order;
            dispatch.details = DispatchLogic.GetDispatchDetail(DispatchID, order.ID);
            if (DispatchID > 0)
            {
                dispatch.order.PartyID           = dispatch.PartyID;
                dispatch.order.DeliveryAddressID = dispatch.DeliveryAddressID;
                dispatch.order.TransportID       = dispatch.TransportID;
                dispatch.order.BookingAt         = dispatch.BookingAt;
            }
            return(PartialView("_DispatchDetails", dispatch));
        }
Esempio n. 4
0
        public ActionResult OrderRegister()
        {
            ViewBag.Parties  = PartyLogic.GetPartyByID(0);
            ViewBag.Products = ProductLogic.GetFinishedProducts();
            var orders = OrderLogic.GetOrderByID(0);

            if (orders != null)
            {
                orders = orders.OrderBy(x => x.OrderDate);
            }
            return(View(orders));
        }
Esempio n. 5
0
        public ActionResult DispatchRegister()
        {
            ViewBag.Parties  = PartyLogic.GetPartyByID(0);
            ViewBag.Products = ProductLogic.GetFinishedProducts();
            var dispatches = DispatchLogic.GetDispatchByID(0);

            if (dispatches != null)
            {
                dispatches = dispatches.OrderBy(x => x.DODate);
            }
            return(View(dispatches));
        }
Esempio n. 6
0
        //
        // GET: /Order/

        public ActionResult Add(string ID)
        {
            ViewBag.Dispatch   = false;
            ViewBag.Parties    = PartyLogic.GetPartyByID(0).Where(x => x.PartyGroupID == (PartyGroupLogic.GetAllPartyGroup().FirstOrDefault(y => y.GroupCode == "100003").ID)).OrderBy(x => x.Name);
            ViewBag.Transports = TransportLogic.GetTransportByID(0);
            ViewBag.Products   = ProductLogic.GetFinishedProducts();
            if (Convert.ToInt32(ID) > 0)
            {
                var order = OrderLogic.GetOrderByID(Convert.ToInt32(ID)).FirstOrDefault();
                ViewBag.Addresses = PartyAddressLogic.GetPartyAddress(order.PartyID);
                return(View(order));
            }
            else
            {
                var order = new Order();
                order.OrderNo = OrderLogic.GetMaxOrderNo();
                return(View(order));
            }
        }
Esempio n. 7
0
        //
        // GET: /Report/

        public ActionResult Stock()
        {
            ViewBag.Products = ProductLogic.GetFinishedProducts();
            return(View(StockLogic.GetStockReport(null, null, null, null, null)));
        }