Monday, February 19, 2018

Enrollment System in Microsoft Visual Foxpro

In this article I would like to share with you my very simple enrollment system that I wrote using Microsoft Visual Foxpro 9. I hope you will like my work. Thank you.

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.








Sample Program Output



Program Listing

Table Stucture

student 
============

sid
name
course


subjects
=============
sid
subject
units


form1    Init

m.sid =""
m.sname=""
m.scource=""
m.ssubject=""
m.sunits=0

SET DEFAULT TO D:\vfp\enrollment
WITH thisform
    .txtsid.enabled=.f.
    .txtsname.enabled=.f.
    .txtscourse.enabled=.f.
ENDWITH


New Record Button

WITH thisform 
    .txtsid.value=""
    .txtsname.value=""
    .txtscourse.value=""
    .txtsid.enabled=.t.
    .txtsname.enabled=.t.
    .txtscourse.enabled=.t.
    .txtsid.setfocus
  ENDWITH
  
  
  Save and Update Button
  =====================
  
  SELECT student

LOCATE FOR sid = m.sid

if !found()
   && new record
   if Messagebox("Are you sure to add new record?",32+4,"Confirmation") = 6
   append blank  && add new record
   gather memvar
  endif
 else && update record
       if Messagebox("Are you sure to update existing record?",32+4,"Confirmation") = 6
       gather memvar && overwrite existing record
     endif
  endif

  thisform.grdStudent.refresh
  
  
  Delete Button
  ==============
  
   SELECT STUDENT
SET DELETED on
locate for sid = m.sid
if found()
   
   if Messagebox("Are you sure to delete this record?",32+4,"Confirmation") = 6
   DELETE
    Messagebox("Record Successfully deleted","Information")
      thisform.refresh
  thisform.grdstudent.refresh
  Endif
 ENDIF
  
   thisform.refresh
  thisform.grdstudent.refresh
  thisform.txtsid.Enabled= .F.
  thisform.txtsname.Enabled= .F.
   thisform.txtscourse.Enabled= .F.
  thisform.command1.SetFocus
  
  
  
* Code To Print Single Record
* Written By Mr. Jake R. Pomperada
* February 19, 2017

Print Single Record Button
============================

SELECT Student
SET FILTER TO sid=ALLTRIM(thisform.txtId.Value)
REPORT FORM student_report to PRINTER preview
Thisform.Refresh


Print All Record Button
=========================


SELECT Student

REPORT FORM student_report to PRINTER preview

thisform.Refresh



Form1 Init  for counting of units enrolled
===========================================

SET TALK OFF
SET ECHO OFF
SET CENTURY ON


SET DEFAULT TO D:\vfp\enrollment


thisform.txtName.Value=""

SELECT student
IF !BOF() THEN 
SKIP -1
SET FILTER TO sid = student.sid IN subjects
Select subjects

sum units  to thisform.txtTotalunits.value 
thisform.Refresh
thisform.txtId.SetFocus
ELSE
 MESSAGEBOX("Beginning of Record")
 ENDIF


 Previous Button
 ===============
 
 
thisform.Refresh

SELECT student



IF !BOF() 
SKIP -1
  
 
SET FILTER TO sid = student.sid IN subjects

Select subjects
sum units  to thisform.txtTotalunits.value 
ELSE
MESSAGEBOX("This is the first record.")
thisform.command1.Enabled= .F.
thisform.command2.Enabled= .T.
 
 ENDIF
 thisform.Refresh

 
 Next Button
 ============
 
 
thisform.Refresh
SELECT student
IF  !EOF() THEN 
SKIP 
 
SET FILTER TO sid = student.sid IN subjects
thisform.Refresh
Select subjects
    sum units  to thisform.txtTotalunits.value
ELSE
 MESSAGEBOX("End of Record")
 thisform.command2.Enabled = .F.
 thisform.command1.Enabled= .T.
 ENDIF
 
 Close button
 ===============
 
 thisform.Release
thisform.Hide
DO FORM main_menu




 
 

No comments:

Post a Comment