Beispiel #1
0
 public static void XReport()
 {
     FRSSrv.RemoteDataClient FClient = GetFRSClient();
     if (FClient != null)
     {
         FRSSrv.XReportResponce res = FClient.XReport(AlohainiFile.BDate, AlohainiFile.DepNum, AlohaTSClass.GetTermNum());
         if (res.Result)
         {
             if (iniFile.XFromGes)
             {
                 decimal cash = 0;
                 decimal card = 0;
                 GesData.GetGesData(AlohainiFile.BDate, AlohainiFile.DepNum, out cash, out card);
                 decimal VCash = 0;
                 try { VCash = res.VoidPayments.Where(a => a.ExternalId == 1 && a.Term == 0).First().Summ; }
                 catch { }
                 try { res.Payments.Where(a => a.ExternalId == 1 && a.Term == 0).First().Summ = cash + VCash; }
                 catch { }
             }
             //if (iniFile.FRSPrintCheck)
             {
                 PrintOnWinPrinter.PrintDoc2(FiscalCheckCreator.GetXReportVisual(res));
             }
         }
         FClient.Close();
     }
 }
Beispiel #2
0
        public static void ZReport(DateTime BD)
        {
            Utils.ToCardLog("FClient.ZReport");
            FRSSrv.RemoteDataClient FClient = GetFRSClient();
            //DateTime BD = AlohainiFile.BDate;

            if (FClient != null)
            {
                FRSSrv.ZReportResponce Res = null;
                try
                {
                    Res = FClient.ZReport(AlohainiFile.DepNum, AlohaTSClass.GetTermNum(), BD);
                }
                catch (Exception e)
                {
                    Utils.ToCardLog("Error  FClient.ZReport" + e.Message);
                    ZReportAskSaver.SaveZRepFRSAsk(BD);
                }
                if (Res != null)
                {
                    if (Res.Result)
                    {
                        if (iniFile.XFromGes)
                        {
                            decimal cash = 0;
                            decimal card = 0;
                            GesData.GetGesData(AlohainiFile.BDate, AlohainiFile.DepNum, out cash, out card);
                            decimal VCash = 0;
                            try { VCash = Res.OutData.VoidPayments.Where(a => a.ExternalId == 1 && a.Term == 0).First().Summ; }
                            catch { }
                            try { Res.OutData.Payments.Where(a => a.ExternalId == 1 && a.Term == 0).First().Summ = cash + VCash; }
                            catch { }
                        }


                        //if (iniFile.FRSPrintCheck)
                        {
                            if (Res.OutData.Payments.Count() > 0)
                            {
                                Utils.ToCardLog("FClient.ZReport print");
                                PrintOnWinPrinter.PrintDoc2(FiscalCheckCreator.GetEndOfSmenaVisual(Res));
                            }
                            else
                            {
                                PrintOnWinPrinter.PrintDoc2(FiscalCheckCreator.GetZReportVisual(Res));
                            }
                        }
                    }
                }
                FClient.Close();
            }
            else
            {
                Utils.ToCardLog("FClient == null");
                ZReportAskSaver.SaveZRepFRSAsk(BD);
            }
        }
Beispiel #3
0
        public static void ReprintFChk(Guid CheckId)
        {
            try
            {
                FRSSrv.RemoteDataClient FClient = GetFRSClient();
                if (FClient != null)
                {
                    FRSSrv.AddCheckResponce Resp = FClient.PrintCheck(CheckId);

                    if (Resp.Check.Sucсess)
                    {
                        Utils.ToCardLog("ReprintFChk ExtNum " + Resp.Check.ExtNum + " ReprintFChk");
                        //  if (iniFile.FRSPrintCheck)
                        {
                            PrintOnWinPrinter.PrintDoc2(new PrintDocArgs()
                            {
                                FStrs = FiscalCheckCreator.GetFisckalCheckVisual(Resp), QRAsStr = Resp.Check.FROutData.QRAsStr
                            });
                        }
                    }
                    try
                    {
                        if (Resp.ParentCheck != null)
                        {
                            if (Resp.ParentCheck.Sucсess)
                            {
                                Utils.ToCardLog("ReprintFChk Parent ExtNum " + Resp.Check.ExtNum + " ReprintFChk");
                                //  if (iniFile.FRSPrintCheck)
                                {
                                    PrintOnWinPrinter.PrintDoc2(new PrintDocArgs()
                                    {
                                        FStrs = FiscalCheckCreator.GetFisckalCheckVisual(Resp, true), QRAsStr = Resp.ParentCheck.FROutData.QRAsStr
                                    });
                                }
                            }
                        }
                    }
                    catch (Exception ee)
                    {
                        Utils.ToCardLog("Error SendChk ParentCheck" + ee.Message);
                    }
                    FClient.Close();
                }
            }
            catch (Exception e)
            {
                Utils.ToCardLog("Error SendChk " + e.Message);
            }
        }
