software design and development

60
Software Design and Development Major Programming Assessment Task 26 th July 2005 Evan Hooper

Upload: kyle

Post on 07-Sep-2015

10 views

Category:

Documents


4 download

DESCRIPTION

Software Design and Development

TRANSCRIPT

Software Design and Development

Software Design and DevelopmentMajor Programming Assessment Task26th July 2005

Evan Hooper

Project Information

ForHcpc TechnologiesBringing Technologies to You

www.hcpc.com.auComing Soon

4Background to HCpc Technologies

4Our Mission

4Director

4Director

6User And User Needs

7Social and Ethical Issues

8Details Of Project

9Project Outline

11Collaborative Approach

12IPO Chart

13Data Dictionary

14Data Flow Diagram

15Story Board

16Evaluation of Project

17Testing The Software

17Project Design and Description

31Test Plans and Reports

32Installation Guide

32Program Requirements

32Installing Hcpc Data Basing

33Read me

36Code Hard Copy

36Main Form

38Sub Form

40Login Form

41Invoice Form

Background to HCpc Technologies

HCpc Technologies was founded in June 2004, and has undergone over 12 months of development. After lengthy research, HCpc Technologies is proud to provide the Australian public with a superior computer product that is cost competitive if not, more affordable than our competitors.

With honesty, professionalism and integrity, it is our commitment to provide our clients with an easy and competitive solution to their computer needs, wether they are purchasing an MP3 player or a complete computer system.

Our Mission Provide the Australia public with a superior product and service at a competitive price, whilst educating them to ensure that they make the right decisions every time when choosing between products. Director Stephen Cromie, born in October of 1973, is the co-founder of HCpc Technologies, with the vision of providing the Australian market with a complete solution for their entire computer needs at an affordable and competitive price.

Mr. Cromies vision extends beyond this however, in that he sees a need to provide the Australian market with a product that is far more superior to their competitors, whilst also remaining more cost effective. The Australian public deserves a superior product that incorporates quality known parts, and is assembled here in Australia.With a strong background in Project Management, Mr. Cromie knows the fundamental requirements in providing customers not only with a quality product, he also understands that each person is different except when it comes to service, Wether youre a business or home user, everyone deserves a quality service experience during selection and in the product they purchase. It is with this high standard that HCpc Technologies has associated itself with other quality suppliers who believe and live by this fundamental truth.

Director Evan Hooper, born in December of 1986, is the co-founder of HCpc Technologies, with the vision of embarking on providing the Australian market with a new generation of computer products, which is easily purchased and understood by both computer literate persons as well as the average user.

Mr. Hooper has listened to the common complaints of customers, and has embarked in meeting this desired need by developing a site that is user friendly, The site is a work in progress that will continue to evolve as the business grows. Education is the key to our clients experiencing a positive investment. Your average person doesnt understand what all the computer jargon means, especially when it comes to selecting appropriate items to be used in the computer. Most online computer suppliers provide many options for the majority of components that go into making up your computer system. At the end of selecting all these options, your general client is left wondering if they have made the correct decision and why it cost more than the advertised price. This is why Mr. Hooper has made all the selections for you, thus providing all the relevant options with a fixed price, Although at first you may think you want to select it yourself, now all you have to do is make a quick glance and see each difference highlighted and the price is as you see it.

e-mail: [email protected] Description for Hcpc Technologies The Project that I am designing is a databasing and invoicing program named HcPc Databasing System that is made by the developers at HcPc Technologies for Hcpc that keeps track of computer hardware in a professional manner. It separates products into certain categories and allows users to keep track of their stock prices and quantities. It allows for the database to be modified if changes are needed. The program also contains a search tool that will allow the user to find items they require quickly. The program also contains an inbuilt invoicing tool that will allow you to select items that will automatically be added. Invoices will have a print save and delete function. An inbuilt login system is also included so that they managers of the business may modify product codes and descriptions if needed. The Software needed/used in this program

Microsoft Visual Basic 6.0

Microsoft Excel

Visual Basic will be used to develop this program. Excel is used as the product database.

This software has been developed for the use of HcPc Technologies but may some day be used in wild scale commercial use. This program is made for HcPc Technologies. It must meet the companys needs and be easy to use consistent and ergonomic.User and User Needs

The program is aimed at the small business HCPC Technologies and may be used by similar entities if they follow the format in which the program is developed. The program has been developed so that HCPC will be able to keep track of products, make looking up products a lot easier, be able to print invoices for clients and thus will allow them to run there business mush more smoothly.

When running a large scale business such as HCPC Technologies it is importance that inventorying is consistent and tidy. This program will allowHCPC Technologies to achieve this and hopefully benefit them in saving time and being able consider other areas which make require more priority.Due to HCPCs current method of executing there item data basing through excel, this program has been developed to allow this method to be continued and easier to do.

HCPC Technologies need to be able to keep track of products, and this piece of software will allow the HCPC Technologies to add a product to a database. Once this has been performed the product will then be open to be documented and edited.

When a product is sold the quantity can then be manually decreased. Any one employer will be able to do this under the respected column. The advantage of this is that HCPC Technologies will know what products are currently owned and what needs to be purchased at the right time.

Another feature required of this software is the searchable database feature this will allow products to be found quickly and with out fuss. HCPC Technologies will be able to bring up products that they want based upon input search information

The last feature required that this software contains is the invoicing system. The software allows u to select products from the database to add to the invoice products can be then removed from the invoice if neededInvoices will be printable.This program has to meet the requirements for the business as it will specifically run of the excel spread sheet and has been able to successfully complete all the users requirements.Social and Ethical Issues

The Software developer invests time and money into the development of their product. The development begins with an idea. The problem needs to be carefully defined, designs need to be developed and code has to be written and tested. This investment brings responsibilities to the developer but also gives them rights over the product they develop. The program needs to be virus and bug free. When operating this program on a large scale basis the computer systems of other companies are of utmost importance and it is essential that the software does not cause any hard or data lost to these systems

The program needs to meet the needs of all types of people. It needs to cater for people with special abilities so that they to may benefit from the program

The program needs to be reliable. The data must be kept safe as it will document the companies current inventories failure to do this will result in a loss in time and money for the company

We can deal with these issues by consistent testing of the programs to make sure no flaws are in the system.

Details Of Project

Elements of Project

User- Allows a admin to login modify products and then log out once desired tasks are accomplished Database- Allows imported excel documents to be displayed in the program, the program updates the list every time the program is executed. Addition- Products the product description and the price can be added to a blank invoice sheet which can then later be printed Deletion- Allows products that have been added to the invoice by mistake or products that are no longer required to be deleted Modification- Modification of products Eg Delete unneeded products add new prices, quantities ect View Invoices- This programs allows the invoice to be seen be printing is to take place Printing Invoice- Prints the current invoiceProject Outline

HcPc Technoligies has a formal structured approach to deliver software development services. Our approach consists of a Needs Analysis and Project Scope Specification and Development Proposal. This development approach enables us to provide high levels of service against agreed milestones, and demonstrates to our clients that, unlike "backyard" software developers, we will complete the project in a timely and professional manner.

When creating the solution to this problem it is necessary that the correct development approach is chosen to ensure that the final product will reflect all the users needs.All software approaches involve working out the problem and determining different ways in wish a solution may be developed.

The structured approach has been chosen that to develop this software

Visual Basic will be used to create this programReasons for this

Make your application easier to maintain Because macros are separate objects from the forms and reports that use them, an application containing a large number of macros that respond to events on forms and reports can become difficult for the application developer, to maintain. In contrast, when you use Visual Basic to respond to events, your code is built into the form or reports definition. If you move a form or report from one database to another, the Visual Basic code built into the form or report moves with it. (Code is a general term for the statements you write in a programming language.)

Create your own functions Using Visual Basic, you can also create your own functions to either perform calculations that exceed the capability of an expression or replace complex expressions youve written in your application. Mask error messages When something unexpected happens in your application and Microsoft Access displays an error message, the message can be quite mysterious to your applications users, especially if they arent familiar with Microsoft Access. Using Visual Basic, you can detect the error when it occurs and display your own message, or you can have your application do something else. Applications used by a variety of people almost always require some Visual Basic code for handling errors.

Pass arguments to your code An argument is a value that supplies the additional information that some actions require. You set arguments for macro actions in the lower part of the Macro window when you create the macro; you cant change them when the macro is running. With Visual Basic, however, you can pass arguments to your code at the time it runs. You can even use variables for arguments something you cant do in macros. This gives you a great deal of flexibility in how your code runs.

Simple interface to use the program making it easier for the designer to make the program Allows Use of forms

Collaborative Approach

Collaborative ApproachHcpc Managers

Provided Problem/Task

Provided the Businesses Needs and objectives

Provided Basic Interface Ideas

Provided what they actually want the program to do

This is kept up to date by regular meeting with the clients and constantly updating them with test plans

Test the program to see if it meets there wants

Hcpc Workers

The Program is designed for the workers at HcPc Technologies Provided Developers with information regarding the design and interface

HcPc Graphical Designers

Give programmer tips on ergonomic design techniques

Create color scheme for the program create logos and buttons

Develop Lists

Create Hidden Text boxes within the program

HcPc Programmer

Builds the program

Designs the code

Inputs the code

Builds Interface

Works with graphic designers to help build the program

