Sunteți pe pagina 1din 103

FOOD WORLD 2008

CONTENTS

SYNOPSIS 2
INTRODUCTION 4
DATAFLOW DIAGRAM 6
ER DIAGRAM 7
DETAILED DESIGN 8
CODE
NORMALIZATION
INTRODUCTION TO DBMS 19
INTRODUCTION TO MYSQL
INTRODUCTION TO VB
RESULT
CONCLUSION
BIBLIOGRAPHY

 SYNOPSIS 2

 INTRODUCTION 4

[Type text] Page 1


FOOD WORLD 2008

 DATAFLOW DIAGRAM 6

 ER DIAGRAM 7

 DETAILED DESIGN 8

 CODE 11

 NORMALIZATION 56

 INTRODUCTION TO DBMS 19

 INTRODUCTION TO MYSQL 26

 INTRODUCTION TO VB 32

 RESULT 39

 CONCLUSION 43

 BIBLIOGRAPHY 44

SYNOPSIS
A food world supermarket is a place that has all household
items in the same building. A supermarket that has a large number of

[Type text] Page 2


FOOD WORLD 2008

products, their respective departments, customers or vendors has a


large amount of data to be handled
This supermarket database Management System is a software
package that aims to automate the maintenance of the database of
the customers, vendors, products, their respective departments and
billing information of the customers and the vendors, their mode of
payment. All the frequently needed operations were identified and
were implemented in the package.
The basic aspects that are needed in the supermarket database
Management System can be classified into
 Insertion
 Deletion
 Modification and
 Retrieval
Of the customers, departments, vendors, bank and the products.

The main issue that has to be considered is the security aspect of


the databases. Only the authorized person must be entitled to change
the necessary information.
Functionality such as report generation may also be needed
for the purpose of reference and transaction.

ABSTRACT

[Type text] Page 3


FOOD WORLD 2008

A food world supermarket is a place that has all household items


in the same building. A supermarket that has a large number of
products, their respective departments, customers or vendors has a
large amount of data to be handled. Maintenance of such information
manually may prove to be an inefficient and a cumbersome job. Thus,
it would be a novel idea to automate and maintain the data using a
database management system.

The various operations that a supermarket needs to do may be


updating the information of the products, their respective
departments, customers or vendors in the records; retrieval or
manipulation of the same. Functionality such as report generation may
also be needed for the purpose of reference and transaction.

The main issue that has to be considered is the security aspect


of the databases. Only the authorized person must be entitled to
change the necessary information. Not all need to access the database
for modification purpose. The restricted modification access has to be
provided to prevent accidental or intentional corruption of the data.

We can meet the requirements of the supermarket management


operations through an efficient database management System, which
becomes a ready reference for any type of information required
regarding the aspects of the supermarket.

INTRODUCTION

[Type text] Page 4


FOOD WORLD 2008

This supermarket database Management System is a software


package that aims to automate the maintenance of the database of
the customers, vendors, products, their respective departments and
billing information of the customers and the vendors, their mode of
payment. All the frequently needed operations were identified and
were implemented in the package.
The basic aspects that are needed in the supermarket database
Management System can be classified into
 Insertion
 Deletion
 Modification and
 Retrieval
Of the customers, departments, vendors, bank and the products.

Operations with customers:


The software provides an easy interface for insertion and
deletion of details of customers. All the information regarding an
customer such as his name,customer ID,address,phone, etc. can be
entered at one shot, when a new customer record is to be added or
deleted. Operations such as modification and retrieval of the above
mentioned details of the customers can also be performed.The details
of all the customers can also be viewed at once.
Operations with departments:
The insertion and deletion of details of the department can be
done very easily. All the information regarding the department such as
department ID and its description, etc can be entered at one shot,
when a new department record is to be added or deleted. Operations
such as modification and retrieval of the above mentioned details of

[Type text] Page 5


FOOD WORLD 2008

the departments can also be performed. The details of all the


departments can also be viewed at once.

Operations with product:


Insertion and deletion of details of product can be performed. All
the information regarding a product such as the name, product ID,
product cost, product availability in the supermarket and it’s handling
department IDs, etc. can be entered at one shot, when a new product
record is to be added or deleted. Operations such as modification and
retrieval of the above mentioned details of the product can also be
performed. The details of all the products can also be viewed at one
shot.

Operations with vendor:


Vendors are the persons who play an important role in the
supermarket. They supply the products to the supermarket. The
supermarket maintains a list of all vendors. Insertion and deletion of
details of vendors can be performed easily. All the information
regarding a vendor such as his name, vendor ID, address, phone etc.
can be entered at one shot, when a new vendor record is to be added
or deleted. Operations such as modification and retrieval of the above
mentioned details of the vendors can also be performed. The details of
all the vendors can also be viewed using data report.

Navigation and generating reports:


We can navigate from a record to not only the next and the
previous records but also the first and the last records at once. Report
generation capability has also been provided. A few common reports
have also been incorporated, so that it can be used for the compact
view of data, as well as for hard copy reports.
[Type text] Page 6
FOOD WORLD 2008

Data flow diagram of FOOD WORLD

Dept

Customer
Product

Product avail Select Product

CustomerBilling

If less

Yes
If
Vendor confirm Update product
transaction Availability

No
Vendor bill
Payment mode
No transaction
Update product
Availability Complete customer
transaction
Complete
vendor
transaction

[Type text] Page 7


FOOD WORLD 2008

ER-DIAGRAM for FOOD WORLD

DEPT_ID
DNAME AM B_N
VB_ID
VENID VENN O
E

DEPARTMENT VENDOR GIV


ES VEND_BILL

D_BILL
CID CNAME
CON DELI
CADD VERS
TRO
LS

PRODUCT PCOS
CUSTOMER BUYS
T

PID
CTYPE PNAME PDES

PAYS

CBILLI
D
CHEC BANK
CUST_BILL K BNAME

BILLNO BADD BID


DATE
TOTAL

[Type text] Page 8


FOOD WORLD 2008

Detailed Design

The process of detailed design involves the transformation of the


data collected for the supermarket management into a relational
database schema.
In the design process various factors will have to be taken care
of a complete and an efficient system is what would be required.
Optimality in terms of time and space of the conceptual data is of
primary concern, needless to say .In this design the twelve rules of
Codd have to be obeyed.
Codd's rules in the Design of the Supermarket Management
System
All of Codd's rules have been taken as references in the design
of our database system.
The information rule:
All information are explicitly and logically represented as data
values in tables. i.e, all the required data values are accommodated in
our database. Every detail about the customers, vendors, products and
their respective departments.
The guaranteed access rule:
Every item must be logically addressable and accessible. The
different tables and their primary keys enable this in. All the data with
in tuples are made access able in our database. The customer id acts
as the primary key in the customer related tables, department id and
vendor id also make data access easy and fast.
Systematic treatment of all null values:
A DBMS should support null values to represent missing or
inapplicable fields. In our database ,the customer phone and the last

[Type text] Page 9


FOOD WORLD 2008

name fields of the customer record can be null values as these


privileges can't be taken as granted for every one.

Database Description rule:


A description of database is maintained using the same logical
structures with which data was defined by the DBMS.These are
accessable only to users with proper authority. The same has been
extended to our project in which the data access previliges and
manipulation privileges are protected using user names and
passwords.

The comprehensive sublanguage rule:


According to the rule, the DBMS must provide data
definition,view definition , manipulation,transaction operations and
authorization.Our project is been developed using oracle 8 and the
front end using Visual Basic.Hence the above listed operations can be
easily provided by us.

View Updating rule:


All theoretically updatable views must also be practically
updatable. Our system is developed using sql in which there exist
commands that enable all the operations.

The insert and update rule:


A single operand must hold good for all retrive,view ,update or
change operations.In our project there are fields and table organized

[Type text] Page 10


FOOD WORLD 2008

such that the update operations etc work on a set of tuples than a
single one ,which also is possible.

The physical independence rule:


User access to database must be consistent irrespective of the
changes in storage representation. This is easily enabled in the system
as the connectivty between VB and oracle is strong and as long as the
tables exist the access is possible.

The logical data independence rule:


The application programs and the terminal activities must remain
logically unaffected when design of the database is changed.This
change can be, splitting of table or even joining.Our backend in SQL is
built very strong and it is possible for specifying different types if
operations by the users.
The integrity constraints:
The integrity constraints must be stored as data in the database
table. In our project deletion of a valid record is automatically
cascaded to the tuples referencing that record in other tables.
Distribution rule:
If the data in the database becomes distributed the applications
running on it should not be hindered.In our project there can be many
applications that may be running using the customer, vendor,product
id as the key.It can be updating the details such as the product’s
availability in the market which reduces when the customer purchases
and increases when the vendor delivers the product, etc.

[Type text] Page 11


FOOD WORLD 2008

No subversion rule:
If the RDBMS supports a low level language then it should not
bypass any integrity constraints defined in the higher level.In our
project we have taken care to see that this problem is avoided and
there is no change or manipulation of data in the lowest level.

Thus all of Codd's rules have been used by us in the


development and deployment of the Supermarket Database
system.The fields have been identified and are subjected to
normalization.

[Type text] Page 12


FOOD WORLD 2008

CODE

Form name:frmabout

Private Sub Image1_Click()


Unload Me
frmdesktop.Show
End Sub

Private Sub Form_Load()

End Sub

Form name:frmbankdat

Dim rs As ADODB.Recordset
Dim con As ADODB.Connection
Dim cs As String
Dim cmd As String
Dim flag As Integer
Private Sub cmdnext_Click()
rs.MoveNext
If rs.EOF = True Then
rs.MoveLast
Else: display
End If
End Sub
Private Sub cmdcancel_Click()
txtbid.Enabled = False

[Type text] Page 13


FOOD WORLD 2008

txtbname.Enabled = False
txtbaddress.Enabled = False
txtstreet.Enabled = False
txtcity.Enabled = False
txtbankph.Enabled = False

cmdinsert.Visible = True
cmdmod.Visible = True
cmddel.Visible = True
cmdmmenu.Visible = True
frmequery.Enabled = True
cmdfirst.Enabled = True
cmdlast.Enabled = True
cmdprev.Enabled = True
cmdnext.Enabled = True
cmdview.Enabled = True
cmdcancel.Visible = False
cmdsave.Visible = False
display
End Sub

Private Sub cmdview_Click()


DataReport4.Show
End Sub

Private Sub cmdyes_Click()


If flag = 0 Then
If rs.EOF <> True Then
rs.Delete adAffectCurrent

[Type text] Page 14


FOOD WORLD 2008

rs.MovePrevious
If rs.BOF = True Then
rs.MoveFirst
End If
End If
display
Else:
rs!bank_id = txtbid.Text
rs!bank_name = txtbname.Text
rs!badd_no = txtbaddress.Text
rs!badd_street = txtstreet.Text
rs!badd_city = txtcity.Text
rs!bank_ph = txtbankph.Text

rs.Update
txtbname.Enabled = False
txtbaddress.Enabled = False
txtstreet.Enabled = False
txtcity.Enabled = False
txtbankph.Enabled = False

End If
cmdinsert.Visible = True
cmdmod.Visible = True
cmddel.Visible = True
cmdmmenu.Visible = True
Cmdyes.Visible = False
cmdno.Visible = False

[Type text] Page 15


FOOD WORLD 2008

If rs.EOF <> True Then


frmequery.Enabled = True
cmdfirst.Enabled = True
cmdlast.Enabled = True
cmdprev.Enabled = True
cmdnext.Enabled = True
cmdview.Enabled = True
End If

lblrusure.Visible = False

End Sub
Private Sub cmdno_Click()
txtbid.Enabled = False
txtbname.Enabled = False
txtbaddress.Enabled = False
txtstreet.Enabled = False
txtcity.Enabled = False
txtbankph.Enabled = False

cmdinsert.Visible = True
cmdmod.Visible = True
cmddel.Visible = True
cmdmmenu.Visible = True
frmequery.Enabled = True
cmdfirst.Enabled = True
cmdlast.Enabled = True
cmdprev.Enabled = True
cmdnext.Enabled = True

[Type text] Page 16


FOOD WORLD 2008

cmdview.Enabled = True
Cmdyes.Visible = False
cmdno.Visible = False
lblrusure.Visible = False
End Sub

Private Sub cmdinsert_Click()


txtbid.Text = ""
txtbname.Text = ""
txtbaddress.Text = ""
txtstreet.Text = ""
txtcity.Text = ""
txtbankph.Text = ""

txtbid.Enabled = True
txtbname.Enabled = True
txtbaddress.Enabled = True
txtstreet.Enabled = True
txtcity.Enabled = True
txtbankph.Enabled = True
txtbid.SetFocus

MsgBox "First 3 letters BID followed by a number (NOT NULL) ",


vbInformation, "TO INSERT..."

cmdinsert.Visible = False
cmdmod.Visible = False
cmddel.Visible = False
cmdmmenu.Visible = False

[Type text] Page 17


FOOD WORLD 2008

frmequery.Enabled = False
cmdfirst.Enabled = False
cmdlast.Enabled = False
cmdprev.Enabled = False
cmdnext.Enabled = False
cmdview.Enabled = False
cmdcancel.Visible = True
cmdsave.Visible = True
End Sub
Private Sub Cmdmod_Click()
flag = 1
txtbname.Enabled = True
txtbaddress.Enabled = True
txtstreet.Enabled = True
txtcity.Enabled = True
txtbankph.Enabled = True

txtbname.SetFocus

cmdinsert.Visible = False
cmdmod.Visible = False
cmddel.Visible = False
cmdmmenu.Visible = False
frmequery.Enabled = False
cmdfirst.Enabled = False
cmdlast.Enabled = False
cmdprev.Enabled = False
cmdnext.Enabled = False
cmdview.Enabled = False

[Type text] Page 18


FOOD WORLD 2008

Cmdyes.Visible = True
cmdno.Visible = True
lblrusure.Visible = True

End Sub
Private Sub Cmddel_Click()
flag = 0
cmdinsert.Visible = False
cmdmod.Visible = False
cmddel.Visible = False
cmdmmenu.Visible = False
frmequery.Enabled = False
cmdfirst.Enabled = False
cmdlast.Enabled = False
cmdprev.Enabled = False
cmdnext.Enabled = False
cmdview.Enabled = False
Cmdyes.Visible = True
cmdno.Visible = True
lblrusure.Visible = True

End Sub
Private Sub Cmdmmenu_Click()
Unload Me
frmdesktop.Show
End Sub
Private Sub cmdsave_Click()

[Type text] Page 19


FOOD WORLD 2008

If txtbid.Text <> "" And txtbname.Text <> "" And txtbaddress.Text


<> "" And txtstreet.Text <> "" And txtcity.Text <> "" And
txtbankph.Text <> "" Then
rs.MoveLast
rs.AddNew
rs!bank_id = txtbid.Text
rs!bank_name = txtbname.Text
rs!badd_no = txtbaddress.Text
rs!badd_street = txtstreet.Text
rs!badd_city = txtcity.Text
rs!bank_ph = txtbankph.Text
rs.UpdateBatch adAffectAllChapters
Else:
MsgBox "First 3 letters BID followed by number (NOT NULL) ",
vbCritical, "ERROR INSERTING..."
'rs.MovePrevious
txtbid.Text = ""
txtbname.Text = ""
txtbaddress.Text = ""
txtstreet.Text = ""
txtcity.Text = ""
txtbankph.Text = ""
End If

txtbid.Enabled = False
txtbname.Enabled = False
txtbaddress.Enabled = False
txtstreet.Enabled = False
txtcity.Enabled = False

[Type text] Page 20


FOOD WORLD 2008

txtbankph.Enabled = False

cmdinsert.Visible = True
cmdmod.Visible = True
cmddel.Visible = True
cmdmmenu.Visible = True
frmequery.Enabled = True
cmdfirst.Enabled = True
cmdlast.Enabled = True
cmdprev.Enabled = True
cmdnext.Enabled = True
cmdview.Enabled = True
cmdcancel.Visible = False
cmdsave.Visible = False
display
End Sub
Private Sub cmdfirst_Click()
rs.MoveFirst
display
End Sub
Private Sub cmdlast_Click()
rs.MoveLast
display
End Sub
Private Sub cmdprev_Click()
rs.MovePrevious
If rs.BOF = True Then
rs.MoveFirst
Else: display

[Type text] Page 21


FOOD WORLD 2008

End If

End Sub

Private Sub cmdrefresh_Click()


Unload Me
Load frmbankdet
frmbankdet.Show
End Sub

Private Sub Form_Load()


frmbankdet.Show
cmdsave.Visible = False
cmdcancel.Visible = False
Cmdyes.Visible = False
cmdno.Visible = False
lblrusure.Visible = False

Set rs = New ADODB.Recordset


Set con = New ADODB.Connection
con.Open "user
ID=svspes05;password=26609527;dsn=FOODWORLD"
Set rs.ActiveConnection = con

rs.Open "bank_tab1", con, adOpenDynamic, adLockOptimistic


display

txtbid.Enabled = False
txtbname.Enabled = False

[Type text] Page 22


FOOD WORLD 2008

txtbaddress.Enabled = False
txtstreet.Enabled = False
txtcity.Enabled = False
txtbankph.Enabled = False

End Sub
Public Sub display()
If rs.EOF = True Then
MsgBox "No records in the table ", vbInformation, "No records"
txtbid.Text = ""
txtbname.Text = ""
txtbaddress.Text = ""
txtstreet.Text = ""
txtcity.Text = ""
txtbankph.Text = ""
cmdmod.Enabled = False
cmddel.Enabled = False
cmdfirst.Enabled = False
cmdlast.Enabled = False
cmdprev.Enabled = False
cmdnext.Enabled = False
cmdview.Enabled = False
frmebankinfo.Enabled = False
Else:
cmdmod.Enabled = True
cmddel.Enabled = True
cmdfirst.Enabled = True
cmdlast.Enabled = True
cmdprev.Enabled = True

[Type text] Page 23


FOOD WORLD 2008

cmdnext.Enabled = True
frmebankinfo.Enabled = True

txtbid.Text = rs!bank_id
txtbname.Text = rs!bank_name
txtbaddress.Text = rs!badd_no
txtstreet.Text = rs!badd_street
txtcity.Text = rs!badd_city
txtbankph.Text = rs!badd_ph
End If

End Sub

Private Sub txtbankph_KeyPress(KeyAscii As Integer)


If (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub txtbid_KeyPress(KeyAscii As Integer)
If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub

Private Sub txtbname_KeyPress(KeyAscii As Integer)


If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii <> 32) Then

[Type text] Page 24


FOOD WORLD 2008

KeyAscii = 0
End If
End Sub
Private Sub txtbaddress_KeyPress(KeyAscii As Integer)
If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) And
(KeyAscii <> 35) And (KeyAscii <> 32) And (KeyAscii <> 47) Then
KeyAscii = 0
End If
End Sub
Private Sub txtstreet_KeyPress(KeyAscii As Integer)
If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) And
(KeyAscii <> 32) And (KeyAscii <> 44) Then
KeyAscii = 0
End If
End Sub
Private Sub txtcity_KeyPress(KeyAscii As Integer)
If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) And
(KeyAscii <> 32) And (KeyAscii <> 45) Then
KeyAscii = 0
End If
End Sub

From name: frmclock

Dim rs As ADODB.Recordset
Dim con As ADODB.Connection

[Type text] Page 25


FOOD WORLD 2008

Dim cs As String
Dim cmd As String
Dim flag As Integer
Private Sub cmdnext_Click()
rs.MoveNext
If rs.EOF = True Then
rs.MoveLast
Else: display
End If
End Sub
Private Sub cmdcancel_Click()
txtbid.Enabled = False
txtbname.Enabled = False
txtbaddress.Enabled = False
txtstreet.Enabled = False
txtcity.Enabled = False
txtbankph.Enabled = False

cmdinsert.Visible = True
cmdmod.Visible = True
cmddel.Visible = True
cmdmmenu.Visible = True
frmequery.Enabled = True
cmdfirst.Enabled = True
cmdlast.Enabled = True
cmdprev.Enabled = True
cmdnext.Enabled = True
cmdview.Enabled = True
cmdcancel.Visible = False

[Type text] Page 26


FOOD WORLD 2008

cmdsave.Visible = False
display
End Sub

Private Sub cmdview_Click()


DataReport4.Show
End Sub

Private Sub cmdyes_Click()


If flag = 0 Then
If rs.EOF <> True Then
rs.Delete adAffectCurrent
rs.MovePrevious
If rs.BOF = True Then
rs.MoveFirst
End If
End If
display
Else:
rs!bank_id = txtbid.Text
rs!bank_name = txtbname.Text
rs!badd_no = txtbaddress.Text
rs!badd_street = txtstreet.Text
rs!badd_city = txtcity.Text
rs!bank_ph = txtbankph.Text

rs.Update
txtbname.Enabled = False
txtbaddress.Enabled = False

[Type text] Page 27


FOOD WORLD 2008

txtstreet.Enabled = False
txtcity.Enabled = False
txtbankph.Enabled = False

End If
cmdinsert.Visible = True
cmdmod.Visible = True
cmddel.Visible = True
cmdmmenu.Visible = True
Cmdyes.Visible = False
cmdno.Visible = False

If rs.EOF <> True Then


frmequery.Enabled = True
cmdfirst.Enabled = True
cmdlast.Enabled = True
cmdprev.Enabled = True
cmdnext.Enabled = True
cmdview.Enabled = True
End If

lblrusure.Visible = False

End Sub
Private Sub cmdno_Click()
txtbid.Enabled = False
txtbname.Enabled = False
txtbaddress.Enabled = False
txtstreet.Enabled = False

[Type text] Page 28


FOOD WORLD 2008

txtcity.Enabled = False
txtbankph.Enabled = False

cmdinsert.Visible = True
cmdmod.Visible = True
cmddel.Visible = True
cmdmmenu.Visible = True
frmequery.Enabled = True
cmdfirst.Enabled = True
cmdlast.Enabled = True
cmdprev.Enabled = True
cmdnext.Enabled = True
cmdview.Enabled = True
Cmdyes.Visible = False
cmdno.Visible = False
lblrusure.Visible = False
End Sub

Private Sub cmdinsert_Click()


txtbid.Text = ""
txtbname.Text = ""
txtbaddress.Text = ""
txtstreet.Text = ""
txtcity.Text = ""
txtbankph.Text = ""

txtbid.Enabled = True
txtbname.Enabled = True
txtbaddress.Enabled = True

[Type text] Page 29


FOOD WORLD 2008

txtstreet.Enabled = True
txtcity.Enabled = True
txtbankph.Enabled = True
txtbid.SetFocus

MsgBox "First 3 letters BID followed by a number (NOT NULL) ",


vbInformation, "TO INSERT..."

cmdinsert.Visible = False
cmdmod.Visible = False
cmddel.Visible = False
cmdmmenu.Visible = False
frmequery.Enabled = False
cmdfirst.Enabled = False
cmdlast.Enabled = False
cmdprev.Enabled = False
cmdnext.Enabled = False
cmdview.Enabled = False
cmdcancel.Visible = True
cmdsave.Visible = True
End Sub
Private Sub Cmdmod_Click()
flag = 1
txtbname.Enabled = True
txtbaddress.Enabled = True
txtstreet.Enabled = True
txtcity.Enabled = True
txtbankph.Enabled = True

[Type text] Page 30


FOOD WORLD 2008

txtbname.SetFocus

cmdinsert.Visible = False
cmdmod.Visible = False
cmddel.Visible = False
cmdmmenu.Visible = False
frmequery.Enabled = False
cmdfirst.Enabled = False
cmdlast.Enabled = False
cmdprev.Enabled = False
cmdnext.Enabled = False
cmdview.Enabled = False
Cmdyes.Visible = True
cmdno.Visible = True
lblrusure.Visible = True

End Sub
Private Sub Cmddel_Click()
flag = 0
cmdinsert.Visible = False
cmdmod.Visible = False
cmddel.Visible = False
cmdmmenu.Visible = False
frmequery.Enabled = False
cmdfirst.Enabled = False
cmdlast.Enabled = False
cmdprev.Enabled = False
cmdnext.Enabled = False
cmdview.Enabled = False

[Type text] Page 31


FOOD WORLD 2008

Cmdyes.Visible = True
cmdno.Visible = True
lblrusure.Visible = True

End Sub
Private Sub Cmdmmenu_Click()
Unload Me
frmdesktop.Show
End Sub
Private Sub cmdsave_Click()
If txtbid.Text <> "" And txtbname.Text <> "" And txtbaddress.Text
<> "" And txtstreet.Text <> "" And txtcity.Text <> "" And
txtbankph.Text <> "" Then
rs.MoveLast
rs.AddNew
rs!bank_id = txtbid.Text
rs!bank_name = txtbname.Text
rs!badd_no = txtbaddress.Text
rs!badd_street = txtstreet.Text
rs!badd_city = txtcity.Text
rs!bank_ph = txtbankph.Text
rs.UpdateBatch adAffectAllChapters
Else:
MsgBox "First 3 letters BID followed by number (NOT NULL) ",
vbCritical, "ERROR INSERTING..."
'rs.MovePrevious
txtbid.Text = ""
txtbname.Text = ""
txtbaddress.Text = ""

[Type text] Page 32


FOOD WORLD 2008

txtstreet.Text = ""
txtcity.Text = ""
txtbankph.Text = ""
End If

txtbid.Enabled = False
txtbname.Enabled = False
txtbaddress.Enabled = False
txtstreet.Enabled = False
txtcity.Enabled = False
txtbankph.Enabled = False

cmdinsert.Visible = True
cmdmod.Visible = True
cmddel.Visible = True
cmdmmenu.Visible = True
frmequery.Enabled = True
cmdfirst.Enabled = True
cmdlast.Enabled = True
cmdprev.Enabled = True
cmdnext.Enabled = True
cmdview.Enabled = True
cmdcancel.Visible = False
cmdsave.Visible = False
display
End Sub
Private Sub cmdfirst_Click()
rs.MoveFirst
display

[Type text] Page 33


FOOD WORLD 2008

End Sub
Private Sub cmdlast_Click()
rs.MoveLast
display
End Sub
Private Sub cmdprev_Click()
rs.MovePrevious
If rs.BOF = True Then
rs.MoveFirst
Else: display
End If

End Sub

Private Sub cmdrefresh_Click()


Unload Me
Load frmbankdet
frmbankdet.Show
End Sub

Private Sub Form_Load()


frmbankdet.Show
cmdsave.Visible = False
cmdcancel.Visible = False
Cmdyes.Visible = False
cmdno.Visible = False
lblrusure.Visible = False

Set rs = New ADODB.Recordset

[Type text] Page 34


FOOD WORLD 2008

Set con = New ADODB.Connection


con.Open "user
ID=svspes05;password=26609527;dsn=FOODWORLD"
Set rs.ActiveConnection = con

rs.Open "bank_tab1", con, adOpenDynamic, adLockOptimistic


display

txtbid.Enabled = False
txtbname.Enabled = False
txtbaddress.Enabled = False
txtstreet.Enabled = False
txtcity.Enabled = False
txtbankph.Enabled = False

End Sub
Public Sub display()
If rs.EOF = True Then
MsgBox "No records in the table ", vbInformation, "No records"
txtbid.Text = ""
txtbname.Text = ""
txtbaddress.Text = ""
txtstreet.Text = ""
txtcity.Text = ""
txtbankph.Text = ""
cmdmod.Enabled = False
cmddel.Enabled = False
cmdfirst.Enabled = False
cmdlast.Enabled = False

[Type text] Page 35


FOOD WORLD 2008

cmdprev.Enabled = False
cmdnext.Enabled = False
cmdview.Enabled = False
frmebankinfo.Enabled = False
Else:
cmdmod.Enabled = True
cmddel.Enabled = True
cmdfirst.Enabled = True
cmdlast.Enabled = True
cmdprev.Enabled = True
cmdnext.Enabled = True
frmebankinfo.Enabled = True

txtbid.Text = rs!bank_id
txtbname.Text = rs!bank_name
txtbaddress.Text = rs!badd_no
txtstreet.Text = rs!badd_street
txtcity.Text = rs!badd_city
txtbankph.Text = rs!badd_ph
End If

End Sub

Private Sub txtbankph_KeyPress(KeyAscii As Integer)


If (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub txtbid_KeyPress(KeyAscii As Integer)

[Type text] Page 36


FOOD WORLD 2008

If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub

Private Sub txtbname_KeyPress(KeyAscii As Integer)


If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii <> 32) Then
KeyAscii = 0
End If
End Sub
Private Sub txtbaddress_KeyPress(KeyAscii As Integer)
If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) And
(KeyAscii <> 35) And (KeyAscii <> 32) And (KeyAscii <> 47) Then
KeyAscii = 0
End If
End Sub
Private Sub txtstreet_KeyPress(KeyAscii As Integer)
If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) And
(KeyAscii <> 32) And (KeyAscii <> 44) Then
KeyAscii = 0
End If
End Sub
Private Sub txtcity_KeyPress(KeyAscii As Integer)

[Type text] Page 37


FOOD WORLD 2008

If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) And
(KeyAscii <> 32) And (KeyAscii <> 45) Then
KeyAscii = 0
End If
End Sub

From name: frmcustbill

Dim con As ADODB.Connection


Dim rs As ADODB.Recordset
Dim rs1 As ADODB.Recordset
Dim cs As String
Dim max As Integer
Dim max1 As Integer
Dim uno As String
Dim paymode As String
Dim finalno As String
Dim resp As String
Private Sub cmdpay_Click()
rs.Open "select prod_avail from product_tab where prod_id='" &
Text3.Text & "'", con, adOpenDynamic, adLockOptimistic
If rs.EOF = False Then
max1 = rs(0)
max1 = max1 - Val(Text6.Text)
rs!prod_avail = max1
rs.Update
End If
rs.Close

[Type text] Page 38


FOOD WORLD 2008

rs.Open "select prod_avail from product_tab where prod_id='" &


Text10.Text & "'", con, adOpenDynamic, adLockOptimistic
If rs.EOF = False Then
max1 = rs(0)
max1 = max1 - Val(Text13.Text)
rs!prod_avail = max1
rs.Update
End If
rs.Close

rs.Open "select prod_avail from product_tab where prod_id='" &


Text17.Text & "'", con, adOpenDynamic, adLockOptimistic
If rs.EOF = False Then
max1 = rs(0)
max1 = max1 - Val(Text20.Text)
rs!prod_avail = max1
rs.Update
End If
rs.Close

rs.Open "select prod_avail from product_tab where prod_id='" &


Text24.Text & "'", con, adOpenDynamic, adLockOptimistic
If rs.EOF = False Then
max1 = rs(0)
max1 = max1 - Val(Text27.Text)
rs!prod_avail = max1
rs.Update
End If

[Type text] Page 39


FOOD WORLD 2008

rs.Close

rs.Open "select prod_avail from product_tab where prod_id='" &


Text31.Text & "'", con, adOpenDynamic, adLockOptimistic
If rs.EOF = False Then
max1 = rs(0)
max1 = max1 - Val(Text34.Text)
rs!prod_avail = max1
rs.Update
End If
rs.Close

rs.Open "select prod_avail from product_tab where prod_id='" &


Text38.Text & "'", con, adOpenDynamic, adLockOptimistic
If rs.EOF = False Then
max1 = rs(0)
max1 = max1 - Val(Text41.Text)
rs!prod_avail = max1
rs.Update
End If
rs.Close

rs.Open "select prod_avail from product_tab where prod_id='" &


Text45.Text & "'", con, adOpenDynamic, adLockOptimistic
If rs.EOF = False Then
max1 = rs(0)
max1 = max1 - Val(Text48.Text)
rs!prod_avail = max1
rs.Update

[Type text] Page 40


FOOD WORLD 2008

End If
rs.Close

rs.Open "select prod_avail from product_tab where prod_id='" &


Text52.Text & "'", con, adOpenDynamic, adLockOptimistic
If rs.EOF = False Then
max1 = rs(0)
max1 = max1 - Val(Text55.Text)
rs!prod_avail = max1
rs.Update
End If
rs.Close

finalno = paymode + uno

If txtcusttype.Text = "REGULAR" Or txtcusttype.Text = "CASUAL" Then

rs.Open "cust_bill", con, adOpenDynamic, adLockOptimistic


'rs.MoveLast
rs.AddNew
rs!bill_no = txtbillno.Text
rs!custbill_id = txtcid.Text
rs!total = Text73.Text
rs!date_of_bill = txtdate.Text

'rs!pmode = finalno
rs.UpdateBatch adAffectAllChapters
End If

[Type text] Page 41


FOOD WORLD 2008

txtbillno.Text = ""
txtcid.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
Text15.Text = ""
Text16.Text = ""
Text17.Text = ""
Text18.Text = ""
Text19.Text = ""
Text20.Text = ""
Text21.Text = ""
Text22.Text = ""
Text23.Text = ""
Text24.Text = ""
Text25.Text = ""
Text26.Text = ""
Text27.Text = ""
Text28.Text = ""
Text29.Text = ""

[Type text] Page 42


FOOD WORLD 2008

Text30.Text = ""
Text31.Text = ""
Text32.Text = ""
Text33.Text = ""
Text34.Text = ""
Text35.Text = ""
Text36.Text = ""
Text37.Text = ""
Text38.Text = ""
Text39.Text = ""
Text40.Text = ""
Text41.Text = ""
Text42.Text = ""
Text43.Text = ""
Text44.Text = ""
Text45.Text = ""
Text46.Text = ""
Text47.Text = ""
Text48.Text = ""
Text49.Text = ""
Text50.Text = ""
Text51.Text = ""
Text52.Text = ""
Text53.Text = ""
Text54.Text = ""
Text55.Text = ""
Text56.Text = ""
Text57.Text = ""
Text58.Text = ""

[Type text] Page 43


FOOD WORLD 2008

txtdate.Text = ""
Text73.Text = ""
Text74.Text = ""
Text75.Text = ""
Text76.Text = ""
Text77.Text = ""
Text78.Text = ""
Text79.Text = ""
Text80.Text = ""
Text81.Text = ""
txtfname.Text = ""
txtlname.Text = ""
txtcusttype.Text = ""
txtcustph.Text = ""

Unload frmcustbill
frmpaymode.Show
End Sub
Private Sub cmdcancel_Click()
End
frmmainmenu.Show
End Sub

Private Sub Form_Load()


Set con = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
con.Open "user
ID=svspes05;password=26609527;dsn=FOODWORLD"

[Type text] Page 44


FOOD WORLD 2008

Set rs.ActiveConnection = con


rs.Open "cust_bill", con, adOpenDynamic, adLockOptimistic
'rs.MoveLast
'txtbillno.Text = rs!bill_no + 1
rs.Close
txtdate = Format(Date, "dd-mm-yyyy")
End Sub
Private Sub Option1_GotFocus()
Label17.Visible = False
End Sub
Private Sub Option2_GotFocus()
Label17.Visible = True
Label17.Caption = "CHEQUE NO."
End Sub

Private Sub Option3_GotFocus()


Label17.Visible = True
Label17.Caption = "CREDIT CARD NO."
End Sub
Private Sub Text10_KeyPress(KeyAscii As Integer)
If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text10_LostFocus()
If Text10.Text <> "" Then

[Type text] Page 45


FOOD WORLD 2008

rs.Open "select prod_name,prod_cost,prod_desc,prod_avail from


product_tab where prod_id='" & Text10.Text & "'", con,
adOpenDynamic, adLockOptimistic
If rs.EOF = False Then
Text11.Text = rs(0)
Text12.Text = rs(1)
Text75.Text = rs(2)
max = rs(3)
Else
MsgBox "NO records", vbOKOnly, "Info"
End If
rs.Close
End If

End Sub
Private Sub Text13_KeyPress(KeyAscii As Integer)
If (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text13_LostFocus()

If Val(Text13.Text) >= 0 Then


If Val(Text13.Text) > max Then
MsgBox "AVAILABILITY IS LESS", vbCritical, "NO AVAILABILITY"
Text13.SetFocus
Else
Text14.Text = Val(Text12.Text) * Val(Text13.Text)
End If

[Type text] Page 46


FOOD WORLD 2008

Else
MsgBox "ILLEGAL VALUE", vbCritical, "ERROR"
Text13.SetFocus
End If
End Sub
Private Sub Text15_KeyPress(KeyAscii As Integer)
If (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If

End Sub
Private Sub Text15_LostFocus()
Text16.Text = Val(Text14.Text) - (Val(Text14.Text) *
(Val(Text15.Text) / 100))
End Sub
Private Sub Text17_KeyPress(KeyAscii As Integer)
If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text17_LostFocus()
If Text17.Text <> "" Then
rs.Open "select prod_name,prod_cost,prod_desc,prod_avail from
product_tab where prod_id='" & Text17.Text & "'", con,
adOpenDynamic, adLockOptimistic
If rs.EOF = False Then
Text18.Text = rs(0)
Text19.Text = rs(1)

[Type text] Page 47


FOOD WORLD 2008

Text76.Text = rs(2)
max = rs(3)
Else
MsgBox "NO records", vbOKOnly, "Info"
End If
rs.Close
End If
End Sub
Private Sub Text20_KeyPress(KeyAscii As Integer)
If (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text22_KeyPress(KeyAscii As Integer)
If (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text24_KeyPress(KeyAscii As Integer)
If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text27_KeyPress(KeyAscii As Integer)
If (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub

[Type text] Page 48


FOOD WORLD 2008

Private Sub Text29_KeyPress(KeyAscii As Integer)


If (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text31_KeyPress(KeyAscii As Integer)
If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text34_KeyPress(KeyAscii As Integer)
If (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text36_KeyPress(KeyAscii As Integer)
If (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text38_KeyPress(KeyAscii As Integer)

[Type text] Page 49


FOOD WORLD 2008

If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub

Private Sub Text41_KeyPress(KeyAscii As Integer)


If (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text43_KeyPress(KeyAscii As Integer)
If (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text45_KeyPress(KeyAscii As Integer)
If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text48_KeyPress(KeyAscii As Integer)
If (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text50_KeyPress(KeyAscii As Integer)

[Type text] Page 50


FOOD WORLD 2008

If (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then


KeyAscii = 0
End If
End Sub
Private Sub Text52_KeyPress(KeyAscii As Integer)
If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text55_KeyPress(KeyAscii As Integer)
If (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text57_KeyPress(KeyAscii As Integer)
If (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text6_KeyPress(KeyAscii As Integer)
If (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub Text8_KeyPress(KeyAscii As Integer)
If (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If

[Type text] Page 51


FOOD WORLD 2008

End Sub
Private Sub Text9_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub Text16_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub Text23_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub Text30_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub Text37_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub Text44_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub Text51_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub Text58_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub Text73_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub txtcid_KeyPress(KeyAscii As Integer)

[Type text] Page 52


FOOD WORLD 2008

If (KeyAscii < 97 Or KeyAscii > 122) And (KeyAscii < 65 Or KeyAscii >
90) And (KeyAscii <> 8) And (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0
End If
End Sub
Private Sub txtcid_LostFocus()
rs.Open "select fname,lname,cust_type,cust_ph from cust_tab where
cust_id='" & txtcid.Text & "'", con, adOpenDynamic, adLockOptimistic
If rs.EOF = False Then
txtfname.Text = rs(0)
txtlname.Text = rs(1)
txtcusttype.Text = rs(2)
txtcustph.Text = rs(3)
txtcid.Enabled = False
txtfname.Enabled = False
txtlname.Enabled = False
txtcusttype.Enabled = False
txtcustph.Enabled = False
lblcid.Enabled = False
lblfname.Enabled = False
lbllname.Enabled = False
lblcusttype.Enabled = False
lblcustph.Enabled = False

Else
MsgBox "NO records", vbOKOnly, "Info"
txtcid.SetFocus
End If
rs.Close

[Type text] Page 53


FOOD WORLD 2008

End Sub
Private Sub Text20_LostFocus()
If Val(Text20.Text) >= 0 Then
If Val(Text20.Text) > max Then
MsgBox "AVAILABILITY IS LESS", vbCritical, "NO AVAILABILITY"
Text20.SetFocus
Else
Text21.Text = Val(Text20.Text) * Val(Text19.Text)
End If
Else
MsgBox "ILLEGAL VALUE", vbCritical, "ERROR"
Text20.SetFocus
End If
End Sub
Private Sub Text22_LostFocus()
Text23.Text = Val(Text21.Text) - (Val(Text21.Text) *
(Val(Text22.Text) / 100))
End Sub
Private Sub Text24_LostFocus()
If Text24.Text <> "" Then
rs.Open "select prod_name,prod_cost,prod_desc,prod_avail from
product_tab where prod_id='" & Text24.Text & "'", con,
adOpenDynamic, adLockOptimistic
If rs.EOF = False Then
Text25.Text = rs(0)
Text26.Text = rs(1)
Text77.Text = rs(2)
max = rs(3)
Else

[Type text] Page 54


FOOD WORLD 2008

MsgBox "NO records", vbOKOnly, "Info"


End If
rs.Close
End If

End Sub
Private Sub Text27_LostFocus()
If Val(Text27.Text) >= 0 Then
If Val(Text27.Text) > max Then
MsgBox "AVAILABILITY IS LESS", vbCritical, "NO AVAILABILITY"
Text27.SetFocus
Else
Text28.Text = Val(Text27.Text) * Val(Text26.Text)
End If
Else
MsgBox "ILLEGAL VALUE", vbCritical, "ERROR"
Text27.SetFocus
End If
End Sub
Private Sub Text29_LostFocus()
Text30.Text = Val(Text28.Text) - (Val(Text28.Text) *
(Val(Text29.Text) / 100))
End Sub
Private Sub Text3_LostFocus()
If Text3.Text = "" Then
MsgBox "Invalid data", vbOKOnly, "Info"
Else

[Type text] Page 55


FOOD WORLD 2008

rs.Open "select prod_name,prod_cost,prod_desc,prod_avail from


product_tab where prod_id='" & Text3.Text & "'", con,
adOpenDynamic, adLockOptimistic
If rs.EOF = False Then
Text4.Text = rs(0)
Text5.Text = rs(1)
Text74.Text = rs(2)
max = rs(3)
Else
MsgBox "NO records", vbOKOnly, "Info"
End If
rs.Close
End If
End Sub
Private Sub Text31_LostFocus()
If Text31.Text <> "" Then
rs.Open "select prod_name,prod_cost,prod_desc,prod_avail from
product_tab where prod_id='" & Text31.Text & "'", con,
adOpenDynamic, adLockOptimistic
If rs.EOF = False Then
Text32.Text = rs(0)
Text33.Text = rs(1)
Text78.Text = rs(2)
max = rs(3)
Else
MsgBox "NO records", vbOKOnly, "Info"
End If
rs.Close
End If

[Type text] Page 56


FOOD WORLD 2008

End Sub
Private Sub Text34_LostFocus()
If Val(Text34.Text) >= 0 Then
If Val(Text34.Text) > max Then
MsgBox "AVAILABILITY IS LESS", vbCritical, "NO AVAILABILITY"
Text34.SetFocus
Else
Text35.Text = Val(Text34.Text) * Val(Text33.Text)
End If
Else
MsgBox "ILLEGAL VALUE", vbCritical, "ERROR"
Text34.SetFocus
End If
End Sub
Private Sub Text36_LostFocus()
Text37.Text = Val(Text35.Text) - (Val(Text35.Text) *
(Val(Text36.Text) / 100))
End Sub
Private Sub Text38_LostFocus()
If Text38.Text <> "" Then
rs.Open "select prod_name,prod_cost,prod_desc,prod_avail from
product_tab where prod_id='" & Text38.Text & "'", con,
adOpenDynamic, adLockOptimistic
If rs.EOF = False Then
Text39.Text = rs(0)
Text40.Text = rs(1)
Text79.Text = rs(2)
max = rs(3)
Else

[Type text] Page 57


FOOD WORLD 2008

MsgBox "NO records", vbOKOnly, "Info"


End If
rs.Close
End If
End Sub
Private Sub Text41_LostFocus()
If Val(Text41.Text) >= 0 Then
If Val(Text41.Text) > max Then
MsgBox "AVAILABILITY IS LESS", vbCritical, "NO AVAILABILITY"
Text41.SetFocus
Else
Text42.Text = Val(Text41.Text) * Val(Text40.Text)
End If
Else
MsgBox "ILLEGAL VALUE", vbCritical, "ERROR"
Text41.SetFocus
End If
End Sub
Private Sub Text43_LostFocus()
Text44.Text = Val(Text42.Text) - (Val(Text42.Text) *
(Val(Text43.Text) / 100))
End Sub
Private Sub Text45_LostFocus()
If Text45.Text <> "" Then
rs.Open "select prod_name,prod_cost,prod_desc,prod_avail from
product_tab where prod_id='" & Text45.Text & "'", con,
adOpenDynamic, adLockOptimistic
If rs.EOF = False Then
Text46.Text = rs(0)

[Type text] Page 58


FOOD WORLD 2008

Text47.Text = rs(1)
Text80.Text = rs(2)
max = rs(3)
Else
MsgBox "NO records", vbOKOnly, "Info"
End If
rs.Close
End If
End Sub
Private Sub Text48_LostFocus()
If Val(Text48.Text) >= 0 Then
If Val(Text48.Text) > max Then
MsgBox "AVAILABILITY IS LESS", vbCritical, "NO AVAILABILITY"
Text48.SetFocus
Else
Text49.Text = Val(Text48.Text) * Val(Text47.Text)
End If
Else
MsgBox "ILLEGAL VALUE", vbCritical, "ERROR"
Text48.SetFocus
End If
End Sub
Private Sub Text50_LostFocus()
Text51.Text = Val(Text49.Text) - (Val(Text49.Text) *
(Val(Text50.Text) / 100))
End Sub
Private Sub Text52_LostFocus()
If Text52.Text <> "" Then

[Type text] Page 59


FOOD WORLD 2008

rs.Open "select prod_name,prod_cost,prod_desc,prod_avail from


product_tab where prod_id='" & Text52.Text & "'", con,
adOpenDynamic, adLockOptimistic
If rs.EOF = False Then
Text53.Text = rs(0)
Text54.Text = rs(1)
Text81.Text = rs(2)
max = rs(3)
Else
MsgBox "NO records", vbOKOnly, "Info"
End If
rs.Close
End If
End Sub
Private Sub Text55_LostFocus()
If Val(Text55.Text) >= 0 Then
If Val(Text55.Text) > max Then
MsgBox "AVAILABILITY IS LESS", vbCritical, "NO AVAILABILITY"
Text55.SetFocus
Else
Text56.Text = Val(Text55.Text) * Val(Text54.Text)
End If
Else
MsgBox "ILLEGAL VALUE", vbCritical, "ERROR"
Text55.SetFocus
End If
End Sub
Private Sub Text57_LostFocus()

[Type text] Page 60


FOOD WORLD 2008

Text58.Text = Val(Text56.Text) - (Val(Text56.Text) *


(Val(Text57.Text) / 100))
End Sub
Private Sub Text6_LostFocus()
If Val(Text6.Text) >= 0 Then
If Val(Text6.Text) > max Then
MsgBox "AVAILABILITY IS LESS", vbCritical, "NO AVAILABILITY"
Text6.SetFocus
Else
Text7.Text = Val(Text5.Text) * Val(Text6.Text)
End If
Else
MsgBox "ILLEGAL VALUE", vbCritical, "ERROR"
Text6.SetFocus
End If
End Sub
Private Sub Text62_LostFocus()
Text63.Text = Val(Text62.Text) * Val(Text61.Text)
End Sub
Private Sub Text64_LostFocus()
Text65.Text = Val(Text63.Text) - (Val(Text63.Text) *
(Val(Text64.Text) / 100))
End Sub
Private Sub Text66_LostFocus()
If Text66.Text <> "" Then
rs.Open "select prod_name,prod_cost,prod_desc from product_tab
where prod_id='" & Text66.Text & "'", con, adOpenDynamic,
adLockOptimistic
If rs.EOF = False Then

[Type text] Page 61


FOOD WORLD 2008

Text67.Text = rs(0)
Text68.Text = rs(1)
Text83.Text = rs(2)
Else
MsgBox "NO records", vbOKOnly, "Info"
End If
End If
rs.Close
End Sub
Private Sub Text69_LostFocus()
Text70.Text = Val(Text69.Text) * Val(Text68.Text)
End Sub
Private Sub Text71_LostFocus()
Text72.Text = Val(Text70.Text) - (Val(Text70.Text) *
(Val(Text71.Text) / 100))
End Sub
Private Sub Text73_LostFocus()
If (Text9.Text = "") Then
Text9.Text = 0
End If
If (Text16.Text = "") Then
Text16.Text = 0
End If
If (Text23.Text = "") Then
Text23.Text = 0
End If
If (Text30.Text = "") Then
Text30.Text = 0
End If

[Type text] Page 62


FOOD WORLD 2008

If (Text37.Text = "") Then


Text37.Text = 0
End If
If (Text44.Text = "") Then
Text44.Text = 0
End If
If (Text51.Text = "") Then
Text51.Text = 0
End If
If (Text58.Text = "") Then
Text58.Text = 0
End If
Text73.Text = Val(Text9.Text) + Val(Text16.Text) + Val(Text23.Text)
+ Val(Text30.Text) + Val(Text37.Text) + Val(Text44.Text) +
Val(Text51.Text) + Val(Text58.Text)
End Sub
Private Sub Text8_LostFocus()
Text9.Text = Val(Text7.Text) - (Val(Text7.Text) * (Val(Text8.Text) /
100))
End Sub

[Type text] Page 63


FOOD WORLD 2008

Normalization

The data to be maintained by us for the Supermarket Management are


:

Department Details:
There are various departments for handling various types of
products in the supermarket. So the necessary details are:

• DEPT_ID
• DEPT_TYPE

Customer details:
There may be many customers coming to the supermarket. The
customers may be classified into two categories like regular and
casual.So the neccassary details are:
• CUST_ID
• CUST_NAME
• CUST_ADDRESS
• CUST_PH
• CUST_TYPE

Product details:
There are various products in the supermarket which the
customer can purchase.So the necessary details are:
• PROD_ID
• PROD_NAME
• PROD_DESC
[Type text] Page 64
FOOD WORLD 2008

• PROD_COST
• PROD_AVAIL
• PROD_DEPT

Bank details:
There may be regular or casual customers who may be having
bank accounts. So the necessary details of the bank are:
• BANK_ID
• BANK_NAME
• BANK_ADDRESS
• BANK_PHONE

Vendor details:
There may be a lot of vendors for the supermarket.So the
details regarding them are maintained as follows:
• VEND_ID
• VEND_NAME
• VEND_ADDRESS
• VEND_PH
Customer Billing:
The supermarket management should maintain the transaction
of all regular and casual customers. Transactions with a person with no
CID is not entered.So the details regarding this are:
• BILL_NO
• CUST_ID
• TOTAL
• DATE_OF_BILL
Vendor Billing:

[Type text] Page 65


FOOD WORLD 2008

The transaction with respect to vendors should be maintained in


the database.So the details regarding this are:
• BILL_NO
• VEND_ID
• TOTAL
• DATE_OF_BILL

Details of normalization

Normalization is a step by step decomposition of complex records into


simple ones by reducing redundancies , inconsistancies and remove
anamolies.
There are three important forms in Normalization process :
 First Normal Form.
 Second Normal Form.
 Third Normal Form.
First Normal Form (1NF):
Definition : A table is said to be in first normal form if the
intersection of any column and row contain only any value.
Method : Identify suitable value from the pool of unnormalized
data.Remove any item that repeat with in a single tuple of this key to
another relation with the identified key as the primary key.
Its application to our database :
The Department ID gets repeated many times.Hence it can be
separated from the original table. Similarly the customer ID get
repeated and so do the vendor ID. Therefore these can be separated

[Type text] Page 66


FOOD WORLD 2008

into different table all together. Thus many more redundancies are
identified.

Second Normal Form (2NF):

Definition : A table is said to be in the second normal form if all


the values in every column are functionally or transitively dependent
on the primary key.
Method: Examine every column and section whether its values
depends on the whole of the compound key or some parts of
it.Remove those that depend only on part of the key to a new table
with that part of the primary key.The implication of second normal to
our project:
For eg: The customer address details can be broken up into
three different fields.

Third Normal Form (3NF):

Definition : A table is said to be in the third normal form if the


values in every nonkey columns are not tranitively dependent on the
primary key.
Method : Examine every non-key column with every other non-
key column.If the value depends on teh non-key element remove that
and form a separate table.The implication of third normal form to our
project:

After the normalization is applied, the final schema of the database is


as follows:

[Type text] Page 67


FOOD WORLD 2008

1.Department Details:

Dept_id Dept_type

2.Customer Details:

Cust_ID fname lname House No


street city Cust_ph Cust_type

3.Product Details:

Prod_ID Prod_name Prod_desc


Prod_cost Prod_availability Prod_dept

4.Bank Details:

Bank_ID Bank_name Building


Street City Bank_phone

5.Vendor Details:

Vend_ID Vend_name House No.


street City Vend_ph

6.Customer bill Detail:

[Type text] Page 68


FOOD WORLD 2008

Billno Cust_ID Total Date_of_Bill

7.Vendor bill Detail:

Billno Vend_ID Total Date_of_Bill

Table descriptions

Department details:

The department table consists of the department ID and the


type of the department.
• The department ID which is a primary key should start with a
DID.
• The department type describes the type of products it handles.

DEPT_ID NOT NULL VARCHAR(10)


DEPT_TYPE NOT NULL VARCHAR(30)

Customer details:
The customer plays an important role in the supermarket. The
customer table consists of
• The customer ID which is a primary key should start with CID.
• The customer’s first name which should be present.
• The customer’s last name which is not a must as some persons
might not have it.
• The address of the customer divided into house No,street,city

[Type text] Page 69


FOOD WORLD 2008

• The phone number of the customer. This is not a must.


• The type of customer , That is a customer is regular if he is very
frequently buying products from the supermarket and a
customer is casual if he occasionally visits the supermarket.

CUST_ID NOT NULL VARCHAR(10)


FNAME NOT NULL VARCHAR(30)
LNAME VARCHAR(30)
ADDRESS VARCHAR2(60)
STREET VARCHAR(30)
CITY VARCHAR(30)
CUST_PH VARCHAR(10)
CUST_TYPE NOT NULL VARCHAR(10)

Bank details:
The customers can also pay by cheque. So we need the basic
bank details such as:
• The bank ID which is a primary key and should start from BID.
• The name of the bank which cannot be null.

Name Null Type


BANK_ID NOT NULL VARCHAR(10)
BANK_NAME NOT NULL VARCHAR(30)
BADD_NO VARCHAR(20)
BADD_STREET VARCHAR(100)
BADD_CITY VARCHAR(20)
BANK_PHONE INT(10)

[Type text] Page 70


FOOD WORLD 2008

Product details:
The details of the product should be stored in the database.The
product table consists of
• The product ID which is a primary key and should start with PID.
• The name of the product which cannot be null.
• The description of the product.
• The number of each of the products available in stock.
• The department handling the product.

PROD_ID NOT NULL VARCHAR(10)


PROD_NAME NOT NULL VARCHAR(30)
PROD_DESC VARCHAR(30)
PROD_COST NOT NULL VARCHAR(10)
PROD_AVAIL NOT NULL VARCHAR(10)
PROD_DEPT VARCHAR(10)

Vendor details:
The vendor details should be maintained.
• The vendor ID is a primary key and should start with VID.
• The name of the vendor enterprise.
• The address details of the vendor
• The phone number of the vendor. This is not a must.
VEND_ID NOT NULL VARCHAR(10)
NAME NOT NULL VARCHAR(30)
ADDRESS NOT NULL VARCHAR(10)
STREET VARCHAR(30)
CITY VARCHAR(30)
VEND_PH VARCHAR(10)

Customer Billing:
The supermarket management should maintain the transaction
of all regular and casual customers.

[Type text] Page 71


FOOD WORLD 2008

Transactions with a person with no CID is not entered.


So the details regarding this are:
BILL_NO NOT NULL VARCHAR(10)
CUST_ID NOT NULL VARCHAR(10)
TOTAL INT(10)
DATE_OF_BILL NOT NULL DATE

Vendor Billing:
The transaction with respect to vendors should be maintained in
the database.So the details regarding this are:
BILL_NO NOT NULL VARCHAR(10)
VEND_ID NOT NULL VARCHAR(10)
TOTAL INT(10)
DATE_OF_BILL NOT NULL DATE

Introduction to DBMS
DATABASE MANAGEMENT SYSTEM CONCEPTS:

Data and database technology are having a major impact on the


management of resources and computer stored information in today’s
industries. A database can be in general terms, referred to as a
collection of related data . By data we are referring to a collection of

[Type text] Page 72


FOOD WORLD 2008

known facts that have been recorded and have an implicit meaning. A
database is designed, built and populated with data for a specific
purpose. It has an intended group of users and some preconceived
applications in which these users are interested.
Now that we are aware of what a database is we can easily
understand the concepts of a database management system. A
database management system is a collection of programs that enable
a user to create and maintain a database. The DBMS is a general
purpose system that facilitates the process of defining, constructing
and manipulating database for various applications.
Defining a database involves specifying the datatypes, structures
and constraints for data to be stored in the database, Constructing the
database is the process of storing the data itself on some medium that
is controlled by the DBMS.

Manipulating the database include such functions as querying the


database to retrieve specific data, updating the database, and
generating reports from the data. We can use general-purpose
software or special purpose software to create and maintain database.
The database along with the doftware to manage it is collectively
called a database system.
CHARACTERISTICS OF A DATABASE MANAGEMENT SYSTEM

 It represents complex relationships between data.


 Keeps a tight control over data redundancy.
 Enforces user-defined rules to ensures the integrity of table
data
 Has a centralized data dictionary for the storage of
information pertaining to data and its manipulation.
 Ensures the data can be shared across applications.

[Type text] Page 73


FOOD WORLD 2008

 Enforces data authorization.


 Has automatic, intelligent backup and recovery procedure for
data.
 Has different interfaces via which users can manipulate the
data.

RELATIONAL DATABASE MANAGEMENT SYSTEM

At the heart of most of today’s information systems is a


relational database management system-RDBMS. To qualify as
relational DBMS a system must have at least the following properties:

 It must store data as relations such that each column is


independently identified by its column name and ordering of
rows is immaterial.
 The operations available to the user, as well as those used by
the system itself, should be true relational operations.
 The system must support at least one type of join operation.

CHARACTRISTICS OF A RELATIONAL DBMS MODEL

 All parent-child relationships are eliminated and data is instead


represented as simple row/column tables of data values.
 A relation is similar to a table with rows/columns of data values.
 The rows of table are referred to as tuples and columns are
called as attributes.
 Several tuples placed one below the other creates the table.

[Type text] Page 74


FOOD WORLD 2008

 Each table is an independent entity and there is no physical


relation between them.
 There is a built in support for query languages.
 Relational model of data management is based on the set theory
and the query languages are so designed to enable them to
manipulate set of data i.e., one o more tuples.
 The user interface is non-procedural, as only what needs to be
done is given not how it is to be done.
 A relational database is data-driven, not design driven.
 It is designed once, and the data changes over the time without
affecting the applications.
 The data is self-describing. For example, the phone number type
is identified as phone_number_type.
 Data is stored in one place , read from one place, and modified
in one place, data is stored once, so maintaining consistency
among all applications is easier.
 Rules that control how the data will be stored are defined and
enforced.

E.R.(Entity Relationship) model:-

In E.R. Diagram the emphasis is on representing the


schemas rather than the instances. This is more useful because a
database schema changes rarely, whereas the extension changes
frequently. In addition the schema usually easier to display than the
extension of database because it is smaller.

[Type text] Page 75


FOOD WORLD 2008

The basic object that the E.R. model represents is an entity,


which is a thing in the real world with an independent existence. Each
entity has attributes, which are the particular properties that describe
it. A particular entity will have a value for each of attribute. An
attribute could be simple, composite, singled valued, multi valued,
stored or derived. An entity type usually has attribute whose values
are distinct for each individual entity in the collection. Such an
attribute is known as key attribute. Entities that have key attribute of
their own are known as strong entities. Entities that do not have the
key attributes of their own are known as weak entities.

Whenever an attribute of entity refers to another entity


type, some relationship exists. The degree of a relationship is the
number of participating entity types. A relationship of degree two is
called binary and of degree three is called Terenary. Relationships
usually have certain constraints that limit the possible combinations of
the entities that may participate in the corresponding relationship set.
The cardinality ratio for a binary relationship specifies the number of
relationship instances that an entity can participate in. The possible
cardinalities for binary relationship are 1 : 1 , 1 : N, N : 1, M:N. The
participation constraint specifies whether the existence of an entity
depends on its being related to another entity via the relationship
type. There are two types of participation constraints namely, total
and partial.

[Type text] Page 76


FOOD WORLD 2008

The symbols used for the various parts of E.R. diagram are as Follows:

SYMBOL MEANING

ENTITY

WEAK ENTITY

RELATION
SHIP

IDENTIFYING
RELATIONSHIP

[Type text] Page 77


FOOD WORLD 2008

ATTRIBUTE

MULTIVALUED
ATTRIBUTE

KEY ATTRIBUTE

COMPOSITE ATTRIBUTE

Relationship constraints:
Domain constraints specify that the value of each attribute A
must be an atomic value from the domain(A).
The key constraints specify that all elements of a set are
distinct. Hence all tuples in a relation should also be distinct. This
means that no two tuples in a relation must have the same

[Type text] Page 78


FOOD WORLD 2008

combination of values for all their attributes. The primary key of the
relation is underlined.
Entity integrity constraint stakes no primary key value can
be null. Referential integrity constraint is specified between two
relations. It is used to maintain the consistency among the tuples of
two relations. Informally, the referential integrity constraint states that
a tuple in one relation that refers to another relation must refer to an
existing tuple in that relation.

NEED FOR COMPUTERISATION

1.Time Factor:
In manual system if the user has to search for a particular record it
would take a lot of time. Where as in a computerized system the
search period is reduced by the use of indexed files.

2.Accuracy:
If the user is mentally not conscious he might go wrong and may enter
few wrong entries, which will affect the final result. This
problem occurs most of the times in manual system. In
computerized system these problems are removed with
programs validating the entered data & also by alerting the user
whenever he makes mistakes. So the user need not worry, his
job is only to key in the data.

3.Repeatability:
In manual system if the user wants to take many copies of
ledger each time he has to type to type it , which requires a lot of time

[Type text] Page 79


FOOD WORLD 2008

and manpower. In a computer system we don’t come across such


problems. In fact a program developed for that purpose can be used
any number of times with the same accuracy and time factor , with
less effort, if maintained properly.

4.Efficiency:
If the number of entries increases searching of a particular
record in a manual system becomes a tedious job. Whereas in a
computer the record can be located in relatively short period based on
a key filed. Manpower required in manual system is high where as
manpower in a computer required is considerably less.

INTRODUCTION TO MYSQL

The MySQL (R) software delivers a very fast, multi-threaded,


multi-user, and robust SQL (Structured Query Language) database
server. MySQL Server is intended for mission-critical, heavy-load

[Type text] Page 80


FOOD WORLD 2008

production systems as well as for embedding into mass-deployed


software. MySQL is a trademark of MySQL AB.

Overview of the MySQL Database Management System

MySQL, the most popular Open Source SQL database management


system, is developed, distributed, and supported by MySQL AB. MySQL
AB is a commercial company, founded by the MySQL developers, that
builds its business by providing services around the MySQL database
management system.
The MySQL web site (http://www.mysql.com/) provides the latest
information about MySQL software and MySQL AB.
MySQL is a database management system.
A database is a structured collection of data. It may be
anything from a simple shopping list to a picture gallery or the vast
amounts of information in a corporate network. To add, access, and
process data stored in a computer database, you need a database
management system such as MySQL Server. Since computers are very
good at handling large amounts of data, database management
systems play a central role in computing, as stand-alone utilities or as
parts of other applications.
MySQL is a relational database management system.
A relational database stores data in separate tables
rather than putting all the data in one big storeroom. This adds speed
and flexibility. The SQL part of ``MySQL'' stands for ``Structured
Query Language''. SQL is the most common standardized language
used to access databases and is defined by the ANSI/ISO SQL
Standard.(The SQL standard has been evolving since 1986 and several
versions exist. In this manual, ``SQL-92'' refers to the standard

[Type text] Page 81


FOOD WORLD 2008

released in 1992, ``SQL-99'' refers to the standard released in 1999,


and ``SQL:2003'' refers to the version of the standard that is
expected to be released in mid-2003.We use the term ``the SQL
standard'' to mean the current version of the SQL Standard at any
time.)
MySQL software is Open Source.
Open Source means that it is possible for anyone to use and
modify the software. Anybody can download the MySQL software from
the Internet and use it without paying anything. If you wish, you may
study the source code and change it to suit your needs.
Why use the MySQL Database Server?
The MySQL Database Server is very fast, reliable, and
easy to use. If that is what you are looking for, you should give it a
try. MySQL Server also has a practical set of features developed in
close cooperation with our users. MySQL Server was originally
developed to handle large databases much faster than existing
solutions and has been successfully used in highly demanding
production environments for several years.
Though under constant development, MySQL Server today offers a rich
and useful set of functions. Its connectivity, speed, and security make
MySQL Server highly suited for accessing databases on the Internet.
The technical features of MySQL Server
. The MySQL Database Software is a client/server system that
consists of a multi-threaded SQL server that supports different
backends, several different client programs and libraries,
administrative tools, and a wide range of application programming
interfaces (APIs).
History of MySQL

[Type text] Page 82


FOOD WORLD 2008

We started out with the intention of using mSQL to connect


to our tables using our own fast low-level (ISAM) routines. However,
after some testing, we came to the conclusion that mSQL was not fast
enough nor flexible enough for our needs. This resulted in a new SQL
interface to our database but with almost the same API interface as
mSQL. This API was chosen to allow third-party code that was written
for use with mSQL to be ported easily for use with MySQL.
The derivation of the name MySQL is not clear. Our base
directory and a large number of our libraries and tools have had the
prefix ``my'' for well over 10 years. However, co-founder Monty
Widenius's daughter is also named My. Which of the two gave its name
to MySQL is still a mystery, even for us.
The name of the MySQL Dolphin (our logo) is Sakila.
Sakila was chosen by the founders of MySQL AB from a huge list of
names suggested by users in our "Name the Dolphin" contest. The
winning name was submitted by Ambrose Twebaze, an open source
software developer from Swaziland, Africa. According to Ambrose, the
name Sakila has its roots in SiSwati, the local language of Swaziland.
Sakila is also the name of a town in Arusha, Tanzania, near Ambrose's
country of origin, Uganda.

The Main Features of MySQL


The following list describes some of the important
characteristics of the MySQL Database Software.
Internals and Portability
• Written in C and C++.
• Tested with a broad range of different compilers.
• Works on many different platforms..
• Uses GNU Automake, Autoconf, and Libtool for portability.

[Type text] Page 83


FOOD WORLD 2008

• APIs for C, C++, Eiffel, Java, Perl, PHP, Python, Ruby, and Tcl
are available.
• Fully multi-threaded using kernel threads. This means it can
easily use multiple CPUs if they are available.
• Provides transactional and non-transactional storage engines.
• Uses very fast B-tree disk tables (MyISAM) with index
compression.
• Relatively easy to add another storage engine. This is useful if
you want to add an SQL interface to an in-house database.
• A very fast thread-based memory allocation system.
• Very fast joins using an optimized one-sweep multi-join.
• In-memory hash tables which are used as temporary tables.
• SQL functions are implemented through a highly optimized class
library and should be as fast as possible. Usually there isn't any
memory allocation at all after query initialization.
• The MySQL code is tested with Purify (a commercial memory
leakage detector) as well as with Valgrind..
• Available as client/server or embedded (linked) version.
• Many column types: signed/unsigned integers 1, 2, 3, 4, and 8
bytes long, FLOAT, DOUBLE, CHAR, VARCHAR, TEXT, BLOB,
DATE, TIME, DATETIME, TIMESTAMP, YEAR, SET, and ENUM
types.
• Fixed-length and variable-length records.

Commands and Functions


• Full operator and function support in the SELECT and WHERE
clauses of queries. For example:
• mysql> SELECT CONCAT(first_name, " ", last_name)

[Type text] Page 84


FOOD WORLD 2008

• -> FROM tbl_name


• -> WHERE income/dependents > 10000 AND age > 30;
• Full support for SQL GROUP BY and ORDER BY clauses. Support
for group functions (COUNT(), COUNT(DISTINCT ...), AVG(),
STD(), SUM(), MAX(), MIN(), and GROUP_CONCAT()).
• Support for LEFT OUTER JOIN and RIGHT OUTER JOIN with both
standard SQL and ODBC syntax.
• Support for aliases on tables and columns as required by SQL-
92.
• DELETE, INSERT, REPLACE, and UPDATE return the number of
rows that were changed (affected). It is possible to return the
number of rows matched instead by setting a flag when
connecting to the server.
• The MySQL-specific SHOW command can be used to retrieve
information about databases, tables, and indexes. The EXPLAIN
command can be used to determine how the optimizer resolves
a query.
• Function names do not clash with table or column names. For
example, ABS is a valid column name..
• You can mix tables from different databases in the same query
Security
• A privilege and password system that is very flexible and secure,
and allows host-based verification. Passwords are secure
because all password traffic is encrypted when you connect to a
server.
Scalability and Limits
• Handles large databases. We use MySQL Server with databases
that contain 50 million records. We also know of users that use

[Type text] Page 85


FOOD WORLD 2008

MySQL Server with 60,000 tables and about 5,000,000,000


rows.
• Up to 32 indexes per table are allowed. Each index may consist
of 1 to 16 columns or parts of columns. The maximum index
width is 500 bytes (this may be changed when compiling MySQL
Server). An index may use a prefix of a CHAR or VARCHAR
column.
Connectivity
• Clients may connect to the MySQL server using TCP/IP sockets
on any platform. On Windows systems in the NT family (NT,
2000, or XP), clients may connect using named pipes. On Unix
systems, clients may connect using Unix domain socket files.
• The Connector/ODBC interface provides MySQL support for client
programs that use ODBC (Open-DataBase-Connectivity)
connections. For example, you can use MS Access to connect to
your MySQL server. Clients may be run on Windows or Unix.
Connector/ODBC source is available. All ODBC 2.5 functions are
supported, as are many others.
Localisation
• The server can provide error messages to clients in many
languages. Full support for several different character sets,
including ISO-8859-1 (Latin1), german, big5, ujis, and more. For
example, the Scandinavian characters `@^a', `@"a' and `@"o'
are allowed in table and column names.
• All data is saved in the chosen character set. All comparisons for
normal string columns are case-insensitive.
• Sorting is done according to the chosen character set (the
Swedish way by default). It is possible to change this when the
MySQL server is started. To see an example of very advanced

[Type text] Page 86


FOOD WORLD 2008

sorting, look at the Czech sorting code. MySQL Server supports


many different character sets that can be specified at compile
and runtime.
Clients and Tools
• The MySQL server has built-in support for SQL statements to
check, optimize, and repair tables. These statements are
available from the command line through the mysqlcheck client.
MySQL also includes myisamchk, a very fast command-line
utility for performing these operations on MyISAM tables. All
MySQL programs can be invoked with the --help or -? options to
obtain online assistance.
Stability of MySQL
This section addresses the questions ``How stable is MySQL Server?''
and ``Can I depend on MySQL Server in this project?'' We will try to
clarify these issues and answer some important questions that concern
many potential users. The information in this section is based on data
gathered from the mailing list, which is very active in identifying
problems as well as reporting types of use.
The original code stems back from the early 1980s, providing a stable
code base, and the ISAM table format remains backward-compatible.
At TcX, the predecessor of MySQL AB, MySQL code has worked in
projects since mid-1996, without any problems. When the MySQL
Database Software was released to a wider public, our new users
quickly found some pieces of ``untested code''. Each new release
since then has had fewer portability problems (even though each new
release has also had many new features).
Each release of the MySQL Server has been usable. Problems have
occurred only when users try code from the ``gray zones.'' Naturally,
new users don't know what the gray zones are; this section therefore

[Type text] Page 87


FOOD WORLD 2008

attempts to document those areas that are currently known. The


descriptions mostly deal with Version 3.23 and 4.0 of MySQL Server.
All known and reported bugs are fixed in the latest version, with the
exception of those listed in the bugs section, which are design-related.
The MySQL Server design is multi-layered with independent modules.
Some of the newer modules are listed here with an indication of how
well-tested each of them is:

MyODBC 3.51 (uses ODBC SDK 3.51) -- Stable


In wide production use. Some issues brought up appear to be
application-related and independent of the ODBC driver or underlying
database server.

Introduction to Visual Basic

[Type text] Page 88


FOOD WORLD 2008

Visual Basic is an object-oriented programming language. VB


applications are composed of objects such as command-buttons, text
boxes, pictures, and databases. The heart of Visual Basic is its objects.
Visual basic objects consist of properties, methods and events
that act on that data.
properties - i.e. data
methods - i.e., procedures that act on the data
events - i.e., user activity that triggers the procedures

Elements of Visual Basic IDE:


The VB IDE consists of the following elements.
 Menu Bar
 Context Menus
 Toolbars
 Toolbox
 Project Explorer Window
 Properties Window
 Object Browser
 Form Designer
 Code Editor Window
 Form Layout Window
 Immediate, Locals and Watch Windows.

Menu Bar:
Menu Bar displays the commands you use to work with Visual Basic
and is located at the top. Besides the standard File, Edit, View,
Windows and Help menus, menus are provided to accessfunctions
specific to programming such as Project, Format or Debug.

[Type text] Page 89


FOOD WORLD 2008

Context Menus:
Context Menus provide certain short cuts to frequently performed
actions. To open a context menu, click the right mouse button on the
object you are using. The specific list of shortcuts available from
context menus depends on the part of the environment where you
click the right mouse button. For example, the context menu
displayed when you right click on the Toolbox lets you display the
components dialog box, hide the Toolbox, dock or undock the Toolbox,
or add a custom tab to the Toolbox etc.

Toolbars:
Toolbars provide quick access to commonly used commands in the
programming environment and is located below the menu bar. You
click a button on the toolbar once to carry out the action represented
by that button. By default, the Standard toolbar is displayed when
you start VB. Additional toolbars, for editing, form design, and
debugging can be toggled on or off from the Toolbars command on the
View Menu. Toolbars can be docked beneath the menu bar or can
“float” if you select the vertical bar on the left edge and drag it away
from the menu bar.

Toolbox:
Toolbox provides a set of controls that you use at design time to
place them on the form and is located on the left side. In addition to
the default controls layout, you can create your own custom layouts
by selecting Add Tab from the context menu and adding controls to
the resulting tab.

[Type text] Page 90


FOOD WORLD 2008

Project Explorer Window:


The Project Window lists the forms, and modules in your current
project. To recapitulate, a project is simply a collection of files you
use to build your application.

Properties Window:
Properties Window displays the different properties of the
different objects, such as size, caption, color etc., which can be set at
the design time and located at the right side.

Object Browser:
The Object browser lists the available objects in your project,
and gives you a way to navigate through your code. You can use the
Object browser to explore objects in VB , see what methods and
properties are available for those objects, and paste code procedures
into your application.

Form Designer:
The Form serves as the designer window or the container for
placing the different controls, graphics and pictures needed for your
applications and is located at the center. There can be more than one
form or a designer window for a single application.

Code Editor Window:


Every form has its own code editor window, where you write the
codes for manipulating the objects in the designer window.

[Type text] Page 91


FOOD WORLD 2008

Form Layout Window:


The Form Layout Window allows you to position the forms in
your application using a small graphical representation of the screen.

Immediate Window:
The Immediate Window is provided for debugging purposes and
is located below the form window. You can use it in the calculator
mode to immediately compute big expressions.

Visual Basic provides a great deal of flexibility, allowing you to


configure the working environment to best suit your individual style.
You can choose between a single or multiple document interface, and
you can adjust the size and positioning of the various Integrated
Development Environment (IDE) elements. Your layout will persist
between sessions of Visual Basic.

Kinds of Objects
Objects can be used to form the interface, store data, and share
functionality across applications.
 Controls
 Database
 ActiveX

Custom Controls
Custom controls are provided to get input from the user in
familiar ways. Controls are text boxes, list boxes, command buttons
and more. These are provided in Visual Basic Studio via the toolbox to
build your application.Custom Controls are interface objects that the

[Type text] Page 92


FOOD WORLD 2008

user interacts with to drive the application. Each custom control has its
own properties, methods and event handlers.
Custom Control properties are variable settings that effect the
state of the control. Properties range from setting its appearance to
changing its data. Properties can be changed both at design-time and
run-time.

Instantiating the Control


Controls that appear on the Toolbox are classes. Objects are
not defined until the control is actually drawn onto the form. You can
find the class name and object name in the properties window.Objects
on the form are ready for use

Working with Objects


Objects in Visual Basic have properties, methods, and events.
Object properties allow changes to its settings and appearance. Object
methods perform tasks. Object events are user actions like mouse-
clicks and key presses. Events allow you to write code to handle
actions on the object.

Object Properties
Setting object properties varies with each property.Properties
can be set:
At Design-Time
At Run-time

[Type text] Page 93


FOOD WORLD 2008

Setting a custom control at design-time can be done through the


Visual Basic Studio environment.
Use the mouse to drag the control to the form.
Select the control
Highlight the desired property field in the Properties window.
Change the value

Object Methods
Objects in Visual Basic may have methods (another name for
procedures) that perform tasks that may affect the values in its
properties. There may be tasks that need to be performed on the
object in order to access its properties.
Telephones have a "dial" method Phone.Dial 080-6721983 passes the
"dial" method the phone number then performs the dialing task Use
the following syntax when calling an object method:
object.method

List Box
The list box is a more sophisticated version of the text box.
Instead of just supporting one string entry, it can hold multiple string
entries. The list box is similar to an array because it uses an index to
keep track of each entry in the list.

Object Events
Each object in Visual Basic may have events and event-
handlers.An event is an internal flag that represents an action that has
occurred. When the user clicks on a command button or types in a text
box, an event flag is raised (namely, a "Button Click" for the command
button and a "Change" for the text box). When an event flag is raised,

[Type text] Page 94


FOOD WORLD 2008

Visual Basic notifies the object for which it was raised. It then calls the
corresponding procedure (known as an event-handler in VB) to
execute the code.

Creating Objects
You can create objects in Visual Basic by drawing the control on
the form. OR Creating objects in code become useful when you are
using a programs Object Model.

Object Model
The object model is a hierarchy of objects that contain the
methods, properties, and events that control the application.
Creating an object is different then creating a variable of a
known type. Before you can use the properties, methods, and events
of an object model, you must first create a programmatic reference to
the class containing the properties, methods, or events you wish to
use.You do this by declaring a local object variable to hold a reference
to the object. You then assign a reference to the object to the local
variable.

[Type text] Page 95


FOOD WORLD 2008

Introduction to SQL

SQL,Sructured Query Language is a powerful tool that enables


the creation, updation and maintenence of Databases is a SQL allows
users to access data in relational database management systems, such
as Oracle, Sybase,Informix, Microsoft SQL Server, Access, and others,
by allowing users to describe the data the user wishes to see. SQL also
allows users to define the data in a database, and manipulate that
data. This page will describehow to use SQL, and give examples. The
SQL used in this document is "ANSI", or standard SQL, and no
SQLfeatures of specific database management systems will be
discussed until the "Nonstandard SQL" section. It is recommended that
you print this page, so that you can easily refer back to previous
examples.

Basics Of SQL:
 Basics of the SELECT Statement
 Conditional Selection
 Relational Operators
 Compound Conditions
 IN & BETWEEN
 Using LIKE
 Joins
 Aliases & In/Subqueries
 Aggregate Functions
 Views

[Type text] Page 96


FOOD WORLD 2008

 Creating New Tables


 Altering Tables
 Adding Data
 Deleting Data
 Updating Data
 Indexes

[Type text] Page 97


FOOD WORLD 2008

RESULT
SCREEN SHOTS OF FORMS

[Type text] Page 98


FOOD WORLD 2008

[Type text] Page 99


FOOD WORLD 2008

[Type text] Page 100


FOOD WORLD 2008

FUTURE ENHANCEMENTS

This software for Supermarket incorporates the basic


functionalities of a supermarket Management system. The Scope of
the future enhancement lies in the following fields.

Features that can still be added to our project are:

 Images in the of the customers.


 Providing online access to customers
 Recovery information of customers, vendors and billing.
 Bank Transactions of the supermarket and its Maintenance
modules.

[Type text] Page 101


FOOD WORLD 2008

CONCLUSION

The role of supermarket is becoming more important now a days


because of the busy schedule of the customers, it is not possible for
them to go from shop to shop purchasing and bargaining the products.
It is necessary to provide the availability of all products in the same
compound. It is necessary to provide a database management system
which will take care of it.
We learnt a lot of information regarding the functionality of the
supermarket.We have tried to simulate all the possible activities to the
best of our knowledge.We hope that this software will provide a user
friendly interface to the management of a supermarket.

[Type text] Page 102


FOOD WORLD 2008

BIBLIOGRAPHY

1. Ivan Bayross – Commercial Application Development


using Oracle and Developer 2000 by BPB Publications

2. Learn visual basic in 21 days-Sams series.

3. Ramez A. Elmasri & Shamkant Navathe - Fundamentals


of Database Systems third edition by Addison Wesley

4. Nandagopalan. S. - Database Management Systems VTU


Text Book by Sapna Publications

[Type text] Page 103

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