Professional Documents
Culture Documents
Software Development
For
Point of Sale System of Construction Materials Shop
Presented by
DSE Batch-32
Group III
Project Report
August 2016
Member List
ROLL NO
Name
Duty List
DSE-30
Leader
DSE-40
Co-leader
DSE-28
Member
DSE-32
Member
ACKNOWLEDGEMENT
We are the students attending at the specialization course of Diploma in
Software Engineering. This is jointly sponsored by the National Management
Collage and Winner Computer Group in Botahtaung Township.
We particularly wish to respect all our teachers were teaching us from the
beginning of this course to now and here. Without their guidance, management
and encouragement, we havent been developed this Project. And we also thank
the manager, staffs and all of the people who have directly or indirectly took
interest to complete my project file.
Contents
Page
Chapter (1)
INTRODUCTION
1.1
Introduction
1.2
Objectives
1.3
1.4
Proposed System
1.5
Feasibility
1.5.1
Economic Feasibility
1.5.2
Operational Feasibility
1.5.3
Technical Feasibility
1.6
System Requirements
1.7
Time Schedule
Chapter (2)
10
2.1
Content Diagram
11
2.2
11
2.3
14
2.4
18
2.5
Normalization
19
2.5.1
Unnormalization
19
3
2.5.2
First Normalizaion
21
2.5.3
Second Normalization
23
2.6
25
Chapter (3)
28
3.1
Structure Chart
29
3.2
Pseudo Code
30
3.3
33
Chapter (4)
CONCLUSION
71
4.1
Conclusion
72
4.2
72
4.3
Future Extensions
72
Chapter (1)
Introduction
1.1
Introduction
In the world of developing the information technology, most of people in Myanmar
are changing to use computerized system instead of manual system. Our project title is Point
of Sale System of construction material shop. By using our software, users can analyze sales
records, and figure out how well all the items in the shop sell. Also, they can maintain and
review sales histories easily.
We used Microsoft Visual Basic 2010 and Microsoft Access Database.
1.2
Objectives
To enhance the manual system to computerized system.
To service quickly and efficiently.
To reduce human work power and uses of paper.
To review sales histories easily and quickly at anytime without losing data
records.
1.3
1.4
Proposed system
In the proposed system, we will able to:
Reduce unnecessary paper works.
Speed-up searching the data records.
Reduce errors and time.
Let the users know in hand stocks and buying prices within a short time.
Give essential reports to manager in time.
1.5
Feasibility
1.6
System Requirements
CPU
Intel Pentium 4
Memory
1GB
Hard Disk
Operation System
Window 7
Required Application
Monitor
Keyboard
USB/Classic Keyboard
Pointing Device
USB Mouse
Printer
Injector or Laser
June
3rd
4th
week week
July
1st
week
2nd
week
3rd
week
4th
week
August
1st
2nd
3rd
week week week
Planning
Analysis
Design
Coding and
implemention
Testing
Documentation
Chapter (2)
System Analysis and Design
10
11
2.2
12
13
14
2.3
15
16
17
18
2.4
19
2.5
Normalization
2.5.1 Unnormalization
ItemID
ItemName
ItemType
Price
Quantity
WarehouseNo
ItemTypeID
ItemTypeName
CustomerID
CustomerName
Phone
City
Township
Street
HomeNo
VoucherNo
SaleDate
CustomerID
ItemType
ItemName
Quantity
Price
Totalprice
OrderID
OrderDate
20
ItemID
ItemName
Quantity
Price
TotalPrice
OrderID
OrderDate
CustomerID
DeliveryDate
21
ItemID
ItemName
Quantity
Price
TotalPrice
OrderID
OrderDate
CustomerID
DeliveryDate
23
Table :ItemType
ItemTypeID
ItemTypeName
Table : Customer
CustomerID
CustomerName
Phone
City
Township
Street
HomeNo
Table : Sale
VoucherID
SaleDate
CustomerID
24
ItemID
Quantity
Price
Amount
Table :SaleLine
VoucherID
TotalPrice
Table :OrderDetail
OrderID
ItemID
Quantity
Price
Amount
Table :OrderLine
OrderID
OrderedDate
CustomerID
DeliveryDate
TotalPrice
ConfirmDelivery
25
2.6
Table : Item
Attribute Name
ItemID
ItemTypeID
ItemName
Price
Quantity
WarehouseNo
Data Type
Char(5)
Char(4)
VarChar(25)
Number(9)
Number(5)
Char(2)
Remark
Primary Key
Foreign Key
Reference Table
Data Type
Char(4)
Char(25)
Remark
Primary Key
Reference Table
Data Type
Char(5)
Varchar(25)
Char(11)
Char(20)
Char(25)
Char(20)
Char(4)
Remark
Primary Key
Reference Table
Data Type
Char(5)
Char(5)
Date/time
Char(5)
Number(5)
Number(9)
Number(9)
Remark
Primary Key
Foreign Key
Reference Table
Foreign Key
Item Table
Data Type
Char(5)
Remark
Foreign Key
Reference Table
Sale Table
ItemType Table
Table: ItemType
Attribute Name
ItemTypeID
ItemTypeName
Table: Customer
Attribute Name
CustomerID
CustomerName
CustomerPhone
CustomerStreet
CustomerTownship
CustomerCity
CustomerHomeNo
Table: Sale
Attribute Name
VoucherID
CustomerID
SaleDate
ItemID
Quantity
Price
Amount
Customer Table
Table :SaleLine
Attribute Name
VoucherID
26
TotalPrice
Number(9)
Table: OrderDetail
Attribute Name
OrderID
ItemID
Quantity
Price
Amount
Data Type
Char(6)
Char(5)
Number(5)
Number(9)
Number(9)
Remark
Foreign Key
Foreign Key
Reference Table
Item Table
Table: OrderLine
Attribute Name
OrderID
OrderedDate
CustomerID
DeliveryDate
TotalPrice
Data Type
Char(6)
Date/time
Char(5)
Date/time
Number(9)
Remark
Primary
Reference Table
Sale Table
Foreign Key
Customer Table
27
Chapter-3
Form Design and Implementation
28
3.1
Structure Chart
29
3.2
Pseudo Code
Login_Program
Open Login_Form
Prompt UserName and Password
Get UserName and Password
Read Login record
IF UserName= AND Password = THEN
Display Enter User Name and Password
ELSE
IF UserName = THEN
Display Enter User Name
ELSE
IF Password = THEN
Display Enter User Name
ELSE
IF UserName = data_username
AND Password = data_password THEN
Display Main_Form
ELSE
Display Incorrect User Name or Password!
30
ENDIF
ENDIF
ENDIF
ENDIF
END
Add_Items_Information
PromptItem_ID,Item_Type_Name, Item_Name, Price, Quantity, Warehouse
Get Item_ID,Item_Type_Name, Item_Name, Price, Quantity, Warehouse
Save Item Information
END
Add_Item_Type
Prompt Item_ID, Item_Type_Name, Warehouse
GetItem_ID, Item_Type_Name, Warehouse
Save Item Type Information
END
Save_Sales_Information
Prompt VoucherID, Saledate, ItemID, Quantity, UnitPrice
Get VoucherID, Saledate, ItemID, Quantity, UnitPrice
Amount = UnitPrice * Quantity
Save Sales Information
Print Sales Information
END
31
Add_Customers_Information
Prompt CustomerID, CustomerName, PhoneNumber, Street, City, HomeNumber
Get CustomerID, CustomerName, PhoneNumber, Street, City, HomeNumber
Save Customer Information
END
Add_Order
Prompt OrderID, DeliveryDate, CustomerID,CustomerName, ItemID, Quantity
Get OrderID, DeliveryDate, CustomerID,CustomerName, ItemID, Quantity
Calculate Amount, Total
SaveOrderInformation
Print order Information
END
32
3.3
Login_Form
Main_Form
33
Sale_Form
34
Add_Order_Form
View_Order_Form
35
Edit_Order_Form
Order_Change_Form
Item_Form
36
Add_Item_Form
37
Edit_Item_Form
Item_Type_Form
38
Customer_Form
Add_Customer_Form
39
Edit_Customer_Form
Reports_Form
40
Login_Form
41
43
Sale_Form
Imports System.Data
Imports System.Data.SqlClient
Public Class Sale_Form
Dim connection As New OleDb.OleDbConnection
Dim ds As DataSet
Dim dt As New DataTable
Dim dr As DataRow
Dim count As New Integer
Private Sub addBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles addBtn.Click
If txtItemID.Text <> "" Then
Dim q As Integer
ds = SelectData("Select * from Item where Itemid='" & txtItemID.Text
& "'")
q = ds.Tables(0).Rows(0).Item(4)
If txtQuantity.Text > q Then
MessageBox.Show("Quantity is not enough")
ElseIf txtQuantity.Text = "" Then
Else
ds = SelectData("Select * from Item where Itemid='" &
txtItemID.Text & "'")
Dim itemquantity As Integer = ds.Tables(0).Rows(0).Item(4) txtQuantity.Text
SaveData("Update Item Set Quantity=" & itemquantity & " where
Itemid='" + txtItemID.Text + "'")
Dim amount, total As Long
Dim rowNum As Integer = DataGridView1.Rows.Add()
DataGridView1.Rows.Item(rowNum).Cells(0).Value = txtItemID.Text
DataGridView1.Rows.Item(rowNum).Cells(1).Value =
txtItemType.Text
DataGridView1.Rows.Item(rowNum).Cells(2).Value =
txtItemName.Text
DataGridView1.Rows.Item(rowNum).Cells(3).Value =
txtQuantity.Text
DataGridView1.Rows.Item(rowNum).Cells(4).Value = txtPrice.Text
DataGridView1.Rows.Item(rowNum).Cells(5).Value =
txtAmount.Text
44
total = txtTotal.Text
amount = txtAmount.Text
total = total + amount
txtTotal.Text = total
txtItemID.Text = ""
txtItemType.Text = ""
txtItemName.Text = ""
txtPrice.Text = ""
txtQuantity.Text = ""
txtAmount.Text = ""
txtItemID.Focus()
txttotalitem.Text = txttotalitem.Text + 1
End If
End If
End Sub
Private Sub txtItemID_TextChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles txtItemID.TextChanged,
txtvoucher.TextChanged, txtSaleDate.TextChanged
ds = SelectData("Select * from Item where ItemID='" & txtItemID.Text &
"'")
If ds.Tables(0).Rows.Count > 0 Then
txtItemType.Text = ds.Tables(0).Rows(0).Item(1)
txtItemName.Text = ds.Tables(0).Rows(0).Item(2)
txtPrice.Text = ds.Tables(0).Rows(0).Item(3)
txtQuantity.Text = 1
txtQuantity.Focus()
Else
txtItemType.Text = ""
txtItemName.Text = ""
txtPrice.Text = ""
txtQuantity.Text = ""
txtAmount.Text = ""
End If
End Sub
Private Sub txtQuantity_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtQuantity.TextChanged
45
txtQuantity.Text = ""
End If
End Sub
Private Sub sale_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
txtvoucher.Text = AutoID("VoucherID", "Sale")
txtSaleDate.Text = Today
txtItemID.Focus()
txtTotal.Text = 0
txttotalitem.Text = 0
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
saveintodb()
createtable()
ds = SelectData("Select * from Sale where Voucherid='" & txtvoucher.Text
& "'")
count = ds.Tables(0).Rows.Count
dt.Clear()
If count > 0 Then
For i As Int32 = 0 To count - 1
dr = dt.NewRow
With ds.Tables(0).Rows(i)
dr.Item(0) = .Item("VoucherID")
dr.Item(1) = .Item("SaleDate")
dr.Item(2) = .Item("ItemID")
dr.Item(3) = .Item("ItemTypeName")
dr.Item(4) = .Item("ItemName")
dr.Item(5) = .Item("Quantity")
dr.Item(6) = .Item("UnitPrice")
dr.Item(7) = .Item("Amount")
End With
dt.Rows.Add(dr)
Next
Else
MessageBox.Show("Search record not found")
47
End If
Dim objReport As New SaleReport
Dim DailyReport As New CrystalReport1
If dt.Rows.Count <> 0 Then
DailyReport.SetDataSource(dt)
objReport.CrystalReportViewer1.ReportSource = DailyReport
objReport.CrystalReportViewer1.Show()
objReport.ShowDialog()
End If
txtvoucher.Text = AutoID("VoucherID", "Sale")
txtTotal.Text = 0
txttotalitem.Text = 0
DataGridView1.Rows.Clear()
End Sub
Private Sub createtable()
dt.Columns.Clear()
dt.Columns.Add("Voucher ID")
dt.Columns.Add("Sale Date")
dt.Columns.Add("Item ID")
dt.Columns.Add("Item Type Name")
dt.Columns.Add("Item Name")
dt.Columns.Add("Quantity")
dt.Columns.Add("Unit Price")
dt.Columns.Add("Amount")
End Sub
Private Sub saveintodb()
Dim a As Integer
a = txttotalitem.Text
For i = 0 To a - 1
SaveData("Insert into Sale values ('" & txtvoucher.Text & "','" &
txtSaleDate.Text & "','" & DataGridView1.Rows.Item(i).Cells(0).Value & "','"
& DataGridView1.Rows.Item(i).Cells(1).Value & "','" &
DataGridView1.Rows.Item(i).Cells(2).Value & "'," &
DataGridView1.Rows.Item(i).Cells(3).Value & "," &
DataGridView1.Rows.Item(i).Cells(4).Value & ", " &
DataGridView1.Rows.Item(i).Cells(5).Value & ")")
Next i
48
SaveData("Insert into SaleLine values ('" & txtvoucher.Text & "'," &
txtTotal.Text & ")")
End Sub
End Class
Add_Order_Form
Public Class Add_Order_Form
Dim dt As New DataTable
Dim ds As New DataSet
Dim ds2 As New DataSet
Dim ds3 As New DataSet
Dim ds4 As New DataSet
Dim dr As DataRow
Dim count As New Integer
Private Sub Order_Form_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
txtOrderID.Text = AutoID("OrderID", "OrderLine")
Createtable()
txtOrderDate.Text = Today
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = False Then
txt_Cust_ID.Text = ""
txt_Cust_Name.Text = ""
AddBtn.Enabled = False
txt_Cust_ID.ReadOnly = False
ElseIf CheckBox1.Checked = True Then
txt_Cust_ID.Text = AutoID("CustomerID", "Customer")
txt_Cust_Name.Text = ""
AddBtn.Enabled = True
txt_Cust_ID.ReadOnly = True
End If
End Sub
Private Sub AddBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles AddBtn.Click
Add_Cust.Show()
End Sub
49
dr.Item(0) = .Item("Orderid")
dr.Item(1) = .Item("OrderDate")
dr.Item(2) = .Item("ItemID")
dr.Item(3) = .Item("ItemTypeName")
dr.Item(4) = .Item("ItemName")
dr.Item(5) = .Item("Quantity")
dr.Item(6) = .Item("UnitPrice")
dr.Item(7) = .Item("Amount")
End With
dt.Rows.Add(dr)
Next
Else
MessageBox.Show("Search record not found")
End If
Dim objReport As New OrderReport
Dim DailyReport As New CrystalReport2
If dt.Rows.Count <> 0 Then
DailyReport.SetDataSource(dt)
objReport.CrystalReportViewer1.ReportSource = DailyReport
objReport.CrystalReportViewer1.Show()
objReport.ShowDialog()
End If
clearForm()
End Sub
Private Sub Remove_Btn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Remove_Btn.Click
Dim rowNum, total As Integer
rowNum = DataGridView1.CurrentRow.Index
Label19.Text = DataGridView1.Rows.Item(rowNum).Cells(0).Value
txtQuantity.Text = DataGridView1.Rows.Item(rowNum).Cells(3).Value
ds = SelectData("Select * from Item where Itemid='" + Label19.Text + "'")
Dim itemquantity As Integer = ds.Tables(0).Rows(0).Item(4) +
txtQuantity.Text
SaveData("Update Item Set Quantity=" & itemquantity & " where
Itemid='" + Label19.Text + "'")
total = DataGridView1.Rows.Item(rowNum).Cells(5).Value
DataGridView1.Rows.RemoveAt(DataGridView1.CurrentRow.Index)
txtTotal.Text = txtTotal.Text - total
txttotalitem.Text = txttotalitem.Text - 1
txtQuantity.Text = ""
End Sub
52
DataGridView1.Rows.Item(rowNum).Cells(4).Value = txtUnitPrice.Text
DataGridView1.Rows.Item(rowNum).Cells(5).Value = txtAmount.Text
total = total + amount
txtTotal.Text = total
End If
txttotalitem.Text = txttotalitem.Text + 1
txtItemID.Text = ""
txtItemname.Text = ""
txtItemType.Text = ""
txtUnitPrice.Text = ""
txtQuantity.Text = ""
End Sub
Private Sub clearForm()
txtOrderID.Text = AutoID("OrderID", "OrderLine")
txt_Cust_ID.Text = ""
txt_Cust_Name.Text = ""
txtItemID.Text = ""
txtItemname.Text = ""
txtItemType.Text = ""
txtUnitPrice.Text = ""
txtQuantity.Text = ""
txttotalitem.Text = 0
txtTotal.Text = ""
txtAmount.Text = ""
DataGridView1.Rows.Clear()
End Sub
Private Sub txttotalitem_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txttotalitem.TextChanged
If txttotalitem.Text = 0 And txt_Cust_Name.Text = "" Then
Print_Btn.Enabled = False
Else
Print_Btn.Enabled = True
End If
End Sub
End Class
View_Order_Form
54
Dim ds As DataSet
Private Sub Item_Form_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
fill_Item()
End Sub
Private Sub fill_Item()
Dim connection As New OleDb.OleDbConnection
connection.ConnectionString =
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" &
Application.StartupPath.ToString & "\POS.mdb"
connection.Open()
Dim adp As OleDb.OleDbDataAdapter
Dim query As String
query = "Select * from item"
adp = New OleDb.OleDbDataAdapter(query, connection)
ds = New DataSet()
adp.Fill(ds, "item")
DataGridView1.DataSource = ds.Tables(0)
connection.Close()
End Sub
Private Sub AddItemsToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
AddItemsToolStripMenuItem.Click
Add_Item.Show()
End Sub
Private Sub RemoveItemsToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
RemoveItemsToolStripMenuItem.Click
Dim rowNum As Integer
rowNum = DataGridView1.CurrentRow.Index
SaveData("DELETE * FROM Item WHERE itemid = '" +
DataGridView1.Rows.Item(rowNum).Cells(0).Value + "' ")
fill_Item()
End Sub
Private Sub EditItemsToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
EditItemsToolStripMenuItem.Click
Edit_Item_Form.ShowDialog()
fill_Item()
End Sub
End Class
56
Add_Item_Form
Public Class Add_Item_Form
Dim ds As DataSet
Dim ds2 As New DataSet
Private Sub Add_Item_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
ItemIdTxtBox.Text = AutoID("ItemID", "Item")
ds = SelectData("Select * from ItemType order by ItemTypeName")
If ds.Tables(0).Rows.Count > 0 Then
For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
ItemTypeCboBox.Items.Add(ds.Tables(0).Rows(i).Item(1))
Next
End If
ds2 = SelectData("Select * from ItemType order by warehouse")
If ds2.Tables(0).Rows.Count > 0 Then
For i As Integer = 0 To ds2.Tables(0).Rows.Count - 1
WarehouseCboBox.Items.Add(ds2.Tables(0).Rows(i).Item(2))
Next
End If
ItemNameTxtBox.Focus()
End Sub
Private Sub AddBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles AddBtn.Click
If ItemTypeCboBox.Text.Trim = "" Then
nullerrormsg("the Item Type")
ItemTypeCboBox.Focus()
ElseIf ItemNameTxtBox.Text.Trim = "" Then
nullerrormsg("the name of item.")
ItemNameTxtBox.Focus()
ElseIf PriceTxtBox.Text.Trim = "" Then
nullerrormsg("the Price for the item.")
PriceTxtBox.Focus()
ElseIf IsNumeric(PriceTxtBox.Text.Trim) = False Then
PriceTxtBox.SelectAll()
PriceTxtBox.Focus()
ElseIf QuantityTxtBox.Text.Trim = "" Then
nullerrormsg("the Quantity")
57
QuantityTxtBox.Focus()
ElseIf IsNumeric(QuantityTxtBox.Text.Trim) = False Then
QuantityTxtBox.SelectAll()
QuantityTxtBox.Focus()
ElseIf WarehouseCboBox.Text.Trim = "" Then
nullerrormsg("the Warehouse number.")
WarehouseCboBox.Focus()
Else
SaveData("Insert into Item values ('" & ItemIdTxtBox.Text & "','" &
ItemTypeCboBox.Text & "','" & ItemNameTxtBox.Text & "'," &
PriceTxtBox.Text & ", " & QuantityTxtBox.Text & ",'" &
WarehouseCboBox.Text & "')")
statusLbl.Text = "Item(s) added successfully"
clear()
ItemIdTxtBox.Text = AutoID("ItemID", "Item")
End If
RefreshItem()
End Sub
Private Sub clear()
ItemIdTxtBox.Text = ""
ItemTypeCboBox.Text = ""
ItemNameTxtBox.Text = ""
PriceTxtBox.Text = ""
QuantityTxtBox.Text = ""
WarehouseCboBox.Text = ""
ItemNameTxtBox.Focus()
End Sub
End Class
Edit_Item_Form
Public Class Edit_Item_Form
Dim ds As DataSet
Private Sub Edit_Item_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim rowNum As Integer
rowNum = Item_Form.DataGridView1.CurrentRow.Index
ItemIdTxtBox.Text =
Item_Form.DataGridView1.Rows.Item(rowNum).Cells(0).Value
ItemTypeCboBox.Text =
Item_Form.DataGridView1.Rows.Item(rowNum).Cells(1).Value
58
ItemNameTxtBox.Text =
Item_Form.DataGridView1.Rows.Item(rowNum).Cells(2).Value
PriceTxtBox.Text =
Item_Form.DataGridView1.Rows.Item(rowNum).Cells(3).Value
QuantityTxtBox.Text =
Item_Form.DataGridView1.Rows.Item(rowNum).Cells(4).Value
WarehouseCboBox.Text =
Item_Form.DataGridView1.Rows.Item(rowNum).Cells(5).Value
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
SaveData("Update Item Set Itemid='" + ItemIdTxtBox.Text + "',
ItemTypeName='" + ItemTypeCboBox.Text + "',ItemName='" +
ItemNameTxtBox.Text + "',Price=" + PriceTxtBox.Text + ",Quantity=" +
QuantityTxtBox.Text + ",Warehouse=" + WarehouseCboBox.Text + " where
Itemid='" + ItemIdTxtBox.Text + "'")
lbl_Status.Text = "Item Updated Successfully."
fill_Item()
End Sub
Private Sub fill_Item()
Dim connection As New OleDb.OleDbConnection
connection.ConnectionString =
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" &
Application.StartupPath.ToString & "\POS.mdb"
connection.Open()
Dim adp As OleDb.OleDbDataAdapter
Dim query As String
query = "Select * from item"
adp = New OleDb.OleDbDataAdapter(query, connection)
ds = New DataSet()
adp.Fill(ds, "item")
Item_Form.DataGridView1.DataSource = ds.Tables(0)
connection.Close()
End Sub
End Class
Item_Type_Form
Public Class Item_Type_Form
59
Dim ds As DataSet
Private Sub Item_Type_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
fill_Item()
txtBox_ItemTypeID.Text = AutoID("ItemTypeID", "ItemType")
End Sub
Private Sub fill_Item()
Dim connection As New OleDb.OleDbConnection
connection.ConnectionString =
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" &
Application.StartupPath.ToString & "\POS.mdb"
connection.Open()
Dim adp As OleDb.OleDbDataAdapter
Dim query As String
query = "Select * from ItemType"
adp = New OleDb.OleDbDataAdapter(query, connection)
ds = New DataSet()
adp.Fill(ds, "itemType")
DataGridView1.DataSource = ds.Tables(0)
connection.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If txtBox_ItemTypeName.Text.Trim = "" Then
nullerrormsg("Item Type name")
txtBox_ItemTypeName.Focus()
ElseIf TextBox1.Text.Trim = "" Then
nullerrormsg("Warehouse")
TextBox1.Focus()
Else
SaveData("Insert into ItemType values ('" & txtBox_ItemTypeID.Text &
"','" & txtBox_ItemTypeName.Text & "','" & TextBox1.Text & "')")
MessageBox.Show(" Saving Successfully")
txtBox_ItemTypeID.Text = AutoID("ItemTypeID", "ItemType")
fill_Item()
End If
End Sub
End Class
60
Customer_Form
Public Class Customer_Form
Dim ds As DataSet
Dim dt As DataTable
Private Sub Customer_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
fill_Cust()
End Sub
Private Sub fill_Cust()
Dim connection As New OleDb.OleDbConnection
connection.ConnectionString =
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" &
Application.StartupPath.ToString & "\POS.mdb"
connection.Open()
Dim adp As OleDb.OleDbDataAdapter
Dim query As String
query = "Select * from customer"
adp = New OleDb.OleDbDataAdapter(query, connection)
ds = New DataSet()
adp.Fill(ds, "customer")
DataGridView1.DataSource = ds.Tables(0)
connection.Close()
End Sub
Private Sub AddCustomerToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
AddCustomerToolStripMenuItem.Click
Add_Cust_Form.ShowDialog()
End Sub
Private Sub EditToolStripMenuItem1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles EditToolStripMenuItem1.Click
Edit_Cust_Form.ShowDialog()
End Sub
Private Sub RemoveToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
RemoveToolStripMenuItem.Click
Dim rowNum As Integer
61
rowNum = DataGridView1.CurrentRow.Index
SaveData("DELETE * FROM Customer WHERE CustomerID = '" +
DataGridView1.Rows.Item(rowNum).Cells(0).Value + "' ")
fill_Cust()
End Sub
End Class
Add_Customer_Form
Public Class Add_Cust_Form
Dim ds As DataSet
Private Sub Add_Cust_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
txtID.Text = AutoID("CustomerID", "Customer")
txtName.Focus()
End Sub
Private Sub AddBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles AddBtn.Click
If txtName.Text.Trim = "" Then
nullerrormsg("Customer name")
txtName.Focus()
ElseIf txtPhone.Text.Trim = "" Then
nullerrormsg("Customer Phone")
txtPhone.Focus()
ElseIf txtPhone.Text >= Convert.ToChar(33) And txtPhone.Text <=
Convert.ToChar(47) Then
txtPhone.SelectAll()
txtPhone.Focus()
ElseIf txtPhone.Text >= Convert.ToChar(58) And txtPhone.Text <=
Convert.ToChar(126) Then
txtPhone.SelectAll()
txtPhone.Focus()
ElseIf txtstreet.Text.Trim = "" Then
nullerrormsg("Street")
txtstreet.Focus()
ElseIf txtTownship.Text.Trim = "" Then
nullerrormsg("Township")
txtTownship.Focus()
ElseIf txtPhone.Text.Trim = "" Then
nullerrormsg("Phone")
62
txtPhone.Focus()
ElseIf cboCity.Text.Trim = "" Then
nullerrormsg("City")
cboCity.Focus()
ElseIf txtHomeNo.Text.Trim = "" Then
nullerrormsg("Home No")
txtHomeNo.Focus()
Else
SaveData("Insert into Customer values ('" & txtID.Text & "','" &
txtName.Text & "','" & txtPhone.Text & "','" & txtstreet.Text & "','" &
txtTownship.Text & "', '" & cboCity.Text & "','" & txtHomeNo.Text & "')")
statusLbl.Text = "Successfully added"
clear()
txtID.Text = AutoID("CustomerID", "Customer")
fill_Cust()
End If
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs)
Me.Close()
End Sub
Private Sub clear()
txtName.Text = ""
txtPhone.Text = ""
txtstreet.Text = ""
txtTownship.Text = ""
cboCity.Text = ""
txtHomeNo.Text = ""
End Sub
Private Sub fill_Cust()
Dim connection As New OleDb.OleDbConnection
connection.ConnectionString =
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" &
Application.StartupPath.ToString & "\POS.mdb"
connection.Open()
Dim adp As OleDb.OleDbDataAdapter
Dim query As String
query = "Select * from customer"
adp = New OleDb.OleDbDataAdapter(query, connection)
ds = New DataSet()
63
adp.Fill(ds, "customer")
Customer_Form.DataGridView1.DataSource = ds.Tables(0)
connection.Close()
End Sub
End Class
Edit_Customer_Form
Public Class Edit_Cust_Form
Dim ds As DataSet
Private Sub Edit_Cust_Form_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
Dim rowNum As Integer
rowNum = Customer_Form.DataGridView1.CurrentRow.Index
txtBox_Cust_ID.Text =
Customer_Form.DataGridView1.Rows.Item(rowNum).Cells(0).Value
txtBox_Cust_Name.Text =
Customer_Form.DataGridView1.Rows.Item(rowNum).Cells(1).Value
txtBox_PhNum.Text =
Customer_Form.DataGridView1.Rows.Item(rowNum).Cells(2).Value
txtBox_Street.Text =
Customer_Form.DataGridView1.Rows.Item(rowNum).Cells(3).Value
txtBox_Township.Text =
Customer_Form.DataGridView1.Rows.Item(rowNum).Cells(4).Value
cboBox_City.Text =
Customer_Form.DataGridView1.Rows.Item(rowNum).Cells(5).Value
txtBox_HomeNum.Text =
Customer_Form.DataGridView1.Rows.Item(rowNum).Cells(6).Value
End Sub
Private Sub fill_Item()
Dim connection As New OleDb.OleDbConnection
connection.ConnectionString =
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" &
Application.StartupPath.ToString & "\POS.mdb"
connection.Open()
Dim adp As OleDb.OleDbDataAdapter
Dim query As String
query = "Select * from item"
adp = New OleDb.OleDbDataAdapter(query, connection)
ds = New DataSet()
64
adp.Fill(ds, "item")
Item_Form.DataGridView1.DataSource = ds.Tables(0)
connection.Close()
End Sub
Private Sub SaveBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles SaveBtn.Click
SaveData("Update Customer Set CustomerName = '" +
txtBox_Cust_Name.Text + "' , PhoneNumber = '" + txtBox_PhNum.Text + "',
Street = '" + txtBox_Street.Text + "', township = '" + txtBox_Township.Text +
"' , city = '" + cboBox_City.Text + "', HomeNumber = '" +
txtBox_HomeNum.Text + "'")
lbl_Status.Text = "Successfully Updated."
fill_Item()
End Sub
End Class
Report_Form
Public Class Report_Form
Dim ds As DataSet
Dim dt As New DataTable
Dim dr As DataRow
Dim count As New Integer
Private Sub createtable()
dt.columns.clear()
dt.Columns.Add("Voucher ID")
dt.Columns.Add("SaleDate")
dt.Columns.Add("Item ID")
dt.Columns.Add("Item Type Name")
dt.Columns.Add("Item Name")
dt.Columns.Add("Quantity")
dt.Columns.Add("Unit Price")
dt.Columns.Add("Amount")
DataGridView1.DataSource = dt
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If ComboBox1.Text = "Sales Report" Then
If RadioButton2.Checked = True Then
65
createtable()
Dim d As Date
d = Format(DateTimePicker1.Value, "Short date")
ds = SelectData("Select * from SaleReport where SaleDate=#" & d &
"#")
count = ds.Tables(0).Rows.Count
dt.Clear()
If count > 0 Then
For i As Int32 = 0 To count - 1
dr = dt.NewRow
With ds.Tables(0).Rows(i)
dr.Item(0) = .Item("VoucherID")
dr.Item(1) = .Item("SaleDate")
dr.Item(2) = .Item("ItemID")
dr.Item(3) = .Item("ItemTypeName")
dr.Item(4) = .Item("ItemName")
dr.Item(5) = .Item("Quantity")
dr.Item(6) = .Item("UnitPrice")
dr.Item(7) = .Item("Amount")
End With
dt.Rows.Add(dr)
Next
DataGridView1.Refresh()
DataGridView1.DataSource = dt
Else
MessageBox.Show("Search record not found")
End If
Dim objReport As New SaleReport
Dim DailyReport As New CrystalReport4
If dt.Rows.Count <> 0 Then
DailyReport.SetDataSource(dt)
objReport.CrystalReportViewer1.ReportSource = DailyReport
objReport.CrystalReportViewer1.Show()
objReport.ShowDialog()
End If
ElseIf RadioButton1.Checked = True Then
createtable()
Dim m As Integer
m = DateTimePicker1.Value.Month
ds = SelectData("Select * from SaleReport where Month=" & m & "")
66
count = ds.Tables(0).Rows.Count
dt.Clear()
If count > 0 Then
For i As Int32 = 0 To count - 1
dr = dt.NewRow
With ds.Tables(0).Rows(i)
dr.Item(0) = .Item("VoucherID")
dr.Item(1) = .Item("SaleDate")
dr.Item(2) = .Item("ItemID")
dr.Item(3) = .Item("ItemTypeName")
dr.Item(4) = .Item("ItemName")
dr.Item(5) = .Item("Quantity")
dr.Item(6) = .Item("UnitPrice")
dr.Item(7) = .Item("Amount")
End With
dt.Rows.Add(dr)
Next
DataGridView1.Refresh()
DataGridView1.DataSource = dt
Else
MessageBox.Show("Search record not found")
End If
Dim objReport As New SaleReport
Dim DailyReport As New CrystalReport5
If dt.Rows.Count <> 0 Then
DailyReport.SetDataSource(dt)
objReport.CrystalReportViewer1.ReportSource = DailyReport
objReport.CrystalReportViewer1.Show()
objReport.ShowDialog()
End If
ElseIf RadioButton3.Checked = True Then
createtable()
Dim y As Integer
y = DateTimePicker1.Value.Year
ds = SelectData("Select * from SaleReport where Year=" & y & "")
count = ds.Tables(0).Rows.Count
67
dt.Clear()
If count > 0 Then
For i As Int32 = 0 To count - 1
dr = dt.NewRow
With ds.Tables(0).Rows(i)
dr.Item(0) = .Item("VoucherID")
dr.Item(1) = .Item("SaleDate")
dr.Item(2) = .Item("ItemID")
dr.Item(3) = .Item("ItemTypeName")
dr.Item(4) = .Item("ItemName")
dr.Item(5) = .Item("Quantity")
dr.Item(6) = .Item("UnitPrice")
dr.Item(7) = .Item("Amount")
End With
dt.Rows.Add(dr)
Next
DataGridView1.Refresh()
DataGridView1.DataSource = dt
Else
MessageBox.Show("Search record not found")
End If
Dim objReport As New SaleReport
Dim DailyReport As New CrystalReport6
If dt.Rows.Count <> 0 Then
DailyReport.SetDataSource(dt)
objReport.CrystalReportViewer1.ReportSource = DailyReport
objReport.CrystalReportViewer1.Show()
objReport.ShowDialog()
End If
End If
ElseIf ComboBox1.Text = "Order Report" Then
If RadioButton2.Checked = True Then
createtable()
Dim d As Date
d = Format(DateTimePicker1.Value, "Short date")
ds = SelectData("Select * from OrderReport where OrderDate=#" & d
& "#")
count = ds.Tables(0).Rows.Count
68
dt.Clear()
If count > 0 Then
For i As Int32 = 0 To count - 1
dr = dt.NewRow
With ds.Tables(0).Rows(i)
dr.Item(0) = .Item("VoucherID")
dr.Item(1) = .Item("SaleDate")
dr.Item(2) = .Item("ItemID")
dr.Item(3) = .Item("ItemTypeName")
dr.Item(4) = .Item("ItemName")
dr.Item(5) = .Item("Quantity")
dr.Item(6) = .Item("UnitPrice")
dr.Item(7) = .Item("Amount")
End With
dt.Rows.Add(dr)
Next
DataGridView1.Refresh()
DataGridView1.DataSource = dt
Else
MessageBox.Show("Search record not found")
End If
Dim objReport As New SaleReport
Dim DailyReport As New CrystalReport7
If dt.Rows.Count <> 0 Then
DailyReport.SetDataSource(dt)
objReport.CrystalReportViewer1.ReportSource = DailyReport
objReport.CrystalReportViewer1.Show()
objReport.ShowDialog()
End If
ElseIf RadioButton1.Checked = True Then
createtable()
Dim m As Integer
m = DateTimePicker1.Value.Month
ds = SelectData("Select * from SaleReport where Month=" & m & "")
count = ds.Tables(0).Rows.Count
dt.Clear()
If count > 0 Then
69
dr.Item(5) = .Item("Quantity")
dr.Item(6) = .Item("UnitPrice")
dr.Item(7) = .Item("Amount")
End With
dt.Rows.Add(dr)
Next
DataGridView1.Refresh()
DataGridView1.DataSource = dt
Else
MessageBox.Show("Search record not found")
End If
Dim objReport As New SaleReport
Dim DailyReport As New CrystalReport9
If dt.Rows.Count <> 0 Then
DailyReport.SetDataSource(dt)
objReport.CrystalReportViewer1.ReportSource = DailyReport
objReport.CrystalReportViewer1.Show()
objReport.ShowDialog()
End If
End If
End If
End Sub
End Class
Chapter (4)
71
Conclusion
4.1
Conclusion
By conclusion, using our computerized system can reduce time, paper works and
human power and serve quickly and efficiently. We believe that the system can be used easier
and more convenient. We will add some feature to our POS software system to get more
satisfaction.
4.2
4.3
Future Extensions
Automatic database backing up facility will be added.
72
73