Beispiel #4
0
        private static FRSSrv.AddCheckResponce SendChk(FRSSrv.FiskalCheck Chk)
        {
            try
            {
                long Mbefore = GC.GetTotalMemory(false);
                Utils.ToCardLog("SendChk memory " + Mbefore);

                FRSSrv.AddCheckResponce Resp    = new AddCheckResponce();
                FRSSrv.RemoteDataClient FClient = GetFRSClient();
                if (FClient != null)
                {
                    FRSSrv.AddCheckRequest Request = new FRSSrv.AddCheckRequest()
                    {
                        Id    = new Guid(),
                        Check = Chk
                    };

                    Resp = FClient.AddCheck(Request);

                    if (Resp.Check.Sucсess)
                    {
                        Utils.ToCardLog("SendChk ExtNum " + Chk.ExtNum + " ClosedSucsees");

                        if ((iniFile.FRSPrintCheck) && (!Resp.Check.WrongChk))
                        {
                            PrintOnWinPrinter.PrintDoc2(new PrintDocArgs()
                            {
                                FStrs = FiscalCheckCreator.GetFisckalCheckVisual(Resp), QRAsStr = Resp.Check.FROutData.QRAsStr
                            });
                        }
                    }
                    FClient.InnerChannel.Close();
                    FClient.InnerChannel.Dispose();
                    FClient.Close();
                    long MAfter = GC.GetTotalMemory(false);
                    Utils.ToCardLog("SendChk memory " + MAfter);
                }
                return(Resp);
            }
            catch (Exception e)
            {
                Utils.ToCardLog("Error SendChk " + e.Message);
                return(null);
            }



            //System.Windows.Forms.MessageBox.Show(Resp.Check.FD+" "+Resp.Check.FP);
        }
Beispiel #5
0
        public static FRSSrv.RemoteDataClient GetFRSClient()
        {
            try
            {
                Utils.ToCardLog("Init FClient ");

                string CloudAddress = iniFile.FRSSRVPath.Trim();
                if (CloudAddress == "")
                {
                    string myHost = System.Net.Dns.GetHostName();

                    string CloudIP = "";

                    foreach (IPAddress Addr in Dns.GetHostEntry(myHost).AddressList)
                    {
                        if (Addr.ToString().Length > 8)
                        {
                            if (Addr.ToString().Substring(0, 7) == "192.168")
                            {
                                CloudIP = "192.168." + Addr.GetAddressBytes()[2].ToString() + ".47";
                            }
                        }
                    }
                    CloudAddress = String.Format(@"http://{0}:3838/FRSService/RemoteData", CloudIP);
                }
                Utils.ToCardLog("FClient Address: " + CloudAddress);

                System.ServiceModel.Channels.Binding binding = new System.ServiceModel.BasicHttpBinding();
                ((System.ServiceModel.BasicHttpBinding)binding).MaxReceivedMessageSize = 1024 * 1024;
                //System.ServiceModel.EndpointAddress remoteAddress = new System.ServiceModel.EndpointAddress(@"http://192.168.77.7:3838/FRSService/RemoteData");
                //System.ServiceModel.EndpointAddress remoteAddress = new System.ServiceModel.EndpointAddress(iniFile.FRSSRVPath.Trim());
                System.ServiceModel.EndpointAddress remoteAddress = new System.ServiceModel.EndpointAddress(CloudAddress);
                FRSSrv.RemoteDataClient             FClient       = new FRSSrv.RemoteDataClient(binding, remoteAddress);
                FClient.InnerChannel.OperationTimeout = new TimeSpan(0, 5, 0);
                return(FClient);
            }
            catch (Exception e)
            {
                Utils.ToCardLog("Error Init FClient " + e.Message);
                return(null);
            }
        }
Beispiel #6
0
        public static void UpdateItems()
        {
            FRSSrv.RemoteDataClient FClient = GetFRSClient();
            if (FClient != null)
            {
                try
                {
                    var tExDishez = AlohaTSClass.GetExDishez();
                    Utils.ToCardLog("ExDishez: " + String.Join(",", tExDishez));


                    FClient.InitItems(tExDishez.ToArray(), AlohaTSClass.GetExDisc().ToArray());
                    FClient.Close();
                    Utils.ToLog("UpdateItems ok ");
                }
                catch (Exception e)
                {
                    Utils.ToLog("Error UpdateItems: " + e.Message);
                }
            }
        }
Beispiel #7
0
        private static List <FRSSrv.FiskalCheck> GetCurentChecks()
        {
            try
            {
                Utils.ToCardLog("FRS GetCurentChecks");
                List <FRSSrv.FiskalCheck> Tmp     = new List <FiskalCheck>();
                FRSSrv.RemoteDataClient   FClient = GetFRSClient();
                if (FClient != null)
                {
                    int WCode = (AlohaTSClass.IsManager(AlohaTSClass.CurentWaiter) || (!AlohaTSClass.IsTableServise()) ? 0 : AlohaTSClass.CurentWaiter);
                    Tmp = FClient.GetLastChecks(DateTime.Now, AlohainiFile.DepNum, WCode).ToList();
                    FClient.Close();

                    Utils.ToCardLog("Get " + Tmp.Count);
                }
                return(Tmp);
            }
            catch (Exception e)
            {
                Utils.ToCardLog("[Error] FRS GetCurentChecks " + e.Message);
                return(new List <FiskalCheck>());
            }
        }