Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 75

ISABELA STATE UNIVERSITY

Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY

RELEVANT SOURCE CODE

Bachelor of Science in Information TechnologyPage 1

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY

APPENDIX I
RELEVANT SOURCE CODE
Project Name:
System Code:
TTS
A SMS-Based Student Account
Monitoring System
Sub-System:

Sub-Sytem
Code:

Date: September
2014

RSC
Authors:
Socrates C. Ariola
Paulo I. Guillermo
Paul John S. Solomon
Page
1 of 74

Log in form
Private Sub cmdcancel_Click()
Unload Me
End Sub
Private Sub cmdok_Click()
Connect
sql = "select * from tblusers where userid='" & LCase(txtuserid.Text) & "'"
Set rs = New ADODB.Recordset
rs.Open sql, con, adOpenDynamic, adLockOptimistic
If rs.RecordCount = 0 Then
MsgBox "User ID not found!", vbInformation, "System"
txtuserid.SetFocus
txtuserid.Text = ""
txtpassword.Text = ""
ElseIf rs.RecordCount = 1 And rs.Fields!Password <> LCase(txtpassword.Text) Then
MsgBox "Password Incorect!", vbInformation, "System"
txtpassword.SetFocus
txtpassword.Text = ""
Else
With mainform.StatusBar1
.Panels(1).Text = rs.Fields!longname
End With
Connect
Set rs = Nothing
rs.Open "select * from tblusers where userid='" & LCase(txtuserid.Text) & "'", con,
adOpenDynamic, adLockOptimistic
If rs.Fields!usertype = "Admin" Then
mainform.mnusetupandconfiguration.Enabled = True
Bachelor of Science in Information TechnologyPage 2

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
Else
mainform.mnusetupandconfiguration.Enabled = False
End If
Unload Me
splashform.Show
End If
End Sub
Private Sub Timer1_Timer()
loginform.Caption = "Log on @ " & "[" & Format(Now) & "]"
End Sub
Private Sub txtpassword_GotFocus()
txtpassword.BackColor = &H80FFFF
End Sub
Private Sub txtpassword_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call cmdok_Click
End Sub
Private Sub txtpassword_LostFocus()
txtpassword.BackColor = &H8000000F
End Sub
Private Sub txtuserid_GotFocus()
txtuserid.BackColor = &H80FFFF
End Sub
Private Sub txtuserid_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call cmdok_Click
End Sub
Private Sub txtuserid_LostFocus()
txtuserid.BackColor = &H8000000F
End Sub
Main Form
Private Sub cmdadd_Click()
studentinformationform.Show
End Sub
Private Sub cmdenroll_Click()
enrollmentform.Show 1, mainform
End Sub
Bachelor of Science in Information TechnologyPage 3

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY

Private Sub cmdpay_Click()


paymentform.Show 1, mainform
End Sub
Private Sub cmdremind_Click()
remindersform.Show 1, mainform
End Sub
Private Sub MDIForm_Load()
Connect
sql = "select * from tblsystemnumber"
Set rs = New ADODB.Recordset
rs.Open sql, con, adOpenDynamic, adLockOptimistic
mainform.StatusBar1.Panels(2).Text = rs.Fields!systemnumber
End Sub
Private Sub MDIForm_Unload(Cancel As Integer)
If vbYes = MsgBox("Are you sure you want exit?", vbQuestion + vbYesNo, "System")
Then
Unload Me
Else
Cancel = True
End If
End Sub
Private Sub mnuabout_Click()
aboutform.Show
End Sub
Private Sub mnuenrollee_Click()
enrolleemasterlistform.Show
End Sub
Private Sub mnuenrolleemasterlistreport_Click()
enrolleemasterlistreportform.Show
End Sub
Private Sub mnuassestmentform_Click()
assestmentform.Show
End Sub

Bachelor of Science in Information TechnologyPage 4

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
Private Sub mnuenrollees_Click()
enrolleemasterlistreportform.Show
End Sub
Private Sub mnuenrollment_Click()
enrollmentform.Show 1, mainform
End Sub
Private Sub mnuexaminationschedules_Click()
examinationschedulesform.Show
End Sub
Private Sub mnuexit_Click()
Unload Me
End Sub
Private Sub mnulogoff_Click()
Unload Me
loginform.Show
End Sub
Private Sub mnumessages_Click()
messagesform.Show
End Sub
Private Sub mnupayment_Click()
paymentform.Show 1, mainform
End Sub
Private Sub mnupaymentbreakdown_Click()
paymentbreakdownform.Show
End Sub
Private Sub mnupaymentinformationreport_Click()
paymentinformationreportform.Show
End Sub
Private Sub mnupaymentinformation_Click()
paymentbreakdownform.Show
End Sub
Private Sub mnupayments_Click()
paymentinformationreportform.Show
End Sub

Bachelor of Science in Information TechnologyPage 5

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
Private Sub mnureminders_Click()
remindersform.Show 1, mainform
End Sub
Private Sub mnustudentifnformation_Click()
studentinformationform.Show
End Sub
Private Sub mnusystemnumber_Click()
systemnumberform.Show
End Sub
Private Sub mnuusermaintenance_Click()
usermaintenanceform.Show
End Sub
Private Sub mnuusertype_Click()
usertypeform.Show
End Sub
Private Sub mnuyearlevel_Click()
yearlevelform.Show
End Sub
AddUpdateUserType
Public Sub addusertype()
rs.Fields!usertypeid = id
rs.Fields!usertype = txtusertype.Text
End Sub
Private Sub cmdsave_Click()
If txtusertype.Text = "" Then
MsgBox "Please fill User Type!", , "System"
txtusertype.SetFocus
Else
If cmdsave.Caption = "&Save" Then
id = "1"
Set rs = New ADODB.Recordset
sql = "select * from tblusertype"
rs.Open sql, con, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
With rs
.MoveLast
id = Val(!usertypeid) + Val(1)
Bachelor of Science in Information TechnologyPage 6

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
.Close
End With
End If
Connect
rs.Open "select * from tblusertype where usertype='" & txtusertype & "'", con,
adOpenDynamic, adLockOptimistic
If rs.RecordCount = 1 Then
MsgBox "Usertype already exist!", , "System"
txtusertype.Text = ""
txtusertype.SetFocus
Else
Connect
sql = "select * from tblusertype"
Set rs = Nothing
rs.Open sql, con, adOpenDynamic, adLockOptimistic
With rs
.AddNew
addusertype
.Update
End With
MsgBox "Usertype successfully saved!", vbInformation, "System"
Unload Me
usertypeform.Show
End If
Else
con.Execute "update tblusertype set" & vbCrLf & _
"usertype='" & txtusertype.Text & "'" & vbCrLf & _
"where usertypeid='" & id & "'"
MsgBox "Usertype successfully updated!", vbInformation, "System"
Unload Me
usertypeform.Show
End If
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
usertypeform.Show
End Sub
Private Sub txtusertype_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
Bachelor of Science in Information TechnologyPage 7

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
AddUpdateUserForm
Public Sub fillusertype()
Set rs = New ADODB.Recordset
rs.Open "select * from tblusertype", con, adOpenDynamic, adLockOptimistic
Do While Not rs.EOF
txtusertype.AddItem rs.Fields!usertype
rs.MoveNext
Loop
rs.Close
End Sub
Public Sub adduser()
rs.Fields!id = id
rs.Fields!userid = txtuserid.Text
rs.Fields!lastname = txtlastname.Text
rs.Fields!firstname = txtfirstname.Text
rs.Fields!mi = txtmi.Text
rs.Fields!extensionname = txtextensionname.Text
rs.Fields!longname = txtlongname.Text
rs.Fields!usertype = txtusertype.Text
rs.Fields!Password = txtlogonpassword.Text
rs.Fields!entryby = mainform.StatusBar1.Panels(1).Text
rs.Fields!entrydate = Now
End Sub
Private Sub Check1_Click()
If Check1.Value = 1 Then
txtlogonpassword.PasswordChar = ""
Else
txtlogonpassword.PasswordChar = "*"
End If
End Sub
Private Sub cmdsave_Click()
If txtuserid.Text = "" Then
MsgBox "Please fill User ID!", , "System"
txtuserid.SetFocus
Bachelor of Science in Information TechnologyPage 8

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
ElseIf txtfirstname.Text = "" Then
MsgBox "Please fill First Name", , "System"
txtfirstname.SetFocus
ElseIf txtlastname.Text = "" Then
MsgBox "Please fill Last Name!", , "System"
txtlastname.SetFocus
ElseIf txtmi.Text = "" Then
MsgBox "Please fill Middle Initial!", , "System"
txtmi.SetFocus
ElseIf txtusertype.Text = "" Then
MsgBox "Please select User Type!", , "System"
txtusertype.SetFocus
ElseIf txtlogonpassword.Text = "" Then
MsgBox "Please fill Logon Password!", , "System"
txtlogonpassword.SetFocus
Else
If cmdsave.Caption = "&Save" Then
Connect
rs.Open "select * from tblusers where userid='" & txtuserid.Text & "'", con,
adOpenDynamic, adLockOptimistic
If rs.RecordCount = 1 Then
MsgBox "User ID already exist!", , "System"
txtuserid.Text = ""
txtuserid.SetFocus
Else
id = "1"
Set rs = New ADODB.Recordset
sql = "select * from tblstudent"
rs.Open sql, con, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
With rs
.MoveLast
id = Val(!id) + Val(1)
.Close
End With
End If
Connect
sql = "select * from tblusers"
Set rs = Nothing
rs.Open sql, con, adOpenDynamic, adLockOptimistic
With rs
.AddNew
adduser
Bachelor of Science in Information TechnologyPage 9

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
rs.Fields!entryby = mainform.StatusBar1.Panels(1).Text
rs.Fields!entrydate = Now
.Update
End With
MsgBox "User successfully saved!", vbInformation, "System"
Unload Me
usermaintenanceform.Show
End If
Else
con.Execute "update tblusers set" & vbCrLf & _
"firstname='" & txtfirstname.Text & "'," & vbCrLf & _
"lastname='" & txtlastname.Text & "'," & vbCrLf & _
"mi='" & txtmi.Text & "'," & vbCrLf & _
"extensionname='" & txtextensionname.Text & "'," & vbCrLf & _
"usertype='" & txtusertype.Text & "'," & vbCrLf & _
"longname='" & txtlongname.Text & "'," & vbCrLf & _
"password='" & txtlogonpassword.Text & "'," & vbCrLf & _
"updatedby='" & mainform.StatusBar1.Panels(1).Text & "'," & vbCrLf & _
"lastupdate='" & Now & "'" & vbCrLf & _
"where userid='" & txtuserid.Text & "'"
MsgBox "User successfully updated!", vbInformation, "System"
Unload Me
usermaintenanceform.Show
End If
End If
End Sub
Private Sub Form_Activate()
Call fillusertype
End Sub
Private Sub Form_Unload(Cancel As Integer)
usermaintenanceform.Show
End Sub

Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)


End Sub
Private Sub txtextensionname_Change()
txtlongname.Text = txtfirstname.Text & " " & txtmi.Text & " " & txtlastname.Text & " " &
txtextensionname.Text
End Sub
Private Sub txtextensionname_KeyPress(KeyAscii As Integer)
Bachelor of Science in Information TechnologyPage 10

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
Data = "JSrIV"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtfirstname_Change()
txtlongname.Text = txtfirstname.Text & " " & txtmi.Text & " " & txtlastname.Text & " " &
txtextensionname.Text
End Sub
Private Sub txtfirstname_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub

Private Sub txtlastname_Change()


txtlongname.Text = txtfirstname.Text & " " & txtmi.Text & " " & txtlastname.Text & " " &
txtextensionname.Text
End Sub
Private Sub txtlastname_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub

Bachelor of Science in Information TechnologyPage 11

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
Private Sub txtlogonpassword_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM_1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtmi_Change()
txtlongname.Text = txtfirstname.Text & " " & txtmi.Text & " " & txtlastname.Text & " " &
txtextensionname.Text
End Sub
Private Sub txtmi_KeyPress(KeyAscii As Integer)
Data = "QWERTYUIOPASDFGHJKLXCVBNM"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtuserid_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnm1234567890-_"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
AddUpdateYearLevel
Public Sub addyearlevel()
rs.Fields!yearlevelid = id
Bachelor of Science in Information TechnologyPage 12

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
rs.Fields!yearlevel = txtyearlevel.Text
End Sub
Private Sub cmdsave_Click()
If txtyearlevel.Text = "" Then
MsgBox "Please fill Year Level!", , "System"
txtyearlevel.SetFocus
Else
If cmdsave.Caption = "&Save" Then
id = "1"
Set rs = New ADODB.Recordset
sql = "select * from tblyearlevel"
rs.Open sql, con, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
With rs
.MoveLast
id = Val(!yearlevelid) + Val(1)
.Close
End With
End If
Connect
rs.Open "select * from tblyearlevel where yearlevel='" & txtyearlevel.Text & "'", con,
adOpenDynamic, adLockOptimistic
If rs.RecordCount = 1 Then
MsgBox "Yearlevel already exist!", , "System"
txtyearlevel.Text = ""
txtyearlevel.SetFocus
Else
Connect
sql = "select * from tblyearlevel"
Set rs = Nothing
rs.Open sql, con, adOpenDynamic, adLockOptimistic
With rs
.AddNew
addyearlevel
.Update
End With
MsgBox "Year Level successfully saved!", vbInformation, "System"
Unload Me
yearlevelform.Show
End If
Else
con.Execute "update tblyearlevel set" & vbCrLf & _
Bachelor of Science in Information TechnologyPage 13

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
"yearlevel='" & txtyearlevel.Text & "'" & vbCrLf & _
"where yearlevelid='" & id & "'"
MsgBox "Year Level successfully updated!", vbInformation, "System"
Unload Me
yearlevelform.Show
End If
End If
End Sub

Private Sub Form_Unload(Cancel As Integer)


yearlevelform.Show
End Sub
Private Sub txtyearlevel_KeyPress(KeyAscii As Integer)
Data = "1234567890thstndraeYG "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
AssesmentForm

Private Sub getenrollees()


ListView1.ListItems.Clear
Connect
sql = "select * from tblstudent"
Set rs = New ADODB.Recordset
rs.Open sql, con, adOpenDynamic, adLockOptimistic
Do Until rs.EOF
With ListView1.ListItems.Add(, , rs!idnumber)
.SubItems(1) = rs!completename
.SubItems(2) = rs!yearlevel
.SubItems(3) = rs!dateenrolled
.SubItems(4) = rs!amountpaid
.SubItems(5) = rs!balance
End With
rs.MoveNext
Loop
Bachelor of Science in Information TechnologyPage 14

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
rs.Close: Set rs = Nothing
End Sub
Private Sub searchid()
ListView1.ListItems.Clear
Connect
sql = "select * from tblstudent where idnumber like '" & txtsearchid.Text & "%'"
Set rs = New ADODB.Recordset
rs.Open sql, con, adOpenDynamic, adLockOptimistic
Do Until rs.EOF
With ListView1.ListItems.Add(, , rs!idnumber)
.SubItems(1) = rs!completename
.SubItems(2) = rs!yearlevel
.SubItems(3) = rs!dateenrolled
.SubItems(4) = rs!amountpaid
.SubItems(5) = rs!balance
End With
rs.MoveNext
Loop
rs.Close: Set rs = Nothing
End Sub
Private Sub searchlastname()
ListView1.ListItems.Clear
Connect
sql = "select * from tblstudent where lastname like '" & txtsearchlastname.Text & "%'"
Set rs = New ADODB.Recordset
rs.Open sql, con, adOpenDynamic, adLockOptimistic
Do Until rs.EOF
With ListView1.ListItems.Add(, , rs!idnumber)
.SubItems(1) = rs!completename
.SubItems(2) = rs!yearlevel
.SubItems(3) = rs!dateenrolled
.SubItems(4) = rs!amountpaid
.SubItems(5) = rs!balance
End With
rs.MoveNext
Loop
rs.Close: Set rs = Nothing
End Sub
Private Sub searchyearlevel()
ListView1.ListItems.Clear
Connect
Bachelor of Science in Information TechnologyPage 15

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
sql = "select * from tblstudent where yearlevel like '" & txtsearchyearlevel.Text & "%'"
Set rs = New ADODB.Recordset
rs.Open sql, con, adOpenDynamic, adLockOptimistic
Do Until rs.EOF
With ListView1.ListItems.Add(, , rs!idnumber)
.SubItems(1) = rs!completename
.SubItems(2) = rs!yearlevel
.SubItems(3) = rs!dateenrolled
.SubItems(4) = rs!amountpaid
.SubItems(5) = rs!balance
End With
rs.MoveNext
Loop
rs.Close: Set rs = Nothing
End Sub
Private Sub Form_Load()
Call getenrollees
End Sub
Private Sub ListView1_DblClick()
Call cmdview_Click
End Sub
Private Sub txtsearchid_Change()
Call searchid
End Sub
Private Sub txtsearchlastname_Change()
Call searchlastname
End Sub
Private Sub txtsearchyearlevel_Change()
Call searchyearlevel
End Sub
EnrolleeMasterListForm

Private Sub getenrollees()


ListView1.ListItems.Clear
Connect
sql = "select * from tblstudent"
Set rs = New ADODB.Recordset
rs.Open sql, con, adOpenDynamic, adLockOptimistic
Bachelor of Science in Information TechnologyPage 16

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY

Do Until rs.EOF
With ListView1.ListItems.Add(, , rs!idnumber)
.SubItems(1) = rs!completename
.SubItems(2) = rs!yearlevel
.SubItems(3) = rs!dateenrolled
.SubItems(4) = rs!amountpaid
.SubItems(5) = rs!balance
End With
rs.MoveNext
Loop
rs.Close: Set rs = Nothing
End Sub
Private Sub searchid()
ListView1.ListItems.Clear
Connect
sql = "select * from tblstudent where idnumber like '" & txtsearchid.Text & "%'"
Set rs = New ADODB.Recordset
rs.Open sql, con, adOpenDynamic, adLockOptimistic
Do Until rs.EOF
With ListView1.ListItems.Add(, , rs!idnumber)
.SubItems(1) = rs!completename
.SubItems(2) = rs!yearlevel
.SubItems(3) = rs!dateenrolled
.SubItems(4) = rs!amountpaid
.SubItems(5) = rs!balance
End With
rs.MoveNext
Loop
rs.Close: Set rs = Nothing
End Sub
Private Sub searchlastname()
ListView1.ListItems.Clear
Connect
sql = "select * from tblstudent where lastname like '" & txtsearchlastname.Text & "%'"
Set rs = New ADODB.Recordset
rs.Open sql, con, adOpenDynamic, adLockOptimistic
Do Until rs.EOF
With ListView1.ListItems.Add(, , rs!idnumber)
.SubItems(1) = rs!completename
.SubItems(2) = rs!yearlevel
.SubItems(3) = rs!dateenrolled
Bachelor of Science in Information TechnologyPage 17

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
.SubItems(4) = rs!amountpaid
.SubItems(5) = rs!balance
End With
rs.MoveNext
Loop
rs.Close: Set rs = Nothing
End Sub
Private Sub searchyearlevel()
ListView1.ListItems.Clear
Connect
sql = "select * from tblstudent where yearlevel like '" & txtsearchyearlevel.Text & "%'"
Set rs = New ADODB.Recordset
rs.Open sql, con, adOpenDynamic, adLockOptimistic
Do Until rs.EOF
With ListView1.ListItems.Add(, , rs!idnumber)
.SubItems(1) = rs!completename
.SubItems(2) = rs!yearlevel
.SubItems(3) = rs!dateenrolled
.SubItems(4) = rs!amountpaid
.SubItems(5) = rs!balance
End With
rs.MoveNext
Loop
rs.Close: Set rs = Nothing
End Sub
Private Sub editenrollee()
On Error Resume Next
Connect
Set rs = New ADODB.Recordset
rs.Open "select * from tblstudent where idnumber='" & ListView1.SelectedItem.Text &
"'", con, adOpenDynamic, adLockOptimistic
With updateenrolleeform
.Caption = "Edit Enrollee - " & rs.Fields!idnumber
.txtidnumber.Text = rs.Fields!idnumber
.txtamountpaid.Text = rs.Fields!amountpaid
.txtbalance.Text = rs.Fields!balance
.txtbarangay.Text = rs.Fields!barangay
.txtdateofbirth.Value = rs.Fields!dateofbirth
.txtemailaddress.Text = rs.Fields!emailaddress
.txtextensionname.Text = rs.Fields!extensionname
.txtfirstname.Text = rs.Fields!firstname
.txtgender.Text = rs.Fields!gender
Bachelor of Science in Information TechnologyPage 18

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
.txtguardiansname.Text = rs.Fields!guardiansname
.txtguardiansnumber.Text = rs.Fields!guardiansnumber
.txthousenumber.Text = rs.Fields!housenumber
.txtidnumber.Text = rs.Fields!idnumber
.txtlastname.Text = rs.Fields!lastname
.txtmiddlename.Text = rs.Fields!middlename
.txtmobilenumber.Text = rs.Fields!mobilenumber
.txtprovince.Text = rs.Fields!province
.txtrelationship.Text = rs.Fields!relationship
.txtstreet.Text = rs.Fields!street
.txttotalfees.Text = rs.Fields!totalfees
.txttowncity.Text = rs.Fields!towncity
.txtyearlevel.Text = rs.Fields!yearlevel
End With
rs.Close
End Sub
Private Sub cmdadd_Click()
updateenrolleeform.Show
Unload Me
End Sub
Private Sub cmddelete_Click()
If vbYes = MsgBox("Are you sure you want to delete " &
ListView1.SelectedItem.SubItems(1) & "?", vbQuestion + vbYesNo, "System") Then
con.Execute "delete from tblstudent where idnumber='" & ListView1.SelectedItem.Text
& "'"
MsgBox "" & ListView1.SelectedItem.SubItems(1) & " successfully deleted!",
vbInformation, "System"
ListView1.ListItems.Clear
Call getenrollees
Else
ListView1.ListItems.Clear
Call getenrollees
End If
End Sub
Private Sub cmdedit_Click()
Call editenrollee
Unload Me
End Sub
Private Sub Form_Load()
Call getenrollees
End Sub
Bachelor of Science in Information TechnologyPage 19

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY

Private Sub ListView1_DblClick()


Call editenrollee
Unload Me
End Sub
Private Sub txtsearchid_Change()
Call searchid
End Sub
Private Sub txtsearchlastname_Change()
Call searchlastname
End Sub
Private Sub txtsearchyearlevel_Change()
Call searchyearlevel
End Sub
EnrolleeMasterListReportForm
Public Sub getall()
Connect
Set rs = Nothing
rs.Open "select * from tblstudent", con, adOpenDynamic, adLockOptimistic
Set allenrolleemasterlist.DataSource = rs
allenrolleemasterlist.Show
End Sub
Public Sub getyearlevel()
Connect
Set rs = Nothing
rs.Open "select * from tblstudent where yearlevel='" & txtlist.Text & "'", con,
adOpenDynamic, adLockOptimistic
Set yearlevelenrolleemasterlist.DataSource = rs
yearlevelenrolleemasterlist.Show
End Sub
Public Sub fillyearlevel()
txtlist.Clear
Set rs = Nothing
rs.Open "select * from tblyearlevel", con, adOpenDynamic, adLockOptimistic
Do While Not rs.EOF
txtlist.AddItem rs.Fields!yearlevel
rs.MoveNext
Loop
Bachelor of Science in Information TechnologyPage 20

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
rs.Close
End Sub
Private Sub cmdview_Click()
If Option1.Value = True Then getall
If Option2.Value = True Then getyearlevel
End Sub
Private Sub Form_Load()
End Sub
Private Sub Option1_Click()
txtlist.Clear
txtlist.Enabled = False
End Sub
Private Sub Option2_Click()
txtlist.Enabled = True
Call fillyearlevel
End Sub
EnrollmentForm
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Send_SMS(Cell_no As String, SMS_msg As String)
' Send an 'AT' command to the phone
message1.Text = "Sending SMS..."
DoEvents
MSComm1.Output = "AT" & vbCrLf
Sleep 10
MSComm1.Output = "AT+CMGS=1" & vbCrLf
'This line can be
removed if your modem will always be in Text Mode...
Sleep10
MSComm1.Output = "AT+CMGS=" &Chr(17) & txtguardiansnumber.Text & Chr(17)
& vbCrLf 'store cell no. to modem....."
Sleep 10
MSComm1.Output = SMS_msg & Chr(13)
message1.Text = "Message Sent"
DoEvents

Bachelor of Science in Information TechnologyPage 21

'messages

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
Sleep 200 'wait for 200 milliseconds...
message1.Text = " Ready to recieve SMS..."
DoEvents
End Sub
Private Sub mesagesent()
message = From: La Salette of Cabatuan, + completename + is now enrolled, he/she
gave an initial payment of + txtamountpaid.Text + pesos and the remaining balance is +
txtbalance.Text + pesos, Thank You.
' Send an 'AT' command to the phone
MSComm1.Output = "AT" & vbCrLf
Sleep 10
MSComm1.Output = "AT+CMGS=1" & vbCrLf
'This line can be removed
if your modem will always be in Text Mode...
Sleep 10
MSComm1.Output = "AT+CMGS=" &Chr(17) & txtguardiansnumber.Text & Chr(17) &
vbCrLf 'Replace this with your mobile Phone's No.
Sleep 10
MSComm1.Output = message & Chr(13)
Sleep 20
MsgBox "Message Send"
End Sub
Private Sub getenrollee1()
On Error Resume Next
Connect
Set rs = New ADODB.Recordset
rs.Open "select * from tblstudent where idnumber='" & txtidnumber.Text & "'", con,
adOpenDynamic, adLockOptimistic
If rs.RecordCount = 0 Then
MsgBox "No record found!", , "System"
Else
txtidnumber.Text = rs.Fields!idnumber
txtyearlevel.Text = rs.Fields!yearlevel
txtcompletename.Text = rs.Fields!completename
txtguardiansnumber.Text = rs.Fields!guardiansnumber
End If
rs.Close
End Sub
Private Sub searchenrollees()
ListView1.ListItems.clear
Connect
Bachelor of Science in Information TechnologyPage 22

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
sql = "select * from tblstudent where balance=0 and idnumber like '%" &
txtidnumber.Text & "%'"
Set rs = New ADODB.Recordset
rs.Open sql, con, adOpenDynamic, adLockOptimistic
Do Until rs.EOF
With ListView1.ListItems.Add(, , rs!idnumber)
.SubItems(1) = rs!completename
.SubItems(2) = rs!yearlevel
.SubItems(3) = rs!amountpaid
.SubItems(4) = rs!balance
End With
rs.MoveNext
Loop
rs.Close
End Sub
Private Sub getenrollee()
On Error Resume Next
Connect
Set rs = New ADODB.Recordset
rs.Open "select * from tblstudent where idnumber='" & ListView1.SelectedItem.Text &
"'", con, adOpenDynamic, adLockOptimistic
txtidnumber.Text = rs.Fields!idnumber
txtyearlevel.Text = rs.Fields!yearlevel
txtcompletename.Text = rs.Fields!completename
txtguardiansnumber.Text = rs.Fields!guardiansnumber
rs.Close
End Sub
Private Sub getenrollees()
ListView1.ListItems.clear
Connect
sql = "select * from tblstudent where amountpaid=0"
Set rs = New ADODB.Recordset
rs.Open sql, con, adOpenDynamic, adLockOptimistic
Do Until rs.EOF
With ListView1.ListItems.Add(, , rs!idnumber)
.SubItems(1) = rs!completename
.SubItems(2) = rs!yearlevel
.SubItems(3) = rs!amountpaid
.SubItems(4) = rs!balance
End With
rs.MoveNext
Loop
Bachelor of Science in Information TechnologyPage 23

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
rs.Close
End Sub
Public Sub printreceipt()
Connect
Set rs = New ADODB.Recordset
rs.Open "select * from tblpaymenthistory join tblpaymentbreakdown where
officialreceiptnumber='" & txtofficialreceiptnumber.Text & "'", con, adOpenDynamic,
adLockOptimistic
Set officialreceipt.DataSource = rs
officialreceipt.Show 1, mainform
End Sub
Public Sub clear()
txtidnumber.Text = ""
'txtlastname.Text = ""
'txtfirstname.Text = ""
'txtmiddlename.Text = ""
'txtextensionname.Text = ""
txtyearlevel.Text = ""
'txtmobilenumber.Text = ""
'txtemailaddress.Text = ""
'txtgender.Text = ""
'txtdateofbirth.Value = Format(Now, "mm/dd/yyyy")
txtamountpaid.Text = ""
'txthousenumber.Text = ""
'txtstreet.Text = ""
'txtbarangay.Text = ""
'txttowncity.Text = ""
'txtprovince.Text = ""
'txtguardiansname.Text = ""
'txtrelationship.Text = ""
txtguardiansnumber.Text = ""
txtbalance.Text = txttotalfees.Text
Call officialreceiptnumber
End Sub

Public Sub getpaymentbreakdown()


Connect
Set rs = New ADODB.Recordset
rs.Open "select * from tblpaymentbreakdown", con, adOpenDynamic, adLockOptimistic
If rs.RecordCount = 0 Then
MsgBox "No payment record found!", vbInformation, "System"
Bachelor of Science in Information TechnologyPage 24

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
Else
txttuitionfee.Text = rs.Fields!tuitionfee
txtmiscellaneousfee.Text = rs.Fields!miscellaneousfee
txtcomputerfee.Text = rs.Fields!computerfee
txttestpaperfee.Text = rs.Fields!testpaperfee
txtstudentidfee.Text = rs.Fields!studentidfee
txthandbookfee.Text = rs.Fields!handbookfee
txtcertificationfee.Text = rs.Fields!certificationfee
txtrecollectionfee.Text = rs.Fields!recollectionfee
txtothers.Text = rs.Fields!others
txttotalfees.Text = rs.Fields!totalfees
txtbalance.Text = rs.Fields!totalfees
End If
rs.Close
End Sub
Public Sub officialreceiptnumber()
ornumber = "1000000001"
Set rs = Nothing
sql = "select officialreceiptnumber from tblpaymenthistory"
rs.Open sql, con, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
With rs
.MoveLast
ornumber = Val(!officialreceiptnumber) + Val(1)
.Close
End With
End If
txtofficialreceiptnumber.Text = ornumber
End Sub
Public Sub addpaymenthistory()
rs.Fields!officialreceiptnumber = ornumber
rs.Fields!paymentdate = Format(Now, "mm/dd/yyyy")
rs.Fields!studentid = txtidnumber.Text
rs.Fields!completename = completename
rs.Fields!yearlevel = txtyearlevel.Text
rs.Fields!totalfees = txttotalfees.Text
rs.Fields!previousbalance = "0"
rs.Fields!previouspayment = "0"
rs.Fields!amountpaid = txtamountpaid.Text
Bachelor of Science in Information TechnologyPage 25

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
rs.Fields!remainingbalance = txtbalance.Text
rs.Fields!entryby = mainform.StatusBar1.Panels(1).Text
rs.Fields!entrydate = Now
End Sub
Private Sub cmdenroll_Click()
If txtidnumber.Text = "" Then
MsgBox "Please fill ID Number!", , "System"
txtidnumber.SetFocus
ElseIf txtamountpaid.Text = "" Then
MsgBox "Please enter amount paid!", , "System"
txtamountpaid.SetFocus
ElseIf Val(txtbalance.Text) < 0 Then
MsgBox "Amount paid must not be greater than total fees!", , "System"
txtamountpaid.SetFocus
Else
Connect
Set rs = Nothing
rs.Open "select * from tblstudent where idnumber='" & txtidnumber.Text & "' and
amountpaid=0", con, adOpenDynamic, adLockOptimistic
If rs.RecordCount = 0 Then
MsgBox "ID number not found!", , "System"
txtidnumber.Text = ""
txtidnumber.SetFocus
Else
Call officialreceiptnumber
Connect
Set rs = Nothing
rs.Open "select * from tblpaymenthistory", con, adOpenDynamic, adLockOptimistic
With rs
.AddNew
addpaymenthistory
rs.Fields!entryby = mainform.StatusBar1.Panels(1).Text
rs.Fields!entrydate = Now
.Update
End With
rs.Close
con.Execute "update tblstudent set" & vbCrLf & _
"amountpaid='" & txtamountpaid.Text & "'," & vbCrLf & _
"balance='" & Val(txttotalfees.Text) - Val(txtamountpaid.Text) & "'" & vbCrLf
&_
"where idnumber='" & txtidnumber.Text & "'"
Connect
Set rs = Nothing
Bachelor of Science in Information TechnologyPage 26

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
rs.Open "select * from tblstudent where idnumber='" & txtidnumber.Text & "'", con,
adOpenDynamic, adLockOptimistic
txtguardiansnumber.Text = rs.Fields!guardiansnumber
Call Send_SMS(txtguardiansnumber.Text, "From:LSC, " + completename + " is now
enrolled and paid " + txtamountpaid.Text + ". Remaining balance is " + txtbalance.Text +
", Thank You.")
MsgBox "Student successfully enrolled!", vbInformation, "System"
Call printreceipt
Call clear
Call getenrollees
End If
End If
End Sub
Private Sub Form_Activate()
Connect
Call officialreceiptnumber
Call getpaymentbreakdown
Call getenrollees
End Sub
Private Sub Form_Load()
On Error GoTo err
With MSComm1
.CommPort = 8
.Settings = "6900,N,8,1"
.Handshaking = comRTS
.RTSEnable = True
.DTREnable = True
.RThreshold = 45
.SThreshold = 45
.InputMode = comInputModeText
.InputLen = 50
.PortOpen = True 'must be the last
End With
err: MsgBox err.Description
End Sub
Private Sub ListView1_Click()
Call getenrollee
End Sub
Private Sub MSComm1_OnComm()
Me.List1.AddItem MSComm1.Input
End Sub

