public ActionResult Edit(int id)
        {
            Context.SalesOrder dbitem = RepoSalesOrder.FindByPK(id);
            SalesOrderKontrak  model  = new SalesOrderKontrak(dbitem);

            ViewBag.kondisi  = "konfirmasi";
            ViewBag.name     = model.SONumber;
            ViewBag.Title    = "konfirmasi Sales Order Kontrak " + model.SONumber;
            ViewBag.PostData = "Edit";

            return(View("SalesOrderKontrak/FormReadOnly", model));
        }
Ejemplo n.º 2
0
        public ActionResult Add(Klaim model)
        {
            KlaimProduct[] result = JsonConvert.DeserializeObject <KlaimProduct[]>(model.strProduk);
            model.ListProduct = result.ToList();
            KlaimAttachment[] resultAtt = JsonConvert.DeserializeObject <KlaimAttachment[]>(model.StrAtt);
            model.ListAtt = resultAtt.ToList();
            if (ModelState.IsValid && IsValid(model, ModelState))
            {
                Context.Klaim dbitem = new Context.Klaim();
                int           seq    = RepoKlaim.getUrutanOnCAll(model.TanggalPengajuan.Value);
                dbitem.NoKlaim = RepoKlaim.GenerateCode(model.TanggalPengajuan.Value, seq);
                bool Isexist = RepoKlaim.IsExist(model.NoKlaim);

                if (Isexist)
                {
                    ModelState.AddModelError("NoKlaim", "No Klaim telah dipakai.");
                    return(View("Form", model));
                }
                if (model.BebanClaimDriver + model.BebanClaimKantor != model.BebanClaim)
                {
                    ModelState.AddModelError("BebanClaimDriver", "Beban Klaim Driver + Beban Klaim Kantor harus sama dengan Beban Klaim");
                    return(View("Form", model));
                }

                model.setDb(dbitem);
                RepoKlaim.save(dbitem, UserPrincipal.id);
                //tambah beban klaim nya driver
                int idDriver            = 0;
                Context.SalesOrder dbso = RepoSalesOrder.FindByPK(model.SOKlaimId.Value);
                if (dbitem.SalesOrderKontrakId == 0)
                {
                    idDriver = dbso.AdminUangJalan.IdDriver1.Value;
                }
                else
                {
                    idDriver = dbso.SalesOrderKontrak.SalesOrderKontrakListSo.Where(
                        d => d.Id == dbitem.SalesOrderKontrakId
                        ).FirstOrDefault().Driver1Id.Value;
                }
                Context.BebanKlaimDriver dbKlaimDriver = new Context.BebanKlaimDriver()
                {
                    IdDriver = idDriver,
                    Klaim    = dbitem
                };
                RepoKlaimDriver.save(dbKlaimDriver, UserPrincipal.id);
                //lebah dieu sync ERPna
                Context.ERPConfig erpConfig = RepoERPConfig.FindByFrist();
                Repoglt_det.saveFromAc(1, dbitem.NoKlaim, decimal.Parse(dbitem.TotalPengajuanClaim.Value.ToString()), 0, Repoac_mstr.FindByPk(erpConfig.IdBiayaKlaim));  //D
                Repoglt_det.saveFromAc(2, dbitem.NoKlaim, 0, decimal.Parse(dbitem.TotalPengajuanClaim.Value.ToString()), Repoac_mstr.FindByPk(erpConfig.IdKreditKlaim)); //K
                return(RedirectToAction("Index"));
            }
            return(View("Form", model));
        }
Ejemplo n.º 3
0
        public ActionResult Edit(int idSo)
        {
            Context.SalesOrder    dbso   = RepoSalesOrder.FindByPK(idSo);
            Context.RevisiTanggal dbitem = RepoRevisiTanggal.FindBySo(idSo);

            RevisiTanggal model = new RevisiTanggal(dbso);

            if (RepoRevisiTanggal.FindBySo(idSo) != null)
            {
                model = new RevisiTanggal(dbitem);
            }

            return(View("Form", model));
        }
        public ActionResult Edit(int id)
        {
            Context.SalesOrder    dbitem = RepoSalesOrder.FindByPK(id);
            SalesOrderKonsolidasi model  = new SalesOrderKonsolidasi(dbitem);

            model.NamaCustomer = RepoLookupCode.FindByPK(model.CustomerId).Nama;
            model.KodeNama     = RepoCustomer.FindByPK(model.SupplierId.Value).CustomerCodeOld;
            model.SupplierName = RepoCustomer.FindByPK(model.SupplierId.Value).CustomerNama;
            Context.DaftarHargaKonsolidasiItem dhoitem = RepoDHKonsolidasi.FindItemByPK(model.RuteId.Value);
            ViewBag.ListNamaRute = dhoitem.ListNamaRute;

            ViewBag.name = model.SONumber;
            return(View("Form", model));
        }
