Exemple #1
0
        /// <summary>
        /// SPP board view controller
        /// </summary>
        /// <param name="po">Kode PO</param>
        /// <returns>Model SPP dashboard</returns>
        public ActionResult SPPBoard(string po)
        {
            try
            {
                ViewBag.useDataTable = true;
                ViewBag.po           = po;
                ViewBag.addSpp       = false;

                if (User.IsInRole(BAPBSPP) || User.IsInRole(BAPB) || User.IsInRole(DEVELOPER))
                {
                    ViewBag.addSpp = true;
                }

                if (po != null && po != "")
                {
                    PoTransactions pt    = new PoTransactions(po);
                    var            model = pt.getSppLists();
                    //DateTime sppDate = DateTime.MinValue;
                    //string bankName = null;
                    //string billNumber = null;
                    //string billOwner = null;
                    List <SppBoard> sbModel = new List <SppBoard>();
                    if (model.Count() > 0)
                    {
                        foreach (var item in model)
                        {
                            SppBoard newSb = new SppBoard()
                            {
                                spp_id      = item.spp_id,
                                spp_number  = item.spp_number,
                                spp_date    = item.spp_date,
                                payment_for = item.payment_for,
                                bank_name   = item.bank_name,
                                bill_number = item.bill_number,
                                bill_owner  = item.bill_owner,
                                claim_value = pt.getTotalInvoice(item.spp_id),
                                note        = item.note
                            };

                            //if (item.spp_date != null && item.spp_date > DateTime.MinValue)
                            //{
                            //    sppDate = item.spp_date;
                            //}
                            //if (bankName == null)
                            //{
                            //    bankName = item.bank_name;
                            //}
                            //if (billNumber == null)
                            //{
                            //    billNumber = item.bill_number;
                            //}
                            //if (billOwner == null)
                            //{
                            //    billOwner = item.bill_owner;
                            //}

                            sbModel.Add(newSb);
                        }
                    }
                    //ViewBag.sppDate = sppDate;
                    //ViewBag.bankName = bankName;
                    //ViewBag.billNumber = billNumber;
                    //ViewBag.billOwner = billOwner;
                    return(View(sbModel));
                }
                ViewBag.noData = true;
                return(View());
            }
            catch (Exception e)
            {
                Log.Error(e);
                ViewBag.useDataTable = true;
                ViewBag.po           = po;
                ViewBag.addSpp       = false;
                ViewBag.noData       = true;
                return(View());
            }
        }