50
Book Shop Management Index Preface About Visual Basic Current System Proposed System Data Flow Diagram Database Design Form Design Source Code Hardware and Software Requirement

Book Shop Management System

Embed Size (px)

Citation preview

Page 1: Book Shop Management System

Book Shop Management System.

Index

Preface

About Visual Basic

Current System

Proposed System

Data Flow Diagram

Database Design

Form Design

Source Code

Hardware and Software Requirement

Future Scope and Limitation

References

Page 2: Book Shop Management System

Book Shop Management System.

Preface

Computer is fast emerging as a daily need in walks of life.

The knowledge of computers and programming language has become

basic skill need to service in today’s information based society. Every

business institution and the corporate section, make a use of computer

for making their operation efficient & effective.

Book distributors transaction handling is one of the complex

process and it required computerized system to maintain overall

transactions in a easier manner. Due to heavy demand of books in

these competitive worlds, data increase so much. Books shop required

up to date information about the customer who purchased books or

about the suppliers from where books are purchased. The books shop

requires large amount of data to record and to store, which are

collected from the Book House.

About Visual Basic 6.0

Page 3: Book Shop Management System

Book Shop Management System.

Visual Basic 6.0 is Microsoft latest and greatest version of

the Visual Basic programming language. Although writing programs

can be a tedious chore at times Visual Basic educes the efforts

required on your part and marks programming enjoyable About Visual

Basic 6.0 Visual Basic marks many aspects of programming as simple

as dragging graphic object onto the screen with your mouse.

Even driven programming

Traditionally programming is essentially linear and is based on

the flow of The execution. Operation runs for fixed span or until they

reached a decision Point. At the decision point the programming

branches depending on the point to the program or the status of

various variable of the program. This operation continues till the

program is completed. Once the program execution starts it is

impossible to interrupt the activity. The programmer is responsible for

the structure looks and the flow of program. If the programmer wants a

good user interface, be has to explicitly write the long and complex

code for the user interface of the program.

In the conventional method the programs are usually

written in a top Down manner. This may be done either using the

structure programming Approach i.e. by breaking up the program in to

small sections of independent Procedures or function or using a

modular approach i.e. by creating a program From a set of more or

less self contained function and procedures. Theoretically, This makes

a possible to reuse the modules to be used in other programs. In

Practice, there are generally a very few routines that can be reused

without major Reworking. On this data is declared globally, any

function or procedure can Access the data, which might put it at the

Page 4: Book Shop Management System

Book Shop Management System.

mercy pf any function or procedure. The likelihood of incorrect data

manipulation is high. If data is declared locally only the procedure in

which the data is safer, it is very restricted.

In object oriented programming, a method (the function or

procedure of an object) Know what data if can manipulate them. There

is no confusion about who control whom. Declaring object and

enclosing method and their data in a Class achieve this. General

procedures the kind use in structured programming cannot access

data with an object without using the object methods which are

Designed too manipulate their data.

In procedural program, the order of procedure and control

statement determines the program, flow of control. This implies that

the programmer knows the entire flow of the program while he

developed it. In program designed to capture the essence of the

dynamic world, this assumption is unrealistic and cumbersome.

Object oriented programming captures these logical

relationship in object Determines the flow of control in objects clarify

the communication along the Component of an application. Object

responds to the other objects. Massages move through the system, not

data. Instead of invoking a Function on some data like in conventional

programming method, a message is sent to object. This is the principle

of operation in windows, Visual Basic is Object oriented, i.e. revolves

around ready made objects, and it is event driven, All the activity in

program are triggered by one event or another. Each object also Has

it’s own event handling procedures. The Visual Basic system knows all

about this already.

It knows what button is and how it work. It also knows how to

handle Menus dialogue boxes, drive and directory list and much else.

The programmer’s job is to determine where, how and when an object

appears on the screen what it is to do. What is caption reads what

Page 5: Book Shop Management System

Book Shop Management System.

colors it would He end what happens, when an event occurs. The

events are trapped by the Execute, when the event occurs.

Because the program code run through event and as such at

any point a Whole range of event might be possible, the program flow

is not as fixed as in a Conventional program. Operations do not have to

follow a set if sequence, and Can be easily interrupted, suspended or

abandoned. The processes of program Design reflex the nature of the

system. One begins by creating the screen layout, And work out words

from here , adding first the code that will run in response to Specific

