コード例 #1
0
ファイル: Dokumen.cs プロジェクト: yudhasatria0808/TMS
 public void setDb(Context.Dokumen dbitem)
 {
     dbitem.Id = Id;
     //dbitem.NoSo = NoSo;
     //dbitem.VehicleNo = VehicleNo;
     //dbitem.Customer = Customer;
 }
コード例 #2
0
        public DokumenIndex(Context.Dokumen dbitem)
        {
            Id      = dbitem.Id;
            IsAdmin = dbitem.IsAdmin;
            Status  = dbitem.IsComplete ? "Close" : "Open";
            if (dbitem.SalesOrder.SalesOrderOncallId.HasValue)
            {
                NoSo        = dbitem.SalesOrder.SalesOrderOncall.SONumber;
                VehicleNo   = dbitem.SalesOrder.SalesOrderOncall.DataTruck == null ? "" : dbitem.SalesOrder.SalesOrderOncall.DataTruck.VehicleNo;
                JnsTruck    = dbitem.SalesOrder.SalesOrderOncall.DataTruck == null ? "" : dbitem.SalesOrder.SalesOrderOncall.DataTruck.JenisTrucks.StrJenisTruck;
                Rute        = dbitem.SalesOrder.SalesOrderOncall.StrDaftarHargaItem;
                TanggalMuat = dbitem.SalesOrder.SalesOrderOncall.TanggalMuat;
                NamaDriver  = dbitem.SalesOrder.SalesOrderOncall.Driver1 == null ? "" : dbitem.SalesOrder.SalesOrderOncall.Driver1.NamaDriver;
                //Customer = dbitem.SalesOrder.SalesOrderOncall.Customer.CustomerNama;
            }
            else if (dbitem.SalesOrder.SalesOrderPickupId.HasValue)
            {
                NoSo        = dbitem.SalesOrder.SalesOrderPickup.SONumber;
                VehicleNo   = dbitem.SalesOrder.SalesOrderPickup.DataTruck.VehicleNo;
                JnsTruck    = dbitem.SalesOrder.SalesOrderPickup.DataTruck.JenisTrucks.StrJenisTruck;
                Rute        = dbitem.SalesOrder.SalesOrderPickup.Rute.Nama;
                TanggalMuat = dbitem.SalesOrder.SalesOrderPickup.TanggalPickup;
                NamaDriver  = dbitem.SalesOrder.SalesOrderPickup.Driver1.NamaDriver;
            }
            else if (dbitem.SalesOrder.SalesOrderProsesKonsolidasiId.HasValue)
            {
                NoSo        = dbitem.SalesOrder.SalesOrderProsesKonsolidasi.SONumber;
                VehicleNo   = dbitem.SalesOrder.SalesOrderProsesKonsolidasi.DataTruck.VehicleNo;
                JnsTruck    = dbitem.SalesOrder.SalesOrderProsesKonsolidasi.DataTruck.JenisTrucks.StrJenisTruck;
                Rute        = dbitem.RuteSo;
                TanggalMuat = dbitem.SalesOrder.SalesOrderProsesKonsolidasi.TanggalMuat;
                NamaDriver  = dbitem.SalesOrder.SalesOrderProsesKonsolidasi.Driver1.NamaDriver;
            }
            else if (dbitem.SalesOrder.SalesOrderKontrakId.HasValue)
            {
                List <int> ListIdDumy = dbitem.ListIdSo.Split(new string[] { "." }, StringSplitOptions.None).ToList().Select(int.Parse).ToList();
                List <Context.SalesOrderKontrakListSo> dbsoDummy = dbitem.SalesOrder.SalesOrderKontrak.SalesOrderKontrakListSo.Where(d => ListIdDumy.Contains(d.Id)).ToList();
                NoSo        = string.Join(", ", dbsoDummy.Select(d => d.NoSo).ToList());
                VehicleNo   = dbsoDummy.FirstOrDefault().DataTruck.VehicleNo;
                JnsTruck    = dbsoDummy.FirstOrDefault().DataTruck.JenisTrucks.StrJenisTruck;
                TanggalMuat = dbsoDummy.FirstOrDefault().MuatDate;
                Customer    = dbitem.SalesOrder.SalesOrderKontrak.Customer.CustomerNama;
                KodeNama    = dbitem.SalesOrder.SalesOrderKontrak.Customer.CustomerCodeOld;
                NamaDriver  = dbsoDummy.FirstOrDefault().Driver1.NamaDriver;
            }

            Customer   = dbitem.Customer.CustomerNama;
            KodeNama   = dbitem.Customer.CustomerCodeOld;
            Delay      = dbitem.DokumenItem.Count() == 0 ? 0 : dbitem.DokumenItem.Where(d => !d.IsLengkap).Count();
            Lengkap    = dbitem.DokumenItem.Count() == 0 ? "Ya" : dbitem.DokumenItem.Any(d => !d.IsLengkap) ? "Tidak" : "Ya";
            LastUpdate = dbitem.ModifiedDate;

            ListDokumen = new List <DokumenItem>();
            foreach (var item in dbitem.DokumenItem)
            {
                ListDokumen.Add(new DokumenItem(item));
            }

            IsReturn = dbitem.IsReturn;
        }
