Exemple #1
0
        /// <summary>
        /// Payment Board controller
        /// </summary>
        /// <param name="po">Kode PO</param>
        /// <returns>Model Payment</returns>
        public ActionResult PaymentBoard(string po)
        {
            ViewBag.useIcheck    = true;
            ViewBag.useDataTable = true;
            ViewBag.po           = po;
            ViewBag.addPayment   = false;
            try
            {
                if (User.IsInRole(ADMIN) || User.IsInRole(DEVELOPER))
                {
                    ViewBag.addPayment = true;
                }

                if (po != null && po != "")
                {
                    PoTransactions pt    = new PoTransactions(po);
                    var            model = pt.getPayments();
                    //if (model.Count > 0)
                    //{
                    //string dpb = pt.getDpb();
                    //ViewBag.dpb = dpb;
                    return(View(model));
                    //}
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
            }

            ViewBag.noData = true;
            return(View());
        }
Exemple #2
0
        public ActionResult POImport(PoImport model)
        {
            ViewBag.po          = model.po;
            ViewBag.addPoImport = false;

            if (User.IsInRole(PELAKSANA) || User.IsInRole(DEVELOPER))
            {
                ViewBag.useDatePicker = true;
                ViewBag.addPoImport   = true;
            }
            if (ModelState.IsValid)
            {
                try
                {
                    PoImport pi = db.poImportData.Find(model.po_import_id);
                    if (pi == null)
                    {
                        model.created_at = DateTime.Now;
                        model.updated_at = DateTime.Now;
                        db.poImportData.Add(model);
                        db.SaveChanges();
                    }
                    else
                    {
                        //pi = model;
                        model.updated_at = DateTime.Now;
                        db.Entry(pi).CurrentValues.SetValues(model);
                        db.Entry(pi).State = EntityState.Modified;
                        db.SaveChanges();
                    }
                    if (model.state == 0)
                    {
                        PoTransactions pt  = new PoTransactions(model.po);
                        var            ppp = pt.GetProducts();
                        if (ppp.Count() > 0)
                        {
                            ViewBag.cur = ppp.First().cur;
                        }
                        ViewBag.listProducts = ppp;
                        ViewBag.saved        = 1;
                        return(View(model));
                    }
                    else if (model.state == 1)
                    {
                        return(RedirectToAction("PrintPOImport", "Out", new { po = model.po }));
                    }
                    else if (model.state == 2)
                    {
                        return(RedirectToAction("PDFPoImport", "Out", new { po = model.po }));
                    }
                }
                catch (Exception e)
                {
                    Log.Error(e);
                    throw;
                }
            }
            ViewBag.saved = 2;
            return(View(model));
        }
Exemple #3
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());
        }
Exemple #4
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());
            }
        }
Exemple #5
0
        /// <summary>
        /// Print PO Impor
        /// </summary>
        /// <param name="po">Kode PO dalam bentuk string</param>
        /// <returns></returns>
        public ActionResult PrintPOImport(string po)
        {
            try
            {
                ViewBag.po = po;
                PoImport pi = db.poImportData.FirstOrDefault(p => p.po == po);
                if (pi != null)
                {
                    PrintPOImport ppi = new PrintPOImport()
                    {
                        po               = pi.po,
                        tanggal          = pi.tanggal,
                        ke               = pi.ke,
                        alamat           = pi.alamat,
                        no_telp          = pi.no_telp,
                        no_fax           = pi.no_fax,
                        attn             = pi.attn,
                        ref_po           = pi.ref_po,
                        condition        = pi.condition,
                        term_of_payment  = pi.term_of_payment,
                        pay_to_bank      = pi.pay_to_bank,
                        shipment         = pi.shipment,
                        delivery_time    = pi.delivery_time,
                        delivery_to      = pi.delivery_to,
                        attn_on_delivery = pi.attn_on_delivery,
                        manager          = pi.manager
                    };
                    PoTransactions pt  = new PoTransactions(po);
                    var            ppp = pt.GetProducts();
                    if (ppp.Count() > 0)
                    {
                        ViewBag.cur = ppp.First().cur;
                        float total = 0;
                        foreach (var item in ppp)
                        {
                            total += item.cur_amount;
                        }
                        ViewBag.total = total;
                    }

                    ViewBag.listProducts = ppp;
                    return(View(ppi));
                }
                ViewBag.noData = true;
                return(View());
            }
            catch (Exception e)
            {
                Log.Error(e);
                ViewBag.noData = true;
                return(View());
            }
        }
Exemple #6
0
 public bool DeliveredBoard(string po, string noteModel, string statusModel, IEnumerable <ProductDelivered> model)
 {
     try
     {
         PoTransactions pt = new PoTransactions(po);
         return(pt.setPoDelivered(po, noteModel, statusModel, model));
     }
     catch (Exception e)
     {
         Log.Error(e);
         return(false);
     }
 }
Exemple #7
0
 public bool SubmitOption(string po, string name, bool state)
 {
     try
     {
         PoTransactions pt     = new PoTransactions(po);
         bool           result = pt.setOption(name, state);
         return(result);
     }
     catch (Exception e)
     {
         Log.Error(e);
         return(false);
     }
 }
Exemple #8
0
 public bool SubmitDateOption(string po, string name, DateTime value)
 {
     try
     {
         PoTransactions pt = new PoTransactions(po);
         //DateTime dtime = DateTime.Parse(value);
         bool result = pt.setDateOption(name, value);
         return(result);
     }
     catch (Exception e)
     {
         Log.Error(e);
         return(false);
     }
 }
Exemple #9
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());
            }
        }
Exemple #10
0
        public ActionResult SPPForm(string po, int?spp)
        {
            try
            {
                ViewBag.useAjax       = true;
                ViewBag.useDatePicker = true;
                ViewBag.useIcheck     = true;
                ViewBag.po            = po;
                ViewBag.supplier      = "";
                ViewBag.address       = "";
                ViewBag.npwp          = "";
                ViewBag.billNumber    = "";
                ViewBag.cur           = "";
                if (po != null && po != "")
                {
                    PoTransactions pt = new PoTransactions(po);
                    //var poOptions = db.sppData.Select(s => s.po).ToList();
                    generatePaymentDropDown(false);
                    SppDashboard model        = new SppDashboard();
                    string       supplier     = pt.getSupplier();
                    string[]     supplierInfo = pt.getSupplierInfo();
                    if (supplier != null)
                    {
                        ViewBag.supplier = supplier;
                    }
                    model.spp_date = DateTime.Now;
                    var cur = db.dbPoProduct.FirstOrDefault(f => f.po == po);
                    if (cur != null)
                    {
                        try
                        {
                            ViewBag.cur = cur.cur;
                        }
                        catch (ArgumentNullException)
                        {
                            ViewBag.cur = "0";
                        }
                    }

                    List <string> poOptions = pt.getMultiplePo(ViewBag.supplier);
                    ViewBag.options = poOptions;

                    if (spp > 0)
                    {
                        model = pt.getSpp(spp);
                        if (model != null)
                        {
                            if (model.spp_date == null || model.spp_date == DateTime.MinValue)
                            {
                                model.spp_date = DateTime.Now;
                            }
                            if (supplierInfo != null && supplierInfo.Count() > 0)
                            {
                                model.address     = model.address != null ? model.address : supplierInfo[1];
                                model.npwp        = model.npwp != null ? model.npwp : supplierInfo[2];
                                model.bill_number = model.bill_number != null ? model.bill_number : supplierInfo[3];
                            }
                            ViewBag.attachmentOptions = model.attachment;

                            JavaScriptSerializer js       = new JavaScriptSerializer();
                            InvoiceFormat[]      invoices = js.Deserialize <InvoiceFormat[]>(model.invoice_number);
                            if (invoices.Count() > 0)
                            {
                                foreach (var invoice in invoices)
                                {
                                    model.invoice_num   = invoice.number;
                                    model.invoice_date  = invoice.date;
                                    model.invoice_value = invoice.total;
                                }
                            }

                            return(View(model));
                        }
                        ViewBag.noData = true;
                        return(View());
                    }
                    else
                    {
                        if (supplierInfo != null && supplierInfo.Count() > 0)
                        {
                            model.address     = model.address != null ? model.address : supplierInfo[1];
                            model.npwp        = model.npwp != null ? model.npwp : supplierInfo[2];
                            model.bill_number = model.bill_number != null ? model.bill_number : supplierInfo[3];
                        }
                    }
                    return(View(model));
                }
                ViewBag.noData = true;
                return(View());
            }
            catch (Exception e)
            {
                Log.Error(e);
                ViewBag.useAjax       = true;
                ViewBag.useDatePicker = true;
                ViewBag.useIcheck     = true;
                ViewBag.po            = po;
                ViewBag.cur           = "";
                ViewBag.supplier      = "";
                ViewBag.address       = "";
                ViewBag.npwp          = "";
                ViewBag.billNumber    = "";
                ViewBag.noData        = true;
                return(View());
            }
        }
Exemple #11
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());
            }
        }