🔒 Closed Help

Status
Not open for further replies.

Spaghetto

Established
Pa help po nito
1665739689064.webp


View attachment 2237674

Code:
Imports System.Data.SqlClient
Public Class Form1
    Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
        Me.Dispose()

    End Sub

    Private Sub txtQty_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtQty.KeyPress
        Select Case Asc(e.KeyChar)
            Case 48 To 57
            Case 46
            Case 8
            Case Else
                e.Handled = True
        End Select
    End Sub

    Private Sub GroupBox2_Enter(sender As Object, e As EventArgs) Handles GroupBox2.Enter

    End Sub

    Private Sub txtUnitPrice_TextChanged(sender As Object, e As EventArgs) Handles txtUnitPrice.TextChanged

    End Sub

    Private Sub txtDiscount_TextChanged(sender As Object, e As EventArgs) Handles txtDiscount.TextChanged

    End Sub

    Private Sub txtDiscount_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtDiscount.KeyPress
        Select Case Asc(e.KeyChar)
            Case 48 To 57
            Case 46
            Case 8
            Case Else
                e.Handled = True
        End Select
    End Sub
    Function GetInvoice() As String
        Try
            Dim sdate As String = Now.ToString("MMddyy")
            cn.Open()
            cm = New SqlCommand("select top 1 invoiceno form bills where invoiceno like '" & sdate & "%' order by id desc", cn)
            dr = cm.ExecuteReader
            dr.Read()
            If dr.HasRows Then GetInvoice = CLng(dr.Item("invoiceno").ToString) + 1 Else GetInvoice = sdate & "1001"
            dr.Close()
            cn.Close()
            Return GetInvoice()

        Catch ex As Exception
            cn.Close()
            MsgBox(ex.Message, vbCritical)
        End Try
    End Function

    Private Sub billing_Click(sender As Object, e As EventArgs) Handles billing.Click
        txtInvoiceNo.Text = GetInvoice()
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Connection()
    End Sub
End Class
 
Status
Not open for further replies.

Similar threads

About this Thread

  • 1
    Replies
  • 354
    Views
  • 2
    Participants
Last reply from:
deadsheep

Online now

Members online
864
Guests online
3,286
Total visitors
4,150

Forum statistics

Threads
2,276,114
Posts
28,967,719
Members
1,231,123
Latest member
Carboradore_26
Back
Top