Você está na página 1de 73

NATIONAL MANAGEMENT DEGREE COLLEGE

Software Development

For

Point of Sale System of Construction Materials Shop

Project submitted in partial fulfillment of the requirement

For the Diploma in Software Engineering

Presented by
DSE Batch-32
Group III

Project Report August 2016


Member List
ROLL NO Name Duty List

DSE-30 Mg Kaung Htet Aung Leader

DSE-40 Mg Kaung Si Thu Hein Co-leader

DSE-28 Mg Lin Htet Aung Member

DSE-32 Ma May Thet Mon Member

1
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.

2
Contents
Page
Chapter (1) INTRODUCTION 5

1.1 Introduction 6

1.2 Objectives 6

1.3 Current System Problem 6

1.4 Proposed System 7

1.5 Feasibility 7

1.5.1 Economic Feasibility 7

1.5.2 Operational Feasibility 7

1.5.3 Technical Feasibility 8

1.6 System Requirements 8

1.7 Time Schedule 9

Chapter (2) SYSTEM ANALYSIS AND DESIGN 10

2.1 Content Diagram 11

2.2 Data Flow Diagram (DFD Level-0) 11

2.3 Data Flow Diagram (DFD Level-1) 14

2.4 Entity Relationship Diagram (ERD) 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 Data Table (Data Dictionary) 25

Chapter (3) FORM DESIGN AND IMPLEMENTATION 28

3.1 Structure Chart 29

3.2 Pseudo Code 30

3.3 Form Design And Coding 33

Chapter (4) CONCLUSION 71

4.1 Conclusion 72

4.2 Limitation and Constrains 72

4.3 Future Extensions 72

4
Chapter (1)
Introduction

5
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 Current system problem

In the current manual system, sales records, customers information and

import histories are recorded and stored by using papers and files. So, it has many

problems such as duplicating data, leaving off data in recording and calculation errors.

As the manual system uses paper and files, they are unable to search or review

such records of files easily and quickly. Also, there may be lost of data records.
6
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.5.1 Economic feasibility

As we are changing to the computerized system, we must consider about the

commercial benefits and operational costs. So, the expense of developing the system

should be less cost.

We can also get intangible benefits. For example, we get the customers

satisfaction for comfortable, quick and good customer services.

1.5.2 Operational Feasibility

When changing to the computerized system, most of the staffs are not well

trained in computers. So, we must provide paper training, explanation and user

manual to understand and able to use the computerized system efficiently. This can

make the staffs and manager more qualify and increase the standards of the work.
7
1.5.3 Technical Feasibility

Our computerized system is easy to use for some staffs and managers who

have experience and are expert. But we should train the staffs who can only work

manually.

In the manual system, duplicate data cant be searched easily, but it can be

easily found the desired information in our new system.

1.6 System Requirements

CPU Intel Pentium 4

Memory 1GB

Hard Disk 2GB Free Space

Operation System Window 7

Required Application Microsoft Access,Visual Basic 2010

Monitor 1024 x 768 resolution

Keyboard USB/Classic Keyboard

Pointing Device USB Mouse

Printer Injector or Laser

8
1.7 Time Schedule
Task Duration June July August

3rd 4th 1st 2nd 3rd 4th 1st 2nd 3rd


Activities
week week week week week week week week week

Planning

Analysis

Design

Coding and
implemention

Testing

Documentation

9
Chapter (2)
System Analysis and Design

10
2.1 Context Diagram

2.2 Data Flow Diagram (Level-0)

11
12
13
2.3 Data Flow Diagram (Level-1)

14
15
16
17
2.4 Entity Relationship Diagram

18
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
19
ItemID

ItemName

Quantity

Price

TotalPrice

OrderID

OrderDate

CustomerID

DeliveryDate

20
2.5.2 First Normalization
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

ItemType
21
ItemID

ItemName

Quantity

Price

TotalPrice

OrderID

OrderDate

CustomerID

DeliveryDate

22
2.5.3 Second Normalization
Table : Item

ItemID

ItemTypeID

ItemName

Price

Quantity

WarehouseNo

Table :ItemType

ItemTypeID

ItemTypeName

Table : Customer

CustomerID

CustomerName

Phone

City

Township

Street

HomeNo

Table : Sale

VoucherID

SaleDate

CustomerID

23
ItemID

Quantity

Price

Amount

Table :SaleLine

VoucherID

TotalPrice

Table :OrderDetail

OrderID

ItemID

Quantity

Price

Amount

Table :OrderLine

OrderID

OrderedDate

CustomerID

DeliveryDate

TotalPrice

ConfirmDelivery

24
2.6 Data Table (Data Dictionary)
Table : Item

Attribute Name Data Type Remark Reference Table

ItemID Char(5) Primary Key

ItemTypeID Char(4) Foreign Key ItemType Table

ItemName VarChar(25)

Price Number(9)

Quantity Number(5)

WarehouseNo Char(2)

Table: ItemType

Attribute Name Data Type Remark Reference Table

ItemTypeID Char(4) Primary Key

ItemTypeName Char(25)

Table: Customer

Attribute Name Data Type Remark Reference Table

CustomerID Char(5) Primary Key

CustomerName Varchar(25)

CustomerPhone Char(11)

CustomerStreet Char(20)

CustomerTownship Char(25)

CustomerCity Char(20)

CustomerHomeNo Char(4)

25
Table: Sale

Attribute Name Data Type Remark Reference Table

VoucherID Char(5) Primary Key

CustomerID Char(5) Foreign Key Customer Table

SaleDate Date/time

ItemID Char(5) Foreign Key Item Table

Quantity Number(5)

Price Number(9)

Amount Number(9)

Table :SaleLine

Attribute Name Data Type Remark Reference Table

VoucherID Char(5) Foreign Key Sale Table

TotalPrice Number(9)

Table: OrderDetail

Attribute Name Data Type Remark Reference Table

OrderID Char(6) Foreign Key

ItemID Char(5) Foreign Key Item Table

Quantity Number(5)

Price Number(9)

Amount Number(9)

26
Table: OrderLine

Attribute Name Data Type Remark Reference Table

OrderID Char(6) Primary Sale Table

OrderedDate Date/time

CustomerID Char(5) Foreign Key Customer Table

DeliveryDate Date/time

TotalPrice Number(9)

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!

ENDIF

ENDIF

ENDIF

ENDIF

END

30
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

Add_Customers_Information

Prompt CustomerID, CustomerName, PhoneNumber, Street, City, HomeNumber

Get CustomerID, CustomerName, PhoneNumber, Street, City, HomeNumber

Save Customer Information

END

31
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 Form Design & Coding
Login_Form

Main_Form

33
Sale_Form

Add_Order_Form

34
View_Order_Form

Edit_Order_Form

35
Order_Change_Form

Item_Form

36
Add_Item_Form

Edit_Item_Form

37
Item_Type_Form

Customer_Form

38
Add_Customer_Form

Edit_Customer_Form

39
Reports_Form

40
Login_Form

Public Class Login_Form


Private Sub Btn_Login_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Btn_Login.Click
Dim ds As DataSet
ds = SelectData("SELECT * FROM Login WHERE Username ='" &
txtBox_UserName.Text & "' ")
If ds.Tables(0).Rows.Count <> 0 Then

If txtBox_PassW.Text = ds.Tables(0).Rows(0).Item(1) Then


Main_Form.Show()
Me.Hide()
End If
End If
End Sub
Private Sub checkBox_ShowPassW_CheckedChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
checkBox_ShowPassW.CheckedChanged
If checkBox_ShowPassW.Checked = False Then
txtBox_PassW.UseSystemPasswordChar = True
ElseIf checkBox_ShowPassW.Checked = True Then
txtBox_PassW.UseSystemPasswordChar = False
End If
End Sub
End Class

Main_Form
Public Class Main_Form
Dim ds As DataSet
Private Sub ItemsToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ItemsToolStripMenuItem.Click
Item_Form.ShowDialog()
End Sub

Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
Me.Close()
End Sub

41
Private Sub CustomerToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
CustomerToolStripMenuItem.Click
Customer_Form.ShowDialog()
End Sub

Private Sub SalesToolStripMenuItem_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles SalesToolStripMenuItem.Click
Sale_Form.ShowDialog()
End Sub

Private Sub ItemTypeToolStripMenuItem_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
ItemTypeToolStripMenuItem.Click
Item_Type.ShowDialog()
End Sub

Private Sub AddOrderToolStripMenuItem_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
AddOrderToolStripMenuItem.Click
Add_Order_Form.ShowDialog()
End Sub

Private Sub ViewOrderToolStripMenuItem_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
ViewOrderToolStripMenuItem.Click
View_Order_Form.ShowDialog()
End Sub

