📄 purchase.frm
字号:
Appearance = 0 'Flat
BackColor = &H00400000&
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C0E0FF&
Height = 375
Left = 180
TabIndex = 35
Top = 5190
Width = 11775
End
End
Attribute VB_Name = "Purchase"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mode, c1, c2, c3, c4 As String
Dim pos As Integer
Private Function is_empty() As Boolean
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 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
'Adodc1.Recordset.AddNew
DTPicker1.Value = Date
Text2 = Date
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()
If Trim(Text17) = "" Then
MsgBox "Can't Save as Billno is Not Entered.", vbExclamation, "Saving..."
Exit Sub
End If
'<----------------------Saving in Master_trans-------->
Adodc3.Recordset.AddNew
Adodc3.Recordset.Fields("ac_id") = Text1.Text
Adodc3.Recordset.Fields("Billno") = Text17.Text
Adodc3.Recordset.Fields("Date") = Text2.Text
Adodc3.Recordset.Fields("Amt") = Text14.Text
Adodc3.Recordset.Fields("Paid") = Text16.Text
Adodc3.Recordset.Fields("Balance") = Text11.Text
Adodc3.Recordset.Fields("Mode") = Combo1.Text
Adodc3.Recordset.Fields("Ch_no") = Text20.Text
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.Text
Adodc4.Recordset.Fields("Billno") = Text17.Text
Adodc4.Recordset.Fields("item_code") = Str(Adodc1.Recordset.Fields("item_code"))
a = Adodc1.Recordset.Fields("g_head")
Adodc4.Recordset.Fields("g_head") = (a)
a = Adodc1.Recordset.Fields("item")
Adodc4.Recordset.Fields("item") = a
a = Adodc1.Recordset.Fields("model")
Adodc4.Recordset.Fields("model") = (a)
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
'---------------Increasing 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_p 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
MAIN.Show
Unload Me
End Sub
Private Sub Command2_Click()
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("ac_id") = Text1.Text
Adodc1.Recordset.Fields("billno") = Text17.Text
Adodc1.Recordset.Fields("item_code") = Text4.Text
Adodc1.Recordset.Fields("g_head") = Text5.Text
Adodc1.Recordset.Fields("item") = Text6.Text
Adodc1.Recordset.Fields("model") = Text7.Text
Adodc1.Recordset.Fields("qty") = Text8.Text
Adodc1.Recordset.Fields("rate") = Text9.Text
Adodc1.Recordset.Fields("rebate") = Text10.Text
Adodc1.Recordset.Update
a = Val(Text8) * Val(Text9) - Val(Text10)
Text14 = Val(Text14) + a
Text11 = Val(Text14)
'-----------clear the textboxes-------------
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
Text9 = ""
Text10 = ""
Text4.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()
If Me.Tag = "" Then
Call clear_temp_trans_pur
Adodc1.Refresh
DataGrid1.Refresh
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
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 Text16_Change()
Text11 = Val(Text14) - Val(Text16)
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Me.Enabled = False
items.Tag = "P"
items.Show
End If
End Sub
Private Sub List1_Click()
'-----------------------Account ID and Balance---------------
Frame1.Enabled = True
Frame3.Enabled = True
Adodc2.RecordSource = "select * from accounts_p"
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
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -