You are on page 1of 9

EXNO:4 STOCK MAINTENANCE SYSTEM

PROBLEM STATEMENT

Stock monitoring system keeps track of the number of items and the quantity of each item present in the
stock. System checks for the availability of the item needed. System decrements the available quantity by
the quantity sold. The system increments the available quantity by the quantity of item purchased. The
system should maintain the history of all purchases and sales.

DATA BASE DESIGN


STOCK MAINTENANCESYSTEM

USE CASE DIAGRAM:

stock view

shopkeeper stock sales NewClass

stock update

CLASS DIAGRAM:

COMPONENT DIAGRAM: DEPLOYMENT DIAGRAM:


ACTIVITY DIAGRAM:

SEQUENCE DIAGRAM:
LAYERED ARCHITECTURE DIAGRAM:
CODINGS:
MAIN FORM:

Private Sub CmdPurchase_click()


Frmpurchase.Show
End Sub

Private Sub cmdview_Click()


FrmStockView.Show
End Sub

PURCHASE FORM:

Dim CLS2 As New Project1.inventory


Private Sub CmdPurchase_click()
Dim Invoiceamount As Integer
Dim purchasequantity As Integer
Dim uniprice As Integer
Invoiceamount = Val(txtpurchqty.Text) * Val(TxtUnitPrice.Text)
purchasequantity = Val(txtpurchqty.Text)
uniprice = Val(TxtUnitPrice.Text)
txtinvamt = Invoiceamount
'bool = CLS2.SavePurchase("cinthol", 5, 5, 125)
bool = CLS2.SavePurchase(txtProduct.Text, purchasequantity, uniprice, Invoiceamount)
End Sub
Private Sub Form_Load()
CLS2.dbcon
End Sub

Private Sub LstName_Click()


i = LstName.ListIndex
CLS2.displayItemInPurchase (LstName.List(i))
TxtAvaiStock.Enabled = False
txtinvamt.Enabled = False
End Sub

STOCKVIEW FORM

Dim CLS1 As New Project1.stockview


Private Sub Form_Load()
CLS1.dbcon
End Sub

Private Sub LstName_Click()


i = LstName.ListIndex
CLS1.displayItem (LstName.List(i))
End Sub

SALES FORM:

Dim Invoiceamount As Integer


Dim salesquantity As Integer
Dim uniprice As Integer
Invoiceamount = Val(txtpurchqty.Text) * Val(TxtUnitPrice.Text)
salesquantity = Val(txtpurchqty.Text)
uniprice = Val(TxtUnitPrice.Text)
txtinvamt = Invoiceamount
bool = CLS3.SavePurchase(txtProduct.Text, salesquantity, uniprice, Invoiceamount)
End Sub
Private Sub Form_Load()
CLS3.dbcon
End Sub

Private Sub LstName_Click()


i = LstName.ListIndex
CLS3.displayItemInSales (LstName.List(i))
TxtAvaiStock.Enabled = False
txtinvamt.Enabled = False
End Sub

CLASS 1:
Option Explicit

Dim db As New ADODB.Connection


Dim rs As New ADODB.Recordset
Public Function dbcon()

db.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Z:\software


engineering\Database3.mdb;Persist Security Info=False"
db.Open
Set rs = db.Execute("select * from StockTab")
Dim i
i=0
While (Not rs.EOF)
Project1.FrmStockView.LstName.AddItem (rs("Name"))
rs.MoveNext
Wend
End Function
Public Function displayItem(Product As String)
Set rs = db.Execute("select * from StockTab where name='" & Product & "'")
Project1.FrmStockView.txtProduct = Product
Project1.FrmStockView.txtavaistock = rs("qty")
Project1.FrmStockView.txtPrice = rs("Unitprice")
End Function

Public Function displayItemInPurchase(Product As String)


Set rs = db.Execute("select * from StockTab where name="" & Product & """)
Project1.Frmpurchase.txtProduct = Product
Project1.Frmpurchase.txtavaistock = rs("qty")
Project1.Frmpurchase.TxtUnitPrice = rs("rate")
End Function

CLASS 2:

Option Explicit

Dim db As New ADODB.Connection


Dim rs As New ADODB.Recordset
Public Function dbcon()
db.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Z:\software
engineering\Database3.mdb;Persist Security Info=False"
db.Open
Set rs = db.Execute("select * from StockTab")
Dim i
i=0
While (Not rs.EOF)
Project1.Frmpurchase.LstName.AddItem (rs("Name"))
rs.MoveNext
Wend
End Function
Public Function displayItemInPurchase(Product As String)
Set rs = db.Execute("select * from StockTab where name='" & Product & "'")
Project1.Frmpurchase.txtProduct = Product
Project1.Frmpurchase.TxtAvaiStock = rs("qty")
Project1.Frmpurchase.TxtUnitPrice = rs("Unitprice")
End Function
Public Function SavePurchase(Product As String, purchasequantity As Integer, unitprice As Integer,
Invoiceamount As Integer)
Dim query As String
query = "insert into purchase(product,unitprice,qty,invoiceamount)values('" & Product & "'," & unitprice
& "," & purchasequantity & "," & Invoiceamount & ")"
db.Execute (query)
query = "update StockTab set unitprice=" & unitprice & ",qty=(qty+" & purchasequantity & ")where
Name= '" & Product & "'"
db.Execute (query)
End Function

CLASS 3:

Option Explicit

Dim db As New ADODB.Connection


Dim rs As New ADODB.Recordset
Public Function dbcon()
db.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Z:\software
engineering\Database3.mdb;Persist Security Info=False"
db.Open
Set rs = db.Execute("select * from stocktab")
Dim i
i=0
While (Not rs.EOF)
Project1.Frmsales.LstName.AddItem (rs("Name"))
rs.MoveNext
Wend
End Function
Public Function displayItemInSales(Product As String)
Set rs = db.Execute("select * from stocktab where name='" & Product & "'")
Project1.Frmsales.txtProduct = Product
Project1.Frmsales.TxtAvaiStock = rs("qty")
Project1.Frmsales.TxtUnitPrice = rs("Unitprice")
End Function
Public Function SavePurchase(Product As String, salesquantity As Integer, unitprice As Integer,
Invoiceamount As Integer)
Dim query As String
query = "insert into sales(product,unitprice,qty,invoiceamount)values('" & Product & "'," & unitprice &
"," & salesquantity & "," & Invoiceamount & ")"
db.Execute (query)
query = "update StockTab set unitprice=" & unitprice & ",qty=(qty-" & salesquantity & ")where Name=
'" & Product & "'"
db.Execute (query)
End Function
OUTPUT

You might also like