Пример #1
0
        protected void PrintFooter()
        {
            try
            {
                //Align Center
                _thermalPrinterGeneric.SetAlignCenter();

                //Set Font Size: Small
                _thermalPrinterGeneric.SetFont(1);

                //User : Terminal
                _thermalPrinterGeneric.WriteLine(string.Format("{0} - {1}", GlobalFramework.LoggedUser.Name, GlobalFramework.LoggedTerminal.Designation));
                _thermalPrinterGeneric.LineFeed();

                //Printed On | Company|App|Version
                _thermalPrinterGeneric.WriteLine(string.Format("{1}: {2}{0}{3}: {4} {5}"
                                                               , Environment.NewLine
                                                               , CustomFunctions.Res("global_printed_on_date")
                                                               , FrameworkUtils.CurrentDateTimeAtomic().ToString(SettingsApp.DateTimeFormat)
                                                               , _customVars["APP_COMPANY"]
                                                               , _customVars["APP_NAME"]
                                                               , _customVars["APP_VERSION"]
                                                               )
                                                 ); /* IN009211 */

                //Reset Font Size: Normal
                _thermalPrinterGeneric.SetFont(0);

                //Line Feed
                _thermalPrinterGeneric.LineFeed();

                //Reset to Left
                _thermalPrinterGeneric.SetAlignLeft();

                //Finish With Cut and Print Buffer
                //TK016249 - Impressoras - Diferenciação entre Tipos
                _thermalPrinterGeneric.Cut(true, GlobalFramework.LoggedTerminal.ThermalPrinter.ThermalCutCommand);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        public static void Print(sys_configurationprinters pPrinter)
        {
            try
            {
                ThermalPrinterGeneric thermalPrinterGeneric = new ThermalPrinterGeneric(pPrinter);

                List <TicketColumn> columns = new List <TicketColumn>();
                columns.Add(new TicketColumn("Code", "Code", 6, TicketColumnsAlign.Right));
                columns.Add(new TicketColumn("Designation", CustomFunctions.Res("global_designation"), 0));
                columns.Add(new TicketColumn("Quantity", "Qnt", 7, TicketColumnsAlign.Right, typeof(decimal), "{0:0.00}"));
                columns.Add(new TicketColumn("UnitMeasure", "UM", 3));
                columns.Add(new TicketColumn("Price", "Preço", 10, TicketColumnsAlign.Right, typeof(decimal), "{0:0.00}"));
                columns.Add(new TicketColumn("Tax", "Taxa", 7, TicketColumnsAlign.Right, typeof(decimal), "{0:0.00}"));
                columns.Add(new TicketColumn("Discount", "Desc", 7, TicketColumnsAlign.Right, typeof(decimal), "{0:0.00}"));
                columns.Add(new TicketColumn("Total", "Total", 11, TicketColumnsAlign.Right, typeof(decimal), "{0:0.00}"));

                string sql = string.Format(@"
                    SELECT 
                        Code,Designation,Quantity,UnitMeasure,Price,Vat,Discount,TotalFinal
                    FROM 
                        fin_documentfinancedetail 
                    WHERE 
                        DocumentMaster = '{0}'
                    ORDER 
                        BY Ord
                    ;",
                                           SettingsApp.XpoPrintFinanceDocument
                                           );
                TicketTable ticketTable = new TicketTable(sql, columns, thermalPrinterGeneric.MaxCharsPerLineSmall);
                ticketTable.Print(thermalPrinterGeneric);
                //Cut
                thermalPrinterGeneric.Cut(true);
                //Print Buffer
                thermalPrinterGeneric.PrintBuffer();

                //Get Result Objects
                ResultFRBODocumentFinanceMaster           FRBOHelperResponseProcessReportFinanceDocument = FRBOHelper.GetFRBOFinanceDocument(SettingsApp.XpoPrintFinanceDocument);
                List <FRBODocumentFinanceMasterView>      gcDocumentFinanceMaster      = FRBOHelperResponseProcessReportFinanceDocument.DocumentFinanceMaster.List;
                List <FRBODocumentFinanceDetail>          gcDocumentFinanceDetail      = FRBOHelperResponseProcessReportFinanceDocument.DocumentFinanceMaster.List[0].DocumentFinanceDetail;
                List <FRBODocumentFinanceMasterTotalView> gcDocumentFinanceMasterTotal = FRBOHelperResponseProcessReportFinanceDocument.DocumentFinanceMaster.List[0].DocumentFinanceMasterTotal;;

                _log.Debug(string.Format("DocumentNumber: [{0}]", gcDocumentFinanceMaster[0].DocumentNumber));

                foreach (FRBODocumentFinanceDetail item in gcDocumentFinanceDetail)
                {
                    _log.Debug(string.Format("Designation: [{0}], Price: [{1}]", item.Designation, item.Price));
                }

                foreach (FRBODocumentFinanceMasterTotalView item in gcDocumentFinanceMasterTotal)
                {
                    _log.Debug(string.Format("Designation: [{0}], Value :[{1}]", item.Designation, item.Value));
                }

                Dictionary <string, string> CustomVars = GlobalFramework.FastReportCustomVars;
                _log.Debug(string.Format("Company_Name: [{0}]", CustomVars["Company_Name"]));

                //ThermalPrinterFinanceDocument thermalPrinterFinanceDocument = new ThermalPrinterFinanceDocument(pPrinter);
                //thermalPrinterFinanceDocument.Print();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }