Пример #1
0
        private void RemoveSplitButton()
        {
            bool debug = false;

            try
            {
                // Store Index Position before Removes
                int lastIndex = _splitPaymentButtons.Count - 1;
                if (debug)
                {
                    _log.Debug(string.Format("RemoveSplitButton: [{0}]", _splitPaymentButtons[lastIndex].LabelText));
                }
                // Store Reference to Delete After remove From List
                TouchButtonSplitPayment touchButtonSplitPayment = _splitPaymentButtons[lastIndex];
                _splitPaymentButtons.Remove(touchButtonSplitPayment);
                touchButtonSplitPayment.Destroy();
                // CalculateSplit;
                CalculateSplit();
                // UpdateActionButtons
                UpdateActionButtons();
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
Пример #2
0
        private void AddSplitButton(bool callUpdateAndCalculateMethods)
        {
            bool debug = false;

            try
            {
                string buttonLabel = $"Cliente #{_splitPaymentButtons.Count + 1}";
                TouchButtonSplitPayment touchButtonSplitPayment = new TouchButtonSplitPayment($"splitPaymentButton{_splitPaymentButtons.Count}", _colorSplitPaymentTouchButtonFilledDataBackground, buttonLabel, _fontSplitPaymentTouchButtonSplitPayment, 0, _intSplitPaymentTouchButtonSplitPaymentHeight);
                _splitPaymentButtons.Add(touchButtonSplitPayment);
                _vbox.PackStart(_splitPaymentButtons[_splitPaymentButtons.Count - 1], false, true, 5);
                // Event
                touchButtonSplitPayment.Clicked += TouchButtonSplitPayment_Clicked;
                // Check Label and Position
                if (debug)
                {
                    _log.Debug(string.Format("AddSplitButton: [{0}]", _splitPaymentButtons[_splitPaymentButtons.Count - 1].LabelText));
                }
                // Call Update And Calculate Methods only on Last of PaymentStartClients
                if (callUpdateAndCalculateMethods)
                {
                    // CalculateSplit;
                    CalculateSplit();
                    // UpdateActionButtons
                    UpdateActionButtons();
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
Пример #3
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        // Events

        private void TouchButtonSplitPayment_Clicked(object sender, EventArgs e)
        {
            bool    debug      = false;
            decimal checkTotal = 0.0m;

            try
            {
                TouchButtonSplitPayment touchButtonSplitPayment = (TouchButtonSplitPayment)sender;
                if (debug)
                {
                    _log.Debug(string.Format("TouchButtonSplitPayment Clicked: [{0}]", touchButtonSplitPayment.LabelText));
                }

                foreach (var item in touchButtonSplitPayment.ArticleBag)
                {
                    checkTotal += item.Value.PriceFinal * item.Value.Quantity;
                }
                if (debug)
                {
                    _log.Debug(string.Format("touchButtonSplitPayment.ArticleBag: Total: [{0}]", checkTotal));
                }

                // Using RequestProcessFinanceDocumentParameter, to prevent Emmit Document On Ok/Close
                PosPaymentsDialog dialog = new PosPaymentsDialog(_sourceWindow, DialogFlags.DestroyWithParent, touchButtonSplitPayment.ArticleBag, false, true, true, touchButtonSplitPayment.ProcessFinanceDocumentParameter, touchButtonSplitPayment.SelectedPaymentMethodButtonName);
                int response             = dialog.Run();

                if (response == (int)ResponseType.Ok)
                {
                    // Assign ProcessFinanceDocumentParameter (Other dialog.TotalChange | dialog.TotalDelivery)
                    touchButtonSplitPayment.ProcessFinanceDocumentParameter = dialog.ProcessFinanceDocumentParameter;
                    // Store SelectedPaymentMethodButtonName to init Dialog with corrected Button Toggled
                    touchButtonSplitPayment.SelectedPaymentMethodButtonName = dialog.SelectedPaymentMethodButton.Name;
                    // Call UpdateTouchButtonSplitPaymentLabels
                    UpdateTouchButtonSplitPaymentLabels(touchButtonSplitPayment);
                    // UpdateActionButtons
                    UpdateActionButtons();

                    // Valid Result Destroy Dialog
                    dialog.Destroy();
                }
                ;
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
Пример #4
0
        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);
            }
        }