Ejemplo n.º 5
0
        public PartialViewResult GetPartialSo(int idSo, string ListIdSo)
        {
            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 (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;
                AdminUangJalan model = new AdminUangJalan(dbsoDummy.FirstOrDefault().AdminUangJalan, RepoAtm.FindAll(), RepoBor.FindAll());
                model.ModelKontrak = new SalesOrderKontrak(dbitem);
                return(PartialView("SalesOrderKontrak/_PartialFormReadOnly", model));
            }
            return(PartialView(""));
        }
Ejemplo n.º 6
0
        public ActionResult Edit(int idSo)
        {
            Context.SalesOrder dbso = RepoSalesOrder.FindByPK(idSo);

            Removal model = new Removal(dbso);

            if (dbso.SalesOrderOncallId.HasValue)
            {
                return(View("FormOncall", model));
            }
            else if (dbso.SalesOrderPickupId.HasValue)
            {
                return(View("FormPickup", model));
            }
            else if (dbso.SalesOrderProsesKonsolidasiId.HasValue)
            {
                return(View("FormKonsolidasi", model));
            }

            return(View("Form", model));
        }
        public ActionResult Edit(int id)
        {
            Context.SettlementBatal dbitem = RepoSettlementBatal.FindByPK(id);
            if (dbitem.IdSoKontrak == "" || dbitem.IdSoKontrak == null)
            {
                SettlementBatal    model = new SettlementBatal(dbitem);
                Context.SalesOrder dbso  = RepoSalesOrder.FindByPK(dbitem.IdSalesOrder.Value);
                ViewBag.SPBU            = dbso.AdminUangJalan.AdminUangJalanVoucherSpbu;
                ViewBag.KeteranganBatal = dbso.KeteranganBatal;
                if (model.ModelOncall != null)
                {
                    ViewBag.name = model.ModelOncall.SONumber;
                    if (dbitem.Driver != null && dbitem.DataTruck != null)
                    {
                        ViewBag.KodeDriver    = dbitem.Driver.KodeDriver;
                        ViewBag.KodeDriverOld = dbitem.Driver.KodeDriverOld;
                        ViewBag.DriverName    = dbitem.Driver.NamaDriver;
                        ViewBag.VehicleNo     = dbitem.DataTruck.VehicleNo;
                    }
                }
                if (model.ModelPickup != null)
                {
                    ViewBag.name = model.ModelPickup.SONumber;
                }
                if (model.ModelKonsolidasi != null)
                {
                    ViewBag.name = model.ModelKonsolidasi.SONumber;
                }

                return(View("Form", model));
            }
            else
            {
                SettlementBatal    model = new SettlementBatal(dbitem);
                Context.SalesOrder dbso  = RepoSalesOrder.FindByPK(dbitem.IdSalesOrder.Value);
                ViewBag.SPBU = dbso.SalesOrderKontrak.SalesOrderKontrakListSo.Where(d => d.Id == int.Parse(dbitem.IdSoKontrak)).FirstOrDefault().AdminUangJalan.AdminUangJalanVoucherSpbu;
                return(View("Form", model));
            }
        }
        public ActionResult Edit(int id)
        {
            Context.SalesOrder dbitem = RepoSalesOrder.FindByPK(id);
            SalesOrderKontrak  model  = new SalesOrderKontrak(dbitem);

            ViewBag.name = model.SONumber;
            return(View("Form", model));
        }
Ejemplo n.º 9
0
 public ActionResult Edit(int id)
 {
     Context.SalesOrder dbitem = RepoSalesOrder.FindByPK(id);
     if (dbitem.SalesOrderOncallId.HasValue)
     {
         SalesOrderOncall model = new SalesOrderOncall(dbitem);
         ViewBag.kondisi        = "planning";
         ViewBag.name           = model.SONumber;
         ViewBag.area           = RepoSalesOrder.FindArea(dbitem.SalesOrderOncall.IdDaftarHargaItem.Value);
         ViewBag.is_area_pulang = RepoSalesOrder.FindRute(dbitem.SalesOrderOncall.IdDaftarHargaItem.Value).IsAreaPulang == true ? "Yes" : "No";
         ViewBag.TanggalPulang  = model.TanggalMuat.Value.AddDays(RepoSalesOrder.FindRute(dbitem.SalesOrderOncall.IdDaftarHargaItem.Value).WaktuKerja);
         ViewBag.Title          = "Planning Sales Order Oncall " + model.SONumber;
         ViewBag.PostData       = "EditOncall";
         return(View("SalesOrderOncall/FormReadOnly", model));
     }
     else if (dbitem.SalesOrderProsesKonsolidasiId.HasValue)
     {
         SalesOrderProsesKonsolidasi model = new SalesOrderProsesKonsolidasi(dbitem);
         ViewBag.kondisi  = "planning";
         ViewBag.name     = model.SONumber;
         ViewBag.Title    = "Planning Sales Order Proses Konsolidasi " + model.SONumber;
         ViewBag.PostData = "EditProsesKonsolidasi";
         return(View("SalesOrderProsesKonsolidasi/FormReadOnly", model));
     }
     else if (dbitem.SalesOrderPickupId.HasValue)
     {
         SalesOrderPickup model = new SalesOrderPickup(dbitem);
         ViewBag.kondisi  = "planning";
         ViewBag.name     = model.SONumber;
         ViewBag.Title    = "Planning Sales Order Pickup " + model.SONumber;
         ViewBag.PostData = "EditPickup";
         return(View("SalesOrderPickup/FormReadOnly", model));
     }
     else
     {
         return(View(""));
     }
 }
