Sunteți pe pagina 1din 112

QUEZON CITY POLYTECHNIC UNIVERSITY 88

APPENDIX A

Survey Questionnaire

NAME: _________________________________ DATE: ________________

STUDENT NO.: ___________ C/Y/S: _____________ AGE: ____ GENDER: ____

DIRECTION:

PLEASE SELECT YOUR LEVEL OF AGREEMENT TO THE FOLLOWING


QUESTIONS ITEM BELOW. YOUR HONEST RESPONSE WILL HELP US
TO PURSUE OUR SYSTEM VENDING MACHINE COIN TUITION KIOSK
FOR QUEZON CITY POLYTECHNIC UNIVERSITY STUDENTS.

1. How much is your daily school allowance?


20 pesos and below

30 – 40 pesos

50 – 80 pesos

90 pesos and above

2. Where do you spend your daily school allowance?


Foods

Transportation

School Projects

Hanging out

Other specify answer: _____________

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 89

3. Are you saving money from your allowance?

Yes

No

If Yes, How much per day?

20 pesos and below

30 – 40 pesos

50 – 80 pesos

90 pesos and above

If No, Why? ____________

4. Where do you usually spend your savings? You may select 1 or more
below.

Foods

Transportation
School Projects
Hanging out

Other specify answer: _____________

5. Will you consider spending your savings to your tuition fee?

Yes

No

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 90

6. Where do you usually put your savings?

BANK

COIN BANK

LENDING

Other specify answer: __________

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 91

APPENDIX B

Graphical Representation of

Survey Results

QCPU Students Daily School Allowance


45%
40%
35%
PERCENTAGE

30%
25%
20%
15%
10%
5%
0%
20PESOS - 30-40 PESOS 50-80 PESOS 90 PESOS -
BELOW ABOVE
AMOUNT

QCPU Students Daily School Allowance

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 92

4%

23%
TRANSPORTATION
29%
FOOD
PROJECT
COMPUTER GAMES
OTHERS
8%
36%

Factors that the students spend their allowances

10%

YES NO

90%

Students who saves money from their allowances

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 93

QCPU STUDENTS

HANGING OUT

SHOPPING

ONLINE GAMING

FOODS

0% 10% 20% 30% 40% 50% 60% 70%

FOODS ONLINE GAMING SHOPPING HANGING OUT


STUDENTS 65% 15% 7% 13%

QCPU Students usually spends their savings

40% YES

60% NO

Percentage of the QCPU Students who are willing to spend their savings for
their tuition fee

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 94

APPENDIX C

SCREENSHOTS

Loading Screen

Log In Module

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 95

Super Admin Module

New Admin Account

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 96

Super Admin Dashboard

Edit Student Payment Information

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 97

System Statistics

System Settings

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 98

Super Admin Account Settings

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 99

Admin Module

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 100

Add New Student

Add New Payment Information

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 101

Change Student Course

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 102

Edit Student Information

Delete Student

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 103

Previous Payment

System News

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 104

Printing Option

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 105

System Statistics

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 106

Transaction History

Deduction History

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 107

Receipt

Edit Account Settings

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 108

Student Module Welcome Screen

Student Module

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 109

APPENDIX D

Schematic Diagram of the Coin Acceptor

Regulator
Power Indicator
Capacitor

Step Power
LED1
Resistor 3

Mouse
switch
L1014

LED2

Resistor 1 Resistor 2

Switch

Ground
12v

Coin Slot

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 110

APPENDIX E

Entity Relationship Diagram

tbldeposit
Admin PK deposit_id
PK admin_id studentid
username depositdate
password amount
lastname
firstname Tblpayment
middlename PK Paymentid
Studentid
Amount
Scholarship
DIVIDE
Totalamount
INTO
Deposit

Adds tbldeduction
information PK deduction_id
FK studentid
deductiondate
CREATE
amount
HAS

tbltransaction
Student PK transactionid
PK studentnumber studentid
FK studentid transactiondate
lastname amount
middlename
HAS
firstname tblcourses
Coursed PK courseid
coursename
students
tblnews
PK newsid
news_title
news_content
date_posted

Figure no. 5.1 Entity Relationship Diagram

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 111

tblcoinbanks
PK coinbanks_id
FK studentid
amount
Student
PK studentnumber
FK studentid tbloldpayments
HAS
lastname PK oldpayment_id
middlename FK students_id
firstname amount
Coursed scholarship
totalamount
deposit

tbloldtransactions
PK oldtransaction_id
tblolddeduction FK1 oldpayment_id
PK olddeduction_id FK2 studentid
FK1 oldpayment_id transactiondate
FK2 studentid amount
deductiondate
amount

tblsettings
SuperAdmin adminusername
adminusername adminpassword
adminpassword MANAGE admincode
denomination
ornumber
schoolyear
schoolsemester
MONITOR

tblstatistics
courses
tblactivitylog students
PK activityid payments
loginusername coins
fullname banks
activity ones
activitydate fives
tens

Figure no. 5.2 Entity Relationship Diagram

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 112

APPENDIX F

Procedural Flow Chart

Admin Log-in

START

Username= “ “
Password= “ “

Enter
username and
password

If username
No
and Invalid Attempts =
password Attempts + 1
correct?
Password

Yes Yes
if
Load Admin attempts End
Module >= 5

No

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 113

Add New Student

Start

A
Input Lastname,
Firstname,
Middlename and
student number

No
Do you
Click the
want to
ESC(Cancel) to exit A
save?
the module

Yes

Successfully
added a
student !

End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 114

Add Student New Payment

Start

Click the student that


you’re going to add
payment information

Input the Scholarship


After you click the Percentage and the Over
student name, Press F3 to all balance tuition fee of
add payment the student

Click the No Save the


ESC(Cancel) to exit payment
the module information?

Yes

A
Successfully
added payment!

End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 115

Change Student Course

Start

Click the student that


you’re going to change
the course

After you click the student


name, Click the Change
Course button at the top of
the student list

Choose what the new


course of the student
is

Click the Change


Course button

You successfully
set the new
course

End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 116

Delete Student

Start

Click the student that


you’re going to delete the
information

After you click the student Are you sure you


name, Click the Delete want to delete the
button at the top of the student ?
student list

No Are you sure


you want to
Click the Cancel to
delete the
exit the module student?

Yes

A End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 117

Payment Validation

Start

Click the student


name to validate
his/her payment

Click the payment


validation button at
the right lower part

Is the deposit Validate the deposit


amount = Yes amount and the system will
minimum
denomination set automatically deduct it
by the admin? from the balance of the
student current tuition fee

No
Successfully
The deposit validate the
amount is not payment
enough to validate of”Student
Name”!

A End A

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 118

Add System News

Start

Click the system


news button

Click the Add news


button

Input the News Title


and Description

Yes
Save the You
Successfully End
news?
Added News!

No
Click the Cancel
button

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 119

View Previous Payment

Start A

Click the Previous Payment A form will pop up at the


button at the bottom of New screen. You can view now
Payment button the list of payment made by
the selected student

Yes
Print the Previous You want to
Payment print
payment?

No

No You want
A to close?
A

Yes

End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 120

Print Deduction History

Start

Select a student

Click the Printing button

Click the Print Deduction button

End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 121

Print Transaction History

Start

Select a student

Click the Printing button

Click the Print Transaction


History button

End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 122

Print Payment

Start

Select a student

Click the Printing button

Click the Print Payment


button

End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 123

Transfer Coin

Start

Is there
an excess
No End
coins?

Yes

Click the
transfer coin A
button

You
successfully
transfer the
coins!

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 124

Account Settings

Start
A

You want to
edit your No
End
account
setting?

A
Yes

Edit your
Account
Information

Edit your
Are you No A
Personal done?
Information

Yes

Click the
A
Update Admin
Account button

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 125

Log in

Start

Login

Equal to
coinbank any A
user?

B C D

End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 126

Super Admin Module


Start

Login As Super
Admin

No

Is equal to
coinbank username
and
password
Yes

I Displays Super
Admin Function

Logout

End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 127

Add New Admin

Start

New Account

No
Create

Account?

Yes

Account
Created

I Log Out

End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 128

Edit Admin Account

Start

Edit Account

No

Edit
Account?

Yes

Account Edited

I Log Out

End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 129

Delete Admin Account

Start

Delete Account

No
Delete
Account?

Yes

Account
Deleted

I Log Out

End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 130

Activity Log
Start

Activity Log

No

Display User
Activities?

Yes

Displayed User
Activities

I Log Out

End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 131

Edit Payment

Start

Edit Payment

No

Edit
Payment?

Yes

Payment Edited

I Log Out

End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 132

Change Denomination Validation

Start

System Settings

No

Change System
Settings

Yes

Validation Amount
Changed

I Log Out

End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 133

System Statistics

Start

Statistics

No
Display
Transaction
s

Yes

Show Transaction
Report

I Log Out

End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 134

Super Admin Account Settings


Start

Change Account
Settings

No

Change
Settings?

Yes

Modify Account
Settings

I Log Out

End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 135

Student Module

Start

Login As Student

Displays Real Time


Student Information

Insert Coin

Equal To
coinbank Valid
Deposits?

For Accounting Validation

Log Out

End

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 136

APPENDIX G

Main Source Code

Imports System.IO.Ports
Imports MySql.Data.MySqlClient CheckForIllegalCrossThreadCalls =
Imports Excel = False
Microsoft.Office.Interop.Excel
Imports System.IO lblSemester.Text = "School
Imports System.Threading Year : " & schoolyear & " | "

Public Class frmMain If schoolsemester = 1 Then


Private WithEvents Animation As lblSemester.Text =
New Windows.Forms.Timer lblSemester.Text & "1st Semester"
Private WithEvents DateTime As Else
New Windows.Forms.Timer lblSemester.Text =
Private WithEvents lblSemester.Text & "2nd Semester"
MessageAnimation As New End If
Windows.Forms.Timer
Timer1.Interval = 100
Private Declare Function Timer1.Start()
GetAsyncKeyState Lib "user32" (ByVal
vKey As Short) As Integer LoadThreads()
Private WithEvents Timer1 As New LoadColors()
Windows.Forms.Timer LoadTimers()

Private WithEvents NewsLoading As Panel1.Left =


New Windows.Forms.Timer (((MainPanel.Width - 250) / 2) -
Private WithEvents NewsAnimation (Panel1.Width / 2))
As New Windows.Forms.Timer pb1.Image =
Private WithEvents ScreenSaver As System.Drawing.Image.FromFile(Applica
New Windows.Forms.Timer tion.StartupPath &
Private NewsCount As Integer = 0 "\ScreenSaver\1.jpg")

Private WithEvents GetLogins As DateTime.Start()


New Windows.Forms.Timer MessageAnimation.Start()

Private Sub Animation.Interval = 10


frmMain_KeyPress(ByVal sender As Animation.Tag = "Show"
Object, ByVal e As Animation.Start()
System.Windows.Forms.KeyPressEventArg End Sub
s) Handles Me.KeyPress
idlecount = 0 Public transactionanimationthrd
ScreenSaverCount = 0 As System.Threading.Thread
End Sub Public norecordsthrd As
System.Threading.Thread
Private Sub frmMain_Load(ByVal Public paymentthrd As
sender As System.Object, ByVal e As System.Threading.Thread
System.EventArgs) Handles MyBase.Load Public validatepaymentthrd As
CreateBorders(Me, True) System.Threading.Thread

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 137

Public warningthrd As Public Sub WarningThread()


System.Threading.Thread Do
Thread.Sleep(10)
Public Sub LoadThreads()
transactionanimationthrd = Try
New Thread(AddressOf If
TransactionsAnimationThread) Now.TimeOfDay.Hours = 16 And
Now.TimeOfDay.Minutes >= 45 Then
transactionanimationthrd.IsBackground LoginDisabled =
= True True

transactionanimationthrd.Start() If id > 0 Then


If
paymentthrd = New lblWarningTitle.Height < 30 Then
Thread(AddressOf PaymentThread)
paymentthrd.IsBackground = lblWarningTitle.Height += 5
True Else
paymentthrd.Start() If
lblWarningcontent.Height < 120 Then
validatepaymentthrd = New
Thread(AddressOf lblWarningcontent.Height += 10
ValidatePaymentThread) Else
If
validatepaymentthrd.IsBackground = lblWarningCountdown.Height < 80 Then
True
validatepaymentthrd.Start() lblWarningCountdown.Height += 10
End
warningthrd = New If
Thread(AddressOf WarningThread) End If
warningthrd.IsBackground = End If
True Else
warningthrd.Start() If
lblWarningCountdown.Height > 0 Then
norecordsthrd = New
Thread(AddressOf NoRecordsThread) lblWarningCountdown.Height -= 10
norecordsthrd.IsBackground = Else
True If
norecordsthrd.Start() lblWarningcontent.Height > 0 Then
End Sub
lblWarningcontent.Height -= 10
Public Sub CloseThreads() Else
If
transactionanimationthrd.Abort() lblWarningTitle.Height > 0 Then
paymentthrd.Abort()
validatepaymentthrd.Abort() lblWarningTitle.Height -= 5
warningthrd.Abort() End
norecordsthrd.Abort() If
End Sub End If
End If
End If
End If

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 138

Dim countdown As Try


