Esempio n. 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());
        }
Esempio n. 2
0
        /// <summary>
        /// View Controller untuk barang tiba
        /// </summary>
        /// <param name="po">Kode PO</param>
        /// <returns>Model PO Delivered</returns>
        public ActionResult DeliveredBoard(string po)
        {
            try
            {
                ViewBag.useIcheck    = true;
                ViewBag.useDataTable = true;
                ViewBag.po           = po;
                ViewBag.addDelivered = false;

                // status kedatangan barang
                // F = full, P = partial, N = none
                ViewBag.full    = "F";
                ViewBag.partial = "P";
                ViewBag.none    = "N";

                if (User.IsInRole(PENERIMABARANG) || User.IsInRole(DEVELOPER))
                {
                    ViewBag.addDelivered = true;
                }

                if (po != null && po != "")
                {
                    PoTransactions pt = new PoTransactions(po);
                    ViewBag.created = pt.getDatePublish();
                    var model = pt.getProductDelivered();
                    if (model != null)
                    {
                        ViewBag.dpb = pt.getDpb();
                        DeliveredInfo di = pt.getDeliveredInfo();
                        ViewBag.note   = di.note;
                        ViewBag.status = di.status;
                        return(View(model));
                    }
                }
                ViewBag.noData = true;
                return(View());
            }
            catch (Exception e)
            {
                Log.Error(e);
                ViewBag.useIcheck    = true;
                ViewBag.useDataTable = true;
                ViewBag.po           = po;
                ViewBag.addDelivered = false;

                // status kedatangan barang
                // F = full, P = partial, N = none
                ViewBag.full    = "F";
                ViewBag.partial = "P";
                ViewBag.none    = "N";
                ViewBag.noData  = true;
                return(View());
            }
        }