Private Sub Main_Form_FormClosed(ByVal sender As System.Object,


ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles
MyBase.FormClosed
Login_Form.Close()
End Sub

Private Sub HelpToolStripMenuItem_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles HelpToolStripMenuItem.Click
AboutUs_Form.ShowDialog()
End Sub

42
Private Sub ReportToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ReportToolStripMenuItem.Click
Report_Form.Show()
End Sub
End Class

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
43
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

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 = ""
44
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

Dim price, total As Long


Dim quantity As String

quantity = txtQuantity.Text

If txtQuantity.Text >= "A" And txtQuantity.Text <= "z" Then


txtQuantity.Text = ""
txtQuantity.Focus()

ElseIf txtQuantity.Text = "" Then


txtAmount.Text = 0
txtQuantity.Focus()

ElseIf txtPrice.Text = "" Then

Else
price = txtPrice.Text
total = price * quantity
txtAmount.Text = total
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
If DataGridView1.Rows.Count = 0 Then

Else
Dim rowNum, total As Integer
rowNum = DataGridView1.CurrentRow.Index
Label15.Text = DataGridView1.Rows.Item(rowNum).Cells(0).Value
txtQuantity.Text = DataGridView1.Rows.Item(rowNum).Cells(3).Value
ds = SelectData("Select * from Item where Itemid='" + Label15.Text +
"'")

45
Dim itemquantity As Integer = ds.Tables(0).Rows(0).Item(4) +
txtQuantity.Text
SaveData("Update Item Set Quantity=" & itemquantity & " where
Itemid='" + Label15.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 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")
46
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 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
47
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
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
48
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

Private Sub txt_Cust_ID_TextChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles txt_Cust_ID.TextChanged
ds = SelectData("Select * from Customer where CustomerID='" &
txt_Cust_ID.Text & "'")

If ds.Tables(0).Rows.Count > 0 Then


txt_Cust_Name.Text = ds.Tables(0).Rows(0).Item(1)
Else
txt_Cust_Name.Text = ""
txt_Cust_ID.Focus()
End If
End Sub

Private Sub txtItmeID_TextChanged(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles txtItemID.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)
txtUnitPrice.Text = ds.Tables(0).Rows(0).Item(3)
txtAmount.Text = ds.Tables(0).Rows(0).Item(3)
txtQuantity.Text = 1
Else
txtItemType.Text = ""
txtItemname.Text = ""
txtUnitPrice.Text = ""
txtQuantity.Text = ""
txtAmount.Text = ""
End If

End Sub

49
Private Sub txtQuantity_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txtQuantity.TextChanged
Dim price, total As Long
Dim quantity As String
quantity = txtQuantity.Text
If txtQuantity.Text >= "A" And txtQuantity.Text <= "z" Then
MsgBox("Please enter quantity that must has numeric value")
txtQuantity.SelectAll()
txtQuantity.Focus()

ElseIf txtQuantity.Text = "" Then


txtAmount.Text = 0
txtQuantity.SelectAll()
txtQuantity.Focus()
ElseIf txtUnitPrice.Text = "" Then

Else

price = txtUnitPrice.Text
total = price * quantity
txtAmount.Text = total
End If
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Print_Btn.Click

Dim a As Integer
a = txttotalitem.Text
For i = 0 To a - 1
SaveData("Insert into OrderDetail values ('" & txtOrderID.Text & "',#"
& DateTimePicker1.Value & "#,'" &
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

50
SaveData("Insert into OrderLine values ('" & txtOrderID.Text & "','" &
txt_Cust_ID.Text & "','" & txt_Cust_Name.Text & "'," & txtTotal.Text & ",#"
& txtOrderDate.Text & "#,#" & DateTimePicker1.Value & "#,'Pending')")
ds = SelectData("Select * from OrderDetail where Orderid='" &
txtOrderID.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("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
51
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

Private Sub createtable()


dt.Columns.Clear()
dt.Columns.Add("OrderID")
dt.Columns.Add("OrderDate")
dt.Columns.Add("itemid")
dt.Columns.Add("itemtypename")
dt.Columns.Add("itemname")
dt.Columns.Add("quantity")
dt.Columns.Add("unitprice")
dt.Columns.Add("amount")
End Sub

Private Sub Add_Btn_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Add_Btn.Click
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
MsgBox("Plese enter quantity at least 1")

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 + "'")
52
Dim amount, total As Long
total = txtTotal.Text
amount = txtAmount.Text

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 =
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

53
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

Public Class View_Order_Form


Dim dt As New DataTable
Dim ds As DataSet
Private Sub View_Order_Form_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
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 orderline where ConfirmDeliveried='Pending'"
adp = New OleDb.OleDbDataAdapter(query, connection)
ds = New DataSet()
adp.Fill(ds, "orderline")
DataGridView1.DataSource = ds.Tables(0)
query = "Select * from orderline where ConfirmDeliveried='Deliveried'"
adp = New OleDb.OleDbDataAdapter(query, connection)
ds = New DataSet()
adp.Fill(ds, "orderline")
DataGridView2.DataSource = ds.Tables(0)
connection.Close()
End Sub

Private Sub PendingToDeliveriedToolStripMenuItem_Click(ByVal sender


As System.Object, ByVal e As System.EventArgs) Handles
PendingToDeliveriedToolStripMenuItem.Click
Order_Change_Form.ShowDialog()
View_Order_Form_Load(sender, e)
54
End Sub

Private Sub EditOrderToolStripMenuItem1_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
EditOrderToolStripMenuItem1.Click
Edit_Order_Form.ShowDialog()
End Sub
End Class

Item_Form

Public Class Item_Form


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
55
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

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")
56
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")
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

57
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
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)
58
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


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


59
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

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

60
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
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")
61
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")
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 = ""
62
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()
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

63
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()
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
64
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
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()
65
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 & "")

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")
66
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

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
67
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

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
68
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
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 CrystalReport8
If dt.Rows.Count <> 0 Then
DailyReport.SetDataSource(dt)
69
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
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 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
70
Chapter (4)
Conclusion

71
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 Limitation & Constrains


Automatic database backing up is not include.

Can run only one system.

Cannot control user permission of using the system.

4.3 Future Extensions


Automatic database backing up facility will be added.

User account control will be added.

72

Você também pode gostar