示例#1
0
        static private ArcusSlip GetSlip(int Num)
        {
            ArcusSlips AS = ArcusAlohaIntegrator.ReadArcusSlips();

            foreach (ArcusSlip S in AS.Slips)
            {
                if (S.Num == Num)
                {
                    return(S);
                }
            }
            return(null);
        }
示例#2
0
        static internal void PrintShortReport()
        {
            Utils.ToCardLog("Печать краткого отчета");
            ArcusSlips AS         = ArcusAlohaIntegrator.ReadArcusSlips();
            decimal    Card       = 0;
            int        CardCount  = 0;
            decimal    Vozvr      = 0;
            int        VozvrCount = 0;


            foreach (ArcusSlip s in AS.Slips)
            {
                if (!s.Void)
                {
                    Card += s.Sum / 100;
                    CardCount++;
                }
                else
                {
                    Vozvr += s.Sum / 100;
                    VozvrCount++;
                }
            }
            List <string> ReportStrings = new List <string>();

            ReportStrings.Add("ОБЩИЙ ОТЧЕТ &&  " + DateTime.Now.ToString("dd/MM/yyyy"));
            ReportStrings.Add("ПО ЭМИТЕНТАМ &&  " + DateTime.Now.ToString("HH:mm"));
            ReportStrings.Add("   ");
            ReportStrings.Add("ОПЛАТ && " + CardCount + "   " + "RUR " + Card.ToString("0.00"));
            ReportStrings.Add("   ");
            ReportStrings.Add("ВОЗВРАТОВ && " + VozvrCount + "   " + "RUR " + Vozvr.ToString("0.00"));
            ReportStrings.Add("   ");
            ReportStrings.Add("ИТОГО && " + (CardCount - VozvrCount) + "   " + "RUR " + (Card - Vozvr).ToString("0.00"));
            ReportStrings.Add("   ");
            ReportStrings.Add("   ");
            string OutStr = "";

            foreach (String s in ReportStrings)
            {
                OutStr += s + " " + char.ConvertFromUtf32(10)[0];
            }
            Utils.ToCardLog("ReportStrings" + OutStr + char.ConvertFromUtf32(31)[0]);
            //ToShtrih.Init();
            //ToShtrih.Conn();
            PrintSlip(OutStr + char.ConvertFromUtf32(31)[0]);
            //ToShtrih.PrintCardCheck(OutStr + char.ConvertFromUtf32(31)[0]);
        }
        //public int Num = 0;
        override protected void OkEvent(int Num)
        {
            SlipNumber = Num;
            string s = "";

            if (Arcus)
            {
                ArcusAlohaIntegrator.GetSipCopy(Num);
            }
            else
            {
                TrPosXAlohaIntegrator.GetJRNCheck(Num, false);
            }

            if (iniFile.Arcus2Enabled)
            {
            }

            this.Hide();
        }
示例#4
0
        internal static void ApplyCardPayment(int ManagerId, int EmployeeId, int QueueId, int TableId, int CheckId, int TenderId, int PaymentId)
        {
            if ((TenderId == 20) && (EmployeeId != iniFile.RemoteCloseEmployee))
            {
                if (MainClass.ComApplyPayment)
                {
                    Utils.ToLog("MainClass.ComApplyPayment return");
                    MainClass.ComApplyPayment = false;
                    return;
                }
                if ((!iniFile.TRPOSXEnables) && (!iniFile.ArcusEnabled))
                {
                    return;
                }


                Utils.ToLog("Создаю форму вопроса безналичной оплаты");

                FTermonalSelect M3 = new FTermonalSelect();
                M3.ShowDialog();
                if (M3.Cancel)
                {
                    M3.Dispose();
                    return;
                }
                M3.Dispose();

                if (MainClass.IsWiFi == 2)
                {
                    return;
                }


                if (MainClass.PlasticTransactionInProcess)
                {
                    MF2 MesFrm = new MF2("Предыдущая транзакция еще не завершена.");
                    MesFrm.button1.Visible = false;
                    MesFrm.button3.Visible = false;
                    MesFrm.button2.Text    = "Ок";
                    MesFrm.ShowDialog();
                }
                else
                {
                    MainClass.PlasticTransactionInProcess = true;
                    // string Resp = "";
                    // string Rcp = "";
                    // string RespMes = "";
                    FiskInfo fi = PDiscountCard.CloseCheck.ReadFiskInfo();
                    bool     AllChecksOnTable = false;

                    {
                        //  ToShtrih.GetPrinterStatus();
                        //Check Ch = AlohaTSClass.GetCheckById(CheckId);

                        Utils.ToLog("Безналичная оплата. Читаю параметры чека № " + CheckId + " Попытка 1", 2);
                        Check Ch = AlohaTSClass.GetCheckById(CheckId);
                        if (Ch == null)
                        {
                            Thread.Sleep(500);
                            Utils.ToLog("Безналичная оплата. Читаю параметры чека № " + CheckId + " Попытка 2", 2);
                            AlohaTSClass.InitAlohaCom();
                            Ch = AlohaTSClass.GetCheckById(CheckId);
                            if (Ch == null)
                            {
                                Thread.Sleep(500);
                                Utils.ToLog("Безналичная оплата. Читаю параметры чека № " + CheckId + " Попытка 3", 2);
                                AlohaTSClass.InitAlohaCom();
                                Ch = AlohaTSClass.GetCheckById(CheckId);
                                if (Ch == null)
                                {
                                    Thread.Sleep(500);
                                    Utils.ToLog("Безналичная оплата. Читаю параметры чека № " + CheckId + " Попытка 4", 2);
                                    AlohaTSClass.InitAlohaCom();
                                    Ch = AlohaTSClass.GetCheckById(CheckId);
                                }
                            }
                        }
                        if (Ch == null)
                        {
                            AlohaTSClass.ShowMessage("Не удалось прочитать параметры чека ");
                            Utils.ToLog("Безналичная оплата. Не удалось прочитать параметры чека № " + CheckId, 2);
                            MainClass.PlasticTransactionInProcess = false;
                            return;
                        }

                        if (Ch.ChecksOnTable.Count > 1)
                        {
                            FTwoChecks FT = new FTwoChecks();
                            FT.Init(Ch.ChecksOnTable);
                            FT.ShowDialog();
                            if (FT.Cancel)
                            {
                                FT.Dispose();
                                MainClass.PlasticTransactionInProcess = false;
                                return;
                            }

                            if (FT.Result == 1)
                            {
                                AllChecksOnTable = true;
                            }
                            FT.Dispose();
                        }


                        int LastTr = fi.CardTransID;


                        try
                        {
                            if (iniFile.ArcusEnabled)
                            {
                                Utils.ToCardLog("Arcus. Инициалазирую оплату ");
                                ArcusAlohaIntegrator.RunOper(Ch, LastTr, AllChecksOnTable, fi, PaymentId);
                            }
                            else
                            {
                                Utils.ToCardLog("TrPosX. Инициалазирую оплату ");
                                TrPosXAlohaIntegrator.RunOper(Ch, LastTr, AllChecksOnTable, fi, PaymentId);
                            }
                        }
                        catch (Exception e)
                        {
                            Utils.ToCardLog("[Error]. Инициалазации оплаты " + e.Message);
                        }
                    }
                }
            }
        }