Provides all relevant documentation

Provides Help

First to test program

Testers

Evaluate the Program

IPO ChartInput

ProcessOutput

Click on List On Main FormGenerates List on sub form depending on Product CategoryList of products is shown

Click on Search OkSearches for matching stringHighlights matching string

Click Add To CartAdds selected item to invoice listProduct is visible in invoice list

Click ModifyBrings up Login screenIf correct information is added

Highlight Item In ListDisplays the information in text boxesStrings visible in text boxes

Click LogoutHides Text Boxes

Text Boxes on Sub Form no longer visible

Print InvoiceSets Printing PropertiesPrints Invoice list

Remove Item From InvoiceRemoves item from arrayItem is no longer visible

Data Dictionary

VariableTypeLengthDescription

ListnumInteger 2 bytesTo show number of list items in Mainformlist Used in Function Inlist

CountInteger 2bytesTo count how many times has gone through loop Used In Function Inlist

NumitemsInteger2 bytes Gets Index of last entry in invoice.invoicelist Used In Sub Cmdaddtocart_Click

PrintlineString9 BytesThe text that is saved as print line when certain code calls it to its destination. Located in (Private Sub cmdprint_Click())

Data Flow Diagram

Story Board SHAPE \* MERGEFORMAT

Evaluation of ProjectThis project has looked at each of the users problems and has adequately solved each problem

The software performs all the users functions that have been stated and no function was unable to be completed

The software follows the social and ethical issues and follows all its guidelines

The Software has been tested by numerous entities and is deemed a working program

There is sufficient documentation to explain how the program works

Testing the SoftwareProject Design and DescriptionMain form- The main was created to make it fairly simple to start executing the program. Every time the program is opened the list generates all the different product categories from the Excel spread sheet. It suits the users needs because the spreadsheets format will not change therefore the program can read from the category list. If a new category is added the list will be updated next time the program is run. The data is read of a record set hidden the sub form.Private Sub Form_Activate()

SubForm.Data1.Recordset.MoveFirst 'gets the information for the excel document from the recordset in subformDo

If Not Inlist(SubForm.txtproductgroup.Text) Then 'if a item is not list it will add it

ListPro.AddItem (SubForm.txtproductgroup.Text)

End If

SubForm.Data1.Recordset.MoveNext ' will move the down till it finds next different value

Loop Until SubForm.txtproductgroup.Text = "" ' loop until a empty space in database

End Sub

This explains how the mainform list generates its data. This Piece of code runs of a function that uses a loop to cycle through each product in the list to find new entries. If the function list returns a new entry it will be added.

Function Inlist(Category As String) As Boolean 'sets this funtion as a yes or no data type can be called

Dim Listnum As Integer 'sets list num as a integer data formatDim count As Integer 'sets the counting moniter as a integerListnum = ListPro.ListCount - 1 '

For count = 0 To Listnum 'sets the count in the product list to 0 If ListPro.List(count) = Category Then 'if the string is in list then it is true and wont do anything

Inlist = True

Exit Function

End If

Next

Inlist = False

End Function ' this function is called by the Private Sub Form_Activate()to make it simple to code

This function is a loop that searches until it finds a new product.

Another feature that was implemented was if a product category is clicked in the main form list only products under that category will be shown in the sub form list. This will be explained in the sub form explanation

Sub Form- The sub from is where the core of the program is executed from. The sub from contains the product list in the form of a table, a search field, a modify button for administration users and also an add to cart option that adds the selected item in the list.Firstly the sub from list is generated depending on what product category was selected on the main form. For example if Business Packages is selected only items under that category will be shownThe sub form contains a hidden data box that is linked to the Excel spreadsheet. Also contained in the form are 8 text boxes each are connected to a data field in the spread sheet these are sku, prod_group, category, title, description, price excl, price_inc and stock_qty. For example when the form loads the data field will search line one of the spreadsheet through dataset.movefirst this means that each text box will display the text of each corresponding field in the spreadsheet it is then transferred to the column. The most important of these fields is the sku box this reads all the items codes. This is a unique column as no two items have the same code.The list is generated when the form loads and works like this

Private Sub Form_Activate() 'this generates the product listData1.Recordset.MoveFirst 'moves the record to first entryProList.ListItems.Clear 'clears list the reason for this is because if the list is not cleared it would duplicate the listDo

If MainForm.ListPro.List(MainForm.ListPro.ListIndex) = txtproductgroup.Text Then ' this loads up all objects in that category based on what was clicked in the main form

Call Addtolist ' calls this function End If

Data1.Recordset.MoveNext 'moves 1 step in arrayLoop Until txtcode.Text = "" ' loops until empty slotEnd SubThe Addtolist Function-

Sub Addtolist() ' this creates the coloumsDim Numitems As Integer

ProList.ListItems.Add 'create blank line'

Numitems = ProList.ListItems.count 'getting the index of the last entryProList.ListItems(Numitems).Text = txtcode.Text

ProList.ListItems(Numitems).SubItems(PRODGROUP_NUM) = txtproductgroup.Text

ProList.ListItems(Numitems).SubItems(CATEGORY_NUM) = txtcategory.Text

ProList.ListItems(Numitems).SubItems(TITLE_NUM) = txttitle.Text

ProList.ListItems(Numitems).SubItems(DESCRIPTION_NUM) = txtdescription.Text

ProList.ListItems(Numitems).SubItems(PRICEEXE_NUM) = Format(txtpriceex.Text, "##,##0.00") ' (fomat that number will be displayed in)

ProList.ListItems(Numitems).SubItems(PRICEINC_NUM) = Format(txtpriceinclude.Text, "##,##0.00") '(fomat that number will be displayed in)

ProList.ListItems(Numitems).SubItems(QUANTITY_NUM) = txtstockqty.Text

This function helps create the columns in which the data from the excel spreadsheet will be displayed in, each column corresponds the text boxes referred to earlier.

When the information was transferred into the visual basic program the numeric figure would be inconsistent that was changed by giving each integer a correct format to follow

Searching- searching allows for a string to be placed in the search box and it will look for an exact match in the list this helps when the product code is known and the product must be found fast. An extra feature implemented was the lcase feature which meant it wouldnt matter what case was used the string would still be returned.Searching works like this

Private Sub CmdOk_Click() 'seaching

Dim count As Integer 'declares counting variableFor count = 1 To ProList.ListItems.count 'starts of at one and moves through the list

If LCase(txtSearch.Text) = LCase(ProList.ListItems(count).Text) Then 'searchs list for text in textbox (lcase case is not a issue) ProList.ListItems(count).EnsureVisible 'adjusts screen to focus on searched item

ProList.ListItems(count).Selected = True 'highlights searched item ProList.SetFocus ' puts focus on the list End If

Next

End Sub

Modifying- allows for the administrator to manually modify the excel spreadsheet through the program. Once modify is clicked it opens the login form where if username and password is typed it will open the hidden boxes that allow the admin to modify the spreadsheet. To modify a product the user must highlight it and it the respected columns will be shown in the revealed boxes. Once desired works has been completed the admin can log out the boxes will disappear.The way in which the modifying element works is quite complicated-

Private Sub ProList_ItemClick(ByVal Item As MSComctlLib.ListItem)

Data1.Recordset.MoveFirst 'moves the record to first entryWhile ProList.SelectedItem txtcode.Text ' as long as the text in textcode box is not equal to selected item the code will continue

Data1.Recordset.MoveNext ' moves record forward oneWend

End Sub

This code is executed every time that the user clicks an item in the

listview (the product listing)Data1.Recordset.MoveFirst 'moves the record to first entry

While ProList.SelectedItem txtcode.Text ' as long as the text in

textcode

box is not equal to selected item the code will continue

Data1.Recordset.MoveNext ' moves record forward one

WendRecall that the textboxes (including txtcode.text) is linked automatically by VB to the spreadsheet through the data control called Data1

This control means that when you execute Data1.Recordset.MoveFirst the data control (and thus the textboxes) actually move to the beginning of the spreadsheet.

By looping through until the prolist.selecteditem is equal (note that the while loop will continue while they are NOT equal, so when it stops they MUST be equal) you know that the product code that is displayed in the textbox (and thus the corresponding entry in the spreadsheet) is the same one that the user has selected.

This means that when the admin is modifying information about the records,

the item that is selected in the list view is the same item that is being edited in the textboxes, and because the text boxes and spreadsheet entries are linked, the spreadsheet entries will be modified as well.Add To Cart- The add to cart function allows users to add a selected item from the list into the invoice form.

Add to Cart works like this

Private Sub Cmdaddtocart_Click() 'adds products to the invoice formDim Numitems As Integer

If txtcode.Text "" Then ' this stops blank lines to being entered to into the code

Invoice.Invoicelist.ListItems.Add 'create blank line'

Numitems = Invoice.Invoicelist.ListItems.count 'getting the index of the last entry

Invoice.Invoicelist.ListItems(Numitems).Text = txtcode.Text ' adds these coloulms reason invoice is used at front is because it is located on a different form

Invoice.Invoicelist.ListItems(Numitems).SubItems(1) = txtproductgroup.Text

Invoice.Invoicelist.ListItems(Numitems).SubItems(2) = txtcategory.Text

Invoice.Invoicelist.ListItems(Numitems).SubItems(3) = txttitle.Text

Invoice.Invoicelist.ListItems(Numitems).SubItems(4) = txtdescription.Text

Invoice.Invoicelist.ListItems(Numitems).SubItems(5) = Format(txtpriceinclude.Text, "##,##0.00") ' also incluldes format in which numbers need to be added

Invoice.Show

End If

End Sub The reason why it was important to include code that would stop blank lines being added to the invoice was because if add to cart was clicked by accident or an item was not selected first blank lines would appear in the invoice.

Invoice Form- The invoice from is where all items that have been added to cart go. Once in the list they can be viewed and removed if needed. A printing function has also been included to print of the invoices for customers.

Invoice List- Private Sub Form_Load()

Invoicelist.ColumnHeaders.Add , , "Code"

Invoicelist.ColumnHeaders.Add , , "Prod Group"

Invoicelist.ColumnHeaders.Add , , "Category"

Invoicelist.ColumnHeaders.Add , , "Title"

Invoicelist.ColumnHeaders.Add , , "Description"

Invoicelist.ColumnHeaders.Add , , "Price"

This adds the respected columns

Removing Items-

Private Sub cmdremove_Click()

Call remove 'calls this functionEnd Sub

Sub remove()

Dim count As Integer 'count is the counterFor count = 1 To Invoicelist.ListItems.count ' sets count to 1 and invoicelist as the top number If Invoicelist.ListItems(count).Selected Then ' removes that item from the array

Invoicelist.ListItems.remove (count) ' also adjusts the count Exit Sub End If

Next

End SubLogin Form-

Private Sub Command1_Click()

If LCase(usertxt.Text) = "admin" And LCase(passtxt.Text) = "password" Then ' sets passwordSubForm.txtcode.Visible = True ' allows these boxes to be shownSubForm.txtproductgroup.Visible = True

SubForm.txtcategory.Visible = True

SubForm.txttitle.Visible = True

SubForm.txtdescription.Visible = True

SubForm.txtpriceex.Visible = True

SubForm.txtpriceinclude.Visible = True

End If

Unload Me

End SubScreen DesignsMain Form

Subform

Login Form

Invoice Form

Main Form When Running

Sub Form When Running

Invoice Form When Running

Test Plans and Reports

Main Form- The first area of testing on the main for was generating the list and making sure it included each entry in the spreadsheet. The testing for this section was to make sure that the data field was reading of the excel spreadsheet properly

No others errors arose on this form.Sub Form- This form was the one with took the most time and effort this from is the core part of the program and it was important that everything worked smoothly and was bug freeBugs that arose from this form

List would duplicate every time form was activated

Blank lines would be added to invoice list

Only one item would appear in list at ( the item that appeared would be the last in the array) had to add a new line after each product was added so it would write to a fresh lineAll bugs where fixed and now program is free of all known bugsInstallation GuideProgram Requirements

To use Hcpc Data Basing you need Pc With a 500Mhz or higher Processor Pentium III or higher is recommended for its use

Microsoft Windows 98 operating system or higher

32 Mb Ram 128 Mb is recommended

CD-ROM drive

Super VGA (800x600)

Mouse

Keyboard

Microsoft excel and the corresponding columns, (sku, prod_group, category, title, description, price excl, price_inc and stock_qty)

Installing Hcpc Data Basing1. Turn on computer

2. Insert HcPc Databasing into your CD-ROM drive

3. If the CD does not manually load up. Click your CD icon and select auto run

4. Follow install prompts and you are done

5. Congratulations on installing HcPc Databasing

Read me ********************************************

Hcpc Data basing XP 1.0 (c) Copyright HCPC Technologies Corp.2004-2005 ********************************************

Thank you for using HcPc Data basing XP 1.0!

This README file contains the latest information about HcPc Data basing 1.0.

For complete

HcPc Data basing XP 1.0 instructions and usage, please refer to the online help or user's guide.

Introduction...Whats New in HCPC Data basing XP 1.0.....Selecting Your Product Group..

Modifying..

Login.....

Searching..

Add To Cart..

Invoicing...

Removing Items from Invoice..Printing..Exiting...HCPC Data basing XP News Letter.

For more details and further explanations of each function, refer to the online help or user's guide.

1) When executing the program the Product list will automatically generated and the program is ready to use.

2) Whats New In HCPC Data basing XP 1.0

a. Modify Existing Excel Documents

b. Print Invoices

c. Manage your Business more efficiently by having products arranged neatly

d. Administration Extras

