예제 #1
0
        public PartialViewResult GetPartialSo(int idSo, int IdSoKontrak = 0)
        {
            Context.SalesOrder dbitem = RepoSalesOrder.FindByPK(idSo);

            if (dbitem.SalesOrderOncallId.HasValue)
            {
                AdminUangJalan model = new AdminUangJalan(dbitem.AdminUangJalan, RepoAtm.FindAll(), RepoBor.FindAll());
                model.ModelOncall = new SalesOrderOncall(dbitem);
                return(PartialView("SalesOrderOncall/_PartialFormReadOnly", model.ModelOncall));
            }
            else if (dbitem.SalesOrderPickupId.HasValue)
            {
                AdminUangJalan model = new AdminUangJalan(dbitem.AdminUangJalan, RepoAtm.FindAll(), RepoBor.FindAll());
                model.ModelPickup = new SalesOrderPickup(dbitem);
                return(PartialView("SalesOrderPickup/_PartialFormReadOnly", model.ModelPickup));
            }
            else if (dbitem.SalesOrderProsesKonsolidasiId.HasValue)
            {
                AdminUangJalan model = new AdminUangJalan(dbitem.AdminUangJalan, RepoAtm.FindAll(), RepoBor.FindAll());
                model.ModelKonsolidasi = new SalesOrderProsesKonsolidasi(dbitem);
                return(PartialView("SalesOrderProsesKonsolidasi/_PartialFormReadOnly", model.ModelKonsolidasi));
            }
            else if (IdSoKontrak != 0)
            {
                //List<int> ListIdDumy = ListIdSo.Split(new string[] { "." }, StringSplitOptions.None).ToList().Select(int.Parse).ToList();
                Context.SalesOrderKontrakListSo dbsoDummy = dbitem.SalesOrderKontrak.SalesOrderKontrakListSo.Where(d => d.Id == IdSoKontrak).FirstOrDefault();
                dbitem.SalesOrderKontrak.SalesOrderKontrakListSo.Clear();
                dbitem.SalesOrderKontrak.SalesOrderKontrakListSo.Add(dbsoDummy);
                AdminUangJalan model = new AdminUangJalan(dbsoDummy.AdminUangJalan, RepoAtm.FindAll(), RepoBor.FindAll());
                model.ModelKontrak = new SalesOrderKontrak(dbitem);
                return(PartialView("SalesOrderKontrak/_PartialFormReadOnly", model));
            }
            return(PartialView(""));
        }
예제 #2
0
        public string GetDetailSo(int idSo, string ListIdSo)
        {
            Context.SalesOrder dbitem = RepoSalesOrder.FindByPK(idSo);
            AdminUangJalan     model  = new AdminUangJalan();

            if (dbitem.SalesOrderKontrakId.HasValue)
            {
                List <int> ListIdDumy = ListIdSo.Split(new string[] { "." }, StringSplitOptions.None).ToList().Select(int.Parse).ToList();
                List <Context.SalesOrderKontrakListSo> dbsoDummy = dbitem.SalesOrderKontrak.SalesOrderKontrakListSo.Where(d => ListIdDumy.Contains(d.Id)).ToList();
                dbitem.SalesOrderKontrak.SalesOrderKontrakListSo = dbsoDummy;

                if (dbsoDummy.FirstOrDefault().IdAdminUangJalan.HasValue)
                {
                    model = new AdminUangJalan(dbsoDummy.FirstOrDefault().AdminUangJalan, RepoAtm.FindAll(), RepoBor.FindAll());
                }
            }
            else
            {
                try
                {
                    model = new AdminUangJalan(dbitem.AdminUangJalan, RepoAtm.FindAll(), RepoBor.FindAll());
                }
                catch { }
            }

            return(new JavaScriptSerializer().Serialize(model));
        }
예제 #3
0
        public string Binding()
        {
            GridRequestParameters param = GridRequestParameters.Current;

            List <Context.Atm> items = RepoAtm.FindAll(param.Skip, param.Take, (param.Sortings != null ? param.Sortings.ToList() : null), param.Filters);

            List <Atm> ListModel = new List <Atm>();

            foreach (Context.Atm item in items)
            {
                ListModel.Add(new Atm(item));
            }

            int total = RepoAtm.Count(param.Filters);

            return(new JavaScriptSerializer().Serialize(new { total = total, data = ListModel }));
        }
        public ActionResult Edit(int id)
        {
            Context.SettlementReguler dbitem = RepoSettlementReg.FindByPK(id);
            SettlementReg             model  = new SettlementReg(dbitem, RepoAtm.FindAll());

            if (model.ModelOncall != null)
            {
                ViewBag.name = model.ModelOncall.SONumber;
            }
            if (model.ModelPickup != null)
            {
                ViewBag.name = model.ModelPickup.SONumber;
            }
            if (model.ModelKonsolidasi != null)
            {
                ViewBag.name = model.ModelKonsolidasi.SONumber;
            }
            if (model.ModelKontrak != null)
            {
                ViewBag.name = model.ModelKontrak.SONumber;
            }

            return(View("Form", model));
        }
        public ActionResult Edit(int id)
        {
            Context.SalesOrder dbitem  = RepoSalesOrder.FindByPK(id);
            List <Context.Atm> ListAtm = RepoAtm.FindAll();

            if (dbitem.SalesOrderOncallId.HasValue)
            {
                SalesOrderOncall model = new SalesOrderOncall(dbitem);
                //ambil rekening default
                if (!model.AtmId.HasValue)
                {
                    Context.Atm dummAtm = ListAtm.Where(d => d.IdDriver == model.Driver1Id).FirstOrDefault();
                    if (dummAtm != null)
                    {
                        model.AtmId       = dummAtm.Id;
                        model.StrRekening = dummAtm.NoRekening;
                        model.AtasNamaRek = dummAtm.AtasNama;
                        model.Bank        = dummAtm.LookupCodeBank.Nama;
                    }
                }

                ViewBag.kondisi  = "konfirmasi";
                ViewBag.name     = model.SONumber;
                ViewBag.Title    = "konfirmasi Sales Order Oncall " + model.SONumber;
                ViewBag.PostData = "EditOncall";
                return(View("SalesOrderOncall/FormReadOnly", model));
            }
            else if (dbitem.SalesOrderProsesKonsolidasiId.HasValue)
            {
                SalesOrderProsesKonsolidasi model = new SalesOrderProsesKonsolidasi(dbitem);

                //ambil rekening default
                if (!model.AtmId.HasValue)
                {
                    Context.Atm dummAtm = ListAtm.Where(d => d.IdDriver == model.Driver1Id).FirstOrDefault();
                    if (dummAtm != null)
                    {
                        model.AtmId       = dummAtm.Id;
                        model.StrRekening = dummAtm.NoRekening;
                        model.AtasNamaRek = dummAtm.AtasNama;
                        model.Bank        = dummAtm.LookupCodeBank.Nama;
                    }
                }

                ViewBag.kondisi  = "konfirmasi";
                ViewBag.name     = model.SONumber;
                ViewBag.Title    = "konfirmasi Sales Proses Konsolidasi " + model.SONumber;
                ViewBag.PostData = "EditKonsolidasi";
                return(View("SalesOrderProsesKonsolidasi/FormReadOnly", model));
            }
            else if (dbitem.SalesOrderPickupId.HasValue)
            {
                SalesOrderPickup model = new SalesOrderPickup(dbitem);

                //ambil rekening default
                if (!model.AtmId.HasValue)
                {
                    Context.Atm dummAtm = ListAtm.Where(d => d.IdDriver == model.Driver1Id).FirstOrDefault();
                    if (dummAtm != null)
                    {
                        model.AtmId       = dummAtm.Id;
                        model.StrRekening = dummAtm.NoRekening;
                        model.AtasNamaRek = dummAtm.AtasNama;
                        model.Bank        = dummAtm.LookupCodeBank.Nama;
                    }
                }

                ViewBag.kondisi  = "konfirmasi";
                ViewBag.name     = model.SONumber;
                ViewBag.Title    = "konfirmasi Sales Order Pickup " + model.SONumber;
                ViewBag.PostData = "EditPickup";
                return(View("SalesOrderPickup/FormReadOnly", model));
            }
            else
            {
                return(View(""));
            }
        }
예제 #6
0
        public ActionResult Edit(int id)
        {
            Context.SalesOrder dbitem = RepoSalesOrder.FindByPK(id);
            AdminUangJalan     model  = new AdminUangJalan();

            if (dbitem.AdminUangJalanId.HasValue)
            {
                model = new AdminUangJalan(dbitem.AdminUangJalan, Repoatm.FindAll(), RepoBor.FindAll());
            }

            model.IdSalesOrder = dbitem.Id;
            ViewBag.Status     = dbitem.Status;
            if (dbitem.SalesOrderOncallId.HasValue)
            {
                model.ModelOncall = new SalesOrderOncall(dbitem);
                model.StatusSo    = model.ModelOncall.Status;
                if (model.IdDriver1.HasValue)
                {
                    model.IdDriver1        = model.IdDriver1;
                    model.NamaDriver1      = model.NamaDriver1;
                    model.KeteranganGanti1 = model.KeteranganGanti1;
                }
                else
                {
                    model.IdDriver1        = model.ModelOncall.Driver1Id;
                    model.NamaDriver1      = model.ModelOncall.KodeDriver1 + " - " + model.ModelOncall.NamaDriver1;
                    model.KeteranganGanti1 = model.ModelOncall.KeteranganDriver1;
                }
                if (model.IdDriver2.HasValue)
                {
                    model.IdDriver2        = model.IdDriver2;
                    model.NamaDriver2      = model.NamaDriver2;
                    model.KeteranganGanti2 = model.KeteranganGanti2;
                }
                else
                {
                    model.IdDriver2        = model.ModelOncall.Driver2Id;
                    model.NamaDriver2      = model.ModelOncall.KodeDriver2 + " - " + model.ModelOncall.NamaDriver2;
                    model.KeteranganGanti2 = model.ModelOncall.KeteranganDriver2;
                }
                ViewBag.dbsoPerDriverCount = 1;
                ViewBag.Title = "Batal Truk " + dbitem.SalesOrderOncall.SONumber;
                return(View("Form", model));
            }
            else if (dbitem.SalesOrderPickupId.HasValue)
            {
                model.ModelPickup = new SalesOrderPickup(dbitem);
                model.StatusSo    = model.ModelPickup.Status;
                if (model.IdDriver1.HasValue)
                {
                    model.IdDriver1        = model.IdDriver1;
                    model.NamaDriver1      = model.NamaDriver1;
                    model.KeteranganGanti1 = model.KeteranganGanti1;
                }
                else
                {
                    model.IdDriver1        = model.ModelPickup.Driver1Id;
                    model.NamaDriver1      = model.ModelPickup.KodeDriver1 + " - " + model.ModelPickup.NamaDriver1;
                    model.KeteranganGanti1 = model.ModelPickup.KeteranganDriver1;
                }
                if (model.IdDriver2.HasValue)
                {
                    model.IdDriver2        = model.IdDriver2;
                    model.NamaDriver2      = model.NamaDriver2;
                    model.KeteranganGanti2 = model.KeteranganGanti2;
                }
                else
                {
                    model.IdDriver2        = model.ModelPickup.Driver2Id;
                    model.NamaDriver2      = model.ModelPickup.KodeDriver2 + " - " + model.ModelPickup.NamaDriver2;
                    model.KeteranganGanti2 = model.ModelPickup.KeteranganDriver2;
                }
                ViewBag.Title = "Batal Order " + dbitem.SalesOrderPickup.SONumber;
                //ViewBag.postData = "EditPickup";
                return(View("Form", model));
            }
            else if (dbitem.SalesOrderProsesKonsolidasiId.HasValue)
            {
                model.ModelKonsolidasi = new SalesOrderProsesKonsolidasi(dbitem);
                model.StatusSo         = model.ModelKonsolidasi.Status;
                if (model.IdDriver1.HasValue)
                {
                    model.IdDriver1        = model.IdDriver1;
                    model.NamaDriver1      = model.NamaDriver1;
                    model.KeteranganGanti1 = model.KeteranganGanti1;
                }
                else
                {
                    model.IdDriver1        = model.ModelKonsolidasi.Driver1Id;
                    model.NamaDriver1      = model.ModelKonsolidasi.KodeDriver1 + " - " + model.ModelKonsolidasi.NamaDriver1;
                    model.KeteranganGanti1 = model.ModelKonsolidasi.KeteranganDriver1;
                }
                if (model.IdDriver2.HasValue)
                {
                    model.IdDriver2        = model.IdDriver2;
                    model.NamaDriver2      = model.NamaDriver2;
                    model.KeteranganGanti2 = model.KeteranganGanti2;
                }
                else
                {
                    model.IdDriver2        = model.ModelKonsolidasi.Driver2Id;
                    model.NamaDriver2      = model.ModelKonsolidasi.KodeDriver2 + " - " + model.ModelKonsolidasi.NamaDriver2;
                    model.KeteranganGanti2 = model.ModelKonsolidasi.KeteranganDriver2;
                }
                ViewBag.Title = "Batal Order " + dbitem.SalesOrderProsesKonsolidasi.SONumber;
                //ViewBag.postData = "EditPickup";
                return(View("Form", model));
            }
            else if (dbitem.SalesOrderKontrakId.HasValue)
            {
                model.ModelKonsolidasi = new SalesOrderProsesKonsolidasi(dbitem);
                model.StatusSo         = model.ModelKonsolidasi.Status;
                if (model.IdDriver1.HasValue)
                {
                    model.IdDriver1        = model.IdDriver1;
                    model.NamaDriver1      = model.NamaDriver1;
                    model.KeteranganGanti1 = model.KeteranganGanti1;
                }
                else
                {
                    model.IdDriver1        = model.ModelKonsolidasi.Driver1Id;
                    model.NamaDriver1      = model.ModelKonsolidasi.KodeDriver1 + " - " + model.ModelKonsolidasi.NamaDriver1;
                    model.KeteranganGanti1 = model.ModelKonsolidasi.KeteranganDriver1;
                }
                if (model.IdDriver2.HasValue)
                {
                    model.IdDriver2        = model.IdDriver2;
                    model.NamaDriver2      = model.NamaDriver2;
                    model.KeteranganGanti2 = model.KeteranganGanti2;
                }
                else
                {
                    model.IdDriver2        = model.ModelKonsolidasi.Driver2Id;
                    model.NamaDriver2      = model.ModelKonsolidasi.KodeDriver2 + " - " + model.ModelKonsolidasi.NamaDriver2;
                    model.KeteranganGanti2 = model.ModelKonsolidasi.KeteranganDriver2;
                }
                ViewBag.Title = "Batal Order " + dbitem.SalesOrderProsesKonsolidasi.SONumber;
                //ViewBag.postData = "EditPickup";
                ViewBag.dbsoPerDriverCount = 1;
                return(View("Form", model));
            }

            return(View());
        }