コード例 #1
0
        /// <summary>
        /// PO view controller
        /// </summary>
        /// <param name="po">kode PO</param>
        /// <returns>List produk</returns>
        public ActionResult POBoard(string po)
        {
            try
            {
                ViewBag.useAjax       = true;
                ViewBag.useIcheck     = true;
                ViewBag.useDataTable  = true;
                ViewBag.useDatePicker = true;
                ViewBag.po            = po;
                ViewBag.editPoBoard   = false;

                if (po != null && po != "")
                {
                    PoTransactions pt = new PoTransactions(po);
                    ViewData["poOption"]  = pt.getOption();
                    ViewData["poPayment"] = pt.getPayments();
                    var model = pt.getProductsAndNotes();
                    if (model.Count() > 0)
                    {
                        ViewBag.created = pt.getDatePublish();
                        ViewBag.limited = pt.getDateEnd();
                    }
                    ViewBag.umDate  = pt.getUmDate();
                    ViewBag.pelDate = pt.getPelaksanaanDate();
                    ViewBag.pemDate = pt.getPemeliharaanDate();
                    ViewBag.dpb     = pt.getDpb();
                    double totalBilling = pt.getTotalBilling();
                    double hasPayment   = pt.getHasPayment();
                    double theTotal     = totalBilling - hasPayment;
                    ViewBag.balance = theTotal.ConvertToDot();

                    if (User.IsInRole(PELAKSANA) || User.IsInRole(DEVELOPER))
                    {
                        string nDpb   = pt.getDpb();
                        bool   isMine = false;
                        string uid    = User.Identity.GetUserId();
                        if (nDpb != null && uid != null)
                        {
                            isMine = pt.isMyPo(nDpb, uid);
                        }
                        if (isMine)
                        {
                            ViewBag.editPoBoard = true;
                        }
                    }

                    return(View(model));
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
            ViewBag.noData = true;
            return(View());
        }