コード例 #1
0
ファイル: invoiceForm.cs プロジェクト: Trexis/financemanager
        private void addProduct()
        {
            selectProductForm form = new selectProductForm(context);
            form.ShowDialog(this);

            InvoiceProduct invoiceproduct = form.InvoiceProduct;
            if (!invoiceproduct.Name.Equals(""))
            {
                ListViewItem item = new ListViewItem();
                listView1.Items.Add(createItem(invoiceproduct));
                calculateTotals();
            }
            enableDelete((listView1.SelectedItems.Count > 0));
            enableEdit((listView1.SelectedItems.Count > 0));
            showHint();
        }
コード例 #2
0
        private void addProduct()
        {
            selectProductForm form = new selectProductForm(context);

            form.ShowDialog(this);

            InvoiceProduct invoiceproduct = form.InvoiceProduct;

            if (!invoiceproduct.Name.Equals(""))
            {
                ListViewItem item = new ListViewItem();
                listView1.Items.Add(createItem(invoiceproduct));
                calculateTotals();
            }
            enableDelete((listView1.SelectedItems.Count > 0));
            enableEdit((listView1.SelectedItems.Count > 0));
            showHint();
        }
コード例 #3
0
        private void editSelection()
        {
            try
            {
                foreach (ListViewItem item in listView1.SelectedItems)
                {
                    InvoiceProduct invoiceproduct = new InvoiceProduct();
                    invoiceproduct.Quantity = Convert.ToDouble(item.Text);
                    invoiceproduct.Name     = item.SubItems[1].Text.ToString();
                    invoiceproduct.Price    = Convert.ToDouble(item.SubItems[2].Text);

                    selectProductForm form = new selectProductForm(this.context, invoiceproduct);
                    form.ShowDialog(this);
                    invoiceproduct = form.InvoiceProduct;
                    if (!invoiceproduct.Name.Equals(""))
                    {
                        item.SubItems.Clear();
                        item.Text = invoiceproduct.Quantity.ToString();
                        item.SubItems.Add(invoiceproduct.Name);
                        item.SubItems.Add(Utilities.MakeMoneyValue(invoiceproduct.Price));
                        item.SubItems.Add(Utilities.MakeMoneyValue(System.Math.Round(invoiceproduct.Price * invoiceproduct.Quantity, 2)));
                        Double vat = 0;
                        if (invoiceproduct.HasVat)
                        {
                            vat = invoiceproduct.Price * invoiceproduct.Quantity * 14 / 100;
                        }
                        item.SubItems.Add(Utilities.MakeMoneyValue(System.Math.Round(vat, 2)));
                        item.SubItems.Add(Utilities.MakeMoneyValue(System.Math.Round((invoiceproduct.Quantity * invoiceproduct.Price) + vat, 2)));
                        calculateTotals();
                    }
                }
                enableDelete((listView1.SelectedItems.Count > 0));
                enableEdit((listView1.SelectedItems.Count > 0));
                showHint();
            }
            catch (Exception ex)
            {
                Tools.ShowError("Unable to load product\n" + ex.Message);
            }
        }
コード例 #4
0
ファイル: invoiceForm.cs プロジェクト: Trexis/financemanager
        private void editSelection()
        {
            try
            {
                foreach (ListViewItem item in listView1.SelectedItems)
                {
                    InvoiceProduct invoiceproduct = new InvoiceProduct();
                    invoiceproduct.Quantity = Convert.ToDouble(item.Text);
                    invoiceproduct.Name = item.SubItems[1].Text.ToString();
                    invoiceproduct.Price = Convert.ToDouble(item.SubItems[2].Text);

                    selectProductForm form = new selectProductForm(this.context, invoiceproduct);
                    form.ShowDialog(this);
                    invoiceproduct = form.InvoiceProduct;
                    if (!invoiceproduct.Name.Equals(""))
                    {
                        item.SubItems.Clear();
                        item.Text = invoiceproduct.Quantity.ToString();
                        item.SubItems.Add(invoiceproduct.Name);
                        item.SubItems.Add(Utilities.MakeMoneyValue(invoiceproduct.Price));
                        item.SubItems.Add(Utilities.MakeMoneyValue(System.Math.Round(invoiceproduct.Price * invoiceproduct.Quantity, 2)));
                        Double vat = 0;
                        if (invoiceproduct.HasVat)
                        {
                            vat = invoiceproduct.Price * invoiceproduct.Quantity * 14 / 100;
                        }
                        item.SubItems.Add(Utilities.MakeMoneyValue(System.Math.Round(vat, 2)));
                        item.SubItems.Add(Utilities.MakeMoneyValue(System.Math.Round((invoiceproduct.Quantity * invoiceproduct.Price) + vat, 2)));
                        calculateTotals();
                    }
                }
                enableDelete((listView1.SelectedItems.Count > 0));
                enableEdit((listView1.SelectedItems.Count > 0));
                showHint();
            }
            catch (Exception ex)
            {
                Tools.ShowError("Unable to load product\n" + ex.Message);
            }
        }