Пример #1
0
        public static Invoice CreateInvoiceCompWithDis2Przed()
        {
            Invoice a = new Invoice("Faktura zapłaty", ClientObjectMothers.CreateClientPrivateWithoutDiscount());

            a.AddProduct(ProductObjectMothers.CreateProductPrzedmiotEUR(), 1);
            a.AddProduct(ProductObjectMothers.CreateProductPrzedmiotPLN(), 2);
            return(a);
        }
Пример #2
0
        public static Invoice CreateInvoicePrivWithDis2PrzedUsl()
        {
            Invoice a = new Invoice("Faktura zapłaty2", ClientObjectMothers.CreateClientPrivateWithDiscountNetto());

            a.AddProduct(ProductObjectMothers.CreateProductPrzedmiotPLN(), 1);
            a.AddProduct(ProductObjectMothers.CreateProductUslugaPLN(), 2);
            return(a);
        }
Пример #3
0
        public void CalculatesTotalForOnlinePurchase()
        {
            _invoice.AddProduct(_taxableProduct);
            _invoice.AddProduct(_nonTaxableProduct);

            var total = _invoice.GetInvoiceTotal(PurchaseMethod.Online, Province.Quebec);

            total.Should().Be(40);
        }
Пример #4
0
        private void textBox1_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode != Keys.Enter && e.KeyCode != Keys.Return)
            {
                return;
            }

            Product product = ProductManager.Instance.First(string.Format("WHERE code_ean = '{0}'", this.quickAdd.Text));

            if (product == null)
            {
                Utils.Warning("Aucun produit n'existe avec le code EAN \"" + this.quickAdd.Text + "\" !");
                this.quickAdd.SelectAll();
                return;
            }

            // On regarde si il n'existe pas déjà un produit
            foreach (InvoiceProduct invoiceProduct in invoice.Products.Items.Where(invoiceProduct => product.EANCode == invoiceProduct.Product.EANCode))
            {
                if (product.CurrentStock - invoiceProduct.Quantity - 1 < 0)
                {
                    Utils.Error(string.Format("Impossible ! Le stock n'est pas suffisant !\nStock restant : {0}", product.CurrentStock));
                    this.quickAdd.Text = "";
                    return;
                }

                invoiceProduct.Quantity++;
                InvoiceProductManager.Instance.Save(invoiceProduct);
                ReloadProducts();
                this.quickAdd.Text = "";
                this.quickAdd.SelectAll();
                return;
            }

            if (product.CurrentStock - 1 < 0)
            {
                Utils.Error(string.Format("Impossible ! Le stock n'est pas suffisant !\nStock restant : {0}", product.CurrentStock));
                this.quickAdd.Text = "";
                return;
            }

            invoice.AddProduct(product);
            ReloadProducts();
            this.quickAdd.Text = "";
            this.quickAdd.SelectAll();
        }
Пример #5
0
        private void ButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            var name = CurrProduct;

            var product = Products.GetProduct(name);

            product.Quantity = double.Parse(TextBoxQuantity.Text);
            var product2 = Products.GetProduct(name);

            if (product.Quantity <= product2.Quantity)
            {
                product.Cost = product.Price * product.Quantity;


                newInvoice.AddProduct(product);
                ResetFields();
                UpdateLabels();
            }
            else
            {
                MessageBox.Show("Brak wystarczającej ilości produktu na magazynie!", "Błąd");
            }
        }