49
[Type text] Page 1 Introduction to Software Development: Developing Software Solutions Due Date: Friday 6th September 2013 Year : 11 Saqib Khan, Hant Patel, Zaman Al Muddaris and Faraz Shaid Software Design Development Year: 11

Major Project SDD

Embed Size (px)

DESCRIPTION

Major assessemt task on Software design development

Citation preview

Page 1: Major Project SDD

Page 1

Saqib Khan, Hant Patel, Zaman Al Muddaris and Faraz ShaidSoftware Design Development

Year: 11

Introduction to Software Development: Developing Software SolutionsDue Date: Friday 6th September 2013

Page 2: Major Project SDD

ContentsIntroduction...........................................................................................................................................3

Problem Statement...............................................................................................................................4

Gantt chart............................................................................................................................................5

Subroutines...........................................................................................................................................6

IPO Chart...............................................................................................................................................7

Data Flow Diagram................................................................................................................................9

Storyboard of Software Solution.........................................................................................................10

System Flowchart of solution..............................................................................................................11

Algorithm of your solution...................................................................................................................12

Screen Layout......................................................................................................................................14

Desk Check..........................................................................................................................................15

Code....................................................................................................................................................18

Test Plan..............................................................................................................................................19

Documentation....................................................................................................................................20

Evaluation of the solution....................................................................................................................24

Conclusion...........................................................................................................................................25

Software Design Development Page 2

Page 3: Major Project SDD

Introduction

The purpose of this project is to present our groups chosen scenario to simulate and create a supermarket cash register. This is usually used to calculate the total number of sale a customer was able to purchase, and will also give the people the proper change and the respective receipts with what they are buying. Attached to cash register is a cash drawer, and this drawer will open during the process of the transaction and will allow the cashier to make the change necessary for the customer. If there are no changes required, the receipts will just immediately comes out from the said device. Cash register is commonly seen within a department store, since it is one way where they can give fast services to their customers.

Instead of making manual calculations with all the items being purchased by the customer, cash register is one way to calculate all the sales right away and without any waste of time, one can immediately give the fast services that the customer expect from the retailer. In order to start the process with this cash register, the sales clerk will only scan a certain item with its corresponding bar code scanner, and this will allow the register to display the current price of each item being purchase by the customer. When the sales clerk is done with it, she will then put the payment amount on the register and immediately calculation will certain follow. If there are change that should be given to the customer, the cash drawer will also open immediately for the cashier to get the change, and the receipts will immediately follow.

A receipt will come out when the process is already completed, and the items are being keyed out of the store's inventory records right away. This record will help the store to have an accurate check during their inventory. In every item being purchase, there is also a corresponding record on it. The register will going to keep each record of every item being purchase, and it will be printed out at the end of the day for their inventory. It is also advisable that cash drawers will be counted from time to time in order to ensure that the cash register always has its appropriate amount of money in order to conduct the process. If the retailer is going to handle the said device, make sure to observe strictly the procedures and safety precautions, so that all transactions are made to be safe. The safety rules, programming of the department key, basic set up of the said device, and all transactions necessary to operate the cash register must always be taken into consideration.

Cash registers make every transaction fast and easy especially for the sales clerk. A simple scan of every item will immediately program the different records of each item. This device will not only benefit the customers, but in the same manner it is also a great advantage for the store owner since it will enable them to have an accurate inventory at the end of the day. Cash Registers are one of the effective ways of rendering the fast services to the customers especially when you are a sales clerk.

Software Design Development Page 3

Page 4: Major Project SDD

Problem Statement

UNIPAD a multi billionaire company has asked us to create cash register software like a supermarket cash register but with more functions and accurate information. The software will allow a barcode to be inputted form the keyboard and the product price and description will be displayed on the screen. Once all items have been entered, the amount due should be displayed. An appropriate message will be displayed when the entered barcode does not have a product associated with it. The program will accept an amount tendered by the customer and calculate the change due. The product description file will contain at least twenty different products.

Software Design Development Page 4

Page 5: Major Project SDD

Gantt chart

Problem Statement

Gantt Chart

Subroutines

IPO Chart

Data Flow Diagram

Storyboard

System FlowChart

Algorithm

Screen Layout

Desk Check

Code

Test Plan

Documentation

Evaluaiton

Conclusion

25-Jun 5-Jul 15-Jul 25-Jul 4-Aug 14-Aug 24-Aug

