Ejemplo n.º 1
0
        /// <summary>
        /// PO import view controller
        /// menampilkan form
        /// </summary>
        /// <param name="po">Kode PO</param>
        /// <returns>Model POImport</returns>
        public ActionResult POImport(string po)
        {
            try
            {
                ViewBag.po          = po;
                ViewBag.saved       = 0;
                ViewBag.addPoImport = false;

                if (User.IsInRole(PELAKSANA) || User.IsInRole(DEVELOPER))
                {
                    ViewBag.useDatePicker = true;
                    ViewBag.addPoImport   = true;
                }

                if (po != null && po != "")
                {
                    PoTransactions pt    = new PoTransactions(po);
                    var            model = pt.getImport();
                    if (model != null)
                    {
                        var ppp = pt.GetProducts();
                        if (ppp.Count() > 0)
                        {
                            ViewBag.cur = ppp.First().cur;
                        }
                        ViewBag.listProducts = ppp;
                        model.delivery_to    = LenAddress;
                        return(View(model));
                    }
                }
                ViewBag.noData = true;
                return(View());
            }
            catch (Exception e)
            {
                Log.Error(e);
                ViewBag.po          = po;
                ViewBag.saved       = 0;
                ViewBag.addPoImport = false;
                ViewBag.noData      = true;
                return(View());
            }
        }