events and then any necessary code to co-ordinate the whole program.

This approach of programming is called event driven programming.

Programming terminology

The terminology that is used in Visual Basic programming are:

Forms

Controls

Module

Project

Procedures

Properties

Methods

Events

Forms The form is the basic object used in Visual Basic application

development. It is a window, initially black on which controls are

placed to create the screen display. The forms size, colors type are

programmable. Code can be attached to the form, which would be

executed when the form is loaded, closed or when the mouse is clicked

or moved on the form. A simple application may use only one form but

a complex application may use many form activated by various

Page 6: Book Shop Management System

Book Shop Management System.

controls pasted on the form. Each of the form on the application is

saved in the disk as separate file with an extension “Form”

.

Controls

These are objects which can be pasted on to a form and these

Controls range from simple labels, which are used to display text on

the screen on Form, or picture boxes for buttons, check boxes, list and

other menus, To file management utilities and spreadsheet style grids.

Their properties, And event they can handle, very to suit their nature.

Each control can have coed Attached to it, though not all will have. A

text label or graphic image, for ex. May be There simply to improve the

display, and not as the start point for any activities.

Module

Code that is attached to form is accessible form anywhere on

that Form, but a program more than one form. In such a case a code

attached to a form. In such case a code attached to a form is not

available to the other forms. In this case, the code that is required to

be made available to the other forms is written in a separate module.

Modules are code segments, which are not written inside the

scope of any form. They have global scope. These cannot be made

visible during run time. It is like any other program code. There may be

several modules in one program and each is saved as separate file.

These files have an extension of “BAS”, because these are BASICcode

modules.

Procedure

All the code in the visual basic program is written in the

forms of procedure, or subroutines. Most of these procedures will be

attached to the event some controls or forms. Some of the procedures

Page 7: Book Shop Management System

Book Shop Management System.

would be separately written inside the modules as global functions. All

the procedures start with keyword Sub and close with the keyword End

Sub.

Project

The project is a file in which all the form files(*.frm files) and

the modules(*.bas files) that make up the entire application, is kept .

These have an extension of “* .Mac”. they are called make file thus

any application wil have a “* . vbp”file.

Properties

Each control has a set of predefined properties, method and

events that it will respond to. Properties are simply characteristics of

an object or control. They are used to store data describes some

particular attribute of the object such as color, size or the picture

present in a control. The one property that every object must have is

the Name property. This is use to refer to the object must be unique in

a project. Visual Basic assign default name to control when you add

them to your form, but you can alter these at design time(and you

should alter them at design time)to make your code more descriptive.

Note that you can’t change a control’s Name property at run time, and

these won’t appear in the properties window .

Properties can be set at design time using the properties window or

they can be set and reference within your Visual Basic code. Properties

are reference in the form of object name. property and in some respect

you can think of them like a variable. You can assign a value to a

property just as you assign a value to a variable. here we assign the

text string “john smith” to text property of the object called Text1:

Text1.text=” john smith”

Page 8: Book Shop Management System

Book Shop Management System.

Just as with variable, properties can also be used as part of other

statement:

Print your name is: Text1.text

Methods

Methods are action that can be performing on an

object. These are like procedures. They are written in code in the form

object name. method parameters for e. forms have a move method

that moves them to the procedure specified by the parameter. In this

case, the top left of the form would be move screen coordinates

(370,915) as

Form1.move 30,915

When you referred to the property or method of an

object that resides in a form other than one form which you are

refereeing it , you will need to give it a fully qualified reference. These

means preceding name of the object with the name of the form like

this:

FormName.ObjectName.property

This sort of reference to an object can be extended in the

case of OLE application to include the name of the project before the

name of the form. If you don’t supply a fully qualified reference, Visual

Basic assumes that you are referring to the project and form in which

you are making the reference.

Events

Events are the key to Visual Basic programming each object in

the Visual Basic can be respond to a predefined set of events. These

would be movement of the mouse, the pressing of the key on the

keyboard or the lapsing the particular period of time. You can see

which events a control can respond to by adding controls to your form

Page 9: Book Shop Management System

Book Shop Management System.

and double clicking it to bring up the code window. The procedure

dropdown list box in the top right corner of the code window contains a

list of all the events that a control can respond to. If you select one of

the item in the list box, the first and last lines of a procedure are added

to your code. This proce4dure will be triggered whenever that

