Пример #1
0
        public async Task <CostsheetGetRes> GetCostsheetData([FromBody] CostsheetGetReq request)
        {
            var response = new CostsheetGetRes();

            try
            {
                if (!string.IsNullOrEmpty(request.QRFID) && request != null)
                {
                    response = _costSheetRepository.GetCostsheetData(request);

                    //List<mQRFPackagePrice> pkgprice = await _costSheetRepository.GetlstQrfPackagePrice(request);
                    //List<mQRFNonPackagedPrice> nonpkgprice = await _costSheetRepository.GetlstQrfNonPackagePrice(request);
                    //List<mQRFPositionTotalCost> positionTotalCost = await _costSheetRepository.GetlstQrfPositionTotalCost(request);

                    //response.QrfPackagePrice = pkgprice;
                    //response.QrfNonPackagePrice = nonpkgprice;
                    //response.QRFPositionTotalCost = positionTotalCost;

                    response.ResponseStatus.Status       = "Success";
                    response.ResponseStatus.ErrorMessage = response != null ? "" : "No Records Found.";
                }
                else
                {
                    response.ResponseStatus.Status       = "Failure";
                    response.ResponseStatus.ErrorMessage = "QRFId can not be Null/Zero.";
                }
            }
            catch (Exception ex)
            {
                response.ResponseStatus.Status       = "Failure";
                response.ResponseStatus.ErrorMessage = "An Error Occurs :- " + ex.Message;
            }

            return(response);
        }
Пример #2
0
        public async Task <CostsheetGetRes> GetCostsheet(CostsheetGetReq costsheetGetReq, string ticket)
        {
            CostsheetGetRes costsheetGetRes = new CostsheetGetRes();

            costsheetGetRes = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceCostsheet:GetCostsheet"), costsheetGetReq, typeof(CostsheetGetRes), ticket);

            return(costsheetGetRes);
        }
Пример #3
0
        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));
        }
Пример #4
0
        public CostsheetGetRes GetCostsheetData(CostsheetGetReq request)
        {
            CostsheetGetRes response = new CostsheetGetRes();
            var             QRFPrice = _MongoContext.mQRFPrice.AsQueryable().Where(a => a.QRFID == request.QRFID && a.IsCurrentVersion == true).OrderByDescending(b => b.VersionId).FirstOrDefault();

            response.CostsheetVersion.QRFID              = QRFPrice.QRFID;
            response.CostsheetVersion.QRFPriceId         = QRFPrice.QRFPrice_Id;
            response.CostsheetVersion.VersionId          = QRFPrice.VersionId;
            response.CostsheetVersion.VersionName        = QRFPrice.VersionName;
            response.CostsheetVersion.VersionDescription = QRFPrice.VersionDescription;
            response.CostsheetVersion.IsCurrentVersion   = QRFPrice.IsCurrentVersion;
            response.CostsheetVersion.VersionCreateDate  = QRFPrice.CreateDate;

            response.QRFSalesFOC = QRFPrice.QRFSalesFOC.AsQueryable().Where(a => a.DateRangeId == request.DepartureId).ToList();

            if (request.DepartureId > 0)
            {
                response.QrfPackagePrice      = _MongoContext.mQRFPackagePrice.AsQueryable().Where(a => a.QRFPrice_Id == QRFPrice.QRFPrice_Id && a.Departure_Id == request.DepartureId).ToList();
                response.QrfNonPackagePrice   = _MongoContext.mQRFNonPackagedPrice.AsQueryable().Where(a => a.QRFPrice_Id == QRFPrice.QRFPrice_Id && a.Departure_Id == request.DepartureId).ToList();
                response.QRFPositionTotalCost = _MongoContext.mQRFPositionTotalCost.AsQueryable().Where(a => a.QRFPrice_Id == QRFPrice.QRFPrice_Id && a.Departure_Id == request.DepartureId).ToList();
            }
            else
            {
                response.QrfPackagePrice      = _MongoContext.mQRFPackagePrice.AsQueryable().Where(a => a.QRFPrice_Id == QRFPrice.QRFPrice_Id).ToList();
                response.QrfNonPackagePrice   = _MongoContext.mQRFNonPackagedPrice.AsQueryable().Where(a => a.QRFPrice_Id == QRFPrice.QRFPrice_Id).ToList();
                response.QRFPositionTotalCost = _MongoContext.mQRFPositionTotalCost.AsQueryable().Where(a => a.QRFPrice_Id == QRFPrice.QRFPrice_Id).ToList();
            }

            if (request.PaxSlabId > 0)
            {
                response.QrfPackagePrice    = response.QrfPackagePrice.Where(x => x.PaxSlab_Id == request.PaxSlabId).ToList();
                response.QrfNonPackagePrice = response.QrfNonPackagePrice.Where(x => x.PaxSlab_Id == request.PaxSlabId).ToList();
            }

            //response.QRFPositionTotalCost = _MongoContext.mQRFPositionTotalCost.AsQueryable().Where(a => a.QRFPrice_Id == QRFPrice.QRFPrice_Id && a.Departure_Id == request.DepartureId).ToList();

            return(response);
        }
