public static void Print(sys_configurationprinters pPrinter) { try { //Parameters fin_documentfinancepayment documentFinancePayment = (fin_documentfinancepayment)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_documentfinancepayment), SettingsApp.XpoPrintFinanceDocumentPayment); //Print Document if (documentFinancePayment != null) { List <int> copyNames = new List <int> { 0 /*, 1*/ }; //Test Print Document ThermalPrinterFinanceDocumentPayment thermalPrinterFinanceDocumentPayment = new ThermalPrinterFinanceDocumentPayment(pPrinter, documentFinancePayment, copyNames, true); thermalPrinterFinanceDocumentPayment.Print(); Console.WriteLine(string.Format("DocumentFinancePayment Printed: {0}", documentFinancePayment.PaymentRefNo)); } else { Console.WriteLine(string.Format("ERROR: DocumentFinancePayment NULL: {0}", SettingsApp.XpoPrintFinanceDocumentPayment)); } } catch (Exception ex) { throw ex; } }
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: public static bool PrintFinanceDocumentPayment(SYS_ConfigurationPrinters pPrinter, FIN_DocumentFinancePayment pDocumentFinancePayment) { bool result = false; if (pPrinter != null) { //Init Helper Vars bool resultSystemPrint = false; //Initialize CopyNames List from PrintCopies List <int> copyNames = CustomReport.CopyNames(pDocumentFinancePayment.DocumentType.PrintCopies); int printCopies = copyNames.Count; try { switch (GetPrinterToken(pPrinter.PrinterType.Token)) { //Impressora SINOCAN em ambiente Windows case "THERMAL_PRINTER_WINDOWS": //Impressora SINOCAN em ambiente Linux case "THERMAL_PRINTER_LINUX": //Impressora SINOCAN em ambiente WindowsLinux/Socket case "THERMAL_PRINTER_SOCKET": //Impressora SINOCAN em ambiente WindowsLinux/USB case "THERMAL_PRINTER_USB": ThermalPrinterFinanceDocumentPayment thermalPrinterFinanceDocumentPayment = new ThermalPrinterFinanceDocumentPayment(pPrinter, pDocumentFinancePayment, copyNames, false); thermalPrinterFinanceDocumentPayment.Print(); //Add to SystemPrint Audit resultSystemPrint = SystemPrintInsert(pDocumentFinancePayment, pPrinter.Designation, printCopies, copyNames); break; case "GENERIC_PRINTER_WINDOWS": CustomReport.ProcessReportFinanceDocumentPayment(CustomReportDisplayMode.Print, pDocumentFinancePayment.Oid, copyNames); //Add to SystemPrint Audit resultSystemPrint = SystemPrintInsert(pDocumentFinancePayment, pPrinter.Designation, printCopies, copyNames); break; case "REPORT_EXPORT_PDF": CustomReport.ProcessReportFinanceDocumentPayment(CustomReportDisplayMode.ExportPDF, pDocumentFinancePayment.Oid, copyNames); //Add to SystemPrint Audit : Developer : Use here Only to Test SystemPrintInsert resultSystemPrint = SystemPrintInsert(pDocumentFinancePayment, pPrinter.Designation, printCopies, copyNames); break; } result = true; } catch (Exception ex) { _log.Warn(ex.Message, ex); throw new Exception(ex.Message); } } return(result); }