Functional Design


Based on the data flow through the system. Full listing of process definitions and algorithms given with relationships throughout the system represented with graphical DFDs.
[login dfd]

1.1.1 Prompt for Data

Description:	Asks user for their login data
Input:		- Login Id
		- Password
Output:		none
Errors:		incorrect data format in data fields
Algorithm:	- Prompt user for login id
		- Read in the login id
		- Verify the data format of the login id
		- Prompt user for password
		- Read in the password
		- Verify the data format of the password
		- On errors, re-prompt the user
		- Return login id and password 

1.1.2 Check for Valid Employee

Description:	Decides on users permissions to enter the system
Input:		- Login Id
		- Password
Output:		none
Errors:		Non-existent Login Id 
		Incorrect password given
Algorithm:	-search employee database for employee record with
		   matching login id
		-if found check password id correct
		-on errors return error message and recall prompt
		   for data
		-return employee id,authorization and position id.

1.1.3 Initial Interface

Description:	Chooses the user window. 
Input:		Employee id
		authorization
		position id 
Output:		user window 
Errors:		none 
Algorithm:      - get interface settings that match the authorization and
		  position id
		- output the window with functions that can be performed
		- send the employee id to the other processes

[sales dfd]

1.2.1 Sell An Item

Description:	This is the point of sale process that allows the cashier to sell products. 
Input:		Bar code
     		item code  
		quantity  
Output:		receipt 
Errors:		- item does not exist in product store. 
Algorithm: 	- reads bar code or item code and quantity
		- searches for product in the data store
		- if found
               		- the price and current stock is returned to the process
			- the current stock is decremented by the quantity amount
		- else
			- prompt for re-entry of input
			- prompts for another item if not finished 
			- repeat previous steps
		- if finished print receipt

1.2.2 Give Refund

Description:	Allows the user to return items to the store. 
Input:		Bar code 
		item code     
		quantity 
Output: 	none 
Errors:		- item is not in data store   
Algorithm:	- reads bar code or item code and quantity
		- searches for product in data store
		- if found
			- the price is returned and the current stock is
			  incremented by quantity amount
		- else 
			- error message and prompt for re-entry of inputs

[employee dfd]

1.3.1 Add Employee

Description:	Enter new employee into the employee data store. 
Input:		employee id
		first and last name
		department
		department number
		authorization
		position
		position number 
Output:		Message to screen 
Errors:        	- employee already exists
		- syntactical errors 
Algorithm:      - read in input
		- check if employee already exists
		- if exists 
			- prompt for re-entry of input
		- else
			- create new employee record

1.3.2 Delete Employee

Description:	removal of employee record from data store. 
Input:		employee id
Output:		Message to screen 
Errors:   	- employee does not exist in data store 
Algorithm:	- check if employee is in data store
		- if yes
			- retrieve employee record
			- verify deletion
		- else
			- error message and prompt for re-entry of input

1.3.3 Modify Employee

Description:	Change the fields of the employee record. 
Input:		employee id 
Output:		Message to screen   
Errors:		- employee does not exist in data store
		- cannot modify field 
Algorithm:	- search for employee in data store
		- if found
			- retrieve record
		- else 
			- error message and prompt for re-entry of input
		- read in modifications
		- verify that inputs are correct
		- update the employee record

[inventory dfd]

1.4.1 Edit a Product

Description:  	To change the attributes of a stocked product
Input:		- product record
Output:		- product modification interface to screen
Errors:		invalid data in data fields
		product to update not found
Algorithm:	- offer interface to user to query product database
		- search the product data base for the given product
		- if not found inform user and re-prompt
		- else
			read product record
			offer user interface to modify the product fields
			verify data fields have valid data
			write product record

1.4.2 Add a Product

Description:	To add a new product to the product data base
Input:		- none
Output:		- product modification interface to screen
Errors:		invalid data in data fields
		incomplete information about product provided
Algorithm:	- give user interface to provide product information
		- check to ensure all data fields of a product (minus description and
			item location) are filled in
		- verify data fields have valid data
		- write new product record to product database

1.4.3 Delete a Product

Description:	To delete a new product to the product data base
Input:		- none
Output:		- product query interface to screen
Errors:		product is flagged as on_order
		product has a current stock greater than 0
		product selected to delete doesn't exist in product database
Algorithm:	- offer interface to user to query product database
		- search the product data base for the given product
		- if not found inform user and re-prompt
		- else
			read product record
			check to see if product is on order or has remaining stock
			if yes inform user and prompt user for verification of delete
			if product is checked or verified for deletion
				delete the product from the product database

[order dfd]

1.5.1 Batch Process


Description:	Processes product database and orders product to satisfy inventory level requirements
Input:		- Product Records
Output:		- none
Errors:		none
Algorithm:	- Every day do
			create an instance of an Order Record data type with 
				a new Order Number, date, time
			read the Manager Name of the Head Manager from the employee database
			for the entire product data base
				- read a product record
				- if current stock < minimum stock
					- order quantity = calculate stock maximum - stock current
					- set on order flag in product record
					- write Item data to ItemList
					- update product record in product database
			In the Order record set Confirmation, Order Received, and Invoice Received to false
			Write Order Record to the Order database

1.5.2 Manual Order

Description:	Accept a special order from an authorized manager or employee
Input:		- Employee_ID
		- Product Record
Output:		- Product Record data for selected products
Errors:		Attempt to find and order a non existent product
Algorithm:	- Offer Query Interface to the product data base
		- On Error, re-prompt and offer cancel option
		- prompt user for order Quantity
		- If quantity is zero, re-prompt and offer cancel option
		- Else 
			create an instance of an Order Record data type with 
				a new Order Number, date, time
			read the employee name from the employee database via employee id
			- set on order flag in product record
			- update product record in product database
			- write Item data to ItemList inside the Order record.
			In the Order record
				- Set Confirmation, Order Received, and Invoice Received to false
			Write Order Record to the Order database