Ejemplo n.º 10
0
 public ActionResult InputDp(int id)
 {
     Context.SalesOrder dbitem = RepoSalesOrder.FindByPK(id);
     if (dbitem.SalesOrderOncallId != null)
     {
         return(RedirectToAction("InputDp", "SalesOrderOncall", new { id = dbitem.Id, status = dbitem.Status }));
     }
     else if (dbitem.SalesOrderKontrakId != null)
     {
         return(RedirectToAction("InputDp", "SalesOrderKontrak", new { id = dbitem.Id, status = dbitem.Status }));
     }
     else if (dbitem.SalesOrderPickupId != null)
     {
         return(RedirectToAction("InputDp", "SalesOrderPickup", new { id = dbitem.Id, status = dbitem.Status }));
     }
     else if (dbitem.SalesOrderProsesKonsolidasiId != null)
     {
         return(RedirectToAction("InputDp", "SalesOrderProsesKonsolidasi", new { id = dbitem.Id, status = dbitem.Status }));
     }
     else
     {
         return(RedirectToAction("", ""));
     }
 }
        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(""));
            }
        }
Ejemplo n.º 12
0
        public ActionResult Add(SettlementReg model)
        {
            SettlementRegTambahanBiaya[] res = JsonConvert.DeserializeObject <SettlementRegTambahanBiaya[]>(model.StrBiayaTambahan);
            model.ListBiayaTambahan = res.ToList();
            Context.ERPConfig  erpConfig = RepoERPConfig.FindByFrist();
            Context.SalesOrder dbso      = RepoSalesOrder.FindByPK(model.IdSalesOrder.Value);
            string             sod_oid   = Guid.NewGuid().ToString();

            if (ModelState.IsValid)
            {
                if (model.listIdSoKontrak != "" && model.listIdSoKontrak != null)
                {
                    List <int> ListIdDumy = model.listIdSoKontrak.Split(new string[] { "." }, StringSplitOptions.None).ToList().Select(int.Parse).ToList();
                    List <Context.SalesOrderKontrakListSo> dbsoDummy = dbso.SalesOrderKontrak.SalesOrderKontrakListSo.Where(d => ListIdDumy.Contains(d.Id)).ToList();
                    //dbso.SalesOrderKontrak.SalesOrderKontrakListSo = dbsoDummy;
                    foreach (var item in dbsoDummy)
                    {
                        item.Status = "settlement";
                    }
                    Context.SettlementReguler dbitem = new Context.SettlementReguler();
                    model.SetDb(dbitem);
                    RepoSalesOrder.save(dbso);
                    RepoSettlementReg.save(dbitem, UserPrincipal.id);
                    foreach (Context.SettlementRegulerTambahanBiaya srtb in dbitem.SettlementRegulerTambahanBiaya)
                    {
                        RepoAuditrail.saveSettlementRegulerBiayaTambahanQuery(srtb, UserPrincipal.id);
                    }
                }
                else
                {
                    Context.SettlementReguler dbitem = new Context.SettlementReguler();
                    string code = (dbso.SalesOrderOncallId.HasValue ? dbso.SalesOrderOncall.SONumber : dbso.SalesOrderProsesKonsolidasiId.HasValue ? dbso.SalesOrderProsesKonsolidasi.SONumber : dbso.SalesOrderPickupId.HasValue ? dbso.SalesOrderPickup.SONumber : dbso.SalesOrderKontrak.SONumber);
                    dbitem.Code = "SR-" + code;
                    string unyu = dbitem.Code;
                    model.SetDb(dbitem);
                    Context.AdminUangJalan db = RepoAdminUangJalan.FindByPK(dbso.AdminUangJalanId.Value);
                    dbso.Status    = "settlement";
                    dbso.UpdatedBy = UserPrincipal.id;
                    if (dbso.oidErp == null)
                    {
                        dbso.oidErp = sod_oid;
                    }
                    RepoSalesOrder.save(dbso);
                    RepoSettlementReg.save(dbitem, UserPrincipal.id);
                    RepoAuditrail.saveSettRegHistory(dbso);
                    foreach (Context.SettlementRegulerTambahanBiaya srtb in dbitem.SettlementRegulerTambahanBiaya)
                    {
                        RepoAuditrail.saveSettlementRegulerBiayaTambahanQuery(srtb, UserPrincipal.id);
                    }

                    //lebah dieu sync ERPna
                    //klo ada revisi rute
                    //D
                    Repoglt_det.saveFromAc(1, dbitem.Code, dbitem.KasSelisih + dbitem.TransferSelisih + dbitem.SolarSelisih + (dbitem.KapalSelisih == null ? 0 : dbitem.KapalSelisih), 0, Repoac_mstr.FindByPk(erpConfig.IdKasbonDriver)); //Kasbon Driver (Piutang)
                    Repoglt_det.saveFromBk(2, dbitem.Code, dbitem.KasAktual + dbitem.TransferAktual + dbitem.SolarAktual + (dbitem.KapalAktual == null ? 0 : dbitem.KapalAktual), 0, Repobk_mstr.FindByPk(erpConfig.IdCashCredit));        //Cash
                    Repoglt_det.saveFromAc(3, dbitem.Code, dbitem.KasDiakui + dbitem.TransferDiakui + dbitem.SolarDiakui + (dbitem.KapalDiakui == null ? 0 : dbitem.KapalDiakui), 0, Repoac_mstr.FindByPk(erpConfig.IdBiayaPerjalanan));   //Biaya

                    //K
                    decimal?tambahanRute  = db.AdminUangJalanTambahanRute.Sum(s => s.values);
                    decimal?boronganDasar = db.TotalBorongan - db.Kawalan - db.Timbangan - db.Karantina - db.SPSI - db.Multidrop - tambahanRute - db.AdminUangJalanTambahanLain.Sum(s => s.Values);
                    Repoglt_det.saveFromAc(1, dbitem.Code, 0, boronganDasar, Repoac_mstr.FindByPk(erpConfig.IdBoronganDasar));
                    Repoglt_det.saveFromAc(2, dbitem.Code, 0, db.Kawalan, Repoac_mstr.FindByPk(erpConfig.IdKawalan));
                    Repoglt_det.saveFromAc(3, dbitem.Code, 0, db.Timbangan, Repoac_mstr.FindByPk(erpConfig.IdTimbangan));
                    Repoglt_det.saveFromAc(4, dbitem.Code, 0, db.Karantina, Repoac_mstr.FindByPk(erpConfig.IdKarantina));
                    Repoglt_det.saveFromAc(5, dbitem.Code, 0, db.SPSI, Repoac_mstr.FindByPk(erpConfig.IdSPSI));
                    Repoglt_det.saveFromAc(6, dbitem.Code, 0, db.Multidrop, Repoac_mstr.FindByPk(erpConfig.IdMultidrop));
                    Repoglt_det.saveFromAc(7, dbitem.Code, 0, tambahanRute, Repoac_mstr.FindByPk(erpConfig.IdTambahanRuteMuat));
                    Repoglt_det.saveFromAc(8, dbitem.Code, 0, db.AdminUangJalanTambahanLain.Sum(s => s.Values), Repoac_mstr.FindByPk(erpConfig.IdTambahanRuteLain));
                    Repoglt_det.saveFromAc(4, dbitem.Code, 0, db.TotalPotonganDriver, Repoac_mstr.FindByPk(erpConfig.IdKasbonAuj)); //Hutang ke Driver, jurnal balik dr auj

                    //Cash&Transfer pada biaya tambahan
                    Repoglt_det.saveFromAc(3, dbitem.Code, dbitem.SettlementRegulerTambahanBiaya.Sum(d => d.Value), 0, Repoac_mstr.FindByPk(erpConfig.IdBiayaPerjalanan)); //D, Biaya Tambahan
                    Repoglt_det.saveFromAc(2, dbitem.Code, 0, dbitem.TotalCash, Repoac_mstr.FindByPk(erpConfig.IdCashCredit));                                             //K, Cash
                    Repoglt_det.saveFromAc(2, dbitem.Code, 0, dbitem.TotalTf, Repoac_mstr.FindByPk(erpConfig.IdTfCredit));                                                 //K, Transfer
                }
                return(RedirectToAction("Index"));
            }

            return(View("Form", model));
        }
Ejemplo n.º 13
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());
        }