Integer = Thread.Sleep(10)
DateDiff(DateInterval.Second,
CDate(Now), CDate(Today & " 4:46:00 lblValidatecontent.Text = "You've
PM")) + 1 already reached the Minimum amount of
P" & denomination & ".00" & vbNewLine
If countdown = 0 Then & vbNewLine & "You can go now to
ForceLoggedOut = Accounting to validate your Payment."
True
End If If
lvDeductions.Items.Count <= 2 Then
If ForceLoggedOut = If paymentdeposit
True Then >= denomination Then
LogoutStudent() If
lblValidateTitle.Height < 22 Then

lblStudentInformationTitle.Top = 35 lblValidateTitle.Height += 3
ElseIf
lblStudentLoginTitle.Top = 0 lblValidateTitle.Height < 30 Then

StudentInformationPanel.Top = -140 lblValidateTitle.Height += 1


Else
StudentLoginPanel.Top = 0 If
lblValidatecontent.Height < 150 Then

txtStudentNumber.Focus() lblValidatecontent.Height += 10
ElseIf
ForceLoggedOut = lblValidatecontent.Height < 162 Then
False
End If lblValidatecontent.Height += 3
ElseIf
If countdown > 1 Then lblValidatecontent.Height < 170 Then

lblWarningCountdown.Text = countdown lblValidatecontent.Height += 1


& " seconds" End If
Else End If
Else
lblWarningCountdown.Text = countdown If
& " second" lblValidatecontent.Height > 20 Then
End If
Catch : End Try lblValidatecontent.Height -= 10
Loop ElseIf
End Sub lblValidatecontent.Height > 8 Then

Private ForceLoggedOut As Boolean lblValidatecontent.Height -= 3


= False ElseIf
lblValidatecontent.Height > 0 Then
Public Sub
ValidatePaymentThread() lblValidatecontent.Height -= 1
Do

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 139

Else lblYear.ForeColor =
If FunctionColor
lblValidateTitle.Height > 8 Then
lblATitle1.ForeColor =
lblValidateTitle.Height -= 3 FunctionColor
ElseIf lblATitle2.ForeColor =
lblValidateTitle.Height > 0 Then FunctionColor

lblValidateTitle.Height -= 1
End If lblStudentInformationTitle.ForeColor
End If = MainColor
End If
Else lblStudentLoginTitle.ForeColor =
If MainColor
lblValidatecontent.Height > 20 Then lblPaymentsTitle.ForeColor =
MainColor
lblValidatecontent.Height -= 10 lblCoinBankTitle.ForeColor =
ElseIf MainColor
lblValidatecontent.Height > 8 Then
lblTransactionsTitle.ForeColor =
lblValidatecontent.Height -= 3 MainColor
ElseIf
lblValidatecontent.Height > 0 Then lblStudentNumber.ForeColor =
FunctionColor
lblValidatecontent.Height -= 1 lblFullName.ForeColor =
Else FunctionColor
If lblCourse.ForeColor =
lblValidateTitle.Height > 8 Then FunctionColor

lblValidateTitle.Height -= 3 lblTPayment.ForeColor =
ElseIf FunctionColor
lblValidateTitle.Height > 0 Then
lblTuitionFee.ForeColor =
lblValidateTitle.Height -= 1 FunctionColor
End If lblScholarship.ForeColor =
End If FunctionColor
End If lblPercent.ForeColor =
Catch : End Try FunctionColor
Loop lblDeposit.ForeColor =
End Sub FunctionColor
lblBalance.ForeColor =
Private Sub LoadColors() FunctionColor
Label1.ForeColor = MainColor
lblTitle.ForeColor = lblCoinBank.ForeColor =
MainColor FunctionColor
lblTime.ForeColor = End Sub
FunctionColor
lblMonth.ForeColor = Private Sub LoadTimers()
FunctionColor DateTime.Interval = 10
lblDay.ForeColor = MessageAnimation.Interval =
FunctionColor

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY
140
10 StudentsLoading.Stop()
MessageAnimation.Tag = "12" Timer1.Stop()

LoginAnimation.Interval = 10 NewsAnimation.Stop()
PaymentsAnimation.Interval = End Sub
10
Private isAdminLogin As Boolean =
TransactionsAnimation.Interval = 10 False

PaymentsAnimation.Start() Private Sub Animation_Tick(ByVal


TransactionsAnimation.Start() sender As Object, ByVal e As
System.EventArgs) Handles
StudentsLoading.Interval = 10 Animation.Tick
If Animation.Tag = "Show"
StudentInformationAnimation.Interval Then
= 10 If Me.Opacity < 0.98 Then
Me.Opacity += 0.07
StudentInformationAnimation.Start() Else
Animation.Stop()
ScreenSaver.Interval = 10 End If
ScreenSaver.Start() Else
If Me.Opacity > 0 Then
PaymentsLoading.Interval = 10 Me.Opacity -= 0.14
PaymentsLoading.Start() Else
Animation.Stop()
TransactionsLoading.Interval DisableTimers()
= 10 CloseThreads()
TransactionsLoading.Start()
If isAdminLogin =
DeductionsLoading.Interval = True Then
10 Dim login = New
DeductionsLoading.Start() frmLogin

NewsAnimation.Interval = 10 login.isAdminLogin = True


NewsAnimation.Tag = "Count" login.Show()
NewsAnimation.Start() End If

NewsLoading.Interval = 10 Me.Close()
NewsLoading.Start() End If
End If
ShowReminder.Interval = 1000 End Sub
End Sub
Private Sub DateTime_Tick(ByVal
Private Sub DisableTimers() sender As Object, ByVal e As
DateTime.Stop() System.EventArgs) Handles
MessageAnimation.Stop() DateTime.Tick
If Today.Day <= 9 Then
LoginAnimation.Stop() lblDay.Text = "0" &
PaymentsAnimation.Stop() Today.Day
TransactionsAnimation.Stop()

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 141

Else If
lblDay.Text = Today.Day lblNoDeduction.Height < 22 Then
End If
lblNoDeduction.Height += 3
lblMonth.Text = ElseIf
MonthName(Today.Month) lblNoDeduction.Height < 30 Then
lblYear.Text = Today.Year
lblNoDeduction.Height += 1
lblTime.Text = End If
TimeOfDay.ToLongTimeString End If

If Now.TimeOfDay.Hours = 17 If isNoDeposit =
Then False Then
DateTime.Stop() If
CreateExcelBackUp() lblNoDeposit.Height > 8 Then
End If
End Sub lblNoDeposit.Height -= 3
ElseIf
Private MessageCount As Integer = lblNoDeposit.Height > 0 Then
30
Private LoginDisabled As Boolean lblNoDeposit.Height -= 1
= False End If
Private WithEvents ShowReminder Else
As New Windows.Forms.Timer If
Private LogoutTime As Date lblNoDeposit.Height < 22 Then

Dim xlApp As New lblNoDeposit.Height += 3


Excel.Application ElseIf
Dim xlWorkBook As Excel.Workbook lblNoDeposit.Height < 30 Then
Dim xlWorkSheet As
Excel.Worksheet lblNoDeposit.Height += 1
Public isBackUp As Boolean = True End If
End If
Public Sub NoRecordsThread()
Do If isNoPayment =
Thread.Sleep(10) False Then
If
Try lblNoTransaction.Height > 8 Then
If isNoDeduction =
False Then lblNoTransaction.Height -= 3
If ElseIf
lblNoDeduction.Height > 8 Then lblNoTransaction.Height > 0 Then

lblNoDeduction.Height -= 3 lblNoTransaction.Height -= 1
ElseIf End If
lblNoDeduction.Height > 0 Then Else
If
lblNoDeduction.Height -= 1 lblNoTransaction.Height < 22 Then
End If
Else lblNoTransaction.Height += 3
ElseIf

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 142

lblNoTransaction.Height < 30 Then If


File.Exists(Application.StartupPath &
lblNoTransaction.Height += 1 "\BackUp Files\BackUp_" & Today.Year
End If & "_" & Today.Month & "_" &
End If Today.Day) Then
Catch : End Try File.Delete(Application.StartupPath &
Loop "\BackUp Files\BackUp_" & Today.Year
End Sub & "_" & Today.Month & "_" &
Today.Day)
#Region "~~> Excel Back Up . . ."
xlApp.DisplayAlerts =
Public Sub CreateExcelBackUp() False
Try
'~~> Add a New Workbook xlWorkBook.SaveAs(Application.Startup
xlWorkBook = Path & "\BackUp Files\BackUp_" &
xlApp.Workbooks.Add Today.Year & "_" & Today.Month & "_"
& Today.Day,
If isBackUp = False Then Excel.XlFileFormat.xlWorkbookDefault,
xlApp.Visible = True Type.Missing, Type.Missing, True,
Else False,
xlApp.Visible = False Excel.XlSaveAsAccessMode.xlExclusive,
End If Excel.XlSaveconflictResolution.xlLoca
lSessionChanges, Type.Missing,
'~~> Set the relevant Type.Missing)
sheet that we want to work with xlApp.DisplayAlerts =
xlWorkSheet = True
xlWorkBook.Sheets("Sheet2") xlApp.Quit()
xlWorkSheet.Delete()
CloseThreads()
xlWorkSheet = DisableTimers()
xlWorkBook.Sheets("Sheet3")
xlWorkSheet.Delete()
System.Diagnostics.Process.Start("shu
xlWorkSheet = tdown", "-s -f -t 10")
xlWorkBook.Sheets("Sheet1") Catch ex As Exception
ShowError("An error
CreateCourseBackUp() occured during Backup Process",
CreateStudentsBackUp() "Please contact your System
CreateCoinBankBackUp() Administrator", False)
CreatePaymentBackUp() End
End Try
CreateTransactionHistoryBackUp() End Sub

CreateDepositHistoryBackUp() Private Gitna =


CreateDeductionBackUp() Excel.constants.xlCenter
Private Kaliwa =
If Not Excel.constants.xlLeft
Directory.Exists(Application.StartupP Private Kanan =
ath & "\BackUp Files") Then Excel.constants.xlRight
Directory.CreateDirectory(Application
.StartupPath & "\BackUp Files")

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 143

Public Sub CreateCourseBackUp() .Range("C" &


xlWorkSheet.Name = "Courses" (nextcourse) & ":H" &
(nextcourse)).Merge()
With xlWorkSheet
.Range("A2").Value = .Range("A" &
"Course Information" (nextcourse + 1)).Value = "No. of
.Range("A2:H2").Merge() Student :"
.Range("C" &
.Range("A2").HorizontalAlignment = (nextcourse + 1)).Value =
Gitna ds.Tables("tblStudents").Rows.Count
.Range("C" &
.Range("A3").Value = "( (nextcourse + 1)).HorizontalAlignment
List of Current Courses )" = Kaliwa
.Range("A3:H3").Merge() .Range("C" &
(nextcourse + 1) & ":H" & (nextcourse
.Range("A3").HorizontalAlignment = + 1)).Merge()
Gitna
.Range("A" &
(nextcourse) & ":B" & (nextcourse +
.Range("A2:H3").BorderAround() 1)).BorderAround()
.Range("C" &
Dim nextcourse As Integer (nextcourse) & ":H" & (nextcourse +
= 5 1)).BorderAround()

sql = "SELECT * FROM nextcourse =


tblCourses" nextcourse + 3
da = New
MySqlDataAdapter(sql, con)
ds.Clear() ds.Tables("tblStudents").Clear()
da.Fill(ds, "tblCourses") Next

For a = 1 To .Range("F" &


ds.Tables("tblCourses").Rows.Count (nextcourse)).Value = "Total Courses
sql = "SELECT * FROM :"
tblStudents WHERE courseid=@id"
Dim students As New .Range("H" &
MySqlCommand(sql, con) (nextcourse)).Value =
ds.Tables("tblCourses").Rows.Count
students.Parameters.AddWithValue("@id .Range("H" &
", ds.Tables("tblCourses").Rows(a - (nextcourse)).HorizontalAlignment =
1).Item("id").ToString) Gitna
da = New End With
MySqlDataAdapter(students) End Sub
da.Fill(ds,
"tblStudents") Public Sub CreateStudentsBackUp()

.Range("A" & xlWorkBook.Sheets.Add(After:=xlWorkBo


(nextcourse)).Value = "Course Name :" ok.Worksheets(xlWorkBook.Worksheets.C
.Range("C" & ount))
(nextcourse)).Value = xlWorkSheet =
ds.Tables("tblCourses").Rows(a - xlWorkBook.Sheets("Sheet4")
1).Item("coursename").ToString xlWorkSheet.Name = "Students"

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 144

.Range("G" &
Dim nextcourse As Integer = 5 nextcourse).Value = "Total Students
:"
With xlWorkSheet .Range("I" &
.Range("A2").Value = nextcourse).Value =
"Student Information" ds.Tables("tblStudents").Rows.Count
.Range("A2:I2").Merge() .Range("I" &
nextcourse).HorizontalAlignment =
.Range("A2").HorizontalAlignment = Gitna
Gitna
.Range("A" &
.Range("A3").Value = "( (nextcourse + 2)).Value = "Student #"
List of Students per Course )" .Range("A" &
.Range("A3:I3").Merge() (nextcourse + 2)).HorizontalAlignment
= Gitna
.Range("A3").HorizontalAlignment = .Range("A" &
Gitna (nextcourse + 2)).BorderAround()

.Range("B" &
.Range("A2:I3").BorderAround() (nextcourse + 2)).Value = "Last Name"
.Range("B" &
sql = "SELECT * FROM (nextcourse + 2) & ":C" & (nextcourse
tblCourses" + 2)).Merge()
da = New .Range("B" &
MySqlDataAdapter(sql, con) (nextcourse + 2) & ":C" & (nextcourse
ds.Clear() + 2)).BorderAround()
da.Fill(ds, "tblCourses") .Range("B" &
(nextcourse + 2)).HorizontalAlignment
For a = 1 To = Gitna
ds.Tables("tblCourses").Rows.Count
.Range("A" & .Range("D" &
nextcourse).Value = "Course :" (nextcourse + 2)).Value = "First
.Range("B" & Name"
nextcourse).Value = .Range("D" &
ds.Tables("tblCourses").Rows(a - (nextcourse + 2) & ":E" & (nextcourse
1).Item("coursename").ToString + 2)).Merge()
.Range("D" &
sql = "SELECT * FROM (nextcourse + 2) & ":E" & (nextcourse
tblStudents WHERE courseid=@id" + 2)).BorderAround()
Dim students As New .Range("D" &
MySqlCommand(sql, con) (nextcourse + 2)).HorizontalAlignment
= Gitna
students.Parameters.AddWithValue("@id
", ds.Tables("tblCourses").Rows(a - .Range("F" &
1).Item("id").ToString) (nextcourse + 2)).Value = "Middle
da = New Name"
MySqlDataAdapter(students) .Range("F" &
da.Fill(ds, (nextcourse + 2) & ":G" & (nextcourse
"tblStudents") + 2)).Merge()
.Range("F" &
(nextcourse + 2) & ":G" & (nextcourse
+ 2)).BorderAround()

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 145

.Range("F" & .Range("F" &


(nextcourse + 2)).HorizontalAlignment (nextcourse + 3 + s) & ":G" &
= Gitna (nextcourse + 3 + s)).BorderAround()
Next
.Range("A" &
(nextcourse + 3) & ":I" & (nextcourse .Range("A" &
+ 3)).Merge() (nextcourse + 4 +
.Range("A" & ds.Tables("tblStudents").Rows.Count)
(nextcourse + 3) & ":I" & (nextcourse & ":I" & (nextcourse + 4 +
+ 3)).BorderAround() ds.Tables("tblStudents").Rows.Count))
.Merge()
For s = 1 To
ds.Tables("tblStudents").Rows.Count nextcourse =
.Range("A" & nextcourse + (5 +
(nextcourse + 3 + s)).Value = ds.Tables("tblStudents").Rows.Count)
ds.Tables("tblStudents").Rows(s -
1).Item("studentnumber").ToString
.Range("A" & ds.Tables("tblStudents").Clear()
(nextcourse + 3 + Next
s)).HorizontalAlignment = Gitna End With
.Range("A" & End Sub
(nextcourse + 3 + s)).BorderAround()
Public Sub CreateCoinBankBackUp()
.Range("B" &
(nextcourse + 3 + s)).Value = xlWorkBook.Sheets.Add(After:=xlWorkBo
ds.Tables("tblStudents").Rows(s - ok.Worksheets(xlWorkBook.Worksheets.C
1).Item("lastname").ToString ount))
.Range("B" & xlWorkSheet =
(nextcourse + 3 + s) & ":C" & xlWorkBook.Sheets("Sheet5")
(nextcourse + 3 + s)).Merge() xlWorkSheet.Name = "Coin
.Range("B" & Bank"
(nextcourse + 3 + s) & ":C" &
(nextcourse + 3 + s)).BorderAround() With xlWorkSheet
.Range("A2").Value =
.Range("D" & "Coin Bank"
(nextcourse + 3 + s)).Value = .Range("A2:I2").Merge()
ds.Tables("tblStudents").Rows(s -
1).Item("firstname").ToString .Range("A2").HorizontalAlignment =
.Range("D" & Gitna
(nextcourse + 3 + s) & ":E" &
(nextcourse + 3 + s)).Merge() .Range("A3").Value = "(
.Range("D" & Current Coins in Bank of the Students
(nextcourse + 3 + s) & ":E" & )"
(nextcourse + 3 + s)).BorderAround() .Range("A3:I3").Merge()

.Range("F" & .Range("A3").HorizontalAlignment =


(nextcourse + 3 + s)).Value = Gitna
ds.Tables("tblStudents").Rows(s -
1).Item("middlename").ToString
.Range("F" & .Range("A2:I3").BorderAround()
(nextcourse + 3 + s) & ":G" &
(nextcourse + 3 + s)).Merge()

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 146

sql = "SELECT * FROM


tblStudents ORDER BY fullname ASC" bank.Parameters.AddWithValue("@id",
da = New ds.Tables("tblStudents").Rows(a -
MySqlDataAdapter(sql, con) 1).Item("id").ToString)
ds.Clear() da = New
da.Fill(ds, MySqlDataAdapter(bank)
"tblStudents") da.Fill(ds,
"tblCoinbanks")
Dim nextstudent As
Integer = 5 .Range("H" &
Dim totalcoins As Integer (nextstudent)).Value = "Coins"
= 0 .Range("H" &
(nextstudent)).HorizontalAlignment =
For a = 1 To Gitna
ds.Tables("tblStudents").Rows.Count .Range("H" &
.Range("A" & (nextstudent) & ":I" &
(nextstudent)).Value = "Student No. (nextstudent)).Merge()
:" .Range("H" &
.Range("C" & (nextstudent) & ":I" &
(nextstudent)).Value = (nextstudent)).BorderAround()
ds.Tables("tblStudents").Rows(a -
1).Item("studentnumber").ToString .Range("H" &
.Range("C" & (nextstudent + 1)).Value =
(nextstudent)).HorizontalAlignment = ds.Tables("tblCoinbanks").Rows(0).Ite
Kaliwa m("amount").ToString
.Range("C" & .Range("H" &
(nextstudent) & ":G" & (nextstudent +
(nextstudent)).Merge() 1)).HorizontalAlignment = Gitna
.Range("H" &
.Range("A" & (nextstudent + 1) & ":I" &
(nextstudent + 1)).Value = "Student (nextstudent + 1)).Merge()
Name :" .Range("H" &
.Range("C" & (nextstudent + 1) & ":I" &
(nextstudent + 1)).Value = (nextstudent + 1)).BorderAround()
ds.Tables("tblStudents").Rows(a -
1).Item("lastname").ToString & ", " & .Range("A" &
ds.Tables("tblStudents").Rows(a - (nextstudent) & ":B" & (nextstudent +
1).Item("firstname").ToString & " " & 1)).BorderAround()
ds.Tables("tblStudents").Rows(a - .Range("C" &
1).Item("middlename").ToString (nextstudent) & ":G" & (nextstudent +
.Range("C" & 1)).BorderAround()
(nextstudent +
1)).HorizontalAlignment = Kaliwa totalcoins =
.Range("C" & totalcoins +
(nextstudent + 1) & ":G" & CInt(ds.Tables("tblCoinbanks").Rows(0
(nextstudent + 1)).Merge() ).Item("amount").ToString)
nextstudent =
sql = "SELECT * FROM nextstudent + 3
tblCoinbanks WHERE studentid=@id"
Dim bank As New
MySqlCommand(sql, con) ds.Tables("tblCoinbanks").Clear()
Next

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 147

.Range("G" & For a = 1 To


(nextstudent)).Value = "Total Coins ds.Tables("tblStudents").Rows.Count
:" .Range("A" &
(nextstudent)).Value = "Student No.
.Range("I" & :"
(nextstudent)).Value = totalcoins .Range("C" &
.Range("I" & (nextstudent)).Value =
(nextstudent)).HorizontalAlignment = ds.Tables("tblStudents").Rows(a -
Gitna 1).Item("studentnumber").ToString
End With .Range("C" &
End Sub (nextstudent)).HorizontalAlignment =
Kaliwa
Public Sub CreatePaymentBackUp() .Range("C" &
(nextstudent) & ":I" &
xlWorkBook.Sheets.Add(After:=xlWorkBo (nextstudent)).Merge()
ok.Worksheets(xlWorkBook.Worksheets.C
ount)) .Range("A" &
xlWorkSheet = (nextstudent + 1)).Value = "Student
xlWorkBook.Sheets("Sheet6") Name :"
xlWorkSheet.Name = "Payment" .Range("C" &
(nextstudent + 1)).Value =
With xlWorkSheet ds.Tables("tblStudents").Rows(a -
.Range("A2").Value = 1).Item("lastname").ToString & ", " &
"Payment Information" ds.Tables("tblStudents").Rows(a -
.Range("A2:K2").Merge() 1).Item("firstname").ToString & " " &
ds.Tables("tblStudents").Rows(a -
.Range("A2").HorizontalAlignment = 1).Item("middlename").ToString
Gitna .Range("C" &
(nextstudent +
.Range("A3").Value = "( 1)).HorizontalAlignment = Kaliwa
Current Payment of Students )" .Range("C" &
.Range("A3:K3").Merge() (nextstudent + 1) & ":I" &
(nextstudent + 1)).Merge()
.Range("A3").HorizontalAlignment =
Gitna sql = "SELECT * FROM
tblPayments WHERE studentid=@id"
Dim payment As New
.Range("A2:K3").BorderAround() MySqlCommand(sql, con)

sql = "SELECT * FROM payment.Parameters.AddWithValue("@id"


tblStudents ORDER BY fullname ASC" , ds.Tables("tblStudents").Rows(a -
da = New 1).Item("id").ToString)
MySqlDataAdapter(sql, con) da = New
ds.Clear() MySqlDataAdapter(payment)
da.Fill(ds, da.Fill(ds,
"tblStudents") "tblPayments")

Dim nextstudent As sql = "SELECT * FROM


Integer = 5 tblDeductions WHERE studentid=@id"
Dim totalcoins As Integer Dim deduction As New
= 0 MySqlCommand(sql, con)

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 148

.Range("F" &
deduction.Parameters.AddWithValue("@i (nextstudent + 3) & ":G" &
d", ds.Tables("tblStudents").Rows(a - (nextstudent + 3)).BorderAround()
1).Item("id").ToString)
da = New .Range("H" &
MySqlDataAdapter(deduction) (nextstudent + 3)).Value = "Deposit"
da.Fill(ds, .Range("H" &
"tblDeductions") (nextstudent +
3)).HorizontalAlignment = Gitna
.Range("B" & .Range("H" &
(nextstudent + 2) & ":K" & (nextstudent + 3) & ":I" &
(nextstudent + 2)).Merge() (nextstudent + 3)).Merge()
.Range("B" & .Range("H" &
(nextstudent + 2) & ":K" & (nextstudent + 3) & ":I" &
(nextstudent + 2)).BorderAround() (nextstudent + 3)).BorderAround()

.Range("B" & .Range("J" &


(nextstudent + 3)).Value = "Tuition (nextstudent + 3)).Value =
Fee" "Deductions"
.Range("B" & .Range("J" &
(nextstudent + (nextstudent +
3)).HorizontalAlignment = Gitna 3)).HorizontalAlignment = Gitna
.Range("B" & .Range("J" &
(nextstudent + 3) & ":C" & (nextstudent + 3) & ":K" &
(nextstudent + 3)).Merge() (nextstudent + 3)).Merge()
.Range("B" & .Range("J" &
(nextstudent + 3) & ":C" & (nextstudent + 3) & ":K" &
(nextstudent + 3)).BorderAround() (nextstudent + 3)).BorderAround()

.Range("D" & .Range("B" &


(nextstudent + 3)).Value = (nextstudent + 4)).Value =
"Scholarship" ds.Tables("tblPayments").Rows(0).Item
.Range("D" & ("amount").ToString
(nextstudent + .Range("B" &
3)).HorizontalAlignment = Gitna (nextstudent +
.Range("D" & 4)).HorizontalAlignment = Gitna
(nextstudent + 3) & ":E" & .Range("B" &
(nextstudent + 3)).Merge() (nextstudent + 4) & ":C" &
.Range("D" & (nextstudent + 4)).Merge()
(nextstudent + 3) & ":E" & .Range("B" &
(nextstudent + 3)).BorderAround() (nextstudent + 4) & ":C" &
(nextstudent + 4)).BorderAround()
.Range("F" &
(nextstudent + 3)).Value = "Current .Range("D" &
Tuition" (nextstudent + 4)).Value =
.Range("F" & ds.Tables("tblPayments").Rows(0).Item
(nextstudent + ("scholarship").ToString
3)).HorizontalAlignment = Gitna .Range("D" &
.Range("F" & (nextstudent +
(nextstudent + 3) & ":G" & 4)).HorizontalAlignment = Gitna
(nextstudent + 3)).Merge()

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 149

.Range("D" & .Range("J" &


(nextstudent + 4) & ":E" & (nextstudent + 4)).Value =
(nextstudent + 4)).Merge() totaldeductions
.Range("D" & .Range("J" &
(nextstudent + 4) & ":E" & (nextstudent +
(nextstudent + 4)).BorderAround() 4)).HorizontalAlignment = Gitna
.Range("J" &
.Range("F" & (nextstudent + 4) & ":K" &
(nextstudent + 4)).Value = (nextstudent + 4)).Merge()
(Math.Ceiling(CInt(ds.Tables("tblPaym .Range("J" &
ents").Rows(0).Item("amount").ToStrin (nextstudent + 4) & ":K" &
g) - (nextstudent + 4)).BorderAround()
(CInt(ds.Tables("tblPayments").Rows(0
).Item("amount").ToString) * .Range("J" &
(CInt(ds.Tables("tblPayments").Rows(0 (nextstudent)).Value = "Balance"
).Item("scholarship").ToString) / .Range("J" &
100)))) (nextstudent)).HorizontalAlignment =
.Range("F" & Gitna
(nextstudent + .Range("J" &
4)).HorizontalAlignment = Gitna (nextstudent) & ":K" &
.Range("F" & (nextstudent)).Merge()
(nextstudent + 4) & ":G" & .Range("J" &
(nextstudent + 4)).Merge() (nextstudent) & ":K" &
.Range("F" & (nextstudent)).BorderAround()
(nextstudent + 4) & ":G" &
(nextstudent + 4)).BorderAround() .Range("J" &
(nextstudent + 1)).Value =
.Range("H" & Math.Ceiling(CInt(ds.Tables("tblPayme
(nextstudent + 4)).Value = nts").Rows(0).Item("amount").ToString
ds.Tables("tblPayments").Rows(0).Item ) -
("deposit").ToString (CInt(ds.Tables("tblPayments").Rows(0
.Range("H" & ).Item("amount").ToString) *
(nextstudent + (CInt(ds.Tables("tblPayments").Rows(0
4)).HorizontalAlignment = Gitna ).Item("scholarship").ToString) /
.Range("H" & 100))) -
(nextstudent + 4) & ":I" & CInt(ds.Tables("tblPayments").Rows(0)
(nextstudent + 4)).Merge() .Item("deposit").ToString) -
.Range("H" & totaldeductions
(nextstudent + 4) & ":I" & .Range("J" &
(nextstudent + 4)).BorderAround() (nextstudent +
1)).HorizontalAlignment = Gitna
Dim totaldeductions .Range("J" &
As Integer = 0 (nextstudent + 1) & ":K" &
(nextstudent + 1)).Merge()
For d = 1 To .Range("J" &
ds.Tables("tblDeductions").Rows.Count (nextstudent + 1) & ":K" &
totaldeductions = (nextstudent + 1)).BorderAround()
totaldeductions +
CInt(ds.Tables("tblDeductions").Rows( .Range("A" &
d - 1).Item("amount").ToString) (nextstudent) & ":B" & (nextstudent +
Next 1)).BorderAround()

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 150

.Range("C" &
(nextstudent) & ":I" & (nextstudent + Dim nextstudent As
1)).BorderAround() Integer = 5
Dim nextmonth As Integer
nextstudent = = nextstudent + 3
nextstudent + 6 Dim totaldeductions As
Integer = 0
Dim totalamount As
ds.Tables("tblPayments").Clear() Integer = 0
Dim totaldeposit As
ds.Tables("tblDeductions").Clear() Integer = 0
Next
End With For a = 1 To
End Sub ds.Tables("tblStudents").Rows.Count
totalamount = 0
Public Sub totaldeposit = 0
CreateTransactionHistoryBackUp() totaldeductions = 0

xlWorkBook.Sheets.Add(After:=xlWorkBo .Range("A" &


ok.Worksheets(xlWorkBook.Worksheets.C (nextstudent)).Value = "Student No.
ount)) :"
xlWorkSheet = .Range("C" &
xlWorkBook.Sheets("Sheet7") (nextstudent)).Value =
xlWorkSheet.Name = ds.Tables("tblStudents").Rows(a -
"Transaction" 1).Item("studentnumber").ToString
.Range("C" &
With xlWorkSheet (nextstudent)).HorizontalAlignment =
.Range("A2").Value = Kaliwa
"Transaction History" .Range("C" &
.Range("A2:I2").Merge() (nextstudent) & ":F" &
(nextstudent)).Merge()
.Range("A2").HorizontalAlignment =
Gitna .Range("A" &
(nextstudent + 1)).Value = "Student
.Range("A3").Value = "( Name :"
List of Student's Transaction every .Range("C" &
Month )" (nextstudent + 1)).Value =
.Range("A3:I3").Merge() ds.Tables("tblStudents").Rows(a -
1).Item("lastname").ToString & ", " &
.Range("A3").HorizontalAlignment = ds.Tables("tblStudents").Rows(a -
Gitna 1).Item("firstname").ToString & " " &
ds.Tables("tblStudents").Rows(a -
1).Item("middlename").ToString
.Range("A2:I3").BorderAround() .Range("C" &
(nextstudent +
sql = "SELECT * FROM 1)).HorizontalAlignment = Kaliwa
tblStudents ORDER BY fullname ASC" .Range("C" &
da = New (nextstudent + 1) & ":F" &
MySqlDataAdapter(sql, con) (nextstudent + 1)).Merge()
ds.Clear()
da.Fill(ds, sql = "SELECT * FROM
"tblStudents") tblPayments WHERE studentid=@id"

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 151

Dim payment As New CInt(ds.Tables("tblDeductions").Rows(


MySqlCommand(sql, con) d - 1).Item("amount").ToString)
Next
payment.Parameters.AddWithValue("@id" End If
, ds.Tables("tblStudents").Rows(a -
1).Item("id").ToString) .Range("A" &
da = New (nextstudent) & ":B" & (nextstudent +
MySqlDataAdapter(payment) 1)).BorderAround()
da.Fill(ds, .Range("C" &
"tblPayments") (nextstudent) & ":G" & (nextstudent +
1)).BorderAround()
sql = "SELECT * FROM
tblDeductions WHERE studentid=@id" .Range("H" &
Dim deductions As New (nextstudent)).Value = "Total
MySqlCommand(sql, con) Deposit"
.Range("H" &
deductions.Parameters.AddWithValue("@ (nextstudent)).HorizontalAlignment =
id", ds.Tables("tblStudents").Rows(a Gitna
- 1).Item("id").ToString) .Range("H" &
da = New (nextstudent) & ":I" &
MySqlDataAdapter(deductions) (nextstudent)).Merge()
da.Fill(ds, .Range("H" &
"tblDeductions") (nextstudent) & ":I" &
(nextstudent)).BorderAround()
sql = "SELECT * FROM
tblTransactions WHERE studentid=@id" .Range("H" &
Dim transactions As (nextstudent + 1)).Value =
New MySqlCommand(sql, con) CInt(ds.Tables("tblPayments").Rows(0)
.Item("deposit").ToString) +
transactions.Parameters.AddWithValue( totaldeductions
"@id", .Range("H" &
ds.Tables("tblStudents").Rows(a - (nextstudent +
1).Item("id").ToString) 1)).HorizontalAlignment = Gitna
da = New .Range("H" &
MySqlDataAdapter(transactions) (nextstudent + 1) & ":I" &
da.Fill(ds, (nextstudent + 1)).Merge()
"tblTransactions") .Range("H" &
(nextstudent + 1) & ":I" &
.Range("B" & (nextstudent + 1)).BorderAround()
(nextstudent + 2) & ":I" &
(nextstudent + 2)).Merge() Dim transactioncount
.Range("B" & As Integer = 0
(nextstudent + 2) & ":I" & Dim lastcell As
(nextstudent + 2)).BorderAround() Integer = 0

If If
ds.Tables("tblDeductions").Rows.Count ds.Tables("tblTransactions").Rows.Cou
> 0 Then nt > 0 Then
For d = 1 To Dim currmonth As
ds.Tables("tblDeductions").Rows.Count Integer = 0
Dim prevmonth As
totaldeductions = totaldeductions + Integer =

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 152

CDate(ds.Tables("tblTransactions").Ro nextmonth
ws(0).Item("transactiondate").ToStrin = nextmonth + transactioncount + 2
g).Month
Dim curryear As transactioncount = 1
Integer = 0
Dim prevyear As totalamount = 0
Integer = End If
CDate(ds.Tables("tblTransactions").Ro
ws(0).Item("transactiondate").ToStrin totalamount =
g).Year totalamount +
CInt(ds.Tables("tblTransactions").Row
For t = 1 To s(t - 1).Item("amount").ToString)
ds.Tables("tblTransactions").Rows.Cou
nt .Range("B" &
curryear = (nextmonth)).Value = "Month :"
CDate(ds.Tables("tblTransactions").Ro .Range("B" &
ws(t - (nextmonth + 1)).Value = "Year :"
1).Item("transactiondate").ToString).
Year .Range("B" &
currmonth = (nextmonth) & ":B" & (nextmonth +
CDate(ds.Tables("tblTransactions").Ro 1)).BorderAround()
ws(t -
1).Item("transactiondate").ToString). .Range("C" &
Month (nextmonth)).Value =
MonthName(currmonth)
If prevyear = .Range("C" &
curryear Then (nextmonth)).HorizontalAlignment =
If Kaliwa
prevmonth = currmonth Then .Range("C" &
(nextmonth) & ":D" &
transactioncount = transactioncount + (nextmonth)).Merge()
1 .Range("C" &
Else (nextmonth + 1)).Value = curryear
.Range("C" &
.Range("B" & (nextmonth + 2) & ":I" & (nextmonth + 1)).HorizontalAlignment
(nextmonth + transactioncount + = Kaliwa
1)).BorderAround() .Range("C" &
(nextmonth + 1) & ":D" & (nextmonth +
1)).Merge()
nextmonth = nextmonth +
transactioncount + 2 .Range("C" &
(nextmonth) & ":D" & (nextmonth +
transactioncount = 1 1)).BorderAround()

totalamount = 0 .Range("E" &


End If (nextmonth)).Value = "Day"
Else .Range("E" &
(nextmonth)).HorizontalAlignment =
.Range("B" & (nextmonth + 2) & ":I" & Gitna
(nextmonth + transactioncount + .Range("E" &
1)).BorderAround() (nextmonth)).BorderAround()

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 153

.Range("F" & .Range("F" &


(nextmonth)).Value = "Amount" (nextmonth) & ":G" &
.Range("F" & (nextmonth)).Merge()
(nextmonth)).HorizontalAlignment =
Gitna
.Range("F" & .Range("H" &
(nextmonth) & ":G" & (nextmonth + 1)).HorizontalAlignment
(nextmonth)).BorderAround() = Gitna
.Range("H" &
.Range("H" & (nextmonth + 1) & ":I" & (nextmonth +
(nextmonth)).Value = "Total Amount" 1)).Merge()
.Range("H" & .Range("H" &
(nextmonth)).HorizontalAlignment = (nextmonth + 1) & ":I" & (nextmonth +
Gitna 1)).BorderAround()
.Range("H" &
(nextmonth) & ":I" & .Range("E" &
(nextmonth)).Merge() (nextmonth + transactioncount)).Value
.Range("H" & =
(nextmonth) & ":I" & CDate(ds.Tables("tblTransactions").Ro
(nextmonth)).BorderAround() ws(t -
1).Item("transactiondate").ToString).
.Range("H" & Day
(nextmonth + 1)).Value = totalamount
.Range("E" & lastcell =
(nextmonth + nextmonth + transactioncount
transactioncount)).HorizontalAlignmen Next
t = Gitna
.Range("E" & nextstudent =
(nextmonth + lastcell + 2
transactioncount)).BorderAround() nextmonth =
nextstudent + 3
.Range("F" & transactioncount
(nextmonth + transactioncount)).Value = 1
= ds.Tables("tblTransactions").Rows(t Else
- 1).Item("amount").ToString nextstudent =
.Range("F" & nextstudent + 4
(nextmonth + nextmonth =
transactioncount)).HorizontalAlignmen nextstudent + 3
t = Gitna transactioncount
.Range("F" & = 1
(nextmonth + transactioncount) & ":G" End If
& (nextmonth +
transactioncount)).Merge()
.Range("F" & ds.Tables("tblPayments").Clear()
(nextmonth + transactioncount) & ":G"
& (nextmonth + ds.Tables("tblDeductions").Clear()
transactioncount)).BorderAround()
ds.Tables("tblTransactions").Clear()
prevyear = Next
curryear End With
prevmonth = End Sub
currmonth

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 154

Public Sub totaldeductions = 0


CreateDepositHistoryBackUp()
.Range("A" &
xlWorkBook.Sheets.Add(After:=xlWorkBo (nextstudent)).Value = "Student No.
ok.Worksheets(xlWorkBook.Worksheets.C :"
ount)) .Range("C" &
xlWorkSheet = (nextstudent)).Value =
xlWorkBook.Sheets("Sheet8") ds.Tables("tblStudents").Rows(a -
xlWorkSheet.Name = "Deposit" 1).Item("studentnumber").ToString
.Range("C" &
With xlWorkSheet (nextstudent)).HorizontalAlignment =
.Range("A2").Value = Kaliwa
"Coin Bank History (Deposit)" .Range("C" &
.Range("A2:I2").Merge() (nextstudent) & ":F" &
(nextstudent)).Merge()
.Range("A2").HorizontalAlignment =
Gitna .Range("A" &
(nextstudent + 1)).Value = "Student
.Range("A3").Value = "( Name :"
List of Student's Deposit every .Range("C" &
Month )" (nextstudent + 1)).Value =
.Range("A3:I3").Merge() ds.Tables("tblStudents").Rows(a -
1).Item("lastname").ToString & ", " &
.Range("A3").HorizontalAlignment = ds.Tables("tblStudents").Rows(a -
Gitna 1).Item("firstname").ToString & " " &
ds.Tables("tblStudents").Rows(a -
1).Item("middlename").ToString
.Range("A2:I3").BorderAround() .Range("C" &
(nextstudent +
sql = "SELECT * FROM 1)).HorizontalAlignment = Kaliwa
tblStudents ORDER BY fullname ASC" .Range("C" &
da = New (nextstudent + 1) & ":F" &
MySqlDataAdapter(sql, con) (nextstudent + 1)).Merge()
ds.Clear()
da.Fill(ds, sql = "SELECT * FROM
"tblStudents") tblCoinbanks WHERE studentid=@id"
Dim coinbank As New
Dim nextstudent As MySqlCommand(sql, con)
Integer = 5
Dim nextmonth As Integer coinbank.Parameters.AddWithValue("@id
= nextstudent + 3 ", ds.Tables("tblStudents").Rows(a -
Dim totaldeductions As 1).Item("id").ToString)
Integer = 0 da = New
Dim totalamount As MySqlDataAdapter(coinbank)
Integer = 0 da.Fill(ds,
Dim totaldeposit As "tblCoinbanks")
Integer = 0
sql = "SELECT * FROM
For a = 1 To tblDeposits WHERE studentid=@id"
ds.Tables("tblStudents").Rows.Count Dim deposits As New
totalamount = 0 MySqlCommand(sql, con)
totaldeposit = 0

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 155

