📄 sales.frm
字号:
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 195
Left = 150
TabIndex = 12
Top = 1410
Width = 1155
End
Begin VB.Label Label9
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Product ID :"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 195
Left = 150
TabIndex = 11
Top = 1020
Width = 915
End
End
Begin VB.Frame Frame1
BackColor = &H00E0E0E0&
Caption = "List of Orders"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 4065
Left = 5250
TabIndex = 3
Top = 1110
Width = 9045
Begin MSComctlLib.ListView lvprod
Height = 3765
Left = 120
TabIndex = 4
ToolTipText = "double click to remove product in the list"
Top = 210
Width = 8835
_ExtentX = 15584
_ExtentY = 6641
View = 3
LabelWrap = -1 'True
HideSelection = -1 'True
FullRowSelect = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = 16777215
BorderStyle = 1
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
NumItems = 5
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "Product Id"
Object.Width = 0
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Alignment = 2
SubItemIndex = 1
Text = "Item"
Object.Width = 1587
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 2
Text = "Descripiton"
Object.Width = 6174
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 3
Text = "Category Name"
Object.Width = 4851
EndProperty
BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Alignment = 1
SubItemIndex = 4
Text = "Amount"
Object.Width = 2293
EndProperty
End
End
Begin VB.Timer Timer1
Interval = 100
Left = 30
Top = 810
End
Begin MSComctlLib.StatusBar sb2
Align = 2 'Align Bottom
Height = 375
Left = 0
TabIndex = 2
Top = 9825
Width = 15240
_ExtentX = 26882
_ExtentY = 661
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 1
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 27342
MinWidth = 27342
EndProperty
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label lblCashier
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "Arial Black"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 705
Left = 840
TabIndex = 45
Top = 210
Width = 7275
End
Begin VB.Label lblStatus
BackStyle = 0 'Transparent
BeginProperty Font
Name = "Tahoma"
Size = 15.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 645
Left = 780
TabIndex = 44
Top = 9420
Width = 6495
End
End
Attribute VB_Name = "Sales"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Orders As New ADODB.Recordset
Dim lst As ListItem
Private Sub btnCancel_Click()
If lvprod.ListItems.Count = 0 Then
btnStart.Enabled = True
btnPrint.Enabled = False
btnSave.Enabled = False
btnCancel.Enabled = False
Call Cleartext
txtAmount.Text = ""
txtDiscount.Text = ""
txtInvoiceNo.Text = ""
Exit Sub
Else
ans = MsgBox("Are you sure do you wanto cancel?", vbYesNo + vbQuestion, "Cancel?")
If ans = vbYes Then
btnStart.Enabled = True
btnPrint.Enabled = False
btnSave.Enabled = False
btnCancel.Enabled = False
Call Cleartext
txtAmount.Text = ""
txtDiscount.Text = ""
txtInvoiceNo.Text = ""
DoEvents
Bar1.Max = lvprod.ListItems.Count * 10
Do While lvprod.ListItems.Count > 0
Bar1.Visible = True
lvprod.ListItems.Remove lvprod.SelectedItem.Index
lvprod.Refresh
Screen.MousePointer = 1
Do While Bar1.Value < Bar1.Max
Bar1.Value = Bar1.Value + 1
DoEvents
Loop
DoEvents
Loop
Bar1.Value = 0
Screen.MousePointer = 1
Bar1.Visible = False
End If
DoEvents
End If
End Sub
Private Sub btnCompute_Click()
a = Val(txtAmount.Text) * Val(txtDiscount.Text)
b = Val(txtAmount.Text) - a
txtAmount.Text = b
If txtDiscount.Text = "" Then
txtDiscount.Text = "0.00"
End If
If Val(txtPayments.Text) < Val(txtAmount.Text) Then
MsgBox "Insufficient Amount " & Chr(10) & "Please change the value " & Chr(10) & "that is greater than or equal " & StrConv(txtAmount, vbUpperCase), vbOKOnly + vbInformation, "Insufficient"
txtAmount.Text = CStr(Format(ComputeAmount, "########0.00"))
Else
If Val(txtDiscount.Text) < Val(txtAmount.Text) Then
bayad = Val(txtPayments.Text)
sukli = bayad - Val(txtAmount.Text)
txtChange.Text = CStr(Format(sukli, "##,####0.00"))
txtAmount.Text = CStr(Format(txtAmount.Text, "##,####0.00"))
txtPayments.Text = CStr(Format(txtPayments.Text, "##,####0.00"))
btnSave.Enabled = True
txtPayments.locked = True
btnCompute.Enabled = False
btnSave.SetFocus
txtDiscount.locked = True
Else
MsgBox "Discount should be less than " & vbCrLf & "the total amount", vbExclamation, "Discount"
End If
End If
txtPayments.SetFocus
End Sub
Private Sub btnCompute_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyF1
Call btnStart_Click
Case vbKeyF2
LookUp.Show vbModal
Case vbKeyF3
btnCancel_Click
Case vbKeyF4
Call btnSave_Click
Case vbKeyF9
ans = MsgBox("Are you sure do you want Log Off?", vbQuestion + vbYesNo, "Log Off")
If ans = vbYes Then
Unload Me
Password.Show
mdiMain.Hide
Else
Exit Sub
End If
End Select
End Sub
Private Sub btnExit_Click()
End
End Sub
Private Sub btnPrint_Click()
On Error Resume Next
Dim tammnt As String, cash As String, _
dscount As String, change As String, _
SNo As String
Dim rs As New ADODB.Recordset
If rs.State = 1 Then Set rs = Nothing
rs.Open "select * from [SalesRep] where [Invoice No]='" & _
Sales.txtInvoiceNo.Text & "'", con, adOpenKeyset, adLockOptimistic
With drptSales
Set .DataSource = Nothing
.DataMember = ""
Set .DataSource = rs.DataSource
With .Sections("Section1").Controls
For i = 1 To .Count
If TypeOf .Item(i) Is RptTextBox Then
.Item(i).DataMember = ""
.Item(i).DataField = rs.Fields(i - 1).Name
End If
Next i
End With
.Show
mdiMain.Toolbar1.Visible = False
End With
If rs.State = 1 Then Set rs = Nothing
rs.Open "select * from [Invoice] where [Invoice No]='" & Sales.txtInvoiceNo.Text & "'", con, adOpenKeyset, adLockOptimistic
tamnt = rs.Fields!Amount
cash = rs.Fields!Payments
dscount = rs.Fields!Discount
change = rs.Fields!change
SNo = rs.Fields("Invoice No")
With drptSales
.Sections("SDetails").Controls("lbltotal").Caption = Format(tamnt, "###,####0.00")
.Sections("SDetails").Controls("lblcash").Caption = Format(cash, "###,####0.00")
.Sections("SDetails").Controls("lbldiscount").Caption = dscount
.Sections("SDetails").Controls("lblchange").Caption = change
.Sections("header").Controls("invoiceno").Caption = SNo
End With
Set rs = Nothing
mdiMain.Toolbar1.Visible = False
End Sub
Private Sub btnReset_Click()
txtPayments.Text = ""
txtChange.Text = ""
txtDiscount.Text = ""
txtAmount.Text = Format(txtAmount, "########0.00")
btnCompute.Enabled = True
txtPayments.locked = False
txtDiscount.locked = False
txtAmount.Text = CStr(Format(ComputeAmount, "########0.00"))
txtPayments.SetFocus
End Sub
Private Sub btnSave_Click()
Dim adoOrders As New ADODB.Recordset
Dim adoInvoice As New ADODB.Recordset
If lvprod.ListItems.Count <= 0 Then
Exit Sub
Else
If txtPayments.Text = Empty Then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -