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 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); }
//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 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); }
//Credit Notes public static FIN_DocumentFinanceMaster PersistFinanceDocumentCreditNote(Guid pDocumentFinanceType) { //SourceDocument for CreditNote Guid xpoOidParentDocument = new Guid("316528f6-bf9b-4a6d-aa5b-530379aaa6ef"); FIN_DocumentFinanceMaster sourceDocument = (FIN_DocumentFinanceMaster)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_DocumentFinanceMaster), xpoOidParentDocument); ArticleBag articleBag = TestArticleBag.GetArticleBag(false); //Fill Required Reference and Reason foreach (var item in articleBag) { item.Value.Reference = sourceDocument; item.Value.Reason = "Anulação"; item.Value.Quantity -= 1; } ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter(pDocumentFinanceType, articleBag) { SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag, //P1 PaymentCondition = SettingsApp.XpoOidDocumentPaymentCondition, PaymentMethod = SettingsApp.XpoOidDocumentPaymentMethod, Currency = SettingsApp.XpoOidDocumentCurrency, //Used for Credit Notes DocumentParent = xpoOidParentDocument, //P2 Customer = SettingsApp.XpoOidDocumentCustomer }; return(PersistFinanceDocumentBase(pDocumentFinanceType, processFinanceDocumentParameter)); }
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); }
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //FinanceDocument //Used to trigger all Errors public static FIN_DocumentFinanceMaster PersistFinanceDocumentMinimal(Guid pDocumentFinanceType) { //Store current Logged Details SYS_UserDetail loggedUser = GlobalFramework.LoggedUser; POS_ConfigurationPlaceTerminal loggedTerminal = GlobalFramework.LoggedTerminal; //Reset Current Logged Details GlobalFramework.LoggedUser = null; GlobalFramework.LoggedTerminal = null; FIN_DocumentFinanceMaster documentFinanceMaster = null; try { //Create Empty ArticleBag ArticleBag articleBag = new ArticleBag(); //Create ProcessFinanceDocumentParameter ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter(pDocumentFinanceType, articleBag); //Reset Defaults processFinanceDocumentParameter.Currency = Guid.Empty; documentFinanceMaster = ProcessFinanceDocument.PersistFinanceDocument(processFinanceDocumentParameter); Console.WriteLine(string.Format("documentFinanceMaster.DocumentNumber: [{0}]", documentFinanceMaster.DocumentNumber)); } finally { //Restore Old Logged Details GlobalFramework.LoggedUser = loggedUser; GlobalFramework.LoggedTerminal = loggedTerminal; } return(documentFinanceMaster); }
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 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; }
//Default public static FIN_DocumentFinanceMaster PersistFinanceDocument(Guid pDocumentFinanceType) { ArticleBag articleBag = TestArticleBag.GetArticleBag(false); ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter(pDocumentFinanceType, articleBag) { SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag, //P1 PaymentCondition = SettingsApp.XpoOidDocumentPaymentCondition, PaymentMethod = SettingsApp.XpoOidDocumentPaymentMethod, Currency = SettingsApp.XpoOidDocumentCurrency, //P2 Customer = SettingsApp.XpoOidDocumentCustomer }; return(PersistFinanceDocumentBase(pDocumentFinanceType, processFinanceDocumentParameter)); }
private void UpdateTouchButtonSplitPaymentLabels(TouchButtonSplitPayment touchButtonSplitPayment) { bool debug = false; try { string labelPaymentDetails = string.Empty; ProcessFinanceDocumentParameter processFinanceDocumentParameter = touchButtonSplitPayment.ProcessFinanceDocumentParameter; if (processFinanceDocumentParameter != null) { if (debug) { _log.Debug(Environment.NewLine); } foreach (var item in touchButtonSplitPayment.ArticleBag) { if (debug) { _log.Debug(string.Format("\t[{0}],[{1}],[{2}]", item.Key.Designation, item.Value.Quantity, item.Value.TotalFinal)); } } erp_customer customer = (erp_customer)FrameworkUtils.GetXPGuidObject(typeof(erp_customer), processFinanceDocumentParameter.Customer); fin_configurationpaymentmethod paymentMethod = (fin_configurationpaymentmethod)FrameworkUtils.GetXPGuidObject(typeof(fin_configurationpaymentmethod), processFinanceDocumentParameter.PaymentMethod); cfg_configurationcurrency currency = (cfg_configurationcurrency)FrameworkUtils.GetXPGuidObject(typeof(cfg_configurationcurrency), processFinanceDocumentParameter.Currency); // Compose labelPaymentDetails string totalFinal = FrameworkUtils.DecimalToStringCurrency(processFinanceDocumentParameter.ArticleBag.TotalFinal, currency.Acronym); string totalDelivery = FrameworkUtils.DecimalToStringCurrency(processFinanceDocumentParameter.TotalDelivery, currency.Acronym); string totalChange = FrameworkUtils.DecimalToStringCurrency(processFinanceDocumentParameter.TotalChange, currency.Acronym); string moneyExtra = (paymentMethod.Token.Equals("MONEY")) ? $" : ({totalDelivery}/{totalChange})" : string.Empty; // Override default labelPaymentDetails labelPaymentDetails = $"{customer.Name} : {paymentMethod.Designation} : {totalFinal}{moneyExtra}"; } // Assign to button Reference touchButtonSplitPayment.LabelPaymentDetails.Text = labelPaymentDetails; } catch (Exception ex) { _log.Error(ex.Message, ex); } }
//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); }
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //OrderMain/Document Conferences //Works in Dual Mode based on pGenerateNewIfDiferentFromArticleBag, sometimes passes 2 times, on for get last document and other to create new one //Mode1 : GenerateNewIfDiferentFromArticleBag = false : Returns Last Conference Document for Current Working Order Main //Mode2 : GenerateNewIfDiferentFromArticleBag = true : Returns Last or New Conference Document if Current Working Order Main is Diferent from working currente Working OrderMain ArticleBag //Returns Last|New DocumentConference, for table current OrderMain //GenerateNewIfDiferentFromArticleBag : Used to generate a new Document if latest Document has been changed (Compare it to current ArticleBag), //else if false use the latest on Database ignoring Diferences, Used to Get latest DocumentConference to use in Generate DocumentConference PosOrdersDialog.buttonTableConsult_Clicked public static FIN_DocumentFinanceMaster GetOrderMainLastDocumentConference(bool pGenerateNewIfDiferentFromArticleBag = false) { //Declare local Variables FIN_DocumentFinanceMaster lastDocument = null; FIN_DocumentFinanceMaster newDocument = null; FIN_DocumentFinanceMaster result = null; FIN_DocumentOrderMain orderMain = null; Guid currentOrderMainOid = GlobalFramework.SessionApp.CurrentOrderMainOid; OrderMain currentOrderMain = GlobalFramework.SessionApp.OrdersMain[currentOrderMainOid]; try { string sql = string.Format(@" SELECT Oid FROM FIN_documentfinancemaster WHERE DocumentType = '{0}' AND SourceOrderMain = '{1}' ORDER BY CreatedAt DESC; " , SettingsApp.XpoOidDocumentFinanceTypeConferenceDocument , currentOrderMain.PersistentOid ); var sqlResult = GlobalFramework.SessionXpo.ExecuteScalar(sql); //Get LastDocument Object if (sqlResult != null) { lastDocument = (FIN_DocumentFinanceMaster)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_DocumentFinanceMaster), new Guid(Convert.ToString(sqlResult))); } //If GenerateNewIfDiferentFromArticleBag Enabled compare ArticleBag with Document and If is diferent Generate a New One if (pGenerateNewIfDiferentFromArticleBag) { //Initialize ArticleBag to Compare with Order Detail and use in ProcessFinanceDocuments ArticleBag articleBag = ArticleBag.TicketOrderToArticleBag(currentOrderMain); //Check if Total is Not Equal and Generate New DocumentConference, This way it will be Equal to Invoice if ( lastDocument == null || (!lastDocument.TotalFinal.Equals(articleBag.TotalFinal) || !lastDocument.DocumentDetail.Count.Equals(articleBag.Count)) ) { //Prepare ProcessFinanceDocumentParameter ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter(SettingsApp.XpoOidDocumentFinanceTypeConferenceDocument, articleBag) { Customer = SettingsApp.XpoOidDocumentFinanceMasterFinalConsumerEntity }; orderMain = (FIN_DocumentOrderMain)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_DocumentOrderMain), currentOrderMain.PersistentOid); processFinanceDocumentParameter.SourceOrderMain = orderMain; if (lastDocument != null) { processFinanceDocumentParameter.DocumentParent = lastDocument.Oid; processFinanceDocumentParameter.OrderReferences = new List <FIN_DocumentFinanceMaster>(); processFinanceDocumentParameter.OrderReferences.Add(lastDocument); } //Generate New Document newDocument = ProcessFinanceDocument.PersistFinanceDocument(processFinanceDocumentParameter, false); //Assign DocumentStatus and OrderReferences if (newDocument != null) { //Assign Result Document to New Document //Get Object outside UOW else we have a problem with "A first chance exception of type 'System.ObjectDisposedException'" result = (FIN_DocumentFinanceMaster)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_DocumentFinanceMaster), newDocument.Oid); ////Old Code that changes last Conference Document to Status "A", it is not Required, Confirmed with Carlos Bento, we must Leave it without status changes //if (lastDocument != null) //{ // lastDocument.DocumentStatusStatus = "A"; // lastDocument.DocumentStatusDate = newDocument.DocumentStatusDate; // lastDocument.DocumentStatusUser = newDocument.DocumentStatusUser; // lastDocument.SystemEntryDate = newDocument.SystemEntryDate; // lastDocument.Save(); //} } } } else { result = lastDocument; } } catch (Exception ex) { // Send Exception to logicpos, must treat exception in ui, to Show Alert to User throw ex; } return(result); }
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(); } }
public static FIN_DocumentFinanceMaster PersistFinanceDocumentBase(Guid pDocumentFinanceType, ProcessFinanceDocumentParameter pProcessFinanceDocumentParameter) { ArticleBag articleBag = TestArticleBag.GetArticleBag(false); //Change default DocumentDateTime //processFinanceDocumentParameter.DocumentDateTime = FrameworkUtils.CurrentDateTimeAtomic().AddDays(-5); FIN_DocumentFinanceMaster documentFinanceMaster = ProcessFinanceDocument.PersistFinanceDocument(pProcessFinanceDocumentParameter); if (documentFinanceMaster != null) { Console.WriteLine(string.Format("documentFinanceMaster.DocumentNumber: [{0}]", documentFinanceMaster.DocumentNumber)); PrintRouter.PrintFinanceDocument(documentFinanceMaster); } return(documentFinanceMaster); }
private ProcessFinanceDocumentParameter GetFinanceDocumentParameter() { //Always Recreate ArticleBag before contruct ProcessFinanceDocumentParameter _pagePad3.ArticleBag = GetArticleBag(); ERP_Customer customer = null; bool wayBillMode = _pagePad1.EntryBoxSelectDocumentFinanceType.Value.WayBill; object resultObject; resultObject = Utils.SaveOrUpdateCustomer( this, _pagePad2.EntryBoxSelectCustomerName.Value, _pagePad2.EntryBoxSelectCustomerName.EntryValidation.Text, _pagePad2.EntryBoxCustomerAddress.EntryValidation.Text, _pagePad2.EntryBoxCustomerLocality.EntryValidation.Text, _pagePad2.EntryBoxCustomerZipCode.EntryValidation.Text, _pagePad2.EntryBoxCustomerCity.EntryValidation.Text, _pagePad2.EntryBoxCustomerPhone.EntryValidation.Text, _pagePad2.EntryBoxCustomerEmail.EntryValidation.Text, _pagePad2.EntryBoxSelectCustomerCountry.Value, _pagePad2.EntryBoxSelectCustomerFiscalNumber.EntryValidation.Text, _pagePad2.EntryBoxSelectCustomerCardNumber.EntryValidation.Text, FrameworkUtils.StringToDecimal(_pagePad2.EntryBoxCustomerDiscount.EntryValidation.Text), _pagePad2.EntryBoxCustomerNotes.EntryValidation.Text ); if (resultObject.GetType() == typeof(ERP_Customer)) { customer = (ERP_Customer)resultObject; } else { //If error in Save or Update Customer if (resultObject.GetType() == typeof(ConstraintViolationException)) { Exception ex = (Exception)resultObject; ResponseType response = Utils.ShowMessageTouch(_sourceWindow, DialogFlags.DestroyWithParent | DialogFlags.Modal, MessageType.Warning, ButtonsType.Close, Resx.window_title_dialog_exception_error, ex.InnerException.Message); } customer = null; } //Construct ProcessFinanceDocumentParameter ProcessFinanceDocumentParameter result = new ProcessFinanceDocumentParameter( _pagePad1.EntryBoxSelectDocumentFinanceType.Value.Oid, _pagePad3.ArticleBag ) { Customer = (customer != null) ? customer.Oid : Guid.Empty, }; //PaymentConditions if (_pagePad1.EntryBoxSelectConfigurationPaymentCondition.Value != null && _pagePad1.EntryBoxSelectConfigurationPaymentCondition.Value.Oid != new Guid()) { result.PaymentCondition = _pagePad1.EntryBoxSelectConfigurationPaymentCondition.Value.Oid; } //PaymentMethod if (_pagePad1.EntryBoxSelectConfigurationPaymentMethod.Value != null && _pagePad1.EntryBoxSelectConfigurationPaymentMethod.Value.Oid != new Guid()) { result.PaymentMethod = _pagePad1.EntryBoxSelectConfigurationPaymentMethod.Value.Oid; } //TotalDelivery: If Money force TotalDelivery to be equal to TotalFinal if (result.PaymentMethod != null && result.PaymentMethod != new Guid()) { FIN_ConfigurationPaymentMethod paymentMethod = (FIN_ConfigurationPaymentMethod)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_ConfigurationPaymentMethod), result.PaymentMethod); if (paymentMethod.Token == "MONEY") { result.TotalDelivery = _pagePad3.ArticleBag.TotalFinal; } } //Currency if (_pagePad1.EntryBoxSelectConfigurationCurrency.Value.Oid != new Guid()) { result.Currency = _pagePad1.EntryBoxSelectConfigurationCurrency.Value.Oid; result.ExchangeRate = (_pagePad1.EntryBoxSelectConfigurationCurrency.Value.ExchangeRate == 0) ? 1 : _pagePad1.EntryBoxSelectConfigurationCurrency.Value.ExchangeRate; } //DocumentParent if (_pagePad1.EntryBoxSelectSourceDocumentFinance.Value != null && _pagePad1.EntryBoxSelectSourceDocumentFinance.Value.Oid != new Guid()) { result.DocumentParent = _pagePad1.EntryBoxSelectSourceDocumentFinance.Value.Oid; } //SourceMode result.SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag; //Not Used //SourceOrderMain : Dont have a OrderMain Source //FinanceDocuments //TotalChange //OrderReferences if (_pagePad1.EntryBoxSelectSourceDocumentFinance.Value != null) { List <FIN_DocumentFinanceMaster> orderReferences = new List <FIN_DocumentFinanceMaster>(); orderReferences.Add(_pagePad1.EntryBoxSelectSourceDocumentFinance.Value); result.OrderReferences = orderReferences; } //If in WayBillMode Assign ShipTo and ShipFrom if (wayBillMode) { //ShipTo: Not Used : Address, BuildingNumber, StreetName result.ShipTo = new MovementOfGoodsProperties(); if (_pagePad4.EntryBoxShipToDeliveryID.EntryValidation.Text != string.Empty) { result.ShipTo.DeliveryID = _pagePad4.EntryBoxShipToDeliveryID.EntryValidation.Text; } if (_pagePad4.EntryBoxShipToDeliveryDate.EntryValidation.Text != string.Empty) { result.ShipTo.DeliveryDate = Convert.ToDateTime(_pagePad4.EntryBoxShipToDeliveryDate.EntryValidation.Text); } if (_pagePad4.EntryBoxShipToWarehouseID.EntryValidation.Text != string.Empty) { result.ShipTo.WarehouseID = _pagePad4.EntryBoxShipToWarehouseID.EntryValidation.Text; } if (_pagePad4.EntryBoxShipToLocationID.EntryValidation.Text != string.Empty) { result.ShipTo.LocationID = _pagePad4.EntryBoxShipToLocationID.EntryValidation.Text; } if (_pagePad4.EntryBoxShipToAddressDetail.EntryValidation.Text != string.Empty) { result.ShipTo.AddressDetail = _pagePad4.EntryBoxShipToAddressDetail.EntryValidation.Text; } if (_pagePad4.EntryBoxShipToCity.EntryValidation.Text != string.Empty) { result.ShipTo.City = _pagePad4.EntryBoxShipToCity.EntryValidation.Text; } if (_pagePad4.EntryBoxShipToPostalCode.EntryValidation.Text != string.Empty) { result.ShipTo.PostalCode = _pagePad4.EntryBoxShipToPostalCode.EntryValidation.Text; } if (_pagePad4.EntryBoxShipToRegion.EntryValidation.Text != string.Empty) { result.ShipTo.Region = _pagePad4.EntryBoxShipToRegion.EntryValidation.Text; } if (_pagePad4.EntryBoxSelectShipToCountry.Value.Oid != new Guid()) { result.ShipTo.Country = _pagePad4.EntryBoxSelectShipToCountry.Value.Code2; result.ShipTo.CountryGuid = _pagePad4.EntryBoxSelectShipToCountry.Value.Oid; } //ShipFrom: Not Used : Address, BuildingNumber, StreetName result.ShipFrom = new MovementOfGoodsProperties(); if (_pagePad5.EntryBoxShipFromDeliveryID.EntryValidation.Text != string.Empty) { result.ShipFrom.DeliveryID = _pagePad5.EntryBoxShipFromDeliveryID.EntryValidation.Text; } if (_pagePad5.EntryBoxShipFromDeliveryDate.EntryValidation.Text != string.Empty) { result.ShipFrom.DeliveryDate = Convert.ToDateTime(_pagePad5.EntryBoxShipFromDeliveryDate.EntryValidation.Text); } if (_pagePad5.EntryBoxShipFromWarehouseID.EntryValidation.Text != string.Empty) { result.ShipFrom.WarehouseID = _pagePad5.EntryBoxShipFromWarehouseID.EntryValidation.Text; } if (_pagePad5.EntryBoxShipFromLocationID.EntryValidation.Text != string.Empty) { result.ShipFrom.LocationID = _pagePad5.EntryBoxShipFromLocationID.EntryValidation.Text; } if (_pagePad5.EntryBoxShipFromAddressDetail.EntryValidation.Text != string.Empty) { result.ShipFrom.AddressDetail = _pagePad5.EntryBoxShipFromAddressDetail.EntryValidation.Text; } if (_pagePad5.EntryBoxShipFromCity.EntryValidation.Text != string.Empty) { result.ShipFrom.City = _pagePad5.EntryBoxShipFromCity.EntryValidation.Text; } if (_pagePad5.EntryBoxShipFromPostalCode.EntryValidation.Text != string.Empty) { result.ShipFrom.PostalCode = _pagePad5.EntryBoxShipFromPostalCode.EntryValidation.Text; } if (_pagePad5.EntryBoxShipFromRegion.EntryValidation.Text != string.Empty) { result.ShipFrom.Region = _pagePad5.EntryBoxShipFromRegion.EntryValidation.Text; } if (_pagePad5.EntryBoxSelectShipFromCountry.Value.Oid != new Guid()) { result.ShipFrom.Country = _pagePad5.EntryBoxSelectShipFromCountry.Value.Code2; result.ShipFrom.CountryGuid = _pagePad5.EntryBoxSelectShipFromCountry.Value.Oid; } } //Notes if (_pagePad1.EntryBoxDocumentMasterNotes.EntryValidation.Text != string.Empty) { result.Notes = _pagePad1.EntryBoxDocumentMasterNotes.EntryValidation.Text; } return(result); }
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(); } }
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //ProcessFinanceDocument //Use: DocumentFinanceMaster resultDocument = FrameworkCalls.ProcessFinanceDocument(SourceWindow, processFinanceDocumentParameter); public static fin_documentfinancemaster PersistFinanceDocument(Window pSourceWindow, ProcessFinanceDocumentParameter pProcessFinanceDocumentParameter) { bool printDocument = true; fin_documentfinancemaster result = null; try { //Protection to Check if SystemDate is < Last DocumentDate ResponseType responseType = Utils.ShowMessageTouchCheckIfFinanceDocumentHasValidDocumentDate(pSourceWindow, pProcessFinanceDocumentParameter); if (responseType != ResponseType.Yes) { return(result); } fin_documentfinancemaster documentFinanceMaster = ProcessFinanceDocument.PersistFinanceDocument(pProcessFinanceDocumentParameter, true); fin_documentfinancedetailorderreference fin_documentfinancedetailorderreference = new fin_documentfinancedetailorderreference(); if (documentFinanceMaster != null) { //ATWS : SendDocumentToATWSDialog if (SendDocumentToATWSEnabled(documentFinanceMaster)) { SendDocumentToATWSDialog(pSourceWindow, documentFinanceMaster); } /* TK013134 - Parking Ticket Module */ foreach (var item in GlobalFramework.PendentPayedParkingTickets) { _log.Debug("[PARKING TICKET] Informing Access.Track that the parking ticket has been payed..."); AccessTrackParkingTicketService.TimeService accessTrackParkingTicketService = new AccessTrackParkingTicketService.TimeService(); bool isTicketPayedInformed = accessTrackParkingTicketService.payTicket(item.Key); _log.Debug($"[PARKING TICKET] Barcode '{item.Key}' sent to Access.Track: Guid '{item.Value}'"); if (!isTicketPayedInformed) { _log.Debug($"[PARKING TICKET] Barcode '{item.Key}' not identified by Access.Track: Guid '{item.Value}'"); } else if (accessTrackParkingTicketService.isTicketValid(item.Key)) { _log.Debug($"[PARKING TICKET] Barcode '{item.Key}' payed successfully"); } else { _log.Error($"[PARKING TICKET] Barcode '{item.Key}' payment has not been recognized by Access.Track!"); } } //IN009279 Parking ticket Service - implementar Cartão cliente int i = 0; foreach (var item in GlobalFramework.PendentPayedParkingCards) { _log.Debug("[PARKING TICKET] Informing Access.Track that the parking card has been payed..."); AccessTrackParkingTicketService.TimeService accessTrackParkingTicketService = new AccessTrackParkingTicketService.TimeService(); //Number of months paid is passed by document notes string sql = string.Format("SELECT Notes FROM fin_documentfinancemaster where SourceOrderMain = '{0}'", item.Value); var sqlResult = GlobalFramework.SessionXpo.ExecuteScalar(sql); string sqlResultquantity = sqlResult.ToString(); string[] quantity = sqlResultquantity.Trim().Split(' '); int splitCount = quantity.Length; int[] number = new int[splitCount]; if (quantity[i].Contains(",")) { number[i] = int.Parse(quantity[i].Substring(0, quantity[i].IndexOf(','))); //Contains decimal separator } else { number[i] = int.Parse(quantity[i]); //Contains only numbers, no decimal separator. } DateTime localDate = DateTime.Now; DateTime endDate = localDate.AddMonths(Convert.ToInt32(number[i])); string dateNow = localDate.ToString(); string dateEnd = endDate.ToString(); accessTrackParkingTicketService.payCard(item.Key, dateNow, dateEnd); i++; }//IN009279 ENDS //Always Send back the Valid Document result = documentFinanceMaster; if (documentFinanceMaster.DocumentType.PrintRequestConfirmation) { responseType = Utils.ShowMessageTouch( pSourceWindow, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_document_finance"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_request_print_document_confirmation") ); if (responseType == ResponseType.No) { printDocument = false; } } //Print Document if (printDocument) { PrintFinanceDocument(pSourceWindow, documentFinanceMaster); } } } catch (Exception 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_INVALID_DOCUMENT_NUMBER": 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_invalid_documentnumber")); break; case "ERROR_COMMIT_FINANCE_DOCUMENT": 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_commit_session")); break; //TODO: NEW CLASS FinanceDocumentValidate : IMPLEMENT HERE THE RESULT EXCEPTION FOR VALIDATE_SIMPLIFIED_INVOICE default: errorMessage = string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_error_creating_financial_document"), ex.Message); break; } Utils.ShowMessageTouch( pSourceWindow, DialogFlags.Modal, _sizeDefaultWindowSize, MessageType.Error, ButtonsType.Close, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_error"), errorMessage ); } return(result); }
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //ProcessFinanceDocument //Use: DocumentFinanceMaster resultDocument = FrameworkCalls.ProcessFinanceDocument(SourceWindow, processFinanceDocumentParameter); public static FIN_DocumentFinanceMaster PersistFinanceDocument(Window pSourceWindow, ProcessFinanceDocumentParameter pProcessFinanceDocumentParameter) { bool printDocument = true; FIN_DocumentFinanceMaster result = null; try { //Protection to Check if SystemDate is < Last DocumentDate ResponseType responseType = Utils.ShowMessageTouchCheckIfFinanceDocumentHasValidDocumentDate(pSourceWindow, pProcessFinanceDocumentParameter); if (responseType != ResponseType.Yes) { return(result); } FIN_DocumentFinanceMaster documentFinanceMaster = ProcessFinanceDocument.PersistFinanceDocument(pProcessFinanceDocumentParameter, true); if (documentFinanceMaster != null) { //ATWS : SendDocumentToATWSDialog if (SendDocumentToATWSEnabled(documentFinanceMaster)) { SendDocumentToATWSDialog(pSourceWindow, documentFinanceMaster); } //Always Send back the Valid Document result = documentFinanceMaster; if (documentFinanceMaster.DocumentType.PrintRequestConfirmation) { responseType = Utils.ShowMessageTouch( pSourceWindow, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo, Resx.window_title_dialog_document_finance, Resx.dialog_message_request_print_document_confirmation ); if (responseType == ResponseType.No) { printDocument = false; } } //Print Document if (printDocument) { PrintFinanceDocument(pSourceWindow, documentFinanceMaster); } } } catch (Exception ex) { string errorMessage = string.Empty; switch (ex.Message) { case "ERROR_MISSING_SERIE": errorMessage = string.Format(Resx.dialog_message_error_creating_financial_document, Resx.dialog_message_error_creating_financial_document_missing_series); break; case "ERROR_INVALID_DOCUMENT_NUMBER": errorMessage = string.Format(Resx.dialog_message_error_creating_financial_document, Resx.dialog_message_error_creating_financial_document_invalid_documentnumber); break; case "ERROR_COMMIT_FINANCE_DOCUMENT": errorMessage = string.Format(Resx.dialog_message_error_creating_financial_document, Resx.dialog_message_error_creating_financial_document_commit_session); break; //TODO: NEW CLASS FinanceDocumentValidate : IMPLEMENT HERE THE RESULT EXCEPTION FOR VALIDATE_SIMPLIFIED_INVOICE default: errorMessage = string.Format(Resx.dialog_message_error_creating_financial_document, ex.Message); break; } Utils.ShowMessageTouch( pSourceWindow, DialogFlags.Modal, _sizeDefaultWindowSize, MessageType.Error, ButtonsType.Close, Resx.global_error, errorMessage ); } return(result); }
public PosPaymentsDialog(Window pSourceWindow, DialogFlags pDialogFlags, ArticleBag pArticleBag, bool pEnablePartialPaymentButtons, bool pEnableCurrentAccountButton, bool pSkipPersistFinanceDocument, ProcessFinanceDocumentParameter pProcessFinanceDocumentParameter, string pSelectedPaymentMethodButtonName) : base(pSourceWindow, pDialogFlags, false) { try { //Init Local Vars _sourceWindow = pSourceWindow; string windowTitle = Resx.window_title_dialog_payments; //TODO:THEME Size windowSize = new Size(598, 620); string fileDefaultWindowIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\Windows\icon_window_payments.png"); //Parameters _articleBagFullPayment = pArticleBag; _skipPersistFinanceDocument = pSkipPersistFinanceDocument; _processFinanceDocumentParameter = pProcessFinanceDocumentParameter; bool enablePartialPaymentButtons = pEnablePartialPaymentButtons; bool enableCurrentAccountButton = pEnableCurrentAccountButton; if (enablePartialPaymentButtons) { enablePartialPaymentButtons = (_articleBagFullPayment.TotalQuantity > 1) ? true : false; } //Files string fileIconClearCustomer = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\icon_pos_nav_delete.png"); string fileIconFullPayment = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\icon_pos_payment_full.png"); string fileIconPartialPayment = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\icon_pos_payment_partial.png"); //Colors Color colorPosPaymentsDialogTotalPannelBackground = FrameworkUtils.StringToColor(GlobalFramework.Settings["colorPosPaymentsDialogTotalPannelBackground"]); //Objects _intialValueConfigurationCountry = SettingsApp.ConfigurationSystemCountry; //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Payment Buttons //Get Custom Select Data string executeSql = @"SELECT Oid, Token, ResourceString FROM fin_configurationpaymentmethod ORDER BY Ord;"; XPSelectData xPSelectData = FrameworkUtils.GetSelectedDataFromQuery(executeSql); //Get Required XpObjects from Selected Data FIN_ConfigurationPaymentMethod xpoMoney = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "MONEY"); FIN_ConfigurationPaymentMethod xpoCheck = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "BANK_CHECK"); FIN_ConfigurationPaymentMethod xpoMB = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "CASH_MACHINE"); FIN_ConfigurationPaymentMethod xpoCreditCard = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "CREDIT_CARD"); FIN_ConfigurationPaymentMethod xpoVisa = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "VISA"); FIN_ConfigurationPaymentMethod xpoCurrentAccount = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "CURRENT_ACCOUNT"); FIN_ConfigurationPaymentMethod xpoCustomerCard = (FIN_ConfigurationPaymentMethod)xPSelectData.GetXPGuidObjectFromField(typeof(FIN_ConfigurationPaymentMethod), "Token", "CUSTOMER_CARD"); //Instantiate Buttons TouchButtonIconWithText buttonMoney = new TouchButtonIconWithText("touchButtonMoney_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoMoney.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoMoney.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height) { CurrentButtonOid = xpoMoney.Oid, Sensitive = (xpoMoney.Disabled) ? false : true }; TouchButtonIconWithText buttonCheck = new TouchButtonIconWithText("touchButtonCheck_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoCheck.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoCheck.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height) { CurrentButtonOid = xpoCheck.Oid, Sensitive = (xpoCheck.Disabled) ? false : true }; TouchButtonIconWithText buttonMB = new TouchButtonIconWithText("touchButtonMB_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoMB.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoMB.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height) { CurrentButtonOid = xpoMB.Oid, Sensitive = (xpoMB.Disabled) ? false : true }; TouchButtonIconWithText buttonCreditCard = new TouchButtonIconWithText("touchButtonCreditCard_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoCreditCard.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoCreditCard.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height) { CurrentButtonOid = xpoCreditCard.Oid, Sensitive = (xpoCreditCard.Disabled) ? false : true }; TouchButtonIconWithText buttonVisa = new TouchButtonIconWithText("touchButtonVisa_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoVisa.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoVisa.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height) { CurrentButtonOid = xpoVisa.Oid, Sensitive = (xpoVisa.Disabled) ? false : true }; TouchButtonIconWithText buttonCurrentAccount = new TouchButtonIconWithText("touchButtonCurrentAccount_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoCurrentAccount.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoCurrentAccount.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height) { CurrentButtonOid = xpoCurrentAccount.Oid, Sensitive = (xpoCurrentAccount.Disabled) ? false : true }; TouchButtonIconWithText buttonCustomerCard = new TouchButtonIconWithText("touchButtonCustomerCard_Green", _colorBaseDialogDefaultButtonBackground, Resx.ResourceManager.GetString(xpoCustomerCard.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoCustomerCard.ButtonIcon)), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height) { CurrentButtonOid = xpoCustomerCard.Oid, Sensitive = (xpoCustomerCard.Disabled) ? false : true }; //Secondary Buttons //Events buttonMoney.Clicked += buttonMoney_Clicked; buttonCheck.Clicked += buttonCheck_Clicked; buttonMB.Clicked += buttonMB_Clicked; buttonCreditCard.Clicked += buttonCredit_Clicked; buttonVisa.Clicked += buttonVisa_Clicked; buttonCurrentAccount.Clicked += buttonCurrentAccount_Clicked; buttonCustomerCard.Clicked += buttonCustomerCard_Clicked; //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Table uint tablePaymentsPadding = 0; Table tablePayments = new Table(2, 3, true) { BorderWidth = 2 }; //Row 1 tablePayments.Attach(buttonMoney, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding); tablePayments.Attach(buttonMB, 1, 2, 0, 1, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding); tablePayments.Attach(buttonVisa, 2, 3, 0, 1, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding); //Row 2 tablePayments.Attach(buttonCheck, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding); tablePayments.Attach(buttonCreditCard, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding); if (enableCurrentAccountButton) { tablePayments.Attach( (SettingsApp.PosPaymentsDialogUseCurrentAccount) ? buttonCurrentAccount : buttonCustomerCard , 2, 3, 1, 2, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding ); } //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Labels Label labelTotal = new Label(Resx.global_total_price_to_pay + ":"); Label labelDelivery = new Label(Resx.global_total_deliver + ":"); Label labelChange = new Label(Resx.global_total_change + ":"); _labelTotalValue = new Label(FrameworkUtils.DecimalToStringCurrency(_articleBagFullPayment.TotalFinal)) { //Total Width WidthRequest = 120 }; _labelDeliveryValue = new Label(FrameworkUtils.DecimalToStringCurrency(0)); _labelChangeValue = new Label(FrameworkUtils.DecimalToStringCurrency(0)); //Colors labelTotal.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.FromArgb(101, 137, 171))); labelDelivery.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.FromArgb(101, 137, 171))); labelChange.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.FromArgb(101, 137, 171))); _labelTotalValue.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.White)); _labelDeliveryValue.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.White)); _labelChangeValue.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.White)); //Alignments labelTotal.SetAlignment(0, 0.5F); labelDelivery.SetAlignment(0, 0.5F); labelChange.SetAlignment(0, 0.5F); _labelTotalValue.SetAlignment(1, 0.5F); _labelDeliveryValue.SetAlignment(1, 0.5F); _labelChangeValue.SetAlignment(1, 0.5F); //labels Font Pango.FontDescription fontDescription = Pango.FontDescription.FromString("Bold 10"); labelTotal.ModifyFont(fontDescription); labelDelivery.ModifyFont(fontDescription); labelChange.ModifyFont(fontDescription); Pango.FontDescription fontDescriptionValue = Pango.FontDescription.FromString("Bold 12"); _labelTotalValue.ModifyFont(fontDescriptionValue); _labelDeliveryValue.ModifyFont(fontDescriptionValue); _labelChangeValue.ModifyFont(fontDescriptionValue); //Table TotalPannel uint totalPannelPadding = 9; Table tableTotalPannel = new Table(3, 2, false); tableTotalPannel.HeightRequest = 132; //Row 1 tableTotalPannel.Attach(labelTotal, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding); tableTotalPannel.Attach(_labelTotalValue, 1, 2, 0, 1, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding); //Row 2 tableTotalPannel.Attach(labelDelivery, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding); tableTotalPannel.Attach(_labelDeliveryValue, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding); //Row 3 tableTotalPannel.Attach(labelChange, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding); tableTotalPannel.Attach(_labelChangeValue, 1, 2, 2, 3, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding); //TotalPannel EventBox eventboxTotalPannel = new EventBox(); eventboxTotalPannel.BorderWidth = 3; eventboxTotalPannel.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(colorPosPaymentsDialogTotalPannelBackground)); eventboxTotalPannel.Add(tableTotalPannel); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Customer Name CriteriaOperator criteriaOperatorCustomerName = null; _entryBoxSelectCustomerName = new XPOEntryBoxSelectRecordValidation <ERP_Customer, TreeViewCustomer>(_sourceWindow, Resx.global_customer, "Name", "Name", null, criteriaOperatorCustomerName, KeyboardMode.Alfa, SettingsApp.RegexAlfaNumeric, false); _entryBoxSelectCustomerName.ClosePopup += delegate { GetCustomerDetails("Oid", _entryBoxSelectCustomerName.Value.Oid.ToString()); Validate(); }; _entryBoxSelectCustomerName.EntryValidation.Changed += _entryBoxSelectCustomerName_Changed; //Customer Discount _entryBoxCustomerDiscount = new EntryBoxValidation(_sourceWindow, Resx.global_discount, KeyboardMode.Alfa, SettingsApp.RegexPercentage, true); _entryBoxCustomerDiscount.EntryValidation.Text = FrameworkUtils.DecimalToString(0.0m); _entryBoxCustomerDiscount.EntryValidation.Sensitive = false; _entryBoxCustomerDiscount.EntryValidation.Changed += _entryBoxCustomerDiscount_Changed; _entryBoxCustomerDiscount.EntryValidation.FocusOutEvent += delegate { _entryBoxCustomerDiscount.EntryValidation.Text = FrameworkUtils.StringToDecimalAndToStringAgain(_entryBoxCustomerDiscount.EntryValidation.Text); }; //Address _entryBoxCustomerAddress = new EntryBoxValidation(this, Resx.global_address, KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericExtended, false); _entryBoxCustomerAddress.EntryValidation.Changed += delegate { Validate(); }; //Locality _entryBoxCustomerLocality = new EntryBoxValidation(this, Resx.global_locality, KeyboardMode.Alfa, SettingsApp.RegexAlfa, false); _entryBoxCustomerLocality.EntryValidation.Changed += delegate { Validate(); }; //ZipCode _entryBoxCustomerZipCode = new EntryBoxValidation(this, Resx.global_zipcode, KeyboardMode.Alfa, SettingsApp.ConfigurationSystemCountry.RegExZipCode, false); _entryBoxCustomerZipCode.WidthRequest = 150; _entryBoxCustomerZipCode.EntryValidation.Changed += delegate { Validate(); }; //City _entryBoxCustomerCity = new EntryBoxValidation(this, Resx.global_city, KeyboardMode.Alfa, SettingsApp.RegexAlfa, false); _entryBoxCustomerCity.WidthRequest = 200; _entryBoxCustomerCity.EntryValidation.Changed += delegate { Validate(); }; //Country CriteriaOperator criteriaOperatorCustomerCountry = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled <> 1) AND (RegExFiscalNumber IS NOT NULL AND RegExZipCode IS NOT NULL)"); _entryBoxSelectCustomerCountry = new XPOEntryBoxSelectRecordValidation <CFG_ConfigurationCountry, TreeViewConfigurationCountry>(pSourceWindow, Resx.global_country, "Designation", "Oid", _intialValueConfigurationCountry, criteriaOperatorCustomerCountry, SettingsApp.RegexGuid, true); _entryBoxSelectCustomerCountry.WidthRequest = 235; //Extra Protection to prevent Customer without Country if (_entryBoxSelectCustomerCountry.Value != null) { _entryBoxSelectCustomerCountry.EntryValidation.Validate(_entryBoxSelectCustomerCountry.Value.Oid.ToString()); } _entryBoxSelectCustomerCountry.EntryValidation.IsEditable = false; _entryBoxSelectCustomerCountry.ButtonSelectValue.Sensitive = false; _entryBoxSelectCustomerCountry.ClosePopup += delegate { _selectedCountry = _entryBoxSelectCustomerCountry.Value; //Require to Update RegEx and Criteria to filter Country Clients Only _entryBoxSelectCustomerFiscalNumber.EntryValidation.Rule = _entryBoxSelectCustomerCountry.Value.RegExFiscalNumber; _entryBoxCustomerZipCode.EntryValidation.Rule = _entryBoxSelectCustomerCountry.Value.RegExZipCode; //Clear Customer Fields, Except Country ClearCustomer(false); //Apply Criteria Operators ApplyCriteriaToCustomerInputs(); //Call Main Validate Validate(); }; //FiscalNumber CriteriaOperator criteriaOperatorFiscalNumber = null; _entryBoxSelectCustomerFiscalNumber = new XPOEntryBoxSelectRecordValidation <ERP_Customer, TreeViewCustomer>(_sourceWindow, Resx.global_fiscal_number, "FiscalNumber", "FiscalNumber", null, criteriaOperatorFiscalNumber, KeyboardMode.AlfaNumeric, _intialValueConfigurationCountry.RegExFiscalNumber, false); _entryBoxSelectCustomerFiscalNumber.EntryValidation.Changed += _entryBoxSelectCustomerFiscalNumber_Changed; //CardNumber CriteriaOperator criteriaOperatorCardNumber = null;//Now Criteria is assigned in ApplyCriteriaToCustomerInputs(); _entryBoxSelectCustomerCardNumber = new XPOEntryBoxSelectRecordValidation <ERP_Customer, TreeViewCustomer>(_sourceWindow, Resx.global_card_number, "CardNumber", "CardNumber", null, criteriaOperatorCardNumber, KeyboardMode.AlfaNumeric, SettingsApp.RegexAlfaNumericExtended, false); _entryBoxSelectCustomerCardNumber.ClosePopup += delegate { if (_entryBoxSelectCustomerCardNumber.EntryValidation.Validated) { GetCustomerDetails("CardNumber", _entryBoxSelectCustomerCardNumber.EntryValidation.Text); } Validate(); }; //Notes _entryBoxCustomerNotes = new EntryBoxValidation(this, Resx.global_notes, KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericExtended, false); _entryBoxCustomerNotes.EntryValidation.Changed += delegate { Validate(); }; //Fill Dialog Inputs with Defaults FinalConsumerEntity Values if (_processFinanceDocumentParameter == null) { //If ProcessFinanceDocumentParameter is not null fill Dialog with value from ProcessFinanceDocumentParameter, implemented for SplitPayments GetCustomerDetails("Oid", SettingsApp.XpoOidDocumentFinanceMasterFinalConsumerEntity.ToString()); } //Fill Dialog Inputs with Stored Values, ex when we Work with SplitPayments else { //Apply Default Customer Entity GetCustomerDetails("Oid", _processFinanceDocumentParameter.Customer.ToString()); //Assign Totasl and Discounts Values _totalDelivery = _processFinanceDocumentParameter.TotalDelivery; _totalChange = _processFinanceDocumentParameter.TotalChange; _discountGlobal = _processFinanceDocumentParameter.ArticleBag.DiscountGlobal; // Update Visual Components _labelDeliveryValue.Text = FrameworkUtils.DecimalToStringCurrency(_totalDelivery); _labelChangeValue.Text = FrameworkUtils.DecimalToStringCurrency(_totalChange); // Selects _selectedCustomer = (ERP_Customer)FrameworkUtils.GetXPGuidObject(typeof(ERP_Customer), _processFinanceDocumentParameter.Customer); _selectedCountry = _selectedCustomer.Country; // PaymentMethod _selectedPaymentMethod = (FIN_ConfigurationPaymentMethod)FrameworkUtils.GetXPGuidObject(typeof(FIN_ConfigurationPaymentMethod), _processFinanceDocumentParameter.PaymentMethod); // Restore Selected Payment Method, require to associate button reference to selectedPaymentMethodButton if (!string.IsNullOrEmpty(pSelectedPaymentMethodButtonName)) { switch (pSelectedPaymentMethodButtonName) { case "touchButtonMoney_Green": _selectedPaymentMethodButton = buttonMoney; break; case "touchButtonCheck_Green": _selectedPaymentMethodButton = buttonCheck; break; case "touchButtonMB_Green": _selectedPaymentMethodButton = buttonMB; break; case "touchButtonCreditCard_Green": _selectedPaymentMethodButton = buttonCreditCard; break; case "touchButtonVisa_Green": _selectedPaymentMethodButton = buttonVisa; break; case "touchButtonCurrentAccount_Green": _selectedPaymentMethodButton = buttonCurrentAccount; break; case "touchButtonCustomerCard_Green": _selectedPaymentMethodButton = buttonCustomerCard; break; } //Assign Payment Method after have Reference AssignPaymentMethod(_selectedPaymentMethodButton); } //UpdateChangeValue, if we add/remove Splits we must recalculate ChangeValue UpdateChangeValue(); } //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Pack Content HBox hboxPaymenstAndTotals = new HBox(false, 0); hboxPaymenstAndTotals.PackStart(tablePayments, true, true, 0); hboxPaymenstAndTotals.PackStart(eventboxTotalPannel, true, true, 0); HBox hboxCustomerNameAndCustomerDiscount = new HBox(true, 0); hboxCustomerNameAndCustomerDiscount.PackStart(_entryBoxSelectCustomerName, true, true, 0); hboxCustomerNameAndCustomerDiscount.PackStart(_entryBoxCustomerDiscount, true, true, 0); HBox hboxFiscalNumberAndCardNumber = new HBox(true, 0); hboxFiscalNumberAndCardNumber.PackStart(_entryBoxSelectCustomerFiscalNumber, true, true, 0); hboxFiscalNumberAndCardNumber.PackStart(_entryBoxSelectCustomerCardNumber, true, true, 0); HBox hboxZipCodeCityAndCountry = new HBox(false, 0); hboxZipCodeCityAndCountry.PackStart(_entryBoxCustomerZipCode, false, false, 0); hboxZipCodeCityAndCountry.PackStart(_entryBoxCustomerCity, false, false, 0); hboxZipCodeCityAndCountry.PackStart(_entryBoxSelectCustomerCountry, true, true, 0); VBox vboxContent = new VBox(false, 0); vboxContent.PackStart(hboxPaymenstAndTotals, true, true, 0); vboxContent.PackStart(hboxFiscalNumberAndCardNumber, true, true, 0); vboxContent.PackStart(hboxCustomerNameAndCustomerDiscount, true, true, 0); vboxContent.PackStart(_entryBoxCustomerAddress, true, true, 0); vboxContent.PackStart(_entryBoxCustomerLocality, true, true, 0); vboxContent.PackStart(hboxZipCodeCityAndCountry, true, true, 0); vboxContent.PackStart(_entryBoxCustomerNotes, true, true, 0); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //ActionArea Buttons _buttonOk = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Ok); _buttonCancel = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Cancel); _buttonClearCustomer = ActionAreaButton.FactoryGetDialogButtonType("touchButtonClearCustomer_DialogActionArea", Resx.global_button_label_payment_dialog_clear_client, fileIconClearCustomer); _buttonFullPayment = ActionAreaButton.FactoryGetDialogButtonType("touchButtonFullPayment_DialogActionArea", Resx.global_button_label_payment_dialog_full_payment, fileIconFullPayment); _buttonPartialPayment = ActionAreaButton.FactoryGetDialogButtonType("touchButtonPartialPayment_DialogActionArea", Resx.global_button_label_payment_dialog_partial_payment, fileIconPartialPayment); // Enable if has selectedPaymentMethod defined, ex when working with SplitPayments _buttonOk.Sensitive = (_selectedPaymentMethod != null); _buttonFullPayment.Sensitive = false; //ActionArea ActionAreaButtons actionAreaButtons = new ActionAreaButtons(); actionAreaButtons.Add(new ActionAreaButton(_buttonClearCustomer, _responseTypeClearCustomer)); if (enablePartialPaymentButtons) { actionAreaButtons.Add(new ActionAreaButton(_buttonFullPayment, _responseTypeFullPayment)); actionAreaButtons.Add(new ActionAreaButton(_buttonPartialPayment, _responseTypePartialPayment)); } actionAreaButtons.Add(new ActionAreaButton(_buttonOk, ResponseType.Ok)); actionAreaButtons.Add(new ActionAreaButton(_buttonCancel, ResponseType.Cancel)); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Init Object this.InitObject(this, pDialogFlags, fileDefaultWindowIcon, windowTitle, windowSize, vboxContent, actionAreaButtons); } catch (Exception ex) { _log.Error(ex.Message, ex); } }