Exemplo n.º 1
0
        /// <summary>
        /// Method to get all tax exempt system reasons
        /// </summary>
        /// <param name="oTeSystem">Tax exempt system</param>
        public void GetAllReasons(ref teSystem oTeSystem)
        {
            var gasReasons = _reasonService.GetTaxExemptReasons("FUEL");

            oTeSystem.GasReasons     = new TaxExemptReasons();
            oTeSystem.PropaneReasons = new TaxExemptReasons();
            oTeSystem.TobaccoReasons = new TaxExemptReasons();

            foreach (var taxExemptReason in gasReasons)
            {
                oTeSystem.GasReasons.AddReason(taxExemptReason, "");
            }


            var tobaccoReasons = _reasonService.GetTaxExemptReasons("TOBACCO");

            foreach (var taxExemptReason in tobaccoReasons)
            {
                oTeSystem.TobaccoReasons.AddReason(taxExemptReason, "");
            }


            var propaneReasons = _reasonService.GetTaxExemptReasons("PROPANE");

            foreach (var taxExemptReason in propaneReasons)
            {
                oTeSystem.PropaneReasons.AddReason(taxExemptReason, "");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Method to get tax free price
        /// </summary>
        /// <param name="oTeSystem">Tax exempt system</param>
        /// <param name="purchaseItem">Purchse item</param>
        /// <param name="sProductKey">Product key</param>
        /// <param name="originalPrice">Original price</param>
        /// <param name="bFound">Value found</param>
        /// <param name="stockcode">Stock code</param>
        /// <param name="productCode">Product code</param>
        /// <param name="outTaxExemptRate">tax exempt rate</param>
        /// <returns>True or false</returns>
        public bool TeGetTaxFreePrice(ref teSystem oTeSystem, ref tePurchaseItem purchaseItem, string sProductKey, float originalPrice, bool bFound, string stockcode, string productCode, float outTaxExemptRate)
        {
            var returnValue     = false;
            var dOutPrice       = purchaseItem.TaxFreePrice;
            var dOutUnitsPerPkg = purchaseItem.UnitsPerPkg;
            var eOutCategory    = purchaseItem.ProdType;
            var sOutUpcCode     = purchaseItem.UpcCode;

            if (_policyManager.TE_ByRate && _policyManager.TE_Type != "SITE") //sghiny dec15, 2009
            {
                if (TeGetTaxFreePriceByRate(ref sProductKey, originalPrice, ref dOutPrice, ref dOutUnitsPerPkg, ref eOutCategory, ref sOutUpcCode, ref bFound, ref outTaxExemptRate, stockcode, ref productCode))
                {
                    returnValue = true;
                }
            }
            else
            {
                if (TeGetTaxFreePriceByPrice(ref oTeSystem, ref sProductKey, originalPrice, ref dOutPrice, ref dOutUnitsPerPkg, ref eOutCategory, ref sOutUpcCode, ref bFound, stockcode))
                {
                    returnValue = true;
                }
            }
            purchaseItem.TaxFreePrice = dOutPrice;
            purchaseItem.UnitsPerPkg  = dOutUnitsPerPkg;
            purchaseItem.ProdType     = eOutCategory;
            purchaseItem.UpcCode      = sOutUpcCode;
            return(returnValue);
        }
        /// <summary>
        /// Method to make default tax exempt sale line
        /// </summary>
        /// <param name="saleLine">Sale line</param>
        /// <param name="theSystem">Tax exempt system</param>
        /// <returns>True or false</returns>
        public bool MakeTaxExemptLine(ref TaxExemptSaleLine saleLine, ref teSystem theSystem)
        {
            bool bFound = false;


            if (!_teSystemManager.TeGetTaxFreePrice(ref theSystem, ref saleLine, ref bFound))// mPrivateGlobals.theSystem.teGetTaxFreePrice(mvarProductKey, mvarOriginalPrice, mvarTaxFreePrice, mvarUnitsPerPkg, mvarProductType, mvarUpcCode, bFound, mvarStockCode, mvarProductCode, mvarTaxExemptRate))
            {
                saleLine.LastError = theSystem.teGetLastError();
                return(false);
            }

            if (!bFound)
            {
                return(false);
            }

            if ((saleLine.ProductType == mPrivateGlobals.teProductEnum.eCigarette) || (saleLine.ProductType == mPrivateGlobals.teProductEnum.eCigar) || (saleLine.ProductType == mPrivateGlobals.teProductEnum.eLooseTobacco))
            {
                saleLine.EquvQuantity = float.Parse((saleLine.UnitsPerPkg * saleLine.Quantity).ToString("#0.00"));
            } // hen
            else if ((saleLine.ProductType == mPrivateGlobals.teProductEnum.eGasoline) || (saleLine.ProductType == mPrivateGlobals.teProductEnum.eDiesel) || (saleLine.ProductType == mPrivateGlobals.teProductEnum.ePropane) || (saleLine.ProductType == mPrivateGlobals.teProductEnum.emarkedGas) || (saleLine.ProductType == mPrivateGlobals.teProductEnum.emarkedDiesel))
            {
                saleLine.EquvQuantity = float.Parse((saleLine.UnitsPerPkg * saleLine.Quantity).ToString("#0.000"));
            }

            saleLine.ExemptedTax = theSystem.RoundToHighCent((saleLine.OriginalPrice - saleLine.TaxFreePrice) * saleLine.Quantity);

            saleLine.Amount = saleLine.TaxInclPrice - saleLine.ExemptedTax - saleLine.TaxCreditAmount;

            return(true);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Method to get all override codes
        /// </summary>
        /// <param name="teSystem">Tax exempt system</param>
        /// <param name="arOverrideCodes">List of override codes</param>
        /// <returns>True or false</returns>
        public bool TeGetAllOverrideCodes(ref teSystem teSystem, ref List <OverrideCode> arOverrideCodes)
        {
            bool isError;

            arOverrideCodes = _teSystemService.GetOverrideCodes(out isError);
            if (!isError)
            {
                return(true);
            }
            teSystem.SLastError = "Error: No override records found.";
            return(false);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Method to set tax exempt exact fuel key
        /// </summary>
        /// <param name="oTeSystem">Tax exempt system</param>
        /// <param name="sCompoundKey">Compound key</param>
        /// <param name="iGradeId">Grade id</param>
        /// <param name="iTierId">Tier id</param>
        /// <param name="iLevelId">Level id</param>
        /// <returns>True or false</returns>
        public bool TeExtractFuelKey(ref teSystem oTeSystem, ref string sCompoundKey, ref short iGradeId, ref short
                                     iTierId, ref short iLevelId)
        {
            var returnValue = false;

            try
            {
                var sTempError = oTeSystem.SLastError;
                oTeSystem.SLastError = "Failed to extract fuel key from \"" + sCompoundKey + "\"";

                if (!TeIsFuelKey(sCompoundKey))
                {
                    return(false);
                }

                var iOldPos = (short)(sCompoundKey.IndexOf(":G:", StringComparison.Ordinal) + 1);
                if (iOldPos == 0)
                {
                    return(false);
                }
                iOldPos = (short)(iOldPos + ":G:".Length); //iOldPos now points at 1 past ":G:"

                var iPos = (short)(sCompoundKey.IndexOf(",T:", StringComparison.Ordinal) + 1);
                if (iPos == 0)
                {
                    return(false);
                }

                iGradeId = short.Parse(sCompoundKey.Substring(iOldPos - 1, iPos - iOldPos));

                iOldPos = (short)(iPos + ",T:".Length);
                iPos    = (short)(sCompoundKey.IndexOf(",L:", iPos + 1 - 1, StringComparison.Ordinal) + 1);
                if (iPos == 0)
                {
                    return(false);
                }

                iTierId = short.Parse(sCompoundKey.Substring(iOldPos - 1, iPos - iOldPos));

                iPos     = (short)(iPos + ",T:".Length);
                iLevelId = short.Parse(sCompoundKey.Substring(iPos - 1, sCompoundKey.Length + 1 - iPos));

                oTeSystem.SLastError = sTempError;
                returnValue          = true;
            }
            catch (Exception ex)
            {
                //ExcludeSE
                oTeSystem.SLastError = oTeSystem.SLastError + " " + ex.HResult + ":" + ex.Message;
            }
            return(returnValue);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Method to test if limit is required
        /// </summary>
        /// <param name="oTeSystem">Tax exempt system</param>
        /// <param name="productType">Product type</param>
        /// <returns>True or false</returns>
        public bool IsLimitRequired(ref teSystem oTeSystem, mPrivateGlobals.teProductEnum productType)
        {
            bool isError;

            bool returnValue = _teSystemService.IsLimitRequired((int)productType, out isError);

            if (!isError)
            {
                return(returnValue);
            }
            oTeSystem.SLastError = "Error: No Category records found.";
            return(false);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Method to get all limits
        /// </summary>
        /// <param name="oTeSystem">Tax exempt system</param>
        public void GetAllLimits(ref teSystem oTeSystem)
        {
            oTeSystem.GasLimit = _teSystemService.GetAdminValue("GasLimit") == null ? 0 : Convert.ToSingle(_teSystemService.GetAdminValue("GasLimit"));

            oTeSystem.PropaneLimit = _teSystemService.GetAdminValue("PropaneLimit") == null ? 0 : Convert.ToSingle(_teSystemService.GetAdminValue("PropaneLimit"));

            oTeSystem.TobaccoLimit = _teSystemService.GetAdminValue("CigLimit") == null ? 0 : Convert.ToSingle(_teSystemService.GetAdminValue("CigLimit"));

            oTeSystem.Retailer = _teSystemService.GetAdminValue("TaxExemptRetailer") == null ? "" : Convert.ToString(_teSystemService.GetAdminValue("TaxExemptRetailer"));

            oTeSystem.TaxCertifyCode = _teSystemService.GetAdminValue("TaxExemptCertifyCode") == null ? "" : Convert.ToString(_teSystemService.GetAdminValue("TaxExemptCertifyCode"));

            oTeSystem.TaxProgram = _teSystemService.GetAdminValue("TaxProgram") == null ? "" : Convert.ToString(_teSystemService.GetAdminValue("TaxProgram"));

            oTeSystem.VoucherFooter = _teSystemService.GetReportValues("TAXEXEMPT") == null ? "" : Convert.ToString(_teSystemService.GetReportValues("TAXEXEMPT"));
        }
Exemplo n.º 8
0
        /// <summary>
        /// Method to get tax free price by price
        /// </summary>
        /// <param name="oTeSystem">Tax exempt system</param>
        /// <param name="sProductKey">Product key</param>
        /// <param name="originalPrice">Original price</param>
        /// <param name="dOutPrice">Price</param>
        /// <param name="dOutUnitsPerPkg">Units per kg</param>
        /// <param name="eOutCategory">Category</param>
        /// <param name="sOutUpcCode">UPC code</param>
        /// <param name="bFound">Value found</param>
        /// <param name="stockcode">Stock code</param>
        /// <returns>True or false</returns>
        private bool TeGetTaxFreePriceByPrice(ref teSystem oTeSystem, ref string sProductKey, double originalPrice
                                              , ref float dOutPrice, ref float dOutUnitsPerPkg, ref mPrivateGlobals.teProductEnum eOutCategory,
                                              ref string sOutUpcCode, ref bool bFound, string stockcode)
        {
            bFound          = false;
            eOutCategory    = mPrivateGlobals.teProductEnum.eNone;
            sOutUpcCode     = "";
            dOutUnitsPerPkg = 0;

            string sSql;

            short iTier  = 0;
            short iGrade = 0;
            short iLevel = 0;

            if (TeIsFuelKey(sProductKey))
            {
                if (!TeExtractFuelKey(ref oTeSystem, ref sProductKey, ref iGrade, ref iTier, ref iLevel))
                {
                    return(false);
                }

                sSql = "SELECT TaxFreePrice, " + "(SELECT CategoryFK From CSCMaster.dbo.ProductTaxExempt Where" + " ProductKey =\'" + stockcode + "\') As CategoryFK," + "1 As UnitsPerPkg, " + "\'\' As UpcCode  FROM FuelPrice  WHERE GradeID=" + iGrade + " AND TierID=" + iTier + " AND LevelID=" + iLevel;
            }
            else
            {
                sSql = "SELECT TaxFreePrice, CategoryFK, UnitsPerPkg, UpcCode FROM CSCMaster.dbo.ProductTaxExempt  WHERE ProductKey=\'" + sProductKey + "\'";
            }

            bool isError;
            var  success = _taxService.TeGetTaxFreePriceByPrice(sSql, ref dOutPrice, originalPrice, ref eOutCategory,
                                                                ref dOutUnitsPerPkg, ref sOutUpcCode, out bFound, out isError);

            if (!isError)
            {
                return(success);
            }
            oTeSystem.SLastError = "2";
            return(false);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Method to get tax free price
        /// </summary>
        /// <param name="oTeSystem">Tax exempt system</param>
        /// <param name="saleLine">Sale line</param>
        /// <param name="bFound">Value found</param>
        /// <returns>True or falses</returns>
        public bool TeGetTaxFreePrice(ref teSystem oTeSystem, ref TaxExemptSaleLine saleLine, ref bool bFound)
        {
            var returnValue = false;

            string sProductKey      = saleLine.ProductKey;
            float  originalPrice    = saleLine.OriginalPrice;
            var    dOutPrice        = saleLine.TaxFreePrice;
            var    dOutUnitsPerPkg  = saleLine.UnitsPerPkg;
            var    eOutCategory     = saleLine.ProductType;
            var    sOutUpcCode      = saleLine.UpcCode;
            var    stockcode        = saleLine.StockCode;
            var    productCode      = saleLine.ProductCode;
            var    outTaxExemptRate = saleLine.TaxExemptRate;

            if (_policyManager.TE_ByRate && _policyManager.TE_Type != "SITE") //sghiny dec15, 2009
            {
                if (TeGetTaxFreePriceByRate(ref sProductKey, originalPrice, ref dOutPrice, ref dOutUnitsPerPkg, ref eOutCategory, ref sOutUpcCode, ref bFound, ref outTaxExemptRate, stockcode, ref productCode))
                {
                    returnValue = true;
                }
            }
            else
            {
                if (TeGetTaxFreePriceByPrice(ref oTeSystem, ref sProductKey, originalPrice, ref dOutPrice, ref dOutUnitsPerPkg, ref eOutCategory, ref sOutUpcCode, ref bFound, stockcode))
                {
                    returnValue = true;
                }
            }
            saleLine.ProductKey    = sProductKey;
            saleLine.OriginalPrice = originalPrice;
            saleLine.TaxFreePrice  = dOutPrice;
            saleLine.UnitsPerPkg   = dOutUnitsPerPkg;
            saleLine.ProductType   = eOutCategory;
            saleLine.UpcCode       = sOutUpcCode;
            saleLine.StockCode     = stockcode;
            saleLine.ProductCode   = productCode;
            saleLine.TaxExemptRate = outTaxExemptRate;
            return(returnValue);
        }
Exemplo n.º 10
0
        public static void AddTeSystemForTill(int tillNumber, int saleNumber, teSystem teSystem)
        {
            MemCacher.Delete($"TESYSTEM_{tillNumber}_{saleNumber}");

            MemCacher.Add($"TESYSTEM_{tillNumber}_{saleNumber}", teSystem, DateTimeOffset.UtcNow.AddHours(1));
        }