Vb.net Billing Software Source Code Now
Imports System.Data.SqlClient Module mod_DB Public connString As String = "Data Source=localhost\SQLEXPRESS;Initial Catalog=BillingDB;Integrated Security=True"
Private Sub PrintInvoice() Dim printDoc As New Printing.PrintDocument() AddHandler printDoc.PrintPage, AddressOf PrintPageHandler Dim printDialog1 As New PrintDialog() printDialog1.Document = printDoc If printDialog1.ShowDialog() = DialogResult.OK Then printDoc.Print() End If End Sub Private Sub PrintPageHandler(sender As Object, e As Printing.PrintPageEventArgs) Dim yPos As Single = e.MarginBounds.Top Dim leftMargin As Single = e.MarginBounds.Left Dim font As New Font("Arial", 12) Dim largeFont As New Font("Arial", 16, FontStyle.Bold) vb.net billing software source code
Public Function ExecuteNonQuery(ByVal query As String) As Integer Using conn As SqlConnection = getConnection() conn.Open() Using cmd As New SqlCommand(query, conn) Return cmd.ExecuteNonQuery() End Using End Using End Function End Module In frm_Billing.vb , a DataGridView acts as the cart. The user scans a barcode or selects a product, and it is added to the cart. Imports System
-- Invoice Master Table (One invoice per record) CREATE TABLE tbl_Invoice_Master ( InvoiceNo INT PRIMARY KEY IDENTITY(1,1), InvoiceDate DATETIME DEFAULT GETDATE(), CustomerID INT FOREIGN KEY REFERENCES tbl_Customers(CustomerID), SubTotal DECIMAL(18,2), TaxAmount DECIMAL(18,2), GrandTotal DECIMAL(18,2) ); 12) Dim largeFont As New Font("Arial"
'Loop through DataGridView rows and print them For Each row As DataGridViewRow In dgvCart.Rows Dim line As String = row.Cells("ProductName").Value & " x " & row.Cells("Quantity").Value & " = " & row.Cells("Total").Value e.Graphics.DrawString(line, font, Brushes.Black, leftMargin, yPos) yPos += 20 Next