Start Date

Page 5

Page 6: Major Project SDD

Subroutines

Since our task does not require subroutine we don’t have a subroutine in our program.

Page 6

Page 7: Major Project SDD

IPO Chart

Input Processing Output

Typing the password in theStar up form

Checking if the password is correct

Retrieving the password form the database.

The user will enter the main window

Barcode/Barcodes Check if the barcode is valid

Get the barcode from the user

The barcode will be displayed.

The item associated with the barcode will be displayed.

The price associated with the barcode will be displayed.

Display the total price so far within the transaction.

Cash Given Check if the cash given is less than the total amount

Get the cash tendered from the user

Change received

Multiply price by count The total sum of products

Subtract cash given by total amount

The change received.

Software Design Development Page 7

Page 8: Major Project SDD

Data Dictionary

Field Name Data Type Length Format Example

Password String 3 Xxx xxx

Barcode Integer 5 XXXXX 51342

Cash Given Currency 3 xx.xx $78.23

Displayed barcode

Integer 5 XXXXX 51342

Item name String 10 Xxxxx Apple

Price Currency 5 xx.xx $5.76

Total price Currency 5 xx.xx $85.76

Change Received

Currency 3 Xxx $23

Software Design Development Page 8

Page 9: Major Project SDD

Data Flow Diagram

Page 9

USERS LOGING

Customers

Identify Items

Prices

Compute Total Cost

of the Order

Look up Prices

Settle Transaction and Issue

Receipt

Customer

Items to Purchase

Item ID

Items and Prices Amount to

be Paid

PaymentReceipt

Prices

Page 10: Major Project SDD

Storyboard of Software Solution

Page 10

Enter Exit

ExitUpdate

ExitAdd

ExitChange

Receipt

ItemsBarcode

Add itemEdit ItemRemove Item

Change Password

ItemAdmin PriceCountItemsBarcode

Item

Add itemEdit ItemRemove Item

Change Password

ItemAdmin

Receipt

Page 11: Major Project SDD

System Flowchart of solution

Page 11

YES

END

YES

YES

NO

NO

NO

END

Display Error

Display Error

Display Change

Received

Cash Tendered < Total Price

Enter Cash Tendered

Display Item Name

Display Item Cost Price

Display Total Price

Barcode invalid

Enter Barcode

Select Items

Enter Password

Display Main Screen

Is it Valid

BEGIN

Page 12: Major Project SDD

Algorithm of your solution

BEGIN Main ProgramEnter passwordDetermine Products PurchasedFinalise Transaction

END

BEGIN Password Enter Password IFPassword is incorrect then display error messageElse Display Main ScreenEnd IF

END

BEGIN Product ListCustomers Read Product ListREPEAT

Customer Enter BarcodeIF Barcode enter is invalid THENDisplay Error message Else display

System display PriceSystem display Item nameSystem display Total CostDisplay Item count

End IF UNTIL

Customers finished shoppingEND Product List

BEGIN Add ItemEnter Barcode for the item

IF Barcode entered exist display errorElse Enter the Item NameIF Item name exist than display errorElseEnter Buy Price for ItemsEnter Sell PriceIf sell price < buy price than Display Error End ifEnd ifEnd if

Software Design Development Page 12

Page 13: Major Project SDD

END ADD ITEM

BEGIN EDIT ITEMUpdate BarcodeIF Barcode exist than Display errorElse Update Product name filedIf product name exist thanDisplay errorElse Update Buy Price fieldUpdate Sell Price fieldEND IFEND IF

END EDIT ITEM

BEGIN Change ReceivedCustomer Enter Cash TenderedIF Cash tendered is < total Price THENDisplay Error MessageElse Display change Received End IF

END Change Received

Software Design Development Page 13

Page 14: Major Project SDD

Screen Layout

Software Design Development Page 14

Page 15: Major Project SDD

Software Design Development Page 15

Page 16: Major Project SDD

Desk CheckPassword Condition Output

PASS 21 1232 If password is f3 Display Error

Password Condition OutputPASS 11 Abc2 If password is T3 Display Main Screen

Barcode Condition Item Name Item cost TotalCost

Item Count Output

Pass 11 012 Apple Apple3 3.00 $3.004 3.00 $10.005 1 16

Barcode Condition Item Name Item cost TotalCost

Item Count Output

Pass 21 31 Barcode

