void buttonPrintTransportationGuideWithoutTotals_Clicked(object sender, EventArgs e) { Guid documentTypeGuid = new Guid("96bcf534-0dab-48bb-a69e-166e81ae6f7b"); Guid customerGuid = new Guid("6223881a-4d2d-4de4-b254-f8529193da33"); //Article Guid article1Guid = new Guid("55892c3f-de10-4076-afde-619c54100c9b"); fin_article article1 = (fin_article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_article), article1Guid); //Place Guid placeGuid = new Guid("dd5a3869-db52-42d4-bbed-dec4adfaf62b"); //Table Guid tableGuid = new Guid("64d417f6-ff97-4f4b-bded-4bc9bf9f18d9"); //Get ArticleBag ArticleBag articleBag = new ArticleBag(); articleBag.Add(article1, placeGuid, tableGuid, PriceType.Price1, 48.0m); //Prepare ProcessFinanceDocumentParameter ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter( documentTypeGuid, articleBag) { Customer = customerGuid, SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag, ExchangeRate = 0.0m }; fin_documentfinancemaster resultDocument = FrameworkCalls.PersistFinanceDocument(SourceWindow, processFinanceDocumentParameter); }
void buttonPrintInvoiceJohnDoe1_Clicked(object sender, EventArgs e) { Guid documentTypeGuid = SettingsApp.XpoOidDocumentFinanceTypeSimplifiedInvoice; Guid customerGuid = new Guid("d8ce6455-e1a4-41dc-a475-223c00de3a91");//John Doe1 //Article Guid article1Guid = new Guid("72e8bde8-d03b-4637-90f1-fcb265658af0"); fin_article article1 = (fin_article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_article), article1Guid); //Place Guid placeGuid = new Guid("dd5a3869-db52-42d4-bbed-dec4adfaf62b"); //Table Guid tableGuid = new Guid("64d417f6-ff97-4f4b-bded-4bc9bf9f18d9"); //Get ArticleBag ArticleBag articleBag = new ArticleBag(); articleBag.Add(article1, placeGuid, tableGuid, PriceType.Price1, 1.0m); //Prepare ProcessFinanceDocumentParameter ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter( documentTypeGuid, articleBag) { Customer = customerGuid, SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag }; fin_documentfinancemaster resultDocument = FrameworkCalls.PersistFinanceDocument(SourceWindow, processFinanceDocumentParameter); }
void buttonPrintInvoiceJohnDoe2_Clicked(object sender, EventArgs e) { Guid documentTypeGuid = SettingsApp.XpoOidDocumentFinanceTypeSimplifiedInvoice; Guid customerGuid = new Guid("f5a382bb-f826-40d8-8910-cfb18df8a41e");//John Doe2 //Article Guid article1Guid = new Guid("32deb30d-ffa2-45e4-bca6-03569b9e8b08"); fin_article article1 = (fin_article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_article), article1Guid); //Place Guid placeGuid = new Guid("dd5a3869-db52-42d4-bbed-dec4adfaf62b"); //Table Guid tableGuid = new Guid("64d417f6-ff97-4f4b-bded-4bc9bf9f18d9"); //Get ArticleBag ArticleBag articleBag = new ArticleBag(); articleBag.Add(article1, placeGuid, tableGuid, PriceType.Price1, 8.0m); //Prepare ProcessFinanceDocumentParameter ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter( documentTypeGuid, articleBag) { Customer = customerGuid, SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag }; fin_documentfinancemaster resultDocument = FrameworkCalls.PersistFinanceDocument(SourceWindow, processFinanceDocumentParameter); }
//NC : Credit Note void buttonCreditNote_Clicked(object sender, EventArgs e) { Guid documentTypeGuid = SettingsApp.XpoOidDocumentFinanceTypeCreditNote; Guid reference = new Guid("daecbf1d-6211-4e74-a8cd-81795e347656"); //FT FT2015S0001/16 fin_documentfinancemaster documentReference = (fin_documentfinancemaster)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_documentfinancemaster), reference); //Add Order References List <DocumentReference> references = new List <DocumentReference>(); references.Add(new DocumentReference(documentReference, "Artigo com defeito")); //Get ArticleBag from documentFinanceMasterSource ArticleBag articleBag = ArticleBag.DocumentFinanceMasterToArticleBag(documentReference); //Prepare ProcessFinanceDocumentParameter ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter( documentTypeGuid, articleBag) { Customer = documentReference.EntityOid, //References = references, SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag }; fin_documentfinancemaster resultDocument = FrameworkCalls.PersistFinanceDocument(SourceWindow, processFinanceDocumentParameter); }
void buttonPrintInvoiceExchangeRate_Clicked(object sender, EventArgs e) { Guid documentTypeGuid = SettingsApp.XpoOidDocumentFinanceTypeInvoice; Guid customerGuid = new Guid("6223881a-4d2d-4de4-b254-f8529193da33"); Guid currencyGuid = new Guid("28d692ad-0083-11e4-96ce-00ff2353398c"); cfg_configurationcurrency currency = (cfg_configurationcurrency)GlobalFramework.SessionXpo.GetObjectByKey(typeof(cfg_configurationcurrency), currencyGuid); //Article:Line1 Guid article1Guid = new Guid("72e8bde8-d03b-4637-90f1-fcb265658af0"); fin_article article1 = (fin_article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_article), article1Guid); //Article:Line2 Guid article2Guid = new Guid("78638720-e728-4e96-8643-6d6267ff817b"); fin_article article2 = (fin_article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_article), article2Guid); //Place Guid placeGuid = new Guid("dd5a3869-db52-42d4-bbed-dec4adfaf62b"); //Table Guid tableGuid = new Guid("64d417f6-ff97-4f4b-bded-4bc9bf9f18d9"); //Get ArticleBag ArticleBag articleBag = new ArticleBag(); articleBag.Add(article1, placeGuid, tableGuid, PriceType.Price1, 100.0m); articleBag.Add(article2, placeGuid, tableGuid, PriceType.Price1, 1.0m); //Prepare ProcessFinanceDocumentParameter ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter( documentTypeGuid, articleBag) { Customer = customerGuid, SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag, Currency = currencyGuid, ExchangeRate = currency.ExchangeRate }; fin_documentfinancemaster resultDocument = FrameworkCalls.PersistFinanceDocument(SourceWindow, processFinanceDocumentParameter); }
//OrderReferences void buttonOrderReferences_Clicked(object sender, EventArgs e) { Guid documentTypeGuid = SettingsApp.XpoOidDocumentFinanceTypeInvoice; Guid customerGuid = new Guid("6223881a-4d2d-4de4-b254-f8529193da33"); Guid orderReference = new Guid("fbec0056-71a7-4d5b-8bfa-d5e887ec585f"); //DC DC2015S0001/1 fin_documentfinancemaster documentOrderReference = (fin_documentfinancemaster)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_documentfinancemaster), orderReference); //Add Order References List <fin_documentfinancemaster> orderReferences = new List <fin_documentfinancemaster>(); orderReferences.Add(documentOrderReference); //Get ArticleBag from documentFinanceMasterSource ArticleBag articleBag = ArticleBag.DocumentFinanceMasterToArticleBag(documentOrderReference); //Prepare ProcessFinanceDocumentParameter ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter( documentTypeGuid, articleBag) { Customer = customerGuid, OrderReferences = orderReferences, SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag, SourceOrderMain = documentOrderReference.SourceOrderMain }; fin_documentfinancemaster resultDocument = FrameworkCalls.PersistFinanceDocument(SourceWindow, processFinanceDocumentParameter); }
void buttonPrintTransportationGuideWithTotals_Clicked(object sender, EventArgs e) { Guid documentTypeGuid = new Guid("96bcf534-0dab-48bb-a69e-166e81ae6f7b"); Guid customerGuid = new Guid("d64c5d26-b4f9-4220-bd3c-72ece5e3960a"); //Article Guid article1Guid = new Guid("55892c3f-de10-4076-afde-619c54100c9b"); FIN_Article article1 = (FIN_Article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_Article), article1Guid); //Place Guid placeGuid = new Guid("dd5a3869-db52-42d4-bbed-dec4adfaf62b"); //Table Guid tableGuid = new Guid("64d417f6-ff97-4f4b-bded-4bc9bf9f18d9"); //Get ArticleBag ArticleBag articleBag = new ArticleBag(); articleBag.Add(article1, placeGuid, tableGuid, PriceType.Price1, 24.0m); //Prepare ProcessFinanceDocumentParameter ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter( documentTypeGuid, articleBag) { Customer = customerGuid, SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag }; FIN_DocumentFinanceMaster resultDocument = FrameworkCalls.PersistFinanceDocument(SourceWindow, processFinanceDocumentParameter); }
void buttonPrintInvoiceDiscount_Clicked(object sender, EventArgs e) { Guid documentTypeGuid = SettingsApp.XpoOidDocumentFinanceTypeInvoice; Guid customerGuid = new Guid("6223881a-4d2d-4de4-b254-f8529193da33"); //Article:Line1 Guid article1Guid = new Guid("72e8bde8-d03b-4637-90f1-fcb265658af0"); FIN_Article article1 = (FIN_Article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_Article), article1Guid); //Article:Line2 Guid article2Guid = new Guid("78638720-e728-4e96-8643-6d6267ff817b"); FIN_Article article2 = (FIN_Article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_Article), article2Guid); //Place Guid placeGuid = new Guid("dd5a3869-db52-42d4-bbed-dec4adfaf62b"); //Table Guid tableGuid = new Guid("64d417f6-ff97-4f4b-bded-4bc9bf9f18d9"); //Get ArticleBag ArticleBag articleBag = new ArticleBag(); articleBag.Add(article1, placeGuid, tableGuid, PriceType.Price1, 100.0m); articleBag.Add(article2, placeGuid, tableGuid, PriceType.Price1, 1.0m); //Prepare ProcessFinanceDocumentParameter ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter( documentTypeGuid, articleBag) { Customer = customerGuid, SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag }; FIN_DocumentFinanceMaster resultDocument = FrameworkCalls.PersistFinanceDocument(SourceWindow, processFinanceDocumentParameter); }
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Events //5.2: FT: Fatura void buttonPrintInvoice_Clicked(object sender, EventArgs e) { Guid documentTypeGuid = SettingsApp.XpoOidDocumentFinanceTypeInvoice; Guid customerGuid = new Guid("6223881a-4d2d-4de4-b254-f8529193da33"); //Prepare ProcessFinanceDocumentParameter ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter( documentTypeGuid, _articleBag) { Customer = customerGuid }; fin_documentfinancemaster resultDocument = FrameworkCalls.PersistFinanceDocument(SourceWindow, processFinanceDocumentParameter); _vboxButtons.Sensitive = false; }
//FT: Vats void buttonPrintInvoiceVat_Clicked(object sender, EventArgs e) { Guid documentTypeGuid = SettingsApp.XpoOidDocumentFinanceTypeInvoice; Guid customerGuid = new Guid("6223881a-4d2d-4de4-b254-f8529193da33"); Guid vatExemptionReasonGuid = new Guid("8311ce58-50ee-4115-9cf9-dbca86538fdd"); fin_configurationvatexemptionreason vatExemptionReason = (fin_configurationvatexemptionreason)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_configurationvatexemptionreason), vatExemptionReasonGuid); //Article:Line1 Guid articleREDGuid = new Guid("72e8bde8-d03b-4637-90f1-fcb265658af0"); fin_article articleRED = (fin_article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_article), articleREDGuid); //Article:Line2 Guid articleISEGuid = new Guid("78638720-e728-4e96-8643-6d6267ff817b"); fin_article articleISE = (fin_article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_article), articleISEGuid); //Article:Line3 Guid articleINTGuid = new Guid("bf99351b-1556-43c4-a85c-90082fb02d05"); fin_article articleINT = (fin_article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_article), articleINTGuid); //Article:Line4 Guid articleNORGuid = new Guid("6b547918-769e-4f5b-bcd6-01af54846f73"); fin_article articleNOR = (fin_article)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_article), articleNORGuid); //Place Guid placeGuid = new Guid("dd5a3869-db52-42d4-bbed-dec4adfaf62b"); //Table Guid tableGuid = new Guid("64d417f6-ff97-4f4b-bded-4bc9bf9f18d9"); //Get ArticleBag ArticleBag articleBag = new ArticleBag(); articleBag.Add(articleRED, placeGuid, tableGuid, PriceType.Price1, 1.0m); articleBag.Add(articleISE, placeGuid, tableGuid, PriceType.Price1, 1.0m, vatExemptionReason); articleBag.Add(articleINT, placeGuid, tableGuid, PriceType.Price1, 1.0m); articleBag.Add(articleNOR, placeGuid, tableGuid, PriceType.Price1, 1.0m); //Prepare ProcessFinanceDocumentParameter ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter( documentTypeGuid, articleBag) { Customer = customerGuid, SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag }; fin_documentfinancemaster resultDocument = FrameworkCalls.PersistFinanceDocument(SourceWindow, processFinanceDocumentParameter); }
private bool PersistFinanceDocuments() { bool debug = false; int padLeftChars = 10; try { int i = 0; foreach (TouchButtonSplitPayment item in _splitPaymentButtons) { i++; // If have if (item.ProcessFinanceDocumentParameter != null) { if (debug) { _log.Debug(string.Format("TotalFinal: [#{0}]:[{1}]", i, FrameworkUtils.DecimalToStringCurrency(item.ProcessFinanceDocumentParameter.ArticleBag.TotalFinal).PadLeft(padLeftChars, ' ') )); } // PersistFinanceDocument item.DocumentFinanceMaster = FrameworkCalls.PersistFinanceDocument(this, item.ProcessFinanceDocumentParameter); //Update Display if (item.DocumentFinanceMaster != null) { fin_configurationpaymentmethod paymentMethod = (fin_configurationpaymentmethod)FrameworkUtils.GetXPGuidObject(typeof(fin_configurationpaymentmethod), item.ProcessFinanceDocumentParameter.PaymentMethod); if (GlobalApp.UsbDisplay != null) { GlobalApp.UsbDisplay.ShowPayment(paymentMethod.Designation, item.ProcessFinanceDocumentParameter.TotalDelivery, item.ProcessFinanceDocumentParameter.TotalChange); } } } } //If has Working Order if ( GlobalFramework.SessionApp.OrdersMain != null && GlobalFramework.SessionApp.CurrentOrderMainOid != null && GlobalFramework.SessionApp.OrdersMain.ContainsKey(GlobalFramework.SessionApp.CurrentOrderMainOid) ) { // Get Current working orderMain OrderMain currentOrderMain = GlobalFramework.SessionApp.OrdersMain[GlobalFramework.SessionApp.CurrentOrderMainOid]; if (debug) { _log.Debug(string.Format("Working on currentOrderMain.PersistentOid: [{0}]", currentOrderMain.PersistentOid)); } //Get OrderDetail OrderDetail currentOrderDetails = currentOrderMain.OrderTickets[currentOrderMain.CurrentTicketId].OrderDetails; // Get configurationPlace to get Tax pos_configurationplace configurationPlace = (pos_configurationplace)GlobalFramework.SessionXpo.GetObjectByKey(typeof(pos_configurationplace), currentOrderMain.Table.PlaceId); } return(true); } catch (Exception ex) { _log.Error(ex.Message, ex); return(false); } }
protected override void OnResponse(ResponseType pResponse) { if (pResponse == ResponseType.Ok) { //Call Last Validation before send to PersistFinanceDocument/Validation, before Preview if (!LastValidation()) { //Keep Running this.Run(); } else { //Procced After Post Validation ResponseType response = ShowPreview(DocumentFinanceDialogPreviewMode.Confirmation); if (response == ResponseType.Yes) { //Get Parameters ProcessFinanceDocumentParameter processFinanceDocumentParameter = GetFinanceDocumentParameter(); //If error in Save or Update Customer if (processFinanceDocumentParameter.Customer == Guid.Empty) { //Keep Running this.Run(); } else { //Proccess Document FIN_DocumentFinanceMaster resultDocument = FrameworkCalls.PersistFinanceDocument(_sourceWindow, processFinanceDocumentParameter); //If Errors Occurs, return null Document, Keep Running until user cancel or a Valid Document is Returned if (resultDocument == null) { this.Run(); } } } else { //Keep Running this.Run(); } } } //Prevent Cancel Document else if (pResponse == ResponseType.Cancel) { if (_pagePad3.ArticleBag != null && _pagePad3.ArticleBag.Count > 0) { ResponseType response = Utils.ShowMessageTouch(_sourceWindow, DialogFlags.DestroyWithParent | DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo, Resx.window_title_dialog_message_dialog, Resx.dialog_message_finance_dialog_confirm_cancel); if (response == ResponseType.No) { //Keep Running this.Run(); } } } else if (pResponse == _responseTypePreview) { //ShowPreview Dialog ShowPreview(DocumentFinanceDialogPreviewMode.Preview); //Always Keep Running this.Run(); } else if (pResponse == _responseTypeClearCustomer) { //ClearCustomer _pagePad2.ClearCustomerAndWayBill(); //Always Keep Running this.Run(); } }
protected override void OnResponse(ResponseType pResponse) { if (pResponse == ResponseType.Ok) { //Call Last Validation before send to PersistFinanceDocument/Validation, before Preview if (!LastValidation()) { //Keep Running this.Run(); } else { //Procced After Post Validation ResponseType response = ShowPreview(DocumentFinanceDialogPreviewMode.Confirmation); if (response == ResponseType.Yes) { //Get Parameters //TK016249 - Impressoras - Diferenciação entre Tipos GlobalFramework.UsingThermalPrinter = false; ProcessFinanceDocumentParameter processFinanceDocumentParameter = GetFinanceDocumentParameter(); //If error in Save or Update Customer if (processFinanceDocumentParameter.Customer == Guid.Empty) { //Keep Running this.Run(); } else { //Proccess Document fin_documentfinancemaster resultDocument = FrameworkCalls.PersistFinanceDocument(_sourceWindow, processFinanceDocumentParameter); //If Errors Occurs, return null Document, Keep Running until user cancel or a Valid Document is Returned if (resultDocument == null) { this.Run(); } } } else { //Keep Running this.Run(); } } } //Prevent Cancel Document else if (pResponse == ResponseType.Cancel) { if (_pagePad3.ArticleBag != null && _pagePad3.ArticleBag.Count > 0) { ResponseType response = Utils.ShowMessageTouch(_sourceWindow, DialogFlags.DestroyWithParent | DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_message_dialog"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_finance_dialog_confirm_cancel")); if (response == ResponseType.No) { //Keep Running this.Run(); } } } else if (pResponse == _responseTypePreview) { //ShowPreview Dialog ShowPreview(DocumentFinanceDialogPreviewMode.Preview); //Always Keep Running this.Run(); } else if (pResponse == _responseTypeClearCustomer) { //ClearCustomer _pagePad2.ClearCustomerAndWayBill(); //Always Keep Running this.Run(); } }