/// <summary>
        /// Apply Special Price
        /// </summary>
        /// <param name="priceCheck">Price check</param>
        /// <param name="userCode">User code</param>
        /// <param name="error">Error</param>
        /// <returns>Stock price check</returns>
        public StockPriceCheck ApplySpecialPrice(SpecialPriceCheck priceCheck, string userCode, out ErrorMessage error)
        {
            if (priceCheck.RegularPrice > 9999.99)
            {
                priceCheck.RegularPrice = 9.99;
            }
            var stockItem = _stockService.GetStockItem(priceCheck.StockCode);

            if (stockItem == null)
            {
                var offSet = _policyManager.LoadStoreInfo().OffSet;
                error = new ErrorMessage
                {
                    MessageStyle = _resourceManager.CreateMessage(offSet, 39, 91, priceCheck.StockCode)
                };
                return(null);
            }
            var  vendorId          = stockItem.Vendor;
            bool activeVendorPrice = _stockService.IsActiveVendorPrice(priceCheck.StockCode, vendorId);

            _stockService.DeletePreviousPrices(priceCheck.StockCode, priceCheck.PriceType, activeVendorPrice, vendorId);

            if (!IsValidPricingInput(priceCheck.PriceType, priceCheck.GridPrices, out error))
            {
                return(null);
            }


            foreach (PriceGrid priceGrid in priceCheck.GridPrices)
            {
                switch (priceCheck.PriceType[0].ToString())
                {
                case "S":
                    if (Convert.ToDouble(priceGrid.Column1) > 9999.99)
                    {
                        priceGrid.Column1 = "9.99";
                    }
                    break;

                case "F":
                    if (Convert.ToDouble(priceGrid.Column2) > 9999.99)
                    {
                        priceGrid.Column2 = "9.99";
                    }
                    break;

                case "I":
                    if (Convert.ToDouble(priceGrid.Column3) > 9999.99)
                    {
                        priceGrid.Column3 = "9.99";
                    }
                    break;

                case "X":
                    if (Convert.ToDouble(priceGrid.Column2) > 9999.99)
                    {
                        priceGrid.Column2 = "9.99";
                    }
                    break;

                default:
                    if (Convert.ToDouble(priceGrid.Column1) > 9999.99)
                    {
                        priceGrid.Column1 = "9.99";
                    }
                    ;
                    break;
                }
            }



            _stockService.AddUpdateSpecialPrice(priceCheck.StockCode, activeVendorPrice, ref vendorId, priceCheck.PriceType[0].ToString(),
                                                priceCheck.GridPrices, priceCheck.Fromdate, priceCheck.Todate, priceCheck.PerDollarChecked, priceCheck.IsEndDate);

            double price = 0;

            _stockService.AddUpdateRegularPrice(priceCheck.StockCode, ref vendorId, ref price, priceCheck.RegularPrice);

            _stockService.TrackPriceChange(priceCheck.StockCode, price, priceCheck.RegularPrice, "PC", 1, userCode, vendorId);

            var      result   = GetStockPriceDetails(priceCheck.StockCode, priceCheck.TillNumber, priceCheck.SaleNumber, priceCheck.RegisterNumber, userCode, out error);
            Register register = new Register();

            _mainManager.SetRegister(ref register, priceCheck.RegisterNumber);
            if (register.Customer_Display)
            {
                result.CustomerDisplay = _mainManager.DisplayMsgLcd(register,
                                                                    _mainManager.FormatLcdString(register, result.Description,
                                                                                                 result.RegularPriceText), "");
            }
            return(result);
        }