particular event occurs, so any code that you add to the procedure will

be executed at the same time. This is how you create Visual Basic code

to respond to user interaction and other events.

Page 10: Book Shop Management System

Book Shop Management System.

Current system

The book shop contains different types of books of

various subjects with various quality according to the customers needs

and requirement. The main thing of the book shop is to maintain lot of

records for the daily transaction of the business. It is necessary for

every business to maintain all records, which show the profit and loss

of the business.

In today’s life people have very little time and many

things to do. They have to manage all this unbalance workload,

although every one wants to achieve all their ambitions and dreams.

And the present system of managing Books is very time consuming so

it is very difficult to maintain good records and fast service. The paper

work is becoming very difficult to handle day by day.

Currently we have to keep track of each and every thing about

the book shop on the paper or in register. We have to maintain lot of

registers to enter these large volumes of data. This leads to the

wastage of stationary.

Some disadvantages are:

Manual system involves a lot of paper work, so it becomes time

consuming and costly.

Page 11: Book Shop Management System

Book Shop Management System.

The chances of errors in calculation of delivery of Books are more

in the current manual system. The calculation of total collection

for day or month or year is very difficult.

Currently no security is provided to the large amount of data of

the every book details.

It becomes very difficult to maintain details of every Book as

records increases day by day.

Page 12: Book Shop Management System

Book Shop Management System.

Proposed system

While creating new software we should analyze what is

the basic need of the software. Analysis is nothing but a planning of

creation of software to get proper output from it. Analysis is details

study of projects that you want to show in your software solving

problems.

The basic need of the software is to save the time of the

user with the help of all useful information. And also to maintain the

collection of data in your computer systematically, so that its easy to

understand.

The proposed system provides lot of facility to the user to

store information of the Books and it provides information in quick time

in a systematic manner. The processing time on the data is very fast. It

provides required data quickly to the user and also in specified manner

to the user. All the information of Books changes is given to the user

and also the reports are also generated according to the requirement

of the user.

Today it is becoming very difficult to maintain record manually. This

software system easily does the job of maintaining daily records as

well as the transaction according to the user requirements.

Some advantages are:

User – friendly software

Page 13: Book Shop Management System

Book Shop Management System.

Easy to record all data about the Books and its details.

It saves time of the user as well as prevent paper work

It provides the security to the database that is large amount of

important data of the hospital.

It provides more reliability for keeping information.

Page 14: Book Shop Management System

Book Shop Management System.

Data Flow Diagram

New Customer

Purchase

Customer Detail

Book Shop

Management

System

Order

Sales

Class details

Order Details

Bills

Page 15: Book Shop Management System

Book Shop Management System.

Database design

Page 16: Book Shop Management System

Book Shop Management System.

Form Design

Main Form:

Sales invoice

Page 17: Book Shop Management System

Book Shop Management System.

Purchase order form

Subject form

Page 18: Book Shop Management System

Book Shop Management System.

Product

Page 19: Book Shop Management System

Book Shop Management System.

Customer Details:

Page 20: Book Shop Management System

Book Shop Management System.

Source Code

Page 21: Book Shop Management System

Book Shop Management System.

Login Form:Dim rs As New ADODB.RecordsetPublic LoginSucceeded As BooleanDim Counter As Integer

Private Sub cmdCancel_Click() 'set the global var to false 'to denote a failed login LoginSucceeded = False Unload Me End Sub

Private Sub cmdOK_Click()On Error Resume Next

If txtPasswd.Text = "" Then MsgBox "Enter A Password:", vbCritical txtPasswd.SetFocus Exit Sub End If 'rs.Close 'After the user_id are loaded into dbUserId close the 'Recordset for further usage rs.Open "Select User_Password from users where User_Name= '" & dcUser.Text & "'", Con, adOpenDynamic, adLockOptimistic If rs.EOF <> True Then 'If Search is found If rs(0) = txtPasswd Then DoEvents 'Check If user is Admin 'Checking : To allow Settings Menu Available only to Admin Unload Me frmMain.Show DoEvents ' Srchflag = True Exit Sub rs.Close Else

Page 22: Book Shop Management System

Book Shop Management System.

MsgBox "Invalid Password!!!" & vbCrLf & "Note : Password is same as Username", vbInformation, "Enjoy Freeware" txtPasswd.Text = "" txtPasswd.SetFocus rs.Close Exit Sub End If End If 'If Srchflag = False Then 'Display msg when search not found ' MsgBox "Invalid Password" & vbCrLf & "No Access!!!", vbCritical, "Invalid User" ' End 'End IfEnd Sub

Main Form:Dim MyForm As FRMSIZEDim DesignX As IntegerDim DesignY As Integer

Private Sub backup_Click()frmBackUp.Show 1End Sub

Private Sub CoolGreen_Click()Call select_color_type(3)sys_color = "3"End Sub

Private Sub Default_Click()Call select_color_type(0)sys_color = "0"End Sub

Private Sub LightBrown_Click()Call select_color_type(5)sys_color = "5"End Sub

Private Sub LightViolet_Click()Call select_color_type(4)sys_color = "4"End Sub

Page 23: Book Shop Management System

Book Shop Management System.

Private Sub MacGrey_Click()Call select_color_type(1)sys_color = "1"End Sub

Private Sub MDIForm_Load()

Dim ScaleFactorX As Single, ScaleFactorY As Single ' Scaling factors ' Size of Form in Pixels at design resolution DesignX = 800 DesignY = 600 RePosForm = True ' Flag for positioning Form DoResize = False ' Flag for Resize Event ' Set up the screen values Xtwips = Screen.TwipsPerPixelX Ytwips = Screen.TwipsPerPixelY Ypixels = Screen.Height / Ytwips ' Y Pixel Resolution Xpixels = Screen.Width / Xtwips ' X Pixel Resolution

' Determine scaling factors ScaleFactorX = (Xpixels / DesignX) ScaleFactorY = (Ypixels / DesignY) Resize_For_Resolution ScaleFactorX, ScaleFactorY, Me MyForm.Height = Me.Height ' Remember the current size MyForm.Width = Me.Width frmContainer.Show 'Display the business status UpdateInfoMsgEnd Sub

Purchase Order Form:Dim MyForm As FRMSIZEDim DesignX As IntegerDim DesignY As Integer

Private Sub cmbPID_Click()

Dim rsProdName As RecordsetSet rsProdName = New ADODB.Recordset

Page 24: Book Shop Management System

Book Shop Management System.

rsProdName.Open "Select * from Books where Book_ID = " & cmbPID & "", Con, adOpenDynamic, adLockReadOnly

If rsProdName.RecordCount > 1 Then MsgBox " Database Error" Exit SubElse txtPName = rsProdName(1) txtunits = rsProdName(7) txtRPU = rsProdName(6)End If

rsProdName.Close

End Sub

Private Sub cmbSID_Click()

Dim rsSupplierName As RecordsetSet rsSupplierName = New ADODB.Recordset

rsSupplierName.Open "Select * from Suppliers where SupplierID = " & cmbSID & "", Con, adOpenDynamic, adLockReadOnly

If rsSupplierName.RecordCount > 1 Then MsgBox " Database Error" Exit SubElse txtSName = rsSupplierName(1) txtSCName = rsSupplierName(2)

End IfrsSupplierName.Close

End SubPrivate Sub cmdAddList_Click()'On Error Resume Next Dim rsMed As Recordset Dim i As Integer Dim rsProdName As New ADODB.Recordset Dim tot As Long

Page 25: Book Shop Management System

Book Shop Management System.

If MFG.Rows > 2 Then For i = 1 To MFG.Rows - 2 Step 1 If MFG.TextMatrix(i, 2) = cmbPID Then MsgBox "Medicine Already Exist In The List Cannot Add Same Medicine Again.....", vbCritical + vbOKOnly Exit Sub End If Next iEnd If

If txtAmount = "" Or txtNet = "" Or txtunits = "" Or txtRPU = "" Then MsgBox "Please Enter the relevant Fields" Exit SubEnd IfIf Val(txtUPurchased) = 0 Then MsgBox "Quantity Cannot be Zero", vbCritical Exit SubEnd If

'Remove quantityrsProdName.Open "Select * from Books where Book_ID = " & cmbPID & "", Con, adOpenStatic, adLockOptimistic

tot = Val(txtunits.Text) - Val(txtUPurchased.Text)rsProdName(7) = tot

txtunits.Text = rsProdName(7)

rsProdName.UpdateBatch adAffectCurrentrsProdName.Close

Dim row As Integerrow = MFG.Rows - 1With MFG

.Rows = .Rows + 1