Bachelor of Science in Information TechnologyPage 27

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
Private Sub txtamountpaid_Change()
txtbalance.Text = Val(txttotalfees.Text) - Val(txtamountpaid.Text)
End Sub
Private Sub txtamountpaid_KeyPress(KeyAscii As Integer)
Data = "1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtbarangay_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtemailaddress_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM-_!@#$
%^&*()+=[]{}<>./?1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtextensionname_KeyPress(KeyAscii As Integer)
Data = "JSrIV"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
Bachelor of Science in Information TechnologyPage 28

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtfirstname_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtguardiansname_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtguardiansnumber_KeyPress(KeyAscii As Integer)
Data = "1234567890+"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txthousenumber_KeyPress(KeyAscii As Integer)
Data = "2345678901"
If KeyAscii < 26 Then
Bachelor of Science in Information TechnologyPage 29

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtidnumber_Change()
Call searchenrollees
End Sub
Private Sub txtidnumber_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call getenrollee1
Data = "1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtlastname_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtmiddlename_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
Bachelor of Science in Information TechnologyPage 30

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
End If
End If
End Sub
Private Sub txtmobilenumber_KeyPress(KeyAscii As Integer)
Data = "1234567890+"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtprovince_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtrelationship_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtstreet_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
Bachelor of Science in Information TechnologyPage 31

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txttowncity_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
MessagesForm
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim buffer$
Dim SMS_Location As String
Dim temp_cell_no, temp_date, temp_time, temp_msg As String
Dim enable_send As Boolean
Public Sub savemessage()
Connect
Set rs = New ADODB.Recordset
rs.Open "select * from tbldraftmessages", con, adOpenDynamic, adLockOptimistic
With rs
.AddNew
.Fields!messageid = id
.Fields!message = txtdraftmessage.Text
.Update
End With
rs.Close
End Sub
Public Sub getmessage()
Connect
Set rs = New ADODB.Recordset
rs.Open "select message, substring(message,1,3) from tbldraftmessages", con,
adOpenDynamic, adLockOptimistic
txtmessage.Text = UCase(rs.MoveLast)
Bachelor of Science in Information TechnologyPage 32

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY

Connect
Set rs = New ADODB.Recordset
rs.Open "select message, substring(message,4,7) from tbldraftmessages", con,
adOpenDynamic, adLockOptimistic
txtidnumber.Text = UCase(rs.MoveLast)
Connect
Set rs = New ADODB.Recordset
rs.Open "select * from tblstudent where idnumber='" & txtidnumber.Text & "'", con,
adOpenDynamic, adLockOptimistic
txtcompletename.Text = rs.Fields!completename
txtmobilenumber.Text = rs.Fields!guardiansnumber
txtbalance.Text = rs.Fields!balance
End Sub
Public Sub closeport()
Timer1.Enabled = False 'incoming SMS disable...
'--- make sure the port is close before terminating the program
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
End If
Unload Me
End
End Sub
'----- Read SMS at designated location ----------------------------Public Sub readsms()
'-------- Set SMS format to Text ---------MSComm1.Output = "AT+CMGF=1" + Chr(13)
Do
buffer$ = MSComm1.Input
Loop Until InStr(buffer$, "OK")
Text2.Text = buffer$
buffer$ = ""
'----- Read SMS at designated location ----------------------------MSComm1.Output = "AT+CMGR=" + SMS_Location + Chr(13)
Do
DoEvents
buffer$ = buffer$ & MSComm1.Input
Loop Until InStr(buffer$, "OK")
Text3.Text = buffer$
End Sub
Bachelor of Science in Information TechnologyPage 33

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY

'------- Delete SMS -----------------------------Public Sub deletesms() 'delete location#1...


Timer1.Enabled = False 'incoming SMS disable...
MSComm1.Output = "AT+CMGD=1" + Chr(13)
Do
buffer$ = MSComm1.Input
Loop Until InStr(buffer$, "OK")
Text2.Text = buffer$
Text4.Text = "Location #1 Deleted..."
DoEvents
Timer1.Enabled = True 'incoming SMS enable...
Sleep 200
Text4.Text = " Ready to recieve SMS..."
DoEvents
End Sub
'Public Sub sendsms() '----------------send sms------------------'Call Send_SMS(Text12.Text, "TESTING..." + ", Date: " + Str(Date) + ", Time: " +
Str(Time))
'End Sub
'----- enable time ---------------Public Sub enabletime()
enable_send = 1
End Sub
Public Sub clear() '-----------------Clear-----------------LName.Text = ""
FName.Text = ""
MName.Text = ""
Text15.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
DoEvents
End Sub
Private Sub Form_Load()
Timer1.Enabled = False 'incoming SMS disable...
With MSComm1

Bachelor of Science in Information TechnologyPage 34

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
.CommPort = 7 'com assignment....
.Settings = "9600,N,8,1"
.Handshaking = comRTS 'comNone
.RTSEnable = True
.DTREnable = True
.RThreshold = 1
.SThreshold = 1
.InputMode = comInputModeText
.InputLen = 0
.PortOpen = True 'must be the last
End With
Text4.Text = "Connected"
DoEvents
Sleep 500 'wait for 500 milliseconds...
'Set interation of comunication
Text4.Text = "Start Setting"
DoEvents
'--------- AT Commands to initialized broad -----------MSComm1.Output = "AT+CNMI=2,1,2,0,0" + Chr(13)
Call Reply_OK
'-------------------------------------------------------MSComm1.Output = "AT+CPMS=""ME"",""SM"",""ME""" + Chr(13)
Call Reply_OK
'---------- Set SMS format to Text --------------------MSComm1.Output = "AT+CMGF=1" + Chr(13) 'set text mode...
Call Reply_OK
Text4.Text = "End Setting"
DoEvents
Sleep 200
Text4.Text = "Ready to recieve SMS..."
DoEvents
Timer1.Enabled = True 'incoming SMS enable...
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call closeport
End Sub
Private Sub Timer1_Timer()
Bachelor of Science in Information TechnologyPage 35

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
'If enable_send Then
'
Text13.Text = Str(Date) + " - " + Str(Time)
' DoEvents
' If Text10.Text = Str(Date) And Text11.Text = Str(Time) Then
' Call Command4_Click
' End If
' End If
buffer$ = MSComm1.Input
'---------- Wait for incomming sms -----------If InStr(buffer$, "+CMTI: ""ME""") Then
Text2.Text = buffer$
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
DoEvents
'------ Get location of SMS -------------SMS_Location = Right(buffer$, 3)
buffer$ = ""
'-------- Set SMS format to Text ---------MSComm1.Output = "AT+CMGF=1" + Chr(13)
Do
buffer$ = MSComm1.Input
Loop Until InStr(buffer$, "OK")
Text2.Text = buffer$
buffer$ = ""
'----- Read SMS at designated location ----------------------------MSComm1.Output = "AT+CMGR=" + SMS_Location + Chr(13)
Do
DoEvents
buffer$ = buffer$ & MSComm1.Input
Loop Until InStr(buffer$, "OK")
Text3.Text = buffer$
'---- extract SMS Data Message ---------------'------- Get Cell no. -----------temp_cell_no = Left(buffer$, 36)
Text5.Text = Right(temp_cell_no, 13)
'-------- Get date ----------------temp_date = Left(buffer$, 48)
Bachelor of Science in Information TechnologyPage 36

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
Text6.Text = Right(temp_date, 8)
'-------- Get time ---------------temp_time = Left(buffer$, 57)
Text7.Text = Right(temp_time, 8)
'---------- Get SMS Message ----------------temp_msg = Right(buffer$, Len(buffer$) - 63)
Text8.Text = Left(temp_msg, Len(temp_msg) - 8)
DoEvents

Call Command3_Click 'delete location #1...


