private void UpdateTitleBar() { try { decimal paymentPercentage = 0.0m; if (_diference < 0 || _diference > 0) { //Calculate in Default Currency [EUR] if (_paymentAmountTotal > 0) { paymentPercentage = (_payedAmount * 100) / _paymentAmountTotal; } WindowTitle = string.Format( "{0}: {1} / {2}{3}", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_pay_invoices"), FrameworkUtils.DecimalToStringCurrency(_diference, _entryBoxSelectConfigurationCurrency.Value.Acronym), FrameworkUtils.DecimalToStringCurrency(_paymentAmountTotal * _exchangeRate, _entryBoxSelectConfigurationCurrency.Value.Acronym), //Show only if above 100% (paymentPercentage < 100) ? string.Format(" / {0}%", FrameworkUtils.DecimalToString(paymentPercentage)) : string.Empty ); } else { WindowTitle = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_pay_invoices"); } } catch (Exception ex) { _log.Error(ex.Message, ex); } }
public string Format(string format, object arg, IFormatProvider formatProvider) { string result = string.Empty;; try { //Require to Convert Exponential from string to decimal currency result = FrameworkUtils.DecimalToStringCurrency(Convert.ToDecimal(double.Parse(arg.ToString()))); } catch (Exception ex) { _log.Error(ex.Message, ex); } return(result); }
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); } }
//OnResponse Ok Post Validation, Last Validations before Procced to PersistFinanceDocument private bool LastValidation() { //Defaylt is true bool result = true; ArticleBag articleBag = GetArticleBag(); try { //Protection to prevent Exceed Customer CardCredit if ( //Can be null if not in a Payable DocumentType _pagePad1.EntryBoxSelectConfigurationPaymentMethod.Value != null && _pagePad1.EntryBoxSelectConfigurationPaymentMethod.Value.Token == "CUSTOMER_CARD" && articleBag.TotalFinal > _pagePad2.EntryBoxSelectCustomerName.Value.CardCredit ) { Utils.ShowMessageTouch( this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, Resx.global_error, string.Format( Resx.dialog_message_value_exceed_customer_card_credit, FrameworkUtils.DecimalToStringCurrency(_pagePad2.EntryBoxSelectCustomerName.Value.CardCredit), FrameworkUtils.DecimalToStringCurrency(articleBag.TotalFinal) ) ); result = false; } //Protection to Prevent Recharge Customer Card with Invalid User (User without Card or FinalConsumer...) if (result && !FrameworkUtils.IsCustomerCardValidForArticleBag(articleBag, _pagePad2.EntryBoxSelectCustomerName.Value)) { Utils.ShowMessageTouch(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, Resx.global_error, Resx.dialog_message_invalid_customer_card_detected); result = false; } } catch (Exception ex) { _log.Error(ex.Message, ex); } return(result); }
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Methods public string GetPageTitle(int pPageIndex) { string result = string.Empty; result = string.Format("{0} :: {1}", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_new_finance_document"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], string.Format("window_title_dialog_document_finance_page{0}", pPageIndex + 1)) ); //Enable/Disable ClearCustomer if (_buttonClearCustomer != null) { _buttonClearCustomer.Visible = (_pagePad2 != null && pPageIndex == 1); } //Enable/Disable Preview if (_pagePad3 != null && _pagePad3.ArticleBag != null) { //Reference cfg_configurationcurrency configurationCurrency = _pagePad1.EntryBoxSelectConfigurationCurrency.Value; //Always Update Totals before Show Title _pagePad3.ArticleBag.DiscountGlobal = FrameworkUtils.StringToDecimal(_pagePad2.EntryBoxCustomerDiscount.EntryValidation.Text); _pagePad3.ArticleBag.UpdateTotals(); if (_pagePad3.ArticleBag.TotalFinal > 0) { result += string.Format(" : {0}", FrameworkUtils.DecimalToStringCurrency(_pagePad3.ArticleBag.TotalFinal * configurationCurrency.ExchangeRate, configurationCurrency.Acronym)); //Enable or Disabled Preview Button _buttonPreview.Visible = true; } else { //Enable or Disabled Preview Button _buttonPreview.Visible = false; } } return(result); }
/// <summary> /// Check if Open and Close CashDrawer Amount is Valid, Totals are Equal /// </summary> /// <param name="pLastMovementTypeAmount"></param> /// <returns></returns> private Boolean IsCashDrawerAmountValid(decimal pLastMovementTypeAmount) { decimal totalInCashDrawer; //With Drawer Opened if (GlobalFramework.WorkSessionPeriodTerminal != null) { decimal moneyCashTotalMovements = ProcessWorkSessionPeriod.GetSessionPeriodMovementTotal(GlobalFramework.WorkSessionPeriodTerminal, MovementTypeTotal.MoneyInCashDrawer); totalInCashDrawer = Math.Round(moneyCashTotalMovements, _decimalRoundTo); } //With Drawer Closed else { totalInCashDrawer = Math.Round(pLastMovementTypeAmount, _decimalRoundTo); } decimal diference = Math.Round(_movementAmountMoney - totalInCashDrawer, _decimalRoundTo); string message = string.Empty; //_log.Debug(string.Format("_movementAmountMoney: [{0}], pLastMovementTypeAmount:[{1}], totalInCashDrawer: [{2}], diference: [{3}]", _movementAmountMoney, pLastMovementTypeAmount, totalInCashDrawer, diference)); if (diference != 0) { message = string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_cashdrawer_open_close_total_enter_diferent_from_total_in_cashdrawer") , FrameworkUtils.DecimalToStringCurrency(totalInCashDrawer) , FrameworkUtils.DecimalToStringCurrency(_movementAmountMoney) , FrameworkUtils.DecimalToStringCurrency(diference) ); Utils.ShowMessageTouch(this, DialogFlags.Modal, new Size(600, 450), MessageType.Error, ButtonsType.Close, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_error"), message); return(false); } else { return(true); } }
protected override void OnResponse(ResponseType pResponse) { if (pResponse == ResponseType.Ok) { _movementAmountMoney = FrameworkUtils.StringToDecimal(_entryBoxMovementAmountMoney.EntryValidation.Text); _movementDescription = _entryBoxMovementDescription.EntryValidation.Text; decimal cashLastMovementTypeAmount = 0.0m; if (_selectedMovementType.Token == "CASHDRAWER_OPEN") { cashLastMovementTypeAmount = ProcessWorkSessionPeriod.GetSessionPeriodCashDrawerOpenOrCloseAmount("CASHDRAWER_CLOSE"); } else if (_selectedMovementType.Token == "CASHDRAWER_CLOSE") { cashLastMovementTypeAmount = ProcessWorkSessionPeriod.GetSessionPeriodCashDrawerOpenOrCloseAmount("CASHDRAWER_OPEN"); //Keep Running if (!IsCashDrawerAmountValid(cashLastMovementTypeAmount)) { this.Run(); } else { pResponse = Utils.ShowMessageTouch( this, DialogFlags.Modal, new Size(500, 350), MessageType.Question, ButtonsType.YesNo, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_button_label_print"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_request_print_document_confirmation")); if (pResponse == ResponseType.Yes) { FrameworkCalls.PrintWorkSessionMovement(this, GlobalFramework.LoggedTerminal.ThermalPrinter, GlobalFramework.WorkSessionPeriodTerminal); } } } else if (_selectedMovementType.Token == "CASHDRAWER_OUT") { //Check if Value is Small than AmountInCashDrawer if (_movementAmountMoney > _totalAmountInCashDrawer) { string movementAmountMoney = FrameworkUtils.DecimalToStringCurrency(_movementAmountMoney); string totalAmountInCashDrawer = FrameworkUtils.DecimalToStringCurrency(_totalAmountInCashDrawer); Utils.ShowMessageTouch( this, DialogFlags.Modal, new Size(500, 350), MessageType.Error, ButtonsType.Ok, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_error"), string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_cashdrawer_money_out_error"), movementAmountMoney, totalAmountInCashDrawer) ); //Keep Running this.Run(); } } } else if (pResponse == _responseTypePrint) { //Uncomment to Pront Session Day //PrintTicket.PrintWorkSessionMovementInit(GlobalFramework.LoggedTerminal.Printer, GlobalFramework.WorkSessionPeriodDay); //PrintWorkSessionMovement //PrintRouter.PrintWorkSessionMovement(GlobalFramework.LoggedTerminal.Printer, GlobalFramework.WorkSessionPeriodTerminal); FrameworkCalls.PrintWorkSessionMovement(this, GlobalFramework.LoggedTerminal.ThermalPrinter, GlobalFramework.WorkSessionPeriodTerminal); //PrintTicket.PrintWorkSessionMovement(GlobalFramework.LoggedTerminal.Printer, GlobalFramework.WorkSessionPeriodDay); //PrintTicket.PrintWorkSessionMovement(GlobalFramework.LoggedTerminal.Printer, GlobalFramework.WorkSessionPeriodTerminal); //(_sourceWindow as PosCashDialog).ShowClosePeriodMessage(GlobalFramework.WorkSessionPeriodDay); //(_sourceWindow as PosCashDialog).ShowClosePeriodMessage(GlobalFramework.WorkSessionPeriodTerminal); //TEST FROM PERSISTED GUID, PAST RESUMES - DEBUG ONLY //WorkSessionPeriod workSessionPeriodDay; //WorkSessionPeriod workSessionPeriodTerminal; //#0 - Day 1 //workSessionPeriodDay = (WorkSessionPeriod)FrameworkUtils.GetXPGuidObjectFromSession(typeof(WorkSessionPeriod), new Guid("90a187b3-c91b-4c5b-907a-d54a6ee1dcb6")); //PrintTicket.PrintWorkSessionMovement(GlobalFramework.LoggedTerminal.Printer, workSessionPeriodDay); //#8 - Day 2 //workSessionPeriodDay = (WorkSessionPeriod)FrameworkUtils.GetXPGuidObjectFromSession(typeof(WorkSessionPeriod), new Guid("5ce65097-55a2-4a6c-9406-aabe9f3f0124")); //PrintTicket.PrintWorkSessionMovement(GlobalFramework.LoggedTerminal.Printer, workSessionPeriodDay); //#1 - Day1 //workSessionPeriodTerminal = (WorkSessionPeriod)FrameworkUtils.GetXPGuidObjectFromSession(typeof(WorkSessionPeriod), new Guid("12d74d99-9734-4adb-b322-82f337e24d3e")); //PrintTicket.PrintWorkSessionMovement(GlobalFramework.LoggedTerminal.Printer, workSessionPeriodTerminal); //#2 - Day1 //workSessionPeriodTerminal = (WorkSessionPeriod)FrameworkUtils.GetXPGuidObjectFromSession(typeof(WorkSessionPeriod), new Guid("67758bb2-c52a-4c05-8e10-37f63f729ce4")); //PrintTicket.PrintWorkSessionMovement(GlobalFramework.LoggedTerminal.Printer, workSessionPeriodTerminal); //#3 - Day1 //workSessionPeriodTerminal = (WorkSessionPeriod)FrameworkUtils.GetXPGuidObjectFromSession(typeof(WorkSessionPeriod), new Guid("f43ae288-3615-44c0-b876-4fcac01efd1e")); //PrintTicket.PrintWorkSessionMovement(GlobalFramework.LoggedTerminal.Printer, workSessionPeriodTerminal); //#4 - Day1 //workSessionPeriodTerminal = (WorkSessionPeriod)FrameworkUtils.GetXPGuidObjectFromSession(typeof(WorkSessionPeriod), new Guid("8b261a90-c15d-4e54-a013-c85467338224")); //PrintTicket.PrintWorkSessionMovement(GlobalFramework.LoggedTerminal.Printer, workSessionPeriodTerminal); //#5 - Day1 //workSessionPeriodTerminal = (WorkSessionPeriod)FrameworkUtils.GetXPGuidObjectFromSession(typeof(WorkSessionPeriod), new Guid("13816f1f-4dd5-4351-afe4-c492f61cacb1")); //PrintTicket.PrintWorkSessionMovement(GlobalFramework.LoggedTerminal.Printer, workSessionPeriodTerminal); //#6 - Day1 //workSessionPeriodTerminal = (WorkSessionPeriod)FrameworkUtils.GetXPGuidObjectFromSession(typeof(WorkSessionPeriod), new Guid("e5698d06-5740-4317-b7c7-d3eb92063b37")); //PrintTicket.PrintWorkSessionMovement(GlobalFramework.LoggedTerminal.Printer, workSessionPeriodTerminal); //#7 - Day1 //workSessionPeriodTerminal = (WorkSessionPeriod)FrameworkUtils.GetXPGuidObjectFromSession(typeof(WorkSessionPeriod), new Guid("734c8ed3-34f9-4096-8c20-de9110a24817")); //PrintTicket.PrintWorkSessionMovement(GlobalFramework.LoggedTerminal.Printer, workSessionPeriodTerminal); //#9 - Day2 - Terminal #10 //workSessionPeriodTerminal = (WorkSessionPeriod)FrameworkUtils.GetXPGuidObjectFromSession(typeof(WorkSessionPeriod), new Guid("f445c36c-3ebd-46f1-bcbd-d158e497eda9")); //PrintTicket.PrintWorkSessionMovement(GlobalFramework.LoggedTerminal.Printer, workSessionPeriodTerminal); //#10 - Day2 - Terminal #20 //workSessionPeriodTerminal = (WorkSessionPeriod)FrameworkUtils.GetXPGuidObjectFromSession(typeof(WorkSessionPeriod), new Guid("74fd498a-c1a7-46e6-a117-14eea795e93d")); //PrintTicket.PrintWorkSessionMovement(GlobalFramework.LoggedTerminal.Printer, workSessionPeriodTerminal); //#11 - Day2 - Terminal #30 //workSessionPeriodTerminal = (WorkSessionPeriod)FrameworkUtils.GetXPGuidObjectFromSession(typeof(WorkSessionPeriod), new Guid("14631cda-f31a-4e7a-8a75-a3ba2955ccf8")); //PrintTicket.PrintWorkSessionMovement(GlobalFramework.LoggedTerminal.Printer, workSessionPeriodTerminal); this.Run(); } }
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); } }
private void CalculateTotalPerSplit(ArticleBag articleBag, int numberOfSplits) { bool debug = false; // Calculate final Total Pay per Split _totalPerSplit = articleBag.TotalFinal / numberOfSplits; try { // Always Init ArticleBags foreach (TouchButtonSplitPayment item in _splitPaymentButtons) { item.ArticleBag = new ArticleBag(); } // Init Object to Use priceTax on above Loop //Get Place Objects to extract TaxSellType Normal|TakeWay, Place, Tables etc OrderMain currentOrderMain = GlobalFramework.SessionApp.OrdersMain[GlobalFramework.SessionApp.CurrentOrderMainOid]; pos_configurationplace configurationPlace = (pos_configurationplace)GlobalFramework.SessionXpo.GetObjectByKey(typeof(pos_configurationplace), currentOrderMain.Table.PlaceId); // Loop articleBag, and Add the quantity for Each Split (Total Article Quantity / numberOfSplits) foreach (var article in articleBag) { // Default quantity to add to all Splitters, last one gets the extra Remains ex 0,0000000000001 decimal articleQuantity = (article.Value.Quantity / numberOfSplits); // Store Remain Quantity decimal articleQuantityRemain = article.Value.Quantity; // Check if Total is equal to Origin decimal articleQuantityCheck = 0.0m; decimal articleQuantityCheckModulo = 0.0m; // Reset t int t = 0; foreach (TouchButtonSplitPayment touchButtonSplitPayment in _splitPaymentButtons) { t++; // Discount articleQuantityRemain articleQuantityRemain = articleQuantityRemain - articleQuantity; if (t.Equals(_splitPaymentButtons.Count)) { // Override Default split Quantity, adding extra Remain articleQuantity += articleQuantityRemain; } // Add to articleQuantityCheck articleQuantityCheck += articleQuantity; // Modulo articleQuantityCheckModulo = article.Value.Quantity % articleQuantityCheck; if (debug) { _log.Debug(string.Format("#{0} Designation: [{1}], PriceFinal: [{2}], Quantity: [{3}]:[{4}]:[{5}]:[{6}]:[{7}]", t, article.Key.Designation, article.Value.PriceFinal, article.Value.Quantity, articleQuantity, articleQuantityRemain, articleQuantityCheck, articleQuantityCheckModulo) ); } // ArticleBagKey ArticleBagKey articleBagKey = new ArticleBagKey( article.Key.ArticleOid, article.Key.Designation, article.Key.Price, article.Key.Discount, article.Key.Vat ); //Detect and Assign VatExemptionReason to ArticleBak Key if (article.Key.VatExemptionReasonOid != null && article.Key.VatExemptionReasonOid != Guid.Empty) { articleBagKey.VatExemptionReasonOid = article.Key.VatExemptionReasonOid; } // ArticleBagProperties ArticleBagProperties articleBagProps = articleBagProps = new ArticleBagProperties( configurationPlace.Oid, currentOrderMain.Table.Oid, (PriceType)configurationPlace.PriceType.EnumValue, article.Value.Code, articleQuantity, article.Value.UnitMeasure ); // Add to ArticleBag touchButtonSplitPayment.ArticleBag.Add(articleBagKey, articleBagProps); } } // After have all splitPaymentButtons ArticleBags (End of arraySplit.Count Loop) foreach (TouchButtonSplitPayment item in _splitPaymentButtons) { // Require to Update ProcessFinanceDocumentParameter, like when we Close Payment Window, BEFORE UpdateTouchButtonSplitPaymentLabels // This is to Update UI when we Add/Remove Splits, else Already filled Payments dont Update // Only change ArticleBag if (item.ProcessFinanceDocumentParameter != null) { fin_configurationpaymentmethod paymentMethod = (fin_configurationpaymentmethod)FrameworkUtils.GetXPGuidObject(typeof(fin_configurationpaymentmethod), item.ProcessFinanceDocumentParameter.PaymentMethod); decimal totalDelivery = (paymentMethod.Token.Equals("MONEY")) ? item.ProcessFinanceDocumentParameter.TotalDelivery : item.ArticleBag.TotalFinal; item.ProcessFinanceDocumentParameter = new ProcessFinanceDocumentParameter( item.ProcessFinanceDocumentParameter.DocumentType, item.ArticleBag ) { PaymentMethod = item.ProcessFinanceDocumentParameter.PaymentMethod, PaymentCondition = item.ProcessFinanceDocumentParameter.PaymentCondition, Customer = item.ProcessFinanceDocumentParameter.Customer, TotalDelivery = totalDelivery, // Require to Recalculate TotalChange TotalChange = totalDelivery - item.ArticleBag.TotalFinal }; } // Always Update all Buttons, with and without ProcessFinanceDocumentParameter UpdateTouchButtonSplitPaymentLabels(item); // Update Window Title //if (WindowTitle != null) WindowTitle = string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_split_payment, numberOfSplits, FrameworkUtils.DecimalToStringCurrency(totalFinal)); if (WindowTitle != null) { WindowTitle = string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_split_payment"), numberOfSplits, FrameworkUtils.DecimalToStringCurrency(_totalPerSplit)); } } } catch (Exception ex) { _log.Error(ex.Message, ex); } }
public bool PrintWorkSessionMovement(sys_configurationprinters pPrinter, pos_worksessionperiod pWorkSessionPeriod, SplitCurrentAccountMode pSplitCurrentAccountMode) { bool result = false; if (pPrinter != null) { sys_configurationprinters printer = pPrinter; sys_configurationprinterstemplates template = (sys_configurationprinterstemplates)FrameworkUtils.GetXPGuidObject(typeof(sys_configurationprinterstemplates), SettingsApp.XpoOidConfigurationPrintersTemplateWorkSessionMovement); string splitCurrentAccountFilter = string.Empty; string fileTicket = template.FileTemplate; switch (pSplitCurrentAccountMode) { case SplitCurrentAccountMode.All: break; case SplitCurrentAccountMode.NonCurrentAcount: //Diferent from DocumentType CC splitCurrentAccountFilter = string.Format("AND DocumentType <> '{0}'", SettingsApp.XpoOidDocumentFinanceTypeCurrentAccountInput); break; case SplitCurrentAccountMode.CurrentAcount: //Only DocumentType CC splitCurrentAccountFilter = string.Format("AND DocumentType = '{0}'", SettingsApp.XpoOidDocumentFinanceTypeCurrentAccountInput); break; } try { //Shared Where for details and totals Queries string sqlWhere = string.Empty; if (pWorkSessionPeriod.PeriodType == WorkSessionPeriodType.Day) { sqlWhere = string.Format("PeriodParent = '{0}'{1}", pWorkSessionPeriod.Oid, splitCurrentAccountFilter); } else { sqlWhere = string.Format("Period = '{0}'{1}", pWorkSessionPeriod.Oid, splitCurrentAccountFilter); } //Shared for Both Modes if (sqlWhere != string.Empty) { sqlWhere = string.Format(" AND {0}", sqlWhere); } //Format to Display Vars string dateCloseDisplay = (pWorkSessionPeriod.SessionStatus == WorkSessionPeriodStatus.Open) ? resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_in_progress") : pWorkSessionPeriod.DateEnd.ToString(SettingsApp.DateTimeFormat); //Get Session Period Details Hashtable resultHashTable = ProcessWorkSessionPeriod.GetSessionPeriodSummaryDetails(pWorkSessionPeriod); //Print Header Summary DataRow dataRow = null; DataTable dataTable = new DataTable(); dataTable.Columns.Add(new DataColumn("Label", typeof(string))); dataTable.Columns.Add(new DataColumn("Value", typeof(string))); //Open DateTime dataRow = dataTable.NewRow(); dataRow[0] = string.Format("{0}:", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_worksession_open_datetime")); dataRow[1] = pWorkSessionPeriod.DateStart.ToString(SettingsApp.DateTimeFormat); dataTable.Rows.Add(dataRow); //Close DataTime dataRow = dataTable.NewRow(); dataRow[0] = string.Format("{0}:", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_worksession_close_datetime")); dataRow[1] = dateCloseDisplay; dataTable.Rows.Add(dataRow); //Open Total CashDrawer dataRow = dataTable.NewRow(); dataRow[0] = string.Format("{0}:", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_worksession_open_total_cashdrawer")); dataRow[1] = FrameworkUtils.DecimalToStringCurrency((decimal)resultHashTable["totalMoneyInCashDrawerOnOpen"]); dataTable.Rows.Add(dataRow); //Close Total CashDrawer dataRow = dataTable.NewRow(); dataRow[0] = string.Format("{0}:", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_worksession_close_total_cashdrawer")); dataRow[1] = FrameworkUtils.DecimalToStringCurrency((decimal)resultHashTable["totalMoneyInCashDrawer"]); dataTable.Rows.Add(dataRow); //Total Money In dataRow = dataTable.NewRow(); dataRow[0] = string.Format("{0}:", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_worksession_total_money_in")); dataRow[1] = FrameworkUtils.DecimalToStringCurrency((decimal)resultHashTable["totalMoneyIn"]); dataTable.Rows.Add(dataRow); //Total Money Out dataRow = dataTable.NewRow(); dataRow[0] = string.Format("{0}:", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_worksession_total_money_out")); dataRow[1] = FrameworkUtils.DecimalToStringCurrency((decimal)resultHashTable["totalMoneyOut"]); dataTable.Rows.Add(dataRow); //Configure Ticket Column Properties List <TicketColumn> columns = new List <TicketColumn>(); columns.Add(new TicketColumn("Label", "", Convert.ToInt16(_maxCharsPerLineNormal / 2) - 2, TicketColumnsAlign.Right)); columns.Add(new TicketColumn("Value", "", Convert.ToInt16(_maxCharsPerLineNormal / 2) - 2, TicketColumnsAlign.Left)); TicketTable ticketTable = new TicketTable(dataTable, columns, _thermalPrinterGeneric.MaxCharsPerLineNormalBold); //Print Ticket Table ticketTable.Print(_thermalPrinterGeneric); //Line Feed _thermalPrinterGeneric.LineFeed(); //Get Final Rendered DataTable Groups Dictionary <DataTableGroupPropertiesType, DataTableGroupProperties> dictGroupProperties = GenDataTableWorkSessionMovementResume(pWorkSessionPeriod.PeriodType, pSplitCurrentAccountMode, sqlWhere); //Prepare Local vars for Group Loop XPSelectData xPSelectData = null; string designation = string.Empty; decimal quantity = 0.0m; decimal total = 0.0m; string unitMeasure = string.Empty; //Store Final Totals decimal summaryTotalQuantity = 0.0m; decimal summaryTotal = 0.0m; //Used to Custom Print Table Ticket Rows List <string> tableCustomPrint = new List <string>(); //Start to process Group int groupPosition = -1; //Assign Position to Print Payment Group Split Title int groupPositionTitlePayments = (pWorkSessionPeriod.PeriodType == WorkSessionPeriodType.Day) ? 9 : 8; //If CurrentAccount Mode decrease 1, it dont have PaymentMethods if (pSplitCurrentAccountMode == SplitCurrentAccountMode.CurrentAcount) { groupPositionTitlePayments--; } foreach (KeyValuePair <DataTableGroupPropertiesType, DataTableGroupProperties> item in dictGroupProperties) //foreach (DataTableGroupProperties item in dictGroupProperties.Values) { if (item.Value.Enabled) { //Increment Group Position groupPosition++; //Print Group Titles (FinanceDocuments|Payments) if (groupPosition == 0) { _thermalPrinterGeneric.WriteLine(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_worksession_resume_finance_documents"), WriteLineTextMode.Big); _thermalPrinterGeneric.LineFeed(); } else if (groupPosition == groupPositionTitlePayments) { //When finish FinanceDocuemnts groups, print Last Row, the Summary Totals Row _thermalPrinterGeneric.WriteLine(tableCustomPrint[tableCustomPrint.Count - 1], WriteLineTextMode.DoubleHeight); _thermalPrinterGeneric.LineFeed(); _thermalPrinterGeneric.WriteLine(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_worksession_resume_paymens_documents"), WriteLineTextMode.Big); _thermalPrinterGeneric.LineFeed(); } //Reset Totals summaryTotalQuantity = 0.0m; summaryTotal = 0.0m; //Get Group Data from group Query xPSelectData = FrameworkUtils.GetSelectedDataFromQuery(item.Value.Sql); //Generate Columns columns = new List <TicketColumn>(); columns.Add(new TicketColumn("GroupTitle", item.Value.Title, 0, TicketColumnsAlign.Left)); columns.Add(new TicketColumn("Quantity", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_quantity_acronym"), 8, TicketColumnsAlign.Right, typeof(decimal), "{0:0.00}")); //columns.Add(new TicketColumn("UnitMeasure", string.Empty, 3)); columns.Add(new TicketColumn("Total", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_totalfinal_acronym"), 10, TicketColumnsAlign.Right, typeof(decimal), "{0:0.00}")); //Init DataTable dataTable = new DataTable(); dataTable.Columns.Add(new DataColumn("GroupDesignation", typeof(string))); dataTable.Columns.Add(new DataColumn("Quantity", typeof(decimal))); //dataTable.Columns.Add(new DataColumn("UnitMeasure", typeof(string))); dataTable.Columns.Add(new DataColumn("Total", typeof(decimal))); //If Has data if (xPSelectData.Data.Length > 0) { foreach (SelectStatementResultRow row in xPSelectData.Data) { designation = Convert.ToString(row.Values[xPSelectData.GetFieldIndex("Designation")]); quantity = Convert.ToDecimal(row.Values[xPSelectData.GetFieldIndex("Quantity")]); unitMeasure = Convert.ToString(row.Values[xPSelectData.GetFieldIndex("UnitMeasure")]); total = Convert.ToDecimal(row.Values[xPSelectData.GetFieldIndex("Total")]); // Override Encrypted values if (GlobalFramework.PluginSoftwareVendor != null && item.Key.Equals(DataTableGroupPropertiesType.DocumentsUser) || item.Key.Equals(DataTableGroupPropertiesType.PaymentsUser)) { designation = GlobalFramework.PluginSoftwareVendor.Decrypt(designation); } //Sum Summary Totals summaryTotalQuantity += quantity; summaryTotal += total; //_log.Debug(string.Format("Designation: [{0}], quantity: [{1}], unitMeasure: [{2}], total: [{3}]", designation, quantity, unitMeasure, total)); //Create Row dataRow = dataTable.NewRow(); dataRow[0] = designation; dataRow[1] = quantity; //dataRow[2] = unitMeasure; dataRow[2] = total; dataTable.Rows.Add(dataRow); } } else { //Create Row dataRow = dataTable.NewRow(); dataRow[0] = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_cashdrawer_without_movements"); dataRow[1] = 0.0m; //dataRow[2] = string.Empty;//UnitMeasure dataRow[2] = 0.0m; dataTable.Rows.Add(dataRow); } //Add Final Summary Row dataRow = dataTable.NewRow(); dataRow[0] = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_total"); dataRow[1] = summaryTotalQuantity; //dataRow[2] = string.Empty; dataRow[2] = summaryTotal; dataTable.Rows.Add(dataRow); //Prepare TicketTable ticketTable = new TicketTable(dataTable, columns, _thermalPrinterGeneric.MaxCharsPerLineNormal); //Custom Print Loop, to Print all Table Rows, and Detect Rows to Print in DoubleHeight (Title and Total) tableCustomPrint = ticketTable.GetTable(); WriteLineTextMode rowTextMode; //Dynamic Print All except Last One (Totals), Double Height in Titles for (int i = 0; i < tableCustomPrint.Count - 1; i++) { //Prepare TextMode Based on Row rowTextMode = (i == 0) ? WriteLineTextMode.DoubleHeight : WriteLineTextMode.Normal; //Print Row _thermalPrinterGeneric.WriteLine(tableCustomPrint[i], rowTextMode); } //Line Feed _thermalPrinterGeneric.LineFeed(); } } //When finish all groups, print Last Row, the Summary Totals Row, Ommited in Custom Print Loop _thermalPrinterGeneric.WriteLine(tableCustomPrint[tableCustomPrint.Count - 1], WriteLineTextMode.DoubleHeight); result = true; } catch (Exception ex) { _log.Error(ex.Message, ex); throw new Exception(ex.Message); } } return(result); }
public PosMoneyPadDialog(Window pSourceWindow, DialogFlags pDialogFlags, decimal pInitialValue = 0.0m, decimal pTotalOrder = 0.0m) : base(pSourceWindow, pDialogFlags) { //Init Local Vars String windowTitle; if (pTotalOrder > 0) { windowTitle = string.Format("{0} - {1} : {2}", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_moneypad"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_total_table_tickets"), FrameworkUtils.DecimalToStringCurrency(pTotalOrder)); } else { windowTitle = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_moneypad"); } this.InitObject(pSourceWindow, pDialogFlags, windowTitle, pInitialValue, pTotalOrder); }
public PosCashDrawerDialog(Window pSourceWindow, DialogFlags pDialogFlags) //Disable WindowTitleCloseButton : base(pSourceWindow, pDialogFlags, true, false) { try { //Parameters _sourceWindow = pSourceWindow; //If has a valid open session if (GlobalFramework.WorkSessionPeriodTerminal != null) { //Get From MoneyInCashDrawer, Includes CASHDRAWER_START and Money Movements _totalAmountInCashDrawer = ProcessWorkSessionPeriod.GetSessionPeriodMovementTotal(GlobalFramework.WorkSessionPeriodTerminal, MovementTypeTotal.MoneyInCashDrawer); } //Dont have Open Terminal Session YET, use from last Closed CashDrawer else { //Default Last Closed Cash Value _totalAmountInCashDrawer = ProcessWorkSessionPeriod.GetSessionPeriodCashDrawerOpenOrCloseAmount("CASHDRAWER_CLOSE"); } //Init Local Vars String windowTitle = string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_cashdrawer"), FrameworkUtils.DecimalToStringCurrency(_totalAmountInCashDrawer)); Size windowSize = new Size(462, 310);//400 With Other Payments String fileDefaultWindowIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\Windows\icon_window_cash_drawer.png"); String fileActionPrint = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\Dialogs\icon_pos_dialog_action_print.png"); //Get SeletedData from WorkSessionMovementType Buttons string executeSql = @"SELECT Oid, Token, ResourceString, ButtonIcon, Disabled FROM pos_worksessionmovementtype WHERE (Token LIKE 'CASHDRAWER_%') AND (Disabled IS NULL or Disabled <> 1) ORDER BY Ord;"; XPSelectData xPSelectData = FrameworkUtils.GetSelectedDataFromQuery(executeSql); //Init Dictionary string buttonBagKey; bool buttonDisabled; Dictionary <string, TouchButtonIconWithText> buttonBag = new Dictionary <string, TouchButtonIconWithText>(); TouchButtonIconWithText touchButtonIconWithText; HBox hboxCashDrawerButtons = new HBox(true, 5); bool buttonOkSensitive; //Generate Buttons foreach (SelectStatementResultRow row in xPSelectData.Data) { buttonBagKey = row.Values[xPSelectData.GetFieldIndex("Token")].ToString(); buttonDisabled = Convert.ToBoolean(row.Values[xPSelectData.GetFieldIndex("Disabled")]); touchButtonIconWithText = new TouchButtonIconWithText( string.Format("touchButton{0}_Green", buttonBagKey), Color.Transparent /*_colorBaseDialogDefaultButtonBackground*/, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], row.Values[xPSelectData.GetFieldIndex("ResourceString")].ToString()), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], row.Values[xPSelectData.GetFieldIndex("ButtonIcon")].ToString())), _sizeBaseDialogDefaultButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height ) { CurrentButtonOid = new Guid(row.Values[xPSelectData.GetFieldIndex("Oid")].ToString()), Sensitive = !buttonDisabled }; //Add to Dictionary buttonBag.Add(buttonBagKey, touchButtonIconWithText); //pack to VBhox hboxCashDrawerButtons.PackStart(touchButtonIconWithText, true, true, 0); //Events buttonBag[buttonBagKey].Clicked += PosCashDrawerDialog_Clicked; } //Initial Button Status, Based on Open/Close Terminal Session string initialButtonToken; if (GlobalFramework.WorkSessionPeriodTerminal != null && GlobalFramework.WorkSessionPeriodTerminal.SessionStatus == WorkSessionPeriodStatus.Open) { buttonBag["CASHDRAWER_OPEN"].Sensitive = false; buttonBag["CASHDRAWER_CLOSE"].Sensitive = true; buttonBag["CASHDRAWER_IN"].Sensitive = true; buttonBag["CASHDRAWER_OUT"].Sensitive = true; initialButtonToken = "CASHDRAWER_CLOSE"; buttonOkSensitive = true; } else { buttonBag["CASHDRAWER_OPEN"].Sensitive = true; buttonBag["CASHDRAWER_CLOSE"].Sensitive = false; buttonBag["CASHDRAWER_IN"].Sensitive = false; buttonBag["CASHDRAWER_OUT"].Sensitive = false; initialButtonToken = "CASHDRAWER_OPEN"; buttonOkSensitive = false; } //Initial Dialog Values _selectedCashDrawerButton = buttonBag[initialButtonToken]; _selectedCashDrawerButton.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(Utils.Lighten(_colorBaseDialogDefaultButtonBackground, 0.50f))); _selectedMovementType = (pos_worksessionmovementtype)FrameworkUtils.GetXPGuidObject(GlobalFramework.SessionXpo, typeof(pos_worksessionmovementtype), _selectedCashDrawerButton.CurrentButtonOid); _selectedMovementType.Token = initialButtonToken; //EntryAmountMoney _entryBoxMovementAmountMoney = new EntryBoxValidation(this, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_money"), KeyboardMode.Money, SettingsApp.RegexDecimalGreaterEqualThanZero, true); _entryBoxMovementAmountMoney.EntryValidation.Changed += delegate { ValidateDialog(); }; //TODO: Enable Other Payments //EntryAmountOtherPayments //_entryBoxMovementAmountOtherPayments = new EntryBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_other_payments, KeyboardModes.Money, regexDecimalGreaterThanZero, false); //_entryBoxMovementAmountOtherPayments.EntryValidation.Changed += delegate { ValidateDialog(); }; //EntryDescription _entryBoxMovementDescription = new EntryBoxValidation(this, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_description"), KeyboardMode.AlfaNumeric, SettingsApp.RegexAlfaNumericExtended, false); _entryBoxMovementDescription.EntryValidation.Changed += delegate { ValidateDialog(); }; //VBox VBox vbox = new VBox(false, 0); vbox.PackStart(hboxCashDrawerButtons, false, false, 0); vbox.PackStart(_entryBoxMovementAmountMoney, false, false, 0); //vbox.PackStart(_entryBoxMovementAmountOtherPayments, false, false, 0); vbox.PackStart(_entryBoxMovementDescription, false, false, 0); //Init Content Fixed fixedContent = new Fixed(); fixedContent.Put(vbox, 0, 0); //ActionArea Buttons _buttonOk = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Ok); _buttonCancel = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Cancel); _buttonPrint = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Print); _buttonOk.Sensitive = false; _buttonPrint.Sensitive = buttonOkSensitive; //ActionArea ActionAreaButtons actionAreaButtons = new ActionAreaButtons(); actionAreaButtons.Add(new ActionAreaButton(_buttonPrint, _responseTypePrint)); actionAreaButtons.Add(new ActionAreaButton(_buttonOk, ResponseType.Ok)); actionAreaButtons.Add(new ActionAreaButton(_buttonCancel, ResponseType.Cancel)); //Call Activate Button Helper Method ActivateButton(buttonBag[initialButtonToken]); //Init Object this.InitObject(this, pDialogFlags, fileDefaultWindowIcon, windowTitle, windowSize, fixedContent, actionAreaButtons); } catch (Exception ex) { _log.Error(ex.Message, ex); } }
public PosMoneyPadDialog(Window pSourceWindow, DialogFlags pDialogFlags, decimal pInitialValue = 0.0m, decimal pTotalOrder = 0.0m) : base(pSourceWindow, pDialogFlags) { //Init Local Vars String windowTitle; if (pTotalOrder > 0) { windowTitle = string.Format("{0} - {1} : {2}", Resx.window_title_dialog_moneypad, Resx.global_total_table_tickets, FrameworkUtils.DecimalToStringCurrency(pTotalOrder)); } else { windowTitle = Resx.window_title_dialog_moneypad; } this.InitObject(pSourceWindow, pDialogFlags, windowTitle, pInitialValue, pTotalOrder); }
public void Validate() { //Settings int decimalRoundTo = SettingsApp.DecimalRoundTo; //Check if Has More than one Invoice and the Input is The Full Payment _paymentAmountEntry = FrameworkUtils.StringToDecimal(_entryPaymentAmount.EntryValidation.Text); //Calc Diference in selected Currency _diference = Math.Round((_paymentAmountTotal * _exchangeRate) - _paymentAmountEntry, decimalRoundTo); _validated = ( _entryBoxSelectConfigurationPaymentMethod.EntryValidation.Validated && _entryBoxSelectConfigurationCurrency.EntryValidation.Validated && _entryPaymentAmount.EntryValidation.Validated && _entryBoxPaymentDate.EntryValidation.Validated && _entryBoxDocumentPaymentNotes.EntryValidation.Validated && (_diference >= 0) ); //Update Payed amount in default currency, must divided by ExchangeRate, inputs are always in selected Currency _payedAmount = _paymentAmountEntry / _exchangeRate; if (_debug) { _log.Debug(string.Format("_payedAmount/_paymentAmountTotal: [{0}/{1}]", FrameworkUtils.DecimalToStringCurrency(_payedAmount), FrameworkUtils.DecimalToStringCurrency(_paymentAmountTotal))); } //Block Change of Currency to prevent conversion problems _entryBoxSelectConfigurationCurrency.EntryValidation.Sensitive = _entryPaymentAmount.EntryValidation.Validated; _entryBoxSelectConfigurationCurrency.ButtonSelectValue.Sensitive = _entryPaymentAmount.EntryValidation.Validated; /* IN009183 */ Utils.ValidateUpdateColors(_entryPaymentAmount.EntryValidation, _entryPaymentAmount.Label, (_validated && _diference >= 0)); //_entryPaymentAmount.EntryValidation.Text = FrameworkUtils.DecimalToString(_paymentAmountEntry, GlobalFramework.CurrentCulture, SettingsApp.DecimalFormat); //FrameworkUtils.DecimalToString(_paymentAmountEntry); // _paymentAmountEntry = Math.Round(_paymentAmountEntry, decimalRoundTo); _buttonOk.Sensitive = _validated; }
public MoneyPad(Window pSourceWindow, decimal pInitialValue = 0.0m) { //Settings string fontMoneyPadButtonKeys = GlobalFramework.Settings["fontMoneyPadButtonKeys"]; string fontMoneyPadTextEntry = GlobalFramework.Settings["fontMoneyPadTextEntry"]; //ButtonLabels string moneyButtonL1Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonL1Value); string moneyButtonL2Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonL2Value); string moneyButtonL3Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonL3Value); string moneyButtonL4Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonL4Value); string moneyButtonL5Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonL5Value); string moneyButtonR1Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonR1Value); string moneyButtonR2Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonR2Value); string moneyButtonR3Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonR3Value); string moneyButtonR4Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonR4Value); string moneyButtonR5Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonR5Value); //Local Vars Color colorFont = Color.White; Size numberPadButtonSize = new Size(100, 80); Size moneyButtonSize = new Size(100, 64); //Delivery Entry string initialValue = (pInitialValue > 0) ? FrameworkUtils.DecimalToString(pInitialValue) : string.Empty; _entryDeliveryValue = new EntryValidation(pSourceWindow, KeyboardMode.None, SettingsApp.RegexDecimal, true) { Text = initialValue, Alignment = 0.5F }; _entryDeliveryValue.ModifyFont(Pango.FontDescription.FromString(fontMoneyPadTextEntry)); //Dialog Validated Equal to Entry, Its the Only Entry in Dialog _validated = _entryDeliveryValue.Validated; //Event _entryDeliveryValue.Changed += _entry_Changed; //NumberPad _numberPad = new NumberPad("numberPad", Color.Transparent, fontMoneyPadButtonKeys, (byte)numberPadButtonSize.Width, (byte)numberPadButtonSize.Height); _numberPad.Clicked += _numberPad_Clicked; //MoneyButtons Left _buttonKeyMBL1 = new TouchButtonText("touchButtonKeyMBL1_Green", Color.Transparent, moneyButtonL1Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height); _buttonKeyMBL2 = new TouchButtonText("touchButtonKeyMBL2_Green", Color.Transparent, moneyButtonL2Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height); _buttonKeyMBL3 = new TouchButtonText("touchButtonKeyMBL3_Green", Color.Transparent, moneyButtonL3Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height); _buttonKeyMBL4 = new TouchButtonText("touchButtonKeyMBL4_Green", Color.Transparent, moneyButtonL4Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height); _buttonKeyMBL5 = new TouchButtonText("touchButtonKeyMBL5_Green", Color.Transparent, moneyButtonL5Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height); //MoneyButtons Right _buttonKeyMBR1 = new TouchButtonText("touchButtonKeyMBR1_Green", Color.Transparent, moneyButtonR1Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height); _buttonKeyMBR2 = new TouchButtonText("touchButtonKeyMBR2_Green", Color.Transparent, moneyButtonR2Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height); _buttonKeyMBR3 = new TouchButtonText("touchButtonKeyMBR3_Green", Color.Transparent, moneyButtonR3Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height); _buttonKeyMBR4 = new TouchButtonText("touchButtonKeyMBR4_Green", Color.Transparent, moneyButtonR4Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height); _buttonKeyMBR5 = new TouchButtonText("touchButtonKeyMBR5_Green", Color.Transparent, moneyButtonR5Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height); //Events _buttonKeyMBL1.Clicked += buttonKeyMB_Clicked; _buttonKeyMBL2.Clicked += buttonKeyMB_Clicked; _buttonKeyMBL3.Clicked += buttonKeyMB_Clicked; _buttonKeyMBL4.Clicked += buttonKeyMB_Clicked; _buttonKeyMBL5.Clicked += buttonKeyMB_Clicked; _buttonKeyMBR1.Clicked += buttonKeyMB_Clicked; _buttonKeyMBR2.Clicked += buttonKeyMB_Clicked; _buttonKeyMBR3.Clicked += buttonKeyMB_Clicked; _buttonKeyMBR4.Clicked += buttonKeyMB_Clicked; _buttonKeyMBR5.Clicked += buttonKeyMB_Clicked; VBox vboxMoneyButtonsLeft = new VBox(true, 0); vboxMoneyButtonsLeft.PackStart(_buttonKeyMBL1, true, true, 0); vboxMoneyButtonsLeft.PackStart(_buttonKeyMBL2, true, true, 0); vboxMoneyButtonsLeft.PackStart(_buttonKeyMBL3, true, true, 0); vboxMoneyButtonsLeft.PackStart(_buttonKeyMBL4, true, true, 0); vboxMoneyButtonsLeft.PackStart(_buttonKeyMBL5, true, true, 0); VBox vboxMoneyButtonsRight = new VBox(true, 0); vboxMoneyButtonsRight.PackStart(_buttonKeyMBR1, true, true, 0); vboxMoneyButtonsRight.PackStart(_buttonKeyMBR2, true, true, 0); vboxMoneyButtonsRight.PackStart(_buttonKeyMBR3, true, true, 0); vboxMoneyButtonsRight.PackStart(_buttonKeyMBR4, true, true, 0); vboxMoneyButtonsRight.PackStart(_buttonKeyMBR5, true, true, 0); HBox hboxInput = new HBox(false, 5); hboxInput.PackStart(vboxMoneyButtonsLeft); hboxInput.PackStart(_numberPad); hboxInput.PackStart(vboxMoneyButtonsRight); //Vbox VBox vboxNumberPad = new VBox(false, 0); vboxNumberPad.PackStart(_entryDeliveryValue, false, true, 5); vboxNumberPad.PackStart(hboxInput, true, true, 5); //Pack It this.Add(vboxNumberPad); }
/// <summary> /// Show Close Message, Shared for Day and Terminal Sessions /// </summary> /// <param name="pWorkSessionPeriod"></param> /// <returns></returns> public void ShowClosePeriodMessage(Window pSourceWindow, POS_WorkSessionPeriod pWorkSessionPeriod) { string messageResource = (pWorkSessionPeriod.PeriodType == WorkSessionPeriodType.Day) ? Resx.dialog_message_worksession_day_close_successfully : Resx.dialog_message_worksession_terminal_close_successfully ; string messageTotalSummary = string.Empty; //used to store number of payments used, to increase dialog window size int workSessionPeriodTotalCount = 0; //Window Height Helper vars int lineHeight = 28; int windowHeight = 300; //Get Session Period Details Hashtable resultHashTable = ProcessWorkSessionPeriod.GetSessionPeriodSummaryDetails(pWorkSessionPeriod); //Get Total Money in CashDrawer On Open/Close string totalMoneyInCashDrawerOnOpen = string.Format("{0}: {1}", Resx.global_total_cashdrawer_on_open, FrameworkUtils.DecimalToStringCurrency((decimal)resultHashTable["totalMoneyInCashDrawerOnOpen"])); string totalMoneyInCashDrawer = string.Format("{0}: {1}", Resx.global_total_cashdrawer, FrameworkUtils.DecimalToStringCurrency((decimal)resultHashTable["totalMoneyInCashDrawer"])); //Get Total Money and TotalMoney Out (NonPayments) string totalMoneyIn = string.Format("{0}: {1}", Resx.global_cashdrawer_money_in, FrameworkUtils.DecimalToStringCurrency((decimal)resultHashTable["totalMoneyIn"])); string totalMoneyOut = string.Format("{0}: {1}", Resx.global_cashdrawer_money_out, FrameworkUtils.DecimalToStringCurrency((decimal)resultHashTable["totalMoneyOut"])); //Init Message messageTotalSummary = string.Format("{1}{0}{2}{0}{3}{0}{4}{0}", Environment.NewLine, totalMoneyInCashDrawerOnOpen, totalMoneyInCashDrawer, totalMoneyIn, totalMoneyOut); //Get Payments Totals try { XPCollection workSessionPeriodTotal = ProcessWorkSessionPeriod.GetSessionPeriodTotal(pWorkSessionPeriod); if (workSessionPeriodTotal.Count > 0) { messageTotalSummary += string.Format("{0}{1}{0}", Environment.NewLine, Resx.global_total_by_type_of_payment); foreach (POS_WorkSessionPeriodTotal item in workSessionPeriodTotal) { messageTotalSummary += string.Format("{1}-{2}: {3}{0}", Environment.NewLine, item.PaymentMethod.Acronym, item.PaymentMethod.Designation, FrameworkUtils.DecimalToStringCurrency(item.Total)); } workSessionPeriodTotalCount = workSessionPeriodTotal.Count; } windowHeight = (workSessionPeriodTotalCount > 0) ? windowHeight + ((workSessionPeriodTotalCount + 2) * lineHeight) : windowHeight + lineHeight; Utils.ShowMessageTouch( pSourceWindow, DialogFlags.Modal, new Size(600, windowHeight), MessageType.Info, ButtonsType.Close, "Info", string.Format(messageResource, messageTotalSummary) ); } catch (Exception ex) { _log.Error(ex.Message, ex); } }
void _touchButtonCashDrawer_Clicked(object sender, EventArgs e) { bool result; //ProcessWorkSessionPeriod.GetSessionPeriodMovementTotalDebug(GlobalFramework.WorkSessionPeriodTerminal, true ); PosCashDrawerDialog dialogCashDrawer = new PosCashDrawerDialog(this, DialogFlags.DestroyWithParent); int response = dialogCashDrawer.Run(); if (response == (int)ResponseType.Ok) { //Get Fresh XPO Objects, Prevent Deleted Object Bug POS_WorkSessionPeriod workSessionPeriodDay = GlobalFramework.SessionXpo.GetObjectByKey <POS_WorkSessionPeriod>(GlobalFramework.WorkSessionPeriodDay.Oid); POS_WorkSessionPeriod workSessionPeriodTerminal; switch (dialogCashDrawer.MovementType.Token) { case "CASHDRAWER_OPEN": //Start Terminal Period result = ProcessWorkSessionPeriod.SessionPeriodOpen(WorkSessionPeriodType.Terminal, dialogCashDrawer.MovementDescription); if (result) { //Update UI GlobalApp.WindowPos.UpdateWorkSessionUI(); GlobalApp.WindowPos.TicketList.UpdateOrderStatusBar(); //Here we already have GlobalFramework.WorkSessionPeriodTerminal, assigned on ProcessWorkSessionPeriod.SessionPeriodStart //Get Fresh XPO Objects, Prevent Deleted Object Bug workSessionPeriodTerminal = GlobalFramework.SessionXpo.GetObjectByKey <POS_WorkSessionPeriod>(GlobalFramework.WorkSessionPeriodTerminal.Oid); result = ProcessWorkSessionMovement.PersistWorkSessionMovement( workSessionPeriodTerminal, dialogCashDrawer.MovementType, GlobalFramework.LoggedUser, GlobalFramework.LoggedTerminal, FrameworkUtils.CurrentDateTimeAtomic(), dialogCashDrawer.MovementAmountMoney, dialogCashDrawer.MovementDescription ); } if (result) { //PrintWorkSessionMovement FrameworkCalls.PrintCashDrawerOpenAndMoneyInOut(dialogCashDrawer, GlobalFramework.LoggedTerminal.Printer, Resx.ticket_title_worksession_terminal_open, 0.0m, dialogCashDrawer.TotalAmountInCashDrawer, dialogCashDrawer.MovementDescription); //Enable UI Buttons When Have Open Session GlobalApp.WindowPos.TouchButtonPosToolbarNewFinanceDocument.Sensitive = true; //Open CashDrawer Utils.ShowMessageTouch(dialogCashDrawer, DialogFlags.Modal, new Size(500, 280), MessageType.Info, ButtonsType.Close, Resx.global_information, Resx.dialog_message_cashdrawer_open_successfully); } else { Utils.ShowMessageTouch(dialogCashDrawer, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, Resx.global_error, Resx.app_error_contact_support); } break; case "CASHDRAWER_CLOSE": //Stop Terminal Period result = ProcessWorkSessionPeriod.SessionPeriodClose(GlobalFramework.WorkSessionPeriodTerminal); if (result) { //Update UI GlobalApp.WindowPos.UpdateWorkSessionUI(); GlobalApp.WindowPos.LabelCurrentTable.Text = Resx.status_message_open_cashdrawer; //Get Fresh XPO Objects, Prevent Deleted Object Bug workSessionPeriodTerminal = GlobalFramework.SessionXpo.GetObjectByKey <POS_WorkSessionPeriod>(GlobalFramework.WorkSessionPeriodTerminal.Oid); //Add CASHDRAWER_CLOSE Movement to Day Period result = ProcessWorkSessionMovement.PersistWorkSessionMovement( workSessionPeriodTerminal, dialogCashDrawer.MovementType, GlobalFramework.LoggedUser, GlobalFramework.LoggedTerminal, FrameworkUtils.CurrentDateTimeAtomic(), dialogCashDrawer.MovementAmountMoney, dialogCashDrawer.MovementDescription ); //PrintWorkSessionMovement FrameworkCalls.PrintWorkSessionMovement(dialogCashDrawer, GlobalFramework.LoggedTerminal.Printer, GlobalFramework.WorkSessionPeriodTerminal); //Enable UI Buttons When Have Open Session GlobalApp.WindowPos.TouchButtonPosToolbarNewFinanceDocument.Sensitive = false; //Show ClosePeriodMessage ShowClosePeriodMessage(dialogCashDrawer, GlobalFramework.WorkSessionPeriodTerminal); } break; case "CASHDRAWER_IN": dialogCashDrawer.TotalAmountInCashDrawer += dialogCashDrawer.MovementAmountMoney; workSessionPeriodTerminal = GlobalFramework.SessionXpo.GetObjectByKey <POS_WorkSessionPeriod>(GlobalFramework.WorkSessionPeriodTerminal.Oid); result = ProcessWorkSessionMovement.PersistWorkSessionMovement( workSessionPeriodTerminal, dialogCashDrawer.MovementType, GlobalFramework.LoggedUser, GlobalFramework.LoggedTerminal, FrameworkUtils.CurrentDateTimeAtomic(), dialogCashDrawer.MovementAmountMoney, dialogCashDrawer.MovementDescription ); if (result) { //PrintCashDrawerOpenAndMoneyInOut FrameworkCalls.PrintCashDrawerOpenAndMoneyInOut(dialogCashDrawer, GlobalFramework.LoggedTerminal.Printer, Resx.ticket_title_worksession_money_in, dialogCashDrawer.MovementAmountMoney, dialogCashDrawer.TotalAmountInCashDrawer, dialogCashDrawer.MovementDescription); //Open CashDrawer PrintRouter.OpenDoor(GlobalFramework.LoggedTerminal.Printer); //Audit FrameworkUtils.Audit("CASHDRAWER_IN", string.Format( Resx.audit_message_cashdrawer_in, FrameworkUtils.DecimalToStringCurrency(dialogCashDrawer.MovementAmountMoney), dialogCashDrawer.MovementDescription) ); //ShowMessage Utils.ShowMessageTouch(dialogCashDrawer, DialogFlags.Modal, new Size(500, 300), MessageType.Info, ButtonsType.Close, Resx.global_information, Resx.dialog_message_operation_successfully); } else { Utils.ShowMessageTouch(dialogCashDrawer, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, Resx.global_error, Resx.app_error_contact_support); } break; //Work with Terminal Session case "CASHDRAWER_OUT": dialogCashDrawer.TotalAmountInCashDrawer -= dialogCashDrawer.MovementAmountMoney; workSessionPeriodTerminal = GlobalFramework.SessionXpo.GetObjectByKey <POS_WorkSessionPeriod>(GlobalFramework.WorkSessionPeriodTerminal.Oid); //In Period Terminal result = ProcessWorkSessionMovement.PersistWorkSessionMovement( workSessionPeriodTerminal, dialogCashDrawer.MovementType, GlobalFramework.LoggedUser, GlobalFramework.LoggedTerminal, FrameworkUtils.CurrentDateTimeAtomic(), -dialogCashDrawer.MovementAmountMoney, dialogCashDrawer.MovementDescription ); if (result) { //PrintCashDrawerOpenAndMoneyInOut FrameworkCalls.PrintCashDrawerOpenAndMoneyInOut(dialogCashDrawer, GlobalFramework.LoggedTerminal.Printer, Resx.ticket_title_worksession_money_out, dialogCashDrawer.MovementAmountMoney, dialogCashDrawer.TotalAmountInCashDrawer, dialogCashDrawer.MovementDescription); //Open CashDrawer PrintRouter.OpenDoor(GlobalFramework.LoggedTerminal.Printer); //Audit FrameworkUtils.Audit("CASHDRAWER_OUT", string.Format( Resx.audit_message_cashdrawer_out, FrameworkUtils.DecimalToStringCurrency(dialogCashDrawer.MovementAmountMoney), dialogCashDrawer.MovementDescription) ); //ShowMessage Utils.ShowMessageTouch(dialogCashDrawer, DialogFlags.Modal, new Size(500, 300), MessageType.Info, ButtonsType.Close, Resx.global_information, Resx.dialog_message_operation_successfully); } else { Utils.ShowMessageTouch(dialogCashDrawer, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, Resx.global_error, Resx.app_error_contact_support); } break; case "CASHDRAWER_MONEY_OUT": break; default: break; } } ; dialogCashDrawer.Destroy(); //TODO: Remove Comments //_log.Debug(string.Format("ProcessWorkSessionPeriod: [{0}]", ProcessWorkSessionPeriod.GetSessionPeriodCashDrawerOpenOrCloseAmount(GlobalFramework.WorkSessionPeriodDay))); //if (GlobalFramework.WorkSessionPeriodDay != null) ProcessWorkSessionPeriod.GetSessionPeriodMovementTotalDebug(GlobalFramework.WorkSessionPeriodDay, true); //if (GlobalFramework.WorkSessionPeriodTerminal != null) ProcessWorkSessionPeriod.GetSessionPeriodMovementTotalDebug(GlobalFramework.WorkSessionPeriodTerminal, true); }
public void InitObject(String pName, Color pColor, String pLabelText, String pFont, TableStatus pTableStatus, decimal pTotal, DateTime pDateOpen, DateTime pDateClosed) { //Init Parameters _buttonColor = pColor; _tableStatus = pTableStatus; //Settings _colorPosTablePadTableTableStatusOpenButtonBackground = FrameworkUtils.StringToColor(GlobalFramework.Settings["colorPosTablePadTableTableStatusOpenButtonBackground"]); _colorPosTablePadTableTableStatusReservedButtonBackground = FrameworkUtils.StringToColor(GlobalFramework.Settings["colorPosTablePadTableTableStatusReservedButtonBackground"]); //Initialize UI Components VBox vbox = new VBox(true, 5) { BorderWidth = 5 }; //Button base Label _label = new Label(pLabelText); SetFont(string.Format("Bold {0}", pFont)); //Label for Date Label labelDateTableOpenOrClosed = new Label(string.Empty); Pango.FontDescription fontDescDateTableOpenOrClosed = Pango.FontDescription.FromString("7"); labelDateTableOpenOrClosed.ModifyFont(fontDescDateTableOpenOrClosed); //Label for Total or Status _labelTotalOrStatus = new Label(string.Empty); _eventBoxTotalOrStatus = new EventBox(); _eventBoxTotalOrStatus.Add(_labelTotalOrStatus); //_eventBoxTotalOrStatus.CanFocus = false; //If click in EventBox call button Click Event _eventBoxTotalOrStatus.ButtonPressEvent += delegate { Click(); }; //Pack VBox vbox.PackStart(_label); vbox.PackStart(labelDateTableOpenOrClosed); vbox.PackStart(_eventBoxTotalOrStatus); //Pack Final Widget _widget = vbox; //_log.Debug(string.Format("pLabelText:[{0}], _tableStatus: [{1}]", pLabelText, _tableStatus)); switch (_tableStatus) { case TableStatus.Free: SetBackgroundColor(_buttonColor, _eventBoxTotalOrStatus); break; case TableStatus.Open: _labelTotalOrStatus.Text = FrameworkUtils.DecimalToStringCurrency(pTotal); if (pDateOpen != null) { labelDateTableOpenOrClosed.Text = string.Format(Resx.pos_button_label_table_open_at, pDateOpen.ToString(SettingsApp.DateTimeFormatHour)); } SetBackgroundColor(_colorPosTablePadTableTableStatusOpenButtonBackground, _eventBoxTotalOrStatus); break; case TableStatus.Reserved: _labelTotalOrStatus.Text = Resx.global_reserved_table; SetBackgroundColor(_colorPosTablePadTableTableStatusReservedButtonBackground, _eventBoxTotalOrStatus); break; default: break; } }
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); } }