private void ApplyDiscount(double Amount)
        {
            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                                        (ThreadStart) delegate()
            {
                string DiscErr = "";
                int CompId     = AlohaTSClass.ApplyComp(iniFile.FayRetailDiscountId, out DiscErr, Amount);
                if (CompId == 0)
                {
                    tbCode.Focus();
                    tbError.Text = "Ошибка применения скидки на чек " + DiscErr;
                    SetVisState(0);
                }
                else
                {
                    CurentCheck    = FayRetail.FayRetailMain.GetCurentFRCheck();
                    string CardNum = tbCode.Text;
                    string ErrMsg  = "";
                    bool Res       = FayRetailClient.ApplyFayRetPaymentToCheck(CardNum, CurentCheck, CurentCashier, Amount, out ErrMsg);
                    Utils.ToCardLog("ApplyDiscount FayRetailClient.ApplyFayRetPaymentToCheck end Res: " + Res.ToString());

                    if (!Res)
                    {
                        tbCode.Focus();
                        tbError.Text = ErrMsg;
                        AlohaTSClass.DeleteComp(CompId);
                        SetVisState(0);
                    }
                    else
                    {
                        FayRetailMain.AddCheckToAddBonus(CurentCheck.ChequeNumber, CardNum);
                        tbFinalMsg.Text = "Успешно. " + ErrMsg;
                        SetVisState(3);
                    }
                }
            }
                                        );
        }
Пример #2
0
        private void EndApplyComp()
        {
            AlohaTSClass.CheckWindow();
            string outMess = "";

            //int OrderMode = ((DType==20)?10:1);
            bool OrderRes = AlohaTSClass.OrderAllDishez(AlohaTSClass.AlohaCurentState.TerminalId, (int)AlohaTSClass.AlohaCurentState.CheckId, (int)AlohaTSClass.AlohaCurentState.TableId);

            if (!OrderRes)
            {
                frmAllertMessage Mf = new frmAllertMessage("Не могу заказать блюда. Попробуйте еще раз. Либо закажите самостоятельно. Если ошибка будет повторяться свяжитесь со службой техподдержки для перезагрузки Алохи.");
                Utils.ToLog("Не могу заказать блюда. Выхожу");
                Mf.ShowDialog();
                return;
            }


            int CompId = AlohaTSClass.ApplyComp(DType, "", out outMess);

            if (AlohaTSClass.GetCurentCheckSumm() != 0)
            {
                AlohaTSClass.ShowMessage("Не смог наложить 100% компенсацию. Проверьте, что все блюда чека входят в группу соответствующую скидки " + DType.ToString());
                AlohaTSClass.DeleteComp(CompId);
                return;
            }


            if (outMess != "")
            {
                AlohaTSClass.ShowMessage(outMess);
            }
            else
            {
                if (CurrentEmp == null)
                {
                    if (CurrentComment != "")
                    {
                        AlohaTSClass.SetManagerDiscountAttr((int)AlohaTSClass.AlohaCurentState.CheckId, CurrentComment, AlohaTSClass.AlohaCurentState.EmployeeNumberCode);
                    }
                }
                else
                {
                    if (CurrentComment != "")
                    {
                        AlohaTSClass.SetManagerDiscountAttr((int)AlohaTSClass.AlohaCurentState.CheckId, CurrentComment, CurrentEmp.Id);
                    }
                    else
                    {
                        AlohaTSClass.SetManagerDiscountAttr((int)AlohaTSClass.AlohaCurentState.CheckId, CurrentEmp.Name, CurrentEmp.Id);
                    }
                }

                if (DType == 20)
                {
                    for (int i = 0; i < ctrlHotelBreakfastCount1.GuestCount; i++)
                    {
                        double price = ctrlHotelBreakfastCount1.Price;
                        if (ctrlHotelBreakfastCount1.IsSmall)
                        {
                            AlohaTSClass.AddDishToCurentChk(iniFile.HotelBreakfastBarCodeSmall, price);
                        }
                        else
                        {
                            AlohaTSClass.AddDishToCurentChk(iniFile.HotelBreakfastBarCode, price);
                        }
                    }



                    //    AlohaTSClass.ApplyFullPaymentToCurentChk(iniFile.HotelBreakfastPaymentId);
                }
                if (DType != 20)
                {
                    AlohaTSClass.CloseCurentCheckAndTableByCurentUser();
                }

                AlohaTSClass.ShowMessage("Компенсация успешно применена");
            }
            this.Close();
        }