コード例 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            double amount_to_deduct = 0;
            double total_amount     = totalAmount();

            frmEnterDiscount aeP = new frmEnterDiscount(this);

            aeP.ShowDialog();

            if (DiscountAmount > 0)
            {
                amount_to_deduct       = DiscountAmount;
                lblDiscountAmount.Text = DiscountAmount.ToString();
            }

            if (DiscountPercent > 0)
            {
                amount_to_deduct        = total_amount * (DiscountPercent / 100);
                lblDiscountAmount.Text  = amount_to_deduct.ToString();
                lblDiscountPercent.Text = DiscountPercent.ToString();
            }

            if (DiscountPercent <= 0 && DiscountAmount <= 0)
            {
                return;
            }

            dgw.Rows.Add(0, 1, "Discount", "Discount", Strings.FormatNumber(amount_to_deduct).ToString(), '0', cmbCustomerTax.Text, "-" + amount_to_deduct, "Remove");

            ComupteAmount();
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            double Subtotal;
            double DiscountPercent;
            double DiscountAmount;
            double InvoiceTotal;

            Subtotal = double.Parse(txtSubtotal.Text);
            if (Subtotal >= 500)
            {
                DiscountPercent = 0.2;
            }
            else if (Subtotal >= 250 && Subtotal < 500)
            {
                DiscountPercent = 0.15;
            }
            else if (Subtotal >= 100 && Subtotal < 250)
            {
                DiscountPercent = 0.1;
            }
            else
            {
                DiscountPercent = 0.0;
            }
            DiscountAmount          = Subtotal * DiscountPercent;
            InvoiceTotal            = Subtotal - DiscountAmount;
            txtDiscountPercent.Text = DiscountPercent.ToString("p1"); //p1 means percentage
            txtDiscountAmount.Text  = "$" + DiscountAmount.ToString();
            txtTotal.Text           = "$" + InvoiceTotal.ToString();
            txtResult.Text          = "Dear Customer you have to pay: $" + InvoiceTotal.ToString();
        }
コード例 #3
0
            public void DiscountPercentsShouldBeObjectEqual(int value)
            {
                DiscountPercent discountPercent1 = new DiscountPercent(value);
                DiscountPercent discountPercent2 = new DiscountPercent(value);

                bool result = discountPercent1.Equals((object)discountPercent2);

                result.Should().BeTrue();
            }
コード例 #4
0
            public void DiscountPercentsShouldNotBeEqual(int value1, int value2)
            {
                DiscountPercent discountPercent1 = new DiscountPercent(value1);
                DiscountPercent discountPercent2 = new DiscountPercent(value2);

                bool result = discountPercent1 != discountPercent2;

                result.Should().BeTrue();
            }
コード例 #5
0
            public void PricesShouldBeEqual(int value)
            {
                DiscountPercent discountPercent1 = new DiscountPercent(value);
                DiscountPercent discountPercent2 = new DiscountPercent(value);

                bool result = discountPercent1 != discountPercent2;

                result.Should().BeFalse();
            }
コード例 #6
0
ファイル: Invoice.cs プロジェクト: gvhung/OuatelseProject
        public Dictionary <string, string> Fetch()
        {
            Dictionary <string, string> res = new Dictionary <string, string>
            {
                { "date", Date.ToString("yyyy-MM-dd") },
                { "pourcentage_remise", DiscountPercent.ToString(CultureInfo.CurrentCulture) },
                { "salaries_id", Employee.Id.ToString() },
                { "clients_id", Customer == null ? "0" : Customer.Id.ToString() },
                { "moyen_de_paiements_id", Payment.Id.ToString() },
                { "estPaye", IsPaid ? "1" : "0" },
                { "montantPaye", PaidAmount.ToString(CultureInfo.InvariantCulture) }
            };

            return(res);
        }
コード例 #7
0
        /// <summary>
        /// Update all properties in the data table
        /// </summary>
        public void UpdateAllData()
        {
            var row = _dictofdata.Rows[0];

            row["Sistema"]                 = System;
            row["Licencia"]                = License;
            row["TipoCambio"]              = ExchangeRate.ToString();
            row["CantidadPesosCaja"]       = LastCashierAmountMxn.ToString();
            row["CantidadDolarCaja"]       = LastCashierAmountUsd.ToString();
            row["UltimoReciboNumero"]      = LastReceiptNumber.ToString();
            row["UltimoCorteZNumero"]      = LastCorteZNumber.ToString();
            row["UltimoTransaccionNumero"] = LastTransactionNumber.ToString();
            row["UltimoNumeroInterno"]     = LastInternalNumber.ToString();
            row["UltimoNumeroPedido"]      = LastOrderNumber.ToString();
            row["NombreImpresora"]         = PrinterName;
            row["NombreNegocio"]           = BusinessName;
            row["DireccionCalleFiscal"]    = FiscalStreetAddress;
            row["CiudadCodigoFiscal"]      = FiscalCityAndZipCode;
            row["RFC"]                   = FiscalNumber;
            row["NombreFiscal"]          = FiscalName;
            row["NumeroTelefono"]        = FiscalPhoneNumber;
            row["Email"]                 = FiscalEmail;
            row["RazonSocial"]           = FiscalType;
            row["Facebook"]              = Facebook;
            row["Instagram"]             = Instagram;
            row["Twitter"]               = Twitter;
            row["PaginaInternet"]        = Website;
            row["Comentarios"]           = Comments;
            row["MensajePie"]            = FooterMessage;
            row["LogoImagen"]            = LogoName;
            row["EmailSaliente"]         = EmailSender;
            row["EmailSalientePassword"] = EmailSenderPassword;
            row["EmailReportes"]         = EmailReports;
            row["EmailPedidos"]          = EmailOrders;
            row["DescuentoPorcentaje"]   = DiscountPercent.ToString();
            row["PuntosPorcentaje"]      = PointsPercent.ToString();
        }
コード例 #8
0
            public void DiscountPercentShouldActLikeInt(int value)
            {
                DiscountPercent discountPercent = new DiscountPercent(value);

                discountPercent.Should().Be(value);
            }
コード例 #9
0
 public PieAndChipsMealDealDiscount(DiscountPercent discountPercent)
 {
     this.DiscountPercent = discountPercent;
 }
コード例 #10
0
 public PieExpiryDiscount(IClock clock, DiscountPercent discountPercent)
 {
     this.clock           = clock ?? throw new ArgumentNullException(nameof(clock));
     this.DiscountPercent = discountPercent;
 }