Book Shop Management System
January 27, 2017 | Author: Dr Mohan Savade | Category: N/A
Short Description
Download Book Shop Management System...
Description
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
Book Shop Management System.
References
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.
Book Shop Management System.
About Visual Basic 6.0 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
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
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
Book Shop Management System.
a complex application may use many form activated by various 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
Book Shop Management System.
attached to the event some controls or forms. Some of the procedures 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”
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
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.
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.
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.
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
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.
Book Shop Management System.
Data Flow Diagram
Customer Detail
New Customer Purchase Order Sales
Book Shop Manage ment System
Book Shop Management System.
Class details Order Details Bills
Database design
Book Shop Management System.
Form Design Main Form:
Sales invoice
Book Shop Management System.
Purchase order form
Subject form Book Shop Management System.
Product
Book Shop Management System.
Customer Details:
Book Shop Management System.
Source Code Book Shop Management System.
Login Form: Dim rs As New ADODB.Recordset Public LoginSucceeded As Boolean Dim 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
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 If End Sub Main Form: Dim MyForm As FRMSIZE Dim DesignX As Integer Dim DesignY As Integer Private Sub backup_Click() frmBackUp.Show 1 End 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
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 UpdateInfoMsg End Sub
Purchase Order Form: Dim MyForm As FRMSIZE Dim DesignX As Integer Dim DesignY As Integer Private Sub cmbPID_Click() Dim rsProdName As Recordset Set rsProdName = New ADODB.Recordset
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 Sub Else txtPName = rsProdName(1) txtunits = rsProdName(7) txtRPU = rsProdName(6) End If rsProdName.Close End Sub Private Sub cmbSID_Click() Dim rsSupplierName As Recordset Set rsSupplierName = New ADODB.Recordset rsSupplierName.Open "Select * from Suppliers where SupplierID = " & cmbSID & "", Con, adOpenDynamic, adLockReadOnly If rsSupplierName.RecordCount > 1 Then MsgBox " Database Error" Exit Sub Else txtSName = rsSupplierName(1) txtSCName = rsSupplierName(2) End If rsSupplierName.Close End Sub Private 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
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 i End If If txtAmount = "" Or txtNet = "" Or txtunits = "" Or txtRPU = "" Then MsgBox "Please Enter the relevant Fields" Exit Sub End If If Val(txtUPurchased) = 0 Then MsgBox "Quantity Cannot be Zero", vbCritical Exit Sub End If 'Remove quantity rsProdName.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 adAffectCurrent rsProdName.Close Dim row As Integer row = MFG.Rows - 1 With MFG .Rows = .Rows + 1 MFG.TextMatrix(row, MFG.TextMatrix(row, MFG.TextMatrix(row, MFG.TextMatrix(row, MFG.TextMatrix(row, MFG.TextMatrix(row, MFG.TextMatrix(row, .FixedRows = 1
1) 2) 3) 4) 5) 6) 7)
= = = = = = =
txtBillID cmbPID txtPName txtUPurchased txtRPU txtdis txtNet
Book Shop Management System.
.RowHeight(0) = .RowHeight(1) * 1.5 SizeColumns MFG, Me MFGVALUES row = row + 1 End With Call CalcFinal Call TextClear End Sub Public Sub CalcFinal() On Error Resume Next Dim amount As Double Dim Discount As Double Dim Total As Double Dim i As Integer If 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 i End If txtgrndtot = amount txtdisgvn = Discount txtpayable = Total Debug.Print Val(amount) - Val(Discount) End Sub Public Sub TextClear() txtunits = "" txtUPurchased = "" txtdis = "0" txtAmount = "" txtNet = "" cmbPID_Click End Sub Private Sub cmdClose_Click() Unload Me End Sub
Book Shop Management System.
Private Sub cmdDelete_Click() Dim selectedRow As Integer Dim rsProdName As New ADODB.Recordset Dim tot As Long selectedRow = MFG.row Dim i As Integer 'Add quatity back If 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 i End If If selectedRow = MFG.Rows - 1 Then MsgBox "Invalid Selection.", vbCritical Exit Sub End If If Not MFG.TextMatrix(1, 1) = "" Then MFG.RemoveItem (selectedRow) Call CalcFinal End If End 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
Book Shop Management System.
flag1 = False flag2 = 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 Recordset Set rsMed = New ADODB.Recordset Dim MID As Long Dim RQuantity As Integer Dim rsAddPatient As Recordset Set rsAddPatient = New ADODB.Recordset Dim rsStock As Recordset Set rsStock = New ADODB.Recordset Dim 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
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.Close Next rsMed.Close If flag = True And flag2 = True And flag1 = True Then MsgBox "Record Saved Succesfully !!", vbInformation, "Record Added" cmdSave.Enabled = False Else MsgBox "An Error Occured while saving to the database", vbCritical Exit Sub End If Command1.Enabled = True cmdSave.Enabled = False End Sub Private Sub cmdVProducts_Click() FrmVProducts.Show End Sub Private Sub cndew_Click()
Book Shop Management System.
Dim ctl As Control For Each ctl In Controls If TypeOf ctl Is TextBox Then ctl.Text = "" End If Next cmbSID.Enabled = True cmdSave.Enabled = True MFG.Clear MFG.Refresh MFG.Rows = 2 Call SetData Call BillID Call ProdDetails Call MFGVALUES End Sub Private Sub Command1_Click() 'On Error Resume Next Dim strReport As String Dim 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.Text PInvoice.WindowState = crptMaximized PInvoice.Action = 1 ' End Sub Private Sub Form_Load() If CN.State = adStateClosed Then Main 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
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 Call Call Call
SetData BillID ProdDetails MFGVALUES
End Sub Public Sub SetData() Dim mbDataChanged As Boolean Dim rsSuppliers As Recordset Set rsSuppliers = New ADODB.Recordset mbDataChanged = False rsSuppliers.Open "select * from Suppliers", Con, adOpenDynamic, adLockOptimistic rsSuppliers.MoveFirst cmbSID.Clear While rsSuppliers.EOF = False cmbSID.AddItem rsSuppliers(0) rsSuppliers.MoveNext Wend rsSuppliers.Close End Sub
Product Form:
Dim MyForm As FRMSIZE Dim DesignX As Integer Dim DesignY As Integer Dim WithEvents adoPrimaryRS As Recordset Dim mbChangedByCode As Boolean Book Shop Management System.
Dim Dim Dim Dim
mvBookMark As Variant mbEditFlag As Boolean mbAddNewFlag As Boolean 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 = 33 And KeyAscii
View more...
Comments