Call Execute_Command
End If
End Sub
Private Sub Execute_Command()
txtmessage.Text = UCase(txtmessage.Text)
If txtmessage.Text = "BAL" Then
'connect
'Set rs = New ADODB.Recordset
'rs.Open "select * from tblstudent where idnumber='" & txtidnumber.Text & "'", con,
adOpenDynamic, adLockOptimistic
'Call Send_SMS(Text5.Text, "Your Account Balance is " + Text15.Text + ", Date: " +
Str(Date) + ", Time: " + Str(Time))
Call Send_SMS(Text5.Text, "From La Salette of Cabatuan, The remaining balance of
" + FName.Text + " " + LName.Text + " is " + Text15.Text + " pesos. Thank You!!!")
Else
Call Send_SMS(Text5.Text, "Sorry, command does not match!!!")
End If
Text4.Text = "Message Sent..."
DoEvents
Sleep 200
Text4.Text = "Ready to recieve SMS..."
DoEvents
End Sub
Sub Reply_OK()
Do
Bachelor of Science in Information TechnologyPage 37

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
DoEvents
buffer$ = buffer$ & MSComm1.Input
Loop Until InStr(buffer$, "OK")
Text1.Text = Text1.Text & vbCr & buffer$
buffer$ = ""
Sleep (500)
End Sub
'-------------- Send SMS ----------------------------------------Private Sub Send_SMS(Cell_no As String, SMS_msg As String)
Text4.Text = "Sending SMS..."
DoEvents
Timer1.Enabled = False 'incoming SMS disable...
'--- Send an 'AT' command to the phone -----'AT+CMGS="09157722578" Chr(13)...
'AT+CMGS - ATcommand to send message...
'Chr(13) = Carriage return...
'Chr(26) = Control Z
MSComm1.Output = "AT+CMGS=" &Chr(34) & Cell_no & Chr(34) & vbCrLf 'store
cell no. to modem....."
Sleep 500
MSComm1.Output = SMS_msg & Chr(26)
'messages
Call Reply_OK
Text4.Text = "Message Sent"
DoEvents
Timer1.Enabled = True 'incoming SMS enable...
Sleep 200 'wait for 200 milliseconds...
Text4.Text = " Ready to recieve SMS..."
DoEvents
End Sub
PaymentBreakDownForm
Public Sub getpaymentbreakdown()
Connect
Set rs = New ADODB.Recordset
rs.Open "select * from tblpaymentbreakdown", con, adOpenDynamic, adLockOptimistic
If rs.RecordCount = 0 Then
MsgBox "No record found!", vbInformation, "System"
Bachelor of Science in Information TechnologyPage 38

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
cmdsave.Caption = "&Save"
Else
txttuitionfee.Text = rs.Fields!tuitionfee
txtmiscellaneousfee.Text = rs.Fields!miscellaneousfee
txtcomputerfee.Text = rs.Fields!computerfee
txttestpaperfee.Text = rs.Fields!testpaperfee
txtstudentidfee.Text = rs.Fields!studentidfee
txthandbookfee.Text = rs.Fields!handbookfee
txtcertificationfee.Text = rs.Fields!certificationfee
txtrecollectionfee.Text = rs.Fields!recollectionfee
txtothers.Text = rs.Fields!others
txttotalfees.Text = rs.Fields!totalfees
txtentryby.Text = rs.Fields!entryby
txtentrydate.Text = rs.Fields!entrydate
cmdsave.Caption = "&Update"
End If
rs.Close
End Sub
Private Sub addpaymentbreakdown()
rs.Fields!feeid = id
rs.Fields!tuitionfee = txttuitionfee.Text
rs.Fields!miscellaneousfee = txtmiscellaneousfee.Text
rs.Fields!computerfee = txtcomputerfee.Text
rs.Fields!testpaperfee = txttestpaperfee.Text
rs.Fields!studentidfee = txtstudentidfee.Text
rs.Fields!handbookfee = txthandbookfee.Text
rs.Fields!certificationfee = txtcertificationfee.Text
rs.Fields!recollectionfee = txtrecollectionfee.Text
rs.Fields!others = txtothers.Text
rs.Fields!totalfees = txttotalfees.Text
End Sub
Private Sub cmdsave_Click()
If txttuitionfee.Text = "" Then
txttuitionfee.Text = "0"
ElseIf txtmiscellaneousfee.Text = "" Then
txtmiscellaneousfee.Text = "0"
ElseIf txtcomputerfee.Text = "" Then
txtcomputerfee.Text = "0"
ElseIf txttestpaperfee.Text = "" Then
txttestpaperfee.Text = "0"
ElseIf txtstudentidfee.Text = "" Then
txtstudentidfee.Text = "0"
ElseIf txthandbookfee.Text = "" Then
txthandbookfee.Text = "0"
Bachelor of Science in Information TechnologyPage 39

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
ElseIf txtcertificationfee.Text = "" Then
txtcertificationfee.Text = "0"
ElseIf txtrecollectionfee.Text = "" Then
txtrecollectionfee.Text = "0"
ElseIf txtothers.Text = "" Then
txtothers.Text = "0"
Else
If cmdsave.Caption = "&Save" Then
Connect
Set rs = New ADODB.Recordset
sql = "select * from tblsystemnumber"
rs.Open sql, con, adOpenDynamic, adLockOptimistic
With rs
.AddNew
addpaymentbreakdown
rs.Fields!entryby = mainform.StatusBar1.Panels(1).Text
rs.Fields!entrydate = Now
.Update
End With
Unload Me
MsgBox "Payment Breakdown successfully saved!", vbInformation, "System"
paymentbreakdownform.Show
Else
con.Execute "update tblpaymentbreakdown set" & vbCrLf & _
"tuitionfee='" & txttuitionfee.Text & "'," & vbCrLf & _
"miscellaneousfee='" & txtmiscellaneousfee.Text & "'," & vbCrLf & _
"computerfee='" & txtcomputerfee.Text & "'," & vbCrLf & _
"testpaperfee='" & txttestpaperfee.Text & "'," & vbCrLf & _
"studentidfee='" & txtstudentidfee.Text & "'," & vbCrLf & _
"handbookfee='" & txthandbookfee.Text & "'," & vbCrLf & _
"certificationfee='" & txtcertificationfee.Text & "'," & vbCrLf & _
"recollectionfee='" & txtrecollectionfee.Text & "'," & vbCrLf & _
"others='" & txtothers.Text & "'," & vbCrLf & _
"totalfees='" & txttotalfees.Text & "'," & vbCrLf & _
"payments='" & Val(txttotalfees.Text) / 5 & "'," & vbCrLf & _
"entryby='" & mainform.StatusBar1.Panels(1).Text & "'," & vbCrLf & _
"entrydate='" & Now & "'" & vbCrLf & _
"where feeid='" & id & "'"
Unload Me
MsgBox "Paymet Breakdown successfully updated!", vbInformation, "System"
paymentbreakdownform.Show
End If
End If
End Sub
Private Sub Form_Activate()
Bachelor of Science in Information TechnologyPage 40

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
id = "1"
Call getpaymentbreakdown
End Sub
Private Sub txtcertificationfee_Change()
txttotalfees.Text = Val(txttuitionfee.Text) + Val(txtmiscellaneousfee.Text) +
Val(txtcomputerfee.Text) + Val(txttestpaperfee.Text) + Val(txtstudentidfee.Text) +
Val(txthandbookfee.Text) + Val(txtrecollectionfee.Text) + Val(txtcertificationfee.Text) +
Val(txtothers.Text)
End Sub
Private Sub txtcertificationfee_KeyPress(KeyAscii As Integer)
Data = "1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtcomputerfee_Change()
txttotalfees.Text = Val(txttuitionfee.Text) + Val(txtmiscellaneousfee.Text) +
Val(txtcomputerfee.Text) + Val(txttestpaperfee.Text) + Val(txtstudentidfee.Text) +
Val(txthandbookfee.Text) + Val(txtrecollectionfee.Text) + Val(txtcertificationfee.Text) +
Val(txtothers.Text)
End Sub
Private Sub txtcomputerfee_KeyPress(KeyAscii As Integer)
Data = "1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txthandbookfee_Change()
txttotalfees.Text = Val(txttuitionfee.Text) + Val(txtmiscellaneousfee.Text) +
Val(txtcomputerfee.Text) + Val(txttestpaperfee.Text) + Val(txtstudentidfee.Text) +
Val(txthandbookfee.Text) + Val(txtrecollectionfee.Text) + Val(txtcertificationfee.Text) +
Bachelor of Science in Information TechnologyPage 41

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
Val(txtothers.Text)
End Sub
Private Sub txthandbookfee_KeyPress(KeyAscii As Integer)
Data = "1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtmiscellaneousfee_Change()
txttotalfees.Text = Val(txttuitionfee.Text) + Val(txtmiscellaneousfee.Text) +
Val(txtcomputerfee.Text) + Val(txttestpaperfee.Text) + Val(txtstudentidfee.Text) +
Val(txthandbookfee.Text) + Val(txtrecollectionfee.Text) + Val(txtcertificationfee.Text) +
Val(txtothers.Text)
End Sub
Private Sub txtmiscellaneousfee_KeyPress(KeyAscii As Integer)
Data = "1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtothers_Change()
txttotalfees.Text = Val(txttuitionfee.Text) + Val(txtmiscellaneousfee.Text) +
Val(txtcomputerfee.Text) + Val(txttestpaperfee.Text) + Val(txtstudentidfee.Text) +
Val(txthandbookfee.Text) + Val(txtrecollectionfee.Text) + Val(txtcertificationfee.Text) +
Val(txtothers.Text)
End Sub
Private Sub txtothers_KeyPress(KeyAscii As Integer)
Data = "1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
Bachelor of Science in Information TechnologyPage 42

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtrecollectionfee_Change()
txttotalfees.Text = Val(txttuitionfee.Text) + Val(txtmiscellaneousfee.Text) +
Val(txtcomputerfee.Text) + Val(txttestpaperfee.Text) + Val(txtstudentidfee.Text) +
Val(txthandbookfee.Text) + Val(txtrecollectionfee.Text) + Val(txtcertificationfee.Text) +
Val(txtothers.Text)
End Sub
Private Sub txtrecollectionfee_KeyPress(KeyAscii As Integer)
Data = "1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtstudentidfee_Change()
txttotalfees.Text = Val(txttuitionfee.Text) + Val(txtmiscellaneousfee.Text) +
Val(txtcomputerfee.Text) + Val(txttestpaperfee.Text) + Val(txtstudentidfee.Text) +
Val(txthandbookfee.Text) + Val(txtrecollectionfee.Text) + Val(txtcertificationfee.Text) +
Val(txtothers.Text)
End Sub
Private Sub txtstudentidfee_KeyPress(KeyAscii As Integer)
Data = "1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txttestpaperfee_Change()
Bachelor of Science in Information TechnologyPage 43

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
txttotalfees.Text = Val(txttuitionfee.Text) + Val(txtmiscellaneousfee.Text) +
Val(txtcomputerfee.Text) + Val(txttestpaperfee.Text) + Val(txtstudentidfee.Text) +
Val(txthandbookfee.Text) + Val(txtrecollectionfee.Text) + Val(txtcertificationfee.Text) +
Val(txtothers.Text)
End Sub
Private Sub txttestpaperfee_KeyPress(KeyAscii As Integer)
Data = "1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txttuitionfee_Change()
txttotalfees.Text = Val(txttuitionfee.Text) + Val(txtmiscellaneousfee.Text) +
Val(txtcomputerfee.Text) + Val(txttestpaperfee.Text) + Val(txtstudentidfee.Text) +
Val(txthandbookfee.Text) + Val(txtrecollectionfee.Text) + Val(txtcertificationfee.Text) +
Val(txtothers.Text)
End Sub
Private Sub txttuitionfee_KeyPress(KeyAscii As Integer)
Data = "1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
PaymentForm
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Send_SMS(Cell_no As String, SMS_msg As String)
' Send an 'AT' command to the phone
message1.Text = "Sending SMS..."
DoEvents
Bachelor of Science in Information TechnologyPage 44

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
MSComm1.Output = "AT" & vbCrLf
Sleep 500
MSComm1.Output = "AT+CMGF=1" & vbCrLf
'This line can be
removed if your modem will always be in Text Mode...
Sleep 500
MSComm1.Output = "AT+CMGS=" &Chr(34) & txtguardiansnumber.Text & Chr(34)
& vbCrLf 'store cell no. to modem....."
Sleep 500
MSComm1.Output = SMS_msg & Chr(26)
message1.Text = "Message Sent"
DoEvents
Sleep 200 'wait for 200 milliseconds...
message1.Text = " Ready to recieve SMS..."
DoEvents
End Sub
Public Sub clear()
txtidnumber.Text = ""
txtcompletename.Text = ""
txtyearlevel.Text = ""
txtpreviouspayment.Text = ""
txtpreviousbalance.Text = ""
txtremainingbalance.Text = ""
txtamountpaid.Text = ""
Call officialreceiptnumber
End Sub
Private Sub getenrollees()
ListView1.ListItems.clear
Connect
sql = "select * from tblstudent where balance>0"
Set rs = New ADODB.Recordset
rs.Open sql, con, adOpenDynamic, adLockOptimistic
Do Until rs.EOF
With ListView1.ListItems.Add(, , rs!idnumber)
.SubItems(1) = rs!completename
.SubItems(2) = rs!yearlevel
.SubItems(3) = rs!amountpaid
.SubItems(4) = rs!balance
End With
rs.MoveNext
Bachelor of Science in Information TechnologyPage 45

'messages

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
Loop
rs.Close
End Sub
Public Sub printreceipt()
Connect
Set rs = New ADODB.Recordset
rs.Open "select * from tblpaymenthistory join tblpaymentbreakdown where
officialreceiptnumber='" & txtofficialreceiptnumber.Text & "'", con, adOpenDynamic,
adLockOptimistic
Set officialreceipt2.DataSource = rs
officialreceipt2.Show 1, mainform
End Sub
Private Sub searchenrollees()
ListView1.ListItems.clear
Connect
sql = "select * from tblstudent where balance>0 and idnumber like '%" &
txtidnumber.Text & "%'"
Set rs = New ADODB.Recordset
rs.Open sql, con, adOpenDynamic, adLockOptimistic
Do Until rs.EOF
With ListView1.ListItems.Add(, , rs!idnumber)
.SubItems(1) = rs!completename
.SubItems(2) = rs!yearlevel
.SubItems(3) = rs!amountpaid
.SubItems(4) = rs!balance
End With
rs.MoveNext
Loop
rs.Close
End Sub
Public Sub officialreceiptnumber()
ornumber = "0000000001"
Set rs = Nothing
sql = "select officialreceiptnumber from tblpaymenthistory"
rs.Open sql, con, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
With rs
.MoveLast
ornumber = Val(!officialreceiptnumber) + Val(1)
Bachelor of Science in Information TechnologyPage 46

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
.Close
End With
End If
txtofficialreceiptnumber.Text = ornumber
'rs.Close
End Sub
Private Sub getenrollee()
On Error Resume Next
Connect
Set rs = New ADODB.Recordset
rs.Open "select * from tblstudent where idnumber='" & ListView1.SelectedItem.Text &
"'", con, adOpenDynamic, adLockOptimistic
id = rs.Fields!idnumber
txtyearlevel.Text = rs.Fields!yearlevel
txtcompletename.Text = rs.Fields!completename
txtpreviouspayment.Text = rs.Fields!amountpaid
txtpreviousbalance.Text = rs.Fields!balance
txtremainingbalance.Text = rs.Fields!balance
txttotalfee.Text = rs.Fields!totalfees
txtguardiansnumber.Text = rs.Fields!guardiansnumber
rs.Close
End Sub
Public Sub addpaymenthistory()
rs.Fields!officialreceiptnumber = txtofficialreceiptnumber.Text
rs.Fields!paymentdate = Format(Now, "mm/dd/yyyy")
rs.Fields!studentid = ListView1.SelectedItem.Text
rs.Fields!completename = txtcompletename.Text
rs.Fields!yearlevel = txtyearlevel.Text
rs.Fields!totalfees = txttotalfee.Text
rs.Fields!previousbalance = txtpreviousbalance.Text
rs.Fields!previouspayment = txtamountpaid.Text
rs.Fields!amountpaid = Val(txtpreviouspayment.Text) + Val(txtamountpaid.Text)
'rs.Fields!currentpayment = txtamountpaid.Text
rs.Fields!remainingbalance = txtremainingbalance.Text
rs.Fields!entryby = mainform.StatusBar1.Panels(1).Text
rs.Fields!entrydate = Now
End Sub
Private Sub cmdsave_Click()
On Error GoTo err
If txtcompletename.Text = "" Then
MsgBox "Please Select student!", , "System"
Bachelor of Science in Information TechnologyPage 47

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
ElseIf Val(txtremainingbalance.Text) < 0 Then
MsgBox "Payment must not be greater than remaining balance!", , "System"
txtamountpaid.SetFocus
Else
completename = txtcompletename.Text
con.Execute "update tblstudent set" & vbCrLf & _
"amountpaid='" & txtamountpaid.Text & "'," & vbCrLf & _
"balance='" & txtremainingbalance.Text & "'" & vbCrLf & _
"where idnumber='" & id & "'"
'amountpaid = Val(txtpreviouspayment.Text) + Val(txtamountpaid.Text)
Connect
Set rs = Nothing
rs.Open "select * from tblpaymenthistory", con, adOpenDynamic, adLockOptimistic
With rs
.AddNew
addpaymenthistory
.Update
End With
rs.Close
Call Send_SMS(txtguardiansnumber.Text, "From: La Salette of Cabatuan, " +
completename + " has paid " + txtamountpaid.Text + " pesos and the remaining balance is
" + txtremainingbalance.Text + " pesos, Thank You.")
MsgBox "Payment successfully saved!", vbInformation, "System"
err: MsgBox err.Description
Call printreceipt
Unload Me
End If
End Sub
Private Sub Form_Activate()
Call getenrollees
Call officialreceiptnumber
End Sub
Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)
End Sub
Private Sub ListView1_Click()
Call getenrollee
End Sub
Private Sub txtamountpaid_Change()
Bachelor of Science in Information TechnologyPage 48

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
txtremainingbalance.Text = Val(txtpreviousbalance.Text) - Val(txtamountpaid.Text)
End Sub
Private Sub txtamountpaid_KeyPress(KeyAscii As Integer)
Data = "1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
Exit Sub
End If
End Sub

Private Sub Form_Load()


On Error GoTo err
With MSComm1
.CommPort = 8
.Settings = "9600,N,8,1"
.Handshaking = comRTS
.RTSEnable = True
.DTREnable = True
.RThreshold = 1
.SThreshold = 1
.InputMode = comInputModeText
.InputLen = 0
.PortOpen = True 'must be the last
End With
err: MsgBox err.Description
End Sub
Private Sub MSComm1_OnComm()
Me.List1.AddItem MSComm1.Input
End Sub
Private Sub txtidnumber_Change()
Call searchenrollees
End Sub
Private Sub txtidnumber_KeyPress(KeyAscii As Integer)
Data = "1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
Bachelor of Science in Information TechnologyPage 49

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
PaymentInformationReportForm
Public Sub getall()
Connect
Set rs = Nothing
rs.Open "select * from tblpaymenthistory", con, adOpenDynamic, adLockOptimistic
Set allpaymentinformation.DataSource = rs
allpaymentinformation.Show
End Sub
Public Sub getyearlevel()
Connect
Set rs = Nothing
rs.Open "select * from tblpaymenthistory where yearlevel='" & txtlist.Text & "'", con,
adOpenDynamic, adLockOptimistic
Set yearlevelpaymentinformation.DataSource = rs
yearlevelpaymentinformation.Show
End Sub
Public Sub getstudent()
Connect
Set rs = Nothing
rs.Open "select * from tblpaymenthistory where studentid='" & txtlist.Text & "'", con,
adOpenDynamic, adLockOptimistic
Set studentpaymentinformation.DataSource = rs
studentpaymentinformation.Show
End Sub
Public Sub fillyearlevel()
txtlist.Clear
Set rs = Nothing
rs.Open "select * from tblyearlevel", con, adOpenDynamic, adLockOptimistic
Do While Not rs.EOF
txtlist.AddItem rs.Fields!yearlevel
rs.MoveNext
Loop
rs.Close
End Sub
Bachelor of Science in Information TechnologyPage 50

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY

Public Sub fillstudent()


txtlist.Clear
Set rs = Nothing
rs.Open "select * from tblstudent", con, adOpenDynamic, adLockOptimistic
Do While Not rs.EOF
txtlist.AddItem rs.Fields!idnumber
rs.MoveNext
Loop
rs.Close
End Sub
Private Sub cmdview_Click()
If Option1.Value = True Then getall
If Option2.Value = True Then getyearlevel
If Option3.Value = True Then getstudent
End Sub
Private Sub Form_Load()
End Sub
Private Sub Option1_Click()
txtlist.Clear
txtlist.Enabled = False
End Sub
Private Sub Option2_Click()
txtlist.Enabled = True
Call fillyearlevel
End Sub
Private Sub Option3_Click()
txtlist.Enabled = True
Call fillstudent
End Sub
RemindersForm
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Send_SMS(Cell_no As Integer, SMS_msg As Integer)
' Send an 'AT' command to the phone

Bachelor of Science in Information TechnologyPage 51

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
message1.Text = "Sending SMS..."
DoEvents
MSComm1.Output = "AT" & vbCrLf
Sleep 500
MSComm1.Output = "AT+CMGF=1" & vbCrLf
'This line can be
removed if your modem will always be in Text Mode...
Sleep 500
MSComm1.Output = "AT+CMGS=" &Chr(34) & txtguardiansnumber.Text & Chr(34)
& vbCrLf 'store cell no. to modem....."
Sleep 500
MSComm1.Output = SMS_msg & Chr(26)

'messages

message1.Text = "Message Sent"


DoEvents
Sleep 200 'wait for 200 milliseconds...
message1.Text = " Ready to recieve SMS..."
DoEvents
End Sub
Private Sub mesagesent()
message = txtmessage.Text
' Send an 'AT' command to the phone
MSComm1.Output = "AT" & vbCrLf
Sleep 500
MSComm1.Output = "AT+CMGF=1" & vbCrLf
'This line can be removed
if your modem will always be in Text Mode...
Sleep 500
MSComm1.Output = "AT+CMGS=" &Chr(34) & txtguardiansnumber.Text & Chr(34) &
vbCrLf 'Replace this with your mobile Phone's No.
Sleep 1000
MSComm1.Output = message & Chr(26)
Sleep 2000
MsgBox "Message Send"
End Sub
Private Sub cmdsend_Click()
If txtmessage.Text = "" Then
MsgBox "Please enter message!", , "System"
Else
Do While Not rs.EOF
txtguardiansnumber.Text = rs.Fields!guardiansnumber
Bachelor of Science in Information TechnologyPage 52

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
Call Send_SMS(txtguardiansnumber.Text, txtmessage.Text)
rs.MoveNext
Loop
If rs.EOF = True Then
rs.MoveFirst
txtguardiansnumber.Text = rs.Fields!guardiansnumber
MsgBox "All messages has been sent!", , "System"
Exit Sub
End If
End If
End Sub
Private Sub Form_Activate()
Connect
Set rs = Nothing
rs.Open "select distinct guardiansnumber from tblstudent", con, adOpenDynamic,
adLockOptimistic
rs.MoveFirst
txtguardiansnumber.Text = rs.Fields!guardiansnumber '& "; " & txtguardiansnumber.Text
End Sub
Private Sub Form_Load()
On Error GoTo err
'Timer1.Enabled = False
With MSComm1
.CommPort = 8
.Settings = "9600,N,8,1"
.Handshaking = comRTS
.RTSEnable = True
.DTREnable = True
.RThreshold = 1
.SThreshold = 1
.InputMode = comInputModeText
.InputLen = 0
.PortOpen = True 'must be the last
End With
err: MsgBox err.Description
End Sub
Private Sub MSComm1_OnComm()
Me.List1.AddItem MSComm1.Input
End Sub
'Private Sub Timer1_Timer()
Bachelor of Science in Information TechnologyPage 53

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
'Do While Not rs.EOF
' Call Send_SMS(txtlist.Text, txtmessage.Text)
' rs.MoveNext
'Loop
'End Sub
Private Sub Timer1_Timer()
End Sub
SplashForm

Private Sub Form_Load()


End Sub
Private Sub Timer1_Timer()
Dim i As Integer
Static j As Integer
If j < 100 Then
j=j+5
Else
j=0
End If
For i = 0 To 4
ProgressBar1.Value = j
Next
If ProgressBar1.Value = 100 Then
Unload Me
mainform.Show
End If
End Sub
StudentInfromationForm

Public Sub clear()


txtidnumber.Text = ""
txtlastname.Text = ""
txtfirstname.Text = ""
Bachelor of Science in Information TechnologyPage 54

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
txtmiddlename.Text = ""
txtextensionname.Text = ""
txtyearlevel.Text = ""
txtmobilenumber.Text = ""
txtemailaddress.Text = ""
txtgender.Text = ""
txtdateofbirth.Value = Format(Now, "mm/dd/yyyy")
txthousenumber.Text = ""
txtstreet.Text = ""
txtbarangay.Text = ""
txttowncity.Text = ""
txtprovince.Text = ""
txtguardiansname.Text = ""
txtrelationship.Text = ""
txtguardiansnumber.Text = ""
End Sub
Public Sub fillyearlevel()
txtyearlevel.clear
Set rs = Nothing
rs.Open "select * from tblyearlevel", con, adOpenDynamic, adLockOptimistic
Do While Not rs.EOF
txtyearlevel.AddItem rs.Fields!yearlevel
rs.MoveNext
Loop
End Sub
Public Sub addstudent()
rs.Fields!id = id
rs.Fields!idnumber = txtidnumber.Text
rs.Fields!lastname = txtlastname.Text
rs.Fields!firstname = txtfirstname.Text
rs.Fields!middlename = txtmiddlename.Text
rs.Fields!extensionname = txtextensionname.Text
rs.Fields!completename = completename
rs.Fields!yearlevel = txtyearlevel.Text
rs.Fields!mobilenumber = txtmobilenumber.Text
rs.Fields!emailaddress = txtemailaddress.Text
rs.Fields!gender = txtgender.Text
rs.Fields!dateofbirth = txtdateofbirth.Value
rs.Fields!dateenrolled = Format(Now, "mm/dd/yyyy")
rs.Fields!totalfees = totalfees
rs.Fields!amountpaid = "0"
rs.Fields!balance = totalfees
Bachelor of Science in Information TechnologyPage 55

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
rs.Fields!housenumber = txthousenumber.Text
rs.Fields!street = txtstreet.Text
rs.Fields!barangay = txtbarangay.Text
rs.Fields!towncity = txttowncity.Text
rs.Fields!province = txtprovince.Text
rs.Fields!completeaddress = txthousenumber.Text & " " & txtstreet.Text & " "
&txtbarangay.Text & " " & txttowncity.Text & ", " & txtprovince.Text
rs.Fields!guardiansname = txtguardiansname.Text
rs.Fields!relationship = txtrelationship.Text
rs.Fields!guardiansnumber = txtguardiansnumber.Text
End Sub
Private Sub cmdsave_Click()
If txtidnumber.Text = "" Then
MsgBox "Please fill ID Number!", , "System"
txtidnumber.SetFocus
ElseIf txtyearlevel.Text = "" Then
MsgBox "Please select Year Level!", , "System"
txtyearlevel.SetFocus
ElseIf txtlastname.Text = "" Then
MsgBox "Please fill Last Name!", , "System"
txtlastname.SetFocus
ElseIf txtfirstname.Text = "" Then
MsgBox "Please fill First Name!", , "System"
txtfirstname.SetFocus
ElseIf txtmiddlename.Text = "" Then
MsgBox "Please fill Middle Name!", , "System"
txtmiddlename.SetFocus
ElseIf txtmobilenumber.Text = "" Then
txtmobilenumber.Text = "none"
ElseIf txtgender.Text = "" Then
MsgBox "Please Select Gender!", , "System"
txtgender.SetFocus
ElseIf txtemailaddress.Text = "" Then
txtemailaddress.Text = "none"
ElseIf txtbarangay.Text = "" Then
MsgBox "Please fill Barangay!", , "System"
txtbarangay.SetFocus
ElseIf txttowncity.Text = "" Then
MsgBox "Please fill Town/City!", , "System"
txttowncity.SetFocus
ElseIf txtprovince.Text = "" Then
MsgBox "Please fill province!", , "System"
txtprovince.SetFocus
ElseIf txtguardiansname.Text = "" Then
MsgBox "Please fill Guardian's Name!", , "System"
Bachelor of Science in Information TechnologyPage 56

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
txtguardiansname.SetFocus
ElseIf txtrelationship.Text = "" Then
MsgBox "Please fill Relationship!", , "System"
txtrelationship.SetFocus
ElseIf txtguardiansnumber.Text = "" Then
MsgBox "Please fill Guardian's Number!", , "System"
txtguardiansnumber.SetFocus
Else
id = "1"
completename = txtfirstname.Text & " " & txtmiddlename.Text & "-" & txtlastname.Text
& " " & txtextensionname.Text
Set rs = New ADODB.Recordset
sql = "select * from tblstudent"
rs.Open sql, con, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
With rs
.MoveLast
id = Val(!id) + Val(1)
.Close
End With
End If
Connect
rs.Open "select * from tblstudent where idnumber='" & txtidnumber.Text & "' and
yearlevel='" & txtyearlevel.Text & "'", con, adOpenDynamic, adLockOptimistic
If rs.RecordCount = 1 Then
MsgBox "Student already enrolled!", , "System"
Call clear
Else
Connect
sql = "select * from tblstudent"
Set rs = Nothing
rs.Open sql, con, adOpenDynamic, adLockOptimistic
With rs
.AddNew
addstudent
rs.Fields!entryby = mainform.StatusBar1.Panels(1).Text
rs.Fields!entrydate = Now
.Update
End With
rs.Close
Call clear
End If
Bachelor of Science in Information TechnologyPage 57

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
End If
End Sub
Private Sub Form_Activate()
Connect
Call fillyearlevel
End Sub
Private Sub txtbarangay_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtemailaddress_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM-_!@#$
%^&*()+=[]{}<>./?1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtextensionname_KeyPress(KeyAscii As Integer)
Data = "JSrIV"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub

Bachelor of Science in Information TechnologyPage 58

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
Private Sub txtfirstname_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtguardiansname_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtguardiansnumber_KeyPress(KeyAscii As Integer)
Data = "1234567890+"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txthousenumber_KeyPress(KeyAscii As Integer)
Data = "2345678901"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
Bachelor of Science in Information TechnologyPage 59

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
End Sub
Private Sub txtidnumber_KeyPress(KeyAscii As Integer)
Data = "1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtlastname_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtmiddlename_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtmobilenumber_KeyPress(KeyAscii As Integer)
Data = "1234567890+"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
Bachelor of Science in Information TechnologyPage 60

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
End If
End If
End Sub
Private Sub txtprovince_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtrelationship_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtstreet_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txttowncity_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
Bachelor of Science in Information TechnologyPage 61

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
KeyAscii = 0
Exit Sub
End If
End If
End Sub
SystemNumberForm
Public Sub systemnumber()
systemnumberid = "1"
On Error Resume Next
Connect
Set rs = New ADODB.Recordset
rs.Open "select * from tblsystemnumber", con, adOpenDynamic, adLockOptimistic
If rs.RecordCount = 0 Then
cmdsave.Caption = "&Save"
Else
systemnumberid = rs.Fields!systemnumberid
txtsystemnumber.Text = rs.Fields!systemnumber
txtentryby.Text = rs.Fields!entryby
txtentrydate.Text = rs.Fields!entrydate
txtupdatedby.Text = rs.Fields!updatedby
txtlastupdate.Text = rs.Fields!lastupdate
cmdsave.Caption = "&Update"
End If
mainform.StatusBar1.Panels(2).Text = rs.Fields!systemnumber
End Sub
Private Sub cmdsave_Click()
If txtsystemnumber.Text = "" Then
MsgBox "System Number Required!", , "System"
txtsystemnumber.SetFocus
Else
If cmdsave.Caption = "&Save" Then
Connect
sql = "select * from tblsystemnumber"
Set rs = New ADODB.connection
rs.Open sql, con, adOpenDynamic, adLockOptimistic
With rs
.AddNew
rs.Fields!systemnumberid = systemnumberid
rs.Fields!systemnumber = txtsystemnumber.Text
rs.Fields!entryby = mainform.StatusBar1.Panels(1).Text
Bachelor of Science in Information TechnologyPage 62

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
rs.Fields!entrydate = Now
.Update
End With
Unload Me
MsgBox "System Number successfully saved!", vbInformation, "System"
systemnumberform.Show
Else
con.Execute "update tblsystemnumber set" & vbCrLf & _
"systemnumber='" & txtsystemnumber.Text & "'," & vbCrLf & _
"updatedby='" & mainform.StatusBar1.Panels(1).Text & "'," & vbCrLf & _
"lastupdate='" & Now & "'" & vbCrLf & _
"where systemnumberid='" & systemnumberid & "'"
Unload Me
MsgBox "System Number successfully updated!", vbInformation, "System"
systemnumberform.Show
End If
End If
End Sub
Private Sub Form_Activate()
Call systemnumber
End Sub
Private Sub txtsystemnumber_KeyPress(KeyAscii As Integer)
Data = "1234567890+"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub

UpdateEnrolleeForm
Public Sub fillyearlevel()
Set rs = Nothing
rs.Open "select * from tblyearlevel", con, adOpenDynamic, adLockOptimistic
Do While Not rs.EOF
txtyearlevel.AddItem rs.Fields!yearlevel
Bachelor of Science in Information TechnologyPage 63

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
rs.MoveNext
Loop
rs.Close
End Sub
Private Sub cmdupdate_Click()
If txtidnumber.Text = "" Then
MsgBox "Please fill ID Number!", , "System"
txtidnumber.SetFocus
ElseIf txtyearlevel.Text = "" Then
MsgBox "Please select Year Level!", , "System"
txtyearlevel.SetFocus
ElseIf txtlastname.Text = "" Then
MsgBox "Please fill Last Name!", , "System"
txtlastname.SetFocus
ElseIf txtfirstname.Text = "" Then
MsgBox "Please fill First Name!", , "System"
txtfirstname.SetFocus
ElseIf txtmiddlename.Text = "" Then
MsgBox "Please fill Middle Name!", , "System"
txtmiddlename.SetFocus
ElseIf txtmobilenumber.Text = "" Then
MsgBox "Please fill Mobile Number!", , "System"
txtmobilenumber.SetFocus
ElseIf txtgender.Text = "" Then
MsgBox "Please Select Gender!", , "System"
txtgender.SetFocus
ElseIf txtemailaddress.Text = "" Then
txtemailaddress.Text = "none"
ElseIf txtbarangay.Text = "" Then
MsgBox "Please fill Barangay!", , "System"
txtbarangay.SetFocus
ElseIf txttowncity.Text = "" Then
MsgBox "Please fill Town/City!", , "System"
txttowncity.SetFocus
ElseIf txtprovince.Text = "" Then
MsgBox "Please fill province!", , "System"
txtprovince.SetFocus
ElseIf txtguardiansname.Text = "" Then
MsgBox "Please fill Guardian's Name!", , "System"
txtguardiansname.SetFocus
ElseIf txtrelationship.Text = "" Then
MsgBox "Please fill Relationship!", , "System"
txtrelationship.SetFocus
ElseIf txtguardiansnumber.Text = "" Then
MsgBox "Please fill Guardian's Number!", , "System"
Bachelor of Science in Information TechnologyPage 64

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
txtguardiansnumber.SetFocus
ElseIf txtamountpaid.Text = "" Then
txtamountpaid.Text = "0"
Else
completename = txtfirstname.Text & " " & txtmiddlename.Text & "-" & txtlastname.Text
& " " & txtextensionname.Text
completeaddress = txthousenumber.Text & ", " & txtstreet.Text & ", " & txtbarangay.Text
& ", " & txttowncity.Text & ", " & txtprovince.Text
con.Execute "update tblstudent set" & vbCrLf & _
"firstname='" & txtfirstname.Text & "'," & vbCrLf & _
"lastname='" & txtlastname.Text & "'," & vbCrLf & _
"middlename='" & txtmiddlename.Text & "'," & vbCrLf & _
"extensionname='" & txtextensionname.Text & "'," & vbCrLf & _
"completename='" & completename & "'," & vbCrLf & _
"dateofbirth='" & txtdateofbirth.Value & "'," & vbCrLf & _
"mobilenumber='" & txtmobilenumber.Text & "'," & vbCrLf & _
"gender='" & txtgender.Text & "'," & vbCrLf & _
"emailaddress='" & txtemailaddress.Text & "'," & vbCrLf & _
"housenumber='" & txthousenumber.Text & "'," & vbCrLf & _
"street='" & txtstreet.Text & "'," & vbCrLf & _
"barangay='" & txtbarangay.Text & "'," & vbCrLf & _
"towncity='" & txttowncity.Text & "'," & vbCrLf & _
"province='" & txtprovince.Text & "'," & vbCrLf & _
"guardiansname='" & txtguardiansname.Text & "'," & vbCrLf & _
"relationship='" & txtrelationship.Text & "'," & vbCrLf & _
"guardiansnumber='" & txtguardiansnumber.Text & "'," & vbCrLf & _
"completeaddress='" & completeaddress & "'," & vbCrLf & _
"yearlevel='" & txtyearlevel.Text & "'," & vbCrLf & _
"updatedby='" & mainform.StatusBar1.Panels(1).Text & "'," & vbCrLf & _
"lastupdate='" & Now & "'" & vbCrLf & _
"where idnumber='" & txtidnumber.Text & "'"
MsgBox "Enrollee successfully updated!", vbInformation, "System"
Unload Me
enrolleemasterlistform.Show
End If
End Sub
Private Sub Form_Activate()
Call fillyearlevel
End Sub
Private Sub Form_Unload(Cancel As Integer)
enrolleemasterlistform.Show
End Sub
Private Sub txtamountpaid_KeyPress(KeyAscii As Integer)
Bachelor of Science in Information TechnologyPage 65

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
Data = "1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtbarangay_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtemailaddress_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM-_!@#$
%^&*()+=[]{}<>./?1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtextensionname_KeyPress(KeyAscii As Integer)
Data = "JSrIV"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
Bachelor of Science in Information TechnologyPage 66

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
End Sub
Private Sub txtfirstname_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtguardiansname_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtguardiansnumber_KeyPress(KeyAscii As Integer)
Data = "1234567890+"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txthousenumber_KeyPress(KeyAscii As Integer)
Data = "2345678901"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
Bachelor of Science in Information TechnologyPage 67

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
End If
End If
End Sub
Private Sub txtidnumber_KeyPress(KeyAscii As Integer)
Data = "1234567890"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtlastname_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtmiddlename_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtmobilenumber_KeyPress(KeyAscii As Integer)
Data = "1234567890+"
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
Bachelor of Science in Information TechnologyPage 68

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtprovince_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtrelationship_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txtstreet_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub txttowncity_KeyPress(KeyAscii As Integer)
Data = "qwertyuiopasdfghjklxcvbnmQWERTYUIOPASDFGHJKLXCVBNM- "
If KeyAscii < 26 Then
KeyAscii = KeyAscii
Bachelor of Science in Information TechnologyPage 69

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
Else
If InStr(Data, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
UserMaintenanceForm
Private Sub getuser()
ListView1.ListItems.Clear
Connect
sql = "select * from tblusers"
Set rs = New ADODB.Recordset
rs.Open sql, con, adOpenDynamic, adLockOptimistic
Do Until rs.EOF
With ListView1.ListItems.Add(, , rs!id)
.SubItems(1) = rs!userid
.SubItems(2) = rs!longname
.SubItems(3) = rs!usertype
End With
rs.MoveNext
Loop
rs.Close
End Sub
Private Sub edituser()
On Error Resume Next
Connect
Set rs = New ADODB.Recordset
rs.Open "select * from tblusers where id='" & ListView1.SelectedItem.Text & "'", con,
adOpenDynamic, adLockOptimistic
With addupdateuserform
.Caption = "Edit User - " & rs.Fields!userid
.txtuserid.Text = rs.Fields!userid
.txtfirstname.Text = rs.Fields!firstname
.txtlastname.Text = rs.Fields!lastname
.txtmi.Text = rs.Fields!mi
.txtextensionname.Text = rs.Fields!extensionname
.txtlongname.Text = rs.Fields!longname
.txtusertype.Text = rs.Fields!usertype
.txtlogonpassword.Text = rs.Fields!Password
.txtentryby.Text = rs.Fields!entryby
Bachelor of Science in Information TechnologyPage 70

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
.txtentrydate.Text = rs.Fields!entrydate
.txtupdatedby.Text = rs.Fields!updatedby
.txtlastupdate.Text = rs.Fields!lastupdate
.cmdsave.Caption = "&Update"
.txtuserid.Enabled = False
End With
rs.Close
End Sub
Private Sub cmdadd_Click()
addupdateuserform.Caption = "Add User"
addupdateuserform.Show
Unload Me
End Sub
Private Sub cmddelete_Click()
If vbYes = MsgBox("Are you sure you want to delete " &
ListView1.SelectedItem.SubItems(1) & "?", vbQuestion + vbYesNo, "System") Then
con.Execute "delete from tblusers where userid='" &
ListView1.SelectedItem.SubItems(1) & "'"
MsgBox "" & ListView1.SelectedItem.SubItems(1) & " successfully deleted!",
vbInformation, "System"
ListView1.ListItems.Clear
Call getuser
Else
ListView1.ListItems.Clear
Call getuser
End If
End Sub
Private Sub cmdedit_Click()
Call edituser
Unload Me
End Sub
Private Sub Form_Load()
Call getuser
End Sub
Private Sub ListView1_DblClick()
Call edituser
Unload Me
End Sub
UserTypeForm
Bachelor of Science in Information TechnologyPage 71

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY

Private Sub getusertype()


ListView1.ListItems.Clear
Connect
sql = "select * from tblusertype"
Set rs = New ADODB.Recordset
rs.Open sql, con, adOpenDynamic, adLockOptimistic
Do Until rs.EOF
With ListView1.ListItems.Add(, , rs!usertypeid)
.SubItems(1) = rs!usertype
End With
rs.MoveNext
Loop
rs.Close
End Sub
Private Sub editusertype()
On Error Resume Next
id = ListView1.SelectedItem.Text
Connect
Set rs = New ADODB.Recordset
rs.Open "select * from tblusertype where usertypeid='" & ListView1.SelectedItem.Text &
"'", con, adOpenDynamic, adLockOptimistic
With addupdateusertypeform
.Caption = "Edit Usertype"
.txtusertype.Text = rs.Fields!usertype
.cmdsave.Caption = "&Update"
End With
rs.Close
End Sub
Private Sub cmdadd_Click()
addupdateusertypeform.Caption = "Add User"
addupdateusertypeform.Show
Unload Me
End Sub
Private Sub cmddelete_Click()
If vbYes = MsgBox("Are you sure you want to delete " &
ListView1.SelectedItem.SubItems(1) & "?", vbQuestion + vbYesNo, "System") Then
con.Execute "delete from tblusertype where usertypeid='" &
ListView1.SelectedItem.Text & "'"
MsgBox "" & ListView1.SelectedItem.SubItems(1) & " successfully deleted!",
vbInformation, "System"
Bachelor of Science in Information TechnologyPage 72

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
ListView1.ListItems.Clear
Call getusertype
Else
ListView1.ListItems.Clear
Call getusertype
End If
End Sub
Private Sub cmdedit_Click()
Call editusertype
Unload Me
End Sub
Private Sub Form_Load()
Call getusertype
End Sub
Private Sub ListView1_DblClick()
Call editusertype
Unload Me
End Sub
YearLevelForm
Private Sub getyearlevel()
ListView1.ListItems.Clear
Connect
sql = "select * from tblyearlevel"
Set rs = New ADODB.Recordset
rs.Open sql, con, adOpenDynamic, adLockOptimistic
Do Until rs.EOF
With ListView1.ListItems.Add(, , rs!yearlevelid)
.SubItems(1) = rs!yearlevel
End With
rs.MoveNext
Loop
rs.Close
End Sub
Private Sub edityearlevel()
On Error Resume Next
id = ListView1.SelectedItem.Text
Connect
Set rs = New ADODB.Recordset
rs.Open "select * from tblyearlevel where yearlevelid='" & ListView1.SelectedItem.Text
Bachelor of Science in Information TechnologyPage 73

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY
& "'", con, adOpenDynamic, adLockOptimistic
With addupdateyearlevelform
.Caption = "Edit Year Level"
.txtyearlevel.Text = rs.Fields!yearlevel
.cmdsave.Caption = "&Update"
End With
rs.Close
End Sub
Private Sub cmdadd_Click()
addupdateyearlevelform.Caption = "Add Year Level"
addupdateyearlevelform.Show
Unload Me
End Sub
Private Sub cmddelete_Click()
If vbYes = MsgBox("Are you sure you want to delete " &
ListView1.SelectedItem.SubItems(1) & "?", vbQuestion + vbYesNo, "System") Then
con.Execute "delete from tblyearlevel where yearlevelid='" &
ListView1.SelectedItem.Text & "'"
MsgBox "" & ListView1.SelectedItem.SubItems(1) & " successfully deleted!",
vbInformation, "System"
ListView1.ListItems.Clear
Call getyearlevel
Else
ListView1.ListItems.Clear
Call getyearlevel
End If
End Sub
Private Sub cmdedit_Click()
Call edityearlevel
Unload Me
End Sub
Private Sub Form_Load()
Call getyearlevel
End Sub
Private Sub ListView1_DblClick()
Call edityearlevel
Unload Me
End Sub

Bachelor of Science in Information TechnologyPage 74

ISABELA STATE UNIVERSITY


Cauayan Campus
Cauayan City, Isabela
COLLEGE OF COMPUTING AND INFORMATION TECHNOLOGY

Bachelor of Science in Information TechnologyPage 75

You might also like