MFG.TextMatrix(row, 1) = txtBillID MFG.TextMatrix(row, 2) = cmbPID MFG.TextMatrix(row, 3) = txtPName MFG.TextMatrix(row, 4) = txtUPurchased MFG.TextMatrix(row, 5) = txtRPU MFG.TextMatrix(row, 6) = txtdis MFG.TextMatrix(row, 7) = txtNet .FixedRows = 1

Page 26: Book Shop Management System

Book Shop Management System.

.RowHeight(0) = .RowHeight(1) * 1.5 SizeColumns MFG, Me MFGVALUES

row = row + 1

End WithCall CalcFinalCall TextClearEnd SubPublic Sub CalcFinal()On Error Resume NextDim amount As DoubleDim Discount As DoubleDim Total As DoubleDim i As IntegerIf MFG.Rows > 2 Then For i = 1 To MFG.Rows - 2 Step 1 amount = amount + (Val(MFG.TextMatrix(i, 5)) * Val(MFG.TextMatrix(i, 4))) Discount = Discount + MFG.TextMatrix(i, 6) Total = Total + MFG.TextMatrix(i, 7)

Next iEnd Iftxtgrndtot = amounttxtdisgvn = Discounttxtpayable = TotalDebug.Print Val(amount) - Val(Discount)

End Sub

Public Sub TextClear()txtunits = ""txtUPurchased = ""txtdis = "0"txtAmount = ""txtNet = ""

cmbPID_ClickEnd Sub

Private Sub cmdClose_Click()Unload MeEnd Sub

Page 27: Book Shop Management System

Book Shop Management System.

Private Sub cmdDelete_Click()Dim selectedRow As IntegerDim rsProdName As New ADODB.RecordsetDim tot As LongselectedRow = MFG.rowDim i As Integer'Add quatity backIf MFG.Rows > 2 Then For i = 1 To MFG.Rows - 2 Step 1 rsProdName.Open "Select * from Books where Book_ID = " & Val(MFG.TextMatrix(i, 2)) & "", Con, adOpenStatic, adLockOptimistic

tot = Val(rsProdName(7)) + Val(MFG.TextMatrix(i, 4))

rsProdName(7) = tot

'txtunits.Text = rsProdName(7)

rsProdName.UpdateBatch adAffectCurrent rsProdName.Close Next iEnd If

If selectedRow = MFG.Rows - 1 Then MsgBox "Invalid Selection.", vbCritical Exit SubEnd If

If Not MFG.TextMatrix(1, 1) = "" Then MFG.RemoveItem (selectedRow) Call CalcFinalEnd IfEnd Sub

Private Sub cmdsave_click()

If MFG.Rows = 2 Then MsgBox "Please Add Items to list before you save", vbCritical, "Error Occured" Exit Sub End If

Dim flag, flag1, flag2 As Boolean

flag = False

Page 28: Book Shop Management System

Book Shop Management System.

flag1 = Falseflag2 = False

Dim rsOrderID As Recordset Dim OID As String Set rsOrderID = New ADODB.Recordset

rsOrderID.Open " Select * from Purchase_Orders", Con, adOpenDynamic, adLockPessimistic

rsOrderID.AddNew rsOrderID(0) = txtBillID rsOrderID(1) = cmbSID rsOrderID(2) = DTPDate

rsOrderID.Update flag = True

rsOrderID.Close

Dim rsMed As RecordsetSet rsMed = New ADODB.RecordsetDim MID As LongDim RQuantity As Integer

Dim rsAddPatient As RecordsetSet rsAddPatient = New ADODB.RecordsetDim rsStock As RecordsetSet rsStock = New ADODB.RecordsetDim i As Integer

rsMed.Open "SELECT * FROM Purchase_Orde_Details", Con, adOpenDynamic, adLockPessimistic

For i = 1 To MFG.Rows - 2 Step 1

' Generating Purchase Order Details ID 'MID = Functions.UID(6, "PODRDTL_") rsAddPatient.Open " Select * from Purchase_Orde_Details", Con, adOpenDynamic, adLockReadOnly If rsAddPatient.EOF = False Then While rsAddPatient.EOF = False

Page 29: Book Shop Management System

Book Shop Management System.

MID = rsAddPatient(0) + 1 rsAddPatient.MoveNext Wend End If rsAddPatient.Close