1.5.3 Modify Order

Description:	Change order specifications before order is sent
Input:		- Employee Id
		- Order record
Output:		- Order List
Errors:		none
Algorithm:	- Search Order Data Base for Orders with no Confirmation flag set 
		- Display the orders, allowing user to select any product listed
		- When product selected, supply interface to manipulate Order Quantity
		- Write updated order to order data base

[shipment dfd]

1.6.1 Accept Shipment

Description:   	This process updates an order with a shipment received flag.
Input:         	Lading Form
     		Order Records
Output:        	- Error message in case of error
Errors:        	- Contains order numbers of orders that do not exist
Algorithm:    	- While more orders to update on the lading form do
			get order number of lading form
          		search order database for order
          		If  order does not exist then print error message to screen with erroneous order number
          		Else
               			set received flag in order record
               			return list of products for that order into a queue

1.6.2 Update Inventory

Description:   	This process updates all product records of products that were listed on 
		  the lading form.
Input:         	Products Ordered
     		Product Records
Output:        	Error Message
Errors:        	- Product ordered has incorrect order amount
Algorithm:     	- Take list of products from queue
     		- Get 1st product of list
     		- While there are products on list do
          	search products database for product record
          	If amount ordered from lading form = amount ordered 
               		add amount ordered to current stock
               		save new current stock in record
               		turn on order flag off
          	Else print error message
          	get next product from list

[warehouse dfd]

1.7.1 Produce Lading Form

Description:   	This process takes all orders issued on one day, and, provided
     		  those items will be delivered, produces a lading form,
		  containing a list of all products from all orders used.
Input:         	Order Records
     
Output:        	Lading Form
Errors:      	none
Algorithm:     	- generate lading form number
		- print date on lading form
     		- get first new order record
     		- While new orders records do
          		print manager's name above product list
          		transfer product list to lading form
          		get next new order record
       		- Print lading form

1.7.2 Produce Invoice

Description:   	This procedure generates an invoice which totals all new orders processed 
		  for one day.
Input:         	Order record
Output:        	Invoice
Errors:        	none
Algorithm:     	- Set total price to zero
		- Generate invoice number
     		- print date on invoice
     		- get first new order that has received flag set
     		- While more new received orders do
          		print product list with prices on invoice
          		add each price to total price
          		get next new received order
	     	- print total price on invoice
     		- print invoice          

[interface dfd]

1.8.0 Modify Interface Environment

Description:   	This procedure allows the head manager to change
     		  the permissions of a function set within a given interface.
Input:         	Interface record
     		Employee_ID
Output:        	Confirmation of changed functions
     		Error Message if Employee_ID refused
Errors:        	- Incorrect Employee_ID
Algorithm:     	- Search for employee record corresponding to Employee_ID
		- If position is head manager then For each interface do
               			display function flags for 
               			specific functions set and prompt
             			user to change the flag settings          
       		- Else print message to inform that no clearance
          		  is given to make changes to function permissions
     
 

Entity Relationship Daigram
[erd]

Data Dictionary


Definition of data flows through the system. Assumed types are numbers, text, date, time, and dollars. That is they are not explicitly defined as to avoid clutter.

Products = { Product Record }


Product Record =

	 Bar Code 
	+ Item
	+ Department
	+ Department Number
	+ Item Location
	+ Price
	+ Stock Minimum
	+ Stock Maximum
	+ Stock Current
	+ On Order Flag

Item =
   
	 Item Code 
	+ Description
	+ Order Quantity

Item Location =

	 Aisle Number
	+ Section

Bar Code	= number -10-
Item Code	= number -8-
Description	= text -256-
Order Quantity	= number -5-
Department	= text -32-
Department Number
		= number -3-
Aisle Number	= number -3-
Section		= character
Price		= dollars
Stock Minimum	= number -4-
Stock Maximum	= number -5-
Stock Current	= number -5-
On Order Flag	= bool

Employees = { Employee Records }

Employee Records = 

	  Employee Id
	+ Authorization
	+ Name
	+ Password
	+ Department
	+ Department Number
	+ Position
	+ Position Id
	+ Login Id

Name =
 
	  First
	+ Last

Employee Id	= number -9-
Authorization	= [1|2|3]
Position	= text -32-
Position Id	= number -2-
Login Id	= text -6-
First		= text -25-
Last		= text -25-

Invoice =

	  Invoice Number
	+ Date
	+ Orderlist
	+ Total Price

Total Price	= dollars

Orderlist =

	  {Order Number}
	+ Itemlist
	+ {prices}

Lading Form =

	  Lading Number
	+ Date
	+ Order List


Audit File = { Audit Records }

Audit Records = 

	  Date
	+ Time
	+ Employee Id
	+ Position Id
	+ Department Number
	+ Authorization
	+ Description
	+ Transaction Number

Transaction Number

		= number -9-

Receipt =

	  Date
	+ Time
	+ {Sale}
	+ Total Price

Sale =

	  Description
	+ Price
	+ Sale Quantity

Sale Quantity	= number -4-

Orders = {Order}

Order =

	  Order Number
	+ Date
	+ Time
	+ Confirmation
	+ Manager Name
	+ Order Received
	+ Item List
	+ Invoice Received

Order Number	= number -5-
Confirmation	= bool
Manager Name	= text -32-
Order Received	= bool
ItemList	= {item}
Invoice Received= bool


Interface = { Interface Records }

Interface Record =
	  Window
	+ Authorization
	+ Interface Settings

Interface Settings	
		= {bool}