public IActionResult Costsheet() { if (UserRoles.Contains("Product Accountant")) { } else if (!UserRoles.Contains("Costing Officer")) { return(View("Unauthorize")); } string QRFID = Convert.ToString(Request.Query["QRFId"]); CostsheetViewModel model = new CostsheetViewModel(); model.MenuViewModel.QRFID = QRFID; model.MenuViewModel.MenuName = "Costsheet"; #region Get Costing Officer Tour Info Header By QRFId NewQuoteViewModel modelQuote = new NewQuoteViewModel(); modelQuote.QRFID = QRFID; model.COHeaderViewModel = cOCommonLibrary.GetCOTourInfoHeader(ref modelQuote, token); model.MenuViewModel.EnquiryPipeline = modelQuote.mdlMenuViewModel.EnquiryPipeline; #endregion #region Dropdown Binding QRFDepartureDateGetReq objDepartureDatesReq = new QRFDepartureDateGetReq() { QRFID = QRFID, date = (DateTime?)null }; QRFDepartureDateGetRes objDepartureDatesRes = coProviders.GetDepartureDatesForCostingByQRF_Id(objDepartureDatesReq, token).Result; model.ConsolidatedSummaryViewModel.DepartureDatesList = (objDepartureDatesRes.DepartureDates).Select(a => new AttributeValues { AttributeValue_Id = a.Departure_Id.ToString(), Value = Convert.ToDateTime(a.Date).ToString("dd MMM yy") }).ToList(); #endregion #region Get Costsheet by QRFId CostsheetGetReq request = new CostsheetGetReq(); CostsheetGetRes response = new CostsheetGetRes(); request.QRFID = QRFID; response = coProviders.GetCostsheet(request, token).Result; model.ConsolidatedSummaryViewModel.CostsheetVersion = response.CostsheetVersion; #endregion return(View(model)); }
public IActionResult GetPricingSummary(string QRFID, long filterByDeparture = 0, long filterByPaxSlab = 0) { try { ItineraryViewModel model = new ItineraryViewModel(); long defaultPaxSlabId = 0; #region Dropdown Binding QRFDepartureDateGetReq objDepartureDatesReq = new QRFDepartureDateGetReq() { QRFID = QRFID, date = (DateTime?)null }; QRFDepartureDateGetRes objDepartureDatesRes = coProviders.GetDepartureDatesForCostingByQRF_Id(objDepartureDatesReq, token).Result; QRFPaxSlabGetReq objPaxSlabReq = new QRFPaxSlabGetReq() { QRFID = QRFID }; QRFPaxGetResponse objPaxSlabRes = coProviders.GetPaxSlabDetailsForCostingByQRF_Id(objPaxSlabReq, token).Result; model.PaxSlabList = (objPaxSlabRes.PaxSlabDetails.QRFPaxSlabs).Select(a => new AttributeValues { AttributeValue_Id = a.PaxSlab_Id.ToString(), Value = a.From + "-" + a.To }).ToList(); model.DepartureDatesList = (objDepartureDatesRes.DepartureDates).Select(a => new AttributeValues { AttributeValue_Id = a.Departure_Id.ToString(), Value = Convert.ToDateTime(a.Date).ToString("dd MMM yy") }).ToList(); if (model.PaxSlabList != null && model.PaxSlabList.Count > 0) { defaultPaxSlabId = Convert.ToInt32(model.PaxSlabList[0].AttributeValue_Id); } #endregion #region Get Costsheet by QRFId CostsheetGetReq request = new CostsheetGetReq(); CostsheetGetRes response = new CostsheetGetRes(); request.QRFID = QRFID; request.DepartureId = filterByDeparture == 0 ? objDepartureDatesRes.DepartureDates[0].Departure_Id : filterByDeparture; request.PaxSlabId = filterByPaxSlab == 0 ? defaultPaxSlabId : filterByPaxSlab; response = coProviders.GetCostsheet(request, token).Result; #endregion #region Main Tour Bindings List <QRFPkgAndNonPkgPrice> lstQrfPkg = new List <QRFPkgAndNonPkgPrice>(); foreach (var a in response.QrfPackagePrice.OrderBy(x => x.Age)) { if (lstQrfPkg.Where(x => x.RoomName == a.RoomName && x.Age == a.Age).Count() <= 0) { lstQrfPkg.Add(new QRFPkgAndNonPkgPrice { PaxSlabId = a.PaxSlab_Id, DisplayRoomName = a.RoomName, RoomName = a.RoomName, SellPrice = a.SellPrice, Age = a.Age, QRFCurrency = string.IsNullOrEmpty(a.QRFCurrency) ? "" : a.QRFCurrency.Substring(0, 3).ToUpper() }); } } #region Sequencewise sorting and Sell Price Calculation foreach (var l in lstQrfPkg.OrderBy(x => x.Age)) { double singleSellPrice = response.QrfPackagePrice.Where(x => x.RoomName.ToUpper() == "SINGLE" && x.PaxSlab_Id == l.PaxSlabId).Select(y => y.SellPrice).FirstOrDefault(); double doubleSellPrice = response.QrfPackagePrice.Where(x => x.RoomName.ToUpper() == "DOUBLE" && x.PaxSlab_Id == l.PaxSlabId).Select(y => y.SellPrice).FirstOrDefault(); double twinSellPrice = response.QrfPackagePrice.Where(x => x.RoomName.ToUpper() == "TWIN" && x.PaxSlab_Id == l.PaxSlabId).Select(y => y.SellPrice).FirstOrDefault(); double tripleSellPrice = response.QrfPackagePrice.Where(x => x.RoomName.ToUpper() == "TRIPLE" && x.PaxSlab_Id == l.PaxSlabId).Select(y => y.SellPrice).FirstOrDefault(); if (l.RoomName.ToUpper() == "TWIN") { l.SequenceNo = 1; } else if (l.RoomName.ToUpper() == "DOUBLE") { l.SequenceNo = 2; } else if (l.RoomName.ToUpper() == "SINGLE") { if (l.DisplayRoomName == "SINGLE") { l.DisplayRoomName = "SGL SUPPLEMENT"; } var price = twinSellPrice != 0 ? twinSellPrice : doubleSellPrice; l.SellPrice = singleSellPrice != 0 ? singleSellPrice - price : singleSellPrice; l.SequenceNo = 3; } else if (l.RoomName.ToUpper() == "TRIPLE") { if (l.DisplayRoomName == "TRIPLE") { l.DisplayRoomName = "TPL REDUCTION"; } var price = twinSellPrice != 0 ? twinSellPrice : doubleSellPrice; l.SellPrice = tripleSellPrice != 0 ? price - tripleSellPrice : tripleSellPrice; l.SequenceNo = 4; } else if (l.RoomName.ToUpper() == "CHILDWITHBED") { if (l.DisplayRoomName.Contains("CHILDWITHBED")) { string roomname = l.DisplayRoomName; l.DisplayRoomName = Regex.Replace(roomname, "CHILDWITHBED", "C + B") + " Age : " + l.Age; } l.SequenceNo = 5; } else if (l.RoomName.ToUpper() == "CHILDWITHOUTBED") { if (l.DisplayRoomName.Contains("CHILDWITHOUTBED")) { string roomname = l.DisplayRoomName; l.DisplayRoomName = Regex.Replace(roomname, "CHILDWITHOUTBED", "C - B") + " Age : " + l.Age; } l.SequenceNo = 6; } else if (l.RoomName.ToUpper() == "INFANT") { l.SequenceNo = 100; } else { l.SequenceNo = 80; } } #endregion #endregion #region Supplement Bindings List <QRFPkgAndNonPkgPrice> lstSupplementHeaders = new List <QRFPkgAndNonPkgPrice>(); List <QRFPkgAndNonPkgPrice> lstSupplements = new List <QRFPkgAndNonPkgPrice>(); foreach (var a in response.QrfNonPackagePrice) { if (a.PositionKeepAs.ToUpper() == "SUPPLEMENT") { if (lstSupplementHeaders.Where(x => x.PositionId == a.PositionId).Count() <= 0) { lstSupplementHeaders.Add(new QRFPkgAndNonPkgPrice { PaxSlabId = a.PaxSlab_Id, PaxSlab = a.PaxSlab, SellPrice = a.SellPrice, RoomName = a.RoomName, PositionKeepAs = a.PositionKeepAs, PositionType = a.PositionType, PositionId = a.PositionId, ProductName = a.ProductName, QRFCurrency = string.IsNullOrEmpty(a.QRFCurrency) ? "" : a.QRFCurrency.Substring(0, 3).ToUpper() }); } } } foreach (var a in response.QrfNonPackagePrice) { if (a.PositionKeepAs.ToUpper() == "SUPPLEMENT") { lstSupplements.Add(new QRFPkgAndNonPkgPrice { PaxSlabId = a.PaxSlab_Id, PaxSlab = a.PaxSlab, SellPrice = a.SellPrice, RoomName = a.RoomName, Age = a.Age, PositionKeepAs = a.PositionKeepAs, PositionType = a.PositionType, PositionId = a.PositionId, ProductName = a.ProductName, QRFCurrency = string.IsNullOrEmpty(a.QRFCurrency) ? "" : a.QRFCurrency.Substring(0, 3).ToUpper() }); } } model.SupplementProductList = GetProductsForSupplement(lstSupplementHeaders); #endregion #region Optional Bindings List <QRFPkgAndNonPkgPrice> lstOptionalHeaders = new List <QRFPkgAndNonPkgPrice>(); List <QRFPkgAndNonPkgPrice> lstOptionals = new List <QRFPkgAndNonPkgPrice>(); foreach (var a in response.QrfNonPackagePrice) { if (a.PositionKeepAs.ToUpper() == "OPTIONAL") { if (lstOptionalHeaders.Where(x => x.PositionId == a.PositionId).Count() <= 0) { lstOptionalHeaders.Add(new QRFPkgAndNonPkgPrice { PaxSlabId = a.PaxSlab_Id, PaxSlab = a.PaxSlab, SellPrice = a.SellPrice, RoomName = a.RoomName, PositionKeepAs = a.PositionKeepAs, PositionType = a.PositionType, PositionId = a.PositionId, ProductName = a.ProductName, QRFCurrency = a.QRFCurrency.Substring(0, 3).ToUpper() }); } } } foreach (var a in response.QrfNonPackagePrice) { if (a.PositionKeepAs.ToUpper() == "OPTIONAL") { lstOptionals.Add(new QRFPkgAndNonPkgPrice { PaxSlabId = a.PaxSlab_Id, PaxSlab = a.PaxSlab, SellPrice = a.SellPrice, RoomName = a.RoomName, Age = a.Age, PositionKeepAs = a.PositionKeepAs, PositionType = a.PositionType, PositionId = a.PositionId, ProductName = a.ProductName, QRFCurrency = a.QRFCurrency.Substring(0, 3).ToUpper() }); } } model.OptionalProductList = GetProductsForOptional(lstOptionalHeaders); #endregion model.MainTourList = lstQrfPkg.OrderBy(x => x.SequenceNo).ToList(); model.QRFNonPkgSupplementPositions = lstSupplementHeaders; model.SupplementList = lstSupplements; model.QRFNonPkgOptionalPositions = lstOptionalHeaders; model.OptionalList = lstOptionals; model.DepartureDate = filterByDeparture; model.PaxSlab = filterByPaxSlab; return(PartialView("_PricingSummary", model)); } catch (Exception ex) { throw; return(View()); } }
public bool GetProposalPriceBreakupByQRFId(IConfiguration _configuration, string token, ref ProposalViewModel model, string QRFID) { #region Get Costsheet by QRFId CostsheetGetReq request = new CostsheetGetReq(); CostsheetGetRes response = new CostsheetGetRes(); request.QRFID = QRFID; //request.DepartureId = filterByDeparture == 0 ? objDepartureDatesRes.DepartureDates[0].Departure_Id : filterByDeparture; response = coProviders.GetCostsheet(request, token).Result; #endregion #region Price breakup data binding List <QRFPkgAndNonPkgPrice> lstDepartureDates = new List <QRFPkgAndNonPkgPrice>(); List <QRFPkgAndNonPkgPrice> lstTwinPkg = new List <QRFPkgAndNonPkgPrice>(); List <QRFPkgAndNonPkgPrice> lstDoublePkg = new List <QRFPkgAndNonPkgPrice>(); List <QRFPkgAndNonPkgPrice> lstSinglePkg = new List <QRFPkgAndNonPkgPrice>(); List <QRFPkgAndNonPkgPrice> lstPositionTypeSupplement = new List <QRFPkgAndNonPkgPrice>(); List <QRFPkgAndNonPkgPrice> lstPositionTypeOptional = new List <QRFPkgAndNonPkgPrice>(); List <QRFPkgAndNonPkgPrice> lstNonPkgSupplement = new List <QRFPkgAndNonPkgPrice>(); List <QRFPkgAndNonPkgPrice> lstNonPkgOptional = new List <QRFPkgAndNonPkgPrice>(); foreach (var date in response.QrfPackagePrice) { if (lstDepartureDates.Where(x => x.DepartureId == date.Departure_Id).Count() <= 0) { lstDepartureDates.Add(new QRFPkgAndNonPkgPrice { DepartureDate = date.DepartureDate, DepartureId = date.Departure_Id, PaxSlabId = date.PaxSlab_Id, PaxSlab = date.PaxSlab }); } } var twinrooms = new List <mQRFPackagePrice>(); var doublerooms = new List <mQRFPackagePrice>(); var singlerooms = new List <mQRFPackagePrice>(); twinrooms = response.QrfPackagePrice.Where(x => x.RoomName.ToUpper() == "TWIN").ToList(); if (twinrooms.Count() <= 0) { doublerooms = response.QrfPackagePrice.Where(x => x.RoomName.ToUpper() == "DOUBLE").ToList(); if (doublerooms.Count() <= 0) { singlerooms = response.QrfPackagePrice.Where(x => x.RoomName.ToUpper() == "SINGLE").ToList(); } } if (twinrooms.Count() > 0) { foreach (var pkg in twinrooms) { lstTwinPkg.Add(new QRFPkgAndNonPkgPrice { SellPrice = pkg.SellPrice, QRFCurrency = pkg.QRFCurrency.Substring(0, 3).ToUpper(), PaxSlabId = pkg.PaxSlab_Id, PaxSlab = pkg.PaxSlab, RoomName = pkg.RoomName, DepartureDate = pkg.DepartureDate, DepartureId = pkg.Departure_Id }); } } if (doublerooms.Count() > 0) { foreach (var pkg in doublerooms) { lstDoublePkg.Add(new QRFPkgAndNonPkgPrice { SellPrice = pkg.SellPrice, QRFCurrency = pkg.QRFCurrency.Substring(0, 3).ToUpper(), PaxSlabId = pkg.PaxSlab_Id, PaxSlab = pkg.PaxSlab, RoomName = pkg.RoomName, DepartureDate = pkg.DepartureDate, DepartureId = pkg.Departure_Id }); } } if (singlerooms.Count() > 0) { foreach (var pkg in singlerooms) { lstSinglePkg.Add(new QRFPkgAndNonPkgPrice { SellPrice = pkg.SellPrice, QRFCurrency = pkg.QRFCurrency.Substring(0, 3).ToUpper(), PaxSlabId = pkg.PaxSlab_Id, PaxSlab = pkg.PaxSlab, RoomName = pkg.RoomName, DepartureDate = pkg.DepartureDate, DepartureId = pkg.Departure_Id }); } } //#region QRFNonPkgPrice Position Bindings //foreach (var a in response.QrfNonPackagePrice.Where(x => x.PositionKeepAs.ToUpper() == "SUPPLEMENT")) //{ // if (lstPositionTypeSupplement.Where(x => x.PositionId == a.PositionId).Count() <= 0) // { // lstPositionTypeSupplement.Add(new QRFPkgAndNonPkgPrice { PaxSlabId = a.PaxSlab_Id, PaxSlab = a.PaxSlab, SellPrice = a.SellPrice, RoomName = a.RoomName, PositionKeepAs = a.PositionKeepAs, PositionType = a.PositionType, PositionId = a.PositionId, ProductName = a.ProductName, DepartureDate = a.DepartureDate, DepartureId = a.Departure_Id }); // } //} //foreach (var a in response.QrfNonPackagePrice.Where(x => x.PositionKeepAs.ToUpper() == "OPTIONAL")) //{ // if (lstPositionTypeOptional.Where(x => x.PositionId == a.PositionId).Count() <= 0) // { // lstPositionTypeOptional.Add(new QRFPkgAndNonPkgPrice { PaxSlabId = a.PaxSlab_Id, PaxSlab = a.PaxSlab, SellPrice = a.SellPrice, RoomName = a.RoomName, PositionKeepAs = a.PositionKeepAs, PositionType = a.PositionType, PositionId = a.PositionId, ProductName = a.ProductName, DepartureDate = a.DepartureDate, DepartureId = a.Departure_Id }); // } //} //#endregion foreach (var nonpkg in response.QrfNonPackagePrice) { if (nonpkg.RoomName.ToUpper() == "ADULT" && nonpkg.PositionKeepAs.ToUpper() == "SUPPLEMENT") { lstNonPkgSupplement.Add(new QRFPkgAndNonPkgPrice { SellPrice = nonpkg.SellPrice, QRFCurrency = nonpkg.QRFCurrency.Substring(0, 3).ToUpper(), PaxSlabId = nonpkg.PaxSlab_Id, PaxSlab = nonpkg.PaxSlab, RoomName = nonpkg.RoomName, DepartureDate = nonpkg.DepartureDate, DepartureId = nonpkg.Departure_Id, PositionId = nonpkg.PositionId, PositionType = nonpkg.PositionType, ProductName = nonpkg.ProductName }); } } foreach (var nonpkg in response.QrfNonPackagePrice) { if (nonpkg.RoomName.ToUpper() == "ADULT" && nonpkg.PositionKeepAs.ToUpper() == "OPTIONAL") { lstNonPkgOptional.Add(new QRFPkgAndNonPkgPrice { SellPrice = nonpkg.SellPrice, QRFCurrency = nonpkg.QRFCurrency.Substring(0, 3).ToUpper(), PaxSlabId = nonpkg.PaxSlab_Id, PaxSlab = nonpkg.PaxSlab, RoomName = nonpkg.RoomName, DepartureDate = nonpkg.DepartureDate, DepartureId = nonpkg.Departure_Id, PositionId = nonpkg.PositionId, PositionType = nonpkg.PositionType, ProductName = nonpkg.ProductName }); } } model.ProposalPriceBreakupViewModel.DepartureDatesList = lstDepartureDates.OrderBy(x => x.DepartureDate).ToList(); model.ProposalPriceBreakupViewModel.QrfTwinPkgPriceList = lstTwinPkg; model.ProposalPriceBreakupViewModel.QrfDoublePkgPriceList = lstDoublePkg; model.ProposalPriceBreakupViewModel.QrfSinglePkgPriceList = lstSinglePkg; //model.ProposalPriceBreakupViewModel.QRFNonPkgSupplementPositions = lstPositionTypeSupplement; //model.ProposalPriceBreakupViewModel.QRFNonPkgOptionalPositions = lstPositionTypeOptional; model.ProposalPriceBreakupViewModel.QrfNonPkgPriceSupplementList = lstNonPkgSupplement; model.ProposalPriceBreakupViewModel.QrfNonPkgPriceOptionalList = lstNonPkgOptional; #region Get Costing Officer Tour Info Header By QRFId NewQuoteViewModel modelQuote = new NewQuoteViewModel(); modelQuote.QRFID = QRFID; model.ProposalPriceBreakupViewModel.COHeaderViewModel = cOCommonLibrary.GetCOTourInfoHeader(ref modelQuote, token); #endregion #region Get Hotel Summary details from Itinerary ProposalGetReq req = new ProposalGetReq(); ProposalGetRes res = new ProposalGetRes(); req.QRFID = model.QRFID; res = coProviders.GetHotelSummaryByQrfId(req, token).Result; var hotellist = res.Hotels; model.ProposalPriceBreakupViewModel.HotelList = hotellist.Select(x => new Hotel { HotelName = x.HotelName, Location = string.IsNullOrWhiteSpace(x.Location) ? "" : x.Location.Split(',')[0], Stars = x.Stars, Duration = x.Duration }).ToList(); #endregion #endregion return(true); }