Ejemplo n.º 1
0
        public static void CloseCheck()
        {
            Utils.ToCardLog("CloseCheckFromActiv");

            AlohaTSClass.CheckWindow();
            Check Chk = AlohaTSClass.GetCheckById((int)AlohaTSClass.AlohaCurentState.CheckId);

            /*
             * if (!AlcCheck(Chk))
             * {
             *  return;
             * }
             */
            if (Chk.HasUnorderedItems)
            {
                if (iniFile.AutoOrderBeforeWaiterClose)
                {
                    AlohaTSClass.OrderAllDishez(AlohaTSClass.AlohaCurentState.TerminalId, (int)AlohaTSClass.AlohaCurentState.CheckId, (int)AlohaTSClass.AlohaCurentState.TableId);
                }
                else
                {
                    frmAllertMessage Mf = new frmAllertMessage("В чеке есть незаказаные блюда. ");
                    Utils.ToLog("В чеке есть незаказаные блюда. Выхожу");
                    Mf.ShowDialog();
                    return;
                }
            }
            AlohaTSClass.CloseCheck(AlohaTSClass.GetTermNum(), Chk.AlohaCheckNum);
        }
        public static void CloseAlohaTableLocalCurentUser(int ChkId, int PaymentId, decimal Summ)
        {
            int TermNum = AlohaTSClass.GetTermNum();

            try
            {
                Check Chk = AlohaTSClass.GetCheckById(ChkId);
                Utils.ToCardLog("[CloseAlohaTableLocalCurentUser] Пытаюсь закрть чек локально" + Chk.AlohaCheckNum + " Терминал " + TermNum);
                AlohaTSClass.ApplyPayment(TermNum, Chk.AlohaCheckNum, (double)Summ / 100, PaymentId);
                AlohaTSClass.CloseCheck(TermNum, Chk.AlohaCheckNum);
                if (!AlohaTSClass.CheckIsClosed(Chk.AlohaCheckNum))
                {
                    //Сообщение
                }
                else
                {
                    Utils.ToCardLog("[CloseAlohaTableLocalCurentUser] Чек закрыл" + Chk.AlohaCheckNum);
                    if (AlohaTSClass.IsAlohaTS())
                    {
                        AlohaTSClass.CloseTable(TermNum, Chk.TableId);
                        Utils.ToCardLog("[CloseAlohaTableLocalCurentUser] Стол закрыл" + Chk.AlohaCheckNum);

                        //AlohaTSClass.LogOut();
                        //AlohaTSClass.LogIn(AlohaTSClass.GetTermNum(), 1354);
                        AlohaTSClass.RefreshCheckDisplay();
                    }
                }
            }
            catch (Exception e)
            {
                Utils.ToCardLog("Error CloseAlohaTableLocalCurentUser" + e.Message);
            }
        }
        private static void CloseAlohaTable(CRemoteCloseChk RemChk)
        {
            int TermNum = iniFile.RemoteCloseTerminal;

            try
            {
                Utils.ToCardLog("Отправляю чек из очереди на закрытие" + RemChk.Id);

                AlohaTSClass.LogOut(TermNum);
                AlohaTSClass.LogIn(TermNum, iniFile.RemoteCloseEmployee);



                Check Chk = AlohaTSClass.GetCheckById(RemChk.Id);
                if (Chk == null)
                {
                    RemChk.ErrorCount++;
                    return;
                }

                /*
                 * if ((Chk.Oplata != 0) && (Chk.Oplata != Chk.Summ))
                 * {
                 *  AlohaTSClass.DeletePayments(Chk, TermNum);
                 * }
                 * */
                //if ((Chk.Oplata == 0))
                // {
                //  if (RemChk.PaymentSumm == 0)
                //{
                //  RemChk.PaymentSumm = Chk.Summ;
                //}
                AlohaTSClass.ApplyPayment(TermNum, RemChk.Id, (double)RemChk.PaymentSumm, RemChk.PaymentId);
                //}
                AlohaTSClass.CloseCheck(TermNum, RemChk.Id);
                if (!AlohaTSClass.CheckIsClosed(RemChk.Id))
                {
                    RemChk.ErrorCount++;
                }
                else
                {
                    RemChk.ErrorCount = 0;
                    AlohaTSClass.LogOut(TermNum);
                    AlohaTSClass.LogIn(TermNum, RemChk.Empl);
                    AlohaTSClass.CloseTable(TermNum, Chk.TableId);
                }
                AlohaTSClass.LogOut(TermNum);
            }
            catch
            {
                AlohaTSClass.LogOut(TermNum);
                RemChk.ErrorCount++;
            }
        }