Dim lastcell As
deposits.Parameters.AddWithValue("@id Integer = 0
", ds.Tables("tblStudents").Rows(a -
1).Item("id").ToString) If
da = New ds.Tables("tblDeposits").Rows.Count >
MySqlDataAdapter(deposits) 0 Then
da.Fill(ds, Dim currmonth As
"tblDeposits") Integer = 0
Dim prevmonth As
.Range("B" & Integer =
(nextstudent + 2) & ":I" & CDate(ds.Tables("tblDeposits").Rows(0
(nextstudent + 2)).Merge() ).Item("depositdate").ToString).Month
.Range("B" & Dim curryear As
(nextstudent + 2) & ":I" & Integer = 0
(nextstudent + 2)).BorderAround() Dim prevyear As
Integer =
.Range("A" & CDate(ds.Tables("tblDeposits").Rows(0
(nextstudent) & ":B" & (nextstudent + ).Item("depositdate").ToString).Year
1)).BorderAround()
.Range("C" & For t = 1 To
(nextstudent) & ":G" & (nextstudent + ds.Tables("tblDeposits").Rows.Count
1)).BorderAround() curryear =
CDate(ds.Tables("tblDeposits").Rows(t
.Range("H" & -
(nextstudent)).Value = "Total 1).Item("depositdate").ToString).Year
Deposit" currmonth =
.Range("H" & CDate(ds.Tables("tblDeposits").Rows(t
(nextstudent)).HorizontalAlignment = -
Gitna 1).Item("depositdate").ToString).Mont
.Range("H" & h
(nextstudent) & ":I" &
(nextstudent)).Merge() If prevyear =
.Range("H" & curryear Then
(nextstudent) & ":I" & If
(nextstudent)).BorderAround() prevmonth = currmonth Then

.Range("H" & transactioncount = transactioncount +


(nextstudent + 1)).Value = 1
CInt(ds.Tables("tblCoinbanks").Rows(0 Else
).Item("amount").ToString)
.Range("H" & .Range("B" & (nextmonth + 2) & ":I" &
(nextstudent + (nextmonth + transactioncount +
1)).HorizontalAlignment = Gitna 1)).BorderAround()
.Range("H" &
(nextstudent + 1) & ":I" &
(nextstudent + 1)).Merge() nextmonth = nextmonth +
.Range("H" & transactioncount + 2
(nextstudent + 1) & ":I" &
(nextstudent + 1)).BorderAround() transactioncount = 1

Dim transactioncount totalamount = 0


As Integer = 0 End If

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 156

Else .Range("E" &


(nextmonth)).HorizontalAlignment =
.Range("B" & (nextmonth + 2) & ":I" & Gitna
(nextmonth + transactioncount + .Range("E" &
1)).BorderAround() (nextmonth)).BorderAround()

nextmonth .Range("F" &


= nextmonth + transactioncount + 2 (nextmonth)).Value = "Amount"
.Range("F" &
transactioncount = 1 (nextmonth)).HorizontalAlignment =
Gitna
totalamount = 0 .Range("F" &
End If (nextmonth) & ":G" &
(nextmonth)).Merge()
totalamount = .Range("F" &
totalamount + (nextmonth) & ":G" &
CInt(ds.Tables("tblDeposits").Rows(t (nextmonth)).BorderAround()
- 1).Item("amount").ToString)
.Range("H" &
.Range("B" & (nextmonth)).Value = "Total Amount"
(nextmonth)).Value = "Month :" .Range("H" &
.Range("B" & (nextmonth)).HorizontalAlignment =
(nextmonth + 1)).Value = "Year :" Gitna
.Range("H" &
.Range("B" & (nextmonth) & ":I" &
(nextmonth) & ":B" & (nextmonth + (nextmonth)).Merge()
1)).BorderAround() .Range("H" &
(nextmonth) & ":I" &
.Range("C" & (nextmonth)).BorderAround()
(nextmonth)).Value =
MonthName(currmonth) .Range("H" &
.Range("C" & (nextmonth + 1)).Value = totalamount
(nextmonth)).HorizontalAlignment = .Range("H" &
Kaliwa (nextmonth + 1)).HorizontalAlignment
.Range("C" & = Gitna
(nextmonth) & ":D" & .Range("H" &
(nextmonth)).Merge() (nextmonth + 1) & ":I" & (nextmonth +
.Range("C" & 1)).Merge()
(nextmonth + 1)).Value = curryear .Range("H" &
.Range("C" & (nextmonth + 1) & ":I" & (nextmonth +
(nextmonth + 1)).HorizontalAlignment 1)).BorderAround()
= Kaliwa
.Range("C" & .Range("E" &
(nextmonth + 1) & ":D" & (nextmonth + (nextmonth + transactioncount)).Value
1)).Merge() =
CDate(ds.Tables("tblDeposits").Rows(t
.Range("C" & -
(nextmonth) & ":D" & (nextmonth + 1).Item("depositdate").ToString).Day
1)).BorderAround() .Range("E" &
(nextmonth +
.Range("E" & transactioncount)).HorizontalAlignmen
(nextmonth)).Value = "Day" t = Gitna

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 157

.Range("E" & Public Sub


(nextmonth + CreateDeductionBackUp()
transactioncount)).BorderAround()
xlWorkBook.Sheets.Add(After:=xlWorkBo
.Range("F" & ok.Worksheets(xlWorkBook.Worksheets.C
(nextmonth + transactioncount)).Value ount))
= ds.Tables("tblDeposits").Rows(t - xlWorkSheet =
1).Item("amount").ToString xlWorkBook.Sheets("Sheet9")
.Range("F" & xlWorkSheet.Name =
(nextmonth + "Deduction"
transactioncount)).HorizontalAlignmen
t = Gitna With xlWorkSheet
.Range("F" & .Range("A2").Value =
(nextmonth + transactioncount) & ":G" "Deduction History"
& (nextmonth + .Range("A2:I2").Merge()
transactioncount)).Merge()
.Range("F" & .Range("A2").HorizontalAlignment =
(nextmonth + transactioncount) & ":G" Gitna
& (nextmonth +
transactioncount)).BorderAround() .Range("A3").Value = "(
Payments validated by Accounting )"
prevyear = .Range("A3:I3").Merge()
curryear
prevmonth = .Range("A3").HorizontalAlignment =
currmonth Gitna
lastcell =
nextmonth + transactioncount
Next .Range("A2:I3").BorderAround()

nextstudent = sql = "SELECT * FROM


lastcell + 2 tblStudents ORDER BY fullname ASC"
nextmonth = da = New
nextstudent + 3 MySqlDataAdapter(sql, con)
transactioncount ds.Clear()
= 1 da.Fill(ds,
Else "tblStudents")
nextstudent =
nextstudent + 4 Dim nextstudent As
nextmonth = Integer = 5
nextstudent + 3 Dim nextmonth As Integer
transactioncount = nextstudent + 3
= 1 Dim totaldeductions As
End If Integer = 0
Dim totalamount As
Integer = 0
ds.Tables("tblDeposits").Clear() Dim totaldeposit As
Integer = 0
ds.Tables("tblCoinbanks").Clear()
Next For a = 1 To
End With ds.Tables("tblStudents").Rows.Count
End Sub totalamount = 0
totaldeposit = 0

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 158

totaldeductions = 0
totaldeductions = totaldeductions +
.Range("A" & CInt(ds.Tables("tblDeductions").Rows(
(nextstudent)).Value = "Student No. d - 1).Item("amount").ToString)
:" Next
.Range("C" & End If
(nextstudent)).Value =
ds.Tables("tblStudents").Rows(a - .Range("C" &
1).Item("studentnumber").ToString (nextstudent + 2) & ":H" &
.Range("C" & (nextstudent + 2)).Merge()
(nextstudent)).HorizontalAlignment = .Range("C" &
Kaliwa (nextstudent + 2) & ":H" &
.Range("C" & (nextstudent + 2)).BorderAround()
(nextstudent) & ":F" &
(nextstudent)).Merge() .Range("A" &
(nextstudent) & ":B" & (nextstudent +
.Range("A" & 1)).BorderAround()
(nextstudent + 1)).Value = "Student .Range("C" &
Name :" (nextstudent) & ":G" & (nextstudent +
.Range("C" & 1)).BorderAround()
(nextstudent + 1)).Value =
ds.Tables("tblStudents").Rows(a - .Range("H" &
1).Item("lastname").ToString & ", " & (nextstudent)).Value = "Total Amount"
ds.Tables("tblStudents").Rows(a - .Range("H" &
1).Item("firstname").ToString & " " & (nextstudent)).HorizontalAlignment =
ds.Tables("tblStudents").Rows(a - Gitna
1).Item("middlename").ToString .Range("H" &
.Range("C" & (nextstudent) & ":I" &
(nextstudent + (nextstudent)).Merge()
1)).HorizontalAlignment = Kaliwa .Range("H" &
.Range("C" & (nextstudent) & ":I" &
(nextstudent + 1) & ":F" & (nextstudent)).BorderAround()
(nextstudent + 1)).Merge()
.Range("H" &
sql = "SELECT * FROM (nextstudent + 1)).Value =
tblDeductions WHERE studentid=@id" totaldeductions
Dim deductions As New .Range("H" &
MySqlCommand(sql, con) (nextstudent +
1)).HorizontalAlignment = Gitna
deductions.Parameters.AddWithValue("@ .Range("H" &
id", ds.Tables("tblStudents").Rows(a (nextstudent + 1) & ":I" &
- 1).Item("id").ToString) (nextstudent + 1)).Merge()
da = New .Range("H" &
MySqlDataAdapter(deductions) (nextstudent + 1) & ":I" &
da.Fill(ds, (nextstudent + 1)).BorderAround()
"tblDeductions")
Dim transactioncount
If As Integer = 0
ds.Tables("tblDeductions").Rows.Count Dim lastcell As
> 0 Then Integer = 0
For d = 1 To
ds.Tables("tblDeductions").Rows.Count

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 159

If
ds.Tables("tblDeductions").Rows.Count .Range("G" &
> 0 Then (nextstudent + 4) & ":H" &
.Range("C" & (nextstudent + 4)).Merge()
(nextstudent + 3)).Value = "Date of .Range("G" &
Validation" (nextstudent + 3) & ":H" &
.Range("C" & (nextstudent + 4)).BorderAround()
(nextstudent +
3)).HorizontalAlignment = Gitna For t = 1 To
.Range("C" & ds.Tables("tblDeductions").Rows.Count
(nextstudent + 3) & ":F" & .Range("C" &
(nextstudent + 3)).Merge() (nextstudent + 4 + t)).Value =
.Range("C" & MonthName(CDate(ds.Tables("tblDeducti
(nextstudent + 3) & ":F" & ons").Rows(t -
(nextstudent + 3)).BorderAround() 1).Item("deductiondate").ToString).Mo
nth)
.Range("G" & .Range("C" &
(nextstudent + 3)).Value = "Amount" (nextstudent + 4 +
.Range("G" & t)).HorizontalAlignment = Gitna
(nextstudent + .Range("C" &
3)).HorizontalAlignment = Gitna (nextstudent + 4 + t) & ":D" &
.Range("G" & (nextstudent + 4 + t)).Merge()
(nextstudent + 3) & ":H" & .Range("C" &
(nextstudent + 3)).Merge() (nextstudent + 4 + t) & ":D" &
(nextstudent + 4 + t)).BorderAround()
.Range("C" &
(nextstudent + 4)).Value = "Month" .Range("E" &
.Range("C" & (nextstudent + 4 + t)).Value =
(nextstudent + CDate(ds.Tables("tblDeductions").Rows
4)).HorizontalAlignment = Gitna (t -
.Range("C" & 1).Item("deductiondate").ToString).Da
(nextstudent + 4) & ":D" & y
(nextstudent + 4)).Merge() .Range("E" &
.Range("C" & (nextstudent + 4 +
(nextstudent + 4) & ":D" & t)).HorizontalAlignment = Gitna
(nextstudent + 4)).BorderAround() .Range("E" &
(nextstudent + 4 + t)).BorderAround()
.Range("E" &
(nextstudent + 4)).Value = "Day" .Range("F" &
.Range("E" & (nextstudent + 4 + t)).Value =
(nextstudent + CDate(ds.Tables("tblDeductions").Rows
4)).HorizontalAlignment = Gitna (t -
.Range("E" & 1).Item("deductiondate").ToString).Ye
(nextstudent + 4)).BorderAround() ar
.Range("F" &
.Range("F" & (nextstudent + 4 +
(nextstudent + 4)).Value = "Year" t)).HorizontalAlignment = Gitna
.Range("F" & .Range("F" &
(nextstudent + (nextstudent + 4 + t)).BorderAround()
4)).HorizontalAlignment = Gitna
.Range("F" & .Range("G" &
(nextstudent + 4)).BorderAround() (nextstudent + 4 + t)).Value =

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 160

(ds.Tables("tblDeductions").Rows(t - .Range("A3").Value = "(


1).Item("amount").ToString) Previous Payments of Students )"
.Range("G" & .Range("A3:I3").Merge()
(nextstudent + 4 +
t)).HorizontalAlignment = Gitna .Range("A3").HorizontalAlignment =
.Range("G" & Gitna
(nextstudent + 4 + t) & ":H" &
(nextstudent + 4 + t)).Merge()
.Range("G" & .Range("A2:I3").BorderAround()
(nextstudent + 4 + t) & ":H" &
(nextstudent + 4 + t)).BorderAround() Dim students() As DataRow
Next = tbl_students.Select("", "lastname
ASC, firstname ASC")
nextstudent = Dim nextstudent As
nextstudent + Integer = 5
ds.Tables("tblDeductions").Rows.Count Dim totalcoins As Integer
+ 6 = 0
transactioncount Dim totaldeductions As
= 1 Integer = 0
Else
nextstudent = For a = 1 To
nextstudent + 4 students.Count
transactioncount .Range("A" &
= 1 (nextstudent)).Value = "Student No.
End If :"
.Range("C" &
(nextstudent)).Value = students(a -
ds.Tables("tblDeductions").Clear() 1).Item("studentnumber").ToString
Next .Range("C" &
End With (nextstudent)).HorizontalAlignment =
End Sub Kaliwa
.Range("C" &
Public Sub (nextstudent) & ":H" &
CreateOldPaymentBackUp() (nextstudent)).Merge()

xlWorkBook.Sheets.Add(After:=xlWorkBo .Range("A" &


ok.Worksheets(xlWorkBook.Worksheets.C (nextstudent + 1)).Value = "Student
ount)) Name :"
xlWorkSheet = .Range("C" &
xlWorkBook.Sheets("Sheet10") (nextstudent + 1)).Value = students(a
xlWorkSheet.Name = "Old - 1).Item("lastname").ToString & ", "
Payment" & students(a -
1).Item("firstname").ToString & " " &
With xlWorkSheet students(a -
.Range("A2").Value = "Old 1).Item("middlename").ToString
Payment Information" .Range("C" &
.Range("A2:I2").Merge() (nextstudent +
1)).HorizontalAlignment = Kaliwa
.Range("A2").HorizontalAlignment = .Range("C" &
Gitna (nextstudent + 1) & ":H" &
(nextstudent + 1)).Merge()

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 161

Dim payment() As .Range("B" &


DataRow = (nextstudent + 3 + ((p - 1) *
tbl_oldpayments.Select("studentnumber 5))).HorizontalAlignment = Gitna
=" & students(a - .Range("B" &
1).Item("studentnumber"), (nextstudent + 3 + ((p - 1) * 5)) &
"paymentnumber ASC") ":C" & (nextstudent + 3 + ((p - 1) *
5))).Merge()
.Range("B" & .Range("B" &
(nextstudent + 2) & ":I" & (nextstudent + 3 + ((p - 1) * 5)) &
(nextstudent + 2)).Merge() ":C" & (nextstudent + 3 + ((p - 1) *
.Range("B" & 5))).BorderAround()
(nextstudent + 2) & ":I" &
(nextstudent + 2)).BorderAround() .Range("D" &
(nextstudent + 3 + ((p - 1) *
.Range("A" & 5))).Value = "Tuition Fee"
(nextstudent) & ":B" & (nextstudent + .Range("D" &
1)).BorderAround() (nextstudent + 3 + ((p - 1) *
.Range("C" & 5))).HorizontalAlignment = Gitna
(nextstudent) & ":H" & (nextstudent + .Range("D" &
1)).BorderAround() (nextstudent + 3 + ((p - 1) * 5)) &
":E" & (nextstudent + 3 + ((p - 1) *
If payment.Count > 0 5))).Merge()
Then .Range("D" &
For p = 1 To (nextstudent + 3 + ((p - 1) * 5)) &
payment.Count ":E" & (nextstudent + 3 + ((p - 1) *
5))).BorderAround()
totaldeductions = 0
.Range("F" &
Dim (nextstudent + 3 + ((p - 1) *
deduction() As DataRow = 5))).Value = "Scholarship"
tbl_olddeductions.Select("studentnumb .Range("F" &
er=" & students(a - (nextstudent + 3 + ((p - 1) *
1).Item("studentnumber") & " AND 5))).HorizontalAlignment = Gitna
paymentnumber=" & payment(p - .Range("F" &
1).Item("paymentnumber")) (nextstudent + 3 + ((p - 1) * 5)) &
":G" & (nextstudent + 3 + ((p - 1) *
If 5))).Merge()
deduction.Count > 0 Then .Range("F" &
For d = 1 (nextstudent + 3 + ((p - 1) * 5)) &
To deduction.Count ":G" & (nextstudent + 3 + ((p - 1) *
5))).BorderAround()
totaldeductions = totaldeductions +
CInt(deduction(d - .Range("H" &
1).Item("amount").ToString) (nextstudent + 3 + ((p - 1) *
Next 5))).Value = "Current Tuition"
End If .Range("H" &
(nextstudent + 3 + ((p - 1) *
.Range("B" & 5))).HorizontalAlignment = Gitna
(nextstudent + 3 + ((p - 1) * .Range("H" &
5))).Value = "Payment #" (nextstudent + 3 + ((p - 1) * 5)) &
":I" & (nextstudent + 3 + ((p - 1) *
5))).Merge()

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 162