3) Selecting Your Product Group Once the program is loaded and the product list has been generated it is then possible for the user to select the product group that they are interested in viewing. For example if they wish to see Business packages only the products under that area will be shown.4) Modifying Modifying can only be done if the user is logged in under administration. Once the password has been entered text box fields will appear and the user will be able to directly interact with the excel spread sheet.5) Login- The login screen will allow a user to login as admin and manually edit the excel spread sheet the User name = Admin and Password =Password once logged in modification can commence logging out will then hide the text boxes again so further modification can no longer be carried out6) Searching- The search field allows the user to type in the product code to find the product they need with ease. If the product is found in the list it will be highlighted7) Add To Cart- Add to cart will allow the user to add the selected product into the invoice list multiple products can be added8) Removing Items From Invoice- Removing items from invoice is done by simply selected the desired item that you wish to delete and clicking on remove9) Printing- Printing a invoice once the desired precuts have been placed in the list is easy just make sure a printer is hooked up to your computer and press print10) Exiting- Exiting can be done by clicking on the X on the top right of the screen on the main formHCPC Data basing XP News Letter - HcPc Technologies has a free monthly electronic newsletter that is dedicated to official announcements, tips, and techniques for HcPc Technologies products. You can view the newsletter online at www.hcpc.com.au/newsletter. HcPc Technologies can be reached at:

Voice: 801-437-8900

Web site: www.hcpc.com.au E-mail: [email protected] 2004-2005 HcPc Technologies. All rights reserved. HcPc Data Basing and its use are subject to a license agreement and are also subject to copyright, trademark, patent and/or other laws. Refer to the user guide or www.hcpc.com.au/legal for additional information about HcPc Data Basing patents. HcPc Technologies and HcPc Data Basing are registered trademarks of HcPc Technologies Corporation. All other brand and product names are trademarks or registered trademarks of the respective owners.HcPc Technologies has a free monthly electronic newsletter that is dedicated to official announcements, tips, and techniques for HcPc Technologies products. You can view the newsletter online at www.hcpc.com.au/newsletter. Code Hard CopyMain Form

Private Sub Form_Activate()

SubForm.Data1.Recordset.MoveFirst 'gets the information for the excel document from the recordset in subform

Do

If Not Inlist(SubForm.txtproductgroup.Text) Then 'if a item is not list it will add it

ListPro.AddItem (SubForm.txtproductgroup.Text)

End If

SubForm.Data1.Recordset.MoveNext ' will move the down till it finds next different value

Loop Until SubForm.txtproductgroup.Text = "" ' loop until a empty space in database

End Sub

Private Sub Form_Load()

Load SubForm

Load Invoice

'ListPro.AddItem "Business Packages"

'ListPro.AddItem "Gamer Packages"

'ListPro.AddItem "Home Packages"

'ListPro.AddItem "Barebone Systems"

'ListPro.AddItem "CD Labeling & Storage"

'ListPro.AddItem "CD-R & RW Media"

'ListPro.AddItem "CD -ROM"

'ListPro.AddItem "CD-RW ROM"

'ListPro.AddItem "CPU"

'ListPro.AddItem "Cables & Connectors"

'ListPro.AddItem "Case"

'ListPro.AddItem "DVD ROM"

'ListPro.AddItem "DVD-R & RW Media"

'ListPro.AddItem "DVD-R & RW ROM"

'ListPro.AddItem "Data Storage"

'ListPro.AddItem "Digital Cameras"

'ListPro.AddItem "FDD"

'ListPro.AddItem "Fans & Cooling products"

'ListPro.AddItem "Fax Machine"

'ListPro.AddItem "HDD"

'ListPro.AddItem "Intel Server Products"

'ListPro.AddItem "KVM"

'ListPro.AddItem "Keyboard"

'ListPro.AddItem "Labour"

'ListPro.AddItem "MP3"

'ListPro.AddItem "Mobile Phone Accessories"

'ListPro.AddItem "Modems"

'ListPro.AddItem "Monitor"

'ListPro.AddItem "Motherboards"

'ListPro.AddItem "Mouse & Input devices"

'ListPro.AddItem "Network"

'ListPro.AddItem "Printers"

'ListPro.AddItem "RAM"

'ListPro.AddItem "Scanners"

'ListPro.AddItem "Software"

'ListPro.AddItem "Sound Cards"

'ListPro.AddItem "Speakers , Headphones, Mic"

'ListPro.AddItem "Surveillance Camera Lenses"

'ListPro.AddItem "Surveillance Camera"

'ListPro.AddItem "Surveillance Card"

'ListPro.AddItem "Surveillance Connectors & Cables"

'ListPro.AddItem "Surveillance DVR"

'ListPro.AddItem "Surveillance Monitor"

'ListPro.AddItem "Surveillance Mounting"

'ListPro.AddItem "Surveillance Power Supplies"

'ListPro.AddItem "Surveillance System"

'ListPro.AddItem "Surveillance Video Transmission"

