Point of Sale System
March 22, 2017 | Author: Kaung Htet Aung | Category: N/A
Short Description
Download Point of Sale System...
Description
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 haven’t 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, customer’s 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 customer’s 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 can’t 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 Activities
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
9
Chapter (2) System Analysis and Design
10
2.1 Context Diagram
11
2.2
Data Flow Diagram (Level-0)
12
13
14
2.3
Data Flow Diagram (Level-1)
15
16
17
18
2.4
Entity Relationship Diagram
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
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 22
ItemID ItemName Quantity Price TotalPrice OrderID OrderDate CustomerID DeliveryDate
23
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
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
Data Table (Data Dictionary)
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
Form Design & Coding
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
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 Private Sub CustomerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CustomerToolStripMenuItem.Click Customer_Form.ShowDialog() End Sub 42
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 Private Sub ReportToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReportToolStripMenuItem.Click Report_Form.Show() End Sub End Class
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
Dim price, total As Long Dim quantity As String quantity = txtQuantity.Text If txtQuantity.Text >= "A" And txtQuantity.Text 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
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 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 0 Then For i As Int32 = 0 To count - 1 dr = dt.NewRow With ds.Tables(0).Rows(i) 51
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
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 + "'") 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 53
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
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) 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 55
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(58) And txtPhone.Text 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
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) 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") 70
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
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. 72
User account control will be added.
73
View more...
Comments