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; } }
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //FinanceDocumentPayments public static fin_documentfinancepayment PersistFinanceDocumentPayment() { //All Documents, usefull to Split into Invoices and CreditNotes List <Guid> listDocuments = new List <Guid>(); List <fin_documentfinancemaster> listInvoices = new List <fin_documentfinancemaster>(); List <fin_documentfinancemaster> listCreditNotes = new List <fin_documentfinancemaster>(); //listDocuments.Add(new Guid("a067b55b-09b5-4a48-a386-e9d04777540b"));//NC NCCKOQ5R5012016S001/1 //listDocuments.Add(new Guid("92c5c809-0387-4d1f-93c6-afeb6f291149"));//FT FTCKOQ5R5012016S001/1 //Used listDocuments.Add(new Guid("e00cde4c-2218-4c03-ac4b-161b2b89032b")); //NC NCCKOQ5R5012016S001/2 listDocuments.Add(new Guid("ed8e5198-f253-4198-be18-fff188a7d3b4")); //NC NCCKOQ5R5012016S001/3 listDocuments.Add(new Guid("dc4b8170-2b61-4ed4-ad8b-77aaf8a4c695")); //FT FTCKOQ5R5012016S001/3 listDocuments.Add(new Guid("36e49eb1-5e94-47e4-9467-8365ec71e099")); //FT FTCKOQ5R5012016S001/4 listDocuments.Add(new Guid("529f5d2d-4202-4207-b15f-2d58d56c4ebe")); //FT FTCKOQ5R5012016S001/6 //Force Errors : Invalid Documents listDocuments.Add(new Guid("41ba3dfa-8afa-48bd-aa56-1b51015e7c0c")); //GT GTCKOQ5R5012016S001/1 Mário Fernandes invalid document + diferent customer listDocuments.Add(new Guid("a067b55b-09b5-4a48-a386-e9d04777540b")); //NC NCCKOQ5R5012016S001/1 Carlos Fernandes Payed listDocuments.Add(new Guid("92c5c809-0387-4d1f-93c6-afeb6f291149")); //FT FTCKOQ5R5012016S001/1 Carlos Fernandes Payed listDocuments.Add(new Guid("2813d769-3065-44fb-b48f-a8f7a42a0456")); //FT FTCKOQ5R5012016S001/5 Carlos DocumentStatusStatus = A //Other Parameters //decimal paymentAmount = 28.17m;//Euro decimal paymentAmount = 517.06m;//Kwanza string paymentNotes = "$#%#$&%»»'@£§€"; //Prepare listInvoices and listCreditNotes foreach (Guid item in listDocuments) { fin_documentfinancemaster documentFinanceMaster = (fin_documentfinancemaster)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_documentfinancemaster), item); if (documentFinanceMaster.DocumentType.Credit) { listInvoices.Add(documentFinanceMaster); } else { listCreditNotes.Add(documentFinanceMaster); } } fin_documentfinancepayment documentFinancePayment = ProcessFinanceDocument.PersistFinanceDocumentPayment(listInvoices, listCreditNotes, SettingsApp.XpoOidDocumentCustomer, SettingsApp.XpoOidDocumentPaymentMethod, SettingsApp.XpoOidDocumentCurrency, paymentAmount, paymentNotes); if (documentFinancePayment != null) { Console.WriteLine(string.Format("documentFinancePayment.PaymentRefNo: [{0}]", documentFinancePayment.PaymentRefNo)); sys_configurationprinterstemplates template = ProcessFinanceDocumentSeries.GetDocumentFinanceYearSerieTerminal(GlobalFramework.SessionXpo, documentFinancePayment.DocumentType.Oid).Template; //TK016249 - Impressoras - Diferenciação entre Tipos PrintRouter.PrintFinanceDocumentPayment(GlobalFramework.LoggedTerminal.ThermalPrinter, documentFinancePayment); } return(documentFinancePayment); }
public ThermalPrinterFinanceDocumentPayment(sys_configurationprinters pPrinter, fin_documentfinancepayment pDocumentFinancePayment, List <int> pCopyNames, bool pSecondCopy) : base(pPrinter, pDocumentFinancePayment.DocumentType, pCopyNames, pSecondCopy) { try { //Parameters _documentFinancePayment = pDocumentFinancePayment; //Init Fast Reports Business Objects (From FRBOHelper) ResultFRBODocumentFinancePayment fRBOHelperResponseProcessReportFinancePayment = FRBOHelper.GetFRBOFinancePayment(pDocumentFinancePayment.Oid); //Get FRBOs Lists _documentFinancePaymentList = fRBOHelperResponseProcessReportFinancePayment.DocumentFinancePayment.List; _documentFinancePaymentDocumentList = fRBOHelperResponseProcessReportFinancePayment.DocumentFinancePayment.List[0].DocumentFinancePaymentDocument; } catch (Exception ex) { throw ex; } }
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //ProcessFinanceDocument //Use: DocumentFinanceMaster resultDocument = FrameworkCalls.ProcessFinanceDocument(SourceWindow, Invoices, CreditNotes, Customer, PaymentMethod, pPaymentAmount, pPaymentNotes); public static fin_documentfinancepayment PersistFinanceDocumentPayment(Window pSourceWindow, List <fin_documentfinancemaster> pInvoices, List <fin_documentfinancemaster> pCreditNotes, Guid pCustomer, Guid pPaymentMethod, Guid pConfigurationCurrency, decimal pPaymentAmount, string pPaymentNotes = "") { fin_documentfinancepayment result = null; try { fin_documentfinancepayment documentFinancePayment = ProcessFinanceDocument.PersistFinanceDocumentPayment(pInvoices, pCreditNotes, pCustomer, pPaymentMethod, pConfigurationCurrency, pPaymentAmount, pPaymentNotes); if (documentFinancePayment != null) { //Always send back the Valid Document result = documentFinancePayment; //Print Document PrintFinanceDocumentPayment(pSourceWindow, documentFinancePayment); } } catch (ProcessFinanceDocumentValidationException ex) { string errorMessage = string.Empty; switch (ex.Message) { case "ERROR_MISSING_SERIE": errorMessage = string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_error_creating_financial_document"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_error_creating_financial_document_missing_series")); break; case "ERROR_COMMIT_FINANCE_DOCUMENT_PAYMENT": default: errorMessage = string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_error_creating_financial_document"), ex.Exception.Message); break; } Utils.ShowMessageTouch( pSourceWindow, DialogFlags.Modal, _sizeDefaultWindowSize, MessageType.Error, ButtonsType.Close, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_error"), errorMessage ); } return(result); }
public static bool PersistWorkSessionMovement(Session pSession, pos_worksessionperiod pWorkSessionPeriod, pos_worksessionmovementtype pWorkSessionMovementType, fin_documentfinancemaster pDocumentFinanceMaster, fin_documentfinancepayment pDocumentFinancePayment, sys_userdetail pUserDetail, pos_configurationplaceterminal pTerminal, DateTime pDate, decimal pMovementAmount, string pDescription, uint pOrd = 1) { //Prevent Deleted Objects, Get Fresh Objects sys_userdetail userDetail = pSession.GetObjectByKey <sys_userdetail>(GlobalFramework.LoggedUser.Oid); pos_configurationplaceterminal terminal = pSession.GetObjectByKey <pos_configurationplaceterminal>(GlobalFramework.LoggedTerminal.Oid); pos_worksessionmovementtype workSessionMovementType = pSession.GetObjectByKey <pos_worksessionmovementtype>(pWorkSessionMovementType.Oid); try { pos_worksessionmovement workSessionMovement = new pos_worksessionmovement(pSession) { Ord = pOrd, WorkSessionPeriod = pWorkSessionPeriod, WorkSessionMovementType = workSessionMovementType, UserDetail = userDetail, Terminal = terminal, Date = pDate, MovementAmount = pMovementAmount, Description = pDescription }; //Assign parent DocumentFinanceMaster and PaymentMethod if (pDocumentFinanceMaster != null) { workSessionMovement.DocumentFinanceMaster = pDocumentFinanceMaster; workSessionMovement.DocumentFinanceType = pDocumentFinanceMaster.DocumentType; workSessionMovement.PaymentMethod = pDocumentFinanceMaster.PaymentMethod; } //Assign parent DocumentFinancePayment and PaymentMethod if (pDocumentFinancePayment != null) { workSessionMovement.DocumentFinancePayment = pDocumentFinancePayment; workSessionMovement.DocumentFinanceType = pDocumentFinancePayment.DocumentType; workSessionMovement.PaymentMethod = pDocumentFinancePayment.PaymentMethod; } //Save WorkSessionMovement if not in UOW if (pSession.GetType() == typeof(Session)) { workSessionMovement.Save(); } return(true); } catch (Exception ex) { _log.Error(ex.Message, ex); return(false); } }
//Main Method - With and Without Session public static bool PersistWorkSessionMovement(pos_worksessionperiod pWorkSessionPeriod, pos_worksessionmovementtype pWorkSessionMovementType, fin_documentfinancemaster pDocumentFinanceMaster, fin_documentfinancepayment pDocumentFinancePayment, sys_userdetail pUserDetail, pos_configurationplaceterminal pTerminal, DateTime pDate, decimal pMovementAmount, string pDescription, uint pOrd = 1) { return(PersistWorkSessionMovement(GlobalFramework.SessionXpo, pWorkSessionPeriod, pWorkSessionMovementType, pDocumentFinanceMaster, pDocumentFinancePayment, pUserDetail, pTerminal, pDate, pMovementAmount, pDescription)); }
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /// <summary> /// Generate Fast Report Business Objects for ProcessReportFinanceDocumentPayment /// </summary> public static ResultFRBODocumentFinancePayment GetFRBOFinancePayment(Guid pDocumentFinancePaymentOid) { ResultFRBODocumentFinancePayment result = new ResultFRBODocumentFinancePayment(); try { fin_documentfinancepayment documentFinancePayment = (fin_documentfinancepayment)FrameworkUtils.GetXPGuidObject(GlobalFramework.SessionXpo, typeof(fin_documentfinancepayment), pDocumentFinancePaymentOid); string sqlFilter = string.Format("fpaOid = '{0}'", pDocumentFinancePaymentOid.ToString()); //Prepare and Declare FRBOGenericCollections FRBOGenericCollection <FRBODocumentFinancePaymentView> gcDocumentFinancePayment = new FRBOGenericCollection <FRBODocumentFinancePaymentView>(sqlFilter); FRBOGenericCollection <FRBODocumentFinancePaymentDocumentView> gcDocumentFinancePaymentDocument; //Decrypt Values if (!string.IsNullOrEmpty(gcDocumentFinancePayment.List[0].EntityName)) { gcDocumentFinancePayment.List[0].EntityName = XPGuidObject.DecryptIfNeeded(gcDocumentFinancePayment.List[0].EntityName).ToString(); } if (!string.IsNullOrEmpty(gcDocumentFinancePayment.List[0].EntityAddress)) { gcDocumentFinancePayment.List[0].EntityAddress = XPGuidObject.DecryptIfNeeded(gcDocumentFinancePayment.List[0].EntityAddress).ToString(); } if (!string.IsNullOrEmpty(gcDocumentFinancePayment.List[0].EntityZipCode)) { gcDocumentFinancePayment.List[0].EntityZipCode = XPGuidObject.DecryptIfNeeded(gcDocumentFinancePayment.List[0].EntityZipCode).ToString(); } if (!string.IsNullOrEmpty(gcDocumentFinancePayment.List[0].EntityCity)) { gcDocumentFinancePayment.List[0].EntityCity = XPGuidObject.DecryptIfNeeded(gcDocumentFinancePayment.List[0].EntityCity).ToString(); } if (!string.IsNullOrEmpty(gcDocumentFinancePayment.List[0].EntityLocality)) { gcDocumentFinancePayment.List[0].EntityLocality = XPGuidObject.DecryptIfNeeded(gcDocumentFinancePayment.List[0].EntityLocality).ToString(); } if (!string.IsNullOrEmpty(gcDocumentFinancePayment.List[0].EntityFiscalNumber)) { gcDocumentFinancePayment.List[0].EntityFiscalNumber = XPGuidObject.DecryptIfNeeded(gcDocumentFinancePayment.List[0].EntityFiscalNumber).ToString(); } //If FinalConsumer - Clean Output Data if (gcDocumentFinancePayment.List[0].EntityFiscalNumber == SettingsApp.FinanceFinalConsumerFiscalNumber) { gcDocumentFinancePayment.List[0].EntityName = string.Empty; gcDocumentFinancePayment.List[0].EntityAddress = string.Empty; gcDocumentFinancePayment.List[0].EntityZipCode = string.Empty; gcDocumentFinancePayment.List[0].EntityCity = string.Empty; gcDocumentFinancePayment.List[0].EntityLocality = string.Empty; gcDocumentFinancePayment.List[0].EntityFiscalNumber = SettingsApp.FinanceFinalConsumerFiscalNumberDisplay; } //Render Child Bussiness Objects foreach (FRBODocumentFinancePaymentView documentFinanceMasterPayment in gcDocumentFinancePayment) { //Get FinanceDetail gcDocumentFinancePaymentDocument = new FRBOGenericCollection <FRBODocumentFinancePaymentDocumentView>(string.Format("fpaOid = '{0}'", documentFinanceMasterPayment.Oid), "ftpCode, fmaDocumentNumber"); documentFinanceMasterPayment.DocumentFinancePaymentDocument = gcDocumentFinancePaymentDocument.List; } result.DocumentFinancePayment = gcDocumentFinancePayment; } catch (Exception ex) { _log.Error(ex.Message, ex); } return(result); }
public static bool PrintFinanceDocumentPayment(Window pSourceWindow, sys_configurationprinters pPrinter, fin_documentfinancepayment pDocumentFinancePayment) { bool result = false; if (!LicenceManagement.IsLicensed || !LicenceManagement.CanPrint) { Utils.ShowMessageTouchErrorUnlicencedFunctionDisabled(pSourceWindow, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printing_function_disabled")); return(false); } sys_configurationprinters printer = (pPrinter != null) ? pPrinter : GlobalFramework.LoggedTerminal.Printer; try { //Notification : Show Message TouchTerminalWithoutAssociatedPrinter and Store user input, to Show Next Time(Yes) or Not (No) if (printer == null) { Utils.ShowMessageTouchTerminalWithoutAssociatedPrinter(pSourceWindow, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_documentfinance_type_title_rc")); } else { //ProtectedFiles Protection bool validFiles = true; string extraMessage = string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_error_protected_files_invalid_files_detected_print_document_ignored"), pDocumentFinancePayment.PaymentRefNo); switch (PrintRouter.GetPrinterToken(printer.PrinterType.Token)) { //ThermalPrinter : Ticket Files case "THERMAL_PRINTER_WINDOWS": case "THERMAL_PRINTER_LINUX": case "THERMAL_PRINTER_SOCKET": break; //FastReport : Report Files case "GENERIC_PRINTER_WINDOWS": case "REPORT_EXPORT_PDF": //validFiles = (IsValidProtectedFile(FrameworkUtils.OSSlash(@"Resources/Reports/UserReports/ReportDocumentFinancePayment.frx"), extraMessage)); break; case "VIRTUAL_SCREEN": break; } //ProtectedFiles Protection if (!validFiles) { return(false); } //Call Print Document result = PrintRouter.PrintFinanceDocumentPayment(printer, pDocumentFinancePayment); } } catch (Exception ex) { Utils.ShowMessageTouchErrorPrintingTicket(pSourceWindow, printer, ex); } return(result); }
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //PrintFinanceDocumentPayment public static bool PrintFinanceDocumentPayment(Window pSourceWindow, fin_documentfinancepayment pDocumentFinancePayment) { return(PrintFinanceDocumentPayment(pSourceWindow, null, pDocumentFinancePayment)); }
//XpoMode public TreeViewDocumentFinancePayment(Window pSourceWindow, XPGuidObject pDefaultValue, CriteriaOperator pXpoCriteria, Type pDialogType, GenericTreeViewMode pGenericTreeViewMode = GenericTreeViewMode.Default, GenericTreeViewNavigatorMode pGenericTreeViewNavigatorMode = GenericTreeViewNavigatorMode.Default) { //Init Vars Type xpoGuidObjectType = typeof(fin_documentfinancepayment); //Override Default Value with Parameter Default Value, this way we can have diferent Default Values for GenericTreeView fin_documentfinancepayment defaultValue = (pDefaultValue != null) ? pDefaultValue as fin_documentfinancepayment : null; //Override Default DialogType with Parameter Dialog Type, this way we can have diferent DialogTypes for GenericTreeView Type typeDialogClass = (pDialogType != null) ? pDialogType : null; //Config int fontGenericTreeViewColumn = Convert.ToInt16(GlobalFramework.Settings["fontGenericTreeViewColumn"]); //Configure columnProperties List <GenericTreeViewColumnProperty> columnProperties = new List <GenericTreeViewColumnProperty>(); columnProperties.Add(new GenericTreeViewColumnProperty("CreatedAt") { Title = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_document_date"), MinWidth = 140 }); /* IN009067 */ columnProperties.Add(new GenericTreeViewColumnProperty("PaymentRefNo") { Title = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_document_number"), MinWidth = 120 }); /* IN009067 */ columnProperties.Add(new GenericTreeViewColumnProperty("PaymentStatus") { Title = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_document_status"), MinWidth = 50, MaxWidth = 50 }); //Shared Query /* IN009075 - removing call to view */ // string query = "SELECT {0} as Result FROM view_documentfinancepayment WHERE fpaOid = '{1}' GROUP BY fpaOid,{0};"; string queryForCustomerDetails = "SELECT {0} FROM erp_customer AS Customer LEFT JOIN fin_documentfinancepayment AS Payment ON (Payment.EntityOid = Customer.Oid) WHERE Payment.Oid = '{1}';"; columnProperties.Add(new GenericTreeViewColumnProperty("EntityName") { Title = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_entity"), MinWidth = 260, MaxWidth = 260, Query = string.Format(queryForCustomerDetails, "Name", "{0}"), /* IN009075 */ DecryptValue = true }); /* IN009067 */ columnProperties.Add(new GenericTreeViewColumnProperty("EntityFiscalNumber") { Title = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_fiscal_number"), MinWidth = 100, Query = string.Format(queryForCustomerDetails, "FiscalNumber", "{0}"), /* IN009075 */ DecryptValue = true }); columnProperties.Add(new GenericTreeViewColumnProperty("PaymentAmount") { Title = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_total"), MinWidth = 100, //Alignment = 1.0F, FormatProvider = new FormatterDecimalCurrency(), /* IN009067 */ CellRenderer = new CellRendererText() { FontDesc = new Pango.FontDescription() { Size = fontGenericTreeViewColumn }, Alignment = Pango.Alignment.Right, Xalign = 1.0F } }); /* IN009067 - TODO */ string relatedDocumentsQuery = logicpos.DataLayer.GenerateRelatedDocumentsQuery(true); columnProperties.Add(new GenericTreeViewColumnProperty("RelatedDocuments") { Query = relatedDocumentsQuery, Title = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_document_finance_column_related_doc"), MinWidth = 100 }); //Configure Criteria/XPCollection/Model //CriteriaOperator.Parse("Code >= 100 and Code <= 9999"); CriteriaOperator criteria = pXpoCriteria; SortProperty[] sortProperty = new SortProperty[1]; /* IN009067 - setting up descending sort */ sortProperty[0] = new SortProperty("CreatedAt", SortingDirection.Descending); //Configure Criteria/XPCollection/Model //New IN009223 IN009227 XPCollection xpoCollection = new XPCollection(GlobalFramework.SessionXpo, xpoGuidObjectType, criteria, sortProperty) { TopReturnedObjects = SettingsApp.PaginationRowsPerPage }; //Call Base Initializer base.InitObject( pSourceWindow, //Pass parameter defaultValue, //Pass parameter pGenericTreeViewMode, //Pass parameter pGenericTreeViewNavigatorMode, //Pass parameter columnProperties, //Created Here xpoCollection, //Created Here typeDialogClass //Created Here ); }
private static bool SystemPrintInsert(fin_documentfinancemaster pDocumentFinanceMaster, fin_documentfinancepayment pDocumentFinancePayment, string pPrinterDesignation, int pPrintCopies, List <int> pCopyNames, bool pSecondPrint, string pPrintMotive, sys_userdetail pUserDetail, pos_configurationplaceterminal pConfigurationPlaceTerminal) { bool result = false; try { //Start UnitOfWork using (UnitOfWork uowSession = new UnitOfWork()) { string designation = String.Empty; //Get Objects into Current UOW Session sys_userdetail userDetail = (sys_userdetail)FrameworkUtils.GetXPGuidObject(uowSession, typeof(sys_userdetail), pUserDetail.Oid); pos_configurationplaceterminal configurationPlaceTerminal = (pos_configurationplaceterminal)FrameworkUtils.GetXPGuidObject(uowSession, typeof(pos_configurationplaceterminal), pConfigurationPlaceTerminal.Oid); //Convert CopyNames List to Comma Delimited String string copyNamesCommaDelimited = CustomReport.CopyNamesCommaDelimited(pCopyNames); //SystemPrint sys_systemprint systemPrint = new sys_systemprint(uowSession) { Date = FrameworkUtils.CurrentDateTimeAtomic(), Designation = designation, PrintCopies = pPrintCopies, CopyNames = copyNamesCommaDelimited, SecondPrint = pSecondPrint, UserDetail = userDetail, Terminal = configurationPlaceTerminal }; if (pPrintMotive != String.Empty) { systemPrint.PrintMotive = pPrintMotive; } //Mode: DocumentFinanceMaster if (pDocumentFinanceMaster != null) { fin_documentfinancemaster documentFinanceMaster = (fin_documentfinancemaster)FrameworkUtils.GetXPGuidObject(uowSession, typeof(fin_documentfinancemaster), pDocumentFinanceMaster.Oid); systemPrint.DocumentMaster = documentFinanceMaster; designation = string.Format("{0} {1} : {2}", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printed"), documentFinanceMaster.DocumentType.Designation, documentFinanceMaster.DocumentNumber); //Update DocumentFinanceMaster if (!documentFinanceMaster.Printed) { documentFinanceMaster.Printed = true; } } //Mode: DocumentFinancePayment if (pDocumentFinancePayment != null) { fin_documentfinancepayment documentFinancePayment = (fin_documentfinancepayment)FrameworkUtils.GetXPGuidObject(uowSession, typeof(fin_documentfinancepayment), pDocumentFinancePayment.Oid); systemPrint.DocumentPayment = documentFinancePayment; designation = string.Format("{0} {1} : {2}", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printed"), documentFinancePayment.DocumentType.Designation, documentFinancePayment.PaymentRefNo); } systemPrint.Designation = designation; try { //Commit UOW Changes : Before get current OrderMain uowSession.CommitChanges(); //Audit FrameworkUtils.Audit("SYSTEM_PRINT_FINANCE_DOCUMENT", designation); result = true; } catch (Exception ex) { _log.Error(ex.Message, ex); uowSession.RollbackTransaction(); } } } catch (Exception ex) { _log.Error(ex.Message, ex); } return(result); }
private static bool SystemPrintInsert(fin_documentfinancepayment pDocumentFinancePayment, string pPrinterDesignation, int pPrintCopies, List <int> pCopyNames) { return(SystemPrintInsert(null, pDocumentFinancePayment, pPrinterDesignation, pPrintCopies, pCopyNames, false, String.Empty, GlobalFramework.LoggedUser, GlobalFramework.LoggedTerminal)); }
//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 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": 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); }