fitness center 1

122
Fitness Club System A Project Report Submitted On Fitness Centre Management Submitted in Partial fulfilment of the requirements for the award of Degree Post Graduate Diploma In Computer Application From Pt. RavishankarShukla University Raipur(C.G.) Year : 2014-2015 Guided By : Submitted By: SandeepNamdeo Usat Yadav Submitted to Central College of IT Raipur(C.G.) Pt.RavishankarShukla University Raipur (C.G.) 1 T.Y. Computer Science 2007-2008

Upload: professormanoj

Post on 16-Jan-2016

15 views

Category:

Documents


1 download

DESCRIPTION

fitness

TRANSCRIPT

Page 1: Fitness Center 1

Fitness Club System

A

Project ReportSubmitted

On

Fitness Centre ManagementSubmitted in Partial fulfilment of the

requirements for the award of Degree Post Graduate Diploma In Computer

ApplicationFrom

Pt. RavishankarShukla University Raipur(C.G.) Year : 2014-2015

Guided By : Submitted By:SandeepNamdeo Usat Yadav

Submitted toCentral College of IT Raipur(C.G.)

Pt.RavishankarShukla University Raipur (C.G.)

1 T.Y. Computer Science 2007-2008

Page 2: Fitness Center 1

Fitness Club System

CERTIFICATE OF APPROVAL

This is to certify that the Project work entitled “ Fitness Centre Management “ is

carried out by Usat Yadav student of PGDCA at Central college of IT Raipur

C.G. is hereby approved as a credible work in the discipline of Computer Science

& Information Technology for the award of Post Graduate Diploma In Computer

Application during the year 2015 from Pt. RavishankarShukla University, Raipur

(C.G.)

(Head

Name)

2 T.Y. Computer Science 2007-2008

Page 3: Fitness Center 1

Fitness Club System

CERTIFICATE

This is to certify that the Project work entitled “fitness Centre Management” Submitted to the Central College of IT Raipur C.G. by Usat Yadav in partial fulfilment for the requirements relating to nature and standard of the award of Post Graduate Diploma In Computer Application degree by , Pt. RavishankarShukla University Raipur (C.G.) for the academic year 2014-2015This project work has been carried out under my guidance.

(Guide Name)

3 T.Y. Computer Science 2007-2008

Page 4: Fitness Center 1

Fitness Club System

CERTIFICATE OF EVALUATION

This is to certify that the work entitled “fitness centre Management ” is carried out by Usat Yadav student of PGDCA at Central college of IT Raipur C.G. after proper evaluation and examination ,is hereby approved as a

credible work in the discipline of Computer Science & Information Technology and is done in a satisfactory manner for its acceptance as

a requisite for the award of Post Graduate Diploma In Computer Application during the year 2014-15 from Pt. RavishankarShukla

University , Raipur (C.G).

Internal Examiner External Examiner

4 T.Y. Computer Science 2007-2008

Page 5: Fitness Center 1

Fitness Club System

DECLARATION

This to certify that the project report entitled “Fitness Centre Management ” which is submitted by me in the partial fulfilment for the award of the Post Graduate

Diploma In Computer Application , Central College of IT Raipur (C.G.) , comprise the original work carried out by me.

I further declare that the work reported in this project has not been submitted and will not be submitted , either in part or in full for the award of any other degree or

diploma in this institute or any other institute or University .

Place : RaipurDate:- Usat Yadav

5 T.Y. Computer Science 2007-2008

Page 6: Fitness Center 1

Fitness Club System

ACKNOWLEDGEMENT

This project is an inspiration, support , guidance , corporation and

facilities that were extended to us at their best and by person at all

levels . i was indebted to all of them.

I wish to acknowledgement my profound sense of gratitude to the

project guide Mr. SandeepNamdeo for his remarkable guidance

and continued encouragement during the development of project .

It was a matter of great felicity and privilege for me to work under

the aegis .I would like to extend my special thanks to Mr. Jograj

Singh (Principal- Central College of IT Raipur) for boosting my

confidence when i was lacking so.

I offer our sincere thanks to Department staff members . Finally I

would also like to thank my entire classmate for their corporation and

support. I would like to pay my everlasting regards to my college

“Central College of IT Raipur” Where this project gets completed.

1. INTRODUCTION

TOPIC : FITNESS CLUB MANAGEMENT

6 T.Y. Computer Science 2007-2008

Page 7: Fitness Center 1

Fitness Club System

The P ionee r F i t ne s s Cen t r e was founded i n 2005 and i s l oca t ed nea r

Bhayenda r s t a t i on . The cen t r e was s t a r t ed fo r t he l oca l peop l e o f

nea rby soc i e ty by R .N .A bu i l de r s . I t was t he on ly t he power gym in

t ha t a r ea wh ich p rov ide s mode rn equ ipmen t s . The c lub p rov ide s

va r i ous f a c i l i t i e s such a s Swimming , Ca rd io , S t eam & Gymnas ium.

I t a l so p rov ide s fou r t o f i ve t r a i ne r f o r e ach f ac i l i t e s , work ing a t

d i f f e r en t sh i f t . Va r ious s chemes a r e p rov ided by t he c lub acco rd ing

t o member s r equ i r emen t .The F i t ne s s Cen t r e a l so p rov ide f ac i l i t i e s

such a s We igh t Los s ,We igh t Ga in & Pe r seona l T ra in ing

2. PLANNING

2.1 DEFINING THE PROBLEM

7 T.Y. Computer Science 2007-2008

Page 8: Fitness Center 1

Fitness Club System

1 . I t was d i f f i cu l t t o ma in t a in t he r e co rds o f e ach and eve ry

member manua l l y .

2 . The admi s s ion p roce s s was t ime consuming .

3 . Manua l work c an c ause human e r ro r .

4 . Ma in t a ing r e co rds o f va r i ous f a c i l i t i e s u sed by a

pa r t i cu l a r member was d i f f i cu l t .

5 . Hand l i ng o f f i l e s & pape r was d i f f i cu l t and t he i r was chance o f

m i sp l ac ing i t .

2.2 ANTICIPATED BENEFITS

1 . The da t abase o f e ach member w i l l b e ma in t a ined

sy s t ema t i c a l l y .

2 . I t w i l l keep t he t r a ck r eco rds o f va r i ous f a c i l i t i e s u sed by a

pa r t i cu l a r member .

3 . The admis s ion p rocedu re w i l l be f a s t e r and r ece ip t w i l l be

gene ra t ed i n s t an t l y .

4 . I t w i l l ma in t a in a t t endance o f s t a f f member s .

2.3 CONTEXT DIAGRAM

8 T.Y. Computer Science 2007-2008

Page 9: Fitness Center 1

Fitness Club System

2.4 FEASIBLITY STUDY

9 T.Y. Computer Science 2007-2008

Page 10: Fitness Center 1

Fitness Club System

The ve ry f i r s t phase i n a sy s t em deve lop ing l i f e cyc l e i s

p r e l im ina ry i nves t i ga t i on . The f ea s ib i l i t y s t udy i s a ma jo r pa r t o f

t h i s phase . A measu re o f how bene f i c i a l o r p r ac t i c a l t he

deve lopmen t o f any i n fo rma t ion sy s t em wou ld be t o t he o rgan i za t i on

i s t he f e a s ib i l i t y s t udy .

Ou r s t udy o f t he f e a s ib l e deve lopmen t o f t he so f twa re i s go ing t o

be i n t e rms o f f o l l owing s t eps :

2.4.1 ECONOMIC FEASIBILTY

I t i s u sed t o de t e rmine t he deve lopmen t co s t and t he

an t i c i pa t ed bene f i t s o f t he sy s t ems and sy s t em budge t shou ld

no t exceed t he c l i en t budge t .

Anticipated Benefits:

Tangible Benefits

1 . I t w i l l be l e s s t ime consuming .

2 . The sy s t em can be hand l e by a s i ng l e pe r son so s t a f f c an

be r educed .

3 . The cos t on s t a t i ona ry such a s measu remen t c a rd ,

admi s s ion fo rm can be r educed .

Intangible Benefits

1 . The s a t i s f ac t i on o f member s w i l l be more .

2 . A good i n t e r ac t i on be tween member and s t a f f .

3 . In r ea se l eve l o f s e rv i ce

Development Cost

10 T.Y. Computer Science 2007-2008

Page 11: Fitness Center 1

Fitness Club System

Operational

cost

Equipment & Maintenance 5000

Programming 1000

Help Desk 750

TOTAL 6750

2.4.2 CULTURAL FEASIBILITY

As sy s t em u se r a r e new to t he sy s t em t hey c an f a ce t he

p rob l em o f adap t i ng t o sy s t em. Bu t sy s t em i s so de s igned t ha t

i t h a s r e s emb lance t o p r ev ious manua l sy s t em p rocedu re , w i t h

he lp o f t r a i n ing t h i s p rob l em c an be so lved .

2.4.3 TECHNICAL FEASIBILITY

1 . Up g rada t i on o f r e cen t compu te r s sy s t em.

2 . Do t ma t r i x p r i n t e r .

11 T.Y. Computer Science 2007-2008

CATEGORY AMOUNT

Salary & Wages 28000

Software & License 8000

Training 1500

Uitilites & Tools 500

Travel & Miscelleneous 1000

TOTAL 39000

Page 12: Fitness Center 1

Fitness Club System

2.4.4 SCHEDULING FEASIBILTY

1 . To comple t e t he p ro j ec t , pha se w i se i n a l l oca t ed t ime .

2 . To comple t e t he e ach phase i n t ime so t ha t p ro j ec t c an be

comple t ed i n dead l i ne .

3 . Af t e r s chedu l i ng compa r i son can be made t o s ee whe the r

t ime t ab l e co inc ide s , i f no t co r r ec t i ve measu re c an be

t aken , such a s r educ ing s cope o f t he p ro j ec t .

4. Be low i s t he Gan t t Cha r t wh ich shows t he s chedu l e o f

t he p ro j ec t .

3. ANALYSIS

3.1 INFORMATION GATHERING

3.1.1 QUESTIONAIRE

12 T.Y. Computer Science 2007-2008

Page 13: Fitness Center 1

Fitness Club System

1 . Wha t a r e t he f a c i l i t i e s p rov ided by t he power house f i t ne s s

so lu t i on?

2 . Wha t a r e t he s chemes p rov ided by t he c lub ?

3 . How many f ac i l i t i e s c an a pa r t i cu l a r member u se i n a day?

4 . How many t r a i ne r s a r e p rov ided fo r e ach f ac i l i t i e s ?

5 . How i s you r mode o f paymen t a r e i n s t a l lmen t s a l l owed t o

member s?

6 . Do you p rov ide spec i a l o f f e r s t o member s a s t he s ea son

changes?

7 . Wha t i s t he t im ing o f e ach f ac i l i t i e s ?

8 . How do you ma in t a in you r p r e sen t r e co rds?

9 . Do you r e fund money t o member i f he c ance l admi s s ion?

10 . Do you have compu te r i f ye s , t hen wha t t he con f igu ra t i on?

