//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 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); }
public ThermalPrinterBaseFinanceTemplate(SYS_ConfigurationPrinters pPrinter, FIN_DocumentFinanceType pDocumentType, List <int> pCopyNames, bool pSecondCopy) : base(pPrinter, SettingsApp.PrinterThermalImageCompanyLogo) { //Assign Parameter Properties _documentType = pDocumentType; _copyNames = pCopyNames; _secondCopy = pSecondCopy; //Generate CopyNamesArray (Original, Duplicate,...) if (_copyNames != null) { _copyNamesArray = CustomReport.CopyNames(pCopyNames); } }
// Test Document Report void TestDocumentReport() { Guid docOid = new Guid("6d44b0a8-6450-4245-b4ee-a6e971f4bcec"); FIN_DocumentFinanceMaster documentFinanceMaster = (FIN_DocumentFinanceMaster)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_DocumentFinanceMaster), docOid); if (documentFinanceMaster != null) { //Generate Default CopyNames from DocumentType List <int> copyNames = CustomReport.CopyNames(documentFinanceMaster.DocumentType.PrintCopies); string hash4Chars = ProcessFinanceDocument.GenDocumentHash4Chars(documentFinanceMaster.Hash); string destinationFileName = ""; string result = CustomReport.ProcessReportFinanceDocument(CustomReportDisplayMode.Design, documentFinanceMaster.Oid, hash4Chars, copyNames, destinationFileName); _log.Debug(String.Format("Result: [{0}]", result)); } else { _log.Debug(String.Format("Null Document Found for documentType: [{0}]", nameof(FIN_DocumentFinanceMaster), docOid.ToString())); } }
//OverLoads DocumentFinancePayment private static bool SystemPrintInsert(FIN_DocumentFinancePayment pDocumentFinancePayment, string PrinterDesignation) { List <int> copyNames = CustomReport.CopyNames(pDocumentFinancePayment.DocumentType.PrintCopies); return(SystemPrintInsert(null, pDocumentFinancePayment, PrinterDesignation, 1, copyNames, false, String.Empty, GlobalFramework.LoggedUser, GlobalFramework.LoggedTerminal)); }
public static PrintDialogResponse GetDocumentFinancePrintProperties(Window pSourceWindow, fin_documentfinancemaster pDocumentFinanceMaster) { //Log4Net log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Init Response PrintDialogResponse result = new PrintDialogResponse(ResponseType.Cancel); try { //TODO: Xpo Required to use ExecuteScalar, else we dont have real value but a cached value //Get Fresh Object to get Printed Status //DocumentFinanceMaster documentFinanceMaster = (DocumentFinanceMaster)GlobalFramework.SessionXpo.GetObjectByKey(typeof(DocumentFinanceMaster), pDocumentFinanceMaster.Oid); //bool printed = documentFinanceMaster.Printed; //Fix Cache Problem var sqlResPrinted = GlobalFramework.SessionXpo.ExecuteScalar(string.Format( "SELECT Printed FROM fin_documentfinancemaster WHERE Oid = '{0}';", pDocumentFinanceMaster.Oid) ); bool printed = (sqlResPrinted != null) ? Convert.ToBoolean(sqlResPrinted) : false; //Call Re-Print Dialog if (printed) { PosDocumentFinancePrintDialog dialog = new PosDocumentFinancePrintDialog(pSourceWindow, DialogFlags.DestroyWithParent, pDocumentFinanceMaster); result.Response = (ResponseType)dialog.Run(); if (result.Response == ResponseType.Ok) { //Modify Result with Dialog Properties result.Items = dialog._checkButtonCopyNamesBoxGroup.Items; //Generate CopyNames from CheckButtonCopyNamesBoxGroup.Items result.CopyNames = new List <int>(); foreach (var item in dialog._checkButtonCopyNamesBoxGroup.Items) { result.CopyNames.Add(item.Key); } result.SecondCopy = dialog._secondCopy; if (dialog._entryBoxValidationBoxMotive != null) { result.Motive = dialog._entryBoxValidationBoxMotive.EntryValidation.Text; } } dialog.Destroy(); } //Normal Print Without Dialog else { //Modify Result result.Response = ResponseType.Ok; //Initialize CopyNames List from PrintCopies result.CopyNames = CustomReport.CopyNames(pDocumentFinanceMaster.DocumentType.PrintCopies); } } catch (Exception ex) { log.Error(ex.Message, ex); } return(result); }