コード例 #3
0
        public ActionResult ShowPrint(int id)
        {
            Context.Dokumen dbitem = RepoDokumen.FindByPK(id);
            DokumenIndex    model  = new DokumenIndex(dbitem);

            ViewBag.TanggalPulang = dbitem.SalesOrder.SalesOrderOncall.TanggalMuat.Value.AddDays(RepoSalesOrder.FindRute(dbitem.SalesOrder.SalesOrderOncall.IdDaftarHargaItem.Value).WaktuKerja);

            return(View("Print", model));
        }
コード例 #4
0
        public ActionResult View(int id, string caller)
        {
            Context.Dokumen dbitem = RepoDokumen.FindByPK(id);
            Dokumen         model  = new Dokumen(dbitem);

            ViewBag.caller = caller;
            if (caller == "admin")
            {
                ViewBag.Title = "Dokumen Admin Surat Jalan";
            }
            else
            {
                ViewBag.Title = "Dokumen Billing";
            }

            return(View("View", model));
        }
コード例 #5
0
        public ActionResult Edit(Dokumen model, string btnSubmit, string caller)
        {
            Context.Dokumen dbitem   = RepoDokumen.FindByPK(model.Id);
            DokumenItem[]   resDok   = JsonConvert.DeserializeObject <DokumenItem[]>(model.strDokumen);
            string          strQuery = "";

            foreach (var item in resDok.Where(d => d.IsEdit))
            {
                item.SetDb(dbitem.DokumenItem.Where(d => d.Id == item.Id).FirstOrDefault());
                dbitem.DokumenItemHistory.Add(item.SetDbHistory(new Context.DokumenItemHistory()));
                strQuery += "INSERT INTO dbo.\"DokumenItemHistory\" (\"IdDok\", \"Nama\", \"Jml\", \"Warna\", \"Stempel\", \"Lengkap\", \"KeteranganAdmin\", \"KeteranganBilling\", \"ModifiedDate\") VALUES (" + dbitem.Id +
                            ", " + item.Nama + ", " + item.Jml + ", " + item.Warna + ", " + item.Stempel + ", " + item.Lengkap + ", " + item.KeteranganAdmin + ", " + item.KeteranganBilling + ", " + dbitem.ModifiedDate + ");";
            }

            if (btnSubmit == "Kirim")
            {
                dbitem.IsAdmin = false;
            }
            else if (btnSubmit == "Submit")
            {
                dbitem.IsAdmin = true;
                if (caller != "Admin")
                {
                    dbitem.IsReturn = true;
                }
            }
            else if (btnSubmit == "Terima")
            {
                //create soship
                string             sod_oid   = Guid.NewGuid().ToString();
                Context.SalesOrder dbso      = dbitem.SalesOrder;
                string             code      = (dbso.SalesOrderOncallId.HasValue ? dbso.SalesOrderOncall.SONumber : dbso.SalesOrderProsesKonsolidasiId.HasValue ? dbso.SalesOrderProsesKonsolidasi.SONumber : dbso.SalesOrderPickupId.HasValue ? dbso.SalesOrderPickup.SONumber : dbso.SalesOrderKontrak.SONumber);
                string             ship_guid = Guid.NewGuid().ToString();
                string             guid;
                string             sod_guid;
                dbitem.IsComplete = true;
                SyncToERP(dbso, sod_oid);
                guid     = Reposo_mstr.FindByPK(code).so_oid;
                sod_guid = Reposo_mstr.FindSoDet(code).so_oid;
                Reposo_mstr.saveSoShipMstr(dbso, UserPrincipal.username, guid, ship_guid);
                Reposo_mstr.saveSoShipDet(dbso, UserPrincipal.username, ship_guid, sod_oid);
            }

            RepoDokumen.save(dbitem, UserPrincipal.id, strQuery);
            return(RedirectToAction("Index", new { caller = caller }));
        }
