Professional Documents
Culture Documents
Technology Allahabad
A PROJECT REPORT
ON
COMPUTER SHOP MANAGEMENT
SYSTEM
PREFACE
ACKNOWLEDGEMENTS
First of all I would like to thank almighty God who gave me the
inspiration to take up this task.
I would like to thank Mr. Prabhat kardam (Lecturer) Ewing
Christian institute of management and technology, Allahabad, for his able
guidance and all the pains he took for the completion of my project.
Special thanks to Mr. Sharad Emmanual , Lab Administrator of ECIMT,
who helped us at every step in the project.
I would also like to thanks Mr.Anurag sewak (Head of department, MCA,
ECIMT, Allahabad), who gave precious suggestions at every step in the project.
I would also like to thank Dr. M. Massey, Director, Dr. L.C.T. Esubius, Deputy
Director and Dr. (Mrs.) Kusumlata Pandey, Academic Advisor of MCA (Master of
Computer Application).
I would also like to thank Mr.Anshul Cutting (Asst.
System Administrator) & Mr. Jayant Sheth , Librarian of my college without
whose cooperation, this project could not have been a success.
I express my gratefulness and appreciation to all my academic
colleagues who gave me valuable suggestions during the development of
this software.
Certificate
Date:
TableofContents
Table of Contents.4
Introduction5
Objective....6
Operating environment6
1) Harware requirement..6
2) Sowtware requirement6
Front end tool6
Back end tool.5
Platform used5
Purpose .5
Project Scope ...5
Product
Perspective5
Product Features .5
Process logic....................................................................................................................2
Logic diagram...7
Data flow diagram.8
ER diagram.....11
Data structure..12
Sreenshots .. 3
1) Login form.3
2) Main form..4
3) Sell computer part form.5
4)make quotation form..3
5) Update customer balance.4
6) Sell computer system form...5
7) Change password..5
8) Create user account..3
9) Add company form.4
10) Add new product form
.5
.5
Future Scope
Bibliography
Introduction
Computer-shop management System is a project which assist in keeping the
Record of what ever the sales from shop (whole seller), also it keep track of remaining
balance which due after selling the product. Through this project we maintain the
warranty given on particular products along with complete information related to that
product.
Computer-shop management System is software for store billing
management. Sell hardware systems components and accessories (keep track of sold
configurations, create system configuration, sell accessories and computer
components, supplying companys administration, and many more...). Computer-shop
management System is a windows based billing software designed for uses in computer
stores.
Objective
The objective of my project to provides management facility to
computer-shop. We have given many facilities for users in this project.
1) Welcome screen (Formsplash)
2) Login screen
3) Main form
4) Sell Computer System form
5) Sell Computer Parts form
6) Update customer Balance form
7) Product Price Report form
8) Change password form
9) Make quotation form
10) Add computer part form
11) Add computer system form
12) Create user account form
13) Update shop information form
14) Report of sold computer part
15) Report of sold computer system
OperatingEnvironment
1) Hardware Requirement
1) 20 GB HDD Free Space
2) 128 MB RAM
3) P IV or above Processor
4) Monitor
5) Keyboard: Standard
6) Mouse: Optional
2) Software Requirement
1) MS-office-2003
2) MS Visual Basic6.0
FrontEndTool:MSVisualBasic6.0
BackEndTool:MSAccess
PLATFORM USED: Windows XP, Windows 2000.
Purpose
It is the project about Computer-shop management System. It automates the
Systems records, their Selling and Maintenance, Balance evaluation, due to calculation
other functions. In other words you can say it a complete computer-shop management
System.
In this project we can easily maintain systems sales details. It gives
informations of Annual Transaction of products, its services, daily sales, daily Receipt &
Balance. We can see the Systems details before selling the particular items & view for
our requirement-satisfying item detail.
ProjectScope
The scope of project Computer-shop management system is to Develop
Visual Basic based software to support for daily sale, receipt & Balance of products and
maintain the all information of System related items.
This software will be very useful for the Big Computer Shop as well as the
customer. It will perform as the required task of Automation of product by itself in a
systematic way.
7
It will also save lots of time, as system will perform all tasks in quick time
profiting customer and shop owner as well, so it will prove very economical in every
respect.
Product Perspective
The Computer-shop Management System is the new, self-contained product.
The Computer-shop management system is using vb6.0 platform. All components follow
Model-View-Controller pattern. The user can retrieve information of their shop progress.
All pages of the system are following a consistent theme and clear structure.
The occurrence of errors should be minimized through the use of checkboxes and scroll
down in order to reduce the amount of text input from user. Error message should be
located beside the error input which clearly highlight and tell user how to solve it. If
system error, it should provide the contact methods. The page should display the project
process in different color to clearly reflect the various states. Each level of user will have
its own interface and privilege to mange and modify the project information.
User interface elements are easy to understand. Part of user interface is wellorganized on screen and the parts are concatenated right. When users look at the
interface, they understand which pane is used for which purpose. Each task of an
interface is specified clearly and users use them correctly. For example, when users
press to any button on interface, they can know which operations are done by pressing
this button.
The user interface is easy to learn. When users use the user interface, they
can know which element is used to which operations. The interface actions and
elements is consistent. When users press any button, required actions is done by the
system.
The screen layout and color of the user interface is appealing. When users
look at the screen, it will have a nice vision. Colors will be selected clearly, thus eyes of
users wont be tired.To inhance the graphical user interface I use xp button, lv button
and vk frame.
Since the application must run on the PC, all the hardware shall require to
connect the PC will be hardware interface for the system.The main interface would be
the monitor, Keyboard and mouse.
Product Features
NETWORK SUPPORT. You can use more than one computer to work with Computershop Maintenance System.
Support for VAT tax system. Also you can -
Process Logic
1. Login Form
In this form, existing user/administrator enters the user-name and password
and access the main form. If user forgets his password then he can click on button
forget password and then entering his e-mail id can get user name and password. This
form contains user name and password as sub module.
2. Main Form
If administrator accesses this form using authentic login-name and password
then the administrator has administrative power as add the product, create user
account, add new branded computer system, add company, change the shop record .
Administrator have full power But user have some restricted power only which is
provided by administrator.
In this main form user can sell computer part/assemble computer
system/branded computer system, update customer record, change the password,
make quotation. Using this form the user/administrator can see the report of sold
computer part, branded computer system in any time duration. In this form, there is
option to exit & log-off
3. Sell Computer System Module
There are two sub modules:
10
In this module, the administrator can add new product by entering its name,
company name, range, type, serial number, and its price. Here administrator can also
see the available product and its information. And the administrator can also delete any
product.
9. Add computer system Module
In this module, the administrator can add new branded computer system by
entering its category, model number, company name, ram capacity and its speed,
monitor type, Hard-disk capacity and its interface, processor clock speed and its
L2cach, motherboard company-name and its chipset, its selling and buying price and
other description. Here administrator can also see the available computer system and
its information. And the administrator can also delete any computer system.
10. Add company Module
In this module, the administrator can add any company information whose
product are available at the computer shop. This module contains the name of
company, contact person, address, phone number, website, and fax number.
11. Change Shop information Module
In this module, the administrator save/update the information related to his
computer-shop as name of computer-shop, address, phone-number, and registration
number.
12. Product Price Report:
This report shows the price of all available products and its detail as itemname, company-name, type, range, and serial-number.
11
LOGICAL DIAGRAM
START
LOGIN FORM
MAIN FORM
Sell computer
system
Change
password
Branded
computer system
Make
quotation
Change
password
Assemble
computer/Computer
part
Add
company
Administrator
Update customer
Balance
Price Report
Add
company
REPORT
Sold Computer
part report
Create user
account
Change shop
information
12
Sold computer
system report
Add Computer
part
Add computer
system
Computer-shop
Req.
Customer
Resp. Customer
management
System
sold computer
Sold
compute
r part
Login
Issue detail
Sold
Compute
r system
Login Detail
Rep. Detail
Update
Report
Login
Search criteria
Add
compute
r system
Add
compute
r part
system detail
Customer
Item
User/admin
Update History
Search
Search detail
13
Compter
system Detail
Customer detail
Compter
Part Detail
Customer
Computer Part Detail
Issue detail
Customer
User
Comp.part/system detail
Computer
part/system
Customer detail
Customer
14
User
Balance detail
Update
Balance
Verify balance detail
Balance History
Search Detail
User
Balance Detail
Search
15
Customer Detail
Customer
Item Detail
ER Diagram:-
Brand_name
system_name
configuratio
n
Warranty_period
Item_pric
e
Warranty_period
Item_type
user_addres
s
user_ph.n
o.
Computer
system_detail
Loginname&pas
sword
user_name
Brand_name
Item_pric
e
Item_nam
e
serial_no.
BALANCE
Serial.No.
Warranty.per
d
Balance
Date
16
C_name
n
Sell
computer
system/pa
rt
User
Computer
part_DETAIL
Paid
Amou
nt
Customer
Invoiceno
.
Invoice
no.
Paid_amoun
t
c_address
Tot.amount
c_ph.no.
c_Balance
c_name
DATA STRUCTURE
1. Balance Table
Key
Column Name
Primary key
Data Type
InvoiceNo.
Customername
Customer address
Customer phone no.
Paidamount
Totalamount
Date
Alphanumeric
Alphanumeric
Alphanumeric
Numeric
Numeric
Numeric
Date
Width
5
25
6
6
8
Data Type
Itemname
Brandname
Alphanumeric
Alphanumeric
17
Width
15
25
Type
Price
Serialno.
warranty
Primary key
Alphanumeric
Numeric
Alphanumeric
Numeric
5
6
5
1
3. Customer
key
Primary key
Column Name
Data Type
Customer_name
Customer_Address
Customer_Phone.no.
Customer_Balance
Width
Alphanumeric
Alphanumeric
Numeric
Numeric
25
30
10
8
Primary key
Column Name
Data Type
Systemname
Brandname
Categary
Price
Model no.
warranty
Ram
Mother-board
Monitor
Processor
Other description
Alphanumeric
Alphanumeric
Alphanumeric
Numeric
Alphanumeric
Numeric
Alphanumeric
Alphanumeric
Alphanumeric
Alphanumeric
Alphanumeric
Width
15
25
5
6
5
1
8
10
10
10
45
5.Troubleshoot
key
Primary key
Column Name
Data Type
Invoice no
Customer_name
Customer_Address
Customer_phoneno.
Problem
Service_date
Charge
Alphanumeric
Alphanumeric
Alphanumeric
Numeric
Alphanumeric
Date
Numeric
18
Width
5
25
30
10
25
8
10
6.Employee Table
Key
Column Name
Data Type
Primary key
Employee-id
Employee_name
Employee_address
Employee_phoneno
Alphanumeric
Alphanumeric
Alphanumeric
Numeric
Alphanumeric
Email_id
Width
12
15
45
10
20
7.Warranty
Key
Primary key
Column Name
Data Type
Invoice_no.
Serial_no.
Bill_no.
New_Serial no
Problem
Service_date
Delivery_date
Alphanumeric
Alphanumeric
Alphanumeric
Alphanumeric
Alphanumeric
Date
Date
SCREENSHOTS
Loginform
19
Width
8
20
10
15
25
8
8
Main form
20
Make quotation
21
22
24
25
Test case
If connection of database is not closed at unload of this form then this error occurred.so
needs to close connection of database as
Private Sub Form_Unload(Cancel As Integer)
con.Close
End Sub
In database setsold table has p2 field, this field have to allow zero lenth.
26
I the database there is field name login name have no value so this error occurred.
So insert login name and password.
This error occure when in database the data type is not matching. So need to give
correct data type.
27
There is not any item in the database in the requested field. So need to insert a item or
generate a message.
The insert into command have syntax error. So need to write correct syntax.
28
When execute the insert into statement, there is any extra parameter.
In database customeaddressfield not found because I have write wrong table name.
29
I dcrease the size of all text field and labels to correct this error
30
31
32
33
34
35
36
37
38
Login form
Private Sub Form_Load()
Call connectdatabase
rs.ActiveConnection = con
rs.CursorLocation = adUseClient
rs.CursorType = adOpenDynamic
rs.Source = "select *from usertable"
rs.Open
Frame1.Left = -8000
End Sub
Private Sub lvButtons_H1_Click()
a = MsgBox("Do you really want to quit?", vbYesNo, "Endnow")
If a = 6 Then
End
End If
End Sub
Private Sub lvButtons_H2_Click()
If Text1.Text = "" And Text2.Text = "" Then
MsgBox "Please enter the Login name & password!"
Exit Sub
End If
If Text2.Text = "" And Text1.Text <> "" Then
MsgBox "Enter Your Password"
Text2.SetFocus
Exit Sub
End If
If Text2.Text <> "" And Text1.Text = "" Then
MsgBox "Enter Your Username"
Exit Sub
End If
rs.MoveFirst
For i = 1 To rs.RecordCount
If rs.Fields(2) = Text1.Text And rs.Fields(3) = Text2.Text Then
If rs.Fields(6) = ("admin") Then
mainfrm.Show
Unload Me
con.Close
Exit Sub
End If
If rs.Fields(6) = ("employee") Then
mainfrm.Show
mainfrm.admin.Visible = False
39
Unload Me
con.Close
Exit Sub
End If
End If
rs.MoveNext
Next i
If rs.EOF = True Then
MsgBox "Invalid login name & password!"
Text2.Text = ""
Text2.SetFocus
End If
End Sub
Private Sub Text1_Change()
Text1.BackColor = &HC0FFC0
End Sub
Private Sub Text1_Click()
Text1.BackColor = &H80000009
Text2.BackColor = &HC0FFC0
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_Change()
Text2.BackColor = &HC0FFC0
End Sub
Private Sub Text2_Click()
Text2.BackColor = &H80000009
Text1.BackColor = &HC0FFC0
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call lvButtons_H2_Click
End If
End Sub
Private Sub Timer2_Timer()
Frame1.Left = Frame1.Left + 200
If Frame1.Left = 3000 Then
Timer2.Enabled = False
40
End If
End Sub
Main form
Private Sub about_Click()
aboutfrm.Show
End Sub
Private Sub asssembled_Click()
sellcomputer.Show
End Sub
Private Sub bronded_Click()
Sellbrondedcom.Show
End Sub
Private Sub brondedreport_Click()
reportcomputersys.Show
End Sub
Private Sub company_Click()
addcompany.Show
End Sub
Private Sub component_Click()
DataReport1.Show
End Sub
Private Sub computersystem_Click()
addcomputersystem.Show
End Sub
Private Sub customer_Click()
customeraccount.Show
End Sub
Private Sub emloyee_Click()
user.Show
End Sub
Private Sub Exit_Click()
b = MsgBox("Do you really want to quit?", vbYesNo, "Conformation")
If b = 6 Then
End
Else
41
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, Y
As Single)
Frame1.BackColor = &H404040
End Sub
Private Sub group_Click()
End Sub
Private Sub logo_Click()
shop.Show
End Sub
Private Sub logoff_Click()
loginform.Show
Unload Me
End Sub
Private Sub part_Click()
sellcomputerpart.Show
End Sub
Private Sub monthly_Click()
End Sub
Private Sub pass_Click()
changepasswd.Show
End Sub
Private Sub payment_Click()
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As
Single, Y As Single)
Frame1.BackColor = &H40&
End Sub
Private Sub product_Click()
addproduct.Show
End Sub
42
43
rs3.Open "select Range from itemdetail where Itemname='" & temp & "' and
Company='" & Comboram.Text & "' and Type='" & Combo19.Text & "'"
While rs3.EOF = False
Combo27.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Combo20_Click()
Combo28.Clear
temp = "Processor"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Range from itemdetail where Itemname='" & temp & "' and
Company='" & ComboProcessor.Text & "' and Type='" & Combo20.Text & "'"
While rs3.EOF = False
Combo28.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Combo21_Click()
Combo29.Clear
temp = "MotherBoard"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Range from itemdetail where Itemname='" & temp & "' and
Company='" & Combomotherboard.Text & "' and Type='" & Combo21.Text & "'"
While rs3.EOF = False
Combo29.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
44
45
Wend
End Sub
Private Sub Combo28_Click()
Combo39.Clear
temp = "Processor"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & ComboProcessor.Text & "' and Type='" & Combo20.Text & "' and
Range='" & Combo28.Text & "'"
While rs3.EOF = False
Combo39.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Combo29_Click()
Combo40.Clear
temp = "MotherBoard"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Combomotherboard.Text & "' and Type='" & Combo21.Text & "'
and Range='" & Combo29.Text & "'"
While rs3.EOF = False
Combo40.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Combo30_Click()
temp = "Speaker"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Combospeaker.Text & "' and Type='" & Combo23.Text & "' and
Range='" & Combo30.Text & "'"
While rs3.EOF = False
Combo46.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Combo31_Click()
temp = "Monitor"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Combomonitor.Text & "' and Type='" & Combo24.Text & "' and
Range='" & Combo31.Text & "'"
While rs3.EOF = False
Combo47.AddItem rs3(0)
rs3.MoveNext
46
Wend
End Sub
Private Sub Combo34_Click()
temp = "Printer"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Comboprinter.Text & "' and Type='" & Combo34.Text & "'"
While rs3.EOF = False
Combo51.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Combo35_Click()
Static i As Integer
Static hdprice As Double
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo35.Text & "'"
text4.Text = rs3(0)
If i = 0 Then
hdprice = Val(text4)
price = price + hdprice
Else
price = price - hdprice
hdprice = Val(text4)
price = price + hdprice
End If
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
End Sub
Private Sub Combo36_Click()
Static cdrprice As Double
Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo36.Text & "'"
Text5.Text = rs3(0)
If i = 0 Then
cdrprice = Val(Text5)
price = price + cdrprice
Else
price = price - cdrprice
cdrprice = Val(Text5)
47
48
49
If i = 0 Then
fdprice = Val(Text10)
price = price + fdprice
Else
price = price - fdprice
fdprice = Val(Text10)
price = price + fdprice
End If
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
End Sub
Private Sub Combo42_Click()
Static dvdrprice As Double
Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo42.Text & "'"
Text11.Text = rs3(0)
If i = 0 Then
dvdrprice = Val(Text11)
price = price + dvdrprice
Else
price = price - dvdrprice
dvdrprice = Val(Text11)
price = price + dvdrprice
End If
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
End Sub
Private Sub Combo43_Click()
Static dvdwprice As Double
Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo43.Text & "'"
Text12.Text = rs3(0)
If i = 0 Then
dvdwprice = Val(Text12)
price = price + dvdwprice
Else
price = price - dvdwprice
dvdwprice = Val(Text12)
price = price + dvdwprice
End If
50
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
End Sub
Private Sub Combo44_Click()
Static kbdprice As Double
Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo44.Text & "'"
Text13.Text = rs3(0)
If i = 0 Then
kbdprice = Val(Text13)
price = price + kbdprice
Else
price = price - kbdprice
kbdprice = Val(Text13)
price = price + kbdprice
End If
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
End Sub
Private Sub Combo45_Click()
Static msprice As Double
Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo45.Text & "'"
Text14.Text = rs3(0)
If i = 0 Then
msprice = Val(Text14)
price = price + msprice
Else
price = price - msprice
msprice = Val(Text14)
price = price + msprice
End If
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
51
End Sub
Private Sub Combo46_Click()
Static spkprice As Double
Static i As Integer
'temp = "Speaker"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo46.Text & "'"
Text15.Text = rs3(0)
If i = 0 Then
spkprice = Val(Text15)
price = price + spkprice
Else
price = price - spkprice
spkprice = Val(Text15)
price = price + spkprice
End If
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
End Sub
Private Sub Combo47_Click()
Static monprice As Double
Static i As Integer
'temp = "Monitor"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo47.Text & "'"
Text16.Text = rs3(0)
If i = 0 Then
monprice = Val(Text16)
price = price + monprice
Else
price = price - monprice
monprice = Val(Text16)
price = price + monprice
End If
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
End Sub
Private Sub Combo48_Click()
52
53
54
55
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Combocabinet.Text & "'"
While rs3.EOF = False
Combo53.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Combocdrom_Click()
Combo36.Clear
temp = "CD ROM"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Combocdrom.Text & "'"
While rs3.EOF = False
Combo36.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
56
57
58
59
Else
bool = True
End If
rs3.MoveNext
Wend
End Sub
Private Sub Combomotherboard_Click()
temp = "MotherBoard"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "'
and Company='" & Combomotherboard.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Combomotherboard.Text Then bool = True
For i = 0 To Combo21.ListCount
If Combo21.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combo21.AddItem rs3(1)
Else
bool = True
End If
rs3.MoveNext
Wend
End Sub
60
End Sub
Private Sub Comboprinter_Click()
temp = "Printer"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "'
and Company='" & Comboprinter.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Comboprinter.Text Then bool = True
For i = 0 To Combo34.ListCount
If Combo34.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combo34.AddItem rs3(1)
Else
bool = True
End If
rs3.MoveNext
Wend
End Sub
Private Sub ComboProcessor_Click()
temp = "Processor"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "'
and Company='" & ComboProcessor.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = ComboProcessor.Text Then bool = True
For i = 0 To Combo20.ListCount
If Combo20.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combo20.AddItem rs3(1)
Else
bool = True
End If
rs3.MoveNext
Wend
End Sub
Private Sub Comboram_Click()
temp = "RAM"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "'
and Company='" & Comboram.Text & "'"
While rs3.EOF = False
61
62
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Comboups.Text & "'"
While rs3.EOF = False
Combo48.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Form_Load()
Call connectdatabase
Call setsoldrecordset
Call itemdetail
Call customerrecordset
Reciept.Visible = False
text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
Text10.Enabled = False
Text11.Enabled = False
Text12.Enabled = False
Text13.Enabled = False
Text14.Enabled = False
Text15.Enabled = False
Text16.Enabled = False
Text17.Enabled = False
Text18.Enabled = False
Text19.Enabled = False
Text20.Enabled = False
Text21.Enabled = False
Text22.Enabled = False
Text23.Enabled = False
Text27.Enabled = False
Text25.Enabled = False
Text28.Enabled = False
Text26.Enabled = False
Label32.Visible = False
Text25.Visible = False
ibldate.Caption = Date
'If rs2.State = 1 Then rs2.Close
'rs2.Open "Select * from setsold", cs, adOpenKeyset, adLockOptimistic
invoice.Caption = "S" & (rs2.RecordCount + 1)
63
invoice.FontBold = True
Label38.Caption = "cust" & (rs2.RecordCount + 1)
price = 0
Dim bool As Boolean
While rs3.EOF = False
If rs3.Fields(0).Value = "Hard Disk" Then
bool = True
For i = 0 To Comboharddisk.ListCount
If Comboharddisk.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Comboharddisk.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "CD ROM" Then
bool = True
For i = 0 To Combocdrom.ListCount
If Combocdrom.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combocdrom.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "CD Writer" Then
bool = True
For i = 0 To Combocdwriter.ListCount
If Combocdwriter.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combocdwriter.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "RAM" Then
bool = True
For i = 0 To Comboram.ListCount
If Comboram.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Comboram.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "Processor" Then
64
bool = True
For i = 0 To ComboProcessor.ListCount
If ComboProcessor.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
ComboProcessor.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "MotherBoard" Then
bool = True
For i = 0 To Combomotherboard.ListCount
If Combomotherboard.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combomotherboard.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "Floppy Drive" Then
bool = True
For i = 0 To Combofloppy.ListCount
If Combofloppy.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combofloppy.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "Cabinet" Then
bool = True
For i = 0 To Combocabinet.ListCount
If Combocabinet.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combocabinet.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "DVD ROM" Then
bool = True
For i = 0 To Combodvdrom.ListCount
If Combodvdrom.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combodvdrom.AddItem rs3(1)
65
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "DVD Writer" Then
bool = True
For i = 0 To Combodvdwriter.ListCount
If Combodvdwriter.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combodvdwriter.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "Keyboad" Then
bool = True
For i = 0 To Combokeyboard.ListCount
If Combokeyboard.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combokeyboard.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "Mouse" Then
bool = True
For i = 0 To Combomouse.ListCount
If Combomouse.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combomouse.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "Speaker" Then
bool = True
For i = 0 To Combospeaker.ListCount
If Combospeaker.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combospeaker.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "Monitor" Then
bool = True
For i = 0 To Combomonitor.ListCount
66
67
End If
ElseIf rs3.Fields(0).Value = "Scanner" Then
bool = True
For i = 0 To Comboscanner.ListCount
If Comboscanner.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Comboscanner.AddItem rs3(1)
Else
bool = True
End If
End If
rs3.MoveNext
Wend
End Sub
Private Sub Form_Unload(cancel As Integer)
con.Close
End Sub
Private Sub lvButtons_H2_Click()
Unload Me
End Sub
Private Sub Reciept_Click()
On Error Resume Next:
sellcomputer.PrintForm
End Sub
Private Sub save_Click()
b = (MsgBox("are you sure you want to save?", vbYesNo, conformation))
If b <> 6 Then
Exit Sub
End If
If Combo35.Text = "" Then
End If
If Combo36.Text = "" Then
End If
If Combo37.Text = "" Then
End If
If Combo38.Text = "" Then
End If
If Combo39.Text = "" Then
End If
If Combo40.Text = "" Then
End If
If Combo41.Text = "" Then
68
End If
If Combo42.Text = "" Then
End If
If Combo43.Text = "" Then
End If
If Combo44.Text = "" Then
End If
If Combo45.Text = "" Then
End If
If Combo46.Text = "" Then
End If
If Combo47.Text = "" Then
End If
If Combo48.Text = "" Then
End If
If Combo49.Text = "" Then
End If
If Combo50.Text = "" Then
End If
If Combo51.Text = "" Then
End If
If Combo52.Text = "" Then
End If
If Combo53.Text = "" Then
End If
If vkTextBox1.Text = "" Then
MsgBox " Customer Name is Empty"
vkTextBox1.SetFocus
Exit Sub
ElseIf vkTextBox2.Text = "" Then
MsgBox " Customer Address is Empty"
vkTextBox2.SetFocus
Exit Sub
ElseIf vkTextBox3.Text = "" Then
MsgBox " Customer Pnone No is Empty"
vkTextBox3.SetFocus
Exit Sub
End If
If text4.Text = "" And Text5.Text = "" And Text6.Text = "" And Text7.Text = "" And
Text8.Text = "" _
And Text9.Text = "" And Text10.Text = "" And Text11.Text = "" And Text12.Text = ""
And Text13.Text = "" _
And Text14.Text = "" And Text15.Text = "" And Text16.Text = "" And Text17.Text =
"" And Text18.Text = "" _
69
And Text19.Text = "" And Text20.Text = "" And Text27.Text = "" And Text28.Text =
"" Then
MsgBox "Any product is not choosen by you. Please choose any product."
Exit Sub
End If
If Text24.Text = "" Then
MsgBox " Payment Amount is Empty", vbInformation
Text24.SetFocus
Exit Sub
ElseIf Not IsNumeric(Text24) Then
MsgBox " Payment Amount should be numaric", vbInformation
Text24.Text = ""
Text24.SetFocus
Exit Sub
Else
con.BeginTrans
con.Execute "Insert into setsold values('" & invoice.Caption & "','" &
ibldate.Caption & "','" & Combo35.Text & "','" & Combo36.Text & "','" &
Combo37.Text & "','" & Combo38.Text & "','" & Combo39.Text & "','" &
Combo40.Text & "','" & Combo41.Text & "','" & Combo42.Text & "','" &
Combo43.Text & "','" & Combo44.Text & "','" & Combo45.Text & "','" &
Combo46.Text & "','" & Combo47.Text & "','" & Combo48.Text & "','" &
Combo49.Text & "','" & Combo50.Text & "','" & Combo51.Text & "','" &
Combo52.Text & "','" & Combo53.Text & "'," & Text23.Text & ")"
con.CommitTrans
con.BeginTrans
con.Execute "Insert into Balance values('" & vkTextBox1.Text & "','" &
invoice.Caption & "'," & Text23.Text & "," & Text24.Text & ",'" & ibldate.Caption &
"','" & Text26.Text & "')"
con.CommitTrans
con.BeginTrans
con.Execute "Insert into customer values('" & vkTextBox1.Text & "','" &
vkTextBox2.Text & "','" & vkTextBox3.Text & "','" & Text26.Text & "','" &
invoice.Caption & "')"
con.CommitTrans
If Text26.Visible = True And Val(Text26.Text) > 0 Then
If rs4.State = 1 Then rs4.Close
rs4.Open "Select Customername from Customer where Customername='" &
vkTextBox1.Text & "'"
If rs4.EOF = False Then
con.BeginTrans
con.Execute " Update Customer set Balance= Balance + " & Text26.Text & "
where Customername='" & vkTextBox1.Text & "'"
con.CommitTrans
70
Else
con.BeginTrans
' cs.Execute "Insert into Customer values('" & Text1.Text & "','" & Text2.Text &
"','" & Text3.Text & "'," & Text26.Text & ")"
con.CommitTrans
End If
End If
If Combo35.Text <> "" Then
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select buyingprice,warenty from itemdetail where Serialno='" &
Combo35.Text & "'"
p1 = rs3(0)
w1 = rs3(1)
sql = "insert into
sold(invoice,selldate,customername,address,customerphone,itemname,company
,type,range,buyingprice,price,serialno,warenty) values('" & invoice.Caption & "','"
& ibldate.Caption & "','" & vkTextBox1.Text & "','" & vkTextBox2.Text & "','" &
vkTextBox3.Text & "','" & Label11.Caption & "','" & Comboharddisk.Text & "','" &
Comboharddisktype.Text & "','" & Comboharddiskrange.Text & "','" & p1 & "','" &
text4.Text & "','" & Combo35.Text & "','" & w1 & "')"
Call insertquery
End If
If Combo36.Text <> "" Then
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select buyingprice,warenty from itemdetail where Serialno='" &
Combo36.Text & "'"
p2 = rs3(0)
w2 = rs3(1)
sql = "insert into
sold(invoice,selldate,customername,address,customerphone,itemname,company
,buyingprice,price,serialno,warenty) values('" & invoice.Caption & "','" &
ibldate.Caption & "','" & vkTextBox1.Text & "','" & vkTextBox2.Text & "','" &
vkTextBox3.Text & "','" & Label12.Caption & "','" & Combocdrom.Text & "','" & p2
& "','" & Text5.Text & "','" & Combo36.Text & "','" & w2 & "')"
Call insertquery
End If
If Combo37.Text <> "" Then
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select buyingprice,warenty from itemdetail where Serialno='" &
Combo37.Text & "'"
p30 = rs3(0)
w30 = rs3(1)
71
72
w4 = rs3(1)
sql = "insert into
sold(invoice,selldate,customername,address,customerphone,itemname,company
,type,range,buyingprice,price,serialno,warenty) values('" & invoice.Caption & "','"
& ibldate.Caption & "','" & vkTextBox1.Text & "','" & vkTextBox2.Text & "','" &
vkTextBox3.Text & "','" & Label16.Caption & "','" & Combomotherboard.Text & "','"
& Combo21.Text & "','" & Combo29.Text & "','" & p4 & "','" & Text9.Text & "','" &
Combo40.Text & "','" & w4 & "')"
Call insertquery
End If
If Combo41.Text <> "" Then
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select buyingprice,warenty from itemdetail where Serialno='" &
Combo41.Text & "'"
p5 = rs3(0)
w5 = rs3(1)
sql = "insert into
sold(invoice,selldate,customername,address,customerphone,itemname,company
,buyingprice,price,serialno,warenty) values('" & invoice.Caption & "','" &
ibldate.Caption & "','" & vkTextBox1.Text & "','" & vkTextBox2.Text & "','" &
vkTextBox3.Text & "','" & Label17.Caption & "','" & Combofloppy.Text & "','" & p5 &
"','" & Text10.Text & "','" & Combo41.Text & "','" & w5 & "')"
Call insertquery
End If
If Combo42.Text <> "" Then
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select buyingprice,warenty from itemdetail where Serialno='" &
Combo42.Text & "'"
p6 = rs3(0)
w6 = rs3(1)
sql = "insert into
sold(invoice,selldate,customername,address,customerphone,itemname,company
,buyingprice,price,serialno,warenty) values('" & invoice.Caption & "','" &
ibldate.Caption & "','" & vkTextBox1.Text & "','" & vkTextBox2.Text & "','" &
vkTextBox3.Text & "','" & Label19.Caption & "','" & Combodvdrom.Text & "','" & p6
& "','" & Text11.Text & "','" & Combo42.Text & "','" & w6 & "')"
Call insertquery
End If
If Combo43.Text <> "" Then
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select buyingprice,warenty from itemdetail where Serialno='" &
Combo43.Text & "'"
p7 = rs3(0)
73
w7 = rs3(1)
sql = "insert into
sold(invoice,selldate,customername,address,customerphone,itemname,company
,buyingprice,price,serialno,warenty) values('" & invoice.Caption & "','" &
ibldate.Caption & "','" & vkTextBox1.Text & "','" & vkTextBox2.Text & "','" &
vkTextBox3.Text & "','" & Label20.Caption & "','" & Combodvdwriter.Text & "','" &
p7 & "','" & Text12.Text & "','" & Combo43.Text & "','" & w7 & "')"
Call insertquery
End If
If Combo44.Text <> "" Then
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select buyingprice,warenty from itemdetail where Serialno='" &
Combo44.Text & "'"
p8 = rs3(0)
w8 = rs3(1)
sql = "insert into
sold(invoice,selldate,customername,address,customerphone,itemname,company
,buyingprice,price,serialno,warenty) values('" & invoice.Caption & "','" &
ibldate.Caption & "','" & vkTextBox1.Text & "','" & vkTextBox2.Text & "','" &
vkTextBox3.Text & "','" & Label21.Caption & "','" & Combokeyboard.Text & "','" &
p8 & "','" & Text13.Text & "','" & Combo44.Text & "','" & w8 & "')"
Call insertquery
End If
If Combo45.Text <> "" Then
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select buyingprice,warenty from itemdetail where Serialno='" &
Combo45.Text & "'"
p9 = rs3(0)
w9 = rs3(1)
sql = "insert into
sold(invoice,selldate,customername,address,customerphone,itemname,company
,type,buyingprice,price,serialno,warenty) values('" & invoice.Caption & "','" &
ibldate.Caption & "','" & vkTextBox1.Text & "','" & vkTextBox2.Text & "','" &
vkTextBox3.Text & "','" & Label22.Caption & "','" & Combomouse.Text & "','" &
Combo22.Text & "', '" & p9 & "','" & Text14.Text & "','" & Combo45.Text & "','" & w9
& "')"
Call insertquery
End If
If Combo46.Text <> "" Then
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select buyingprice,warenty from itemdetail where Serialno='" &
Combo46.Text & "'"
p10 = rs3(0)
74
w10 = rs3(1)
sql = "insert into
sold(invoice,selldate,customername,address,customerphone,itemname,company
,type,range,buyingprice,price,serialno,warenty) values('" & invoice.Caption & "','"
& ibldate.Caption & "','" & vkTextBox1.Text & "','" & vkTextBox2.Text & "','" &
vkTextBox3.Text & "','" & Label23.Caption & "','" & Combospeaker.Text & "','" &
Combo23.Text & "','" & Combo30.Text & "','" & p10 & "','" & Text15.Text & "','" &
Combo46.Text & "','" & w10 & "')"
Call insertquery
End If
If Combo47.Text <> "" Then
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select buyingprice,warenty from itemdetail where Serialno='" &
Combo47.Text & "'"
p11 = rs3(0)
w11 = rs3(1)
sql = "insert into
sold(invoice,selldate,customername,address,customerphone,itemname,company
,type,range,buyingprice,price,serialno,warenty) values('" & invoice.Caption & "','"
& ibldate.Caption & "','" & vkTextBox1.Text & "','" & vkTextBox2.Text & "','" &
vkTextBox3.Text & "','" & Label26.Caption & "','" & Combomonitor.Text & "','" &
Combo24.Text & "','" & Combo31.Text & "','" & p11 & "','" & Text16.Text & "','" &
Combo47.Text & "','" & w11 & "')"
Call insertquery
End If
If Combo48.Text <> "" Then
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select buyingprice,warenty from itemdetail where Serialno='" &
Combo48.Text & "'"
p12 = rs3(0)
w12 = rs3(1)
sql = "insert into
sold(invoice,selldate,customername,address,customerphone,itemname,company
,buyingprice,price,serialno,warenty) values('" & invoice.Caption & "','" &
ibldate.Caption & "','" & vkTextBox1.Text & "','" & vkTextBox2.Text & "','" &
vkTextBox3.Text & "','" & Label24.Caption & "','" & Comboups.Text & "','" & p12 &
"','" & Text17.Text & "','" & Combo48.Text & "','" & w12 & "')"
Call insertquery
End If
If Combo49.Text <> "" Then
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select buyingprice,warenty from itemdetail where Serialno='" &
Combo49.Text & "'"
75
p13 = rs3(0)
w13 = rs3(1)
sql = "insert into
sold(invoice,selldate,customername,address,customerphone,itemname,company
,type,buyingprice,price,serialno,warenty) values('" & invoice.Caption & "','" &
ibldate.Caption & "','" & vkTextBox1.Text & "','" & vkTextBox2.Text & "','" &
vkTextBox3.Text & "','" & Label25.Caption & "','" & Combomodem.Text & "','" &
Combo25.Text & "','" & p13 & "','" & Text18.Text & "','" & Combo49.Text & "','" &
w13 & "')"
Call insertquery
End If
If Combo50.Text <> "" Then
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select buyingprice,warenty from itemdetail where Serialno='" &
Combo50.Text & "'"
p14 = rs3(0)
w14 = rs3(1)
sql = "insert into
sold(invoice,selldate,customername,address,customerphone,itemname,company
,buyingprice,price,serialno,warenty) values('" & invoice.Caption & "','" &
ibldate.Caption & "','" & vkTextBox1.Text & "','" & vkTextBox2.Text & "','" &
vkTextBox3.Text & "','" & Label35.Caption & "','" & Combolan.Text & "','" & p14 &
"','" & Text19.Text & "','" & Combo50.Text & "','" & w14 & "')"
Call insertquery
End If
If Combo51.Text <> "" Then
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select buyingprice,warenty from itemdetail where Serialno='" &
Combo51.Text & "'"
p15 = rs3(0)
w15 = rs3(1)
sql = "insert into
sold(invoice,selldate,customername,address,customerphone,itemname,company
,type,buyingprice,price,serialno,warenty) values('" & invoice.Caption & "','" &
ibldate.Caption & "','" & vkTextBox1.Text & "','" & vkTextBox2.Text & "','" &
vkTextBox3.Text & "','" & Label36.Caption & "','" & Comboprinter.Text & "','" &
Combo34.Text & "','" & p15 & "','" & Text20.Text & "','" & Combo51.Text & "','" &
w15 & "')"
Call insertquery
End If
If Combo52.Text <> "" Then
If rs3.State = adStateOpen Then rs3.Close
76
77
Text24.Text = ""
Text24.SetFocus
End If
Label33.Visible = True
Text26.Visible = True
price = Val(Text23) - Val(Text24)
If price < 0 Then
MsgBox "Payment can not much than total price.", vbCritical
Label33.Visible = False
Text26.Visible = False
Text24.Text = ""
Exit Sub
Else
Text26 = price
End If
End Sub
Private Sub vkOptionButton1_Change(Value As CheckBoxConstants)
Label32.Visible = False
Text25.Visible = False
End Sub
Private Sub vkOptionButton2_Change(Value As CheckBoxConstants)
Label33.Visible = True
Text26.Visible = True
Text26 = Val(Text23)
Text24 = 0
save.SetFocus
End Sub
Private Sub vkOptionButton3_Change(Value As CheckBoxConstants)
Label32.Visible = True
Label32.Caption = "Cheque Number"
Text25.Visible = True
End Sub
Private Sub vkOptionButton4_Change(Value As CheckBoxConstants)
Label32.Visible = True
Label32.Caption = "Demand Draft Number"
Text25.Visible = True
End Sub
Private Sub vkTextBox1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
78
ibldate.Caption = Date
invoice.Caption = "Sbronded" & (rs7.RecordCount + 1)
invoice.FontBold = True
End Sub
Private Sub Form_Unload(cancel As Integer)
con.Close
End Sub
Private Sub lvButtons_H1_Click()
Unload Me
End Sub
Private Sub lvButtons_H2_Click()
b = (MsgBox("are you sure you want to sell?", vbYesNo, conformation))
If Combocompany.Text = "" And model.Text = "" And categary.Text = "" And
combohard.Text = "" And comboram.Text = "" _
And Combomother.Text = "" And ComboProcessor.Text = "" And
Combomonitor.Text = "" And txtsell.Text = "" Then
MsgBox "Any product is not choosen by you. Please choose any product."
Exit Sub
End If
If vkTextBox1.Text = "" Then
MsgBox " Customer Name is Empty"
vkTextBox1.SetFocus
Exit Sub
ElseIf vkTextBox2.Text = "" Then
MsgBox " Customer Address is Empty"
vkTextBox2.SetFocus
Exit Sub
ElseIf vkTextBox3.Text = "" Then
MsgBox " Customer Pnone No is Empty"
vkTextBox3.SetFocus
Exit Sub
End If
If Text1.Text = "" Then
MsgBox " Payment Amount is Empty"
Text1.SetFocus
Exit Sub
End If
con.BeginTrans
80
con.Execute "Insert into Balance values('" & vkTextBox1.Text & "','" &
invoice.Caption & "','" & txtsell.Text & "','" & Text1.Text & "','" & ibldate.Caption &
"','" & Text2.Text & "')"
con.CommitTrans
con.BeginTrans
con.Execute "Insert into customer values('" & vkTextBox1.Text & "','" &
vkTextBox2.Text & "','" & vkTextBox3.Text & "','" & Text2.Text & "','" &
invoice.Caption & "')"
con.CommitTrans
If rs1.State = adStateOpen Then rs1.Close
rs1.Open "select buying_value from computersys where Serialno=" & serial.Text
& ""
p = rs1(0)
sql = "insert into
systemsold(seriel,invoice,customername,address,phone,selldate,buyingvalue,pri
ce,companyname,categary,model,harddisk,ram,motherboard,processor,monitor,o
ther,warranty) values('" & serial.Text & "','" & invoice.Caption & "','" &
vkTextBox1.Text & "','" & vkTextBox2.Text & "','" & vkTextBox3.Text & "','" &
ibldate.Caption & "','" & p & "','" & txtsell.Text & "','" & Combocompany.Text & "','"
& categary.Text & "','" & model.Text & "','" & combohard.Text & "','" &
comboram.Text & "','" & Combomother.Text & "','" & ComboProcessor.Text & "','"
& Combomonitor.Text & "','" & other.Text & "','" & txtwarranty.Text & "')"
MsgBox (sql)
Call insertquery
MsgBox "Data is Saved Properly"
lvButtons_H2.Visible = False
lvButtons_H8.Visible = True
End Sub
Private Sub lvButtons_H3_Click()
rs1.MoveLast
serial.Text = rs1!serialno
Combocompany.Text = rs1!company
model.Text = rs1!model
categary.Text = rs1!categary
combohard.Text = rs1!harddisk
comboram.Text = rs1!ram
Combomother.Text = rs1!motherboard
ComboProcessor.Text = rs1!processor
Combomonitor.Text = rs1!monitor
81
other.Text = rs1!other
txtsell.Text = rs1!selling_value
txtwarranty.Text = rs1!warranty
End Sub
Private Sub lvButtons_H4_Click()
On Error Resume Next
If rs1.EOF = False Then
rs1.MoveNext
serial.Text = rs1!serialno
Combocompany.Text = rs1!company
model.Text = rs1!model
categary.Text = rs1!categary
combohard.Text = rs1!harddisk
comboram.Text = rs1!ram
Combomother.Text = rs1!motherboard
ComboProcessor.Text = rs1!processor
Combomonitor.Text = rs1!monitor
other.Text = rs1!other
txtsell.Text = rs1!selling_value
txtwarranty.Text = rs1!warranty
End If
End Sub
Private Sub lvButtons_H5_Click()
On Error GoTo l1
If rs1.BOF = False Then
rs1.MovePrevious
serial.Text = rs1!serialno
Combocompany.Text = rs1!company
model.Text = rs1!model
categary.Text = rs1!categary
combohard.Text = rs1!harddisk
comboram.Text = rs1!ram
Combomother.Text = rs1!motherboard
ComboProcessor.Text = rs1!processor
Combomonitor.Text = rs1!monitor
other.Text = rs1!other
txtsell.Text = rs1!selling_value
txtwarranty.Text = rs1!warranty
End If
Exit Sub
l1:
82
83
Else
Text2 = price
End If
End Sub
Private Sub vkTextBox3_Change()
If vkTextBox3.Text = "" Then
Exit Sub
End If
If Not IsNumeric(vkTextBox3.Text) Then
MsgBox " Customer Phone should be numaric"
vkTextBox3.Text = ""
vkTextBox3.SetFocus
Exit Sub
End If
End Sub
Make quotation
Dim price As Double
Dim temp As String
Dim bool As Boolean
Dim p1, p2 As Double
Dim w1, w2 As Integer
Private Sub lvButtons_H1_Click()
On Error Resume Next:
quotation.PrintForm
End Sub
Private Sub Combo19_Click()
Combo27.Clear
temp = "RAM"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Range from itemdetail where Itemname='" & temp & "' and
Company='" & Comboram.Text & "' and Type='" & Combo19.Text & "'"
While rs3.EOF = False
Combo27.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Combo20_Click()
Combo28.Clear
temp = "Processor"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Range from itemdetail where Itemname='" & temp & "' and
Company='" & ComboProcessor.Text & "' and Type='" & Combo20.Text & "'"
84
85
rs3.MoveNext
Wend
End Sub
Private Sub Combo25_Click()
temp = "Modem"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Combomodem.Text & "' and Type='" & Combo25.Text & "'"
While rs3.EOF = False
Combo49.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Combo27_Click()
temp = "RAM"
Combo38.Clear
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Comboram.Text & "' and Type='" & Combo19.Text & "' and
Range='" & Combo27.Text & "'"
While rs3.EOF = False
Combo38.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Combo28_Click()
Combo39.Clear
temp = "Processor"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & ComboProcessor.Text & "' and Type='" & Combo20.Text & "' and
Range='" & Combo28.Text & "'"
While rs3.EOF = False
Combo39.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Combo29_Click()
Combo40.Clear
temp = "MotherBoard"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Combomotherboard.Text & "' and Type='" & Combo21.Text & "'
and Range='" & Combo29.Text & "'"
While rs3.EOF = False
86
Combo40.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Combo30_Click()
temp = "Speaker"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Combospeaker.Text & "' and Type='" & Combo23.Text & "' and
Range='" & Combo30.Text & "'"
While rs3.EOF = False
Combo46.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
87
If i = 0 Then
hdprice = Val(text4)
price = price + hdprice
Else
price = price - hdprice
hdprice = Val(text4)
price = price + hdprice
End If
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
End Sub
Private Sub Combo36_Click()
Static cdrprice As Double
Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo36.Text & "'"
Text5.Text = rs3(0)
If i = 0 Then
cdrprice = Val(Text5)
price = price + cdrprice
Else
price = price - cdrprice
cdrprice = Val(Text5)
price = price + cdrprice
End If
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
End Sub
88
89
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
End Sub
Private Sub Combo40_Click()
Static mbprice As Double
Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo40.Text & "'"
Text9.Text = rs3(0)
If i = 0 Then
mbprice = Val(Text9)
price = price + mbprice
Else
price = price - mbprice
mbprice = Val(Text9)
price = price + mbprice
End If
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
End Sub
Private Sub Combo41_Click()
Static fdprice As Double
Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo41.Text & "'"
Text10 = rs3(0)
If i = 0 Then
fdprice = Val(Text10)
price = price + fdprice
Else
price = price - fdprice
fdprice = Val(Text10)
price = price + fdprice
End If
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
End Sub
90
91
End Sub
Private Sub Combo44_Click()
Static kbdprice As Double
Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo44.Text & "'"
Text13.Text = rs3(0)
If i = 0 Then
kbdprice = Val(Text13)
price = price + kbdprice
Else
price = price - kbdprice
kbdprice = Val(Text13)
price = price + kbdprice
End If
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
End Sub
Private Sub Combo45_Click()
Static msprice As Double
Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo45.Text & "'"
Text14.Text = rs3(0)
If i = 0 Then
msprice = Val(Text14)
price = price + msprice
Else
price = price - msprice
msprice = Val(Text14)
price = price + msprice
End If
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
End Sub
Private Sub Combo46_Click()
Static spkprice As Double
92
Static i As Integer
'temp = "Speaker"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo46.Text & "'"
Text15.Text = rs3(0)
If i = 0 Then
spkprice = Val(Text15)
price = price + spkprice
Else
price = price - spkprice
spkprice = Val(Text15)
price = price + spkprice
End If
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
End Sub
Private Sub Combo47_Click()
Static monprice As Double
Static i As Integer
'temp = "Monitor"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo47.Text & "'"
Text16.Text = rs3(0)
If i = 0 Then
monprice = Val(Text16)
price = price + monprice
Else
price = price - monprice
monprice = Val(Text16)
price = price + monprice
End If
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
End Sub
Private Sub Combo48_Click()
Static upsprice As Double
Static i As Integer
'temp = "UPS"
If rs3.State = adStateOpen Then rs3.Close
93
rs3.Open "select Price from itemdetail where Serialno='" & Combo48.Text & "'"
Text17.Text = rs3(0)
If i = 0 Then
upsprice = Val(Text17)
price = price + upsprice
Else
price = price - upsprice
upsprice = Val(Text17)
price = price + upsprice
End If
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
End Sub
Private Sub Combo49_Click()
Static modprice As Double
Static i As Integer
'temp = "Modem"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo49.Text & "'"
Text18.Text = rs3(0)
If i = 0 Then
modprice = Val(Text18)
price = price + modprice
Else
price = price - modprice
modprice = Val(Text18)
price = price + modprice
End If
i=i+1
Text21 = price
Text22 = price * 4 / 100
Text23 = price + Val(Text22)
End Sub
Private Sub Combo50_Click()
Static lcardprice As Double
Static i As Integer
'temp = "LAN Card"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo50.Text & "'"
Text19.Text = rs3(0)
If i = 0 Then
lcardprice = Val(Text19)
94
95
96
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Combocdrom.Text & "'"
While rs3.EOF = False
Combo36.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Combocdwriter_Click()
Combo37.Clear
temp = "CD Writer"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Combocdwriter.Text & "'"
While rs3.EOF = False
Combo37.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
97
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Combofloppy.Text & "'"
While rs3.EOF = False
Combo41.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Comboharddisk_Click()
temp = "Hard Disk"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "'
and Company='" & Comboharddisk.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Comboharddisk.Text Then bool = True
For i = 0 To Comboharddisktype.ListCount
If Comboharddisktype.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Comboharddisktype.AddItem rs3(1)
Else
bool = True
End If
rs3.MoveNext
Wend
End Sub
Private Sub Comboharddiskrange_Click()
Combo35.Clear
temp = "Hard Disk"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Comboharddisk.Text & "' and Type='" & Comboharddisktype.Text
& "' and Range='" & Comboharddiskrange.Text & "'"
While rs3.EOF = False
Combo35.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Comboharddisktype_Click()
Comboharddiskrange.Clear
harddiskprice = ""
temp = "Hard Disk"
If rs3.State = adStateOpen Then rs3.Close
98
rs3.Open "select Range from itemdetail where Itemname='" & temp & "' and
Company='" & Comboharddisk.Text & "' and Type='" & Comboharddisktype.Text
& "'"
While rs3.EOF = False
Comboharddiskrange.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Combokeyboard_Click()
temp = "Keyboad"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Combokeyboard.Text & "'"
While rs3.EOF = False
Combo44.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Combolan_Click()
temp = "LAN Card"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Combolan.Text & "'"
While rs3.EOF = False
Combo50.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Combomodem_Click()
temp = "Modem"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "'
and Company='" & Combomodem.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Combomodem.Text Then bool = True
For i = 0 To Combo25.ListCount
If Combo25.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combo25.AddItem rs3(1)
Else
bool = True
End If
rs3.MoveNext
Wend
99
End Sub
Private Sub Combomonitor_Click()
temp = "Monitor"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "'
and Company='" & Combomonitor.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Combomonitor.Text Then bool = True
For i = 0 To Combo24.ListCount
If Combo24.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combo24.AddItem rs3(1)
Else
bool = True
End If
rs3.MoveNext
Wend
End Sub
Private Sub Combomotherboard_Click()
temp = "MotherBoard"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "'
and Company='" & Combomotherboard.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Combomotherboard.Text Then bool = True
For i = 0 To Combo21.ListCount
If Combo21.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combo21.AddItem rs3(1)
Else
bool = True
End If
rs3.MoveNext
Wend
End Sub
Private Sub Combomouse_Click()
temp = "Mouse"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "'
and Company='" & Combomouse.Text & "'"
While rs3.EOF = False
100
101
rs3.MoveNext
Wend
End Sub
Private Sub Comboram_Click()
temp = "RAM"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "'
and Company='" & Comboram.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Comboram.Text Then bool = True
For i = 0 To Combo19.ListCount
If Combo19.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combo19.AddItem rs3(1)
Else
bool = True
End If
rs3.MoveNext
Wend
End Sub
Private Sub Comboscanner_Click()
temp = "Scanner"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Comboscanner.Text & "'"
While rs3.EOF = False
Combo52.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Combospeaker_Click()
temp = "Speaker"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "'
and Company='" & Combospeaker.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Combospeaker.Text Then bool = True
For i = 0 To Combo23.ListCount
If Combo23.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
102
Combo23.AddItem rs3(1)
Else
bool = True
End If
rs3.MoveNext
Wend
End Sub
Private Sub Comboups_Click()
temp = "UPS"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and
Company='" & Comboups.Text & "'"
While rs3.EOF = False
Combo48.AddItem rs3(0)
rs3.MoveNext
Wend
End Sub
Private Sub Form_Load()
Call connectdatabase
Call setsoldrecordset
Call itemdetail
Call customerrecordset
text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
Text10.Enabled = False
Text11.Enabled = False
Text12.Enabled = False
Text13.Enabled = False
Text14.Enabled = False
Text15.Enabled = False
Text16.Enabled = False
Text17.Enabled = False
Text18.Enabled = False
Text19.Enabled = False
Text20.Enabled = False
Text21.Enabled = False
Text22.Enabled = False
Text23.Enabled = False
Text27.Enabled = False
103
Text28.Enabled = False
'Text26.Enabled = False
'Label32.Visible = False
'Text25.Visible = False
ibldate.Caption = Date
'If rs2.State = 1 Then rs2.Close
'rs2.Open "Select * from setsold", cs, adOpenKeyset, adLockOptimistic
'invoice.Caption = "S" & (rs2.RecordCount + 1)
'invoice.FontBold = True
'Label38.Caption = "cust" & (rs2.RecordCount + 1)
price = 0
Dim bool As Boolean
While rs3.EOF = False
If rs3.Fields(0).Value = "Hard Disk" Then
bool = True
For i = 0 To Comboharddisk.ListCount
If Comboharddisk.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Comboharddisk.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "CD ROM" Then
bool = True
For i = 0 To Combocdrom.ListCount
If Combocdrom.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combocdrom.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "CD Writer" Then
bool = True
For i = 0 To Combocdwriter.ListCount
If Combocdwriter.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combocdwriter.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "RAM" Then
104
bool = True
For i = 0 To Comboram.ListCount
If Comboram.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Comboram.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "Processor" Then
bool = True
For i = 0 To ComboProcessor.ListCount
If ComboProcessor.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
ComboProcessor.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "MotherBoard" Then
bool = True
For i = 0 To Combomotherboard.ListCount
If Combomotherboard.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combomotherboard.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "Floppy Drive" Then
bool = True
For i = 0 To Combofloppy.ListCount
If Combofloppy.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combofloppy.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "Cabinet" Then
bool = True
For i = 0 To Combocabinet.ListCount
If Combocabinet.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combocabinet.AddItem rs3(1)
105
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "DVD ROM" Then
bool = True
For i = 0 To Combodvdrom.ListCount
If Combodvdrom.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combodvdrom.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "DVD Writer" Then
bool = True
For i = 0 To Combodvdwriter.ListCount
If Combodvdwriter.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combodvdwriter.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "Keyboad" Then
bool = True
For i = 0 To Combokeyboard.ListCount
If Combokeyboard.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combokeyboard.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "Mouse" Then
bool = True
For i = 0 To Combomouse.ListCount
If Combomouse.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Combomouse.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "Speaker" Then
bool = True
For i = 0 To Combospeaker.ListCount
106
107
End If
ElseIf rs3.Fields(0).Value = "Printer" Then
bool = True
For i = 0 To Comboprinter.ListCount
If Comboprinter.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Comboprinter.AddItem rs3(1)
Else
bool = True
End If
ElseIf rs3.Fields(0).Value = "Scanner" Then
bool = True
For i = 0 To Comboscanner.ListCount
If Comboscanner.List(i) = rs3(1) Then bool = False
Next
If bool = True Then
Comboscanner.AddItem rs3(1)
Else
bool = True
End If
End If
rs3.MoveNext
Wend
End Sub
Private Sub Form_Unload(cancel As Integer)
con.Close
End Sub
Private Sub lvButtons_H2_Click()
Unload Me
End Sub
Private Sub Text24_Change()
Label33.Visible = True
Text26.Visible = True
price = Val(Text23) - Val(Text24)
If price <= 0 Then
Label33.Visible = False
Text26.Visible = False
Else
Text26 = price
End If
End Sub
Private Sub vkOptionButton1_Change(Value As CheckBoxConstants)
108
Label32.Visible = False
Text25.Visible = False
End Sub
Private Sub vkOptionButton2_Change(Value As CheckBoxConstants)
Label33.Visible = True
Text26.Visible = True
Text26 = Val(Text23)
Text24 = 0
save.SetFocus
End Sub
109
If KeyAscii = 13 Then
txtpass.SetFocus
End If
End Sub
Private Sub lvButtons_H1_Click()
Unload Me
End Sub
Private Sub lvButtons_H2_Click()
If Text1.Text = "" Or Text2.Text = "" Or _
Text3.Text = "" Or Text4.Text = "" Then
MsgBox " INVALID INPUTES !!!!EITHER OR SOME ITEM MISSING!"
Exit Sub
End If
sql = "update customer set Customername='" & Text1.Text &
"',Customeraddress='" & Text2.Text & "',Customerphone='" & Text4.Text &
"',Balance ='" & Text5.Text & "',invoice='" & Text3.Text & "' where
customername='" & DataGrid1.Columns(0) & "'"
con.BeginTrans
con.Execute (sql)
con.CommitTrans
MsgBox "Record Updated"
rs4.Close
sql1 = "select * from customer"
rs4.Source = sql1
rs4.Open
Set DataGrid1.DataSource = rs4
End Sub
Private Sub lvButtons_H4_Click()
sql = "delete from customer where invoice= '" & DataGrid1.Columns(4) & "'"
con.BeginTrans
con.Execute (sql)
con.CommitTrans
MsgBox "Data deleted"
rs4.Close
sql1 = "select * from customer"
rs4.Source = sql1
rs4.Open
Set DataGrid1.DataSource = rs4
110
End Sub
Change password
Private Sub cancel_Click()
Unload Me
End Sub
Private Sub Form_Load()
Call connectdatabase
Call usrrecord
End Sub
Private Sub Form_Unload(cancel As Integer)
con.Close
End Sub
Private Sub lvButtons_H1_Click()
If Text3.Text = "" Then
MsgBox "Enter the login name.", vbInformation
Exit Sub
End If
If Not (Text1.Text = Text2.Text) Then
MsgBox "Password not match so Re-enter the password"
111
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Else
sql = "update usertable set passwd='" & Text4.Text & "' where logname='" &
Text3.Text & "' and passwd='" & Text1.Text & "'"
MsgBox (sql)
con.BeginTrans
con.Execute (sql)
con.CommitTrans
MsgBox "Your password successfully change.", vbInformation
End If
End Sub
112
113
rs.Source = sql1
rs.Open
Set DataGrid1.DataSource = rs
End Sub
Private Sub cmdUpdate_Click()
If txtemp.Text = "" Or txtName.Text = "" Or _
txtpass.Text = "" Or txtaddress.Text = "" Or _
txtph.Text = "" Then
MsgBox " INVALID INPUTES !!!!EITHER OR SOME ITEM MISSING!"
Exit Sub
End If
sql = "update usertable set name='" & txtemp.Text & "',logname='" &
txtName.Text & "',passwd='" & txtpass.Text & "',address='" & txtaddress.Text &
"',type='" & tp.Text & "',mobnumber='" & txtph.Text & "' where name='" &
DataGrid1.Columns(1) & "'"
'Call insertquery
con.BeginTrans
con.Execute (sql)
con.CommitTrans
MsgBox "Record Updated"
DataGrid1.Columns(3).Visible = False
txtid.Text = DataGrid1.Columns(0)
txtemp.Text = DataGrid1.Columns(1)
txtName.Text = DataGrid1.Columns(2)
txtpass.Text = DataGrid1.Columns(3)
txtph.Text = DataGrid1.Columns(4)
txtaddress.Text = DataGrid1.Columns(5)
tp.Text = DataGrid1.Columns(6)
rs.Close
sql1 = "select * from usertable"
rs.Source = sql1
rs.Open
Set DataGrid1.DataSource = rs
End Sub
Private Sub DataGrid1_Click()
cmdClearAll.Enabled = True
id.Visible = True
txtid.Visible = True
114
cmdDelete.Enabled = True
cmdAdd.Visible = False
cmdUpdate.Enabled = True
cmdUpdate.Visible = True
Set DataGrid1.DataSource = rs
DataGrid1.Columns(3).Visible = False
txtid.Text = DataGrid1.Columns(0)
txtemp.Text = DataGrid1.Columns(1)
txtName.Text = DataGrid1.Columns(2)
txtpass.Text = DataGrid1.Columns(3)
txtph.Text = DataGrid1.Columns(4)
txtaddress.Text = DataGrid1.Columns(5)
tp.Text = DataGrid1.Columns(6)
End Sub
Private Sub Form_Unload(cancel As Integer)
con.Close
End Sub
Private Sub salary_LostFocus()
If salary.Text = "" Then
Exit Sub
End If
If IsNumeric(salary.Text) = False Then
MsgBox "ONLY NUMERIC VALUE IS ALLOW"
salary.Text = ""
salary.SetFocus
End If
End Sub
Private Sub show_Click()
cmdClearAll.Enabled = True
id.Visible = True
txtid.Visible = True
cmdDelete.Enabled = True
cmdAdd.Visible = False
cmdUpdate.Visible = True
Set DataGrid1.DataSource = rs
DataGrid1.Columns(3).Visible = False
txtid.Text = DataGrid1.Columns(0)
txtemp.Text = DataGrid1.Columns(1)
115
txtName.Text = DataGrid1.Columns(2)
txtpass.Text = DataGrid1.Columns(3)
txtph.Text = DataGrid1.Columns(4)
txtaddress.Text = DataGrid1.Columns(5)
tp.Text = DataGrid1.Columns(6)
End Sub
Private Sub Form_Load()
cmdUpdate.Visible = False
cmdClearAll.Enabled = False
cmdDelete.Enabled = False
Call connectdatabase
Call usrrecord
End Sub
Private Sub txtemp_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtName.SetFocus
End If
End Sub
Private Sub txtName_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtpass.SetFocus
End If
End Sub
Private Sub txtph_LostFocus()
If txtph.Text = "" Then
Exit Sub
End If
If IsNumeric(txtph.Text) = False Then
MsgBox "MOBILE NUMBER SHOULD BE NUMERIC VALUE!"
txtph.Text = ""
Exit Sub
End If
If Len(txtph.Text) < 10 Or Len(txtph.Text) > 12 Then
MsgBox "Please Enter a valid Mobile number"
txtph.Text = ""
txtph.SetFocus
End If
End Sub
116
Add company
Private Sub Clearall_Click()
update.Visible = False
Clearall.Visible = False
lvButtons_H2.Visible = True
cname.Text = ""
person.Text = ""
address.Text = ""
city.Text = ""
mobnumber.Text = ""
email.Text = ""
website.Text = ""
fax.Text = ""
notes.Text = ""
End Sub
Private Sub DataGrid1_Click()
update.Visible = True
lvButtons_H2.Visible = False
Clearall.Visible = True
Set DataGrid1.DataSource = rs6
cname.Text = DataGrid1.Columns(0)
person.Text = DataGrid1.Columns(1)
address.Text = DataGrid1.Columns(2)
city.Text = DataGrid1.Columns(3)
mobnumber.Text = DataGrid1.Columns(4)
email.Text = DataGrid1.Columns(6)
website.Text = DataGrid1.Columns(5)
fax.Text = DataGrid1.Columns(7)
notes.Text = DataGrid1.Columns(8)
End Sub
Private Sub delete_Click()
sql = "delete from company where companyname= '" & DataGrid1.Columns(o) &
"'"
con.BeginTrans
con.Execute (sql)
con.CommitTrans
MsgBox "Data deleted"
rs6.Close
sql7 = "select * from company"
rs6.Source = sql7
117
rs6.Open
Set DataGrid1.DataSource = rs6
cname.Text = DataGrid1.Columns(0)
person.Text = DataGrid1.Columns(1)
address.Text = DataGrid1.Columns(2)
city.Text = DataGrid1.Columns(3)
mobnumber.Text = DataGrid1.Columns(4)
email.Text = DataGrid1.Columns(6)
website.Text = DataGrid1.Columns(5)
fax.Text = DataGrid1.Columns(7)
notes.Text = DataGrid1.Columns(8)
End Sub
Private Sub fax_LostFocus()
If fax.Text = "" Then
Exit Sub
End If
If IsNumeric(fax.Text) = False Then
MsgBox "FAX NUMBER SHOULD BE NUMERIC VALUE!"
fax.Text = ""
fax.SetFocus
Exit Sub
End If
End Sub
Private Sub Form_Load()
Call connectdatabase
Call companyrecordset
Set DataGrid1.DataSource = rs6
update.Visible = False
Clearall.Visible = False
End Sub
Private Sub Form_Unload(cancel As Integer)
con.Close
End Sub
Private Sub lvButtons_H2_Click()
If cname.Text = "" Then
MsgBox "Enter the customer name."
Exit Sub
End If
If person.Text = "" Then
MsgBox "Enter the contact person name"
118
Exit Sub
End If
If address.Text = "" Then
MsgBox "enter the address."
Exit Sub
End If
If city.Text = "" Then
MsgBox "enter the city"
Exit Sub
End If
If mobnumber.Text = "" Then
MsgBox "Enter the mobile number.If there is no mobile no. just enter 0."
Exit Sub
End If
If email.Text = "" Then
MsgBox "Enter the email id."
Exit Sub
End If
If website.Text = "" Then
MsgBox "Enter the website name."
Exit Sub
End If
If fax.Text = "" Then
MsgBox "Enter the fax no."
Exit Sub
End If
If notes.Text = "" Then
'Exit Sub
End If
sql = "insert into
company(companyname,contactperson,address,city,mobnumber,email,website,f
ax,anynote) values('" & cname.Text & "','" & person.Text & "','" & address.Text &
"','" & city.Text & "','" & mobnumber.Text & "','" & email.Text & "','" & website.Text &
"','" & fax.Text & "','" & notes.Text & "')"
Call insertquery
MsgBox "Data inserted successfully.."
cname.Text = ""
person.Text = ""
address.Text = ""
city.Text = ""
mobnumber.Text = ""
email.Text = ""
website.Text = ""
fax.Text = ""
119
notes.Text = ""
rs6.Close
sql7 = "select * from company"
rs6.Source = sql7
rs6.Open
Set DataGrid1.DataSource = rs6
End Sub
Private Sub lvButtons_H4_Click()
Unload Me
End Sub
120
End If
If city.Text = "" Then
MsgBox "enter the city"
Exit Sub
End If
If mobnumber.Text = "" Then
MsgBox "Enter the mobile number.If there is no mobile no. just enter 0."
Exit Sub
End If
If email.Text = "" Then
MsgBox "Enter the email id."
Exit Sub
End If
If website.Text = "" Then
MsgBox "Enter the website name."
Exit Sub
End If
If fax.Text = "" Then
MsgBox "Enter the fax no."
Exit Sub
End If
If notes.Text = "" Then
End If
sql = "update company set companyname='" & cname.Text & "',contactperson='"
& person.Text & "',address='" & address.Text & "',city='" & city.Text &
"',mobnumber='" & mobnumber.Text & "',email='" & email.Text & "',website='" &
website.Text & "',fax='" & fax.Text & "',anynote='" & notes.Text & "' where
companyname='" & DataGrid1.Columns(0) & "'"
con.BeginTrans
con.Execute (sql)
con.CommitTrans
MsgBox "Record Updated"
rs6.Close
sql7 = "select * from company"
rs6.Source = sql7
rs6.Open
Set DataGrid1.DataSource = rs6
cname.Text = DataGrid1.Columns(0)
person.Text = DataGrid1.Columns(1)
address.Text = DataGrid1.Columns(2)
city.Text = DataGrid1.Columns(3)
mobnumber.Text = DataGrid1.Columns(4)
email.Text = DataGrid1.Columns(6)
website.Text = DataGrid1.Columns(5)
fax.Text = DataGrid1.Columns(7)
121
notes.Text = DataGrid1.Columns(8)
End Sub
Add product
Private Sub cancel_Click()
Unload Me
End Sub
Private Sub cmdAdd_Click()
If Text1.Text = "" Then
MsgBox "Enter the product name", vbInformation
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "Enter the company name", vbInformation
Text2.SetFocus
Exit Sub
End If
If Text5.Text = "" Then
MsgBox "Enter the Buying Price", vbInformation
Text5.SetFocus
Exit Sub
End If
If Text6.Text = "" Then
MsgBox "Enter the Price", vbInformation
Text6.SetFocus
Exit Sub
End If
If Text7.Text = "" Then
MsgBox "Enter the Serial no..", vbInformation
Text7.SetFocus
Exit Sub
End If
If Text8.Text = "" Then
MsgBox "Enter the Warranty", vbInformation
Text8.SetFocus
Exit Sub
End If
sql = "insert into
itemdetail(itemname,company,type,range,buyingprice,price,serialno,warenty)
values('" & Text1.Text & "','" & Text2.Text & "','" & Text3.Text & "','" & text4.Text &
"','" & Text5.Text & "','" & Text6.Text & "','" & Text7.Text & "','" & Text8.Text & "')"
Call insertquery
MsgBox "Data inserted successfully..", vbInformation
122
Text1 = ""
Text2 = ""
Text3 = ""
text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
rs3.Close
sql1 = "select * from itemdetail"
rs3.Source = sql1
rs3.Open
Set DataGrid1.DataSource = rs3
End Sub
Private Sub cmdClearAll_Click()
Text1 = ""
Text2 = ""
Text3 = ""
text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
cmdAdd.Visible = True
End Sub
123
cmdAdd.Visible = True
rs3.Close
sql1 = "select * from itemdetail"
rs3.Source = sql1
rs3.Open
Set DataGrid1.DataSource = rs3
End Sub
Private Sub cmdUpdate_Click()
If Text1.Text = "" Then
MsgBox "Enter the product name", vbInformation
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "Enter the company name", vbInformation
Text2.SetFocus
Exit Sub
End If
If Text5.Text = "" Then
MsgBox "Enter the Buying Price", vbInformation
Text5.SetFocus
Exit Sub
End If
If Text6.Text = "" Then
MsgBox "Enter the Price", vbInformation
Text6.SetFocus
Exit Sub
End If
If Text7.Text = "" Then
MsgBox "Enter the Serial no..", vbInformation
Text7.SetFocus
Exit Sub
End If
If Text8.Text = "" Then
MsgBox "Enter the Warranty", vbInformation
Text8.SetFocus
Exit Sub
End If
sql = "update itemdetail set itemname='" & Text1.Text & "',company='" &
Text2.Text & "',type='" & Text3.Text & "',range='" & text4.Text & "',buyingprice='" &
Text5.Text & "',price='" & Text6.Text & "',serialno='" & Text7.Text & "',warenty='" &
Text8.Text & "' where serialno='" & DataGrid1.Columns(6) & "'"
124
con.BeginTrans
con.Execute (sql)
con.CommitTrans
MsgBox "Record Updated", vbInformation
Text1.Text = DataGrid1.Columns(0)
Text2.Text = DataGrid1.Columns(1)
Text3.Text = DataGrid1.Columns(2)
text4.Text = DataGrid1.Columns(3)
Text5.Text = DataGrid1.Columns(4)
Text6.Text = DataGrid1.Columns(5)
Text7.Text = DataGrid1.Columns(6)
Text8.Text = DataGrid1.Columns(7)
rs3.Close
sql1 = "select * from itemdetail"
rs.Source = sql1
rs3.Open
Set DataGrid1.DataSource = rs3
End Sub
Private Sub DataGrid1_Click()
cmdClearAll.Enabled = True
cmdDelete.Enabled = True
cmdAdd.Visible = False
cmdUpdate.Enabled = True
cmdUpdate.Visible = True
Set DataGrid1.DataSource = rs3
Text1.Text = DataGrid1.Columns(0)
Text2.Text = DataGrid1.Columns(1)
Text3.Text = DataGrid1.Columns(2)
text4.Text = DataGrid1.Columns(3)
Text5.Text = DataGrid1.Columns(4)
Text6.Text = DataGrid1.Columns(5)
Text7.Text = DataGrid1.Columns(6)
Text8.Text = DataGrid1.Columns(7)
End Sub
Private Sub Form_Load()cmdUpdate.Visible = False
125
cmdClearAll.Enabled = False
cmdDelete.Enabled = False
Call connectdatabase
Call itemdetail
Set DataGrid1.DataSource = rs3
Text1.Text = DataGrid1.Columns(0)
Text2.Text = DataGrid1.Columns(1)
Text3.Text = DataGrid1.Columns(2)
text4.Text = DataGrid1.Columns(3)
Text5.Text = DataGrid1.Columns(4)
Text6.Text = DataGrid1.Columns(5)
Text7.Text = DataGrid1.Columns(6)
Text8.Text = DataGrid1.Columns(7)
End Sub
Private Sub Text5_LostFocus()
If Text5.Text = "" Then
Exit Sub
End If
If IsNumeric(Text5.Text) = False Then
MsgBox "Buying price should be numeric", vbInformation
Text5.Text = ""
Text5.SetFocus
End If
End Sub
Private Sub Text6_LostFocus()
If Text6.Text = "" Then
Exit Sub
End If
If IsNumeric(Text6.Text) = False Then
MsgBox " Price should be numeric", vbInformation
Text6.Text = ""
Text6.SetFocus
End If
End Sub
127
txtwarranty.Text & "','" & categary.Text & "','" & combohard.Text & "','" &
Comboram.Text & "','" & Combomother.Text & "','" & ComboProcessor.Text & "','"
& Combomonitor.Text & "','" & other.Text & "')"
Call insertquery
MsgBox "Data inserted successfully.."
Combocompany.Text = ""
model.Text = ""
categary.Text = ""
combohard.Text = ""
Comboram.Text = ""
Combomother.Text = " "
ComboProcessor.Text = ""
Combomonitor.Text = ""
other.Text = ""
txtbuy.Text = ""
txtsell.Text = ""
txtwarranty.Text = ""
rs1.Close
sql2 = "select * from "
rs.Source = sql2
rs1.Open
Set DataGrid1.DataSource = rs1
End Sub
Private Sub Clearall_Click()
Combocompany.Text = ""
model.Text = ""
categary.Text = ""
combohard.Text = ""
Comboram.Text = ""
Combomother.Text = " "
ComboProcessor.Text = ""
Combomonitor.Text = ""
other.Text = ""
txtbuy.Text = ""
txtsell.Text = ""
txtwarranty.Text = ""
add.Visible = True
update.Visible = False
End Sub
Private Sub DataGrid1_Click()
Clearall.Visible = True
add.Visible = False
Label13.Visible = True
128
serial.Visible = True
serial.Enabled = False
update.Visible = True
Clearall.Visible = True
Set DataGrid1.DataSource = rs1
serial.Text = DataGrid1.Columns(0)
Combocompany.Text = DataGrid1.Columns(1)
model.Text = DataGrid1.Columns(2)
categary.Text = DataGrid1.Columns(3)
combohard.Text = DataGrid1.Columns(4)
Comboram.Text = DataGrid1.Columns(5)
Combomother.Text = DataGrid1.Columns(6)
ComboProcessor.Text = DataGrid1.Columns(7)
Combomonitor.Text = DataGrid1.Columns(8)
other.Text = DataGrid1.Columns(9)
txtbuy.Text = DataGrid1.Columns(10)
txtsell.Text = DataGrid1.Columns(11)
txtwarranty.Text = DataGrid1.Columns(12)
End Sub
Private Sub delete_Click()
add.Visible = True
update.Visible = False
sql = "delete from computersys where serialno= " & DataGrid1.Columns(o) & ""
con.BeginTrans
con.Execute (sql)
con.CommitTrans
Combocompany.Text = ""
model.Text = ""
categary.Text = ""
combohard.Text = ""
Comboram.Text = ""
Combomother.Text = " "
ComboProcessor.Text = ""
Combomonitor.Text = ""
other.Text = ""
txtbuy.Text = ""
txtsell.Text = ""
txtwarranty.Text = ""
MsgBox "Data deleted"
rs1.Close
sql2 = "select * from computersys"
rs1.Source = sql2
rs1.Open
Set DataGrid1.DataSource = rs1
End Sub
129
130
End If
If categary.Text = "" Then
MsgBox "Enter the categary name."
Exit Sub
End If
If model.Text = "" Then
MsgBox "Enter the model name."
Exit Sub
End If
If combohard.Text = "" Then
MsgBox "Enter the hard-disk type."
Exit Sub
End If
If Comboram.Text = "" Then
MsgBox "Enter the Ram name."
Exit Sub
End If
If Combomother.Text = " " Then
MsgBox "Enter the motherboard name."
Exit Sub
End If
If ComboProcessor.Text = "" Then
MsgBox "Enter the processor name."
Exit Sub
End If
If Combomonitor.Text = "" Then
MsgBox "Enter the monitor type."
Exit Sub
End If
If txtbuy.Text = "" Then
MsgBox "Enter the Buying value."
Exit Sub
End If
If txtsell.Text = "" Then
MsgBox "Enter the selling value."
Exit Sub
End If
If txtwarranty.Text = "" Then
MsgBox "Enter the Warranty Time."
Exit Sub
End If
sql = "update computersys set company='" & Combocompany.Text & "',model='"
& model.Text & "',categary='" & categary.Text & "',harddisk='" & combohard.Text
& "',ram='" & Comboram.Text & "',motherboard='" & Combomother.Text &
131
132
End Sub
Private Sub lvButtons_H2_Click()
If Text1.Text = "" Then
MsgBox "Please enter the SHOP NAME."
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "Please enter the OWNER NAME."
Exit Sub
End If
If Text3.Text = "" Then
MsgBox "Please enter the Address."
Exit Sub
End If
If text4.Text = "" Then
MsgBox "Please enter the phone number."
Exit Sub
End If
If Text5.Text = "" Then
MsgBox "Please enter the Registration name."
Exit Sub
End If
sql = "update shop set shopname='" & Text1.Text & "',address='" & Text3.Text &
"',owner='" & Text2.Text & "',phonenumber='" & text4.Text &
"',registrationnumber='" & Text5.Text & "'"
'Call insertquery
con.BeginTrans
con.Execute (sql)
con.CommitTrans
MsgBox "Record Updated"
rsshop.Close
sql1 = "select * from shop"
rsshop.Source = sql1
rsshop.Open
Text1.Text = rsshop(0)
Text2.Text = rsshop(2)
Text3.Text = rsshop(1)
text4.Text = rsshop(3)
Text5.Text = rsshop(4)
End Sub
FUTURE SCOPE
The future scope of this software is given below.
133
Bibliography
Books:
1) Programing Microsoft visual basic 6.0
2) Mastering visual basic 6
3) Black book visual basic
4) Complete reference in visual basic 6
5) System analysis and design by elias m. awad
Websites:
1) www.a1vbcode.com
2) www.vbcode.com
3) www.codeguru.com
4) www.vbexpert.com
5) www.1000project.com
134
135