示例#5
0
        internal static void EOD()
        {
            try
            {
                Utils.ToLog("Закрытие дня");

                //RunExport();

                try
                {
                    if ((iniFile.FRSEnabled) && (iniFile.FRSMaster))
                    {
                        FRSClientApp.FRSClient.ZReport(AlohainiFile.BDate);
                    }

                    if (iniFile.TRPOSXEnables)
                    {
                        if (!TrPosXAlohaIntegrator.Sverka())
                        {
                            FiskInfo fi = PDiscountCard.CloseCheck.ReadFiskInfo();
                            fi.NeedSverka = true;
                            PDiscountCard.CloseCheck.WriteFiskInfo(fi);
                        }
                        else
                        {
                            PDiscountCard.CloseCheck.ZeroPlastNum();
                            FiskInfo fi = PDiscountCard.CloseCheck.ReadFiskInfo();
                            fi.NeedSverka = false;
                            PDiscountCard.CloseCheck.WriteFiskInfo(fi);
                        }
                    }
                    if (iniFile.ArcusEnabled)
                    {
                        if (!ArcusAlohaIntegrator.Sverka())
                        {
                            FiskInfo fi = PDiscountCard.CloseCheck.ReadFiskInfo();
                            fi.NeedSverka = true;
                            PDiscountCard.CloseCheck.WriteFiskInfo(fi);
                        }
                        else
                        {
                            PDiscountCard.CloseCheck.ZeroPlastNum();
                            FiskInfo fi = PDiscountCard.CloseCheck.ReadFiskInfo();
                            fi.NeedSverka = false;
                            PDiscountCard.CloseCheck.WriteFiskInfo(fi);
                        }
                    }

                    /*
                     * if (iniFile.InPasEnabled)
                     * {
                     *  DualConnector.DualConnectorMain.Sverka();
                     * }
                     * */
                    if (CreditCardAlohaIntegration.CreditCardConnectorEnabled)
                    {
                        CreditCardAlohaIntegration.RunSverka();
                    }
                }
                catch (Exception ee)
                {
                    Utils.ToLog(ee.Message);
                }



                do
                {
                    Thread.CurrentThread.Join(3000);
                }while (MainClass.FiskalPrinterIsPrinting);

                string Status = "";

                if (!iniFile.FRSEnabled)
                {
                    Utils.ToLog("!iniFile.FRSEnabled");
                    if (iniFile.FiskalDriverNonShtrih)
                    {
                        Utils.ToLog("iniFile.FiskalDriverNonShtrih");
                        FiskalDrivers.FiskalDriver.PrintZReport();
                        Hamster.HamsterWorker.MoveHamster();
                    }
                    else
                    {
                        if (!Shtrih2.ClosedSmenaInternal(out Status))
                        {
                            //Shtrih2.ZReport();
                            ZReport();
                        }
                        else
                        {
                            Utils.ToLog("Принтер с закрытой сменой. Status :" + Status);
                        }
                    }

                    /*
                     * if (iniFile.FiskalDriverNonShtrihAlohaReport)
                     * {
                     *
                     * }
                     * */
                }

                /*
                 * else
                 * {
                 * if (!Shtrih2.ClosedSmenaInternal(out Status))
                 * {
                 *
                 *  RunFiskalChanger();
                 * }
                 * else
                 * {
                 *  Utils.ToLog("Принтер с закрытой сменой. Status :" + Status);
                 * }
                 * }
                 */
                Shtrih2.ExitFiskalThread();
            }
            catch (Exception e)
            {
                Utils.ToLog(e.Message);
            }
        }
        public void Custom(string Name)
        {
            try
            {
                Utils.ToLog("Custom " + Name);
                if (Name == "DeleteItemsAndCloseCheck")
                {
                    Utils.ToCardLog("DeleteItemsAndCloseCheck");
                    AlohaEventVoids.DeleteItemsAndCloseCheck();
                }
                if (Name == "PrintCheck")
                //  else if (Name == "PlasticCopySlip")
                {
                    if (iniFile.PrintPrecheckOnFR)
                    {
                        AlohaEventVoids.PrintCurentPrecheckOnFR();
                    }
                    else
                    {
                        AlohaTSClass.PrintCurentPredcheck();
                    }
                    return;
                    //AlohaEventVoids.CloseCheck();
                }
                if (Name == "CloseCheck")
                {
                    AlohaEventVoids.CloseCheck();
                }
                if (Name == "XReport")
                {
                    Utils.ToCardLog("Custom XReport");
                    AlohaEventVoids.XReport();
                }
                if (Name == "XReportHamster")
                {
                    AlohaEventVoids.XReportHamster();
                }
                if (Name == "ZReport")
                {
                    AlohaEventVoids.ZReport();
                }
                if (Name == "OrderItems")
                {
                    AlohaEventVoids.OrderItems();
                }
                if (Name == "ApplyPayment5000")
                {
                    AlohaEventVoids.ApplyPayment(5000);
                }
                if (Name == "ShowReportSale")
                {
                    AlohaEventVoids.ShowReportSale();
                }
                if (Name == "ShowTotalSumm")
                {
                    AlohaEventVoids.ShowTotalSumm();
                    //AlohaTSClass.GetSelectedItems();
                    //OrderDivider.OrderItems();
                    //OrderDivider.HideWindow();
                }
                if (Name == "OrderItemsWithDivide")
                {
                    OrderDivider.OrderItems(false);
                }
                if (Name == "OrderAllItemsWithDivide")
                {
                    OrderDivider.OrderItems(true);
                }


                if (Name == "AddWaiterToCheck")
                {
                    AlohaEventVoids.AddWaiterToCheck();
                }

                if (Name == "Plastik")
                {
                    if (iniFile.ArcusEnabled)
                    {
                        ArcusAlohaIntegrator.XReport();
                    }
                    else if (iniFile.TRPOSXEnables)
                    {
                        TrPosXAlohaIntegrator.FoolReport();
                    }
                }
                if (Name == "PlastikXReport")
                {
                    if (iniFile.ArcusEnabled)
                    {
                        ArcusAlohaIntegrator.PrintShortReport();
                        //AlohaEventVoids.TestPrintWithPause();
                    }
                    else if (iniFile.TRPOSXEnables)
                    {
                        TrPosXAlohaIntegrator.XReport();
                    }
                    else
                    {
                        AlohaTSClass.ShowMessage("Нет подключенных безналичных терминалов. TRPOSXEnables=0 и ArcusEnabled=0");
                    }
                }
                else if (Name == "PlasticSverka")
                {
                    if (iniFile.ArcusEnabled)
                    {
                        ArcusAlohaIntegrator.SverkaWithQ();
                    }
                    else
                    {
                        TrPosXAlohaIntegrator.SverkaWithQ();
                    }
                }
                else if (Name == "PlasticCopySlip")
                {
                    if (iniFile.ArcusEnabled)
                    {
                        ArcusAlohaIntegrator.GetSipCopy();
                    }
                    else if (iniFile.TRPOSXEnables)
                    {
                        TrPosXAlohaIntegrator.GetSlipCopy();
                    }
                    else
                    {
                        AlohaTSClass.ShowMessage("Нет подключенных безналичных терминалов. TRPOSXEnables=0 и ArcusEnabled=0 ");
                    }
                }

                else if (Name == "ShowStopList")
                {
                    //  AlohaEventVoids.ShowStopListReason();
                    AlohaEventVoids.ShowStopList();
                }
                else if (Name == "ShowStopListReason")
                {
                    AlohaEventVoids.ShowStopListReason();
                }
                else if (Name == "Degustations")
                {
                    AlohaEventVoids.Degustations();
                }
                if (Name == "Payment")
                {
                    DisplayBoardClass.ApplyPaymentEvent();
                }
                if (Name == "ShowfrmCard")
                {
                    AlohaEventVoids.ShowfrmCard();
                }
                if (Name == "ShowfrmModifItem")
                {
                    AlohaEventVoids.ShowfrmModifItem();
                }
                if (Name.Length > 5)
                {
                    if (Name.Substring(0, 5) == "Scale")
                    {
                        AlohaEventVoids.AddScaleDish2(Name);
                    }
                }
                if (Name == "VIP")
                {
                    AlohaEventVoids.SetVip();
                }
                if (Name == "FCCShowAdmin")
                {
                    FCC.ShowAdmin();
                }
                if (Name == "FCCSetBill")
                {
                    FCC.SetBill();
                }
                if (Name == "FCCSetBillWithHands")
                {
                    //FCC.SetBillWithHands();
                }
                if (Name == "FCCShowCassir")
                {
                    FCC.ShowCassirFrm();
                }
                if (Name == "FCCInspectSmallChange")
                {
                    FCC.InpectSmallChange(true);
                }


                if (Name == "ShowCashIncome")
                {
                    AlohaEventVoids.ShowFrmCashIn();
                }
                if (Name == "FCCShowRazmen")
                {
                    FCC.ShowRazmen();
                    // DualConnector.DualConnectorMain.InFuncsfrm();
                }

                if (Name == "CloseByWaiter")
                {
                    AlohaEventVoids.CloseByWaiter();
                }
                if (Name == "CloseByWaiterCard")
                {
                    AlohaEventVoids.CloseByWaiter(2);
                }
                if (Name == "CloseByWaiterGlory")
                {
                    if (!AlohaTSClass.IsAlohaTS() && !iniFile.FCCEnable)
                    {
                        Utils.ToLog("CloseByWaiterGlory && (!AlohaTSClass.IsAlohaTS() && !iniFile.FCCEnable)");
                        AlohaEventVoids.CloseCheck();
                    }
                    else
                    {
                        AlohaEventVoids.CloseByWaiter(1);
                    }
                }

                /*
                 *
                 * if (Name == "InPasShortReport")
                 * {
                 *  DualConnector.DualConnectorMain.ShortReport();
                 * }
                 * if (Name == "InPasFullReport")
                 * {
                 *  DualConnector.DualConnectorMain.LongReport();
                 * }
                 * if (Name == "InPasSverka")
                 * {
                 *  DualConnector.DualConnectorMain.Sverka();
                 * }
                 *
                 * if (Name == "InPasLastChk")
                 * {
                 *  DualConnector.DualConnectorMain.GetCopyLastSlip();
                 * }
                 *
                 * if (Name == "InPasAnyChk")
                 * {
                 *  DualConnector.DualConnectorMain.GetCopySlip();
                 * }
                 * */
                if ((Name == "InPasFuncsfrm") || ((Name == "PlasticFuncsfrm")))
                {
                    /*
                     * if (iniFile.InPasEnabled)
                     * {
                     *  DualConnector.DualConnectorMain.InPasFuncsfrm();
                     * }
                     * else
                     * */
                    {
                        CreditCardAlohaIntegration.ShowFuncsfrm();
                    }
                }

                if (Name == "WestReport0")
                {
                    West.WestMain.ShowSaleReport(0);
                }
                if (Name == "WestReport1")
                {
                    West.WestMain.ShowSaleReport(1);
                }
                if (Name == "WestPager")
                {
                    West.WestMain.mShowPagerDialog();
                }
                if (Name == "BonusCardReport")
                {
                    Loyalty.LoyaltyBasik.PrintLongSlipReport();
                }

                if (Name == "EGAISScan")
                {
                    EGAIS.EGAISCodeReader.Read();
                }
                if (Name == "ReprintCheck")
                {
                    FRSClientApp.FRSClient.PrintFCheckShowWnd();
                }
                if (Name == "FayRetailCard")
                {
                    FayRetail.FayRetailMain.ShowWndApplyCardWithCurentCheck();
                }
                if (Name == "PBFirstRequest")
                {
                    MB.PB.SendCurentChk();
                }
            }
            catch (Exception e)
            {
                Utils.ToCardLog("[Error] Custom " + Name + ", Mess: " + e.Message);
            }

            /*
             * else if (Name == "PlastikVozvrat")
             * {
             * TrPosXClass.Void(100) ;
             * }
             * */
        }