.Range("H" & 5))).Value = payment(p -


(nextstudent + 3 + ((p - 1) * 5)) & 1).Item("paymentnumber").ToString
":I" & (nextstudent + 3 + ((p - 1) * .Range("B" &
5))).BorderAround() (nextstudent + 5 + ((p - 1) *
5))).HorizontalAlignment = Gitna
.Range("D" & .Range("B" &
(nextstudent + 5 + ((p - 1) * (nextstudent + 5 + ((p - 1) * 5)) &
5))).Value = "Deposit" ":C" & (nextstudent + 5 + ((p - 1) *
.Range("D" & 5))).Merge()
(nextstudent + 5 + ((p - 1) * .Range("B" &
5))).HorizontalAlignment = Gitna (nextstudent + 4 + ((p - 1) * 5)) &
.Range("D" & ":C" & (nextstudent + 6 + ((p - 1) *
(nextstudent + 5 + ((p - 1) * 5)) & 5))).BorderAround()
":E" & (nextstudent + 5 + ((p - 1) *
5))).Merge() .Range("D" &
.Range("D" & (nextstudent + 4 + ((p - 1) *
(nextstudent + 5 + ((p - 1) * 5)) & 5))).Value = payment(p -
":E" & (nextstudent + 5 + ((p - 1) * 1).Item("amount").ToString
5))).BorderAround() .Range("D" &
(nextstudent + 4 + ((p - 1) *
.Range("F" & 5))).HorizontalAlignment = Gitna
(nextstudent + 5 + ((p - 1) * .Range("D" &
5))).Value = "Deductions" (nextstudent + 4 + ((p - 1) * 5)) &
.Range("F" & ":E" & (nextstudent + 4 + ((p - 1) *
(nextstudent + 5 + ((p - 1) * 5))).Merge()
5))).HorizontalAlignment = Gitna .Range("D" &
.Range("F" & (nextstudent + 4 + ((p - 1) * 5)) &
(nextstudent + 5 + ((p - 1) * 5)) & ":E" & (nextstudent + 4 + ((p - 1) *
":G" & (nextstudent + 5 + ((p - 1) * 5))).BorderAround()
5))).Merge()
.Range("F" & .Range("F" &
(nextstudent + 5 + ((p - 1) * 5)) & (nextstudent + 4 + ((p - 1) *
":G" & (nextstudent + 5 + ((p - 1) * 5))).Value = payment(p -
5))).BorderAround() 1).Item("scholarship").ToString
.Range("F" &
.Range("H" & (nextstudent + 4 + ((p - 1) *
(nextstudent + 5 + ((p - 1) * 5))).HorizontalAlignment = Gitna
5))).Value = "Balance" .Range("F" &
.Range("H" & (nextstudent + 4 + ((p - 1) * 5)) &
(nextstudent + 5 + ((p - 1) * ":G" & (nextstudent + 4 + ((p - 1) *
5))).HorizontalAlignment = Gitna 5))).Merge()
.Range("H" & .Range("F" &
(nextstudent + 5 + ((p - 1) * 5)) & (nextstudent + 4 + ((p - 1) * 5)) &
":I" & (nextstudent + 5 + ((p - 1) * ":G" & (nextstudent + 4 + ((p - 1) *
5))).Merge() 5))).BorderAround()
.Range("H" &
(nextstudent + 5 + ((p - 1) * 5)) & .Range("H" &
":I" & (nextstudent + 5 + ((p - 1) * (nextstudent + 4 + ((p - 1) *
5))).BorderAround() 5))).Value =
(Math.Ceiling(CInt(payment(p -
.Range("B" & 1).Item("amount").ToString) -
(nextstudent + 5 + ((p - 1) * (CInt(payment(p -

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 163

1).Item("amount").ToString) * 1).Item("amount").ToString) *
(CInt(payment(p - (CInt(payment(p -
1).Item("scholarship").ToString) / 1).Item("scholarship").ToString) /
100)))) 100))) - CInt(payment(p -
.Range("H" & 1).Item("deposit").ToString) -
(nextstudent + 4 + ((p - 1) * totaldeductions
5))).HorizontalAlignment = Gitna .Range("H" &
.Range("H" & (nextstudent + 6 + ((p - 1) *
(nextstudent + 4 + ((p - 1) * 5)) & 5))).HorizontalAlignment = Gitna
":I" & (nextstudent + 4 + ((p - 1) * .Range("H" &
5))).Merge() (nextstudent + 6 + ((p - 1) * 5)) &
.Range("H" & ":I" & (nextstudent + 6 + ((p - 1) *
(nextstudent + 4 + ((p - 1) * 5)) & 5))).Merge()
":I" & (nextstudent + 4 + ((p - 1) * .Range("H" &
5))).BorderAround() (nextstudent + 6 + ((p - 1) * 5)) &
":I" & (nextstudent + 6 + ((p - 1) *
.Range("D" & 5))).BorderAround()
(nextstudent + 6 + ((p - 1) *
5))).Value = payment(p - If Not p =
1).Item("deposit").ToString payment.Count Then
.Range("D" &
(nextstudent + 6 + ((p - 1) * .Range("B" & (nextstudent + 7 + ((p -
5))).HorizontalAlignment = Gitna 1) * 5)) & ":I" & (nextstudent + 7 +
.Range("D" & ((p - 1) * 5))).Merge()
(nextstudent + 6 + ((p - 1) * 5)) &
":E" & (nextstudent + 6 + ((p - 1) * .Range("B" & (nextstudent + 7 + ((p -
5))).Merge() 1) * 5)) & ":I" & (nextstudent + 7 +
.Range("D" & ((p - 1) * 5))).BorderAround()
(nextstudent + 6 + ((p - 1) * 5)) & End If
":E" & (nextstudent + 6 + ((p - 1) * Next
5))).BorderAround()
nextstudent =
.Range("F" & nextstudent + (payment.Count * 5) + 3
(nextstudent + 6 + ((p - 1) * Else
5))).Value = totaldeductions nextstudent =
.Range("F" & nextstudent + 4
(nextstudent + 6 + ((p - 1) * End If
5))).HorizontalAlignment = Gitna Next
.Range("F" & End With
(nextstudent + 6 + ((p - 1) * 5)) & End Sub
":G" & (nextstudent + 6 + ((p - 1) *
5))).Merge() Public Sub
.Range("F" & CreateOldTransactionHistoryBackUp()
(nextstudent + 6 + ((p - 1) * 5)) &
":G" & (nextstudent + 6 + ((p - 1) * xlWorkBook.Sheets.Add(After:=xlWorkBo
5))).BorderAround() ok.Worksheets(xlWorkBook.Worksheets.C
.Range("H" & ount))
(nextstudent + 6 + ((p - 1) * xlWorkSheet =
5))).Value = xlWorkBook.Sheets("Sheet11")
Math.Ceiling(CInt(payment(p - xlWorkSheet.Name = "Old
1).Item("amount").ToString) - Transaction"
(CInt(payment(p -

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 164

With xlWorkSheet .Range("C" &


.Range("A2").Value = "Old (nextstudent + 1)).Value = students(a
Transaction History" - 1).Item("lastname").ToString & ", "
.Range("A2:K2").Merge() & students(a -
1).Item("firstname").ToString & " " &
.Range("A2").HorizontalAlignment = students(a -
Gitna 1).Item("middlename").ToString
.Range("C" &
.Range("A3").Value = "( (nextstudent +
List of Student's Old Transaction per 1)).HorizontalAlignment = Kaliwa
Previous Payment )" .Range("C" &
.Range("A3:K3").Merge() (nextstudent + 1) & ":I" &
(nextstudent + 1)).Merge()
.Range("A3").HorizontalAlignment =
Gitna .Range("A" &
(nextstudent) & ":B" & (nextstudent +
1)).BorderAround()
.Range("A2:K3").BorderAround() .Range("C" &
(nextstudent) & ":I" & (nextstudent +
Dim students() As DataRow 1)).BorderAround()
= tbl_students.Select("", "lastname
ASC, firstname ASC") .Range("B" &
Dim nextstudent As (nextstudent + 2) & ":K" &
Integer = 5 (nextstudent + 2)).Merge()
Dim nextmonth As Integer .Range("B" &
= 0 (nextstudent + 2) & ":K" &
Dim totaldeductions As (nextstudent + 2)).BorderAround()
Integer = 0
Dim totalamount As Dim payment() As
Integer = 0 DataRow =
Dim totaldeposit As tbl_oldpayments.Select("studentnumber
Integer = 0 =" & students(a -
1).Item("studentnumber"),
For a = 1 To "paymentnumber ASC")
students.Count Dim nextpayment As
.Range("A" & Integer = nextstudent + 3
(nextstudent)).Value = "Student No. nextmonth =
:" nextpayment
.Range("C" &
(nextstudent)).Value = students(a - Dim lastpayment As
1).Item("studentnumber").ToString Integer = 0
.Range("C" &
(nextstudent)).HorizontalAlignment = If payment.Count > 0
Kaliwa Then
.Range("C" & For p = 1 To
(nextstudent) & ":I" & payment.Count
(nextstudent)).Merge() totalamount =
0
.Range("A" & totaldeposit
(nextstudent + 1)).Value = "Student = 0
Name :" totaldeductions = 0

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 165

Dim
deductions() As DataRow = .Range("B" &
tbl_olddeductions.Select("studentnumb (nextpayment + 3) & ":C" &
er=" & students(a - (nextpayment + 3)).Merge()
1).Item("studentnumber") & " AND .Range("B" &
paymentnumber=" & payment(p - (nextpayment + 1) & ":C" &
1).Item("paymentnumber")) (nextpayment + 3)).BorderAround()
Dim
transactions() As DataRow = .Range("B" &
tbl_oldtransactions.Select("studentnu (nextpayment + 4)).Value = "Total
mber=" & students(a - Deposit"
1).Item("studentnumber") & " AND .Range("B" &
paymentnumber=" & payment(p - (nextpayment +
1).Item("paymentnumber"), "transyear 4)).HorizontalAlignment = Gitna
DESC, transmonth DESC, transday ASC") .Range("B" &
(nextpayment + 4) & ":C" &
If (nextpayment + 4)).Merge()
deductions.Count > 0 Then .Range("B" &
For d = 1 (nextpayment + 4) & ":C" &
To deductions.Count (nextpayment + 4)).BorderAround()

totaldeductions = totaldeductions + .Range("B" &


CInt(deductions(d - (nextpayment + 5)).Value =
1).Item("amount").ToString) CInt(payment(p -
Next 1).Item("deposit").ToString) +
End If totaldeductions
.Range("B" &
.Range("B" & (nextpayment +
(nextpayment)).Value = "Payment #" 5)).HorizontalAlignment = Gitna
.Range("B" & .Range("B" &
(nextpayment)).HorizontalAlignment = (nextpayment + 5) & ":C" &
Gitna (nextpayment + 5)).Merge()
.Range("B" & .Range("B" &
(nextpayment) & ":C" & (nextpayment + 5) & ":C" &
(nextpayment)).Merge() (nextpayment + 5)).BorderAround()
.Range("B" &
(nextpayment) & ":C" & Dim
(nextpayment)).BorderAround() transactioncount As Integer = 0
Dim lastcell
.Range("B" & As Integer = 0
(nextpayment + 1) & ":C" &
(nextpayment + 1)).Merge() If
transactions.Count > 0 Then
.Range("B" & Dim
(nextpayment + 2)).Value = payment(p currmonth As Integer = 0
- 1).Item("paymentnumber").ToString Dim
.Range("B" & prevmonth As Integer =
(nextpayment + transactions(0).Item("transmonth").To
2)).HorizontalAlignment = Gitna String
.Range("B" & Dim
(nextpayment + 2) & ":C" & curryear As Integer = 0
(nextpayment + 2)).Merge()

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 166

Dim End
prevyear As Integer = If
transactions(0).Item("transyear").ToS
tring totalamount = totalamount +
CInt(transactions(t -
transactioncount = 0 1).Item("amount").ToString)

For t = 1
To transactions.Count .Range("D" & (nextmonth)).Value =
"Month :"
curryear = transactions(t -
1).Item("transyear").ToString .Range("D" & (nextmonth + 1)).Value =
"Year :"
currmonth = transactions(t -
1).Item("transmonth").ToString
.Range("D" & (nextmonth) & ":D" &
If (nextmonth + 1)).BorderAround()
prevyear = curryear Then

If prevmonth = currmonth Then .Range("E" & (nextmonth)).Value =


MonthName(currmonth)
transactioncount = transactioncount +
1 .Range("E" &
(nextmonth)).HorizontalAlignment =
Else Kaliwa

.Range("D" & (nextmonth + 2) & ":K" & .Range("E" & (nextmonth) & ":F" &
(nextmonth + transactioncount + (nextmonth)).Merge()
1)).BorderAround()
.Range("E" & (nextmonth + 1)).Value =
curryear
nextmonth = nextmonth +
transactioncount + 2 .Range("E" & (nextmonth +
1)).HorizontalAlignment = Kaliwa
transactioncount = 1
.Range("E" & (nextmonth + 1) & ":F" &
totalamount = 0 (nextmonth + 1)).Merge()

End If
Else .Range("E" & (nextmonth) & ":F" &
(nextmonth + 1)).BorderAround()
.Range("D" & (nextmonth + 2) & ":K" &
(nextmonth + transactioncount +
1)).BorderAround() .Range("G" & (nextmonth)).Value =
"Day"

nextmonth = nextmonth + .Range("G" &


transactioncount + 2 (nextmonth)).HorizontalAlignment =
Gitna
transactioncount = 1
.Range("G" &
totalamount = 0 (nextmonth)).BorderAround()

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 167

.Range("G" & (nextmonth +


.Range("H" & (nextmonth)).Value = transactioncount)).BorderAround()
"Amount"

.Range("H" & .Range("H" & (nextmonth +


(nextmonth)).HorizontalAlignment = transactioncount)).Value =
Gitna transactions(t -
1).Item("amount").ToString
.Range("H" & (nextmonth) & ":I" &
(nextmonth)).Merge() .Range("H" & (nextmonth +
transactioncount)).HorizontalAlignmen
.Range("H" & (nextmonth) & ":I" & t = Gitna
(nextmonth)).BorderAround()
.Range("H" & (nextmonth +
transactioncount) & ":I" & (nextmonth
.Range("J" & (nextmonth)).Value = + transactioncount)).Merge()
"Total Amount"
.Range("H" & (nextmonth +
.Range("J" & transactioncount) & ":I" & (nextmonth
(nextmonth)).HorizontalAlignment = + transactioncount)).BorderAround()
Gitna

.Range("J" & (nextmonth) & ":K" & prevyear = curryear


(nextmonth)).Merge()
prevmonth = currmonth
.Range("J" & (nextmonth) & ":K" &
(nextmonth)).BorderAround() lastcell = nextmonth +
transactioncount

.Range("J" & (nextmonth + 1)).Value = lastpayment = nextmonth +


totalamount transactioncount
Next
.Range("J" & (nextmonth +
1)).HorizontalAlignment = Gitna nextmonth
= lastcell + 2
.Range("J" & (nextmonth + 1) & ":K" &
(nextmonth + 1)).Merge() transactioncount = 1
Else
.Range("J" & (nextmonth + 1) & ":K" & nextmonth
(nextmonth + 1)).BorderAround() = lastcell + 2

transactioncount = 1
.Range("G" & (nextmonth + End If
transactioncount)).Value =
transactions(t - If Not p =
1).Item("transday").ToString payment.Count Then
If
.Range("G" & (nextmonth + lastpayment > nextpayment + 5 Then
transactioncount)).HorizontalAlignmen
t = Gitna .Range("B" & (nextpayment) & ":K" &
(lastpayment + 2)).BorderAround()

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 168

nextmonth =
nextpayment
nextstudent = lastpayment + 2 End If
Next
nextpayment = nextstudent End With
End Sub
nextmonth = nextpayment
Else Public Sub
CreateOldDeductionHistoryBackUp()
.Range("B" & (nextpayment) & ":K" &
(nextpayment + 6)).BorderAround() xlWorkBook.Sheets.Add(After:=xlWorkBo
ok.Worksheets(xlWorkBook.Worksheets.C
ount))
nextstudent = nextpayment + 7 xlWorkSheet =
xlWorkBook.Sheets("Sheet12")
nextpayment = nextstudent xlWorkSheet.Name = "Old
Deduction"
nextmonth = nextpayment
End If With xlWorkSheet
Else .Range("A2").Value = "Old
If Deduction History"
lastpayment > nextpayment + 5 Then .Range("A2:I2").Merge()

.Range("B" & (nextpayment) & ":K" & .Range("A2").HorizontalAlignment =


(lastpayment + 2)).BorderAround() Gitna

.Range("A3").Value = "(
nextstudent = lastpayment + 2 Payments validated by Accounting per
Previous Payment )"
nextpayment = nextstudent .Range("A3:I3").Merge()

nextmonth = nextpayment .Range("A3").HorizontalAlignment =


Else Gitna

.Range("B" & (nextpayment) & ":K" &


(nextpayment + 5)).BorderAround() .Range("A2:I3").BorderAround()

Dim students() As DataRow


nextstudent = nextpayment + 7 = tbl_students.Select("", "lastname
ASC, firstname ASC")
nextpayment = nextstudent Dim nextstudent As
Integer = 5
nextmonth = nextpayment Dim nextmonth As Integer
End If = 0
End If Dim totaldeductions As
Next Integer = 0
Else Dim totalamount As
nextstudent = Integer = 0
nextstudent + 4 Dim totaldeposit As
nextpayment = Integer = 0
nextstudent + 3

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 169

For a = 1 To Dim nextpayment As


students.Count Integer = nextstudent + 3
.Range("A" & nextmonth =
(nextstudent)).Value = "Student No. nextpayment
:"
.Range("C" & Dim lastpayment As
(nextstudent)).Value = students(a - Integer = 0
1).Item("studentnumber").ToString
.Range("C" & If payment.Count > 0
(nextstudent)).HorizontalAlignment = Then
Kaliwa For p = 1 To
.Range("C" & payment.Count
(nextstudent) & ":G" & totalamount =
(nextstudent)).Merge() 0
totaldeposit
.Range("A" & = 0
(nextstudent + 1)).Value = "Student
Name :" totaldeductions = 0
.Range("C" &
(nextstudent + 1)).Value = students(a Dim
- 1).Item("lastname").ToString & ", " deductions() As DataRow =
& students(a - tbl_olddeductions.Select("studentnumb
1).Item("firstname").ToString & " " & er=" & students(a -
students(a - 1).Item("studentnumber") & " AND
1).Item("middlename").ToString paymentnumber=" & payment(p -
.Range("C" & 1).Item("paymentnumber"))
(nextstudent +
1)).HorizontalAlignment = Kaliwa If
.Range("C" & deductions.Count > 0 Then
(nextstudent + 1) & ":G" & For d = 1
(nextstudent + 1)).Merge() To deductions.Count

.Range("A" & totaldeductions = totaldeductions +


(nextstudent) & ":B" & (nextstudent + CInt(deductions(d -
1)).BorderAround() 1).Item("amount").ToString)
.Range("C" & Next
(nextstudent) & ":G" & (nextstudent + End If
1)).BorderAround()
.Range("B" &
.Range("B" & (nextpayment)).Value = "Payment #"
(nextstudent + 2) & ":I" & .Range("B" &
(nextstudent + 2)).Merge() (nextpayment)).HorizontalAlignment =
.Range("B" & Gitna
(nextstudent + 2) & ":I" & .Range("B" &
(nextstudent + 2)).BorderAround() (nextpayment) & ":C" &
(nextpayment)).Merge()
Dim payment() As .Range("B" &
DataRow = (nextpayment) & ":C" &
tbl_oldpayments.Select("studentnumber (nextpayment)).BorderAround()
=" & students(a -
1).Item("studentnumber"),
"paymentnumber ASC")

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 170

.Range("B" & .Range("D" &


(nextpayment + 1) & ":C" & (nextpayment)).HorizontalAlignment =
(nextpayment + 1)).Merge() Gitna
.Range("D" &
.Range("B" & (nextpayment) & ":G" &
(nextpayment + 2)).Value = payment(p (nextpayment)).Merge()
- 1).Item("paymentnumber").ToString .Range("D" &
.Range("B" & (nextpayment) & ":G" &
(nextpayment + (nextpayment)).BorderAround()
2)).HorizontalAlignment = Gitna
.Range("B" & .Range("D" &
(nextpayment + 2) & ":C" & (nextpayment + 1)).Value = "Month"
(nextpayment + 2)).Merge() .Range("D" &
(nextpayment +
.Range("B" & 1)).HorizontalAlignment = Gitna
(nextpayment + 3) & ":C" & .Range("D" &
(nextpayment + 3)).Merge() (nextpayment + 1) & ":E" &
.Range("B" & (nextpayment + 1)).Merge()
(nextpayment + 1) & ":C" & .Range("D" &
(nextpayment + 3)).BorderAround() (nextpayment + 1) & ":E" &
(nextpayment + 1)).BorderAround()
.Range("B" &
(nextpayment + 4)).Value = "Total .Range("F" &
Amount" (nextpayment + 1)).Value = "Day"
.Range("B" & .Range("F" &
(nextpayment + (nextpayment +
4)).HorizontalAlignment = Gitna 1)).HorizontalAlignment = Gitna
.Range("B" & .Range("F" &
(nextpayment + 4) & ":C" & (nextpayment + 1)).BorderAround()
(nextpayment + 4)).Merge()
.Range("B" & .Range("G" &
(nextpayment + 4) & ":C" & (nextpayment + 1)).Value = "Year"
(nextpayment + 4)).BorderAround() .Range("G" &
(nextpayment +
.Range("B" & 1)).HorizontalAlignment = Gitna
(nextpayment + 5)).Value = .Range("G" &
totaldeductions (nextpayment + 1)).BorderAround()
.Range("B" &
(nextpayment + .Range("H" &
5)).HorizontalAlignment = Gitna (nextpayment)).Value = "Amount"
.Range("B" & .Range("H" &
(nextpayment + 5) & ":C" & (nextpayment)).HorizontalAlignment =
(nextpayment + 5)).Merge() Gitna
.Range("B" & .Range("H" &
(nextpayment + 5) & ":C" & (nextpayment) & ":I" &
(nextpayment + 5)).BorderAround() (nextpayment)).Merge()

