Пример #1
0
        private bool Validate()
        {
            double amountReceived = paymentWidget.Received;

            if (!ValidateDate())
            {
                return(false);
            }

            if (Currency.Round(amountReceived + TotalReceived, operation.TotalsPriceType) < total)
            {
                string text;
                if (PrintFiscal)
                {
                    text = Translator.GetString("The paid amount is less than the total. " +
                                                "Do you want to add another payment? (You can only print a fiscal receipt for a fully paid operation.)");
                }
                else
                {
                    text = Translator.GetString("The paid amount is less than the total. " +
                                                "Do you want to add another payment?");
                }

                switch (Message.ShowDialog(Translator.GetString("Not enough received money"),
                                           "Icons.TradePoint32.png", text, "Icons.Warning32.png", MessageButtons.YesNo))
                {
                case ResponseType.No:
                    if (AllowOperationWithoutReceipt())
                    {
                        AddPayment(amountReceived);
                        return(true);
                    }
                    paymentWidget.FocusReceived();
                    return(false);

                case ResponseType.DeleteEvent:
                    paymentWidget.FocusReceived();
                    return(false);
                }

                if (amountReceived > 0)
                {
                    AddPayment(amountReceived);
                }

                paymentWidget.Received = total - TotalReceived;
                paymentWidget.FocusReceived();
                return(false);
            }
            if (amountReceived > 0)
            {
                AddPayment(amountReceived);
            }

            return(true);
        }
        private void btnAdd_Clicked(object sender, EventArgs e)
        {
            double amountReceived = paymentWidget.Received;

            if (amountReceived <= 0)
            {
                return;
            }

            AddPayment(amountReceived);
            paymentWidget.Received = 0;
            paymentWidget.FocusReceived();
        }