Пример #5
0
        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());
            }
        }
Пример #6
0
        public IActionResult GetItinerary(string QRFID, string filterByDay = null, string filterByServiceType = null, long filterByDeparture = 0, long filterByPaxSlab = 0)
        {
            try
            {
                ItineraryViewModel model = new ItineraryViewModel();

                #region Get Quote Info By QRFId
                NewQuoteViewModel modelQuote = new NewQuoteViewModel();
                modelQuote.QRFID = QRFID;
                SalesQuoteLibrary quoteLibrary = new SalesQuoteLibrary(_configuration);
                bool GetStatus = false;
                GetStatus = quoteLibrary.GetQRFAgentByQRFId(_configuration, token, ref modelQuote);
                if (GetStatus)
                {
                    model.TourInfoHeaderViewModel       = modelQuote.TourInfoHeaderViewModel;
                    model.MenuViewModel.EnquiryPipeline = modelQuote.mdlMenuViewModel.EnquiryPipeline;
                }
                #endregion

                #region Get Itinerary Details by QRFId
                itineraryGetReq          = new ItineraryGetReq();
                itineraryGetReq.QRFID    = QRFID;
                itineraryGetReq.editUser = ckUserEmailId;
                itineraryGetRes          = coProviders.GetItineraryDetails(itineraryGetReq, token).Result;
                model.Itinerary          = itineraryGetRes.Itinerary;
                #endregion

                #region Get Costsheet by QRFId
                NewQuoteViewModel modelQuote1 = new NewQuoteViewModel();
                bool GetStatus1 = false;
                SalesQuoteLibrary quoteLibrary1 = new SalesQuoteLibrary(_configuration);
                if (!string.IsNullOrEmpty(QRFID))
                {
                    modelQuote1.QRFID = QRFID;
                    GetStatus1        = quoteLibrary1.GetQRFPaxSlabDetails(_configuration, token, ref modelQuote1);
                }
                SalesProviders          objSalesProvider     = new SalesProviders(_configuration);
                DepartureDateGetRequest objDepartureDatesReq = new DepartureDateGetRequest()
                {
                    QRFID = QRFID, date = (DateTime?)null
                };
                DepartureDateGetResponse objDepartureDatesRes = objSalesProvider.GetDepartureDatesForQRFId(objDepartureDatesReq, token).Result;
                model.PaxSlabList = (modelQuote1.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);
                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 Price Per Person Binding
                List <ItineraryDaysInfo>    lstDays      = itineraryGetRes.Itinerary.ItineraryDays.ToList();
                List <QRFPkgAndNonPkgPrice> lstPositions = new List <QRFPkgAndNonPkgPrice>();

                foreach (var a in lstDays)
                {
                    List <ItineraryDescriptionInfo> lstdes = a.ItineraryDescription.Where(x => x.KeepAs.ToUpper() != "INCLUDED").ToList();
                    foreach (var k in response.QrfNonPackagePrice.Where(y => y.RoomName.ToUpper() == "ADULT"))
                    {
                        foreach (var l in lstdes)
                        {
                            if (l.PositionId == k.PositionId)
                            {
                                lstPositions.Add(new QRFPkgAndNonPkgPrice {
                                    QRFCurrency = string.IsNullOrEmpty(k.QRFCurrency) ? "" : k.QRFCurrency.Substring(0, 3).ToUpper(), SellPrice = k.SellPrice, PositionId = k.PositionId, PositionKeepAs = k.PositionKeepAs, PaxSlabId = k.PaxSlab_Id, ProductName = k.ProductName, RoomName = k.RoomName
                                });
                            }
                        }
                    }
                }

                model.ListNonQrfPkgPositions = lstPositions;
                #endregion

                #region Filter Dropdown Bindings
                model.DayList         = GetDays(itineraryGetRes.Itinerary.ItineraryDays);
                model.ServiceTypeList = GetProductTypes(model.Itinerary.ItineraryDays);
                #endregion

                #region Date Binding
                if (filterByDay == "Day")
                {
                    filterByDay = null;
                }

                if (filterByServiceType == "Service Type")
                {
                    filterByServiceType = null;
                }

                if (!string.IsNullOrEmpty(filterByDay))
                {
                    model.Itinerary.ItineraryDays = model.Itinerary.ItineraryDays.Where(x => x.Day == filterByDay).ToList();
                }

                if (!string.IsNullOrEmpty(filterByServiceType))
                {
                    for (int i = 0; i < model.Itinerary.ItineraryDays.Count; i++)
                    {
                        model.Itinerary.ItineraryDays[i].ItineraryDescription = model.Itinerary.ItineraryDays[i].ItineraryDescription.Where(x => x.ProductType == filterByServiceType).ToList();
                    }
                }
                model.Days          = filterByDay;
                model.Services      = filterByServiceType;
                model.DepartureDate = filterByDeparture;
                model.PaxSlab       = filterByPaxSlab;
                #endregion

                return(PartialView("_Itinerary", model));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Пример #7
0
        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));
        }
Пример #8
0
        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);
        }