-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBill.vb
65 lines (56 loc) · 1.81 KB
/
Bill.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Public Class Bill
Private Sub Save()
App.Save("../../database/bills.txt", BillLV)
End Sub
Private Sub Load()
Dim list = App.Load("../../database/bills.txt")
BillLV.Items.Clear()
For Each item In list
BillLV.Items.Add(item)
Next
End Sub
Public Sub Add(item As Array)
App.AddToListView(0, item, BillLV)
Save()
End Sub
Public Sub Edit(index As Integer, item As Array)
BillLV.Items.RemoveAt(index)
App.AddToListView(index, item, BillLV)
Save()
End Sub
Public Sub Remove(index As Integer)
BillLV.Items.RemoveAt(index)
Save()
End Sub
Private Sub DeleteButton_Click(sender As Object, e As EventArgs) Handles DeleteButton.Click
If BillLV.SelectedItems.Count > 0 Then
Remove(BillLV.FocusedItem.Index)
Else
MsgBox("Chưa chọn dữ liệu")
End If
End Sub
Private Sub CreateButton_Click(sender As Object, e As EventArgs) Handles CreateButton.Click
Dim form As New BillForm
form.Owner = Me
form.BillLink = Me
form.Show()
End Sub
Private Sub Bill_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Owner.Enabled = False
BillLV.View = View.Details
Load()
End Sub
Private Sub Bill_Closed(sender As Object, e As EventArgs) Handles Me.Closed
Owner.Enabled = True
End Sub
Private Sub PrintButton_Click(sender As Object, e As EventArgs) Handles PrintButton.Click
If BillLV.SelectedItems.Count > 0 Then
Dim form As New PrintForm
form.Owner = Me
form.BillId = BillLV.SelectedItems(0).Text
form.Show()
Else
MsgBox("Chưa chọn dữ liệu")
End If
End Sub
End Class