With rsMed .AddNew !PurchaseOrderDetailID = MID !PurchaseOrderID = txtBillID !PurchaseProductID = MFG.TextMatrix(i, 2) !PurchaseQUANTITY = Val(MFG.TextMatrix(i, 4)) !PurchaseUnitPrice = Val(MFG.TextMatrix(i, 5)) !PurchaseDiscount = Val(MFG.TextMatrix(i, 6)) !NetValue = txtpayable .Update flag1 = True End With

rsStock.Open "select * from books where Book_ID= " & MFG.TextMatrix(i, 2) & "", Con, adOpenDynamic, adLockPessimistic If rsStock.EOF = False Then rsStock(4) = rsStock(4) + Val(MFG.TextMatrix(i, 4)) rsStock.Update flag2 = True End If rsStock.CloseNextrsMed.CloseIf flag = True And flag2 = True And flag1 = True Then MsgBox "Record Saved Succesfully !!", vbInformation, "Record Added" cmdSave.Enabled = FalseElse MsgBox "An Error Occured while saving to the database", vbCritical Exit SubEnd If

Command1.Enabled = TruecmdSave.Enabled = FalseEnd SubPrivate Sub cmdVProducts_Click()FrmVProducts.ShowEnd Sub

Private Sub cndew_Click()

Page 30: Book Shop Management System

Book Shop Management System.

Dim ctl As Control

For Each ctl In Controls If TypeOf ctl Is TextBox Then ctl.Text = "" End IfNextcmbSID.Enabled = TruecmdSave.Enabled = TrueMFG.ClearMFG.RefreshMFG.Rows = 2

Call SetDataCall BillIDCall ProdDetailsCall MFGVALUESEnd SubPrivate Sub Command1_Click()'On Error Resume NextDim strReport As StringDim strTXT As Integer

strTXT = Val(txtBillID.Text)PInvoice.DataFiles(0) = App.Path & "\BookStore.mdb"'strReport = App.Path & "\invoice.rpt"PInvoice.ReportFileName = App.Path & "\Purchase.rpt"PInvoice.SelectionFormula = "{qryPurchases.PurchaseOrderID} = " & txtBillID.TextPInvoice.WindowState = crptMaximizedPInvoice.Action = 1

'End Sub

Private Sub Form_Load()If CN.State = adStateClosed Then MainDim ScaleFactorX As Single, ScaleFactorY As Single ' Scaling factors ' Size of Form in Pixels at design resolution DesignX = 800 DesignY = 600 RePosForm = True ' Flag for positioning Form DoResize = False ' Flag for Resize Event ' Set up the screen values Xtwips = Screen.TwipsPerPixelX Ytwips = Screen.TwipsPerPixelY

Page 31: Book Shop Management System

Book Shop Management System.

Ypixels = Screen.Height / Ytwips ' Y Pixel Resolution Xpixels = Screen.Width / Xtwips ' X Pixel Resolution

' Determine scaling factors ScaleFactorX = (Xpixels / DesignX) ScaleFactorY = (Ypixels / DesignY) ScaleMode = 1 ' twips 'Exit Sub ' uncomment to see how Form1 looks without resizing Resize_For_Resolution ScaleFactorX, ScaleFactorY, Me MyForm.Height = Me.Height ' Remember the current size MyForm.Width = Me.Width

Call SetDataCall BillIDCall ProdDetailsCall MFGVALUES

End Sub

Public Sub SetData()Dim mbDataChanged As BooleanDim rsSuppliers As RecordsetSet rsSuppliers = New ADODB.Recordset

mbDataChanged = False rsSuppliers.Open "select * from Suppliers", Con, adOpenDynamic, adLockOptimisticrsSuppliers.MoveFirstcmbSID.ClearWhile rsSuppliers.EOF = FalsecmbSID.AddItem rsSuppliers(0)rsSuppliers.MoveNextWendrsSuppliers.CloseEnd SubProduct Form:Dim MyForm As FRMSIZEDim DesignX As IntegerDim DesignY As Integer

Dim WithEvents adoPrimaryRS As RecordsetDim mbChangedByCode As Boolean

Page 32: Book Shop Management System

Book Shop Management System.

Dim mvBookMark As VariantDim mbEditFlag As BooleanDim mbAddNewFlag As BooleanDim mbDataChanged As Boolean

Private Sub cmbCID_KeyPress(KeyAscii As Integer)Dim llngRet As Long Dim lstrFind As String Dim objcb As New Class1 If KeyAscii >= 33 And KeyAscii <= 126 Then If cmbCID.SelLength = 0 Then lstrFind = cmbCID.Text & VBA.Chr(KeyAscii) Else lstrFind = Left(cmbCID.Text, cmbCID.SelStart) & VBA.Chr(KeyAscii) End If llngRet = objcb.WinCBFindString(cmbCID.hwnd, lstrFind, False) If llngRet <> -1 Then cmbCID.ListIndex = llngRet cmbCID.SelStart = Len(lstrFind) cmbCID.SelLength = Len(cmbCID.Text) - cmbCID.SelStart KeyAscii = 0 End IfEnd IfEnd Sub

Private Sub cmbSID_KeyPress(KeyAscii As Integer)Dim llngRet As Long Dim lstrFind As String Dim objcb As New Class1 If KeyAscii >= 33 And KeyAscii <= 126 Then If cmbSID.SelLength = 0 Then lstrFind = cmbSID.Text & VBA.Chr(KeyAscii) Else lstrFind = Left(cmbSID.Text, cmbSID.SelStart) & VBA.Chr(KeyAscii) End If llngRet = objcb.WinCBFindString(cmbSID.hwnd, lstrFind, False) If llngRet <> -1 Then cmbSID.ListIndex = llngRet cmbSID.SelStart = Len(lstrFind) cmbSID.SelLength = Len(cmbSID.Text) - cmbSID.SelStart KeyAscii = 0 End IfEnd IfEnd Sub

Page 33: Book Shop Management System

Book Shop Management System.

Private Sub cmbSID_LostFocus()Dim rs As New ADODB.Recordset Dim rs1 As New ADODB.Recordset Dim SID As Long Dim Sup As String rs.Open "select * from Suppliers where CompanyName = '" & cmbSID.Text & "'", Con, adOpenKeyset, adLockPessimistic rs1.Open "select SupplierId from Suppliers", Con, adOpenKeyset, adLockPessimistic While rs1.EOF = False SID = rs1(0) + 1 rs1.MoveNext Wend rs1.Close Sup = cmbSID.Text 'While Not rs.EOF If rs.EOF = False Then Exit Sub Else rs.AddNew rs.Fields(0) = SID rs.Fields(1) = Sup rs.Update rs.Close cmbSID.Clear Dim rs2 As New ADODB.Recordset rs2.Open "select CompanyName from Suppliers", Con, adOpenDynamic, adLockOptimistic rs2.MoveFirst While rs2.EOF = False cmbSID.AddItem rs2(0) rs2.MoveNext

Page 34: Book Shop Management System

Book Shop Management System.

Wend rs2.Close End If 'Wend cmbSID.Text = SupEnd Sub

Private Sub cmdViewAll_Click()FrmVProducts.ShowEnd Sub

Private Sub cmbCID_LostFocus() 'dim rsSearch as New ADODB.Recordset Dim rs As New ADODB.Recordset Dim rs1 As New ADODB.Recordset Dim CID As Long Dim Cat As String rs.Open "select * from categories where categoryname = '" & cmbCID.Text & "'", Con, adOpenKeyset, adLockPessimistic rs1.Open "select categoryID from categories", Con, adOpenKeyset, adLockPessimistic While rs1.EOF = False CID = rs1(0) + 1 rs1.MoveNext Wend rs1.Close Cat = cmbCID.Text 'While Not rs.EOF If rs.EOF = False Then Exit Sub Else rs.AddNew rs.Fields(0) = CID rs.Fields(1) = Cat rs.Update rs.Close

Page 35: Book Shop Management System

Book Shop Management System.

cmbCID.Clear Dim rs2 As New ADODB.Recordset rs2.Open "select CategoryName from Categories", Con, adOpenDynamic, adLockOptimistic rs2.MoveFirst While rs2.EOF = False cmbCID.AddItem rs2(0) rs2.MoveNext Wend rs2.Close End If 'Wend cmbCID.Text = CatEnd Sub

Private Sub Combo1_Click()

If txtFields(3).Text = "" Then MsgBox "Please enter money" Exit Sub End If Dim rs2 As New ADODB.Recordset Dim i As Long rs2.Open "select cur_value from MoneyChanger where currency_name = '" & Combo1.Text & "' ", Con, adOpenDynamic, adLockPessimistic i = Val(txtFields(3).Text) * rs2(0) txtFields(8).Text = i rs2.CloseEnd Sub

Private Sub Form_Load()If CN.State = adStateClosed Then MainDim ScaleFactorX As Single, ScaleFactorY As Single ' Scaling factors

Page 36: Book Shop Management System

Book Shop Management System.

' Size of Form in Pixels at design resolution DesignX = 800 DesignY = 600 RePosForm = True ' Flag for positioning Form DoResize = False ' Flag for Resize Event ' Set up the screen values Xtwips = Screen.TwipsPerPixelX Ytwips = Screen.TwipsPerPixelY Ypixels = Screen.Height / Ytwips ' Y Pixel Resolution Xpixels = Screen.Width / Xtwips ' X Pixel Resolution

' Determine scaling factors ScaleFactorX = (Xpixels / DesignX) ScaleFactorY = (Ypixels / DesignY) ScaleMode = 1 ' twips 'Exit Sub ' uncomment to see how Form1 looks without resizing Resize_For_Resolution ScaleFactorX, ScaleFactorY, Me MyForm.Height = Me.Height ' Remember the current size MyForm.Width = Me.Width

Dim rsCategories As RecordsetDim rsSuppliers As Recordset

Set rsCategories = New ADODB.RecordsetSet rsSuppliers = New ADODB.Recordset

Set adoPrimaryRS = New Recordset adoPrimaryRS.Open "select * from Books", Con, adOpenStatic, adLockOptimistic

Dim oText As TextBox 'Bind the text boxes to the data provider For Each oText In Me.txtFields On Error Resume Next Set oText.DataSource = adoPrimaryRS oText.Enabled = True oText.Locked = True Next

mbDataChanged = False rsSuppliers.Open "select * from Suppliers", Con, adOpenDynamic, adLockOptimisticIf rsSuppliers.EOF = False Then

rsSuppliers.MoveFirst

Page 37: Book Shop Management System

Book Shop Management System.

While rsSuppliers.EOF = FalsecmbSID.AddItem rsSuppliers(1)rsSuppliers.MoveNextWend

End If

rsCategories.Open "select * from Categories", Con, adOpenDynamic, adLockOptimisticDebug.Print rsCategories.RecordCountDebug.Print rsSuppliers.RecordCount

'If rsCategories.EOF = False Then rsCategories.MoveFirst

While rsCategories.EOF = False

cmbCID.AddItem rsCategories(1) rsCategories.MoveNext Wend

'End If

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If mbEditFlag Or mbAddNewFlag Then Exit Sub

Select Case KeyCode Case vbKeyEscape cmdClose_Click Case vbKeyEnd cmdLast_Click Case vbKeyHome cmdFirst_Click Case vbKeyUp, vbKeyPageUp If Shift = vbCtrlMask Then cmdFirst_Click Else cmdPrevious_Click End If Case vbKeyDown, vbKeyPageDown If Shift = vbCtrlMask Then cmdLast_Click

Page 38: Book Shop Management System

Book Shop Management System.

Else cmdNext_Click End If End SelectEnd Sub

Reports

Sale report:

Page 39: Book Shop Management System

Book Shop Management System.

Hardware and Software Requirement

Hardware Requirement:

Here is the recommended hardware requirement for this software to run efficiently. 1) Pentium 166 MHz or higher processor

2) 32 MB RAM

3) 50 MB free hard disc space

4) SVGA monitors

5) Printer

Page 40: Book Shop Management System

Book Shop Management System.

Software Requirement:

This software comes under application software. So the necessary

software for this is

1) An operating system.

2) Window operating system family.

3) Window 9x,(that is window 95,98,ME,etc.)

4) Window NT, 2000, 2003.

Future Scope and Limitation

This software has demands in private and public area.

This software provides a great help in managing the data in a well-

mannered order. This project is designed specially to maintain the data

in a sequential manner and to save the tome and efforts of database

administrator. The project is structured according to today’s need.

Due to time constraint it is possible that some points

might remain uncovered by us. In future we will update our software to

give valuable information left at present.

Page 41: Book Shop Management System

Book Shop Management System.

References

1) Mastering Visual Basic 6.0 in 24 Days

2) Visual Basic 6.0 Bible

3) Peterson Blogwers

4) Divya Babulgaonkar

Page 42: Book Shop Management System

Book Shop Management System.