invalid2 Error3 Error4 Error5 Error6 Error

Password Desk Check

Software Design Development Page 16

Main Desk check

Page 17: Major Project SDD

Barcode Item Name

Buy Price Sell Price Condition Output

Pass 1

1 Barcode entered exist

Error

2 Item name entered exist

Error

3 6.00

4 7.00

Pass 2

1 07 Barcode entered exist

Error

2 Pears Item name entered exist

Error

3 6.00

4 7.00

Software Design Development Page 17

Edit Item Desk Check

Update Item Desk check

Transaction Desk Check

Barcode Item Name Buy Price Sell Price Condition Output

Pass1

1 05

2 Mango

3 5.00

4 7.00

Pass2

1 05

2 Mango

3 10.00

4 9.00

5 If sell price < buy price

Error

Total Cost Cash Tendered Change Received

Condition Output

Pass 11 502 603 1045

Total Cost Cash Tendered Change Received

Pass 11 502 303 Cash tendered

< total priceDisplay Error

45

Page 18: Major Project SDD

Code Note: I acknowledge that not all the code used in developing this solution is ours. It is all for commercial and entertainment purposes.

ADD ITEM

Public Class AddItem

' used to tell the main window that the operation is cancelled Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.DialogResult = Windows.Forms.DialogResult.Cancel End Sub

' used to insert the item Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

' perform validation for barcode If TextBox1.Text.Trim = "" Then MsgBox("You should enter a barcode number", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox1.Focus() Exit Sub End If If Not IsNumeric(TextBox1.Text) Then MsgBox("The barcode number should include digits only", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox1.Focus() Exit Sub End If If TextBox1.Text.Contains(".") Or TextBox1.Text.Contains("-") Then MsgBox("The barcode number should include digits only", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox1.Focus() Exit Sub End If

' perform check for the item name If TextBox2.Text.Trim = "" Then MsgBox("You should enter name for the item", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox2.Focus() Exit Sub End If

' perform a check for the buy price If Not IsNumeric(TextBox3.Text) Then MsgBox("You should enter the buy price as a number", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox3.Focus() Exit Sub End If Dim BuyPrice As Decimal = Decimal.Parse(TextBox3.Text) If BuyPrice < 0 Then

Software Design Development Page 18

Page 19: Major Project SDD

