📄 sale.frm
字号:
If Adodc1.Recordset.RecordCount = 0 Then
'MsgBox "The Database is Empty.", vbOKOnly + vbExclamation, "Confirm..."
is_empty = True
Else
is_empty = False
End If
End Function
Private Function new_no() As Integer
On Error Resume Next
If is_empty Then
new_no = 1
Else
Adodc2.RecordSource = "Select max(ac_no) from accounts"
Adodc2.Refresh
new_no = Adodc2.Recordset.Fields(0) + 1
End If
End Function
Private Sub cb_Click(Index As Integer)
Select Case (Index)
Case 0
If Not is_empty Then
Adodc1.Recordset.MoveFirst
Call ref
End If
Case 1
If Not is_empty Then
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF = True Then
Adodc1.Recordset.MoveFirst
End If
Call ref
End If
Case 2
If Not is_empty Then
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF = True Then
Adodc1.Recordset.MoveLast
End If
Call ref
End If
Case 3
If Not is_empty Then
Adodc1.Recordset.MoveLast
End If
Call ref
Case 4
Dim nno As Integer
mode = "add"
Label15.Caption = "Type The Entries Of New Account"
pos = Adodc1.Recordset.AbsolutePosition
nno = new_no
'Adodc1.Recordset.AddNew
DTPicker1.Value = Date
Text2 = Date
Text13 = nno
List1.SetFocus
Exit Sub
Case 5
mode = "edit"
pos = Adodc1.Recordset.AbsolutePosition
Case 6
Dim res As Integer
If Not is_empty Then
res = MsgBox("Wish To Delete The Current A/C Entry Permanently", vbYesNo + vbExclamation, "Confirm...")
If res = vbYes Then
Adodc1.Recordset.Delete
If Not is_empty Then
Call cb_Click(2)
Else
Adodc1.Refresh
MsgBox "No more records"
End If
End If
End If
Call ref
Case 7
Me.Enabled = False
Form2.Show
Case 8
Form4.Enabled = True
Form4.Show
Unload Me
Case 9
Label17.Caption = "Under Filteration"
f_mode = True
Me.Enabled = False
Form2.Show
Case 10
Adodc1.RecordSource = "select * from students"
Adodc1.Refresh
Label17.Caption = ""
End Select
Call ref
End Sub
Private Sub Command1_Click()
Call rep
End Sub
Private Sub Combo1_Click()
If Combo1.Text = "CHEQUE" Then
Text20.Enabled = True
Else
Text20.Enabled = False
End If
End Sub
Private Sub Command10_Click()
'<----------------------Saving in Master_trans-------->
Adodc3.Recordset.AddNew
Adodc3.Recordset.Fields("ac_id") = Text1
Adodc3.Recordset.Fields("Billno") = Text17
Adodc3.Recordset.Fields("Date") = Text2
Adodc3.Recordset.Fields("Time") = Text3
Adodc3.Recordset.Fields("Amt") = Text14
Adodc3.Recordset.Fields("Paid") = Text16
Adodc3.Recordset.Fields("Balance") = Text11
Adodc3.Recordset.Fields("Mode") = Combo1.Text
Adodc3.Recordset.Fields("Ch_no") = Text20
Adodc3.Recordset.Update
'<----------------------End of Master_trans-------->
'<----------------------Saving in trans-------->
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
Adodc4.Recordset.AddNew
Adodc4.Recordset.Fields("ac_id") = Text1
Adodc4.Recordset.Fields("Billno") = Text17
Adodc4.Recordset.Fields("item_code") = Adodc1.Recordset.Fields("item_code")
Adodc4.Recordset.Fields("g_head") = Adodc1.Recordset.Fields("g_head")
Adodc4.Recordset.Fields("item") = Adodc1.Recordset.Fields("item")
Adodc4.Recordset.Fields("model") = Adodc1.Recordset.Fields("model")
Adodc4.Recordset.Fields("qty") = Adodc1.Recordset.Fields("qty")
Adodc4.Recordset.Fields("rate") = Adodc1.Recordset.Fields("rate")
Adodc4.Recordset.Fields("rebate") = Adodc1.Recordset.Fields("rebate")
Adodc4.Recordset.Update
'---------------Reducing the Stock---------------
Adodc5.RecordSource = "select * from stock where item_code = '" + Adodc1.Recordset.Fields("item_code") + "'"
Adodc5.Refresh
Adodc5.Recordset.Fields("QOH") = Adodc5.Recordset.Fields("QOH") - Adodc1.Recordset.Fields("qty")
Adodc5.Recordset.Update
'-----------------end of red. of stock--------------
Adodc1.Recordset.MoveNext
Wend
'<----------------------End of Master_trans-------->
'<------------------Change the Balance Amt.(if applicable)----?
If Val(Text11) > 0 Then
Adodc2.RecordSource = "select * from accounts where ac_no = " + Text1
Adodc2.Refresh
Adodc2.Recordset.Fields("balance") = Adodc2.Recordset.Fields("balance") + Val(Text11)
Adodc2.Recordset.Update
End If
'<----------------------------End------------------------->
End Sub
Private Sub Command11_Click()
MAIN.Enabled = True
Unload Me
End Sub
Private Sub Command2_Click()
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("ac_id") = Text1
Adodc1.Recordset.Fields("billno") = Text17
Adodc1.Recordset.Fields("item_code") = Text4
Adodc1.Recordset.Fields("g_head") = Text5
Adodc1.Recordset.Fields("item") = Text6
Adodc1.Recordset.Fields("model") = Text7
Adodc1.Recordset.Fields("qty") = Text8
Adodc1.Recordset.Fields("rate") = Text9
Adodc1.Recordset.Fields("rebate") = Text10
Adodc1.Recordset.Update
Adodc4.Recordset.AddNew
Adodc4.Recordset.Fields("ac_name") = Text1
Adodc4.Recordset.Fields("Billno") = Text17
Adodc4.Recordset.Fields("item_code") = Adodc1.Recordset.Fields("item_code")
Adodc4.Recordset.Fields("g_head") = Adodc1.Recordset.Fields("g_head")
Adodc4.Recordset.Fields("item") = Adodc1.Recordset.Fields("item")
Adodc4.Recordset.Fields("model") = Adodc1.Recordset.Fields("model")
Adodc4.Recordset.Fields("qty") = Adodc1.Recordset.Fields("qty")
Adodc4.Recordset.Fields("rate") = Adodc1.Recordset.Fields("rate")
Adodc4.Recordset.Fields("rebate") = Adodc1.Recordset.Fields("rebate")
Adodc4.Recordset.Fields("Amount") = Adodc1.Recordset.Fields("rebate")
Adodc4.Recordset.Update
'---------------Reducing the Stock---------------
Adodc5.RecordSource = "select * from stock where item_code = '" + Adodc1.Recordset.Fields("item_code") + "'"
Adodc5.Refresh
Adodc5.Recordset.Fields("QOH") = Adodc5.Recordset.Fields("QOH") - Adodc1.Recordset.Fields("qty")
Adodc5.Recordset.Update
'-----------------end of red. of stock--------------
Adodc1.Recordset.MoveNext
'<----------------------End of Master_trans-------->
'<------------------Change the Balance Amt.(if applicable)----?
If Val(Text11) > 0 Then
Adodc2.RecordSource = "select * from accounts where ac_no = " + Text1
Adodc2.Refresh
Adodc2.Recordset.Fields("balance") = Adodc2.Recordset.Fields("balance") + Val(Text11)
Adodc2.Recordset.Update
End If
'<----------------------------End------------------------->
'-----------clear the textboxes-------------
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
Text2.SetFocus
End Sub
Private Sub DTPicker1_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date)
Text2 = DTPicker1.Value
End Sub
Private Sub DTPicker1_Change()
Text2 = DTPicker1.Value
End Sub
Private Sub Form_Activate()
Call clear_temp_trans
Adodc1.Refresh
DataGrid1.Refresh
If Me.Tag = "" Then
While Adodc2.Recordset.EOF = False
List1.AddItem Adodc2.Recordset.Fields("ac_name")
Adodc2.Recordset.MoveNext
Wend
Call ref
Call cb_Click(4)
Else
If Me.Tag = "cancel" Then
Text4.SetFocus
Else
Text8.SetFocus
End If
End If
End Sub
Private Sub ref()
On Error Resume Next
Dim s As String
s = "Record No. :" + Str(Adodc1.Recordset.AbsolutePosition) + " out of " + Str(Adodc1.Recordset.RecordCount)
Label15.Caption = s
hs.Max = Adodc1.Recordset.RecordCount
hs.Value = Adodc1.Recordset.AbsolutePosition
End Sub
Private Sub hs_Change()
Adodc1.Recordset.AbsolutePosition = hs.Value
Call ref
End Sub
Private Sub rep()
mysql = "delete from temp_accounts"
Call del_rec
Adodc3.RecordSource = "Select * from temp_accounts order by name"
Adodc3.Refresh
Adodc1.Recordset.MoveFirst
If Adodc1.Recordset.RecordCount <> 0 Then
'While Adodc1.Recordset.EOF = False
For j = 1 To Adodc1.Recordset.RecordCount
Adodc3.Recordset.AddNew
For i = 0 To 8
If Adodc1.Recordset.Fields(i) = Null Then
Adodc3.Recordset.Fields(i) = ""
Else
Adodc3.Recordset.Fields(i) = Adodc1.Recordset.Fields(i)
End If
Next i
Adodc3.Recordset.Update
Adodc1.Recordset.MoveNext
Next j
'Wend
End If
MsgBox "Press Ok to Print Report"
DataEnvironment1.Connection1.Open
DataEnvironment1.Command1
DataReport1.Show
DataReport1.WindowState = 2
Adodc1.Recordset.MoveFirst
'''DataEnvironment1.rsCommand1_Grouping.Filter = ("where ucase(Branch) = 'CS' and Sem = '8'")
'''MsgBox "Press Ok to Print Report"
'''
'''MsgBox DataEnvironment1.Connection1.State
'''If DataEnvironment1.Connection1.State = 1 Then
''' DataEnvironment1.Connection1.Close
''' DataEnvironment1.Connection1.Open
'''Else
''' DataEnvironment1.Connection1.Open
'''End If
'''DataEnvironment1.Command1_Grouping
'''DataReport1.Show
'''DataReport1.WindowState = 2
End Sub
Private Sub List1_Click()
'-----------------------Account ID and Balance---------------
Frame1.Enabled = True
Frame3.Enabled = True
Adodc2.RecordSource = "select * from accounts"
Adodc2.Refresh
Adodc2.Recordset.MoveFirst
While Adodc2.Recordset.EOF = False
If List1.Text = Adodc2.Recordset.Fields("ac_name") Then
Text1 = Adodc2.Recordset.Fields("ac_no")
Text18 = Adodc2.Recordset.Fields("balance")
End If
Adodc2.Recordset.MoveNext
Wend
DTPicker1.Value = Date
Text3 = Time
'---------for Bill No.-----------------------------------
Adodc3.RecordSource = "select * from master_trans order by billno"
Adodc3.Refresh
If Adodc3.Recordset.RecordCount >= 1 Then
Adodc3.Recordset.MoveLast
Text17 = Adodc3.Recordset.Fields("billno") + 1
Else
Text17 = 1
End If
'------end of bill no generation-------------------------
End Sub
Private Sub Text16_Change()
Text11 = Val(Text14) - Val(Text16)
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Me.Enabled = False
items.Show
End If
End Sub
Private Sub Text8_Validate(Cancel As Boolean)
If Val(Text8) > Val(Me.Tag) Then
MsgBox "Low Stock"
Cancel = True
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -