Exemplo n.º 1
0
        static internal bool VerifyCheckPercent()
        {
            Utils.ToLog("VerifyCheckPercent");
            if (RegWorker.GetRegPercent() == -1)
            {
                Utils.ToLog("RegWorker.GetRegPercent() ==-1 ");
                return(false);
            }


            decimal CPerc = 0;

            if (myAllChecks.GetShtrihBalanse(true).AllSumm == 0)
            {
                CPerc = 100;
            }
            else
            {
                CPerc = (myAllChecks.GetShtrihBalanse(false).AllSumm * 100) / myAllChecks.GetShtrihBalanse(true).AllSumm;
            }

            return(CPerc < RegWorker.GetRegPercent() - 1);
        }
Exemplo n.º 2
0
        static internal bool GetCheckColor(Check Ch)
        {
            FiskInfo Fi = ReadFiskInfo();

            if (!Fi.IsMod)
            {
                return(true);
            }

            if (Ch.Vozvr)
            {
                return(true);
            }

            /*
             * if (Ch.Tender!=   TenderType.Cash)
             * {
             *  return true;
             * }
             */
            if (Ch.HasNonCashPayment())
            {
                return(true);
            }

            if ((Ch.TableNumber >= 200) && (Ch.TableNumber <= 240))
            {
                return(true);// FoodFox
            }


            //Shtrih.RegisterNumber = 241;
            // Shtrih.GetCashReg();


            decimal CurentShtrihCash = 5000;

            if (!iniFile.FiskalDriverNonShtrih)
            {
                try
                {
                    Utils.ToLog("CurentShtrihCash S");
                    CurentShtrihCash = Shtrih2.GetCashReg(241);
                    Utils.ToLog("CurentShtrihCash E");
                }
                catch (Exception e)
                {
                    Utils.ToCardLog("[Error] CurentShtrihCash " + e.Message);
                }
            }


            if (CurentShtrihCash < 5000)
            {
                return(true);
            }
            foreach (Dish D in Ch.Dishez)
            {
                if (AlohaTSClass.DishIsTort(D.BarCode))
                {
                    return(true);
                }
            }

            /*
             * if (Ch.CompId != 0)
             * {
             *  return true;
             * }
             */
            if ((Ch.CompId == 8) || (Ch.CompId == 53))
            {
                return(true);
            }


            try
            {
                if (AlohaTSClass.GetVip(Ch.AlohaCheckNum))
                {
                    Utils.ToCardLog("VIP");
                    return(true);
                }
            }
            catch
            {
            }

            try
            {
                int    P     = 0;
                int    V     = 0;
                string DCard = AlohaTSClass.GetDiscountAttr((int)Ch.AlohaCheckNum, out P, out V);
                if (DCard.Length > 4)
                {
                    if (DCard.Substring(0, 3).ToUpper() == "ZAV")
                    {
                        try
                        {
                            string n   = DCard.Substring(3);
                            int    num = Convert.ToInt32(n);
                            if (SuperCardsZAV.Contains(num))
                            {
                                Utils.ToCardLog("card");
                                return(true);
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            catch
            { }

            if (VerifyCheckPercent())
            {
                Utils.ToLog("Hamster");
                return(true);
            }

            /*
             * if (RegWorker.GetRegModType() == 3) //Азарика
             * {
             *  Utils.ToCardLog("ModType3");
             *  if ((DateTime.Now.Hour >= 8) && (DateTime.Now.Hour < 22))
             *
             *  //&& (DateTime.Now.DayOfWeek != DayOfWeek.Saturday) && (DateTime.Now.DayOfWeek != DayOfWeek.Sunday))
             *  {
             *      int P = 0;
             *      int V = 0;
             *      string DCard = AlohaTSClass.GetDiscountAttr((int)Ch.AlohaCheckNum, out P, out V);
             *      if (DCard.Length > 4)
             *      {
             *          if ((DCard.Substring(0, 3).ToUpper() == "ZAV") || (DCard.Substring(0, 3).ToUpper() == "VIP"))
             *          {
             *              return false;
             *          }
             *          else if (Ch.CompId == 2)
             *          {
             *              return false;
             *          }
             *          else
             *          {
             *              return true;
             *          }
             *
             *      }
             *      else if (Ch.CompId == 2)
             *      {
             *          return false;
             *      }
             *      else
             *      {
             *          return true;
             *      }
             *  }
             * }
             *
             */


            if (RegWorker.GetRegModType() == 2)
            {
                if ((DateTime.Now.Hour >= 8) && (DateTime.Now.Hour < 22))

                //&& (DateTime.Now.DayOfWeek != DayOfWeek.Saturday) && (DateTime.Now.DayOfWeek != DayOfWeek.Sunday))
                {
                    Utils.ToCardLog("ModType2");
                    int    P     = 0;
                    int    V     = 0;
                    string DCard = AlohaTSClass.GetDiscountAttr((int)Ch.AlohaCheckNum, out P, out V);
                    if (DCard.Length > 4)
                    {
                        if ((DCard.Substring(0, 3).ToUpper() == "ZAV") || (DCard.Substring(0, 3).ToUpper() == "VIP"))
                        {
                            return(false);
                        }
                        else if (Ch.CompId == 2)
                        {
                            return(false);
                        }
                        else
                        {
                            return(true);
                        }
                    }
                    else if (Ch.CompId == 2)
                    {
                        return(false);
                    }
                    else if (Ch.Summ > 2500)
                    {
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
            }
            //else
            {
                if ((Ch.CompId == 6) || (Ch.CompId == 54)) //с собой
                {
                    return(false);
                }

                DateTime dt2 = DateTime.Now;
                //  dt2 = AlohaTime(Ch.OpenTimeStr);
                if (dt2 > DateTime.Now)
                {
                    dt2.AddDays(-1);
                }


                if ((Ch.CheckTimeLong < Fi.MaxLong) && (Ch.CheckTimeLong > Fi.MinLong))
                {
                    if ((Ch.Summ < Fi.BigSum) && (Ch.Summ > Fi.LowSum))
                    {
                        //if (Ch.CompId == 0)
                        {
                            Random R = new Random();
                            if (R.Next(1, 100) > Fi.HiPercent)
                            {
                                return(true);
                            }
                        }
                    }
                }
            }

            return(false);
        }