Vb.net Billing Software Source Code -

lblSubtotal.Text = subtotal.ToString("N2") lblTax.Text = taxAmount.ToString("N2") lblDiscount.Text = discount.ToString("N2") lblGrandTotal.Text = grandTotal.ToString("N2") End Sub

Private Sub ResetBill() txtCustomerName.Clear() txtMobile.Clear() txtGSTIN.Clear() dgvItems.Rows.Clear() nudQuantity.Value = 1 lblSubtotal.Text = "0.00" lblTax.Text = "0.00" lblDiscount.Text = "0.00" lblGrandTotal.Text = "0.00" currentBillID = -1 btnPrint.Enabled = False End Sub End Class Imports System.Drawing.Printing Public Class frmPrintPreview Private billID As Integer Private billData As DataTable Private itemsData As DataTable

' Save Customer Dim custID As Integer = SaveCustomer(txtCustomerName.Text, txtMobile.Text, txtGSTIN.Text) vb.net billing software source code

Public Sub New(billID As Integer) InitializeComponent() Me.billID = billID LoadBillData() 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 lblSubtotal

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

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 subtotal As Decimal

Private Sub PrintDocument1_PrintPage(sender As Object, e As PrintPageEventArgs) Handles PrintDocument1.PrintPage Dim font As New Font("Arial", 10) Dim y As Single = e.MarginBounds.Top