Source Code: Vb.net Billing Software
Dim taxRate As Decimal = 5.0 ' 5% GST Dim taxAmount As Decimal = subtotal * (taxRate / 100) Dim discount As Decimal = nudDiscount.Value Dim grandTotal As Decimal = subtotal + taxAmount - discount
e.Graphics.DrawString("INVOICE", New Font("Arial", 16, FontStyle.Bold), Brushes.Black, e.MarginBounds.Left, y) y += 40 e.Graphics.DrawString("Bill No: " & billID, font, Brushes.Black, e.MarginBounds.Left, y) y += 20 ' Draw more lines – customer details, items grid, totals... End Sub vb.net billing software source code
ProductID (AutoNumber, PK) ProductName (Text) HSN (Text) Price (Currency) Dim taxRate As Decimal = 5
lblSubtotal.Text = subtotal.ToString("N2") lblTax.Text = taxAmount.ToString("N2") lblDiscount.Text = discount.ToString("N2") lblGrandTotal.Text = grandTotal.ToString("N2") End Sub totals... End Sub ProductID (AutoNumber
Private Sub LoadBillData() ' Fetch Bill Header and Items using billID from DB ' (Implement using OleDbDataAdapter) ' Then bind to PrintDocument End Sub
Private Function SaveBillHeader(custID As Integer, subtotal As Decimal, tax As Decimal, discount As Decimal, grand As Decimal) As Integer Dim query As String = "INSERT INTO Bills (BillDate, CustomerID, Subtotal, TaxAmount, DiscountAmount, GrandTotal) VALUES (@date, @cid, @sub, @tax, @dis, @grand); SELECT SCOPE_IDENTITY()" Using conn As New OleDbConnection(connString) Dim cmd As New OleDbCommand(query, conn) cmd.Parameters.AddWithValue("@date", DateTime.Now) cmd.Parameters.AddWithValue("@cid", custID) cmd.Parameters.AddWithValue("@sub", subtotal) cmd.Parameters.AddWithValue("@tax", tax) cmd.Parameters.AddWithValue("@dis", discount) cmd.Parameters.AddWithValue("@grand", grand) conn.Open() Return CInt(cmd.ExecuteScalar()) End Using End Function
Private Sub btnAddItem_Click(sender As Object, e As EventArgs) Handles btnAddItem.Click If cboProduct.SelectedValue Is Nothing Then Exit Sub Dim productID As Integer = CInt(cboProduct.SelectedValue) Dim productName As String = cboProduct.Text Dim qty As Integer = CInt(nudQuantity.Value) Dim price As Decimal = GetProductPrice(productID) Dim total As Decimal = price * qty