11 . Do you a l l ow member t o change s cheme o r f a c i l i t i e s i f once

s e l e c t ed ?

12 . How do you so lve t he compla in t s o f t he member s ?

13 T.Y. Computer Science 2007-2008

Page 14: Fitness Center 1

Fitness Club System

3.2 THINGS

14 T.Y. Computer Science 2007-2008

Page 15: Fitness Center 1

Fitness Club System

3.3 ENTITY RELATIONSHP DIGRAM(E.R.D)

15 T.Y. Computer Science 2007-2008

Page 16: Fitness Center 1

Fitness Club System

3.4 EVENT TABLE

EVENT TRIGGER SOURCE USE

CASE

RESPONSE DESTINATION

16 T.Y. Computer Science 2007-2008

Page 17: Fitness Center 1

Fitness Club System

1) Member

Schemes

Enrolment.

Schemes

facilities

details

Member

Recor

d

details

Of

Enrolme

nt

Confirmed

Enrolment Member

2) Member

Wants To

Renew

Membershi

p.

Renewal Of

membership Member

Record

Renewal

Of

Schemes

Confirmati

on Of

Renewal Member

3) Record

Staff

Attendance

Daily ------- Update

Schemes

------- ---------

4) Time To

Produce

Transaction

Summary

Report

End

Of

Day

-------

Produce

Transac

tion

Summar

y

Report

Transaction

Summary

Report

Management

5) Time To

Produce

Attendance

Report

Monthly -------

Produce

Staff

Attenda

nce

Report

Attendanc

e

Report

Management

3.5 D.F.D FRAGMENTS

17 T.Y. Computer Science 2007-2008

Page 18: Fitness Center 1

Fitness Club System

Cont Of D.F.D

18 T.Y. Computer Science 2007-2008

Page 19: Fitness Center 1

Fitness Club System

Cont of D.F.D

19 T.Y. Computer Science 2007-2008

Page 20: Fitness Center 1

Fitness Club System

3.7 EVENT PARTITION

20 T.Y. Computer Science 2007-2008

Page 21: Fitness Center 1

Fitness Club System

3.8 DECOMPOSITION

21 T.Y. Computer Science 2007-2008

Page 22: Fitness Center 1

Fitness Club System

Diagram 1:- Enroll Member

Cont of Decomposition …

Diagram 2:-Update Member Details

22 T.Y. Computer Science 2007-2008

Page 23: Fitness Center 1

Fitness Club System

Cont of Decomposition …

Diagram 3:- Update Membership

23 T.Y. Computer Science 2007-2008

Page 24: Fitness Center 1

Fitness Club System

3.8 PROCESS DESCRIPTION

3.8.1 STRUCTURED ENGLISH

24 T.Y. Computer Science 2007-2008

Page 25: Fitness Center 1

Fitness Club System

Process 1 :- Enroll Member

Create enroll member { Accept member details Accept facilities details Accept schemes details Create records of details }

Process 2 :- Update Member Details

Create updates{ Accept member details Accept facilities details Accept schemes details Update details Create confirmation}

Process 3 :-Update Membership

Create renewal{ Accept member details Accept schemes details Update details Create confirmation}

Process 4 :- Record Attendance

Create attendance{ Accept staff details Update attendance

25 T.Y. Computer Science 2007-2008

Page 26: Fitness Center 1

Fitness Club System

}

Process 5 :- Produce Transaction Report

Create transaction report { Accept member details Accept schemes details Create transaction details}

Process 6 :- Produce Attendance Report

Create attendance report { Accept staff details Accept attendance details Create attendance report}

3 .8 .2 DATA FLOW DEFINITION

1) Enrollment Request

26 T.Y. Computer Science 2007-2008

Page 27: Fitness Center 1

Fitness Club System

Enrollment - Id

Member - Id

Scheme - Name - Duration - Admin - Expiry - Amount

Facility - Name - Duration - Admin - Expiry - Amount Amount

2) Member Details Change Request

Member - Id - First Name

- Middle Name - Last Name - Address - Mobile - Residence - DOB - Age - Gender

3) Renewal Of Membership

Enrollment - Id

Member - Id

27 T.Y. Computer Science 2007-2008

Page 28: Fitness Center 1

Fitness Club System

Scheme - Name - Duration - Admin - Expiry - Amount

Facility - Name - Duration - Admin - Expiry - Amount Amount

4) Attendance Details

Staff - IdDateTimeAttend

5) Transaction Summary Report

Scheme - Id - Name Facility - Id - Name Member - Id - Surname - First Name

- Middle Name - Date Of Joining - Expiry Date Amount Date

6) Attendance Report

Staff - Id - Surname - First Name

- Middle Name

28 T.Y. Computer Science 2007-2008

Page 29: Fitness Center 1

Fitness Club System

DateAttend Days

3 . 8 .3 DATA ELEMENT DEFINITION

1) Enrollment Request Enrollment - Id = Positive integer max upto four digit Member - Id = Positive integer max upto four digit Scheme - Name = Text field with max 20 characters Scheme - Duration = Text field with max 20 characters Scheme - Admin = Date Scheme - Expiry = Date Scheme - Amount = Currency in rupees Facility - Name = Text field with max 20 characters Facility - Duration = Text field with max 20 characters Facility - Admin = Date Facility - Expiry = Date Facility - Amount = Currency in rupees Amount = Currency in rupees

2) Member Details Change Request

Member - Id = Positive integer max upto four digit Member - Surname = Text field with max 50 characters Member - First Name = Text field with max 50 characters Member - Middle Name = Text field with max 50 characters Member - Address = Text field with max 250 characters Member - Mobile = Positive integer max upto ten digit Member - Residance = Positive integer max upto ten digit Member – Dob = Date Member -Age = Positive integer max upto twor digit Member – Gender = Text field with max 6 characters

3) Renewal Of membership Enrollment - Id = Positive integer max upto four digit Member - Id = Positive integer max upto four digit Scheme - Name = Text field with max 20 characters Scheme - Duration = Text field with max 20 characters Scheme - Admin = Date

29 T.Y. Computer Science 2007-2008

Page 30: Fitness Center 1

Fitness Club System

Scheme - Expiry = Date Scheme - Amount = Currency in rupees Facility - Name = Text field with max 20 characters Facility - Duration = Text field with max 20 characters Facility - Admin = Date Facility - Expiry = Date Facility - Amount = Currency in rupees Amount = Currency in rupees

4) Attendance Details

Staff - Id = Positive integer max upto four digit Staff - Surname = Text field with max 50 characters Staff - First Name = Text field with max 50 characters Staff- Middle Name = Text field with max 50 characters Date = Date Time = Time Attend Days = yes /no

5) Transaction Summary Report

Scheme – Name =Text field with max 20 characters Facility – Name =Text field with max 20 characters Member - Id = Positive integer max upto four digit Member – Surname = Text field with max 50 characters Member - First Name = Text field with max 50 characters Member - Middle Name = Text field with max 50 characters Date Of Joining = Date Expiry Date= Date Amount = Currency in rupees Date = Date

6) Attendance Report

Staff - Id = Positive integer max upto four digit Staff - Surname = Text field with max 50 characters Staff - First Name = Text field with max 50 characters Staff- Middle Name = Text field with max 50 characters

30 T.Y. Computer Science 2007-2008

Page 31: Fitness Center 1

Fitness Club System

Date = Date Attend Days = Positive integer max upto two digit

3 . 8 .4 DATA STORE ELEMENT

1) Member Database Surname , Firstname , Middlename , Id , Address , Mobile , Residance , Dob , Age , Gender.

2) Enrollment Database Enrollment_Id , Member_Id ,Scheme_Name , Scheme_Duration , Scheme_Admin , Scheme_Expiry , Scheme_ Amount , Facility_Name , Facility _Duration , Facility _Admin , Facility_Amount , Amount

3) Scheme Database Scheme Id ,Scheme_Name , Duration , Fees.

4) Facility Database Facility_Id , Facility_Name , Duration , Fees.

5) Staff Database

Surname , Firstname , Middlename , Id , Address , Mobile , Residance , Gender .Post.

6) Attendance Database Surname , Firstname , Middlename , Id , Date , Time , Attend .

7) Payment Database Enrollment_Id ,Recipt_no, Payment_mmode, Name , Cheque_No , Date ,Amount.

31 T.Y. Computer Science 2007-2008

Page 32: Fitness Center 1

Fitness Club System

4 DESIGN PHASE

4.1 Automation System Boundary

32 T.Y. Computer Science 2007-2008

Page 33: Fitness Center 1

Fitness Club System

4.2 System Flow Chart

4.3 Structure Chart

33 T.Y. Computer Science 2007-2008

Page 34: Fitness Center 1

Fitness Club System

Cont of Structure Chart ……

34 T.Y. Computer Science 2007-2008

Page 35: Fitness Center 1

Fitness Club System

Cont of Structure Chart

35 T.Y. Computer Science 2007-2008

Page 36: Fitness Center 1

Fitness Club System

4.4 Database Design

36 T.Y. Computer Science 2007-2008

Page 37: Fitness Center 1

Fitness Club System

1) Table Name: Member

Field Name Data Type Size Constraint DescriptionMemberId Number Long integer Primary key

Not nullUnique Member identification

First Text 50 Not null Member First nameMiddle Text 50 Not null Member Middle nameLast Text 50 Not null Member Last nameAddress Text 150 Not null Member AddressMobile. Number Long integer Not null Member contact no.Residance Number Long integer Not null Member resident noDOB Date/Time Not null Member DobAge Number Long integer Not null Member Age Gender Text 7 Not null Male/Female

2) Table Name: Staff

Field Name Data Type Size Constraint DescriptionStaff Id Number Long integer Primary key

Not nullUnique Staff identification

First Text 50 Not null Staff First nameMiddle Text 50 Not null Staff Middle nameLast Text 50 Not null Staff Last nameAddress Text 150 Not null Staff AddressMobile. Number Long integer Not null Staff contact no.Residance Number Long integer Not null Staff resident noGender Text 7 Not null Male/FemalePost Text 10 Not Null Staff PostAge Number Long integer Not null Staff Age

3) Table Name: Scheme

Field Name Data Type Size Constraint Description

37 T.Y. Computer Science 2007-2008

Page 38: Fitness Center 1

Fitness Club System

Scheme Id Number Long integer Primary keyNot null

Unique Scheme identification

Name Text 50 Not null Scheme nameDuration Text 50 Not null Scheme AddressFees Currency 50 Not null Fees in Rs

3) Table Name: Facility

Field Name Data Type Size Constraint DescriptionFacility Id Number Long integer Primary key

Not nullUnique Facility identification

Name Text 50 Not null Facility nameDuration Text 50 Not null Facility AddressFees Currency 50 Not null Fees in Rs

4) Table Name: Enrollment

Field Name Data Type Size Constraint DescriptionEnrollment Id Number Long integer Primary key

Not nullUnique Member Enroll identification

MemberId Number Long integer Primary keyNot null

Unique Member identification

SchemeName Text 50 Not null SchemeNameSchemeDuration Text 50 Not null Member

SchemeDurationSchemeAdmin Date Not null Member Scheme

Admin dateSchemeExpiry Date Not null Member Scheme

Expiry dateSchemeAmount Currency Not null Scheme AmountFacilityName Text 50 Not null FacilityNameFacilityDuration Text 50 Not null Member

FacilityDurationFacilityAdmin Date Not null Member Facility

Admin dateSchemeAmount Currency Not null Scheme Amount

TotalAmount Currency Not null Total Amount

5) Table Name: Attendance

Field Name Data Type Size Constraint DescriptionSTaff Id Number Long integer Primary key Unique Staff

38 T.Y. Computer Science 2007-2008

Page 39: Fitness Center 1

Fitness Club System

Not null identificationDate Date 50 Not null Staff Attendace dateTime Time 50 Not null Staff Attendace TimeAttend Yes/ no Not null Staff attendance

Form Design Layouts

MDIForm1

39 T.Y. Computer Science 2007-2008

Page 40: Fitness Center 1

Fitness Club System

FrmMember

40 T.Y. Computer Science 2007-2008

Page 41: Fitness Center 1

Fitness Club System

FrmStaff

41 T.Y. Computer Science 2007-2008

Page 42: Fitness Center 1

Fitness Club System

FrmScheme

42 T.Y. Computer Science 2007-2008

Page 43: Fitness Center 1

Fitness Club System

FrmFacility

43 T.Y. Computer Science 2007-2008

Page 44: Fitness Center 1

Fitness Club System

FrmEnrollment

44 T.Y. Computer Science 2007-2008

Page 45: Fitness Center 1

Fitness Club System

FrmAttendance

45 T.Y. Computer Science 2007-2008

Page 46: Fitness Center 1

Fitness Club System

FrmPayment

46 T.Y. Computer Science 2007-2008

Page 47: Fitness Center 1

Fitness Club System

FrmRecipt

47 T.Y. Computer Science 2007-2008

Page 48: Fitness Center 1

Fitness Club System

FrmMontlyReport

48 T.Y. Computer Science 2007-2008

Page 49: Fitness Center 1

Fitness Club System

FrmDailyReport

49 T.Y. Computer Science 2007-2008

Page 50: Fitness Center 1

Fitness Club System

Report 1 Recipt Generation

50 T.Y. Computer Science 2007-2008

Page 51: Fitness Center 1

Fitness Club System

Report 2

51 T.Y. Computer Science 2007-2008

Page 52: Fitness Center 1

Fitness Club System

Montly Member Transaction

Report 3

52 T.Y. Computer Science 2007-2008

Page 53: Fitness Center 1

Fitness Club System

Daily Member Transaction

5 Implementaion

53 T.Y. Computer Science 2007-2008

Page 54: Fitness Center 1

Fitness Club System

5.1 Coding

FrmMember

Private Sub cmbSearch_LostFocus() txtSearch.SetFocusEnd Sub

Private Sub cmdAdd_Click() cmdAdd.Enabled = FalseUserMode = "Add" Call clear getNxID Call Enableall cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdSave.Enabled = True txtFirst.SetFocusEnd SubPrivate Sub cmdCancel_Click() If MsgBox("Do you want to cancel the current transaction", vbYesNo + vbCritical, strmessage) = vbYes Then Call clear cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdAdd.Enabled = True cmdSave.Enabled = False End IfEnd Sub

Private Sub cmdDelete_Click() If MsgBox("Do you want to delete this record", vbYesNo + vbCritical, strmessage) = vbYes Then With rs .MoveFirst .Move FlexMember.Row - 1 .Delete FlexMember.RemoveItem FlexMember.Row .MoveNext filllist If .EOF Then On Error Resume Next

54 T.Y. Computer Science 2007-2008

Page 55: Fitness Center 1

Fitness Club System

.MovePrevious On Error GoTo 0 If .BOF Then MsgBox "no record" cmdDelete.Enabled = False Else filllist End If Else filllist End If End With End If Call clear cmdAdd.Enabled = True cmdSave.Enabled = TrueEnd SubPrivate Sub cmdExit_Click() If MsgBox("Do you want to Exit", vbYesNo + vbCritical, strmessage) = vbYes Then Unload Me End IfEnd SubPrivate Function filllist() As Boolean Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset sql = "Select * from Member where MemberId=" & Val(txtId) rs.Open sql, Conn, adOpenKeyset, adLockOptimistic If Not rs.EOF Then lblMemberIdText.Caption = Val(rs("MemberId")) txtLast = UCase(rs("Last")) txtFirst = Trim(rs("First")) txtMiddle = Trim(rs("Middle")) txtAddress = Trim(rs("Address")) txtMobile = Val(rs("Mobile")) txtResidance = Trim(rs("Residance")) dtpDob = Format(Trim(rs("Dob") & ""), "dd/MM/yyyy") txtAge = Val(rs("Age")) optMale.Value = IIf(Trim(rs("Gender") & "") = "Male", True, False) optFemale.Value = IIf(Trim(rs("Gender") & "") = "Female", True, False)End If rs.Close Set rs = NothingEnd FunctionPrivate Sub cmdSave_Click() If txtFirst.Text = "" Then Call Message

55 T.Y. Computer Science 2007-2008

Page 56: Fitness Center 1

Fitness Club System

txtFirst.SetFocus Exit Sub End If If txtLast.Text = "" Then Call Message txtLast.SetFocus Exit Sub End If If txtMiddle.Text = "" Then Call Message txtMiddle.SetFocus Exit Sub End If If txtMobile.Text = "" Then Call Message txtMobile.SetFocus Exit Sub End If If txtResidance.Text = "" Then Call Message txtResidance.SetFocus Exit Sub End If If txtAge.Text = "" Then Call Message txtAge.SetFocus Exit Sub End If If txtAddress.Text = "" Then Call Message txtAddress.SetFocus Exit Sub End If UserMode = "Add" Set rs = New ADODB.Recordset rs.Open "Member", Conn, adOpenKeyset, adLockOptimistic rs.AddNew rs("MemberId") = Val(lblMemberIdText.Caption) SaveRec rs rs.Update rs.Close If MsgBox("Record Saved", vbOKOnly + vbInformation, strmessage) Then FillGrid End If Call clear cmdUpdate.Enabled = False

56 T.Y. Computer Science 2007-2008

Page 57: Fitness Center 1

Fitness Club System

cmdDelete.Enabled = False cmdAdd.Enabled = True cmdSave.Enabled = False Call Disableall End SubPrivate Sub cmdSearch_Click() Call Enableall cmdAdd.Enabled = False cmdSave.Enabled = False cmdUpdate.Enabled = True cmdDelete.Enabled = True sql = "select * from Member" If cmbSearch.ListIndex = 0 Then sql = sql & " where MemberId= " & Val(txtSearch) ElseIf cmbSearch.ListIndex = 1 Then sql = sql & " where Trim(First) like '%" & UCase(Trim(txtSearch)) & "%' " ElseIf cmbSearch.ListIndex = 2 Then sql = sql & " where Trim(Middle) like '%" & UCase(Trim(txtSearch)) & "%' " ElseIf cmbSearch.ListIndex = 3 Then sql = sql & " where Trim(Last) like '%" & UCase(Trim(txtSearch)) & "%' " Else Exit Sub End If Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset rs.Open sql, Conn, adOpenKeyset, adLockOptimistic If Not rs.EOF Then lblMemberIdText.Caption = Val(rs("MemberId")) txtLast = UCase(rs("Last")) txtFirst = Trim(rs("First")) txtMiddle = Trim(rs("Middle")) txtAddress = Trim(rs("Address")) txtMobile = Val(rs("Mobile")) txtResidance = Trim(rs("Residance")) dtpDob = Format(Trim(rs("Dob") & ""), "dd/MM/yyyy") txtAge = Val(rs("Age")) optMale.Value = IIf(Trim(rs("Gender") & "") = "Male", True, False) optFemale.Value = IIf(Trim(rs("Gender") & "") = "Female", True, False) End If rs.Close Set rs = Nothing txtSearch = ""End SubPrivate Sub cmdUpdate_Click() If txtFirst.Text = "" Then Call Message

57 T.Y. Computer Science 2007-2008

Page 58: Fitness Center 1

Fitness Club System

txtFirst.SetFocus Exit Sub End If If txtLast.Text = "" Then Call Message txtLast.SetFocus Exit Sub End If If txtMiddle.Text = "" Then Call Message txtMiddle.SetFocus Exit Sub End If If txtMobile.Text = "" Then Call Message txtMobile.SetFocus Exit Sub End If If txtResidance.Text = "" Then Call Message txtResidance.SetFocus Exit Sub End If If txtAge.Text = "" Then Call Message txtAge.SetFocus Exit Sub End If If txtAddress.Text = "" Then Call Message txtAddress.SetFocus Exit Sub End If SaveRec rs rs.Update FlexMember.TextMatrix(FlexMember.Row, 1) = lblMemberIdText.Caption FlexMember.TextMatrix(FlexMember.Row, 2) = txtLast FlexMember.TextMatrix(FlexMember.Row, 3) = txtFirst FlexMember.TextMatrix(FlexMember.Row, 4) = txtMiddle FlexMember.TextMatrix(FlexMember.Row, 5) = txtAddress FlexMember.TextMatrix(FlexMember.Row, 6) = txtMobile FlexMember.TextMatrix(FlexMember.Row, 7) = txtResidance FlexMember.TextMatrix(FlexMember.Row, 8) = dtpDob FlexMember.TextMatrix(FlexMember.Row, 9) = txtAge If optFemale.Value = True Then

58 T.Y. Computer Science 2007-2008

Page 59: Fitness Center 1

Fitness Club System

FlexMember.TextMatrix(FlexMember.Row, 10) = "Female" Else FlexMember.TextMatrix(FlexMember.Row, 10) = "Male" End If MsgBox "Record Updated", vbOKOnly + vbInformation, strmessage Call clear cmdAdd.Enabled = True cmdSave.Enabled = True cmdUpdate.Enabled = False cmdDelete.Enabled = FalseEnd Sub

Private Sub dtpDob_Validate(Cancel As Boolean) txtAge = DateDiff("yyyy", dtpDob, Now)End Sub

Private Sub FlexMember_Click()cmdAdd.Enabled = FalsecmdSave.Enabled = FalsecmdUpdate.Enabled = TruecmdDelete.Enabled = Truers.MoveFirstrs.Move FlexMember.Row - 1lblMemberIdText.Caption = FlexMember.TextMatrix(FlexMember.Row, 1)txtLast = FlexMember.TextMatrix(FlexMember.Row, 2)txtFirst = FlexMember.TextMatrix(FlexMember.Row, 3)txtMiddle = FlexMember.TextMatrix(FlexMember.Row, 4)txtAddress = FlexMember.TextMatrix(FlexMember.Row, 5)txtMobile = FlexMember.TextMatrix(FlexMember.Row, 6)txtResidance = FlexMember.TextMatrix(FlexMember.Row, 7)dtpDob = FlexMember.TextMatrix(FlexMember.Row, 8)txtAge = FlexMember.TextMatrix(FlexMember.Row, 9)optMale.Value = IIf(Trim(FlexMember.TextMatrix(FlexMember.Row, 10) & "") = "Male", True, False)optFemale.Value = IIf(Trim(FlexMember.TextMatrix(FlexMember.Row, 10) & "") = "Female", True, False)Call EnableallEnd SubPrivate Sub Form_Load()Call FillGridCall DisableallcmdUpdate.Enabled = FalsecmdDelete.Enabled = FalsecmdSave.Enabled = FalsecmbSearch.AddItem "MemberId"cmbSearch.AddItem "First Name"

59 T.Y. Computer Science 2007-2008

Page 60: Fitness Center 1

Fitness Club System

cmbSearch.AddItem "Middle Name"cmbSearch.AddItem "Last Name"End SubPrivate Sub txtAge_KeyPress(KeyAscii As Integer)KeyAscii = CheckNum(KeyAscii)End SubPrivate Sub txtFirst_KeyPress(KeyAscii As Integer)KeyAscii = CheckName(KeyAscii)End SubPrivate Sub txtMiddle_KeyPress(KeyAscii As Integer)KeyAscii = CheckName(KeyAscii)End SubPrivate Sub txtMobile_KeyPress(KeyAscii As Integer)KeyAscii = CheckNum(KeyAscii)End Sub

Private Sub txtMobile_LostFocus()If Len("txtMobile.text") < 10 ThenMsgBox "please enter correct ", vbOKOnly'txtMobile.Text = ""'txtMobile.SetFocusEnd If

End Sub

Private Sub txtResidance_KeyPress(KeyAscii As Integer)KeyAscii = CheckNum(KeyAscii)End SubPrivate Sub txtLast_KeyPress(KeyAscii As Integer)KeyAscii = CheckName(KeyAscii)End SubPrivate Sub SaveRec(rs As ADODB.Recordset) rs("MemberId") = Val(lblMemberIdText.Caption) rs("Last") = UCase(txtLast) rs("First") = Trim(txtFirst) rs("Middle") = Trim(txtMiddle) rs("Address") = Trim(txtAddress) rs("Mobile") = Val(txtMobile) rs("Residance") = Val(txtResidance) rs("Dob") = Format(dtpDob, "dd/MM/yyyy") rs("Age") = Val(txtAge) If optFemale.Value = True Then rs("Gender") = "Female" Else rs("Gender") = "Male" End If

60 T.Y. Computer Science 2007-2008

Page 61: Fitness Center 1

Fitness Club System

End SubPrivate Sub getNxID() Dim sql As String Set rs = New ADODB.Recordset Set Conn = New ADODB.Connection Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\club.mdb;Persist Security Info=False" sql = "select max(MemberId) from Member" rs.Open sql, Conn, adOpenKeyset, adLockOptimistic lblMemberIdText.Caption = Val(rs(0) & "") + 1End SubPrivate Function clear()lblMemberIdText = ""txtMiddle = ""txtFirst = ""txtLast = ""txtAddress = ""txtMobile = ""txtResidance = ""txtAge = ""'dtpDob.Value = ""End FunctionPrivate Function FillGrid()Set rs = New ADODB.Recordsetrs.CursorLocation = adUseClientsql = "select * from member"rs.Open sql, Conn, adOpenKeyset, adLockOptimistic With FlexMember FlexMember.Cols = rs.Fields.Count + 1 FlexMember.ColWidth(0) = 0 For c = 0 To rs.Fields.Count - 1 FlexMember.TextMatrix(0, c + 1) = rs(c).Name Next FlexMember.Rows = rs.RecordCount + 1 For r = 1 To rs.RecordCount For c = 0 To rs.Fields.Count - 1 FlexMember.TextMatrix(r, c + 1) = IIf(IsNull(rs(c).Value), "{Null}", rs(c).Value) Next c rs.MoveNext Next r End With FlexMember.ColWidth(1) = 850 FlexMember.ColWidth(2) = 1250 FlexMember.ColWidth(3) = 1250 FlexMember.ColWidth(4) = 1250

61 T.Y. Computer Science 2007-2008

Page 62: Fitness Center 1

Fitness Club System

FlexMember.ColWidth(5) = 2000 FlexMember.ColWidth(6) = 1000 FlexMember.ColWidth(7) = 1000 FlexMember.ColWidth(8) = 1000 FlexMember.ColWidth(9) = 800 FlexMember.ColWidth(10) = 900 End FunctionPrivate Function Disableall()txtLast.Enabled = FalsetxtFirst.Enabled = FalsetxtMiddle.Enabled = FalsetxtAddress.Enabled = FalsetxtMobile.Enabled = FalsetxtResidance.Enabled = FalsetxtAge.Enabled = FalsedtpDob.Enabled = FalseoptMale.Enabled = FalseoptFemale.Enabled = FalseEnd FunctionPrivate Function Enableall()txtLast.Enabled = TruetxtFirst.Enabled = TruetxtMiddle.Enabled = TruetxtAddress.Enabled = TruetxtMobile.Enabled = TruetxtResidance.Enabled = TruetxtAge.Enabled = TruedtpDob.Enabled = TrueoptMale.Enabled = TrueoptFemale.Enabled = TrueEnd Function

62 T.Y. Computer Science 2007-2008

Page 63: Fitness Center 1

Fitness Club System

FrmStaff

Private Sub cmbSearch_LostFocus()txtSearch.SetFocusEnd Sub

Private Sub cmdAdd_Click() cmdAdd.Enabled = FalseUserMode = "Add" Call clear1 getNxID Call Enableall txtId.Enabled = False cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdSave.Enabled = True txtFirst.SetFocusEnd SubPrivate Sub cmdSearch_Click() Call Enableall cmdAdd.Enabled = False cmdSave.Enabled = False cmdUpdate.Enabled = True cmdDelete.Enabled = True sql = "select * from Staff" If cmbSearch.ListIndex = 0 Then sql = sql & " where StaffId= " & Val(txtSearch) ElseIf cmbSearch.ListIndex = 1 Then sql = sql & " where Trim(First) like '%" & UCase(Trim(txtSearch)) & "%' " ElseIf cmbSearch.ListIndex = 2 Then sql = sql & " where Trim(Middle) like '%" & UCase(Trim(txtSearch)) & "%' " ElseIf cmbSearch.ListIndex = 3 Then sql = sql & " where Trim(Last) like '%" & UCase(Trim(txtSearch)) & "%' " Else Exit Sub End If Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset rs.Open sql, Conn, adOpenKeyset, adLockOptimistic If Not rs.EOF Then txtId = Val(rs("StaffId")) txtLast = UCase(rs("Last")) txtFirst = Trim(rs("First")) txtMiddle = Trim(rs("Middle")) txtAddress = Trim(rs("Address"))

63 T.Y. Computer Science 2007-2008

Page 64: Fitness Center 1

Fitness Club System

txtMobile = Val(rs("Mobile")) txtResidance = Trim(rs("Residance")) optMale.Value = IIf(Trim(rs("Gender") & "") = "Male", True, False) optFemale.Value = IIf(Trim(rs("Gender") & "") = "Female", True, False) cmbPost = Trim(rs("Post")) txtAge = Val(rs("Age")) End If rs.Close txtSearch.Text = ""End SubPrivate Sub cmdCancel_Click() If MsgBox("Do you want to cancel the current transaction", vbYesNo + vbCritical, strmessage) = vbYes Then Call clear1 cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdAdd.Enabled = True cmdSave.Enabled = False End IfEnd Sub

Private Sub cmdDelete_Click() If MsgBox("Do you want to Delete This Record", vbYesNo + vbCritical, strmessage) = vbYes Then With rs .MoveFirst .Move FlexStaff.Row - 1 .Delete FlexStaff.RemoveItem FlexStaff.Row .MoveNext filllist1 If .EOF Then On Error Resume Next .MovePrevious On Error GoTo 0 If .BOF Then MsgBox "no record" cmdDelete.Enabled = False Else filllist1 End If Else filllist1 End If

End With

64 T.Y. Computer Science 2007-2008

Page 65: Fitness Center 1

Fitness Club System

End If Call clear1 cmdAdd.Enabled = True cmdSave.Enabled = TrueEnd Sub

Private Sub cmdExit_Click() If MsgBox("Do you want to Exit", vbYesNo + vbCritical, strmessage) = vbYes Then Unload Me End IfEnd SubPrivate Sub cmdSave_Click() If txtFirst.Text = "" Then Call Message txtFirst.SetFocus Exit Sub End If If txtMiddle.Text = "" Then Call Message txtMiddle.SetFocus Exit Sub End If If txtLast.Text = "" Then Call Message txtLast.SetFocus Exit Sub End If If txtMobile.Text = "" Then Call Message txtMobile.SetFocus Exit Sub End If If txtResidance.Text = "" Then Call Message txtResidance.SetFocus Exit Sub End If If cmbPost.Text = "" Then Call Message cmbPost.SetFocus Exit Sub End If If txtAge.Text = "" Then Call Message txtAge.SetFocus Exit Sub

65 T.Y. Computer Science 2007-2008

Page 66: Fitness Center 1

Fitness Club System

End If If txtAddress.Text = "" Then Call Message txtAddress.SetFocus Exit Sub End If UserMode = "Add" Set rs = New ADODB.Recordset rs.Open "Staff", Conn, adOpenKeyset, adLockOptimistic rs.AddNew rs("StaffId") = Val(txtId) SaveRec1 rs rs.Update rs.Close If MsgBox("Record Saved", vbOKOnly + vbInformation, strmessage) Then FillGrid1 End If Call clear1 cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdAdd.Enabled = True cmdSave.Enabled = False Call Disableall End Sub

Private Sub cmdUpdate_Click() If txtFirst.Text = "" Then Call Message txtFirst.SetFocus Exit Sub End If If txtMiddle.Text = "" Then Call Message txtMiddle.SetFocus Exit Sub End If If txtLast.Text = "" Then Call Message txtLast.SetFocus Exit Sub End If If txtMobile.Text = "" Then Call Message txtMobile.SetFocus Exit Sub

66 T.Y. Computer Science 2007-2008

Page 67: Fitness Center 1

Fitness Club System

End If If txtResidance.Text = "" Then Call Message txtResidance.SetFocus Exit Sub End If If cmbPost.Text = "" Then Call Message cmbPost.SetFocus Exit Sub End If If txtAge.Text = "" Then Call Message txtAge.SetFocus Exit Sub End If If txtAddress.Text = "" Then Call Message txtAddress.SetFocus Exit Sub End If SaveRec1 rs rs.Update FlexStaff.TextMatrix(FlexStaff.Row, 1) = txtId FlexStaff.TextMatrix(FlexStaff.Row, 2) = txtFirst FlexStaff.TextMatrix(FlexStaff.Row, 3) = txtMiddle FlexStaff.TextMatrix(FlexStaff.Row, 4) = txtLast FlexStaff.TextMatrix(FlexStaff.Row, 5) = txtAddress FlexStaff.TextMatrix(FlexStaff.Row, 6) = txtMobile FlexStaff.TextMatrix(FlexStaff.Row, 7) = txtResidance If optFemale.Value = True Then FlexStaff.TextMatrix(FlexStaff.Row, 8) = "Female" Else FlexStaff.TextMatrix(FlexStaff.Row, 8) = "Male" End If FlexStaff.TextMatrix(FlexStaff.Row, 9) = cmbPost FlexStaff.TextMatrix(FlexStaff.Row, 10) = txtAge If MsgBox("Record Updated", vbOKOnly + vbInformation, strmessage) Then Call clear1 cmdAdd.Enabled = True cmdSave.Enabled = True cmdUpdate.Enabled = False cmdDelete.Enabled = False End IfEnd Sub

67 T.Y. Computer Science 2007-2008

Page 68: Fitness Center 1

Fitness Club System

Private Sub FlexStaff_Click()cmdAdd.Enabled = FalsecmdSave.Enabled = FalsecmdUpdate.Enabled = TruecmdDelete.Enabled = Truers.MoveFirstrs.Move FlexStaff.Row - 1txtId = FlexStaff.TextMatrix(FlexStaff.Row, 1)txtFirst = FlexStaff.TextMatrix(FlexStaff.Row, 2)txtMiddle = FlexStaff.TextMatrix(FlexStaff.Row, 3)txtLast = FlexStaff.TextMatrix(FlexStaff.Row, 4)txtAddress = FlexStaff.TextMatrix(FlexStaff.Row, 5)txtMobile = FlexStaff.TextMatrix(FlexStaff.Row, 6)txtResidance = FlexStaff.TextMatrix(FlexStaff.Row, 7)optMale.Value = IIf(Trim(FlexStaff.TextMatrix(FlexStaff.Row, 8) & "") = "Male", True, False)optFemale.Value = IIf(Trim(FlexStaff.TextMatrix(FlexStaff.Row, 8) & "") = "Female", True, False)cmbPost = FlexStaff.TextMatrix(FlexStaff.Row, 9)txtAge = FlexStaff.TextMatrix(FlexStaff.Row, 10)Call EnableallEnd SubPrivate Sub Form_Load()Call FillGrid1Call DisableallcmdUpdate.Enabled = FalsecmdDelete.Enabled = FalsecmdSave.Enabled = FalsecmbSearch.AddItem "StaffId"cmbSearch.AddItem "First Name"cmbSearch.AddItem "Middle Name"cmbSearch.AddItem "Last Name"End SubPrivate Sub txtAge_KeyPress(KeyAscii As Integer)KeyAscii = CheckNum(KeyAscii)End Sub

Private Sub txtFirst_KeyPress(KeyAscii As Integer)KeyAscii = CheckName(KeyAscii)End SubPrivate Sub txtLast_KeyPress(KeyAscii As Integer)KeyAscii = CheckName(KeyAscii)End SubPrivate Sub txtMobile_KeyPress(KeyAscii As Integer)KeyAscii = CheckNum(KeyAscii)End Sub

68 T.Y. Computer Science 2007-2008

Page 69: Fitness Center 1

Fitness Club System

Private Sub txtResidance_KeyPress(KeyAscii As Integer)KeyAscii = CheckNum(KeyAscii)End SubPrivate Function FillGrid1()Set rs = New ADODB.Recordsetrs.CursorLocation = adUseClientsql = "Select * from Staff"rs.Open sql, Conn, adOpenKeyset, adLockOptimisticWith FlexStaff FlexStaff.Cols = rs.Fields.Count + 1 FlexStaff.ColWidth(0) = 0 For c = 0 To rs.Fields.Count - 1 FlexStaff.TextMatrix(0, c + 1) = rs(c).Name Next FlexStaff.Rows = rs.RecordCount + 1 For r = 1 To rs.RecordCount For c = 0 To rs.Fields.Count - 1 FlexStaff.TextMatrix(r, c + 1) = IIf(IsNull(rs(c).Value), "{Null}", rs(c).Value) Next c rs.MoveNext Next rEnd With FlexStaff.ColWidth(1) = 700 FlexStaff.ColWidth(2) = 1250 FlexStaff.ColWidth(3) = 1250 FlexStaff.ColWidth(4) = 1250 FlexStaff.ColWidth(5) = 2000 FlexStaff.ColWidth(6) = 1000 FlexStaff.ColWidth(7) = 1000 FlexStaff.ColWidth(8) = 850 FlexStaff.ColWidth(10) = 500End FunctionPrivate Sub SaveRec1(rs As ADODB.Recordset) rs("Last") = UCase(txtLast) rs("First") = Trim(txtFirst) rs("Middle") = Trim(txtMiddle) rs("Address") = Trim(txtAddress) rs("Mobile") = Val(txtMobile) rs("Residance") = Val(txtResidance) If optFemale.Value = True Then rs("Gender") = "Female" Else rs("Gender") = "Male" End If rs("Post") = Trim(cmbPost) rs("Age") = Val(txtAge)

69 T.Y. Computer Science 2007-2008

Page 70: Fitness Center 1

Fitness Club System

End SubPrivate Sub getNxID() Dim sql As String Set rs = New ADODB.Recordset Set Conn = New ADODB.Connection Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\club.mdb;Persist Security Info=False" sql = "select max(StaffId) from Staff" rs.Open sql, Conn, adOpenKeyset, adLockOptimistic txtId = Val(rs(0) & "") + 1End SubPrivate Function filllist1() As Boolean Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset sql = "Select * from Staff where StaffId=" & Val(txtId) rs.Open sql, Conn, adOpenKeyset, adLockOptimistic If rs.EOF <> True Then filllist = True txtId = Val(rs("StaffId")) txtLast = UCase(rs("Last")) txtFirst = Trim(rs("First")) txtMiddle = Trim(rs("Middle")) txtAddress = Trim(rs("Address")) txtMobile = Val(rs("Mobile")) txtResidance = Trim(rs("Residance")) optMale.Value = IIf(Trim(rs("Gender") & "") = "Male", True, False) optFemale.Value = IIf(Trim(rs("Gender") & "") = "Female", True, False) cmbPost = Trim(rs("Post")) txtAge = Val(rs("Age")) Else filllist = False End If rs.Close Set rs = NothingEnd FunctionPrivate Function clear1()txtId = ""txtLast = ""txtFirst = ""txtMiddle = ""txtAddress = ""txtMobile = ""txtResidance = ""txtAge = ""cmbPost = ""End Function

70 T.Y. Computer Science 2007-2008

Page 71: Fitness Center 1

Fitness Club System

Private Function Disableall()txtId.Enabled = FalsetxtLast.Enabled = FalsetxtFirst.Enabled = FalsetxtMiddle.Enabled = FalsetxtAddress.Enabled = FalsetxtMobile.Enabled = FalsetxtResidance.Enabled = FalsetxtAge.Enabled = FalsecmbPost.Enabled = FalseoptMale.Enabled = FalseoptFemale.Enabled = FalseEnd FunctionPrivate Function Enableall()txtLast.Enabled = TruetxtFirst.Enabled = TruetxtMiddle.Enabled = TruetxtAddress.Enabled = TruetxtMobile.Enabled = TruetxtResidance.Enabled = TruetxtAge.Enabled = TruecmbPost.Enabled = TrueoptMale.Enabled = TrueoptFemale.Enabled = TrueEnd Function

FrmScheme

71 T.Y. Computer Science 2007-2008

Page 72: Fitness Center 1

Fitness Club System

Private Sub cmdAdd_Click() cmdAdd.Enabled = FalseUserMode = "Add" Call Clear2 getNxID Call Enableall txtScheme.Enabled = False cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdSave.Enabled = True txtScheme.SetFocusEnd Sub

Private Sub cmdCancel_Click() If MsgBox("Do you want to cancel the current transaction", vbYesNo + vbCritical, strmessage) = vbYes Then Call Clear2 cmdDelete.Enabled = False cmdUpdate.Enabled = False cmdAdd.Enabled = True cmdSave.Enabled = False End IfEnd Sub

Private Sub cmdDelete_Click()If MsgBox("Do you want to Delete this Record", vbYesNo + vbCritical, strmessage) = vbYes Then With rs .MoveFirst .Move FlexScheme.Row - 1 .Delete FlexScheme.RemoveItem FlexScheme.Row .MoveNext filllist2If .EOF Then On Error Resume Next .MovePrevious On Error GoTo 0 If .BOF Then MsgBox "no record" cmdDelete.Enabled = False Else filllist2

72 T.Y. Computer Science 2007-2008

Page 73: Fitness Center 1

Fitness Club System

End IfElse filllist2End If End WithEnd If Call Clear2 cmdAdd.Enabled = True cmdSave.Enabled = TrueEnd Sub

Private Sub cmdExit_Click() If MsgBox("Do you want to Exit", vbYesNo + vbCritical, strmessage) = vbYes Then Unload Me End IfEnd SubPrivate Sub cmdSave_Click() If txtScheme.Text = "" Then Call Message txtScheme.SetFocus Exit Sub End If If txtName.Text = "" Then Call Message txtName.SetFocus Exit Sub End If If cmbDuration.Text = "" Then Call Message cmbDuration.SetFocus Exit Sub End If If txtFees.Text = "" Then Call Message txtFees.SetFocus Exit Sub End If UserMode = "Add" Set rs = New ADODB.Recordset rs.Open "Scheme", Conn, adOpenKeyset, adLockOptimistic rs.AddNew rs("SchemeId") = Val(txtScheme) SaveRec2 rs rs.Update rs.Close If MsgBox("Record Saved", vbOKOnly + vbInformation, strmessage) Then

73 T.Y. Computer Science 2007-2008

Page 74: Fitness Center 1

Fitness Club System

FillGrid2 End If Call Clear2 cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdAdd.Enabled = True cmdSave.Enabled = False Call DisableallEnd SubPrivate Sub cmdUpdate_Click() SaveRec2 rs rs.Update FlexScheme.TextMatrix(FlexScheme.Row, 1) = txtScheme FlexScheme.TextMatrix(FlexScheme.Row, 2) = txtName FlexScheme.TextMatrix(FlexScheme.Row, 3) = cmbDuration FlexScheme.TextMatrix(FlexScheme.Row, 4) = txtFees rs.Update MsgBox "Record Updated", vbOKOnly + vbInformation, strmessage Call Clear2 cmdAdd.Enabled = True cmdSave.Enabled = True cmdUpdate.Enabled = False cmdDelete.Enabled = FalseEnd Sub

Private Sub FlexScheme_Click() cmdAdd.Enabled = False cmdSave.Enabled = False cmdUpdate.Enabled = True cmdDelete.Enabled = True rs.MoveFirst rs.Move FlexScheme.Row - 1 txtScheme = FlexScheme.TextMatrix(FlexScheme.Row, 1) txtName = FlexScheme.TextMatrix(FlexScheme.Row, 2) cmbDuration = FlexScheme.TextMatrix(FlexScheme.Row, 3) txtFees = FlexScheme.TextMatrix(FlexScheme.Row, 4) Call EnableallEnd Sub

Private Sub Form_Load() Call FillGrid2 Call Disableall cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdSave.Enabled = FalseEnd Sub

74 T.Y. Computer Science 2007-2008

Page 75: Fitness Center 1

Fitness Club System

Private Sub txtFees_KeyPress(KeyAscii As Integer) KeyAscii = CheckNum(KeyAscii)End Sub

Private Sub txtName_KeyPress(KeyAscii As Integer) KeyAscii = CheckName(KeyAscii)End Sub

Private Sub txtScheme_KeyPress(KeyAscii As Integer) KeyAscii = CheckNum(KeyAscii)End SubPrivate Function Disableall() txtScheme.Enabled = False txtName.Enabled = False cmbDuration.Enabled = False txtFees.Enabled = FalseEnd FunctionPrivate Function Enableall() txtName.Enabled = True cmbDuration.Enabled = True txtFees.Enabled = TrueEnd Function

Private Function FillGrid2()Set rs = New ADODB.Recordsetrs.CursorLocation = adUseClientsql = "Select * from Scheme"rs.Open sql, Conn, adOpenKeyset, adLockOptimisticWith FlexScheme FlexScheme.Cols = rs.Fields.Count + 1 FlexScheme.ColWidth(0) = 0 For c = 0 To rs.Fields.Count - 1 FlexScheme.TextMatrix(0, c + 1) = rs(c).Name Next FlexScheme.Rows = rs.RecordCount + 1 For r = 1 To rs.RecordCount For c = 0 To rs.Fields.Count - 1 FlexScheme.TextMatrix(r, c + 1) = IIf(IsNull(rs(c).Value), "{Null}", rs(c).Value) Next c rs.MoveNext Next rEnd With FlexScheme.ColWidth(2) = 1500 FlexScheme.ColWidth(1) = 850End Function

75 T.Y. Computer Science 2007-2008

Page 76: Fitness Center 1

Fitness Club System

Private Function Clear2() txtScheme = "" txtName = "" cmbDuration = "" txtFees = ""End FunctionPrivate Sub getNxID() Dim sql As String Set rs = New ADODB.Recordset Set Conn = New ADODB.Connection Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\club.mdb;Persist Security Info=False" sql = "select max(SchemeId) from Scheme" rs.Open sql, Conn, adOpenKeyset, adLockOptimistic txtScheme = Val(rs(0) & "") + 1End SubPrivate Sub SaveRec2(rs As ADODB.Recordset) rs("SchemeId") = Trim(txtScheme) rs("Name") = UCase(txtName) rs("Duration") = Trim(cmbDuration) rs("Fees") = Val(txtFees)End Sub

Private Function filllist2() As Boolean Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset sql = "Select * from Scheme where SchemeId=" & Val(txtScheme) rs.Open sql, Conn, adOpenKeyset, adLockOptimistic If rs.EOF <> True Then filllist = True txtScheme = Trim(rs("SchemeId")) txtName = UCase(rs("Name")) cmbDuration = Trim(rs("Duration")) txtFees = Trim(rs("Fees")) Else filllist = False End If rs.Close Set rs = NothingEnd Function

76 T.Y. Computer Science 2007-2008

Page 77: Fitness Center 1

Fitness Club System

FrmFacility

Private Sub cmdAdd_Click() cmdAdd.Enabled = FalseUserMode = "Add" Call Clear3 getNxID Call Enableall txtFacility.Enabled = False cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdSave.Enabled = True txtName.SetFocusEnd SubPrivate Sub cmdCancel_Click() If MsgBox("Do you want to cancel the current transaction", vbYesNo + vbCritical, strmessage) = vbYes Then Call Clear3 cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdAdd.Enabled = True cmdSave.Enabled = False End IfEnd Sub

Private Sub cmdDelete_Click()If MsgBox("Do you want to Delete this Record", vbYesNo + vbCritical, strmessage) = vbYes Then With rs .MoveFirst .Move FlexFacility.Row - 1 .Delete FlexFacility.RemoveItem FlexFacility.Row .MoveNext filllist3 If .EOF Then On Error Resume Next .MovePrevious On Error GoTo 0 If .BOF Then MsgBox "no record" cmdDelete.Enabled = False Else filllist3 End If Else

77 T.Y. Computer Science 2007-2008

Page 78: Fitness Center 1

Fitness Club System

filllist3 End If End WithEnd If Call Clear3 cmdAdd.Enabled = True cmdSave.Enabled = TrueEnd Sub

Private Sub cmdExit_Click() If MsgBox("Do you want to Exit", vbYesNo + vbCritical, strmessage) = vbYes Then Unload Me End IfEnd SubPrivate Sub cmdSave_Click() If txtFacility.Text = "" Then Call Message txtScheme.SetFocus Exit Sub End If If txtName.Text = "" Then Call Message txtName.SetFocus Exit Sub End If If cmbDuration.Text = "" Then Call Message cmbDuration.SetFocus Exit Sub End If If txtFees.Text = "" Then Call Message txtFees.SetFocus Exit Sub End If UserMode = "Add" Set rs = New ADODB.Recordset rs.Open "Facility", Conn, adOpenKeyset, adLockOptimistic rs.AddNew rs("FacilityId") = Val(txtFacility) SaveRec3 rs rs.Update rs.Close If MsgBox("Record Saved", vbOKOnly + vbInformation, strmessage) Then FillGrid3 End If

78 T.Y. Computer Science 2007-2008

Page 79: Fitness Center 1

Fitness Club System

Call Clear3 cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdAdd.Enabled = True cmdSave.Enabled = False Call DisableallEnd SubPrivate Sub cmdUpdate_Click() SaveRec3 rs rs.Update FlexFacility.TextMatrix(FlexFacility.Row, 1) = txtFacility FlexFacility.TextMatrix(FlexFacility.Row, 2) = txtName FlexFacility.TextMatrix(FlexFacility.Row, 3) = cmbDuration FlexFacility.TextMatrix(FlexFacility.Row, 4) = txtFees rs.Update MsgBox "Record Updated", vbOKOnly + vbInformation, strmessage Call Clear3 cmdAdd.Enabled = True cmdSave.Enabled = True cmdUpdate.Enabled = False cmdDelete.Enabled = FalseEnd SubPrivate Sub FlexFacility_Click() cmdAdd.Enabled = False cmdSave.Enabled = False cmdUpdate.Enabled = True cmdDelete.Enabled = True rs.MoveFirst rs.Move FlexFacility.Row - 1 txtFacility = FlexFacility.TextMatrix(FlexFacility.Row, 1) txtName = FlexFacility.TextMatrix(FlexFacility.Row, 2) cmbDuration = FlexFacility.TextMatrix(FlexFacility.Row, 3) txtFees = FlexFacility.TextMatrix(FlexFacility.Row, 4) Call EnableallEnd SubPrivate Sub Form_Load() Call FillGrid3 Call Disableall cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdSave.Enabled = FalseEnd SubPrivate Sub txtFees_KeyPress(KeyAscii As Integer) KeyAscii = CheckNum(KeyAscii)End SubPrivate Sub txtName_KeyPress(KeyAscii As Integer)

79 T.Y. Computer Science 2007-2008

Page 80: Fitness Center 1

Fitness Club System

KeyAscii = CheckName(KeyAscii)End SubPrivate Sub txtScheme_KeyPress(KeyAscii As Integer) KeyAscii = CheckNum(KeyAscii)End SubPrivate Function Disableall() txtFacility.Enabled = False txtName.Enabled = False cmbDuration.Enabled = False txtFees.Enabled = FalseEnd FunctionPrivate Function Enableall() txtName.Enabled = True cmbDuration.Enabled = True txtFees.Enabled = TrueEnd FunctionPrivate Function FillGrid3() Set rs = New ADODB.Recordset rs.CursorLocation = adUseClient sql = "Select * from Facility" rs.Open sql, Conn, adOpenKeyset, adLockOptimistic With FlexFacility FlexFacility.Cols = rs.Fields.Count + 1 FlexFacility.ColWidth(0) = 0 For c = 0 To rs.Fields.Count - 1 FlexFacility.TextMatrix(0, c + 1) = rs(c).Name Next FlexFacility.Rows = rs.RecordCount + 1 For r = 1 To rs.RecordCount For c = 0 To rs.Fields.Count - 1 FlexFacility.TextMatrix(r, c + 1) = IIf(IsNull(rs(c).Value), "{Null}", rs(c).Value) Next c rs.MoveNext Next r End With FlexFacility.ColWidth(1) = 850 FlexFacility.ColWidth(2) = 1500 FlexFacility.ColWidth(3) = 980 FlexFacility.ColWidth(4) = 900End FunctionPrivate Function Clear3() txtFacility = "" txtName = "" cmbDuration = "" txtFees = ""

80 T.Y. Computer Science 2007-2008

Page 81: Fitness Center 1

Fitness Club System

End FunctionPrivate Sub getNxID() Dim sql As String Set rs = New ADODB.Recordset Set Conn = New ADODB.Connection Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\club\club.mdb;Persist Security Info=False" sql = "select max(FacilityId) from Facility" rs.Open sql, Conn, adOpenKeyset, adLockOptimistic txtFacility = Val(rs(0) & "") + 1End SubPrivate Sub SaveRec3(rs As ADODB.Recordset) rs("FacilityId") = Val(txtFacility) rs("FacilityName") = UCase(txtName) rs("Duration") = Trim(cmbDuration) rs("Fees") = Val(txtFees)End SubPrivate Function filllist3() As Boolean Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset sql = "Select * from Facility where FacilityId=" & Val(txtFacility) rs.Open sql, Conn, adOpenKeyset, adLockOptimistic If rs.EOF <> True Then filllist = True txtFacility = Val(rs("FacilityId")) txtName = UCase(rs("FacilityName")) cmbDuration = Trim(rs("Duration")) txtFees = Val(rs("Fees")) Else filllist = False End If rs.Close Set rs = Nothing End Function

81 T.Y. Computer Science 2007-2008

Page 82: Fitness Center 1

Fitness Club System

FrmEnrollment

Private Sub cmdAdd_Click() cmdAdd.Enabled = FalseUserMode = "Add" Call Clear3 getNxID Call Enableall txtFacility.Enabled = False cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdSave.Enabled = True txtName.SetFocusEnd SubPrivate Sub cmdCancel_Click() If MsgBox("Do you want to cancel the current transaction", vbYesNo + vbCritical, strmessage) = vbYes Then Call Clear3 cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdAdd.Enabled = True cmdSave.Enabled = False End IfEnd Sub

Private Sub cmdDelete_Click()If MsgBox("Do you want to Delete this Record", vbYesNo + vbCritical, strmessage) = vbYes Then With rs .MoveFirst .Move FlexFacility.Row - 1 .Delete FlexFacility.RemoveItem FlexFacility.Row .MoveNext filllist3 If .EOF Then On Error Resume Next .MovePrevious On Error GoTo 0 If .BOF Then MsgBox "no record" cmdDelete.Enabled = False Else filllist3 End If

