📄 qiantai.vb
字号:
Public Class qiantai
Dim usertable As DataTable
Private Sub txtWord_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtWord.KeyPress
If e.KeyChar = Chr(13) Then
Dim sqlstring As String
sqlstring = "select * from shangpinxinxi where shangpinno ='" & txtWord.Text + "'"
usertable = DBOperation.DBOperate(sqlstring)
Lbl1.Text = usertable.Rows(0)("shangpinname")
Lab2.Text = usertable.Rows(0)("xiaoshouprice")
Textzk.Focus()
End If
End Sub
Private Sub txtWord_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtWord.TextChanged
TerminalDescription.Text = "小计"
'txpchange清空
txtChange.Text = ""
'txtpaid清空
txtPaid.Text = ""
' DGView1.DataSource = DBsp.Loadsp("spbh", TxtSpbh.Text, "")
End Sub
Private Sub txtTotal_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtTotal.KeyPress
If e.KeyChar = Chr(13) Then
txtPaid.Focus()
End If
End Sub
Private Sub txtTotal_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTotal.TextChanged
TerminalDescription.Text = "小计"
TerminalCounter.Text = txtTotal.Text
End Sub
Private Sub txtPaid_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtPaid.KeyPress
If e.KeyChar = Chr(13) Then
txtChange.Focus()
TerminalDescription.Text = " 找零"
txtChange.Text = txtPaid.Text - txtTotal.Text
TerminalCounter.Text = txtChange.Text
End If
End Sub
Private Sub txtPaid_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPaid.TextChanged
TerminalDescription.Text = " 实收"
TerminalCounter.Text = txtPaid.Text
End Sub
Private Sub txtSellNum_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtSellNum.KeyPress
If e.KeyChar = Chr(13) Then
Dim row As DataGridViewRow = New DataGridViewRow()
row.CreateCells(DGView1)
row.Cells(0).Value = usertable.Rows(0)("shangpinno")
row.Cells(1).Value = usertable.Rows(0)("shangpinname")
row.Cells(2).Value = txtSellNum.Text
row.Cells(3).Value = usertable.Rows(0)("xiaoshouprice")
row.Cells(4).Value = Textzk.Text
row.Cells(5).Value = Format(txtSellNum.Text * usertable.Rows(0)("xiaoshouprice") * Textzk.Text, "0.00")
DGView1.Rows.Add(row)
txtWord.Text = ""
txtSellNum.Text = "1"
Textzk.Text = "1"
jsje()
txtWord.Focus()
End If
End Sub
Private Sub DGView1_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGView1.CellEndEdit
DGView1.CurrentRow.Cells(5).Value = Format(DGView1.CurrentRow.Cells(2).Value * DGView1.CurrentRow.Cells(3).Value * DGView1.CurrentRow.Cells(4).Value, "0.00")
jsje()
End Sub
Private Sub jsje() '计算金额
Dim i As Integer
Dim j As Single
j = 0
For i = 0 To DGView1.Rows.Count - 1
j = j + DGView1.Rows(i).Cells(5).Value
Next
txtTotal.Text = j
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim TempDBStudent As DBsp
Dim TempDBhy As DBhy
Dim TempDBkc As DBkc
Dim i As Integer
For i = 0 To DGView1.Rows.Count - 2
TempDBStudent = New DBsp(DGView1.Rows(i).Cells(0).Value, DGView1.Rows(i).Cells(1).Value, DGView1.Rows(i).Cells(2).Value, DGView1.Rows(i).Cells(3).Value, DateTimePicker1.Value, ComboBox1.Text, DGView1.Rows(i).Cells(4).Value, DGView1.Rows(i).Cells(5).Value)
TempDBkc = New DBkc(DGView1.Rows(i).Cells(0).Value, DGView1.Rows(i).Cells(2).Value)
TempDBhy = New DBhy(txtTotal.Text, TextBox1.Text)
TempDBStudent.AddSp()
TempDBhy.edithy()
TempDBkc.updateshangpinxinxi()
Next
DGView1.Rows.Clear()
TextBox1.Focus()
End Sub
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = Chr(13) Then
Dim sqlstring As String
sqlstring = "select * from huiyuan where huiyuanno='" & TextBox1.Text + "'"
usertable = DBOperation.DBOperate(sqlstring)
TextBox2.Text = usertable.Rows(0)("huiyuanname")
TextBox3.Text = usertable.Rows(0)("jifen")
txtWord.Focus()
If Trim(TextBox1.Text) = "" Then
MsgBox("您输入的会员号不存在,请重新输入!", MsgBoxStyle.Exclamation, "信息框")
Exit Sub
End If
End If
End Sub
Private Sub Textzk_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Textzk.KeyPress
If e.KeyChar = Chr(13) Then
txtSellNum.Focus()
End If
End Sub
Private Sub qiantai_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txtSellNum.Text = "1"
Textzk.Text = "1"
ComboBox1.Text = "1"
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -