/// <summary>
        /// Lay thong tin hanh trinh gia ve
        /// </summary>
        /// <param name="NhaXeId"></param>
        /// <param name="CustomerId"></param>
        /// <param name="XeXuatBenId"></param>
        /// <param name="apiToken"></param>
        /// <returns></returns>
        public ActionResult GetAllHanhTrinhGiaVe(int NhaXeId, int CustomerId, int HanhTrinhId, int XeXuatBenId, string apiToken)
        {
            //kiem tra xac thuc
            string _checkauthentication = isAuthentication(NhaXeId, CustomerId, apiToken, XeXuatBenId);

            if (!String.IsNullOrEmpty(_checkauthentication))
            {
                return(ErrorOccured(_checkauthentication));
            }
            //lay tat ca thong tin phoi ve
            var phoives = _phoiveService.GetPhoiVeByChuyenDi(xexuatben.NguonVeId, xexuatben.NgayDi);
            //lay thong tin hanh trinh
            var hanhtrinhves     = _hanhtrinhService.GetallHanhTrinhGiaVe(HanhTrinhId, NhaXeId);
            var hanhtrinhvesjson = hanhtrinhves.Select(c => new
            {
                Id          = c.Id,
                HanhTrinhId = c.HanhTrinhId,
                DiemDonId   = c.DiemDonId,
                DiemDenId   = c.DiemDenId,
                GiaVe       = Convert.ToInt32(c.GiaVe),
                SoLuong     = phoives.Count(pv => pv.ChangId == c.Id)
            }).ToList();

            return(Successful(hanhtrinhvesjson));
        }
        public ActionResult _GetBangGia(int HanhTrinhId, string NgayDi)
        {
            if (this.CheckNoAccessIntoNhaXe(_workContext, _permissionService, StandardPermissionProvider.CVHoatDongBanVe))
            {
                return(AccessDeniedPartialView());
            }
            if (_workContext.CurrentVanPhong.Id == CommonHelper.VanPhongKhoiTaoId)
            {
                return(AccessDeniedPartialView());
            }
            var model = new BangVeInfoModel();

            model.NgayDi = Convert.ToDateTime(NgayDi);
            var hanhtrinh        = _hanhtrinhService.GetHanhTrinhById(HanhTrinhId);
            var hanhtrinhdiemdon = _hanhtrinhService.GetAllHanhTrinhDiemDonByHanhTrinhId(HanhTrinhId).OrderBy(c => c.ThuTu);
            var diemdonhientai   = new DiemDon();

            if (hanhtrinhdiemdon.Count() > 0)
            {
                diemdonhientai = _hanhtrinhService.GetDiemDonByHanhTrinhDiemDonId(hanhtrinhdiemdon.First().Id);
            }
            else
            {
                return(null);
            }



            model.TenDauTuyen = diemdonhientai.TenDiemDon;
            int     TongVe   = 0;
            decimal TongTien = 0;

            model.HanhTrinhGiaVes = _hanhtrinhService.GetallHanhTrinhGiaVe(HanhTrinhId, 0, diemdonhientai.Id).Select(c =>
            {
                var item = new HanhTrinhGiaVeModel();
                ToHanhTrinhGiaVeModel(c, item);
                item.VeXes = _giaodichkeveService.GetVeXeBanQuayByDay(_workContext.NhaXeId, model.NgayDi, c.Id, 0, _workContext.CurrentNhanVien.Id, c.GiaVe, c.HanhTrinh.isTuyenDi);

                item.SoVeDaBan = item.VeXes.Count();
                TongVe         = TongVe + item.SoVeDaBan;
                TongTien       = TongTien + (item.SoVeDaBan * c.GiaVe);
                for (int k = 0; k < item.SoVeDaBan; k++)
                {
                    if (k == 0)
                    {
                        var vetruoc = _giaodichkeveService.GetVeXeItemById(item.VeXes[k].Id + 1);
                        if (item.VeXes[k].NgayBan.Value.AddMinutes(5) >= DateTime.Now && vetruoc.TrangThai == ENVeXeItemTrangThai.DA_GIAO_HANG)
                        {
                            item.VeXes[k].CanDelete = true;
                        }
                    }
                    else
                    {
                        item.VeXes[k].CanDelete = false;
                    }
                }


                var vechuanbiban = _giaodichkeveService.GetVeChuanBiBanTaiQuay(_workContext.NhaXeId, _workContext.CurrentVanPhong.Id, c.GiaVe, c.HanhTrinh.isTuyenDi);
                if (vechuanbiban != null)
                {
                    item.SoSeriHienTai = vechuanbiban.SoSeri;
                    if (vechuanbiban.quyenve != null)
                    {
                        item.QuyenDangBan = vechuanbiban.quyenve.ThongTin;
                    }
                    else
                    {
                        item.QuyenDangBan = "_________________";
                    }
                }
                else
                {
                    item.IsHetVe      = true;
                    item.QuyenDangBan = "_________________";
                }
                item.SoVeConLai = _giaodichkeveService.CountVeConLaiTaiQuay(_workContext.NhaXeId, _workContext.CurrentVanPhong.Id, c.GiaVe, c.HanhTrinh.isTuyenDi);
                return(item);
            }).ToList();
            model.TongVeDaBan = TongVe;
            model.TongTien    = TongTien.ToTien(_priceFormatter);
            model.SoDiemDon   = model.HanhTrinhGiaVes.Count();
            return(PartialView(model));
        }