82 T.Y. Computer Science 2007-2008

Page 83: Fitness Center 1

Fitness Club System

Else filllist3 End If End WithEnd If Call Clear3 cmdAdd.Enabled = True cmdSave.Enabled = TrueEnd Sub

Private Sub cmdExit_Click() If MsgBox("Do you want to Exit", vbYesNo + vbCritical, strmessage) = vbYes Then Unload Me End IfEnd SubPrivate Sub cmdSave_Click() If txtFacility.Text = "" Then Call Message txtScheme.SetFocus Exit Sub End If If txtName.Text = "" Then Call Message txtName.SetFocus Exit Sub End If If cmbDuration.Text = "" Then Call Message cmbDuration.SetFocus Exit Sub End If If txtFees.Text = "" Then Call Message txtFees.SetFocus Exit Sub End If UserMode = "Add" Set rs = New ADODB.Recordset rs.Open "Facility", Conn, adOpenKeyset, adLockOptimistic rs.AddNew rs("FacilityId") = Val(txtFacility) SaveRec3 rs rs.Update rs.Close If MsgBox("Record Saved", vbOKOnly + vbInformation, strmessage) Then FillGrid3

83 T.Y. Computer Science 2007-2008

Page 84: Fitness Center 1

Fitness Club System

End If Call Clear3 cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdAdd.Enabled = True cmdSave.Enabled = False Call DisableallEnd SubPrivate Sub cmdUpdate_Click() SaveRec3 rs rs.Update FlexFacility.TextMatrix(FlexFacility.Row, 1) = txtFacility FlexFacility.TextMatrix(FlexFacility.Row, 2) = txtName FlexFacility.TextMatrix(FlexFacility.Row, 3) = cmbDuration FlexFacility.TextMatrix(FlexFacility.Row, 4) = txtFees rs.Update MsgBox "Record Updated", vbOKOnly + vbInformation, strmessage Call Clear3 cmdAdd.Enabled = True cmdSave.Enabled = True cmdUpdate.Enabled = False cmdDelete.Enabled = FalseEnd SubPrivate Sub FlexFacility_Click() cmdAdd.Enabled = False cmdSave.Enabled = False cmdUpdate.Enabled = True cmdDelete.Enabled = True rs.MoveFirst rs.Move FlexFacility.Row - 1 txtFacility = FlexFacility.TextMatrix(FlexFacility.Row, 1) txtName = FlexFacility.TextMatrix(FlexFacility.Row, 2) cmbDuration = FlexFacility.TextMatrix(FlexFacility.Row, 3) txtFees = FlexFacility.TextMatrix(FlexFacility.Row, 4) Call EnableallEnd SubPrivate Sub Form_Load() Call FillGrid3 Call Disableall cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdSave.Enabled = FalseEnd SubPrivate Sub txtFees_KeyPress(KeyAscii As Integer) KeyAscii = CheckNum(KeyAscii)End Sub

84 T.Y. Computer Science 2007-2008

Page 85: Fitness Center 1

Fitness Club System

Private Sub txtName_KeyPress(KeyAscii As Integer) KeyAscii = CheckName(KeyAscii)End SubPrivate Sub txtScheme_KeyPress(KeyAscii As Integer) KeyAscii = CheckNum(KeyAscii)End SubPrivate Function Disableall() txtFacility.Enabled = False txtName.Enabled = False cmbDuration.Enabled = False txtFees.Enabled = FalseEnd FunctionPrivate Function Enableall() txtName.Enabled = True cmbDuration.Enabled = True txtFees.Enabled = TrueEnd FunctionPrivate Function FillGrid3() Set rs = New ADODB.Recordset rs.CursorLocation = adUseClient sql = "Select * from Facility" rs.Open sql, Conn, adOpenKeyset, adLockOptimistic With FlexFacility FlexFacility.Cols = rs.Fields.Count + 1 FlexFacility.ColWidth(0) = 0 For c = 0 To rs.Fields.Count - 1 FlexFacility.TextMatrix(0, c + 1) = rs(c).Name Next FlexFacility.Rows = rs.RecordCount + 1 For r = 1 To rs.RecordCount For c = 0 To rs.Fields.Count - 1 FlexFacility.TextMatrix(r, c + 1) = IIf(IsNull(rs(c).Value), "{Null}", rs(c).Value) Next c rs.MoveNext Next r End With FlexFacility.ColWidth(1) = 850 FlexFacility.ColWidth(2) = 1500 FlexFacility.ColWidth(3) = 980 FlexFacility.ColWidth(4) = 900End FunctionPrivate Function Clear3() txtFacility = "" txtName = "" cmbDuration = ""

85 T.Y. Computer Science 2007-2008

Page 86: Fitness Center 1

Fitness Club System

txtFees = ""End FunctionPrivate Sub getNxID() Dim sql As String Set rs = New ADODB.Recordset Set Conn = New ADODB.Connection Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\club\club.mdb;Persist Security Info=False" sql = "select max(FacilityId) from Facility" rs.Open sql, Conn, adOpenKeyset, adLockOptimistic txtFacility = Val(rs(0) & "") + 1End SubPrivate Sub SaveRec3(rs As ADODB.Recordset) rs("FacilityId") = Val(txtFacility) rs("FacilityName") = UCase(txtName) rs("Duration") = Trim(cmbDuration) rs("Fees") = Val(txtFees)End SubPrivate Function filllist3() As Boolean Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset sql = "Select * from Facility where FacilityId=" & Val(txtFacility) rs.Open sql, Conn, adOpenKeyset, adLockOptimistic If rs.EOF <> True Then filllist = True txtFacility = Val(rs("FacilityId")) txtName = UCase(rs("FacilityName")) cmbDuration = Trim(rs("Duration")) txtFees = Val(rs("Fees")) Else filllist = False End If rs.Close Set rs = Nothing End Function

86 T.Y. Computer Science 2007-2008

Page 87: Fitness Center 1

Fitness Club System

FrmAttendance

Private Sub cmdAdd_Click() cmdAdd.Enabled = FalseUserMode = "Add" Call Clear3 getNxID Call Enableall txtFacility.Enabled = False cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdSave.Enabled = True txtName.SetFocusEnd SubPrivate Sub cmdCancel_Click() If MsgBox("Do you want to cancel the current transaction", vbYesNo + vbCritical, strmessage) = vbYes Then Call Clear3 cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdAdd.Enabled = True cmdSave.Enabled = False End IfEnd Sub

Private Sub cmdDelete_Click()If MsgBox("Do you want to Delete this Record", vbYesNo + vbCritical, strmessage) = vbYes Then With rs .MoveFirst .Move FlexFacility.Row - 1 .Delete FlexFacility.RemoveItem FlexFacility.Row .MoveNext filllist3 If .EOF Then On Error Resume Next .MovePrevious On Error GoTo 0 If .BOF Then MsgBox "no record" cmdDelete.Enabled = False Else filllist3 End If

87 T.Y. Computer Science 2007-2008

Page 88: Fitness Center 1

Fitness Club System

Else filllist3 End If End WithEnd If Call Clear3 cmdAdd.Enabled = True cmdSave.Enabled = TrueEnd Sub

Private Sub cmdExit_Click() If MsgBox("Do you want to Exit", vbYesNo + vbCritical, strmessage) = vbYes Then Unload Me End IfEnd SubPrivate Sub cmdSave_Click() If txtFacility.Text = "" Then Call Message txtScheme.SetFocus Exit Sub End If If txtName.Text = "" Then Call Message txtName.SetFocus Exit Sub End If If cmbDuration.Text = "" Then Call Message cmbDuration.SetFocus Exit Sub End If If txtFees.Text = "" Then Call Message txtFees.SetFocus Exit Sub End If UserMode = "Add" Set rs = New ADODB.Recordset rs.Open "Facility", Conn, adOpenKeyset, adLockOptimistic rs.AddNew rs("FacilityId") = Val(txtFacility) SaveRec3 rs rs.Update rs.Close If MsgBox("Record Saved", vbOKOnly + vbInformation, strmessage) Then FillGrid3

88 T.Y. Computer Science 2007-2008

Page 89: Fitness Center 1

Fitness Club System

End If Call Clear3 cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdAdd.Enabled = True cmdSave.Enabled = False Call DisableallEnd SubPrivate Sub cmdUpdate_Click() SaveRec3 rs rs.Update FlexFacility.TextMatrix(FlexFacility.Row, 1) = txtFacility FlexFacility.TextMatrix(FlexFacility.Row, 2) = txtName FlexFacility.TextMatrix(FlexFacility.Row, 3) = cmbDuration FlexFacility.TextMatrix(FlexFacility.Row, 4) = txtFees rs.Update MsgBox "Record Updated", vbOKOnly + vbInformation, strmessage Call Clear3 cmdAdd.Enabled = True cmdSave.Enabled = True cmdUpdate.Enabled = False cmdDelete.Enabled = FalseEnd SubPrivate Sub FlexFacility_Click() cmdAdd.Enabled = False cmdSave.Enabled = False cmdUpdate.Enabled = True cmdDelete.Enabled = True rs.MoveFirst rs.Move FlexFacility.Row - 1 txtFacility = FlexFacility.TextMatrix(FlexFacility.Row, 1) txtName = FlexFacility.TextMatrix(FlexFacility.Row, 2) cmbDuration = FlexFacility.TextMatrix(FlexFacility.Row, 3) txtFees = FlexFacility.TextMatrix(FlexFacility.Row, 4) Call EnableallEnd SubPrivate Sub Form_Load() Call FillGrid3 Call Disableall cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdSave.Enabled = FalseEnd SubPrivate Sub txtFees_KeyPress(KeyAscii As Integer) KeyAscii = CheckNum(KeyAscii)End Sub

89 T.Y. Computer Science 2007-2008

Page 90: Fitness Center 1

Fitness Club System

Private Sub txtName_KeyPress(KeyAscii As Integer) KeyAscii = CheckName(KeyAscii)End SubPrivate Sub txtScheme_KeyPress(KeyAscii As Integer) KeyAscii = CheckNum(KeyAscii)End SubPrivate Function Disableall() txtFacility.Enabled = False txtName.Enabled = False cmbDuration.Enabled = False txtFees.Enabled = FalseEnd FunctionPrivate Function Enableall() txtName.Enabled = True cmbDuration.Enabled = True txtFees.Enabled = TrueEnd FunctionPrivate Function FillGrid3() Set rs = New ADODB.Recordset rs.CursorLocation = adUseClient sql = "Select * from Facility" rs.Open sql, Conn, adOpenKeyset, adLockOptimistic With FlexFacility FlexFacility.Cols = rs.Fields.Count + 1 FlexFacility.ColWidth(0) = 0 For c = 0 To rs.Fields.Count - 1 FlexFacility.TextMatrix(0, c + 1) = rs(c).Name Next FlexFacility.Rows = rs.RecordCount + 1 For r = 1 To rs.RecordCount For c = 0 To rs.Fields.Count - 1 FlexFacility.TextMatrix(r, c + 1) = IIf(IsNull(rs(c).Value), "{Null}", rs(c).Value) Next c rs.MoveNext Next r End With FlexFacility.ColWidth(1) = 850 FlexFacility.ColWidth(2) = 1500 FlexFacility.ColWidth(3) = 980 FlexFacility.ColWidth(4) = 900End FunctionPrivate Function Clear3() txtFacility = "" txtName = "" cmbDuration = ""

90 T.Y. Computer Science 2007-2008

Page 91: Fitness Center 1

Fitness Club System

txtFees = ""End FunctionPrivate Sub getNxID() Dim sql As String Set rs = New ADODB.Recordset Set Conn = New ADODB.Connection Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\club\club.mdb;Persist Security Info=False" sql = "select max(FacilityId) from Facility" rs.Open sql, Conn, adOpenKeyset, adLockOptimistic txtFacility = Val(rs(0) & "") + 1End SubPrivate Sub SaveRec3(rs As ADODB.Recordset) rs("FacilityId") = Val(txtFacility) rs("FacilityName") = UCase(txtName) rs("Duration") = Trim(cmbDuration) rs("Fees") = Val(txtFees)End SubPrivate Function filllist3() As Boolean Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset sql = "Select * from Facility where FacilityId=" & Val(txtFacility) rs.Open sql, Conn, adOpenKeyset, adLockOptimistic If rs.EOF <> True Then filllist = True txtFacility = Val(rs("FacilityId")) txtName = UCase(rs("FacilityName")) cmbDuration = Trim(rs("Duration")) txtFees = Val(rs("Fees")) Else filllist = False End If rs.Close Set rs = Nothing End Function

FrmPayment

91 T.Y. Computer Science 2007-2008

Page 92: Fitness Center 1

Fitness Club System

Private Sub cmdAdd_Click() cmdAdd.Enabled = FalseUserMode = "Add" Call Clear3 getNxID Call Enableall txtFacility.Enabled = False cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdSave.Enabled = True txtName.SetFocusEnd SubPrivate Sub cmdCancel_Click() If MsgBox("Do you want to cancel the current transaction", vbYesNo + vbCritical, strmessage) = vbYes Then Call Clear3 cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdAdd.Enabled = True cmdSave.Enabled = False End IfEnd Sub

Private Sub cmdDelete_Click()If MsgBox("Do you want to Delete this Record", vbYesNo + vbCritical, strmessage) = vbYes Then With rs .MoveFirst .Move FlexFacility.Row - 1 .Delete FlexFacility.RemoveItem FlexFacility.Row .MoveNext filllist3 If .EOF Then On Error Resume Next .MovePrevious On Error GoTo 0 If .BOF Then MsgBox "no record" cmdDelete.Enabled = False Else filllist3 End If Else

92 T.Y. Computer Science 2007-2008

Page 93: Fitness Center 1

Fitness Club System

filllist3 End If End WithEnd If Call Clear3 cmdAdd.Enabled = True cmdSave.Enabled = TrueEnd Sub

Private Sub cmdExit_Click() If MsgBox("Do you want to Exit", vbYesNo + vbCritical, strmessage) = vbYes Then Unload Me End IfEnd SubPrivate Sub cmdSave_Click() If txtFacility.Text = "" Then Call Message txtScheme.SetFocus Exit Sub End If If txtName.Text = "" Then Call Message txtName.SetFocus Exit Sub End If If cmbDuration.Text = "" Then Call Message cmbDuration.SetFocus Exit Sub End If If txtFees.Text = "" Then Call Message txtFees.SetFocus Exit Sub End If UserMode = "Add" Set rs = New ADODB.Recordset rs.Open "Facility", Conn, adOpenKeyset, adLockOptimistic rs.AddNew rs("FacilityId") = Val(txtFacility) SaveRec3 rs rs.Update rs.Close If MsgBox("Record Saved", vbOKOnly + vbInformation, strmessage) Then FillGrid3 End If

93 T.Y. Computer Science 2007-2008

Page 94: Fitness Center 1

Fitness Club System

Call Clear3 cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdAdd.Enabled = True cmdSave.Enabled = False Call DisableallEnd SubPrivate Sub cmdUpdate_Click() SaveRec3 rs rs.Update FlexFacility.TextMatrix(FlexFacility.Row, 1) = txtFacility FlexFacility.TextMatrix(FlexFacility.Row, 2) = txtName FlexFacility.TextMatrix(FlexFacility.Row, 3) = cmbDuration FlexFacility.TextMatrix(FlexFacility.Row, 4) = txtFees rs.Update MsgBox "Record Updated", vbOKOnly + vbInformation, strmessage Call Clear3 cmdAdd.Enabled = True cmdSave.Enabled = True cmdUpdate.Enabled = False cmdDelete.Enabled = FalseEnd SubPrivate Sub FlexFacility_Click() cmdAdd.Enabled = False cmdSave.Enabled = False cmdUpdate.Enabled = True cmdDelete.Enabled = True rs.MoveFirst rs.Move FlexFacility.Row - 1 txtFacility = FlexFacility.TextMatrix(FlexFacility.Row, 1) txtName = FlexFacility.TextMatrix(FlexFacility.Row, 2) cmbDuration = FlexFacility.TextMatrix(FlexFacility.Row, 3) txtFees = FlexFacility.TextMatrix(FlexFacility.Row, 4) Call EnableallEnd SubPrivate Sub Form_Load() Call FillGrid3 Call Disableall cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdSave.Enabled = FalseEnd SubPrivate Sub txtFees_KeyPress(KeyAscii As Integer) KeyAscii = CheckNum(KeyAscii)End SubPrivate Sub txtName_KeyPress(KeyAscii As Integer)

94 T.Y. Computer Science 2007-2008

Page 95: Fitness Center 1

Fitness Club System

KeyAscii = CheckName(KeyAscii)End SubPrivate Sub txtScheme_KeyPress(KeyAscii As Integer) KeyAscii = CheckNum(KeyAscii)End SubPrivate Function Disableall() txtFacility.Enabled = False txtName.Enabled = False cmbDuration.Enabled = False txtFees.Enabled = FalseEnd FunctionPrivate Function Enableall() txtName.Enabled = True cmbDuration.Enabled = True txtFees.Enabled = TrueEnd FunctionPrivate Function FillGrid3() Set rs = New ADODB.Recordset rs.CursorLocation = adUseClient sql = "Select * from Facility" rs.Open sql, Conn, adOpenKeyset, adLockOptimistic With FlexFacility FlexFacility.Cols = rs.Fields.Count + 1 FlexFacility.ColWidth(0) = 0 For c = 0 To rs.Fields.Count - 1 FlexFacility.TextMatrix(0, c + 1) = rs(c).Name Next FlexFacility.Rows = rs.RecordCount + 1 For r = 1 To rs.RecordCount For c = 0 To rs.Fields.Count - 1 FlexFacility.TextMatrix(r, c + 1) = IIf(IsNull(rs(c).Value), "{Null}", rs(c).Value) Next c rs.MoveNext Next r End With FlexFacility.ColWidth(1) = 850 FlexFacility.ColWidth(2) = 1500 FlexFacility.ColWidth(3) = 980 FlexFacility.ColWidth(4) = 900End FunctionPrivate Function Clear3() txtFacility = "" txtName = "" cmbDuration = "" txtFees = ""

95 T.Y. Computer Science 2007-2008

Page 96: Fitness Center 1

Fitness Club System

End FunctionPrivate Sub getNxID() Dim sql As String Set rs = New ADODB.Recordset Set Conn = New ADODB.Connection Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\club\club.mdb;Persist Security Info=False" sql = "select max(FacilityId) from Facility" rs.Open sql, Conn, adOpenKeyset, adLockOptimistic txtFacility = Val(rs(0) & "") + 1End SubPrivate Sub SaveRec3(rs As ADODB.Recordset) rs("FacilityId") = Val(txtFacility) rs("FacilityName") = UCase(txtName) rs("Duration") = Trim(cmbDuration) rs("Fees") = Val(txtFees)End SubPrivate Function filllist3() As Boolean Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset sql = "Select * from Facility where FacilityId=" & Val(txtFacility) rs.Open sql, Conn, adOpenKeyset, adLockOptimistic If rs.EOF <> True Then filllist = True txtFacility = Val(rs("FacilityId")) txtName = UCase(rs("FacilityName")) cmbDuration = Trim(rs("Duration")) txtFees = Val(rs("Fees")) Else filllist = False End If rs.Close Set rs = Nothing End Function

FrmRecipt

96 T.Y. Computer Science 2007-2008

Page 97: Fitness Center 1

Fitness Club System

Private Sub cmdPrint_Click()Set rs = New ADODB.Recordset rs.Open "Recipt", Conn, adOpenKeyset, adLockOptimistic rs.AddNew SaveRec7 rs rs.Update rs.Close Recipt.ShowEnd Sub

Private Sub Form_Load()txtDate.Text = DateEnd SubPrivate Sub SaveRec7(rs As ADODB.Recordset) rs("Recipt") = Val(txtRecipt) rs("Id") = Val(txtId) rs("Date") = Format(txtDate, "dd/MM/yyyy") rs("Name") = Trim(txtName) rs("Amount") = Val(txtRs) rs("SName") = Trim(txtScheme) rs("FName") = Trim(txtFacility) rs("SFrom") = Format(txtFrom, "dd/MM/yyyy") rs("STo") = Format(txtTo, "dd/MM/yyyy") rs("FFrom") = Format(txtFroms, "dd/MM/yyyy") rs("FTo") = Format(txtTos, "dd/MM/yyyy") End Sub

FrmMontlyReport

Private Sub cmdShow_Click()Dim str1 As String

str1 = cmbMonth.ListIndex + 1

DataEnvironment1.Command3 str1MontlyReport.ShowUnload DataEnvironment1

97 T.Y. Computer Science 2007-2008

Page 98: Fitness Center 1

Fitness Club System

End Sub

FrmDailyReport

Private Sub cmdShow_Click()Dim str1 As Stringstr1 = Trim(txtDate)DataEnvironment1.Command2 str1DailyReport.ShowUnload DataEnvironment1End Sub

Private Sub Form_Load()txtDate.Text = DateEnd Sub

CONCLUSION

The quality and reliability of the software depends on the result of phasaes in the system development .The software quality includes the modularity, good documentation, user friendliness, maintainability etc,

The software reliability depends on the less chances of failure and enhancement in the system even in stressed situations

As far as my developed system is concerned; we have tried to make the system as user friendly as possible where a layman can handle the system very comfortably.

During detail design, the system is designed into modules so it is easy to understand and helpful to the management.

98 T.Y. Computer Science 2007-2008

Page 99: Fitness Center 1

Fitness Club System

REFERENCES

The Bibliography contains reference to all the documents that were referred for the creation and successful completion of the project. It contains the names of the referred software engineering documents, visual basic technical and standards.

1) Mastering Visual Basic 6 Fundamentals- By Microsoft.2) Visual Basic 6 Programming Black Book – By Holzner Dream Tech.3) Internet.

99 T.Y. Computer Science 2007-2008