'ListPro.AddItem "UPS"

'ListPro.AddItem "USB & Firewire"

'ListPro.AddItem "Video, Audio Capture and TV & FM Tuners"

'ListPro.AddItem "Videocards"

'ListPro.AddItem "Warranty"

'ListPro.AddItem "Webcam"

'ListPro.AddItem "ZIP Drive"

End Sub

Private Sub ListPro_Click()

'open new form and generate product list based upon which item you clicked

Load SubForm

SubForm.Show

End Sub

Function Inlist(Category As String) As Boolean 'sets this funtion as a yes or no data type can be called

Dim Listnum As Integer 'sets list num as a integer data format

Dim count As Integer 'sets the counting moniter as a integer

Listnum = ListPro.ListCount - 1 '

For count = 0 To Listnum 'sets the count in the product list to 0

If ListPro.List(count) = Category Then 'if the string is in list then it is true and wont do anything

Inlist = True

Exit Function

End If

Next

Inlist = False

End Function ' this function is called by the Private Sub Form_Activate()to make it simple to code

Sub Form

Option Explicit

Private Const CODE_NUM As Integer = 0 'corresponds text box to colums

Private Const PRODGROUP_NUM As Integer = 1 'corresponds text box to colums

Private Const CATEGORY_NUM As Integer = 2 'corresponds text box to colums

Private Const TITLE_NUM As Integer = 3 'corresponds text box to colums

Private Const DESCRIPTION_NUM As Integer = 4 'corresponds text box to colums

Private Const PRICEEXE_NUM As Integer = 5 'corresponds text box to colums

Private Const PRICEINC_NUM As Integer = 6 'corresponds text box to colums

Private Const QUANTITY_NUM As Integer = 7 'corresponds text box to colums

Private Sub Cmdaddtocart_Click() 'adds products to the invoice form

Dim Numitems As Integer

If txtcode.Text "" Then ' this stops blank lines to being entered to into the code

Invoice.Invoicelist.ListItems.Add 'create blank line

'

Numitems = Invoice.Invoicelist.ListItems.count 'getting the index of the last entry

Invoice.Invoicelist.ListItems(Numitems).Text = txtcode.Text ' adds these coloulms reason invoice is used at front is because it is located on a different form

Invoice.Invoicelist.ListItems(Numitems).SubItems(1) = txtproductgroup.Text

Invoice.Invoicelist.ListItems(Numitems).SubItems(2) = txtcategory.Text

Invoice.Invoicelist.ListItems(Numitems).SubItems(3) = txttitle.Text

Invoice.Invoicelist.ListItems(Numitems).SubItems(4) = txtdescription.Text

Invoice.Invoicelist.ListItems(Numitems).SubItems(5) = Format(txtpriceinclude.Text, "##,##0.00") ' also incluldes format in which numbers need to be added

Invoice.Show

End If

End Sub

Private Sub cmdlogout_Click() 'this hides the text boxes that talk with the data base so products can not be modified

txtcode.Visible = False ' will not be visable when the form is displayed

txtproductgroup.Visible = False

txtcategory.Visible = False

txttitle.Visible = False

txtdescription.Visible = False

txtpriceex.Visible = False

txtpriceinclude.Visible = False

End Sub

Private Sub CmdModify_Click()

Load Login

Login.Show

'Modifys product list when admin is logged on

End Sub

Private Sub CmdOk_Click() 'seaching

Dim count As Integer 'declares counting vairble

For count = 1 To ProList.ListItems.count 'starts of at one and moves through the list

If LCase(txtSearch.Text) = LCase(ProList.ListItems(count).Text) Then 'searchs list for text in textbox (lcase case is not a issue)

ProList.ListItems(count).EnsureVisible 'adjusts screen to focus on searched item

ProList.ListItems(count).Selected = True 'highlights searched item

ProList.SetFocus ' puts focus on the list

End If

Next

End Sub

Private Sub Form_Activate() 'this generates the product list

Data1.Recordset.MoveFirst 'moves the record to first entry

ProList.ListItems.Clear 'clears list

Do

If MainForm.ListPro.List(MainForm.ListPro.ListIndex) = txtproductgroup.Text Then ' this loads up all objects in that category based on what was clicked in the main form

Call Addtolist ' calls this function

End If

Data1.Recordset.MoveNext 'moves 1 step in array

Loop Until txtcode.Text = "" ' loops until empty slot

End Sub

Private Sub Form_Load() ' this creates coloum headers (name)

ProList.ColumnHeaders.Add , , "Code"

ProList.ColumnHeaders.Add , , "Prod Group"

ProList.ColumnHeaders.Add , , "Category"

ProList.ColumnHeaders.Add , , "Title"

