Example #1
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (dgvInvoices.SelectedCells.Count == 1)
            {
                Invoice invoiceForPrinting = new Invoice(InvoiceNumber, selectedCustomer, tbValuta.Text, tbDescription.Text, mtbDate.Text, cbDocType.SelectedItem.ToString());
                invoiceForPrinting.InvoiceItems = Invoice_DbCommunication.GetInvoiceItemsForInvoice(InvoiceNumber);

                Form print = new PrintForm(invoiceForPrinting);
                print.ShowDialog();
            }
        }
Example #2
0
        private void SetPriceSumTextBoxes()
        {
            List <InvoiceItem> items                = Invoice_DbCommunication.GetInvoiceItemsForInvoice(InvoiceNumber);
            decimal            totalPriceWithTax    = 0.0m;
            decimal            totalPriceWithoutTax = 0.0m;
            decimal            totalTax             = 0.0m;

            foreach (InvoiceItem i in items)
            {
                totalPriceWithTax    += i.GetTotalPrice();
                totalPriceWithoutTax += i.GetTotalPriceWithoutTax();
                totalTax             += i.GetTax();
            }

            tbTotalPrice.Text      = totalPriceWithTax.ToString("N2");
            tbPriceWithoutTax.Text = totalPriceWithoutTax.ToString("N2");
            tbTax.Text             = totalTax.ToString("N2");
        }