Vbnet+billing+software+source+code
Private Sub LoadCustomers() Dim dt As DataTable = GetDataTable("SELECT CustomerID, CustomerName FROM tbl_Customers") cmbCustomer.DisplayMember = "CustomerName" cmbCustomer.ValueMember = "CustomerID" cmbCustomer.DataSource = dt End Sub
e.Graphics.DrawString("TAX INVOICE", fontTitle, Brushes.Black, leftMargin, yPos) yPos += 40 e.Graphics.DrawString("Invoice No: " & txtInvoiceNo.Text, fontBody, Brushes.Black, leftMargin, yPos) yPos += 20 e.Graphics.DrawString("Date: " & txtInvoiceDate.Text, fontBody, Brushes.Black, leftMargin, yPos) yPos += 30 vbnet+billing+software+source+code
Private Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click PrintPreviewDialog1.Document = PrintDocument1 PrintPreviewDialog1.ShowDialog() End Sub Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage Dim fontTitle As New Font("Arial", 18, FontStyle.Bold) Dim fontBody As New Font("Arial", 10) Dim yPos As Single = e.MarginBounds.Top Dim leftMargin As Single = e.MarginBounds.Left Private Sub LoadCustomers() Dim dt As DataTable =
Public Function ExecuteNonQuery(ByVal query As String, Optional ByVal parameters As SqlParameter() = Nothing) As Integer Using conn As New SqlConnection(ConnectionString) Using cmd As New SqlCommand(query, conn) If parameters IsNot Nothing Then cmd.Parameters.AddRange(parameters) conn.Open() Return cmd.ExecuteNonQuery() End Using End Using End Function FontStyle.Bold) Dim fontBody As New Font("Arial"
Imports System.Data.SqlClient Module DatabaseHelper ' Change this connection string to match your SQL Server instance Public ConnectionString As String = "Data Source=localhost;Initial Catalog=BillingDB;Integrated Security=True"
Public Class frmProducts Private Sub frmProducts_Load(sender As Object, e As EventArgs) Handles MyBase.Load LoadProducts() End Sub Private Sub LoadProducts() Dim query As String = "SELECT ProductID, ProductCode, ProductName, Rate, GST_Percent FROM tbl_Products" dgvProducts.DataSource = GetDataTable(query) dgvProducts.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill End Sub
Private Sub btnAddProduct_Click(sender As Object, e As EventArgs) Handles btnAddProduct.Click ' Assume a popup product search form returns selected product Dim frm As New frmProductSearch() If frm.ShowDialog() = DialogResult.OK Then Dim newRow As DataRow = dtDetails.NewRow() newRow("ProductID") = frm.SelectedProductID newRow("ProductName") = frm.SelectedProductName newRow("Quantity") = 1 newRow("Rate") = frm.Rate ' Tax calculation will be done row-by-row based on GST% Dim gstPercent As Decimal = frm.GSTPercent Dim taxable As Decimal = newRow("Quantity") * newRow("Rate") newRow("TaxableValue") = taxable newRow("CGST") = Math.Round(taxable * (gstPercent / 100) / 2, 2) newRow("SGST") = Math.Round(taxable * (gstPercent / 100) / 2, 2) dtDetails.Rows.Add(newRow) CalculateTotals() End If End Sub