ProList.ColumnHeaders.Add , , "Description"

ProList.ColumnHeaders.Add , , "Price Ex Gst"

ProList.ColumnHeaders.Add , , "Price Inc Gst"

ProList.ColumnHeaders.Add , , "Stock Qty"

'ProList.ColumnHeaders

End Sub

Sub Addtolist() ' this creates the coloums

Dim Numitems As Integer

ProList.ListItems.Add 'create blank line

'

Numitems = ProList.ListItems.count 'getting the index of the last entry

ProList.ListItems(Numitems).Text = txtcode.Text

ProList.ListItems(Numitems).SubItems(PRODGROUP_NUM) = txtproductgroup.Text

ProList.ListItems(Numitems).SubItems(CATEGORY_NUM) = txtcategory.Text

ProList.ListItems(Numitems).SubItems(TITLE_NUM) = txttitle.Text

ProList.ListItems(Numitems).SubItems(DESCRIPTION_NUM) = txtdescription.Text

ProList.ListItems(Numitems).SubItems(PRICEEXE_NUM) = Format(txtpriceex.Text, "##,##0.00") ' (fomat that number will be displayed in)

ProList.ListItems(Numitems).SubItems(PRICEINC_NUM) = Format(txtpriceinclude.Text, "##,##0.00") '(fomat that number will be displayed in)

ProList.ListItems(Numitems).SubItems(QUANTITY_NUM) = txtstockqty.Text

End Sub

Private Sub ProList_ItemClick(ByVal Item As MSComctlLib.ListItem)

Data1.Recordset.MoveFirst 'moves the record to first entry

While ProList.SelectedItem txtcode.Text ' as long as the text in textcode box is not equal to selected item the code will continue

Data1.Recordset.MoveNext ' moves record forward one

Wend

End Sub

Login Form

Private Sub Command1_Click()

If LCase(usertxt.Text) = "admin" And LCase(passtxt.Text) = "password" Then ' sets password

SubForm.txtcode.Visible = True ' allows these boxes to be shown

SubForm.txtproductgroup.Visible = True

SubForm.txtcategory.Visible = True

SubForm.txttitle.Visible = True

SubForm.txtdescription.Visible = True

SubForm.txtpriceex.Visible = True

SubForm.txtpriceinclude.Visible = True

End If

Unload Me

End Sub

Private Sub Command2_Click()

Unload Me

End SubInvoice Form

Option Explicit

Private Sub cmdprint_Click()

Dim Printline As String

Dim num As Integer

MsgBox "Check printer is on and on-line", vbExclamation, "Invoicelist"

With Printer ' all these are Printer Properties

.FontName = "Times New Roman" 'set the printer font

.FontSize = 14 ' Set the font size

.FontUnderline = True 'underline off

Printer.Print ""

Printer.Print "Client Invoice" 'print the heading"

Printer.Print ""

Printer.Print ""

.FontSize = 11

.FontUnderline = False 'underline off

End With

Printer.Print "Code" + vbTab + vbTab + vbTab + "Prod Group" + vbTab + vbTab + vbTab + "Category" + vbTab + vbTab + vbTab + "Description" + vbTab + vbTab + vbTab + "Price"

Printline = Left(Invoicelist.ListItems(1).Text, 12)

Printline = Printline + vbTab + vbTab + vbTab + Left(Invoicelist.ListItems(1).SubItems(1), 12)

Printline = Printline + vbTab + vbTab + vbTab + Left(Invoicelist.ListItems(1).SubItems(2), 12)

Printline = Printline + vbTab + vbTab + vbTab + Left(Invoicelist.ListItems(1).SubItems(4), 12)

Printline = Printline + vbTab + vbTab + vbTab + Left(Invoicelist.ListItems(1).SubItems(5), 12)

Printer.Print Printline

Printer.EndDoc

End Sub

Private Sub cmdremove_Click()

Call remove 'calls this function

End Sub

Private Sub Form_Load()

Invoicelist.ColumnHeaders.Add , , "Code"

Invoicelist.ColumnHeaders.Add , , "Prod Group"

Invoicelist.ColumnHeaders.Add , , "Category"

Invoicelist.ColumnHeaders.Add , , "Title"

Invoicelist.ColumnHeaders.Add , , "Description"

Invoicelist.ColumnHeaders.Add , , "Price"

End Sub

Sub remove()

Dim count As Integer 'count is the counter

For count = 1 To Invoicelist.ListItems.count ' sets count to 1 and invoicelist as the top number

If Invoicelist.ListItems(count).Selected Then ' removes that item from the array

Invoicelist.ListItems.remove (count) ' also adjusts the count

Exit Sub

End If

Next

End Sub

Main Form

Sub form

Login Form

Invoice Form