Esempio n. 1
0
        private static void PrintArticlePrinters(FIN_DocumentOrderTicket pOrderTicket)
        {
            //Initialize printerArticleQueue to Store Articles > Printer Queue
            List <SYS_ConfigurationPrinters> printerArticles = new List <SYS_ConfigurationPrinters>();

            foreach (FIN_DocumentOrderDetail item in pOrderTicket.OrderDetail)
            {
                if (item.Article.Printer != null && item.Article.Printer.PrinterType.ThermalPrinter)
                {
                    //Add Printer
                    if (!printerArticles.Contains(item.Article.Printer))
                    {
                        printerArticles.Add(item.Article.Printer);
                    }
                }
            }
            //Print Tickets for Article Printers
            if (printerArticles.Count > 0)
            {
                foreach (SYS_ConfigurationPrinters item in printerArticles)
                {
                    ThermalPrinterInternalDocumentOrderRequest thermalPrinterInternalDocumentOrderRequest = new ThermalPrinterInternalDocumentOrderRequest(item, pOrderTicket, true);
                    thermalPrinterInternalDocumentOrderRequest.Print();
                    Console.WriteLine(string.Format("ThermalPrinterInternalDocumentOrderRequest Printed for {1}: {0}", pOrderTicket.Oid, item.Designation));
                }
            }
        }
Esempio n. 2
0
        public static void Print(SYS_ConfigurationPrinters pPrinter)
        {
            try
            {
                FIN_DocumentOrderTicket orderTicket = (FIN_DocumentOrderTicket)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_DocumentOrderTicket), SettingsApp.XpoPrintDocumentOrderTicket);

                //Print Document
                if (orderTicket != null)
                {
                    //Test Print Document
                    ThermalPrinterInternalDocumentOrderRequest thermalPrinterInternalDocumentOrderRequest = new ThermalPrinterInternalDocumentOrderRequest(pPrinter, orderTicket);
                    thermalPrinterInternalDocumentOrderRequest.Print();
                    Console.WriteLine(string.Format("ThermalPrinterInternalDocumentOrderRequest Printed: {0}", orderTicket.Oid));

                    //Call PrintArticlePrinters
                    PrintArticlePrinters(orderTicket);
                }
                else
                {
                    Console.WriteLine(string.Format("ERROR: ThermalPrinterInternalDocumentOrderRequest NULL: {0}", orderTicket.Oid));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        void buttonPrintOrder_Clicked(object sender, EventArgs e)
        {
            if (Utils.ShowMessageTouchRequiredValidPrinter(this))
            {
                return;
            }

            string    sql = string.Empty;
            OrderMain currentOrderMain = GlobalFramework.SessionApp.OrdersMain[GlobalFramework.SessionApp.CurrentOrderMainOid];
            Guid      orderTicketOid   = new Guid();

            sql = string.Format(@"SELECT COUNT(*) AS Count FROM fin_documentorderticket WHERE OrderMain = '{0}';", currentOrderMain.PersistentOid);
            var countTickets = GlobalFramework.SessionXpo.ExecuteScalar(sql);

            //If has more than one ticket show requestTicket dialog
            if (countTickets != null && Convert.ToInt16(countTickets) > 1)
            {
                CriteriaOperator criteria = CriteriaOperator.Parse(string.Format("OrderMain = '{0}'", currentOrderMain.PersistentOid));
                PosSelectRecordDialog <XPCollection, XPGuidObject, TreeViewDocumentOrderTicket>
                dialog = new PosSelectRecordDialog <XPCollection, XPGuidObject, TreeViewDocumentOrderTicket>(
                    this.SourceWindow,
                    DialogFlags.DestroyWithParent,
                    resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_select_ticket"),
                    //TODO:THEME
                    GlobalApp.MaxWindowSize,
                    null, //XpoDefaultValue
                    criteria,
                    GenericTreeViewMode.Default,
                    null  //pActionAreaButtons
                    );

                int response = dialog.Run();
                if (response == (int)ResponseType.Ok)
                {
                    orderTicketOid = dialog.GenericTreeView.DataSourceRow.Oid;
                }
                dialog.Destroy();
            }
            //Else Print Unique Ticket
            else
            {
                sql = string.Format(@"SELECT Oid FROM fin_documentorderticket WHERE OrderMain = '{0}';", currentOrderMain.PersistentOid);
                //_log.Debug(string.Format("sql: [{0}]", sql));
                orderTicketOid = FrameworkUtils.GetGuidFromQuery(sql);
            }

            if (orderTicketOid != new Guid())
            {
                fin_documentorderticket orderTicket = (fin_documentorderticket)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_documentorderticket), orderTicketOid);
                //POS front-end - Consulta Mesa + Impressão Ticket's + Gerar PDF em modo Thermal Printer [IN009344]
                ThermalPrinterInternalDocumentOrderRequest thermalPrinterInternalDocumentOrderRequest = new ThermalPrinterInternalDocumentOrderRequest(GlobalFramework.LoggedTerminal.ThermalPrinter, orderTicket);
                thermalPrinterInternalDocumentOrderRequest.Print();
            }
        }
Esempio n. 4
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //PrintTableTicket

        public static bool PrintOrderRequest(Window pSourceWindow, sys_configurationprinters pPrinter, OrderMain pDocumentOrderMain, fin_documentorderticket pOrderTicket)
        {
            bool result = false;

            try
            {
                if (SharedPrintTicket(pSourceWindow, pPrinter, TicketType.TableOrder))
                {
                    ThermalPrinterInternalDocumentOrderRequest thermalPrinterInternalDocumentOrderRequest = new ThermalPrinterInternalDocumentOrderRequest(pPrinter, pOrderTicket);
                    thermalPrinterInternalDocumentOrderRequest.Print();
                }
            }
            catch (Exception ex)
            {
                Utils.ShowMessageTouchErrorPrintingTicket(pSourceWindow, pPrinter, ex);
            }

            return(result);
        }
Esempio n. 5
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

        public static bool PrintArticleRequest(FIN_DocumentOrderTicket pOrderTicket)
        {
            bool result = false;

            try
            {
                //Initialize printerArticleQueue to Store Articles > Printer Queue
                List <SYS_ConfigurationPrinters> printerArticles = new List <SYS_ConfigurationPrinters>();
                foreach (FIN_DocumentOrderDetail item in pOrderTicket.OrderDetail)
                {
                    if (item.Article.Printer != null && item.Article.Printer.PrinterType.ThermalPrinter)
                    {
                        //Add Printer
                        if (!printerArticles.Contains(item.Article.Printer))
                        {
                            printerArticles.Add(item.Article.Printer);
                        }
                    }
                }

                //Print Tickets for Article Printers
                if (printerArticles.Count > 0)
                {
                    foreach (SYS_ConfigurationPrinters item in printerArticles)
                    {
                        ThermalPrinterInternalDocumentOrderRequest thermalPrinterInternalDocumentOrderRequest = new ThermalPrinterInternalDocumentOrderRequest(item, pOrderTicket, true);
                        thermalPrinterInternalDocumentOrderRequest.Print();
                    }
                }
                result = true;
            }
            catch (Exception ex)
            {
                _log.Warn(ex.Message, ex);
                throw new Exception(ex.Message);
            }

            return(result);
        }