示例#7
0
        static private void RunOper()
        {
            try
            {
                Utils.ToCardLog("Запуск RunOper OperType=" + OperType.ToString() + " Amount= " + Amount.ToString());
                OperInProcess = true;
                SAPacketObj        Request  = new SAPacketObj();
                SAPacketObj        Response = new SAPacketObj();
                PCPOSTConnectorObj Conn     = new PCPOSTConnectorObj();
                Request.Amount        = (Amount * 100).ToString();
                Request.OperationCode = OperType;
                Request.CurrencyCode  = "643";
                Request.DateTimeHost  = DateTime.Now.ToString("yyyyMMddHHmmss");

                //Conn.InitResources();
                Conn.Exchange(ref Request, ref Response, 10);

                RespCode = Response.ResponseCodeHost.Trim();

                Utils.ToCardLog("[RunOper] Операция выполнена. Результат: " + RespCode);
                Receipt = ReadChequeFile();
                if ((RespCode == "00") || (RespCode == "000"))
                {
                    if ((OperType == 1) || (OperType == 4))
                    {
                        string Tmp = Receipt;
                        Tmp    += Convert.ToChar(31) + Environment.NewLine;
                        Tmp    += Receipt;
                        Receipt = Tmp;

                        try
                        {
                            Utils.ToCardLog("[RunOper] Добавляю Слип в Файл.");

                            ArcusSlips AS  = ArcusAlohaIntegrator.ReadArcusSlips();
                            DateTime   HDT = DateTime.Now;
                            try
                            {
                                HDT = Convert.ToDateTime(Response.DateTimeCRM);
                            }
                            catch
                            { }
                            ArcusSlip S = new ArcusSlip()
                            {
                                HostDt = HDT,
                                Sum    = Convert.ToDecimal(Response.Amount),
                                Void   = (Response.OperationCode == 4),
                                Num    = Response.TrxIDCRM
                            };

                            string[] Str = Receipt.Split(char.ConvertFromUtf32(10)[0]);

                            foreach (string str in Str)
                            {
                                Utils.ToCardLog(str);
                                S.Slip.Add(str);
                            }

                            decimal SummFromTxt = GetSummFromSlip(S.Slip);

                            if ((SummFromTxt != 0) && (S.Sum != SummFromTxt * 100))
                            {
                                Utils.ToCardLog("Error Разные суммы в слипе " + SummFromTxt.ToString() + " и ответе от терминала. " + S.Sum.ToString());
                                S.Sum = SummFromTxt * 100;
                            }

                            AS.Slips.Add(S);

                            ArcusAlohaIntegrator.WriteArcusSlips(AS);

                            Utils.ToCardLog("[RunOper] Добавлил Слип в Файл.");
                        }
                        catch (Exception e)
                        {
                            Utils.ToCardLog("[Error] Ошибка добавления слипа в файл." + e.Message);
                        }
                    }
                }
                else
                {
                    try
                    {
                        EventSenderClass.SendAlohaAsincEvent(StopListService.AlohaEventType.ErrorCreditCardterminal, "", AlohaTSClass.AlohaCurentState.WaterId,
                                                             AlohaTSClass.GetJobCode(AlohaTSClass.AlohaCurentState.WaterId),
                                                             "",
                                                             Convert.ToInt32(RespCode),
                                                             (int)AlohaTSClass.AlohaCurentState.TableId,
                                                             (int)AlohaTSClass.AlohaCurentState.CheckId);
                    }
                    catch
                    { }
                }
                resOper = GetCodeDescr(RespCode);
                if (!Sinc)
                {
                    RunOperationAsincComplitedVoid(RespCode, resOper, "", Receipt);
                }
                OperInProcess = false;
                Utils.ToCardLog("Отработал RunOper OperType=" + OperType.ToString() + " Amount= " + Amount.ToString());
            }
            catch (Exception e)
            {
                resOper  = "Ошибка программы. " + e.Message;
                RespCode = "-1";
                if (!Sinc)
                {
                    RunOperationAsincComplitedVoid(RespCode, resOper, "", "");
                }
                Utils.ToCardLog("[Error] Запускa RunOper " + e.Message);
            }
        }