コード例 #6
0
ファイル: Dokumen.cs プロジェクト: yudhasatria0808/TMS
        public Dokumen(Context.Dokumen dbitem)
        {
            Id           = dbitem.Id;
            IdSalesOrder = dbitem.IdSO;
            if (dbitem.SalesOrder.SalesOrderOncallId.HasValue)
            {
                ModelOncall = new SalesOrderOncall(dbitem.SalesOrder);
            }
            else if (dbitem.SalesOrder.SalesOrderPickupId.HasValue)
            {
                ModelPickup = new SalesOrderPickup(dbitem.SalesOrder);
            }
            else if (dbitem.SalesOrder.SalesOrderProsesKonsolidasiId.HasValue)
            {
                ModelKonsolidasi = new SalesOrderProsesKonsolidasi(dbitem.SalesOrder);
            }
            else if (dbitem.SalesOrder.SalesOrderKontrakId.HasValue)
            {
                List <int> ListIdDumy = dbitem.ListIdSo.Split(new string[] { "." }, StringSplitOptions.None).ToList().Select(int.Parse).ToList();
                List <Context.SalesOrderKontrakListSo> dbsoDummy = dbitem.SalesOrder.SalesOrderKontrak.SalesOrderKontrakListSo.Where(d => ListIdDumy.Contains(d.Id)).ToList();
                dbitem.SalesOrder.SalesOrderKontrak.SalesOrderKontrakListSo = dbsoDummy;

                ModelKontrak = new SalesOrderKontrak(dbitem.SalesOrder);

                ModelKontrak.ListValueModelSOKontrak = ModelKontrak.ListModelSOKontrak;
            }
            ListDokumen = new List <DokumenItem>();
            foreach (var item in dbitem.DokumenItem)
            {
                ListDokumen.Add(new DokumenItem(item));
            }
            ListHistory = new List <DokumenItem>();
            foreach (var item in dbitem.DokumenItemHistory)
            {
                ListHistory.Add(new DokumenItem(item));
            }

            ListIdSo     = dbitem.ListIdSo;
            IsComplete   = dbitem.IsComplete;
            ModifiedDate = dbitem.ModifiedDate;
            IsAdmin      = dbitem.IsAdmin;
        }
コード例 #7
0
        public ActionResult Edit(int id, string caller)
        {
            Context.Dokumen dbitem        = RepoDokumen.FindByPK(id);
            List <int>      ListIdDokumen = dbitem.DokumenItem.Select(b => b.IdBilling).ToList();
            string          strQuery      = "";

            //cek apakah di billing customer ada penambahan data
            //jika ada maka update data jika data dokumen belum close
            if (!dbitem.IsComplete)
            {
                Context.Customer dbcust = dbitem.Customer;
                foreach (var itemBilling in dbitem.Customer.CustomerBilling.Where(i => !ListIdDokumen.Contains(i.Id)).ToList())
                {
                    dbitem.DokumenItem.Add(new Context.DokumenItem()
                    {
                        IdBilling    = itemBilling.Id,
                        CustomerId   = itemBilling.CustomerId,
                        ModifiedDate = DateTime.Now,
                    });
                    strQuery += "INSERT INTO dbo.\"DokumenItem\" (\"IdBilling\", \"CustomerId\", \"ModifiedDate\") VALUES (" + itemBilling.Id + ", " + itemBilling.CustomerId + ", " + DateTime.Now + ");";
                }
                RepoDokumen.save(dbitem, UserPrincipal.id, strQuery);
            }

            if (dbitem.SalesOrder.SalesOrderOncallId.HasValue)
            {
                ViewBag.TanggalPulang = dbitem.SalesOrder.SalesOrderOncall.TanggalMuat.Value.AddDays(RepoSalesOrder.FindRute(dbitem.SalesOrder.SalesOrderOncall.IdDaftarHargaItem.Value).WaktuKerja);
            }
            Dokumen model = new Dokumen(dbitem);

            ViewBag.caller = caller;
            if (caller == "admin")
            {
                ViewBag.Title = "Dokumen Admin Surat Jalan";
            }
            else
            {
                ViewBag.Title = "Dokumen Billing";
            }

            return(View("Form", model));
        }