public IActionResult GetDetailedInfo(string QRFID, long filterByDeparture = 0) { DetailedInfoViewModel model = new DetailedInfoViewModel(); #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; GuesstimateGetReq request = new GuesstimateGetReq() { QRFID = QRFID }; GuesstimateGetRes response = coProviders.GetGuesstimate(request, token).Result; model.ProductNameList = GetProductNamesFromGuesstimate(response.Guesstimate.GuesstimatePosition); model.SupplierList = GetSuppliersFromGuesstimate(response.Guesstimate.GuesstimatePosition); model.ProductTypeList = GetProductTypesFromGuesstimate(response.Guesstimate.GuesstimatePosition); model.DepartureDatesList = (objDepartureDatesRes.DepartureDates).Select(a => new AttributeValues { AttributeValue_Id = a.Departure_Id.ToString(), Value = Convert.ToDateTime(a.Date).ToString("dd MMM yy") }).ToList(); model.PaxSlabList = (objPaxSlabRes.PaxSlabDetails.QRFPaxSlabs).Select(a => new AttributeValues { AttributeValue_Id = a.PaxSlab_Id.ToString(), Value = a.From + "-" + a.To }).ToList(); #endregion return(PartialView("_DetailedInfo", model)); }
public async Task <QRFDepartureDateGetRes> GetDepartureDatesForCostingByQRF_Id(QRFDepartureDateGetReq objDepartureDateRequest, string ticket) { QRFDepartureDateGetRes objDepartureDateResponse = new QRFDepartureDateGetRes(); objDepartureDateResponse = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceCommon:GetDepartureDates"), objDepartureDateRequest, typeof(QRFDepartureDateGetRes), ticket); return(objDepartureDateResponse); }
public QRFDepartureDateGetRes GetDepartureDatesForCostingByQRF_Id([FromBody] QRFDepartureDateGetReq request) { var response = new QRFDepartureDateGetRes(); if (request != null) { var res = _costingRepository.GetDepartureDatesForCostingByQRF_Id(request); return(res); } else { response.Status = "Primary key is blank"; return(response); } }
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 GetSupplierPrice(string QRFID, long DepartureId = 0, long PaxSlabId = 0, string PositionId = null, string SupplierId = null) { try { #region Get Guesstimate by QRFId GuesstimateGetRes response = new GuesstimateGetRes(); GuesstimateGetReq request = new GuesstimateGetReq(); request.QRFID = QRFID; request.DepartureId = DepartureId; request.PaxSlabId = PaxSlabId; request.PositionId = PositionId; request.SupplierId = SupplierId; request.LoginUserId = ckUserEmailId; if (DepartureId == 0) { QRFDepartureDateGetReq objDepartureDatesReq = new QRFDepartureDateGetReq() { QRFID = QRFID, date = (DateTime?)null }; QRFDepartureDateGetRes objDepartureDatesRes = coProviders.GetDepartureDatesForCostingByQRF_Id(objDepartureDatesReq, token).Result; request.DepartureId = objDepartureDatesRes.DepartureDates[0].Departure_Id; } if (PaxSlabId == 0) { QRFPaxSlabGetReq objPaxSlabReq = new QRFPaxSlabGetReq() { QRFID = QRFID }; QRFPaxGetResponse objPaxSlabRes = coProviders.GetPaxSlabDetailsForCostingByQRF_Id(objPaxSlabReq, token).Result; request.PaxSlabId = objPaxSlabRes.PaxSlabDetails.QRFPaxSlabs[0].PaxSlab_Id; } response = coProviders.GetSupplierPrice(request, token).Result; #endregion return(Json(response)); } catch (Exception ex) { return(View()); } }
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 QRFDepartureDateGetRes GetDepartureDatesForCostingByQRF_Id(QRFDepartureDateGetReq req) { var response = new QRFDepartureDateGetRes(); try { var filters = Builders <mQRFPrice> .Filter.Where(x => x.QRFID == req.QRFID); if (_MongoContext.mQRFPrice.Find(filters).Count() > 0) { if (req.date == null) { var res = from m in _MongoContext.mQRFPrice.AsQueryable() where m.QRFID == req.QRFID select new QRFDepartureDateGetRes { DepartureDates = m.Departures }; response.DepartureDates = res.First().DepartureDates.Where(x => x.IsDeleted == false).ToList(); if (response.DepartureDates.Count() > 0) { response.Status = "Success"; } else { response.Status = "No Departures Found"; } } else { var WarnMessage = GetWarning(req.date); var departure = new QRFDepartureDates { Date = req.date, Warning = Convert.ToString(WarnMessage) }; response.DepartureDates.Add(departure); response.Status = "Success"; } } else { if (req.date != null) { var WarnMessage = GetWarning(req.date); var departure = new QRFDepartureDates { Date = req.date, Warning = Convert.ToString(WarnMessage) }; response.DepartureDates.Add(departure); response.Status = "Success"; } else { response.Status = "Invalid Qrf"; } } } catch (Exception ex) { Console.WriteLine(ex.Message); response.Status = "Exception Occured"; } return(response); }
public IActionResult GetConsolidatedSummary(string QRFID, long filterByDeparture = 0, string SuccessMessage = null, string ErrorMessage = null) { if (!(string.IsNullOrEmpty(SuccessMessage))) { TempData["success"] = SuccessMessage; } if (!(string.IsNullOrEmpty(ErrorMessage))) { TempData["error"] = ErrorMessage; } ConsolidatedSummaryViewModel model = new ConsolidatedSummaryViewModel(); #region Dropdown Binding QRFDepartureDateGetReq objDepartureDatesReq = new QRFDepartureDateGetReq() { QRFID = QRFID, date = (DateTime?)null }; QRFDepartureDateGetRes objDepartureDatesRes = coProviders.GetDepartureDatesForCostingByQRF_Id(objDepartureDatesReq, token).Result; model.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; request.DepartureId = filterByDeparture == 0 ? objDepartureDatesRes.DepartureDates[0].Departure_Id : filterByDeparture; response = coProviders.GetCostsheet(request, token).Result; model.CostsheetVersion = response.CostsheetVersion; #region Get currency list SalesProviders objSalesProvider = new SalesProviders(_configuration); CurrencyResponse objCurrencyResponse = objSalesProvider.GetCurrencyList(token).Result; List <Currency> CurrencyList = objCurrencyResponse.CurrencyList; #endregion #endregion #region Header Binding List <QRFPkgAndNonPkgPrice> lstHeaders = new List <QRFPkgAndNonPkgPrice>(); foreach (var a in response.QrfPackagePrice.OrderBy(x => x.Age)) { if (lstHeaders.Where(x => x.RoomName == a.RoomName && x.Age == a.Age).Count() <= 0) { var qrfCurrency = CurrencyList.Where(x => x.CurrencyId == a.QRFCurrency_Id).Select(x => x.CurrencyCode).FirstOrDefault(); if (!string.IsNullOrEmpty(qrfCurrency)) { qrfCurrency = qrfCurrency.ToUpper(); } lstHeaders.Add(new QRFPkgAndNonPkgPrice { PaxSlabId = a.PaxSlab_Id, DisplayRoomName = a.RoomName, RoomName = a.RoomName, Age = a.Age, QRFCurrency = qrfCurrency, DepartureDate = a.DepartureDate, DepartureId = a.Departure_Id }); } } if (lstHeaders.Count == 0) { foreach (var a in response.QrfNonPackagePrice.OrderBy(x => x.Age)) { if (lstHeaders.Where(x => x.RoomName == a.RoomName && x.Age == a.Age).Count() <= 0) { var qrfCurrency = CurrencyList.Where(x => x.CurrencyId == a.QRFCurrency_Id).Select(x => x.CurrencyCode).FirstOrDefault().ToUpper(); if (!string.IsNullOrEmpty(qrfCurrency)) { qrfCurrency = qrfCurrency.ToUpper(); } lstHeaders.Add(new QRFPkgAndNonPkgPrice { PaxSlabId = a.PaxSlab_Id, DisplayRoomName = a.RoomName, RoomName = a.RoomName, Age = a.Age, QRFCurrency = qrfCurrency, DepartureDate = a.DepartureDate, DepartureId = a.Departure_Id, Type = a.RoomName }); } } } foreach (var k in lstHeaders) { if (k.DisplayRoomName == "SINGLE") { k.DisplayRoomName = "SGL SUPPLEMENT"; } if (k.DisplayRoomName == "TRIPLE") { k.DisplayRoomName = "TPL REDUCTION"; } if (k.DisplayRoomName.Contains("CHILDWITHBED")) { string roomname = k.DisplayRoomName; k.DisplayRoomName = Regex.Replace(roomname, "CHILDWITHBED", "C + B") + " Age : " + k.Age; } if (k.DisplayRoomName.Contains("CHILDWITHOUTBED")) { string roomname = k.DisplayRoomName; k.DisplayRoomName = Regex.Replace(roomname, "CHILDWITHOUTBED", "C - B") + " Age : " + k.Age; } } #region Sequencewise sorting foreach (var l in lstHeaders) { if (l.RoomName.ToUpper() == "TWIN") { l.SequenceNo = 1; l.Type = "ADULT"; } else if (l.RoomName.ToUpper() == "DOUBLE") { l.SequenceNo = 2; l.Type = "ADULT"; } else if (l.RoomName.ToUpper() == "SINGLE") { l.SequenceNo = 3; l.Type = "ADULT"; } else if (l.RoomName.ToUpper() == "TRIPLE") { l.SequenceNo = 4; l.Type = "ADULT"; } else if (l.RoomName.ToUpper() == "CHILDWITHBED") { l.SequenceNo = 5; } else if (l.RoomName.ToUpper() == "CHILDWITHOUTBED") { l.SequenceNo = 6; } else if (l.RoomName.ToUpper() == "INFANT") { l.SequenceNo = 100; } else { l.SequenceNo = 80; } } #endregion model.HeaderList = lstHeaders.OrderBy(x => x.SequenceNo).ToList(); #endregion #region Data binding List <QRFPkgAndNonPkgPrice> lstPrice = new List <QRFPkgAndNonPkgPrice>(); List <QRFPkgAndNonPkgPrice> lstPriceData = new List <QRFPkgAndNonPkgPrice>(); List <QRFPkgAndNonPkgPrice> lstSupplements = new List <QRFPkgAndNonPkgPrice>(); List <QRFPkgAndNonPkgPrice> lstOptionals = new List <QRFPkgAndNonPkgPrice>(); List <QRFPkgAndNonPkgPrice> lstPositionTypeSupplement = new List <QRFPkgAndNonPkgPrice>(); List <QRFPkgAndNonPkgPrice> lstPositionTypeOptional = new List <QRFPkgAndNonPkgPrice>(); List <QRFPkgAndNonPkgPrice> lstSupplementPaxSlabs = new List <QRFPkgAndNonPkgPrice>(); List <QRFPkgAndNonPkgPrice> lstOptionalPaxSlabs = new List <QRFPkgAndNonPkgPrice>(); List <QRFPkgAndNonPkgPrice> lstQRFPkgPricePositionTotalCost = new List <QRFPkgAndNonPkgPrice>(); List <QRFPkgAndNonPkgPrice> lstNonQRFPkgPricePositionTotalCost = new List <QRFPkgAndNonPkgPrice>(); #region QRFPkgPrice Postion Bindings #region Paxslab and FOC binding (1st/2nd column) foreach (var a in response.QrfPackagePrice) { if (lstPrice.Where(x => x.PaxSlabId == a.PaxSlab_Id).Count() <= 0) { lstPrice.Add(new QRFPkgAndNonPkgPrice { PaxSlabId = a.PaxSlab_Id, PaxSlab = a.PaxSlab, SellPrice = a.SellPrice, RoomName = a.RoomName }); } } foreach (var pax in lstPrice) { var focPrice = new QRFPkgAndNonPkgPrice(); foreach (var f in response.QRFSalesFOC) { if (pax.PaxSlabId == f.PaxSlabId) { string foc1; StringBuilder str = new StringBuilder(); if (f.FOCSingle > 0) { str.Append(f.FOCSingle + " SINGLE"); } if (f.FOCDouble > 0) { if (f.FOCSingle > 0) { str.Append(" + "); } str.Append(f.FOCDouble + " DOUBLE"); } if (f.FOCTwin > 0) { if (f.FOCDouble > 0 || f.FOCSingle > 0) { str.Append(" + "); } str.Append(f.FOCTwin + " TWIN"); } if (f.FOCTriple > 0) { if (f.FOCTwin > 0 || f.FOCDouble > 0 || f.FOCSingle > 0) { str.Append(" + "); } str.Append(f.FOCTriple + " TRIPLE"); } foc1 = str.ToString(); focPrice.focValue = foc1; focPrice.PaxSlabId = f.PaxSlabId; lstQRFPkgPricePositionTotalCost.Add(focPrice); lstNonQRFPkgPricePositionTotalCost.Add(focPrice); } } } #endregion #region Roomdetails binding foreach (var a in response.QrfPackagePrice) { foreach (var k in lstPrice) { double singleSellPrice = response.QrfPackagePrice.Where(x => x.RoomName.ToUpper() == "SINGLE" && x.PaxSlab_Id == k.PaxSlabId).Select(y => y.SellPrice).FirstOrDefault(); double doubleSellPrice = response.QrfPackagePrice.Where(x => x.RoomName.ToUpper() == "DOUBLE" && x.PaxSlab_Id == k.PaxSlabId).Select(y => y.SellPrice).FirstOrDefault(); double twinSellPrice = response.QrfPackagePrice.Where(x => x.RoomName.ToUpper() == "TWIN" && x.PaxSlab_Id == k.PaxSlabId).Select(y => y.SellPrice).FirstOrDefault(); double tripleSellPrice = response.QrfPackagePrice.Where(x => x.RoomName.ToUpper() == "TRIPLE" && x.PaxSlab_Id == k.PaxSlabId).Select(y => y.SellPrice).FirstOrDefault(); if (k.PaxSlabId == a.PaxSlab_Id && a.RoomName.ToUpper() == "SINGLE") { var price = twinSellPrice != 0 ? twinSellPrice : doubleSellPrice; a.SellPrice = singleSellPrice != 0 ? singleSellPrice - price : singleSellPrice; } if (k.PaxSlabId == a.PaxSlab_Id && a.RoomName.ToUpper() == "TRIPLE") { var price = twinSellPrice != 0 ? twinSellPrice : doubleSellPrice; a.SellPrice = tripleSellPrice != 0 ? price - tripleSellPrice : tripleSellPrice; } } lstPriceData.Add(new QRFPkgAndNonPkgPrice { PaxSlabId = a.PaxSlab_Id, PaxSlab = a.PaxSlab, SellPrice = a.SellPrice, RoomName = a.RoomName, Age = a.Age }); } model.QRFPackagePriceList = lstPrice; model.QRFPkgPositionTotalCost = lstQRFPkgPricePositionTotalCost; model.QRFPackagePriceDataList = lstPriceData; #endregion #endregion #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 }); } } 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 }); } } model.QRFNonPkgSupplementPositions = lstPositionTypeSupplement; model.QRFNonPkgOptionalPositions = lstPositionTypeOptional; #endregion #region QRFNonPkgPrice Paxslab & FOC binding (1st/2nd column) foreach (var a in response.QrfNonPackagePrice) { if (a.PositionKeepAs.ToUpper() == "SUPPLEMENT") { if (lstSupplementPaxSlabs.Where(x => x.PaxSlabId == a.PaxSlab_Id).Count() <= 0) { lstSupplementPaxSlabs.Add(new QRFPkgAndNonPkgPrice { PaxSlabId = a.PaxSlab_Id, PaxSlab = a.PaxSlab, SellPrice = a.SellPrice, RoomName = a.RoomName, Age = a.Age, ProductName = a.ProductName }); } } } foreach (var a in response.QrfNonPackagePrice) { if (a.PositionKeepAs.ToUpper() == "OPTIONAL") { if (lstOptionalPaxSlabs.Where(x => x.PaxSlabId == a.PaxSlab_Id).Count() <= 0) { lstOptionalPaxSlabs.Add(new QRFPkgAndNonPkgPrice { PaxSlabId = a.PaxSlab_Id, PaxSlab = a.PaxSlab, SellPrice = a.SellPrice, RoomName = a.RoomName, Age = a.Age, ProductName = a.ProductName }); } } } //foreach (var p in response.QRFPositionTotalCost) //{ //lstNonQRFPkgPricePositionTotalCost.Add(new QRFPkgAndNonPkgPrice { PaxSlabId = p.PaxSlab_Id, PaxSlab = p.PaxSlab, TotalSellPriceForFOC = p.FOCInBuyCurrency, PositionId = p.PositionId }); //} model.QRFNonPkgPositionTotalCost = lstNonQRFPkgPricePositionTotalCost; model.QRFNonPkgPriceSupplementPaxSlabs = lstSupplementPaxSlabs; model.QRFNonPkgPriceOptionalPaxSlabs = lstOptionalPaxSlabs; #endregion #region Roomdetails binding 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 }); } } 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 }); } } model.QRFNonPackagePriceSupplementList = lstSupplements; model.QRFNonPackagePriceOptionalList = lstOptionals; #endregion model.DepartureDate = filterByDeparture.ToString(); #endregion return(PartialView("_ConsolidatedSummary", model)); }
public IActionResult GetCommercialsData(string QRFID, string EnquiryPipeline = "", long filterByDeparture = 0, long filterByPaxSlab = 0) { CommercialsViewModel model = new CommercialsViewModel(); model.MenuViewModel.QRFID = QRFID; model.MenuViewModel.EnquiryPipeline = EnquiryPipeline; #region Dropdown Binding //NewQuoteViewModel modelQuote = new NewQuoteViewModel(); //bool GetStatus = false; //SalesQuoteLibrary quoteLibrary = new SalesQuoteLibrary(_configuration); //if (Convert.ToInt32(QRFId) > 0) //{ // modelQuote.QRFID = QRFID; // GetStatus = quoteLibrary.GetQRFPaxSlabDetails(_configuration, token, ref modelQuote); //} //SalesProviders objSalesProvider = new SalesProviders(_configuration); //DepartureDateGetRequest objDepartureDatesReq = new DepartureDateGetRequest() { QRF_Id = QRFId, date = (DateTime?)null }; //DepartureDateGetResponse objDepartureDatesRes = objSalesProvider.GetDepartureDatesForQRFId(objDepartureDatesReq, token).Result; //model.PaxSlabList = (modelQuote.mdlQuotePaxRangeViewModel.QuotePaxSlabDetails).Select(a => new AttributeValues { AttributeValue_Id = a.PaxSlabId.ToString(), Value = a.PaxSlabFrom + "-" + a.PaxSlabTo }).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(); ////long defaultPaxSlabId = Convert.ToInt32(model.PaxSlabList[0].AttributeValue_Id); 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(); model.CurrentDate = DateTime.Now.ToString("dd MMM yyyy"); string username = ""; IRequestCookieCollection objCookies = HttpContext.Request.Cookies; username = HttpContext.Request.Cookies["UserName"] ?? ckUserName; model.UserName = username; #endregion #region Get Commercial data CommercialsGetRes response = new CommercialsGetRes(); CommercialsGetReq request = new CommercialsGetReq(); request.QRFID = QRFID; request.DepartureId = filterByDeparture == 0 ? objDepartureDatesRes.DepartureDates[0].Departure_Id : filterByDeparture; request.PaxSlabId = filterByPaxSlab == 0 ? objPaxSlabRes.PaxSlabDetails.QRFPaxSlabs[0].PaxSlab_Id : filterByPaxSlab; response = coProviders.GetCommercials(request, token).Result; model.QRFID = response.QRFID; model.QRFPriceId = response.QRFPriceId; model.PercentSoldOptional = response.PercentSoldOptional; model.BareBoneList = response.BareBoneList; model.QRFExhangeRates = response.QRFExhangeRates; string PositionType = ""; foreach (var item in response.PositionIncluded) { if (item.PositionType != PositionType) { model.PositionIncluded.Add(new mQRFPositionTotalCost { QRFCostForPositionID = "", PositionType = item.PositionType, ProductName = "", TotalBuyPrice = response.PositionIncluded.Where(a => a.PositionType == item.PositionType).Sum(a => a.TotalBuyPrice), TotalSellPrice = response.PositionIncluded.Where(a => a.PositionType == item.PositionType).Sum(a => a.TotalSellPrice), ProfitPercentage = response.PositionIncluded.Where(a => a.PositionType == item.PositionType && a.ProfitPercentage > 0).Count() > 0 ? (response.PositionIncluded.Where(a => a.PositionType == item.PositionType).Sum(a => a.ProfitPercentage) / response.PositionIncluded.Where(a => a.PositionType == item.PositionType && a.ProfitPercentage > 0).Count()) : 0, ProfitAmount = response.PositionIncluded.Where(a => a.PositionType == item.PositionType).Sum(a => a.ProfitAmount), BuyCurrency = item.BuyCurrency, QRFCurrency = item.QRFCurrency }); } model.PositionIncluded.Add(new mQRFPositionTotalCost { QRFCostForPositionID = item.QRFCostForPositionID, PositionType = item.PositionType, PositionId = item.PositionId, ProductName = item.ProductName, TotalBuyPrice = item.TotalBuyPrice, TotalSellPrice = item.TotalSellPrice, ProfitAmount = item.ProfitAmount, ProfitPercentage = item.ProfitPercentage, BuyCurrency = item.BuyCurrency, QRFCurrency = item.QRFCurrency }); PositionType = item.PositionType; } foreach (var item in response.PositionSupplement) { model.PositionSupplement.Add(new mQRFPositionTotalCost { QRFCostForPositionID = item.QRFCostForPositionID, PositionType = item.PositionType, PositionId = item.PositionId, ProductName = item.ProductName, TotalBuyPrice = item.TotalBuyPrice, TotalSellPrice = item.TotalSellPrice, ProfitAmount = item.ProfitAmount, ProfitPercentage = item.ProfitPercentage, BuyCurrency = item.BuyCurrency, QRFCurrency = item.QRFCurrency }); } foreach (var item in response.PositionOptional) { model.PositionOptional.Add(new mQRFPositionTotalCost { QRFCostForPositionID = item.QRFCostForPositionID, PositionType = item.PositionType, PositionId = item.PositionId, ProductName = item.ProductName, TotalBuyPrice = item.TotalBuyPrice, TotalSellPrice = item.TotalSellPrice, ProfitAmount = item.ProfitAmount, ProfitPercentage = item.ProfitPercentage, BuyCurrency = item.BuyCurrency, QRFCurrency = item.QRFCurrency }); } model.DepartureDate = filterByDeparture; model.PaxSlab = filterByPaxSlab; #endregion if (model.PositionSupplement.Count > 0) { ViewBag.QRFCurrency = model.PositionSupplement[0].QRFCurrency; } if (model.PositionOptional.Count > 0) { ViewBag.QRFCurrency = model.PositionOptional[0].QRFCurrency; } if (model.PositionIncluded.Count > 0) { ViewBag.QRFCurrency = model.PositionIncluded[0].QRFCurrency; } ViewBag.IsAllowToAppRej = false; if (model.MenuViewModel.EnquiryPipeline == "Costing Approval Pipeline") { if (UserRoles.Contains("Product Accountant")) { ViewBag.IsAllowToAppRej = true; } } return(PartialView("_Commercials", model)); }
public IActionResult GetGuesstimateData(string QRFID, string filterByDay = null, string filterByServiceType = null, string filterByPackageType = null, long filterByDeparture = 0, long filterByPaxSlab = 0, string SuccessMessage = null, string ErrorMessage = null, string CalculateFor = null) { try { if (!(string.IsNullOrEmpty(SuccessMessage))) { TempData["success"] = SuccessMessage; } if (!(string.IsNullOrEmpty(ErrorMessage))) { TempData["error"] = ErrorMessage; } GuesstimateViewModel model = new GuesstimateViewModel(); //#region Get Summary Detailsby QRFId //qrfSummaryGetReq = new QRFSummaryGetReq(); //qrfSummaryGetReq.QRFID = QRFID; //qrfSummaryGetRes = qrfSummaryProviders.GetQRFSummary(qrfSummaryGetReq, token).Result; //model.SummaryDetails = qrfSummaryMapping.GetQRFSummaryDetails(qrfSummaryGetRes, token); //#endregion #region Filter Dropdown Bindings var objKeepAs = new List <AttributeValues>(); MasterTypeRequest objMasterTypeRequest = new MasterTypeRequest(); objMasterTypeRequest.Property = "QRF Masters"; objMasterTypeRequest.Name = "Position Type"; SalesProviders objSalesProvider = new SalesProviders(_configuration); MasterTypeResponse objMasterTypeResponse = objSalesProvider.GetGenericMasterForType(objMasterTypeRequest, token).Result; if (objMasterTypeResponse.Status == "Success" && objMasterTypeResponse.PropertyList.Count > 0) { if (objMasterTypeResponse.PropertyList[0].Attribute[0].AttributeName == "Position Type") { objKeepAs = objMasterTypeResponse.PropertyList[0].Attribute[0].Values.ToList(); } } 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(); #endregion #region Get Guesstimate by QRFId GuesstimateGetRes response = new GuesstimateGetRes(); GuesstimateGetReq request = new GuesstimateGetReq(); request.QRFID = QRFID; request.DepartureId = filterByDeparture == 0 ? objDepartureDatesRes.DepartureDates[0].Departure_Id : filterByDeparture; request.PaxSlabId = filterByPaxSlab == 0 ? objPaxSlabRes.PaxSlabDetails.QRFPaxSlabs[0].PaxSlab_Id : filterByPaxSlab; request.CalculateFor = CalculateFor; request.LoginUserId = ckUserEmailId; response = coProviders.GetGuesstimate(request, token).Result; GetDistinctRanges(response.Guesstimate, ref model); model.Guesstimate = response.Guesstimate; model.Guesstimate.VersionId = model.Guesstimate.VersionId; ViewBag.VersionName = model.Guesstimate.VersionName; ViewBag.VersionDescription = model.Guesstimate.VersionDescription; model.Guesstimate.VersionName = ""; model.Guesstimate.VersionDescription = ""; model.NextVersionId = response.LastVersionId + 1; model.IsStandardPrice = response.IsStandardPrice; #endregion #region Filter Logic model.DayList = GetDays(model.Guesstimate.GuesstimatePosition); model.ServiceTypeList = GetProductTypes(model.Guesstimate.GuesstimatePosition); model.KeepAsList = objKeepAs; if (filterByDay == "All") { filterByDay = null; } if (filterByServiceType == "All") { filterByServiceType = null; } if (filterByPackageType == "All") { filterByPackageType = null; } if (!string.IsNullOrEmpty(filterByDay)) { model.Guesstimate.GuesstimatePosition = model.Guesstimate.GuesstimatePosition.Where(x => x.Day == filterByDay).ToList(); } if (!string.IsNullOrEmpty(filterByServiceType)) { model.Guesstimate.GuesstimatePosition = model.Guesstimate.GuesstimatePosition.Where(x => x.ProductType == filterByServiceType).ToList(); } if (!string.IsNullOrEmpty(filterByPackageType)) { model.Guesstimate.GuesstimatePosition = model.Guesstimate.GuesstimatePosition.Where(x => x.KeepAs == filterByPackageType).ToList(); } //model.Guesstimate.GuesstimateDetails = model.Guesstimate.GuesstimateDetails.Where(x => model.SummaryDetails.Any(a => a.OriginalItineraryDetails.Any(b => b.PositionId == x.PositionId))).ToList(); model.Day = filterByDay; model.Service = filterByServiceType; model.KeepAs = filterByPackageType; model.DepartureDate = filterByDeparture.ToString(); model.PaxSlab = filterByPaxSlab.ToString(); #endregion return(PartialView("_Guesstimate", model)); } catch (Exception ex) { throw; return(View()); } }