Private Sub frmBilling_Load(sender As Object, e As EventArgs) Handles MyBase.Load LoadProductsIntoCombo() ResetBill() End Sub
Private Sub LoadProductsIntoCombo() Dim query As String = "SELECT ProductID, ProductName FROM Products" Using conn As New OleDbConnection(connString) Dim da As New OleDbDataAdapter(query, conn) Dim dt As New DataTable() da.Fill(dt) cboProduct.DataSource = dt cboProduct.DisplayMember = "ProductName" cboProduct.ValueMember = "ProductID" End Using End Sub 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 frmBilling_Load(sender As Object
Private Sub LoadBillData() ' Fetch Bill Header and Items using billID from DB ' (Implement using OleDbDataAdapter) ' Then bind to PrintDocument End Sub vb.net billing software source code
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
Private Function GetProductPrice(productID As Integer) As Decimal Dim query As String = "SELECT Price FROM Products WHERE ProductID = @pid" Using conn As New OleDbConnection(connString) Dim cmd As New OleDbCommand(query, conn) cmd.Parameters.AddWithValue("@pid", productID) conn.Open() Return CDec(cmd.ExecuteScalar()) End Using End Function
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