Professional Documents
Culture Documents
1. Introduction.
2. System Analysis
5. Design
1
6. Coding
7. Screen Layouts
8. Testing
9. Implementation
10. Maintainence
12. Conclusion
13. Bibliography
2
SECTION 1
INTRODUCTION
3
OBJECTIVES OF THE PROJECT
4
Registers,Destruction of Registers ,Unauthorized access to
registers etc. which can bring in disasterous Consquences.
5
entity and then click the save button with the help of
mouse.However,That central repository of data can be easily
accessed if required.
6
SECTION 2
SYSTEM ANALYSIS
7
System Analysis refers into the process of examining a situation with
the intent of improving it through better procedures and methods.
System Analysis is the process of planning a new System to either
replace or complement an existing system. But before any planning is
done the old system must be thoroughly understood and the
requirements determined. System Analysis, is therefore, the process of
gathering and interpreting facts, diagnosing problems and using the
information to re-comment improvements in the System. Or in other
words, System Analysis means a detailed explanation or description.
Before computerized a system under consideration, it has to be
analyzed. We need to study how it functions currently, what are the
problems, and what are the requirements that the proposed system
should meet.
6. Create a system definition that forms the foundation for all the
subsequent engineering work.
8
2.1 Identification of Customer’s Need
9
are maintained in various hand writtern documents. The hand
written documents invloved in this process are following:
Products Register:
The register is used to record the details of the orders made such
as Order Number,Product Description,Price,Quantity,Total
Amount,Date,Supplier. It also keeps the records of the pending
orders and delivered orders.
10
2.3 Feasibilty Study
11
3. Details of findings :
12
system and programming language used in this localization
process is compatible with the existing one.
13
ii. The system will provide fast and efficient automated
environment instead of slow and error prone manual
system, thus reducing both time and man power
spent in running the system.
iii. The system will have GUI interface and very less user
training is required to learn it.
iv. The system will provide service to view various
information for proper managerial decision making.
14
Behavioral study strives on ensuring that the equilibrium of the
organization and status quo in the organization are nor
disturbed and changes are readily accepted by the users.
• The proposed system provides the facility to pull the data from
the server of the specified Supply order number and get the
respective report.
• User can get the desired output according to their queries .This is
an added advantage.
15
SECTION 3
16
Software Engineering
17
To better manage the development process and to achieve
consistency, it is essential that the software development be done in
phases.
1) Requirement Analysis
2) Software Design
18
The purpose of the design phase is to plan a solution of the problem
specified by the requirements documents. This phase is the first step
in moving from the problem domain to the solution domain. Starting
with what is needed, design takes us toward how to satisfy the
needs. The design of a system is perhaps the most critical factor
affecting the quality of the software. It has a major impact on the
later phases, particularly testing and maintenance.
The design activity is divided into two phases: System Design and
Detailed Design. In system design the focus is on identifying the
modules, whereas during detailed design the focus is on designing
the logic for each of the modules.
3) Coding
The goal of the coding phase is to translate the design of the system
into code in a given programming language. Hence during coding,
the focus should be on developing programs that are easy to read
and understand, and not simply on developing programs that are
easy to write.
4) Testing
19
test cases. The error report describes the errors encountered and
the action taken to remove the errors.
5) Implementation
It is the process of having systems personnel check out and put new
equipment into use, train users, install the new application and
construct any files of data needed to use it. This phase is less
creative than system design. Depending on the size of the
organization that will be involved in using the application and the
risk involved in its use, systems developers may choose to test the
operation in only one area of the firm with only one or two persons.
Sometimes, they will run both old and new system in parallel way to
compares the results.
Paradigm Applied
20
the waterfall model. The spiral model is intended for large, expensive
and complicated projects.
21
represents an approximation of the characteristics of the final
product.
Applications
The spiral model is used most often in large projects. For smaller
projects, the concept of agile software development is becoming a
viable alternative.
22
Advantages
SECTION 4
23
The Methodology:
Topic Understanding:
24
Different Modules In Computerised System
In this module, User can see the ordering details which includes :
i. Order Number
ii. Supplier
iii. Date
iv. Product:
♦ Product code
♦ Product Name
♦ Quantity
♦ Unit Price
♦ Units in Stock
♦ Total Amount
Then as per the user requirements processes are performed.
25
In this module user can see the sales details including the fields:
i. Customer type:
♦ Regular
♦ Non regular
ii. Customer number
iii. Name
26
• Module 4: Customer’s Records
27
• Module 6:Order list Module
This module gives the list of the orders that are delivered.
Fields include
i. Order number
ii. Product description
iii. Price
iv. Quantity
v. Total amount
vi. Date
vii. Supplier
28
v. Total
vi. Date
vii. Customer type
Inventory management
System
29
differently.
Visual Basic has the following traits which differ from C-derived
languages:
• Logical and bitwise operators are unified. This is unlike all the C-
derived languages (such as Java or Perl), which have separate
logical and bitwise operators. This again is a traditional feature of
BASIC.
30
confusion when reading Visual Basic code and is best avoided by
always explicitly specifying the lower bound of the array. This
lower bound is not limited to 0 or 1, because it can also be set by
declaration. In this way, both the lower and upper bounds are
programmable. In more subscript-limited languages, the lower
bound of the array is not variable. This uncommon trait does
exist in Visual Basic .NET but not in VBScript.
31
INTRODUCTION OF Microsoft Access-2003
32
statement per procedure.Microsoft Access does allow forms to contain
code that is triggered as changes are made to the underlying table (as
long as the modifications are done only with that form), and it is
common to use pass-through queries and other techniques in Access to
run stored procedures in RDBMSs that support these.
33
SECTION 5
DESIGN
34
5.1 DATA FLOW DIAGRAM (DFD)
DFD is a model, which gives the insight into the information domain
and functional domain at the same time. DFD is refined into
different levels. The more refined DFD is, more details of the
system are incorporated. In the process of creating a DFD, we
decompose the system into different functional subsystems. The
DFD refinement results in a corresponding refinement of data.
Following is the DFD of the “Inventory Management System”. We
have refined the system up to two levels. Each break-up has been
numbered as per the rule of DFD. We have tried to incorporate all
the details of the system but there is some chance of further
improvisation because of the study that is still going on for the
project development.
Ordering
Database Operations on
products record
Sales
Database Operations on
sales record
Suppliers
Member’s Record
INVENTORY
MANAGEMENT Database Operations on
SYSTEM customers record
Customer,s Records
Database Operations on
Products Records products record
Transaction Performed
35
Orders List
Sales List
Deliveries
36
Context Level or Zero Level DFD
This level shows the overall context of the system and it's operating
environment and shows the whole system as just one process. It does
not usually show data stores, unless they are "owned" by external
systems, e.g. are accessed by but not maintained by this system,
however, these are often shown as external entities.
Level 1 DFD
37
5.2 DATABASE DESIGN
Introduction
• Database
• Relational database
38
from it, and let the database management system software take
care of describing data structures for storing the data and
retrieval procedures for getting queries answered.
• Database Tables
39
List of Tables in Database:
Table 1: ORDERS
40
Table 2: SALES
41
Table 3: SUPPLIERS
42
Table 4: CUSTOMERS
43
Table 5: PRODUCTS
44
Table 6: ORDER_TOTAL
45
Table 7: SALES_TOTAL
46
Table 8: DELIVERED
47
5.3 Logical Design(Flowcharts)
Start
Obtain Details of
Products Store
Yes
Input
Data to
Dbase
ons
Transacti
perform
Want to
No
Want to Perform
view
previous
Obtain Details searching
Details and sorting
operations
48
End
Start
Obtain Details of
customers Store
Yes
Input
Data to
Dbase
s
Transaction
perform
Want to
No
Want to Perform
Obtain Details searching and
view
previous sorting
Details operations
End
49
Module 3:Supplier Details
Start
Obtain Details of
the suppliers Store
Yes
Input
Data to
Dbase
s
Transaction
perform
Want to
No
End
50
5.4 ENTITY-RELATIONSHIP DIAGRAM
51
Cust_nu
m
Cust_name
Sell_pric ROP
price
e Cust_tel
Exp_date
quantity
Cust_ad
Prod_des d
c
Prod_des
c
price
orderno
total
supplier quantity
date
price
SUPPLIER SALES
total
Sup_id
salesno
items customer
Sup_name
sdate
Prod_des
Sup_te c
contact l
Sup_add
52
SECTION 7
SCREEN LAYOUTS
53
ORDERING
54
SALES
55
56
SUPPLIERS
1.ADD
57
2.EDIT
58
3.DELETE
CUSTOMERS
59
1.ADD/EDIT
60
2.DELETE
61
62
PRODUCTS
1.ADD/EDIT
63
2.DELETE
64
PRODUCTS LIST
PENDING
DELIVERED
65
SALES LIST
66
SECTION 8
TESTING
Levels of Testing:
Systems are not designed as entire systems nor are they tested as
single systems. The analyst must perform both unit and system testing.
Unit Testing:
67
to different types of inquiries or print reports. The test cases
needed for unit testing should exercise each condition and option.
Unit testing can be performed from the bottom up, starting with
smallest and lowest-level modules and proceeding one at a time.
For each module in bottom-up testing a short program is used to
execute the module and provides the needed data, so that the
module is asked to perform the way it will when embedded within
the larger system.
System Testing:
68
Testing is an important function to the success of the system.
System testing makes a logical assumption that if all the parts of
the system are correct, the goal will be successfully activated.
Another reason for system testing is its utility as a user-oriented
vehicle before implementation.
1) Program Testing
69
contained portions, each of which can be checked at certain key
points.
2) String Testing
3) System Testing
4) System Documentation
70
procedures operate to system specifications and that the integrity
of important data is maintained. Performance of an acceptance
test is actually the user's show. User motivation is very important
for the successful performance of the system. After that a
comprehensive test report is prepared. This report shows the
system's tolerance, performance range, error rate and accuracy.
There are other six tests which fall under special category. They are
described below:
71
Procedure Testing: It determines the clarity of documentation
on operation and use of system by having users do exactly what
manuals request. For example, powering down system at the end
of week or responding to paper-out light on printer.
Human Factors Testing: It determines how users will use the
system when processing data or preparing reports.
SECTION 9
IMPLEMENTATION
72
After completing the packaging process and produced distribution
media for the application, The application requires perfectly working
Microsoft Visual Studio 6.0 installed on the client system along with Ms
Offfice Access. It can run on all applicable operating systems.
73
Printer: DeskJet 670 C
IMPLEMENTATION
74
Implementation of a computer system to replace a manual
system
Implementation of a new computer system to replace an existing
one.
Implementation of a modified application to replace an existing
one.
Conversion
Direct Implementation
75
The proposed system “Inventory Management” is fully
implemented using Direct Implementation.
SECTION 10
MAINTAINENCE
76
MAINTENANCE
77
changes-to both the code and documents-testing the new parts and
retesting the old part.
SECTION 11
78
Limitations of the Project
79
Not protected as anybody can view the transactions and the
details of various customers and can also modify them.
SECTION 12
CONCLUSION
80
The objective of this project was to build a program for maintaining the
details of all Supply Order .The system developed is able to meet all the
basic requirements. It will provide the facility to the user so that they
can keep tracks of all the equipments being supplied. The management
of the Inventory will be also benefited by the proposed system, as it
will automate the whole supply procedure, which will reduce the
workload. The security of the system is also one of the prime concerns.
81
further changes. Every effort has been made to cover all user
requirements and make it user friendly.
SECTION 13
82
BIBLIOGRAPHY
Bibliography
• www.wikipedia.com
• www.codeproject.com
• Visual Basic 6 Programming BIBLE by Eric A.Smith, Valor Whisler,
and Hank Marquis.
• www.msdn.com
• Introduction to Computers:Working with Access By Sanjay
Saxena.
83
SECTION 6
CODING
84
85
FORM2:CUSTOMER DATA
Private Sub cmdexit_Click()
Unload Me
End Sub
86
cnn.Execute "insert into customers values(" & cID & ", '" &
data(1) & "', '" & _
data(2) & "', '" & data(3) & "')"
rs.Requery 1
customers.fill
Unload Me
End Sub
87
FORM3:CUSTOMER LIST
Public mowd As String
End Sub
88
End Sub
fill
End Sub
End Sub
89
FORM4:PRODUCT DATA
Public key As String
Public pid As Integer
pid = 0
If main.mowd = "add" Then
pid = pid + 1
If rstemp.State = 1 Then rstemp.Close
rstemp.Open "Select * from products where prod_id = " & pid,
cnn
rstemp.Requery 1
Wend
End If
If IsDate(data(6).Text) = False Then
MsgBox "Please enter a valid date.", vbOKOnly
Exit Sub
End If
90
cnn.Execute "insert into products values (" & pid & ",'" &
data(1) & "'," & _
data(2) & "," & data(3) & "," & data(4) & "," & data(5) & ",'"
& data(6) & "')"
''main.check_RS
''rs.Open "select * from products", cnn
ElseIf main.mowd = "edit" Then
cnn.Execute "update products set prod_id = " & data(0) & ",
prod_desc = '" & _
data(1) & "', quantity = " & data(2) & ", price =" & data(3) &
", sell_price = " & _
data(4) & ", ROP = " & data(5) & ", exp_date = '" & data(6) &
"' " & " where prod_id =" & key
End If
rs.Requery 1
main.fill_list
main.cmdROP.Caption = "Switch to Normal mode"
main.rop
Unload Me
Exit Sub
oHINDE:
MsgBox Err.Description
End Sub
91
End Sub
Public Sub UnFreeze()
Dim x As Integer
For x = 0 To 6
data(x).Enabled = True
Next x
cmdsave.Enabled = True
cmdexit.Enabled = True
End Sub
End Sub
92
data(2) = "0"
End If
End Sub
93
FORM5:ORDER PLACEMENT FORM
Public Onum As Integer
Public Order_total As Currency
Public ayos As Boolean
check_RS
rs.Open "select prod_id, prod_desc, products.price,
products.quantity from products where prod_desc = '" &
cmbProd.Text & "'", cnn
For x = 0 To 3
data(x) = rs(x)
Next x
End Sub
update_PROD
End Sub
94
Private Sub cmdexit_Click()
Unload Me
End Sub
95
cmbProd.RemoveItem (cmbProd.ListIndex)
cmbProd.Refresh
cmbsup.Locked = True
For x = 0 To 5
data(x) = ""
Next x
96
Exit Sub
hell:
MsgBox Err.Description
End Sub
Wend
Onum = 1
While ayos <> True
check_RS
rs.Open "select * from orders", cnn
While rs.RecordCount <> 0
check_RS
rs.Open "select * from orders where orders.orderno =" &
Onum, cnn
If rs.RecordCount <> 0 Then
Onum = Onum + 1
End If
Wend
97
check_RStemp
rstemp.Open "select * from delivered where delivered.orderno
= " & Onum, cnn
If rstemp.RecordCount <> 0 Then
While rstemp.RecordCount <> 0
check_RStemp
Onum = Onum + 1
rstemp.Open "select * from delivered where
delivered.orderno = " & Onum, cnn
Wend
End If
check_RS1
rs1.Open "Select * from orders where orders.orderno = " &
Onum, cnn
If rs1.RecordCount = 0 Then ayos = True
Wend
txtOrder = Onum
update_Olist
End Sub
check_RS1
rs1.Open "select sup_name from supplier where items like '%"
& cmbProd.Text & "%' order by sup_name asc ", cnn
If rs1.RecordCount = 0 Then
cmdGO.Enabled = False
If Me.Visible = True Then
MsgBox "there is no supplier for this product!"
'cmdGO.Enabled = False
Exit Sub
98
End If
Else
While Not rs1.EOF
cmbsup.AddItem (rs1(0))
rs1.MoveNext
Wend
End If
If cmbsup.ListCount <> 0 Then
cmbsup.ListIndex = 0
cmdGO.Enabled = True
End If
End Sub
99
Olist.ListItems.Clear
check_RS1
rs1.Open "Select * from orders where orderno = " & Onum
End Sub
100
FORM6:LIST OF PRODUCTS SUPPLIED AND NOT
SUPPLIED
Public mowd As String
Public key As String
Public sID As Integer
max = List1.ListCount
For x = 0 To max - 2
str1 = str1 & List1.List(x) & ","
Next x
101
txtprod = str1 & List1.List(max - 1)
End If
UnFreeze
data(1).SetFocus
Frame1.Visible = False
End Sub
If List1.SelCount = 0 Then
MsgBox " <-- Please select a Product from the list."
Exit Sub
End If
List2.AddItem (List1.Text)
List1.RemoveItem (List1.ListIndex)
Exit Sub
MALI:
MsgBox Err.Description
End Sub
sID = 0
If mowd <> "edit" Then
102
sID = sID + 1
If rstemp.State = 1 Then rstemp.Close
rstemp.Open "Select * from supplier where sup_id = " & sID,
cnn
rstemp.Requery 1
Wend
End If
Else
cnn.Execute "insert into supplier values(" & sID & ",'" &
data(1) & "','" & _
data(2) & "','" & data(3) & "','" & data(4) & "','" & txtprod &
"')"
End If
'check_RS1
rs1.Requery 1
frmSupp.fill_list
Unload Me
Exit Sub
oHinde2:
MsgBox Err.Description
End Sub
103
'check_RS1
'rs1.Open "select * from supplier where sup_name = '" &
cmbsup.Text & "'", cnn
List1.Clear
List2.Clear
check_RS
rs.Open "select * from products", cnn
End If
rs.MoveNext
Wend
Else
While Not rs.EOF
'List1.AddItem (rs(1))
List2.AddItem (rs(1))
rs.MoveNext
Wend
End If
End Sub
104
End Sub
105
FORM7:SUPPLIER DATA FORM
Public ano As String
For x = 1 To 5
lst.SubItems(x) = rs1(x)
Next x
rs1.MoveNext
Wend
End Sub
End Sub
End Sub
106
Private Sub cmddel_Click()
If MsgBox("Do you really want to delete " &
SUPlist.SelectedItem.SubItems(1), vbYesNo) = vbYes Then
cnn.Execute "delete from supplier where sup_id = " &
SUPlist.SelectedItem.Text
rs1.Requery
fill_list
End If
End Sub
check_RS1
rs1.Open "select * from supplier", cnn
fill_list
End Sub
107
If cmbsearch.ListIndex = -1 Then cmbsearch.ListIndex = 0
If cmbOrder.ListIndex = -1 Then cmbOrder.ListIndex = 0
If cmbsort.ListIndex = -1 Then cmbsort.ListIndex = 0
108
Dasc = " asc"
Case 1
Dasc = " desc"
End Select
check_RS1
rs1.Open "select * from supplier where " & sby & " like '" &
txtsearch & "%' order by " & _
oby & Dasc, cnn
rs1.Open "Select * from supplier where " & sby & " like " &
txtsearch & " order by " & oby & Dasc, cnn
End If
rs1.Requery 1
fill_list
109
End Sub
End If
End Sub
110
FORM8:PRODUCT INFORMATION FORM
Public mowd As String
Public sby, oby, Dasc As String
End Sub
Load frmData
frmData.Show 1
End Sub
111
End If
End Sub
End Sub
Public Sub rop()
If cmdROP.Caption = "Switch to ROP mode" Then
invlist.ForeColor = vbRed
Me.Caption = "Products - ROP MODE"
txtsearch.Enabled = False
cmbsearch.Enabled = False
cmdROP.Caption = "Switch to Normal mode"
112
Case 2
oby = "quantity"
Case 3
oby = "price"
Case 4
oby = "ROP"
Case 5
oby = "exp_date"
End Select
Else
Me.Caption = "Products - NORMAL MODE"
invlist.ForeColor = vbBlack
txtsearch = ""
txtsearch.Enabled = True
cmbsearch.Enabled = True
End If
113
End Sub
Private Sub cmdROP_Click()
rop
End Sub
rs.MoveNext
Wend
End Sub
114
Dim sby, oby, Dasc As String
'On Error GoTo uklo
If cmbsearch.ListIndex = -1 Then cmbsearch.ListIndex = 0
If cmbOrder.ListIndex = -1 Then cmbOrder.ListIndex = 0
If cmbsort.ListIndex = -1 Then cmbsort.ListIndex = 0
115
Select Case cmbsort.ListIndex
Case 0
Dasc = " asc"
Case 1
Dasc = " desc"
End Select
check_RS
If cmbsearch.ListIndex = 1 Or cmbsearch.ListIndex = 5 Then
rs.Open "select * from products where " & sby & " like '" &
txtsearch & "%' order by " & _
oby & Dasc, cnn
Else
' If txtsearch = "" Then
' check_RS
' rs.Open "select * from products", cnn
' fill_list
' Exit Sub
If Not IsNumeric(txtsearch) Or txtsearch = "" Then
'MsgBox "Please enter a numeric " & cmbsearch.Text
check_RS
rs.Open "Select * from products where prod_desc like '%'
order by " & oby & Dasc, cnn
fill_list
Exit Sub
End If
rs.Open "Select * from products where " & sby & " like " &
txtsearch & " order by " & oby & Dasc, cnn
End If
rs.Requery 1
fill_list
End Sub
116
Dim x
If rs.RecordCount = 0 Then Exit Sub
mowd = "edit"
For x = 1 To 6
frmData.data(x) =
invlist.SelectedItem.ListSubItems.Item(x).Text
Next x
check_RS1
'rs1.Open "Select * from supplier where sup_name = '" &
invlist.SelectedItem.ListSubItems.Item(7).Text & "'", cnn
'frmData.data(8) = rs1(0)
frmData.data(0) = invlist.SelectedItem.Text
frmData.key = frmData.data(0)
Load frmData
frmData.Show 1
End Sub
117
FORM1:MAIN MENU FORM
Private Sub Form_Load()
connect
End Sub
Case "customers"
Load customers
customers.Show 1
Case "SLIST"
Load Sales_LIST
Sales_LIST.Show 1
Case "sales"
Load sales
sales.Show 1
Case "suppliers"
frmSupp.ano = ""
Load frmSupp
frmSupp.Show 1
Case "products"
Load main
main.Show 1
Case "order"
Load frmOrder
118
frmOrder.Show 1
Case "list"
Load OrderPEND
OrderPEND.Show 1
Case "deliver"
Load Orderdel
Orderdel.Show 1
Case "exit"
End
End Select
End Sub
119
FORM9:LIST OF DELIEVERED ORDERS
rs.Requery
fill
End If
End Sub
120
check_RS
rs.Open "Select * from delivered where delivered.orderno = "
& txtsearch, cnn
fill
End Sub
Public Sub fill()
Dim x As Integer
ORDERlist.ListItems.Clear
For x = 1 To 5
lst.SubItems(x) = rs(x)
Next x
check_RStemp
rstemp.Open "select sup_name from supplier where sup_id
= " & rs(6), cnn
lst.SubItems(6) = rstemp(0)
rs.MoveNext
Wend
If txtsearch <> "" Then
check_RStemp
rstemp.Open "select * from order_total where order_no =" &
txtsearch
If rstemp.RecordCount <> 0 And rs.RecordCount <> 0 Then
Set lst = ORDERlist.ListItems.Add(, , "")
lst.SubItems(3) = "Total Amount: "
lst.SubItems(4) = rstemp(1)
End If
End If
End Sub
121
FORM10:PENDING ORDERS FORM
rs.Requery
fill
End If
End Sub
122
check_RS
rs.Open "Select * from delivered where delivered.orderno = "
& txtsearch, cnn
fill
End Sub
Public Sub fill()
Dim x As Integer
ORDERlist.ListItems.Clear
For x = 1 To 5
lst.SubItems(x) = rs(x)
Next x
check_RStemp
rstemp.Open "select sup_name from supplier where sup_id
= " & rs(6), cnn
lst.SubItems(6) = rstemp(0)
rs.MoveNext
Wend
If txtsearch <> "" Then
check_RStemp
rstemp.Open "select * from order_total where order_no =" &
txtsearch
If rstemp.RecordCount <> 0 And rs.RecordCount <> 0 Then
Set lst = ORDERlist.ListItems.Add(, , "")
lst.SubItems(3) = "Total Amount: "
lst.SubItems(4) = rstemp(1)
End If
End If
End Sub
123
FORM11:SALES LIST FORM
Public sID As Integer
Public Gtotal As Currency
check_RStemp
rstemp.Open "select * from sales where salesno = " & sID, cnn
While Not rstemp.EOF
Set lst = sellist.ListItems.Add(, , rstemp(1), , 1)
For x = 1 To 3
lst.SubItems(x) = rstemp(x + 1)
Next x
rstemp.MoveNext
Wend
Set lst = sellist.ListItems.Add(, , "")
lst.SubItems(2) = "Total amount: "
lst.SubItems(3) = Gtotal
End Sub
Private Sub cmbcus_Click()
If cmbcus.ListIndex = 0 Then
txtnum.Visible = True
txtname.Visible = True
Label1(0).Visible = True
Label1(1).Visible = True
End If
End Sub
124
Private Sub cmdexit_Click()
Unload Me
End Sub
fill1
sID = 1
check_RS1
rs1.Open "select * from sales", cnn
If rstemp.RecordCount = 0 Then
125
If Val(rs(2)) = 0 Then lst.SubItems(2) = "OUT OF
STOCK"
Next x
For x = 3 To 5
lst.SubItems(x) = rs(x + 1)
Next x
Else
End If
rs.MoveNext
Wend
End Sub
tempQTY = "0"
While Val(tempQTY) > Val(invlist.SelectedItem.SubItems(2))
Or tempQTY = "0" Or IsNumeric(tempQTY) = False
126
tempQTY = InputBox("Please enter the quantity.. ",
invlist.SelectedItem.ListSubItems(1))
Wend
tutal = Val(tempQTY) *
Val(invlist.SelectedItem.ListSubItems(3))
Gtotal = Gtotal + tutal
If cmbcus.ListIndex = 0 Then
tempNUM = txtnum
Else
tempNUM = 0
End If
cnn.Execute "insert into sales values(" & sID & ",'" &
invlist.SelectedItem.ListSubItems(1) & "'," & _
tempQTY & "," & invlist.SelectedItem.ListSubItems(3) & ","
&_
tutal & ", '" & Date & "' , " & tempNUM & ")"
tempQ = Val(invlist.SelectedItem.ListSubItems(2)) -
Val(tempQTY)
cnn.Execute "update products set quantity = " & tempQ & "
where prod_id = " & invlist.SelectedItem.Text
check_RS1
127
rs1.Open "select * from sales_total where sales_no = " & sID,
cnn
If rs1.RecordCount = 0 Then
cnn.Execute "insert into sales_total values (" & sID & "," &
Gtotal & ")"
Else
cnn.Execute "update sales_total set s_total = " & Gtotal & "
where sales_no = " & sID
End If
fill2
rs.Requery 1
fill1
txtnum.Locked = True
cmbcus.Locked = True
End Sub
128
End If
check_RStemp
rstemp.Open "select * from customers where cus_num = " &
txtnum, cnn
If rstemp.RecordCount = 0 Then
txtname = ""
Else
txtname = rstemp(1)
End If
Exit Sub
L:
MsgBox Err.Description
End Sub
129
FORM12:SALES LIST DATA
Public sID As Integer
Public Gtotal As Currency
check_RStemp
rstemp.Open "select * from sales where salesno = " & sID, cnn
While Not rstemp.EOF
Set lst = sellist.ListItems.Add(, , rstemp(1), , 1)
For x = 1 To 3
lst.SubItems(x) = rstemp(x + 1)
Next x
rstemp.MoveNext
Wend
Set lst = sellist.ListItems.Add(, , "")
lst.SubItems(2) = "Total amount: "
lst.SubItems(3) = Gtotal
End Sub
Private Sub cmbcus_Click()
If cmbcus.ListIndex = 0 Then
txtnum.Visible = True
txtname.Visible = True
Label1(0).Visible = True
Label1(1).Visible = True
End If
End Sub
130
Private Sub cmdexit_Click()
Unload Me
End Sub
fill1
sID = 1
check_RS1
rs1.Open "select * from sales", cnn
If rstemp.RecordCount = 0 Then
131
If Val(rs(2)) = 0 Then lst.SubItems(2) = "OUT OF
STOCK"
Next x
For x = 3 To 5
lst.SubItems(x) = rs(x + 1)
Next x
Else
End If
rs.MoveNext
Wend
End Sub
tempQTY = "0"
While Val(tempQTY) > Val(invlist.SelectedItem.SubItems(2))
Or tempQTY = "0" Or IsNumeric(tempQTY) = False
132
tempQTY = InputBox("Please enter the quantity.. ",
invlist.SelectedItem.ListSubItems(1))
Wend
tutal = Val(tempQTY) *
Val(invlist.SelectedItem.ListSubItems(3))
Gtotal = Gtotal + tutal
If cmbcus.ListIndex = 0 Then
tempNUM = txtnum
Else
tempNUM = 0
End If
cnn.Execute "insert into sales values(" & sID & ",'" &
invlist.SelectedItem.ListSubItems(1) & "'," & _
tempQTY & "," & invlist.SelectedItem.ListSubItems(3) & ","
&_
tutal & ", '" & Date & "' , " & tempNUM & ")"
tempQ = Val(invlist.SelectedItem.ListSubItems(2)) -
Val(tempQTY)
cnn.Execute "update products set quantity = " & tempQ & "
where prod_id = " & invlist.SelectedItem.Text
check_RS1
133
rs1.Open "select * from sales_total where sales_no = " & sID,
cnn
If rs1.RecordCount = 0 Then
cnn.Execute "insert into sales_total values (" & sID & "," &
Gtotal & ")"
Else
cnn.Execute "update sales_total set s_total = " & Gtotal & "
where sales_no = " & sID
End If
fill2
rs.Requery 1
fill1
txtnum.Locked = True
cmbcus.Locked = True
End Sub
134
End If
check_RStemp
rstemp.Open "select * from customers where cus_num = " &
txtnum, cnn
If rstemp.RecordCount = 0 Then
txtname = ""
Else
txtname = rstemp(1)
End If
Exit Sub
L:
MsgBox Err.Description
End Sub
135
MODULE CODING:
'Practicum 2
Public cnn As New ADODB.Connection
Public rs As New ADODB.Recordset
Public rs1 As New ADODB.Recordset
Public rstemp As New ADODB.Recordset
Public lst As ListItem
cnn.CursorLocation = adUseClient
If rs.State = 1 Then rs.Close
'cnn.Open "provider=MSDASQL.1;Persist Security
Info=False;Data Source=invent"
'Exit Sub
ado2:
'If MsgBox("MSDASQL failed to connect to System Database
""Invent""! Please configure it properly in the control panel or
click Ok to try to connect to the database using " & _
'"Microsoft Jet Driver...", vbOKCancel, "Cant connect!!!") =
vbOK Then
136
End Sub
137