.Range("D" & .Range("H" &


(nextpayment)).Value = "Date of (nextpayment + 1) & ":I" &
Validation" (nextpayment + 1)).Merge()

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 171

.Range("H" &
(nextpayment) & ":I" & (nextpayment + .Range("D" & (nextpayment + 1 + t) &
1)).BorderAround() ":E" & (nextpayment + 1 +
t)).BorderAround()
For t = 1 To
deductions.Count
.Range("F" & (nextpayment + 1 +
.Range("D" & (nextpayment + 1 + t)).Value = deductions(t -
t)).Value = MonthName(deductions(t - 1).Item("deductionday").ToString
1).Item("deductionmonth").ToString)
.Range("F" & (nextpayment + 1 +
.Range("D" & (nextpayment + 1 + t)).HorizontalAlignment = Gitna
t)).HorizontalAlignment = Gitna
.Range("F" & (nextpayment + 1 +
.Range("D" & (nextpayment + 1 + t) & t)).BorderA
":E" & (nextpayment + 1 + t)).Merge()
round()

nextstudent = nextpayment +
.Range("G" & (nextpayment + 1 + deductions.Count + 3
t)).Value = deductions(t -
1).Item("deductionyear").ToString nextpayment = nextstudent
Else
.Range("G" & (nextpayment + 1 +
t)).HorizontalAlignment = Gitna .Range("B" & (nextpayment) & ":I" &
(nextpayment + 6)).BorderAround()
.Range("G" & (nextpayment + 1 +
t)).BorderAround() If Not p
= payment.Count Then

.Range("H" & (nextpayment + 1 + nextstudent = nextpayment + 7


t)).Value = (deductions(t -
1).Item("amount").ToString) nextpayment = nextstudent
Else
.Range("H" & (nextpayment + 1 +
t)).HorizontalAlignment = Gitna nextstudent = nextpayment + 8

.Range("H" & (nextpayment + 1 + t) & nextpayment = nextstudent


":I" & (nextpayment + 1 + t)).Merge() End If
End If
.Range("H" & (nextpayment + 1 + t) & Next
":I" & (nextpayment + 1 + Else
t)).BorderAround() nextstudent =
Next nextstudent + 4
nextpayment =
If nextstudent + 3
deductions.Count >= 5 Then End If
Next
.Range("B" & (nextpayment) & ":I" & End With
(nextpayment + deductions.Count + End Sub
2)).BorderAround()
#End Region

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 172

Dim student As New


Private WithEvents MySqlCommand(sql, con)
PaymentsLoading As New
Windows.Forms.Timer student.Parameters.AddWithValue("@num
Private WithEvents ber", loginid)
TransactionsLoading As New da = New
Windows.Forms.Timer MySqlDataAdapter(student)
Private WithEvents da.Fill(tblStudents)
DeductionsLoading As New
Windows.Forms.Timer If tblStudents.Rows.Count > 0
Then
#Region "~~> Student Information . . id =
." CInt(tblStudents.Rows(0).Item("id").T
Public WithEvents StudentsLoading oString)
As New Windows.Forms.Timer studentnumber =
Public WithEvents tblStudents.Rows(0).Item("studentnumb
StudentInformationAnimation As New er").ToString
Windows.Forms.Timer lastname =
tblStudents.Rows(0).Item("lastname").
Public id As Integer = 0 ToString
Public studentnumber As String = firstname =
"" tblStudents.Rows(0).Item("firstname")
Public lastname As String = "" .ToString
Public firstname As String = "" middlename =
Public middlename As String = "" tblStudents.Rows(0).Item("middlename"
Public fullname As String = "" ).ToString
Public coursename As String = "" fullname =
tblStudents.Rows(0).Item("fullname").
Public NumberIndex As Integer = 1 ToString
Public NameIndex As Integer = 1 coursename =
Public CourseIndex As Integer = 1 tblStudents.Rows(0).Item("coursename"
Public isReloadNumber As Boolean ).ToString
= False Else
Public isReloadName As Boolean = id = 0
False studentnumber = ""
lastname = ""
Public tblStudents As New firstname = ""
DataTable middlename = ""
fullname = ""
Private Sub coursename = ""
StudentsLoading_Tick(ByVal sender As End If
Object, ByVal e As System.EventArgs)
Handles StudentsLoading.Tick lblStudentNumber.Text =
tblStudents.Clear() studentnumber
lblFullName.Text = fullname
sql = "SELECT s.id, lblCourse.Text = coursename
s.studentnumber, s.lastname, End Sub
s.firstname, s.middlename,
s.fullname, c.coursename FROM #End Region
tblStudents s INNER JOIN tblCourses c
ON c.id=s.courseid WHERE #Region "~~> Payments . . ."
studentnumber=@number"

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 173

Public tblPayments As New paymentbank =


DataTable CInt(tblPayments.Rows(0).Item(4).ToSt
Public paymentamount As Integer = ring)
0 Else
Public paymentscholarship As paymentamount = 0
Integer = 0 paymentscholarship = 0
Public paymenttotalamount As paymenttotalamount = 0
Integer = 0 paymentdeposit = 0
Public paymentdeposit As Integer paymentbank = 0
= 0 End If
Public paymentbank As Integer = 0 End Sub

Private WithEvents Public isNewPayment As Boolean


PaymentsAnimation As New Private coinamount As Integer = 0
Windows.Forms.Timer Private coincount As Integer = 0

Private Sub Private Sub Timer1_Tick(ByVal


PaymentsLoading_Tick(ByVal sender As sender As Object, ByVal e As
Object, ByVal e As System.EventArgs) System.EventArgs) Handles Timer1.Tick
Handles PaymentsLoading.Tick Try
tblPayments.Clear() If GetAsyncKeyState(2)
Then
sql = "SELECT p.amount, coinamount =
p.scholarship, p.totalamount, coinamount + 1
p.deposit, cb.amount FROM tblPayments coincount = 0
p INNER JOIN tblCoinbanks cb ON ElseIf
p.studentid=cb.studentid WHERE GetAsyncKeyState(Keys.F5) Then
p.studentid=@id" Code = ""
Dim payments As New CodeIndex = 0
MySqlCommand(sql, con)
If LoginDisabled =
payments.Parameters.AddWithValue("@id True Then
", id) Exit Sub
da = New Else
MySqlDataAdapter(payments) LoginStudent()
da.Fill(tblPayments) End If
ElseIf
If tblPayments.Rows.Count > 0 GetAsyncKeyState(Keys.F6) Then
Then If TransactionType =
paymentamount = "Payment" Then
CInt(tblPayments.Rows(0).Item(0).ToSt TransactionType =
ring) "Bank"
paymentscholarship = lblTBank.Cursor =
CInt(tblPayments.Rows(0).Item(1).ToSt Cursors.Arrow
ring)
paymenttotalamount = lblTBank.ForeColor = Color.Yellow
CInt(tblPayments.Rows(0).Item(2).ToSt
ring) lblTBank.BackColor =
paymentdeposit = Color.FromArgb(20, 20, 20)
CInt(tblPayments.Rows(0).Item(3).ToSt
ring)
lblTPayment.ForeColor = Color.White

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 174

lblTPayment.BackColor = If
Color.FromArgb(40, 40, 40) tblexist.Rows.Count > 0 Then
Else transid =
TransactionType = tblexist.Rows(0).Item("Id")
"Payment" End If

lblTPayment.Cursor = Cursors.Arrow sql = "CALL


uspAddDeposit(@id,@transid,@transdate
lblTPayment.ForeColor = Color.Yellow ,@coin)"
Dim addcoin
lblTPayment.BackColor = As New MySqlCommand(sql, con)
Color.FromArgb(20, 20, 20)
addcoin.Parameters.AddWithValue("@id"
, id)
lblTBank.ForeColor = Color.White
addcoin.Parameters.AddWithValue("@tra
lblTBank.BackColor = nsid", transid)
Color.FromArgb(40, 40, 40)
End If addcoin.Parameters.AddWithValue("@tra
ElseIf nsdate", Date.Today.ToString("yyyy-
GetAsyncKeyState(Keys.F7) Then MM-dd"))
LogoutStudent()
Else addcoin.Parameters.AddWithValue("@coi
If coincount = 1 Then n", coinamount)
Timer1.Stop()
coincount = 0 If con.State
= ConnectionState.Closed Then
If
(paymentdeposit + paymentdeduction) con.Open()
>= paymenttotalamount Then End If

tblexist.Clear()
Dim transid addcoin.ExecuteNonQuery()
As Integer = 0 con.Close()
ElseIf
sql = "SELECT (paymentdeposit + paymentdeduction) +
Id from tbldeposits WHERE coinamount > paymenttotalamount Then
studentid=@id AND depositdate=@date"
Dim deposits tblexist.Clear()
As New MySqlCommand(sql, con) Dim transid
As Integer = 0
deposits.Parameters.AddWithValue("@id
", id) sql = "SELECT
Id from tbltransactions WHERE
deposits.Parameters.AddWithValue("@da studentid=@id AND
te", Date.Today.ToString("yyyy-MM- transactiondate=@date"
dd")) Dim
da = New transactions As New MySqlCommand(sql,
MySqlDataAdapter(deposits) con)

da.Fill(tblexist)

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 175

sql = "SELECT
transactions.Parameters.AddWithValue( Id from tbldeposits WHERE
"@id", id) studentid=@id AND depositdate=@date"
Dim deposits
transactions.Parameters.AddWithValue( As New MySqlCommand(sql, con)
"@date", Date.Today.ToString("yyyy-
MM-dd")) deposits.Parameters.AddWithValue("@id
da = New ", id)
MySqlDataAdapter(transactions)
deposits.Parameters.AddWithValue("@da
da.Fill(tblexist) te", Date.Today.ToString("yyyy-MM-
dd"))
If da = New
tblexist.Rows.Count > 0 Then MySqlDataAdapter(deposits)
transid =
tblexist.Rows(0).Item("Id") da.Fill(tblexist)
End If
If
sql = "CALL tblexist.Rows.Count > 0 Then
uspAddTransaction(@id,@transid,@trans transid =
date,@coin)" tblexist.Rows(0).Item("Id")
Dim addcoin End If
As New MySqlCommand(sql, con)
sql = "CALL
addcoin.Parameters.AddWithValue("@id" uspAddDeposit(@id,@transid,@transdate
, id) ,@coin)"
Dim
addcoin.Parameters.AddWithValue("@tra adddeposit As New MySqlCommand(sql,
nsid", transid) con)

addcoin.Parameters.AddWithValue("@tra adddeposit.Parameters.AddWithValue("@
nsdate", Date.Today.ToString("yyyy- id", id)
MM-dd"))
adddeposit.Parameters.AddWithValue("@
addcoin.Parameters.AddWithValue("@coi transid", transid)
n", (paymenttotalamount -
(paymentdeposit + paymentdeduction))) adddeposit.Parameters.AddWithValue("@
transdate",
If con.State Date.Today.ToString("yyyy-MM-dd"))
= ConnectionState.Closed Then
adddeposit.Parameters.AddWithValue("@
con.Open() coin", coinamount -
End If (paymenttotalamount - (paymentdeposit
+ paymentdeduction)))

addcoin.ExecuteNonQuery() If con.State
con.Close() = ConnectionState.Closed Then

con.Open()
tblexist.Clear() End If
transid = 0

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 176

addcoin.Parameters.AddWithValue("@coi
adddeposit.ExecuteNonQuery() n", coinamount)
con.Close()
Else If con.State
= ConnectionState.Closed Then
tblexist.Clear()
Dim transid con.Open()
As Integer = 0 End If

sql = "SELECT
Id from tbltransactions WHERE addcoin.ExecuteNonQuery()
studentid=@id AND con.Close()
transactiondate=@date" End If
Dim
transactions As New MySqlCommand(sql, coinamount = 0
con) Timer1.Start()
Else
transactions.Parameters.AddWithValue( coincount += 1
"@id", id) End If
End If
transactions.Parameters.AddWithValue( Catch ex As Exception
"@date", Date.Today.ToString("yyyy- ShowError("An error
MM-dd")) occured while Adding Coins", "Please
da = New contact your System Administrator",
MySqlDataAdapter(transactions) False)
End
da.Fill(tblexist) End Try
End Sub
If
tblexist.Rows.Count > 0 Then #End Region
transid =
tblexist.Rows(0).Item("Id") #Region "~~> Transactions . . ."
End If
Public tblDeposits As New
sql = "CALL DataTable
uspAddTransaction(@id,@transid,@trans Public tblTransactions As New
date,@coin)" DataTable
Dim addcoin Public depositindex As Integer =
As New MySqlCommand(sql, con) -1
Public transactionindex As
addcoin.Parameters.AddWithValue("@id" Integer = -1
, id) Public depositid As Integer = 0
Public transactionid As Integer =
addcoin.Parameters.AddWithValue("@tra 0
nsid", transid)
Private WithEvents
addcoin.Parameters.AddWithValue("@tra TransactionsAnimation As New
nsdate", Date.Today.ToString("yyyy- Windows.Forms.Timer
MM-dd")) Private TransactionType As String
= "Payment"
Private isClear As Boolean =
False

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 177

Public Sub lvTransactionD.Left -= 10


TransactionsAnimationThread() lblNoDeposit.Left
Do -= 10
If TransactionType =
"Payment" Then lblNoTransaction.Left -= 10
If ElseIf
lvTransactionP.Left < (5 - 50) Then lvTransactionD.Left > (5 + 20) Then

lvTransactionP.Left += 10 lvTransactionP.Left -= 5

lvTransactionD.Left += 10 lvTransactionD.Left -= 5
lblNoDeposit.Left lblNoDeposit.Left
+= 10 -= 5

lblNoTransaction.Left += 10 lblNoTransaction.Left -= 5
ElseIf ElseIf
lvTransactionP.Left < (5 - 20) Then lvTransactionD.Left > (5 + 8) Then

lvTransactionP.Left += 5 lvTransactionP.Left -= 3

lvTransactionD.Left += 5 lvTransactionD.Left -= 3
lblNoDeposit.Left lblNoDeposit.Left
+= 5 -= 3

lblNoTransaction.Left += 5 lblNoTransaction.Left -= 3
ElseIf ElseIf
lvTransactionP.Left < (5 - 8) Then lvTransactionD.Left > (5) Then

lvTransactionP.Left += 3 lvTransactionP.Left -= 1

lvTransactionD.Left += 3 lvTransactionD.Left -= 1
lblNoDeposit.Left lblNoDeposit.Left
+= 3 -= 1

lblNoTransaction.Left += 3 lblNoTransaction.Left -= 1
ElseIf End If
lvTransactionP.Left < (5) Then End If
Loop
lvTransactionP.Left += 1 End Sub

lvTransactionD.Left += 1 Public isNoDeposit As Boolean =


lblNoDeposit.Left True
+= 1 Public isNoPayment As Boolean =
True
lblNoTransaction.Left += 1
End If Private Sub
Else TransactionsLoading_Tick(ByVal sender
If As Object, ByVal e As
lvTransactionD.Left > (5 + 50) Then System.EventArgs) Handles

lvTransactionP.Left -= 10

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 178

TransactionsLoading.Tick 1).SubItems(2).Text =
tblDeposits.Clear() tblDeposits.Rows(a -
1).Item(2).ToString
sql = "SELECT id, End If
depositdate, amount FROM tblDeposits
WHERE studentid=@id ORDER BY Exit For
depositdate DESC" End If
Dim deposits As New Next
MySqlCommand(sql, con) Next
Else
deposits.Parameters.AddWithValue("@id
", id) lvTransactionD.Items.Clear()
da = New depositindex = -1
MySqlDataAdapter(deposits)
da.Fill(tblDeposits) For a = 1 To
tblDeposits.Rows.Count
If tblDeposits.Rows.Count > 0 Dim lv As
And id > 0 Then ListViewItem =
isNoDeposit = False lvTransactionD.Items.Add(tblDeposits.
Rows(a - 1).Item("id").ToString)
If tblDeposits.Rows.Count
= lvTransactionD.Items.Count Then lv.SubItems.Add(CDate(tblDeposits.Row
For a = 1 To s(a -
tblDeposits.Rows.Count 1).Item("depositdate").ToString).ToSt
For b = 1 To ring("MMMM dd, yyyy"))
lvTransactionD.Items.Count
If lv.SubItems.Add(tblDeposits.Rows(a -
lvTransactionD.Items(b - 1).Item("amount").ToString)
1).SubItems(0).Text.ToString =
tblDeposits.Rows(a - If
1).Item("id").ToString Then depositid.ToString =
If Not tblDeposits.Rows(a -
(lvTransactionD.Items(b - 1).Item("id").ToString Then
1).SubItems(1).Text.ToString = depositindex
CDate(tblDeposits.Rows(a - = a - 1
1).Item(1).ToString).ToString("MMMM End If
dd, yyyy")) Then Next

lvTransactionD.Items(b - If depositindex = -1
1).SubItems(1).Text = Then
CDate(tblDeposits.Rows(a - depositindex = 0
1).Item(1).ToString).ToString("MMMM depositid =
dd, yyyy") lvTransactionD.Items(depositindex).Su
End If bItems(0).Text
End If
If Not
(lvTransactionD.Items(b - lvTransactionD.Items(depositindex).Fo
1).SubItems(2).Text.ToString = reColor = Color.Yellow
tblDeposits.Rows(a -
1).Item(2).ToString) Then lvTransactionD.Items(depositindex).Ba
ckColor = Color.FromArgb(0, 30, 0)
lvTransactionD.Items(b -

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 179

1).Item(1).ToString).ToString("MMMM
End If dd, yyyy")
Else End If

lvTransactionD.Items.Clear() If Not
depositindex = -1 (lvTransactionP.Items(b -
depositid = 0 1).SubItems(2).Text.ToString =
tblTransactions.Rows(a -
isNoDeposit = True 1).Item(2).ToString) Then
End If
lvTransactionP.Items(b -
tblTransactions.Clear() 1).SubItems(2).Text =
tblTransactions.Rows(a -
sql = "SELECT id, 1).Item(2).ToString
transactiondate, amount FROM End If
tblTransactions WHERE studentid=@id
ORDER BY transactiondate DESC" Exit For
Dim transactions As New End If
MySqlCommand(sql, con) Next
Next
transactions.Parameters.AddWithValue( Else
"@id", id)
da = New lvTransactionP.Items.Clear()
MySqlDataAdapter(transactions) transactionindex = -1
da.Fill(tblTransactions)
For a = 1 To
If tblTransactions.Rows.Count tblTransactions.Rows.Count
> 0 And id > 0 Then Dim lv As
isNoPayment = False ListViewItem =
lvTransactionP.Items.Add(tblTransacti
If ons.Rows(a - 1).Item("id").ToString)
tblTransactions.Rows.Count =
lvTransactionP.Items.Count Then lv.SubItems.Add(CDate(tblTransactions
For a = 1 To .Rows(a -
tblTransactions.Rows.Count 1).Item("transactiondate").ToString).
For b = 1 To ToString("MMMM dd, yyyy"))
lvTransactionP.Items.Count
If lv.SubItems.Add(tblTransactions.Rows(
lvTransactionP.Items(b - a - 1).Item("amount").ToString)
1).SubItems(0).Text.ToString =
tblTransactions.Rows(a - If
1).Item("id").ToString Then transactionid.ToString =
If Not tblTransactions.Rows(a -
(lvTransactionP.Items(b - 1).Item("id").ToString Then
1).SubItems(1).Text.ToString =
CDate(tblTransactions.Rows(a - transactionindex = a - 1
1).Item(1).ToString).ToString("MMMM End If
dd, yyyy")) Then Next

lvTransactionP.Items(b - If transactionindex =
1).SubItems(1).Text = -1 Then
CDate(tblTransactions.Rows(a -

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 180

transactionindex System.EventArgs) Handles


= 0 lblTPayment.MouseLeave
transactionid = If TransactionType =
lvTransactionP.Items(transactionindex "Payment" Then
).SubItems(0).Text Exit Sub
End If End If

lblTPayment.ForeColor =
lvTransactionP.Items(transactionindex Color.White
).ForeColor = Color.Yellow lblTPayment.BackColor =
Color.FromArgb(40, 40, 40)
lvTransactionP.Items(transactionindex End Sub
).BackColor = Color.FromArgb(0, 30,
0) Private Sub
End If lblTPayment_MouseMove(ByVal sender As
Else Object, ByVal e As
System.Windows.Forms.MouseEventArgs)
lvTransactionP.Items.Clear() Handles lblTPayment.MouseMove
transactionindex = -1 If TransactionType =
transactionid = 0 "Payment" Then
isNoPayment = True lblTPayment.Cursor =
End If Cursors.Arrow
End Sub Exit Sub
End If
Private Sub
lblTPayment_Click(ByVal sender As lblTPayment.Cursor =
System.Object, ByVal e As Cursors.Hand
System.EventArgs) Handles lblTPayment.ForeColor =
lblTPayment.Click Color.LawnGreen
If TransactionType = lblTPayment.BackColor =
"Payment" Then Color.FromArgb(20, 20, 20)
Exit Sub End Sub
End If
Private Sub lblTBank_Click(ByVal
TransactionType = "Payment" sender As System.Object, ByVal e As
lblTPayment.Cursor = System.EventArgs) Handles
Cursors.Arrow lblTBank.Click
lblTPayment.ForeColor = If TransactionType = "Bank"
Color.Yellow Then
lblTPayment.BackColor = Exit Sub
Color.FromArgb(20, 20, 20) End If

lblTBank.ForeColor = TransactionType = "Bank"


Color.White lblTBank.Cursor =
lblTBank.BackColor = Cursors.Arrow
Color.FromArgb(40, 40, 40) lblTBank.ForeColor =
End Sub Color.Yellow
lblTBank.BackColor =
Private Sub Color.FromArgb(20, 20, 20)
lblTPayment_MouseLeave(ByVal sender
As Object, ByVal e As lblTPayment.ForeColor =

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 181

Private Sub
Color.White DeductionsLoading_Tick(ByVal sender
lblTPayment.BackColor = As Object, ByVal e As
Color.FromArgb(40, 40, 40) System.EventArgs) Handles
End Sub
DeductionsLoading.Tick
Private Sub tblDeductions.Clear()
lblTBank_MouseLeave(ByVal sender As
Object, ByVal e As System.EventArgs) sql = "SELECT id,
Handles lblTBank.MouseLeave deductiondate, amount FROM
If TransactionType = "Bank" tblDeductions WHERE studentid=@id
Then ORDER BY deductiondate DESC"
Exit Sub Dim deductions As New
End If MySqlCommand(sql, con)

lblTBank.ForeColor = deductions.Parameters.AddWithValue("@
Color.White id", id)
lblTBank.BackColor = da = New
Color.FromArgb(40, 40, 40) MySqlDataAdapter(deductions)
End Sub da.Fill(tblDeductions)

Private Sub If tblDeductions.Rows.Count >


lblTBank_MouseMove(ByVal sender As 0 Then
Object, ByVal e As isNoDeduction = False
System.Windows.Forms.MouseEventArgs)
Handles lblTBank.MouseMove If
If TransactionType = "Bank" tblDeductions.Rows.Count =
Then lvDeductions.Items.Count Then
lblTBank.Cursor = For a = 1 To
Cursors.Arrow tblDeductions.Rows.Count
Exit Sub For b = 1 To
End If lvDeductions.Items.Count
If
lblTBank.Cursor = lvDeductions.Items(b -
Cursors.Hand 1).SubItems(0).Text.ToString =
lblTBank.ForeColor = tblDeductions.Rows(a -
Color.LawnGreen 1).Item("id").ToString Then
lblTBank.BackColor = If Not
Color.FromArgb(20, 20, 20) (lvDeductions.Items(b -
End Sub 1).SubItems(1).Text.ToString =
CDate(tblDeductions.Rows(a -
#End Region 1).Item(1).ToString).ToString("MM/dd/
yyyy")) Then
Public tblDeductions As New
DataTable lvDeductions.Items(b -
Public paymentdeduction As 1).SubItems(1).Text =
Integer = 0 CDate(tblDeductions.Rows(a -
Public deductionindex As Integer 1).Item(1).ToString).ToString("MM/dd/
= -1 yyyy")
Public deductionid As Integer = 0 End If

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 182

If Not
(lvDeductions.Items(b - deductionindex = a - 1
1).SubItems(2).Text.ToString = End If
tblDeductions.Rows(a -
1).Item(2).ToString) Then paymentdeduction
= paymentdeduction +
paymentdeduction = paymentdeduction -
CInt(lvDeductions.Items(b - CInt(tblDeductions.Rows(a -
1).SubItems(2).Text) 1).Item("amount").ToString)
Next

lvDeductions.Items(b - If deductionindex = -
1).SubItems(2).Text = 1 Then
tblDeductions.Rows(a - deductionindex =
1).Item(2).ToString 0
deductionid =
lvDeductions.Items(deductionindex).Su
paymentdeduction = paymentdeduction - bItems(0).Text
CInt(tblDeductions.Rows(a - End If
1).Item(2).ToString)
End If
lvDeductions.Items(deductionindex).Fo
Exit For reColor = Color.Yellow
End If
Next lvDeductions.Items(deductionindex).Ba
Next ckColor = Color.FromArgb(0, 30, 0)
Else End If
Else
lvDeductions.Items.Clear()
deductionindex = -1 lvDeductions.Items.Clear()
paymentdeduction = 0 deductionindex = -1
deductionid = 0
For a = 1 To paymentdeduction = 0
tblDeductions.Rows.Count isNoDeduction = True
Dim lv As End If
ListViewItem = End Sub
lvDeductions.Items.Add(tblDeductions.
Rows(a - 1).Item("id").ToString) Public isNoDeduction As Boolean =
True
lv.SubItems.Add(CDate(tblDeductions.R
ows(a - Private Sub
1).Item("deductiondate").ToString).To lvTransactionD_GotFocus(ByVal sender
String("MM/dd/yyyy")) As Object, ByVal e As
System.EventArgs) Handles
lv.SubItems.Add(tblDeductions.Rows(a lvTransactionD.GotFocus
- 1).Item("amount").ToString) lblDay.Focus()
End Sub
If
deductionid.ToString = Private Sub
tblDeductions.Rows(a - lvTransactionD_MouseClick(ByVal
1).Item("id").ToString Then sender As Object, ByVal e As

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 183

System.Windows.Forms.MouseEventArgs) As Object, ByVal e As


Handles lvTransactionD.MouseClick System.EventArgs) Handles
If e.Button = lvTransactionP.GotFocus
Windows.Forms.MouseButtons.Left Then lblDay.Focus()
End Sub

Private Sub
If lvTransactionP_MouseClick(ByVal
lvTransactionD.Items.Count > 0 Then
If depositindex > -1 sender As Object, ByVal e As
Then System.Windows.Forms.MouseEventArgs)
Handles lvTransactionP.MouseClick
lvTransactionD.Items(depositindex).Fo If e.Button =
reColor = Color.White Windows.Forms.MouseButtons.Left Then
If
lvTransactionD.Items(depositindex).Ba lvTransactionP.Items.Count > 0 Then
ckColor = Color.FromArgb(30, 70, 30) If transactionindex >
End If -1 Then

depositindex = lvTransactionP.Items(transactionindex
lvTransactionD.FocusedItem.Index ).ForeColor = Color.White
depositid =
lvTransactionD.Items(depositindex).Su lvTransactionP.Items(transactionindex
bItems(0).Text ).BackColor = Color.FromArgb(30, 70,
30)
End If
lvTransactionD.Items(depositindex).Fo
reColor = Color.Yellow transactionindex =
lvTransactionP.FocusedItem.Index
lvTransactionD.Items(depositindex).Ba transactionid =
ckColor = Color.FromArgb(0, 30, 0) lvTransactionP.Items(transactionindex
End If ).SubItems(0).Text
End If
End Sub
lvTransactionP.Items(transactionindex
Private Sub ).ForeColor = Color.Yellow
lvTransactionD_MouseMove(ByVal sender
As Object, ByVal e As lvTransactionP.Items(transactionindex
System.Windows.Forms.MouseEventArgs) ).BackColor = Color.FromArgb(0, 30,
Handles lvTransactionD.MouseMove 0)
If lvTransactionD.Items.Count End If
> 0 Then End If
lvTransactionD.Cursor = End Sub
Cursors.Hand
Else Private Sub
lvTransactionD.Cursor = lvTransactionP_MouseMove(ByVal sender
Cursors.Arrow As Object, ByVal e As
End If System.Windows.Forms.MouseEventArgs)
End Sub Handles lvTransactionP.MouseMove
If lvTransactionP.Items.Count
Private Sub > 0 Then
lvTransactionP_GotFocus(ByVal sender

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 184

lvTransactionP.Cursor = End If
Cursors.Hand
Else deductionindex =
lvTransactionP.Cursor = lvDeductions.FocusedItem.Index
Cursors.Arrow deductionid =
End If lvDeductions.Items(deductionindex).Su
End Sub bItems(0).Text

Private Sub lvDeductions.Items(deductionindex).Fo


lvDeductions_GotFocus(ByVal sender As reColor = Color.Yellow
Object, ByVal e As System.EventArgs)
Handles lvDeductions.GotFocus lvDeductions.Items(deductionindex).Ba
lblDay.Focus() ckColor = Color.FromArgb(0, 30, 0)
End Sub End If
End If
Private Sub End Sub
lvDeductions_MouseClick(ByVal sender
As Object, ByVal e As Private Sub
System.Windows.Forms.MouseEventArgs) lvDeductions_MouseMove(ByVal sender
Handles lvDeductions.MouseClick As Object, ByVal e As
If e.Button = System.Windows.Forms.MouseEventArgs)
Windows.Forms.MouseButtons.Left Then Handles lvDeductions.MouseMove
If If lvDeductions.Items.Count >
lvDeductions.Items.Count > 0 Then 0 Then
If deductionindex > - lvDeductions.Cursor =
1 Then Cursors.Hand
Else
lvDeductions.Items(deductionindex).Fo lvDeductions.Cursor =
reColor = Color.White Cursors.Arrow

lvDeductions.Items(deductionindex).Ba
ckColor = Color.FromArgb(30, 70, 30)
End If
End Sub

Public Sub PaymentThread() (paymentamount + 10)


Do ThenlblTuitionFee.Text -= 4
If ElseIf
CInt(lblTuitionFee.Text) > CInt(lblTuitionFee.Text) >
(paymentamount + 1000) Then (paymentamount) Then
lblTuitionFee.Text -= lblTuitionFee.Text -=
413 1
ElseIf ElseIf
CInt(lblTuitionFee.Text) > CInt(lblTuitionFee.Text) <
(paymentamount + 100) Then
lblTuitionFee.Text -=
43
ElseIf
CInt(lblTuitionFee.Text)

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 185

(paymentdeposit + paymentdeduction))
(paymentamount - 1000) Then - 1000) Then
lblTuitionFee.Text +=
413 lblCurrentBalance.Text += 413
ElseIf ElseIf
CInt(lblTuitionFee.Text) < CInt(lblCurrentBalance.Text) <
(paymentamount - 100) Then ((paymenttotalamount -
lblTuitionFee.Text += (paymentdeposit + paymentdeduction))
43 - 100) Then
ElseIf
CInt(lblTuitionFee.Text) < lblCurrentBalance.Text += 43
(paymentamount - 10) Then ElseIf
lblTuitionFee.Text += CInt(lblCurrentBalance.Text) <
4 ((paymenttotalamount -
ElseIf (paymentdeposit + paymentdeduction))
CInt(lblTuitionFee.Text) < - 10) Then
(paymentamount) Then
lblTuitionFee.Text += lblCurrentBalance.Text += 4
1 ElseIf
End If
CInt(lblCurrentBalance.Text) <
If ((paymenttotalamount -
CInt(lblCurrentBalance.Text) > (paymentdeposit + paymentdeduction)))
((paymenttotalamount - Then
(paymentdeposit + paymentdeduction))
+ 1000) Then lblCurrentBalance.Text += 1
End If
lblCurrentBalance.Text -= 413
ElseIf If
CInt(lblCurrentBalance.Text) > CInt(lblScholarship.Text) >
((paymenttotalamount - (paymentscholarship + 1000) Then
(paymentdeposit + paymentdeduction)) lblScholarship.Text -
+ 100) Then = 413
ElseIf
lblCurrentBalance.Text -= 43 CInt(lblScholarship.Text) >
ElseIf (paymentscholarship + 100) Then
CInt(lblCurrentBalance.Text) > lblScholarship.Text -
((paymenttotalamount - = 43
(paymentdeposit + paymentdeduction)) ElseIf
+ 10) Then CInt(lblScholarship.Text) >
(paymentscholarship + 10) Then
lblCurrentBalance.Text -= 4 lblScholarship.Text -
ElseIf = 4
CInt(lblCurrentBalance.Text) > ElseIf
((paymenttotalamount - CInt(lblScholarship.Text) >
(paymentdeposit + paymentdeduction))) (paymentscholarship) Then
Then lblScholarship.Text -
= 1
lblCurrentBalance.Text -= 1 ElseIf
ElseIf CInt(lblScholarship.Text) <
CInt(lblCurrentBalance.Text) < (paymentscholarship - 1000) Then
((paymenttotalamount -

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 186

lblScholarship.Text lblDeposit.Text += 1
+= 413 End If
ElseIf
CInt(lblScholarship.Text) < If
(paymentscholarship - 100) Then CInt(lblTotalDeduction.Text) >
lblScholarship.Text (paymentdeduction + 1000) Then
+= 43
ElseIf lblTotalDeduction.Text -= 413
CInt(lblScholarship.Text) < ElseIf
(paymentscholarship - 10) Then CInt(lblTotalDeduction.Text) >
lblScholarship.Text (paymentdeduction + 100) Then
+= 4
ElseIf lblTotalDeduction.Text -= 43
CInt(lblScholarship.Text) < ElseIf
(paymentscholarship) Then CInt(lblTotalDeduction.Text) >
lblScholarship.Text (paymentdeduction + 10) Then
+= 1
End If lblTotalDeduction.Text -= 4
ElseIf
CInt(lblTotalDeduction.Text) >
If CInt(lblDeposit.Text) > (paymentdeduction) Then
(paymentdeposit + 1000) Then
lblDeposit.Text -= lblTotalDeduction.Text -= 1
413 ElseIf
ElseIf CInt(lblTotalDeduction.Text) <
CInt(lblDeposit.Text) > (paymentdeduction - 1000) Then
(paymentdeposit + 100) Then lblTotalDeduction.Text
lblDeposit.Text -= 43 += 413
ElseIf ElseIf
CInt(lblDeposit.Text) > CInt(lblTotalDeduction.Text) <
(paymentdeposit + 10) Then (paymentdeduction - 100) Then
lblDeposit.Text -= 4
ElseIf lblTotalDeduction.Text += 43
CInt(lblDeposit.Text) > ElseIf
(paymentdeposit) Then CInt(lblTotalDeduction.Text) <
lblDeposit.Text -= 1 (paymentdeduction - 10) Then
ElseIf
CInt(lblDeposit.Text) < lblTotalDeduction.Text += 4
(paymentdeposit - 1000) Then ElseIf
lblDeposit.Text += CInt(lblTotalDeduction.Text) <
413 (paymentdeduction) Then
ElseIf
CInt(lblDeposit.Text) < lblTotalDeduction.Text += 1
(paymentdeposit - 100) Then End If
lblDeposit.Text += 43
ElseIf If CInt(lblBalance.Text)
CInt(lblDeposit.Text) < > (paymenttotalamount + 1000) Then
(paymentdeposit - 10) Then lblBalance.Text -=
lblDeposit.Text += 4 413
ElseIf ElseIf
CInt(lblDeposit.Text) < CInt(lblBalance.Text) >
(paymentdeposit) Then

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 187

(paymenttotalamount + 100) Then ElseIf


lblBalance.Text -= 43 CInt(lblCoinBank.Text) < (paymentbank
ElseIf - 100) Then
CInt(lblBalance.Text) > lblCoinBank.Text +=
(paymenttotalamount + 10) Then 43
lblBalance.Text -= 4 ElseIf
ElseIf CInt(lblCoinBank.Text) < (paymentbank
CInt(lblBalance.Text) > - 10) Then
(paymenttotalamount) Then lblCoinBank.Text += 4
lblBalance.Text -= 1 ElseIf
ElseIf CInt(lblCoinBank.Text) <
CInt(lblBalance.Text) < (paymentbank) Then
(paymenttotalamount - 1000) Then lblCoinBank.Text += 1
lblBalance.Text += End If
413 Loop
ElseIf End Sub
CInt(lblBalance.Text) <
(paymenttotalamount - 100) Then Private Sub TransferCoins()
lblBalance.Text += 43 If id = 0 Then
ElseIf Exit Sub
CInt(lblBalance.Text) < End If
(paymenttotalamount - 10) Then
lblBalance.Text += 4 If paymentbank = 0 Then
ElseIf ShowInformation("You
CInt(lblBalance.Text) < don't have any coins in Bank")
(paymenttotalamount) Then Exit Sub
lblBalance.Text += 1 End If
End If
If (paymentdeduction +
If CInt(lblCoinBank.Text) paymentdeposit) = paymenttotalamount
> (paymentbank + 1000) Then Then
lblCoinBank.Text -= ShowInformation("You've
413 already reached your Total Tuition
ElseIf Fee")
CInt(lblCoinBank.Text) > (paymentbank Exit Sub
+ 100) Then End If
lblCoinBank.Text -=
43 If (paymenttotalamount -
ElseIf (paymentdeduction + paymentdeposit))
CInt(lblCoinBank.Text) > (paymentbank > paymentbank Then
+ 10) Then '~~> Transfer all coins
lblCoinBank.Text -= 4 tblexist.Clear()
ElseIf Dim transdid As Integer =
CInt(lblCoinBank.Text) > 0
(paymentbank) Then Dim transpid As Integer =
lblCoinBank.Text -= 1 0
ElseIf
CInt(lblCoinBank.Text) < (paymentbank sql = "SELECT * FROM
- 1000) Then tblDeposits WHERE depositdate=@tdate
lblCoinBank.Text += AND studentid=@sid"
413

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 188

Dim deposits As New


MySqlCommand(sql, con) addcoin.Parameters.AddWithValue("@id"
, id)
deposits.Parameters.AddWithValue("@td
ate", Date.Today.ToString("yyyy-MM- addcoin.Parameters.AddWithValue("@tra
dd")) nsdid", transdid)

deposits.Parameters.AddWithValue("@si addcoin.Parameters.AddWithValue("@tra
d", id) nsddate", Date.Today.ToString("yyyy-
da = New MM-dd"))
MySqlDataAdapter(deposits)
da.Fill(tblexist) addcoin.Parameters.AddWithValue("@tra
nspid", transpid)
If tblexist.Rows.Count >
0 Then addcoin.Parameters.AddWithValue("@tra
transdid = nspdate", Date.Today.ToString("yyyy-
CInt(tblexist.Rows(0).Item("id").ToSt MM-dd"))
ring)
End If addcoin.Parameters.AddWithValue("@coi
n", paymentbank)
tblexist.Clear()
If con.State =
sql = "SELECT * FROM connectionState.Closed Then
tblTransactions WHERE con.Open()
transactiondate=@tdate AND
studentid=@sid" End If
Dim transactions As New
MySqlCommand(sql, con) addcoin.ExecuteNonQuery()
con.Close()
transactions.Parameters.AddWithValue( Else
"@tdate", Date.Today.ToString("yyyy- '~~> Transfer some coins
MM-dd")) tblexist.Clear()
Dim transdid As Integer =
transactions.Parameters.AddWithValue( 0
"@sid", id) Dim transpid As Integer =
da = New 0
MySqlDataAdapter(transactions)
da.Fill(tblexist) sql = "SELECT * FROM
tblDeposits WHERE depositdate=@tdate
If tblexist.Rows.Count > AND studentid=@sid"
0 Then Dim deposits As New
transpid = MySqlCommand(sql, con)
CInt(tblexist.Rows(0).Item("id").ToSt
ring) deposits.Parameters.AddWithValue("@td
End If ate", Date.Today.ToString("yyyy-MM-
dd"))
sql = "CALL
uspTransferCoins(@id,@transdid,@trans deposits.Parameters.AddWithValue("@si
ddate,@transpid,@transpdate,@coin)" d", id)
Dim addcoin As New da = New
MySqlCommand(sql, con)

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 189

MySqlDataAdapter(deposits)
da.Fill(tblexist) addcoin.Parameters.AddWithValue("@tra
nspid", transpid)
If tblexist.Rows.Count >
0 Then addcoin.Parameters.AddWithValue("@tra
transdid = nspdate", Date.Today.ToString("yyyy-
CInt(tblexist.Rows(0).Item("id").ToSt MM-dd"))
ring)
End If addcoin.Parameters.AddWithValue("@coi
n", (paymenttotalamount -
tblexist.Clear() (paymentdeduction + paymentdeposit)))

sql = "SELECT * FROM If con.State =


tblTransactions WHERE connectionState.Closed Then
transactiondate=@tdate AND con.Open()
studentid=@sid" End If
Dim transactions As New
MySqlCommand(sql, con) addcoin.ExecuteNonQuery()
con.Close()
transactions.Parameters.AddWithValue( End If
"@tdate", Date.Today.ToString("yyyy- End Sub
MM-dd"))
Private Sub
transactions.Parameters.AddWithValue( lblTransferCoins_Click(ByVal sender
"@sid", id) As System.Object, ByVal e As
da = New System.EventArgs) Handles
lblTransferCoins.Click
MySqlDataAdapter(transactions) TransferCoins()
da.Fill(tblexist)
End Sub
If tblexist.Rows.Count >
0 Then Private Sub
transpid = lblTransferCoins_MouseLeave(ByVal
CInt(tblexist.Rows(0).Item("id").ToSt sender As Object, ByVal e As
ring) System.EventArgs) Handles
End If lblTransferCoins.MouseLeave
lblTransferCoins.ForeColor =
sql = "CALL Color.White
uspTransferCoins(@id,@transdid,@trans lblTransferCoins.BackColor =
ddate,@transpid,@transpdate,@coin)" Color.FromArgb(40, 40, 40)
Dim addcoin As New End Sub
MySqlCommand(sql, con)
Private Sub
addcoin.Parameters.AddWithValue("@id" lblTransferCoins_MouseMove(ByVal
, id) sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs)
addcoin.Parameters.AddWithValue("@tra Handles lblTransferCoins.MouseMove
nsdid", transdid) lblTransferCoins.ForeColor =
Color.LawnGreen
addcoin.Parameters.AddWithValue("@tra lblTransferCoins.BackColor =
nsddate", Date.Today.ToString("yyyy- Color.FromArgb(20, 20, 20)
MM-dd")) End Sub

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 190

Private WithEvents LoginAnimation As txtStudentNumber.Clear()


New Windows.Forms.Timer End If
Private loginid As String = ""
If (ChrW(e.KeyCode) =
Private Sub LoginStudent() AdminCode.Substring(CodeIndex, 1))
If LoginAnimation.Enabled = Then
True Then Code =
Exit Sub AdminCode.Substring(0, CodeIndex + 1)
End If CodeIndex += 1

If txtStudentNumber.Text = "" If Code = AdminCode Then


Then If
Exit Sub DateDiff(DateInterval.Second,
End If CDate(NextLogin), CDate(Date.Now)) <
0 Then
loginid = ShowError("You
txtStudentNumber.Text have reached your Max Attempt to
txtStudentNumber.Text = "" Login as Administrator.", "Next Login
: " & NextLogin, False)
NumberIndex = 0 CodeIndex = 0
NameIndex = 0 Exit Sub
CourseIndex = 0 End If

LoginAnimation.Tag = "Hide" isAdminLogin = True


LoginAnimation.Start()
End Sub Animation.Tag =
"Hide"
Animation.Start()
Private Code As String = "" End If
Private CodeIndex As Integer = 0 Else
CodeIndex = 0
Private Sub End If
txtStudentNumber_KeyDown(ByVal sender End Sub
As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Private Sub
Handles txtStudentNumber.KeyDown txtStudentNumber_KeyPress(ByVal
If e.KeyCode = Keys.Enter sender As Object, ByVal e As
Then System.Windows.Forms.KeyPressEventArg
Code = "" s) Handles txtStudentNumber.KeyPress
CodeIndex = 0 idlecount = 0
ScreenSaverCount = 0
If LoginDisabled = True
Then Select Case e.KeyChar
Exit Sub Case Backspace
Else Case Number0 To Number9
LoginStudent() Case Else
End If e.Handled = True
ElseIf e.KeyCode = End Select
Keys.Escape Then End Sub
Code = ""
CodeIndex = 0 Private Sub lblClear_Click(ByVal
sender As System.Object, ByVal e As

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 191

System.EventArgs) Handles If LoginAnimation.Tag =


lblClear.Click "Show" Then
txtStudentNumber.Clear() If
End Sub lblStudentLoginTitle.Top < (0 - 8)
Then
Private Sub
lblClear_MouseLeave(ByVal sender As lblStudentInformationTitle.Top += 3
Object, ByVal e As System.EventArgs)
Handles lblClear.MouseLeave lblStudentLoginTitle.Top += 3
ButtonMouseLeave(sender, ElseIf
Color.White) lblStudentLoginTitle.Top < (0) Then
End Sub
lblStudentInformationTitle.Top += 1
Private Sub
lblClear_MouseMove(ByVal sender As lblStudentLoginTitle.Top += 1
Object, ByVal e As End If
System.Windows.Forms.MouseEventArgs)
Handles lblClear.MouseMove If StudentLoginPanel.Top
ButtonMouseMove(sender, > (0 + 20) Then
False, False)
End Sub StudentInformationPanel.Top -= 10
StudentLoginPanel.Top
Private Sub -= 10
lblLoginAccount_Click(ByVal sender As ElseIf
System.Object, ByVal e As StudentLoginPanel.Top > (0 + 8) Then
System.EventArgs) Handles
lblLoginAccount.Click StudentInformationPanel.Top -= 3
LoginStudent() StudentLoginPanel.Top
End Sub -= 3
ElseIf
Private Sub StudentLoginPanel.Top > (0) Then
lblLoginAccount_MouseLeave(ByVal
sender As Object, ByVal e As StudentInformationPanel.Top -= 1
System.EventArgs) Handles StudentLoginPanel.Top
lblLoginAccount.MouseLeave -= 1
ButtonMouseLeave(sender, Else
MainColor) LoginAnimation.Stop()
End Sub

Private Sub txtStudentNumber.Focus()


lblLoginAccount_MouseMove(ByVal End If
sender As Object, ByVal e As Else
System.Windows.Forms.MouseEventArgs) If
Handles lblLoginAccount.MouseMove lblStudentInformationTitle.Top > (0 +
ButtonMouseMove(sender, True, 8) Then
False)
End Sub lblStudentInformationTitle.Top -= 3

Private Sub lblStudentLoginTitle.Top -= 3


LoginAnimation_Tick(ByVal sender As ElseIf
Object, ByVal e As System.EventArgs) lblStudentInformationTitle.Top > (0)
Handles LoginAnimation.Tick Then

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 192

System.EventArgs) Handles
lblStudentInformationTitle.Top -= 1 lblLogOut.Click
LogoutStudent()
lblStudentLoginTitle.Top -= 1 End Sub
End If
Private Sub
If lblLogOut_MouseLeave(ByVal sender As
StudentInformationPanel.Top < (0 - Object, ByVal e As System.EventArgs)
20) Then Handles lblLogOut.MouseLeave
ButtonMouseLeave(sender,
StudentInformationPanel.Top += 10 MainColor)
StudentLoginPanel.Top End Sub
+= 10
ElseIf Private Sub
StudentInformationPanel.Top < (0 - 8) lblLogOut_MouseMove(ByVal sender As
Then Object, ByVal e As
System.Windows.Forms.MouseEventArgs)
StudentInformationPanel.Top += 3 Handles lblLogOut.MouseMove
StudentLoginPanel.Top ButtonMouseMove(sender, True,
+= 3 False)
ElseIf End Sub
StudentInformationPanel.Top < (0)
Then Private Sub
NewsAnimation_Tick(ByVal sender As
StudentInformationPanel.Top += 1 Object, ByVal e As System.EventArgs)
StudentLoginPanel.Top Handles NewsAnimation.Tick
+= 1 If NewsIndex = -1 Then
Else NewsCount = 0

LoginAnimation.Stop() End If

StudentLoginPanel.Enabled = False If NewsCount = 500 Then


NewsAnimation.Stop()

StudentsLoading.Start() If NewsIndex =
End If (CInt(lvNews.Items.Count) - 1) Then
End If NewsIndex = 0
End Sub Else
NewsIndex += 1
Private Sub LogoutStudent() End If
FLogOut = True
loginid = "" If NewsType = 1 Then
lblATitle2.Text =
StudentLoginPanel.Enabled = lvNews.Items(NewsIndex).SubItems(1).T
True ext
lblAcontent2.Text =
LoginAnimation.Tag = "Show" lvNews.Items(NewsIndex).SubItems(2).T
LoginAnimation.Start() ext
End Sub lblADate2.Text =
lvNews.Items(NewsIndex).SubItems(3).T
Private Sub lblLogOut_Click(ByVal ext
sender As System.Object, ByVal e As

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 193

lblATitle2.Top = 0
lblADate2.Top = 0 Private FLogOut As Boolean =
lblAcontent2.Left = 0 False

lblATitle1.Top = 30 Public tblNews As New DataTable


lblADate1.Top = 30 Public NewsList As New List(Of
lblAcontent1.Left = String)
200 Public NewsIndex As Integer = -1
Public NewsId As Integer = 0
NewsType = 2 Public NewsType As Integer = 1
NewsCount = 0
Else Private Sub
lblATitle1.Text = NewsLoading_Tick(ByVal sender As
lvNews.Items(NewsIndex).SubItems(1).T Object, ByVal e As System.EventArgs)
ext Handles NewsLoading.Tick
lblAcontent1.Text = tblNews.Clear()
lvNews.Items(NewsIndex).SubItems(2).T
ext sql = "SELECT * FROM tblNews"
lblADate1.Text = da = New
lvNews.Items(NewsIndex).SubItems(3).T MySqlDataAdapter(sql, con)
ext da.Fill(tblNews)

lblATitle1.Top = 0 If tblNews.Rows.Count > 1


lblADate1.Top = 0 Then
lblAcontent1.Left = 0 If tblNews.Rows.Count =
lvNews.Items.Count Then
lblATitle2.Top = 30 For a = 1 To
lblADate2.Top = 30
lblAcontent2.Left = tblNews.Rows.Count
200 For b = 1 To
NewsType = 1
NewsCount = 0 lvNews.Items.Count
End If If
lvNews.Items(b -
NewsAnimation.Start() 1).SubItems(0).Text.ToString =
Else tblNews.Rows(a -
NewsCount += 1 1).Item("id").ToString Then
End If If Not
End Sub (lvNews.Items(b -
1).SubItems(1).Text.ToString =
Private Sub tblNews.Rows(a - 1).Item(1).ToString)
txtStudentNumber_TextChanged(ByVal Then
sender As System.Object, ByVal e As
System.EventArgs) lvNews.Items(b - 1).SubItems(1).Text
= tblNews.Rows(a -
End Sub 1).Item(1).ToString
End If
Private Sub Panel1_Paint(ByVal
sender As System.Object, ByVal e As If Not
System.Windows.Forms.PaintEventArgs) (lvNews.Items(b -
1).SubItems(2).Text.ToString =
End Sub

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 194

tblNews.Rows(a - 1).Item(2).ToString) End If


Then Next

lvNews.Items(b - 1).SubItems(2).Text If NewsIndex = -1


= tblNews.Rows(a - Then
1).Item(2).ToString NewsIndex = 0
End If NewsId =
lvNews.Items(NewsIndex).SubItems(0).T
If Not ext
(lvNews.Items(b - End If
1).SubItems(3).Text.ToString = End If
CDate(tblNews.Rows(a - Else
1).Item(3).ToString).ToString("MMMM lvNews.Items.Clear()
dd, yyyy")) Then NewsIndex = -1
NewsId = 0
lvNews.Items(b - 1).SubItems(3).Text End If
= CDate(tblNews.Rows(a - End Sub
1).Item(3).ToString).ToString("MMMM
dd, yyyy") Private currmousex As Integer =
End If MousePosition.X
Private currmousey As Integer =
Exit For MousePosition.Y
End If Private idlecount As Integer = 0
Next Private ScreenSaverCount As
Next Integer = 0
Else Private sscount As Integer = 1
lvNews.Items.Clear()
NewsIndex = -1 Private Sub
ScreenSaver_Tick(ByVal sender As
For a = 1 To Object, ByVal e As System.EventArgs)
tblNews.Rows.Count Handles ScreenSaver.Tick
If id > 0 Then
Dim lv As Exit Sub
ListViewItem =
lvNews.Items.Add(tblNews.Rows(a - End If
1).Item("id").ToString)
If MousePosition.X =
lv.SubItems.Add(tblNews.Rows(a - currmousex Then
1).Item(1).ToString) If MousePosition.Y =
currmousey Then
lv.SubItems.Add(tblNews.Rows(a - idlecount += 1
1).Item(2).ToString) Else
currmousex =
lv.SubItems.Add(CDate(tblNews.Rows(a MousePosition.X
- 1).Item(3).ToString).ToString("MMMM currmousey =
dd, yyyy")) MousePosition.Y
idlecount = 0
If ScreenSaverCount = 0
NewsId.ToString = tblNews.Rows(a - End If
1).Item("id").ToString Then Else
NewsIndex = a currmousex =
- 1 MousePosition.X

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 195

currmousey = End If
MousePosition.Y
idlecount = 0
ScreenSaverCount = 0 sscount += 1
End If ScreenSaverCount = 0
Else
If idlecount >= 500 Then ScreenSaverCount += 1
pb1.Visible = True End If
idlecount = 500 Else

If ScreenSaverCount = 500 pb1.Visible = False


Then End If
If End Sub
File.Exists(Application.StartupPath &
"\ScreenSaver\" & sscount & ".jpg") Private Sub Label6_Click(ByVal
Then sender As System.Object, ByVal e As
pb1.Image = System.EventArgs) Handles
System.Drawing.Image.FromFile(Applica Label6.Click
tion.StartupPath & "\ScreenSaver\" &
sscount & ".jpg") End Sub
Else
pb1.Image = End Class
System.Drawing.Image.FromFile(Applica
tion.StartupPath &
"\ScreenSaver\1.jpg")

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 196

APPENDIX H

Use Case Diagram

Vending Machine Coin Tuition Kiosk for


Quezon City Polytechnic University
Students

View Tuition Fee

View Balance

View Payments

Insert Coins
(1,5,10php)
STUDENT

View
Transaction
History

View
Scholarship
Percentage

Figure no 8.1 Use Case Diagram

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 197

Add New
Update Course
Account
Settings

Add New Student

Add New Payment


Tuition fee

Search Student

Validate the
Payment of the
Student

Set the Scholarship


Percentage
ADMIN

View Student
Payment

Edit Student
Information

Delete Student
Information

Figure no. 8.2 Use Case Diagram

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 198

View Previous
Payment of the
Student

Print Receipt

Print Transaction
History

View Payment
Validation history

Transfer Excess Coins

ADMIN
Post New
Announcement

View Student
Deposited Coins

Figure no. 8.3 Use Case Diagram

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y
QUEZON CITY POLYTECHNIC UNIVERSITY 199

Add New Admin

Delete Admin
Account

Edit Student Payment

Update Account
Settings

View Activity Log

SUPER View System


ADMIN Statistics

Edit Admin Account

Update System
Settings

Figure no. 8.4 Use Case Diagram

D E P A R T M E N T OF I N F O R M A T I O N T E C H N O L O G Y

S-ar putea să vă placă și