MsgBox("Buy price can't be negative", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox3.Focus() Exit Sub End If

' perform a check for the sell price If Not IsNumeric(TextBox4.Text) Then MsgBox("You should enter the sell price as a number", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox4.Focus() Exit Sub End If Dim SellPrice As Decimal = Decimal.Parse(TextBox4.Text) If SellPrice < 0 Then MsgBox("Sell price can't be negative", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox4.Focus() Exit Sub End If If SellPrice <= BuyPrice Then MsgBox("Sell price can't be less than buy price", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox4.Focus() Exit Sub End If

' insert the item Try ' create the adapter Dim TA As New POSDSTableAdapters.ItemsTableAdapter

' insert the item TA.Insert(TextBox1.Text, TextBox2.Text, BuyPrice, SellPrice)

' close window and return ok Me.DialogResult = Windows.Forms.DialogResult.OK Catch ex As Exception

' display error message MsgBox(ex.Message, MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") End Try End Sub

Private Sub AddItem_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End SubEnd Class

Software Design Development Page 19

Page 20: Major Project SDD

EDIT ITEMPublic Class EditItem

' this method is used to fill the information Public Sub FillItemInfo(ByVal Barcode As String) ItemsTA.FillByBarcode(MyDS.Items, Barcode) End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.DialogResult = Windows.Forms.DialogResult.Cancel End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' perform validation for barcode If TextBox1.Text.Trim = "" Then MsgBox("You should enter a barcode number", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox1.Focus() Exit Sub End If If Not IsNumeric(TextBox1.Text) Then MsgBox("The barcode number should include digits only", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox1.Focus() Exit Sub End If If TextBox1.Text.Contains(".") Or TextBox1.Text.Contains("-") Then MsgBox("The barcode number should include digits only", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox1.Focus() Exit Sub End If

' perform check for the item name If TextBox2.Text.Trim = "" Then MsgBox("You should enter name for the item", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox2.Focus() Exit Sub End If

' perform a check for the buy price If Not IsNumeric(TextBox3.Text) Then MsgBox("You should enter the buy price as a number", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox3.Focus() Exit Sub End If Dim BuyPrice As Decimal = Decimal.Parse(TextBox3.Text) If BuyPrice < 0 Then MsgBox("Buy price can't be negative", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox3.Focus() Exit Sub End If

' perform a check for the sell price If Not IsNumeric(TextBox4.Text) Then

Software Design Development Page 20

Page 21: Major Project SDD

MsgBox("You should enter the sell price as a number", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox4.Focus() Exit Sub End If Dim SellPrice As Decimal = Decimal.Parse(TextBox4.Text) If SellPrice < 0 Then MsgBox("Sell price can't be negative", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox4.Focus() Exit Sub End If If SellPrice <= BuyPrice Then MsgBox("Sell price can't be less than buy price", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox4.Focus() Exit Sub End If

' insert the item Try ' create the adapter Dim TA As New POSDSTableAdapters.ItemsTableAdapter

' insert the item BS.EndEdit() TA.Update(MyDS.Items)

' close window and return ok Me.DialogResult = Windows.Forms.DialogResult.OK Catch ex As Exception

' display error message MsgBox(ex.Message, MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") End Try End Sub

End Class

CHANGE PASSWORDPublic Class ChangePassword

' user cancels psw change Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.DialogResult = Windows.Forms.DialogResult.Cancel End Sub

' user wants to change password Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Try

' validate the new password If TextBox2.Text = "" Then MsgBox("You should enter a password", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error")

Software Design Development Page 21

Page 22: Major Project SDD

TextBox2.Focus() Exit Sub End If

If TextBox2.Text <> TextBox3.Text Then MsgBox("The password does not match its confirmation", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox2.Focus() Exit Sub End If

' get the original password Dim TA As New POSDSTableAdapters.ValuesTableAdapter Dim DB = TA.GetDataByKey("password") Dim DBPSW As String = DB.Rows(0).Item(1)

If DBPSW <> TextBox1.Text Then MsgBox("The old password is incorrect", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox1.Focus() Exit Sub End If

' everything went well, so we are going to update the password in the db Dim Rc As Integer = TA.UpdateDbVar(TextBox2.Text, "password") If Rc = 0 Then MsgBox("Password not updated", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") Exit Sub End If

Me.DialogResult = Windows.Forms.DialogResult.OK

Catch ex As Exception ' handle the error MsgBox(ex.Message, MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") Exit Sub End Try

End SubEnd Class

PASSWORD PICKERPublic Class ChangePassword

' user cancels psw change Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.DialogResult = Windows.Forms.DialogResult.Cancel End Sub

' user wants to change password Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Try

Software Design Development Page 22

Page 23: Major Project SDD

' validate the new password If TextBox2.Text = "" Then MsgBox("You should enter a password", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox2.Focus() Exit Sub End If

If TextBox2.Text <> TextBox3.Text Then MsgBox("The password does not match its confirmation", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox2.Focus() Exit Sub End If

' get the original password Dim TA As New POSDSTableAdapters.ValuesTableAdapter Dim DB = TA.GetDataByKey("password") Dim DBPSW As String = DB.Rows(0).Item(1)

If DBPSW <> TextBox1.Text Then MsgBox("The old password is incorrect", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") TextBox1.Focus() Exit Sub End If

' everything went well, so we are going to update the password in the db Dim Rc As Integer = TA.UpdateDbVar(TextBox2.Text, "password") If Rc = 0 Then MsgBox("Password not updated", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") Exit Sub End If

Me.DialogResult = Windows.Forms.DialogResult.OK

Catch ex As Exception ' handle the error MsgBox(ex.Message, MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") Exit Sub End Try

End SubEnd Class

Software Design Development Page 23

Page 24: Major Project SDD

MAIN

Public Class MainWindow

' the form loads and initialization should happen Private Sub MainWindow_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Try

' get the password from the user Dim PSWWin As New PasswordPicker

' if the user hits the exit button then stop execution If PSWWin.ShowDialog <> Windows.Forms.DialogResult.OK Then End End If

' get the password Dim PSW As String = PSWWin.TextBox1.Text

' get the password from the database Dim TA As New POSDSTableAdapters.ValuesTableAdapter Dim TB = TA.GetDataByKey("password") Dim DBPSW As String = TB.Rows(0).Item(1)

' check that passwords match If PSW <> DBPSW Then MsgBox("Wrong Password Moron", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") End End If

' load the items information from db into the dataset ItemsTA.Fill(MyDataset.Items)

Catch ex As Exception

' handle the error MsgBox(ex.Message, MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") End End Try

End Sub

' change the password Private Sub ChangePasswordToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChangePasswordToolStripMenuItem.Click Dim PSWChange As New ChangePassword PSWChange.ShowDialog() End Sub

' add item to the db

Software Design Development Page 24

Page 25: Major Project SDD

Private Sub AddItemToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddItemToolStripMenuItem.Click Dim AddItemWindow As New AddItem If AddItemWindow.ShowDialog = Windows.Forms.DialogResult.OK Then ' load the information of items from db ItemsTA.Fill(MyDataset.Items) End If End Sub

' used to select an item Private Sub EditItemToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EditItemToolStripMenuItem.Click

' make sure an item is selected If DGV.SelectedRows.Count = 0 Then Exit Sub End If

' get the barcode of the item Dim Barcode = DGV.SelectedRows(0).Cells(0).Value

' create the edit window Dim EditItemWindow As New EditItem

' fill the window with information EditItemWindow.FillItemInfo(Barcode)

If EditItemWindow.ShowDialog = Windows.Forms.DialogResult.OK Then ' load the information of items from db ItemsTA.Fill(MyDataset.Items) End If End Sub

' this one is used to remove an item Private Sub RemoveItemToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemoveItemToolStripMenuItem.Click

' make sure a single item is being selected If DGV.SelectedRows.Count = 0 Then Exit Sub End If

' get the barcode of the item Dim Barcode As String = DGV.SelectedRows(0).Cells(0).Value

' remove the item Try ItemsTA.DeleteByBarcode(Barcode) ItemsTA.Fill(MyDataset.Items) Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") End Try End Sub

' checks if the return key is pressed

Software Design Development Page 25

Page 26: Major Project SDD

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If Button1.Enabled Then If e.KeyChar = Chr(13) Then Button1_Click(Nothing, Nothing) End If End If End Sub

' this one is used to detect the barcode item when the text change and display its information Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged Try ' step 01: create the table adapter Dim TA As New POSDSTableAdapters.ItemsTableAdapter Dim TB = TA.GetDataByBarcode(TextBox1.Text)

' step 02: check if no item is found If TB.Rows.Count = 0 Then TextBox2.Text = "" TextBox3.Text = "" Button1.Enabled = False Exit Sub End If

' step 03: display the information in the textboxes Button1.Enabled = True Dim R As POS.POSDS.ItemsRow = TB.Rows(0) TextBox2.Text = R.ItemName TextBox3.Text = R.SellPrice Button1.Tag = R Catch ex As Exception ' display error message MsgBox(ex.Message, MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") End Try End Sub

' this will be used to add an item to the recipt details Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

' get the details of the item Dim R As POS.POSDS.ItemsRow = Button1.Tag

' next search for the barcode in the datagridview Dim I As Integer Dim ItemLoc As Integer = -1 For I = 0 To DGV2.Rows.Count - 1 If R.Barcode = DGV2.Rows(I).Cells(0).Value Then

' item found ItemLoc = I Exit For

End If Next

Software Design Development Page 26

Page 27: Major Project SDD

' if item is not found, add it If ItemLoc = -1 Then DGV2.Rows.Add(R.Barcode, R.ItemName, R.BuyPrice, R.SellPrice, 1, R.SellPrice) Else ' if item is already there increase its count Dim ItemCount As Long = DGV2.Rows(ItemLoc).Cells(4).Value ItemCount += 1 Dim NewPrice As Decimal = R.SellPrice * ItemCount DGV2.Rows(ItemLoc).Cells(4).Value = ItemCount DGV2.Rows(ItemLoc).Cells(5).Value = NewPrice End If

' next clear textbox1 and set focus to it TextBox1.Text = "" TextBox1.Focus()

' compute the total for the recipt Dim Sum As Decimal = 0 For I = 0 To DGV2.Rows.Count - 1 Sum += DGV2.Rows(I).Cells(5).Value Next

TextBox4.Text = Sum TextBox5.Text = Sum

End Sub

' remove item from the recipt Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If DGV2.SelectedRows.Count = 0 Then Exit Sub End If

DGV2.Rows.Remove(DGV2.SelectedRows(0)) End Sub

' save the recipt Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

Dim MyConnection As OleDb.OleDbConnection = Nothing Dim MyTransaction As OleDb.OleDbTransaction = Nothing

Try

' create the connection and transaction object MyConnection = New OleDb.OleDbConnection(My.Settings.dbConnectionString) MyConnection.Open() MyTransaction = MyConnection.BeginTransaction

' insert the new recipt Dim SQL As String = "insert into recipts (reciptdate,recipttotal) values (:0,:1)" Dim CMD1 As New OleDb.OleDbCommand

Software Design Development Page 27

Page 28: Major Project SDD

CMD1.Connection = MyConnection CMD1.Transaction = MyTransaction CMD1.CommandText = SQL CMD1.Parameters.AddWithValue(":0", Now.Date) CMD1.Parameters.AddWithValue(":1", TextBox4.Text) CMD1.Parameters.AddWithValue(":1", TextBox5.Text) CMD1.ExecuteNonQuery() CMD1.Dispose()

' get the id for the recipt SQL = "select max(reciptid) as MAXID from recipts" Dim CMD2 As New OleDb.OleDbCommand CMD2.Connection = MyConnection CMD2.Transaction = MyTransaction CMD2.CommandText = SQL Dim ReciptID As Long = CMD2.ExecuteScalar() CMD2.Dispose()

' insert the details of the recipt Dim I As Integer For I = 0 To DGV2.Rows.Count - 1

' get the values Dim Barcode As String = DGV2.Rows(I).Cells(0).Value Dim BuyPrice As Decimal = DGV2.Rows(I).Cells(2).Value Dim SellPrice As Decimal = DGV2.Rows(I).Cells(3).Value Dim ItemCount As Integer = DGV2.Rows(I).Cells(4).Value

' next create a command Dim CMD3 As New OleDb.OleDbCommand SQL = "insert into ReciptDetails " & _ "(reciptid,barcode,itemcount,itembuyprice,itemsellprice) " & _ "values " & _ "(:0 ,:1 ,:2 ,:3 ,:4 )" CMD3.Connection = MyConnection CMD3.Transaction = MyTransaction CMD3.CommandText = SQL CMD3.Parameters.AddWithValue(":0", ReciptID) CMD3.Parameters.AddWithValue(":1", Barcode) CMD3.Parameters.AddWithValue(":2", ItemCount) CMD3.Parameters.AddWithValue(":3", BuyPrice) CMD3.Parameters.AddWithValue(":4", SellPrice)

CMD3.ExecuteNonQuery() CMD3.Dispose()

Next

' all well save the changes MyTransaction.Commit()

' close connection MyTransaction.Dispose() MyConnection.Close() MyConnection.Dispose()

DGV2.Rows.Clear() TextBox4.Text = "" TextBox5.Text = ""

Software Design Development Page 28

Page 29: Major Project SDD

Catch ex As Exception If MyTransaction IsNot Nothing Then MyTransaction.Rollback() End If If MyConnection IsNot Nothing Then If MyConnection.State = ConnectionState.Open Then MyConnection.Close() End If End If

MsgBox(ex.Message, MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Error") End Try

End Sub

Private Sub Button4_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim Number1 As Integer Dim Number2 As Integer Dim Answer As Integer Number1 = TextBox5.Text Number2 = TextBox7.Text Answer = TextBox7.Text - TextBox5.Text MessageBox.Show(Answer, "Your Change is")

End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click End End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click TextBox6.Text = "" TextBox7.Text = "" End Sub

Private Sub TableLayoutPanel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs)

End SubEnd Class

Software Design Development Page 29

Page 30: Major Project SDD

Test Plan

We have developed a cash register program which allows a barcode to be inputted form the keyboard and the product price and description will be displayed on the screen. Once all items have been entered, the amount due will be displayed. An appropriate message will be displayed when the entered barcode does not have a product associated with it. The program will accept an amount tendered by the customer and calculate the change due. The product description file will contain at least twenty different products.

Since we have completed our solution, the code needs to be tested. This stage is similar to the desk-checking stage. The major difference is that we test the coded program on computer rather than using pencil and paper and manually performing the testing. The Product list has been created and the layout has been set out. Since this is a cash register program it easy to use, has fewer components, basic functions and reporting, improves accuracy, easily grows with the business and a better track inventory. The purpose of testing data is to test the relevant parts of the solution. This is to ensure that the solution does what is required of it.

Dummy data consisting of a number of test customers together with a variety of test orders is created. The test data is structured in such a way as to test the limits of the cash register. So we will set the limits from a minimum of $5 to a maximum of $1000. These data includes orders that are both below and above this range, as well as falling within the range. Test data outside of the range should generate appropriate messages. Test data within the range should result in orders being processed correctly. The boundary values (in this case $10 and $1000) are also included to test whether the program performs the correct processing when these items are encountered. Other test data is used to test the database entries. For example, in the barcode field anything other than integers should generate an error message. As seen below.

Software Design Development Page 30

Page 31: Major Project SDD

Below is an example of the test which see`s if the solution is working perfectly. As you can see appropriate data types have been inputted to ensure that the solution works without any errors.

Improvement:

User Friendly Easy to use interface More appealing look Layout Different Languages Basic functions and reporting Improves accuracy Printing a Daily Report

Software Design Development Page 31

Page 32: Major Project SDD

Documentation

Welcome USERS

Congratulations upon your selection of this magnificent cash register, which is designed to provide years of reliable operation. Operating of this cash register is simple enough to be mastered without special training. Everything you need to know is included in this manual, so keep it on hand for reference. Consult your Cash Register dealer if you have any questions about points not specifically covered in this manual.

Functional Description

This software will allow a barcode to be inputted form the keyboard and the product price and description will be displayed on the screen. Once all items have been entered, the amount due should be displayed. An appropriate message will be displayed when the entered barcode does not have a product associated with it. The program will accept an amount tendered by the customer and calculate the change due. The product description file will contain at least twenty different products.

General Guide

This part of the manual introduces you to the cash register and provides a general explanation of its various parts.

Roll Paper: you can use the roll paper to print receipts and a journal Mode Key: there are two types of mode keys: the program key and the operator key. The

program key can be used to set the mode switch to any position.

Software Design Development Page 32

Page 33: Major Project SDD

Drawer: the drawer open automatically whenever you finalize a registration and whenever you issue a read or reset report.

Magnetic Plate: use this plate for tacking the notes received from customer.

System installation

Setting up your cash register consists of the following steps: • Plugging in and Putting in the Batteries• Installing the Paper Roll• Setting the Date and Time• Programming the Sales Tax• Setting at least 2 Department Keys

Plugging in and Putting in the Batteries1. Make sure that you plug the cash register into the electrical outlet before you put in the

batteries.

To get the cash register ready to use

1. Remove the cash register and the parts from the box. Store the box and packing material in a safe, dry place. If you need to move the register in the future, you can put it back in the box.

2. Remove the tape holding the parts of the cash register in place. For example, there may be tape on the back of the Journal Compartment Cover.

3. Put the register on a hard, level surface, away from rain and spilled drinks. A hard level surface makes it easier for the cash drawer to go in and out smoothly. Do not put the register on a porous surface. Depending on the surface or any cleaning solution used on the surface, the rubber feet may leave marks on the surface. Do not place the register on any valuable surface, such as antique or fine wood tables, desks, and so on.

4. Plug the cash register into a standard three-hole electrical wall outlet. (115-120 volt, 60 hertz). Make sure the electrical cord is not going to get tripped over or accidentally pulled from the electrical outlet. Put the cash register on an electrical circuit with no other electrical device or appliance. Other appliances can overload the circuit or cause electrical interference with the cash register. It is best that you use a circuit without other appliances already on it.

5. Install the memory backup batteries. a. Open the Journal Compartment cover. Unlock the compartment cover with the

Cash Drawer/Journal Lock key #515. Grip the left side of the journal cover and gently pull upward. Remove the cover and put it aside.

b. Remove the battery cover, located in the rear left section of the compartment. Press the indentation at the bottom of the cover and slide up. See the graphic to the right for details.

c. Put the batteries in the slots. Make sure that the positive and negative ends are in the right place. The batteries have a little plus (positive) and minus (negative) sign on each end to help you.

d. Replace the battery cover by sliding it back down into position. e. Now you are ready to put the paper in the cash register and set the time and the

date. See the next section for more information.

Software Design Development Page 33

Page 34: Major Project SDD

Trouble Shooting Guide

This section describes what to do when you have problems with operation.

When an error occurs

Errors are indicated by an error codes. When this happen, you can usually find out what the problem is as illustrated below.

Software Design Development Page 34

Page 35: Major Project SDD

In Case of Power Failure

If the power supply to the cash register is cut by a power failure or any other reason, simply wait for power to be restored. The details of any ongoing transaction as well as all sales data in memory are protected by the memory backup batteries.

Power failure during a registration. The subtotal for items registered up to the power failure is retained in memory. You will be able to continue with the registration when power is restored.

Power failure during printing a read/reset report. The data already printed before the power failure is retained in memory. You will be able to issue a report when power is restored.

The power failure symbol is printed and any item that was being printed when the power failure occurred is reprinted in full.

Online Help

For any other question please follow the website or give us a call:

Website: www.cashregister.com.au

Phone Number: 1300 400 500

Software Design Development Page 35

Page 36: Major Project SDD

Evaluation of the solution

Checking the solution to see if it meets the original design specification

The solution meets the original design specification. The initial Cash Register is user friendly and easy to use. This cash register is a way to testing the easiness and the function of the Cash Register. There are many benefits of having a user friendly cash register.

Close comparisons will be made between each transaction to see how fast the cash register works. The Cash Register will be economical so many small businesses have the opportunity to buy the software which will help save money.

The design of the solution is very easy and user friendly, even kids could operate it. The database of the product will need to be done using non computer tool which will be than put inside the database.

User feedback

Following are some comments by the customers who bought our Cash Register:

5.0 out of 5 star Great for Market!We are a small family run farm and we go to farmer's markets every weekend plus we open up our farm for visitors and such. I needed something portable and within our very limited price range. Best thing is the wonderful job it does on taxes! We have food items which are a totally different price than our non-food items and now I don't have to go a bunch of extra steps...Read the full review ›

Great register. I've had 3 of these over the past 20 years. Recommend this to anyone who needs a portable register. Great for people who do outside trade shows with no electricity.

Social and ethical perspectives

Our software is easy to use. The software is designed to avoid the use of technical language. We have used some existing code in our software to build the solution. We know

that we don’t own everything; the software is for commercial purposes. Since the software is the link between the computer and the operator there is many

ergonomically specs designed to make the operator feel relaxed and comfortable. For example, the choice of text and background colours can mean the difference

between customers persisting. The Program is more visually pleasant sight. A common trend in Cash Register is the use of red text on a black background. This combination is actually quite hard on the eyes and Web developers have moved to a more natural white background with black text. Good use of white space also helps enhance the legibility of the page.

Software Design Development Page 36

Page 37: Major Project SDD

Conclusion

As a group of four, we chose the supermarket problem; a supermarket cash register was simulated. A barcode was imputed from the keyboard, and the product price and description were displayed on the screen. Once all items were entered, the amount due was displayed. An appropriate message was displayed when an entered barcode did not have a product associated with it. The program accepted an amount tendered by the customer and calculated the change due. The product description file contained at least twenty different products and the contents discussed in this report included:

1. Title page, documenting group members names, due date and class.2. Contents page3. A brief introduction of the report.4. A problem statement, which states what you will try to solve and the scope of your problem.5. Gantt Chart listing the tasks to be completed, when they are due and who will need to complete it6. A list of all the subroutines and what will occur7. An Input, Process, Output (IPO) chart for all subroutines8. Data dictionary of the solution9. Data Flow Diagram of the solution (DFD)10. Storyboard of the software solution11. System flowchart of the solution12. Algorithm of the solution13. Screen layout of the solution14. Desk check of the solution15. The actual code of the solution (copied from VB)16. Test plan, outlining how you will test the solution and its results17. Explanation of the type of documentation that will need to be produced to accompany your solution18. Evaluation of the solution, including involvement of those 19. Conclusion of the report20. Formatting and Presentation of report

Our group has successfully created a report on a chosen problem. Our chosen problem was the Supermarket Cash Register. The report that our team created has provided us with great opportunity to know about the various aspects and stages of developing a Software Solution for the problem. Apart from imparting theoretical knowledge, this report has helped us improve our practical knowledge about developing a Software Solution.

We learnt a lot of information about how to develop an Software Solution. We got both theoretical as well as practical knowledge about developing a Software Solution and various stages in developing a Software Solution. By writing this report on developing Software Solution we have gained abundance knowledge and hope it will help us in our future studies.

As a group we have achieved what set out to achieve. Overall we are proud of what we have achieved and gained through this assessment.

Software Design Development Page 37