Solved

Multiple transactions POS software

Posted on 2006-06-19
29
512 Views
Last Modified: 2010-04-07
Hey Experts

I am making POS software for a company.

The company have asked for the software to be able to handle multiple transactions

The problem is i dont know how to Implement it in visual basic i was thinking about multiple arrays

I am using a Microsoft Access Database.

Thanks

Northern_Lights
0
Comment
Question by:Nothern_Lights
  • 11
  • 9
  • 7
  • +1
29 Comments
 
LVL 35

Expert Comment

by:[ fanpages ]
Comment Utility
Do they mean multiple concurrent transactions?  i.e. a multi-user application where more than one transaction can be in progress on separate POS terminals at any given point in time.

Or, do they mean that they would like the facility for the POS terminal operator to 'park' the current transaction, open a new transaction, progress this until completion, then return to the first transaction, 'unpark' it, and continue with that?

Please advise further, after gaining clarification from your client, if necessary.

Thanks.

BFN,

fp.
0
 

Author Comment

by:Nothern_Lights
Comment Utility
Sorry about that fanpages

The facility for the POS terminal operator to 'park' the current transaction, open a new transaction, progress this until completion, then return to the first transaction, 'unpark' it, and continue with that is what the client wants.

Thanks

Northern_Lights
0
 
LVL 35

Expert Comment

by:[ fanpages ]
Comment Utility
Personally, I would create a Visual Basic application with a Multiple Document Interface (MDI) Form environment.

I would offer a "New Transaction" menu item (or button) & this would create a new form.  A record would be created in the database with a temporary transaction reference.  When the transaction is confirmed the reference would be replaced with a normal reference (so that you could distinguish between temporary & confirmed transactions).

Many "New Transaction" forms could be opened concurrently, and confirmed in any order, or a temporary transaction form could be closed (and the information would be retained within the database for subsequent selection/re-opening).

I would not progress using arrays to store data unnecessarily, if you have a dedicated database.

BFN,

fp.

0
 
LVL 17

Expert Comment

by:inthedark
Comment Utility
fanpages has a good idea. But not sure you even need to save with temporary transaction reference. Why not just wait until the operator clicks the Accept button or presses a special key like "F10" or something. You could also have a button "Hold" which would simply minimise the form. You can open as many MDI child forms as you need.

MDI form gives you a kind of desktop. Minimized forms just stack up along the bottom of the form. The operator just clicks on a minimized for to reopen it. No need any data.

When you open the form for each new transaction:

On Application startup or perhaps a key combination Alt/N

Sub OpenPOS
Dim frm As frmMyChild
Set frm = New frmMyChild
frm.Show
End Sub

After a transaction is complete, the is no need to reopen a new form just reset the variables.

On your pos form you could have a Hold button or key combination say ALT/H

Private Sub cmdHold_Click()
Me.WindowState = vbMinimized ' place transaction on hold
OpenPOS ' automatically open a new POS screen for next customer
End Sub

0
 
LVL 35

Expert Comment

by:[ fanpages ]
Comment Utility
"fanpages has a good idea. But not sure you even need to save with temporary transaction reference. Why not just wait until the operator clicks the Accept button or presses a special key like "F10" or something."

My reasoning was in case of application/machine failure.  Following a re-boot/re-start you would not need to re-key everything.

I also did not know if the system was a mail order (distance selling) concern or high street store, the ability to save details for retrieval later, not necessarily the same day, may be useful.

BFN,

fp.
0
 

Author Comment

by:Nothern_Lights
Comment Utility
Can fanpages or inthedark explain in more detail how to carryout multiple transactions using MDI forms I have never used them before.

Can i upload the current Beta of the POS to a server so you can see what the interface is like and the problem?

Thanks

Northern_Lights
0
 
LVL 17

Expert Comment

by:inthedark
Comment Utility
fanpages in a pos system if the system fails the computer manager and computer programmer both get sacked.  Just a few minutes after all of the customers walked out of the store. When the store manager reports his turnover for the week to the head office his job is on the line too.
0
 
LVL 35

Expert Comment

by:[ fanpages ]
Comment Utility
I worked for an software house specialising in EPOS software & hardware for over 5 years.  Do I sense you've had experience here too?
0
 
LVL 17

Expert Comment

by:inthedark
Comment Utility
MDI Applications

1) New project
2) Right click on form1 and select remove
3) Project, ADD MDI Form
4) change the name of the form to frmaMain or something, import  to give a name so will always be at the top of the forms
5) Add a picture box to the form just deep enough to put icons onto it like New, Save , Print, etc. The picture box will lock to the top of the form. Later you can add command buttons and put graphics on the buttons to act as your tool bar. Or you can use a cool bar but this can be a pain.
6) Right click on the mdi form and create the pull-down menus you will need like say: File, Edit, View, Window, Help, etc.
In the File menu add a menu item like New. Save the menu scrutctrue.
7) Click on file, New to show the code window and slap in a call to the OpenPOS sub.
8) Project , Add Form. Edit the form's properties and make sure that MDI child is selected and also show in task bar is set to false.
Edit the form's font so that it has the normal font styling that you wish to apply to you whole application.
In the add a few subs like this:
Public Sub SaveData()
End Sub
Public Sub PrintData()
End Sub

This is done so that if the operator clicks on a print icon, or selects the File-Print menu option. The code will look like this:

Sub mnuPrint()
Screen.ActiveForm.PrintData
End Sub

And for saving:

Sub mnuSave()
Dim frm as Form
On Error Resume Next
For each frm in Forms
   frm.SaveData
Next
End Sub

9) Select "Save As" and save the MDI Child form into the Projects Templates folder (normally C:\Program Files\Microsoft Visual Studio\VB98\Template\Forms)

Give the form a name like MDI Child.

Now remove the MDI child form from the project.

10) Projects, Add, Form, now select the MDI Child template. Change the name of the form to something like
frmcPOS

(frm then c, the c keeps all child forms together under the master form)

11) Add a module and create the OpenPOS Sub which is used by the

Sub OpenPOS
Dim frm As frmcPOS
Set frm = New frmcPOS
frm.Show
End Sub

12) In the MDI form the main application for (frmaMain) add into the form_load event

OpenPOS ' main data entry form will auto show at startup.

The application will now run. You add code as needed until the app is complete.

13) Customise your pull-down menus. With short-cut keystrokes. Like File-New could be ALT/N.
Prefix your pull-down menus &File, &Edit and sub menus too So that operator can also type ALT/F/N

etc.



0
 

Author Comment

by:Nothern_Lights
Comment Utility
My FTP Server is 192.168.1.2

Login Name = Experts Exchange
Password = Experts

Thanks

Northern_Lights
0
 
LVL 35

Expert Comment

by:[ fanpages ]
Comment Utility
Sorry?

Why are you providing log-on information to your LAN?
0
 
LVL 17

Expert Comment

by:inthedark
Comment Utility
Yes but mostly with head-office interacing, pricing updates and store signs systems, etc. Have done some till apps. Very serious processes. And sometimes with trade discounts, settlement discounts, BOGOFFs, multibuys. It was just one small step to do the same thing for web-site shopping baskets.

So I sugest that Nothern_Lights has a think about where the company is going before starting to code too much.

You could make your VB app work from a web-server.  In some ways this makes the app quite easy as you don't need to get envloved with so many events. But for bulk input, bar code readers etc. it more likely to be an MDI App.

I would write all of the code arround a couple of classes: OrderHeader and OrderLines.  In this way you can use the same code in your MDI child as you do in your web-site to work out totals, costs, discounts, multi-currency issues etc.
 
0
 

Author Comment

by:Nothern_Lights
Comment Utility
inthedark

I am interested in VB app work from a web-server how would i go about doing this

do you have any examples

Thanks

Nothern_Lights
0
 
LVL 30

Expert Comment

by:nmcdermaid
Comment Utility
Sorry to shake your world but you will not be able to create a reliable POS system using MS Access and VB arrays.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 17

Expert Comment

by:inthedark
Comment Utility
Web system would be a little complicated as you would need to create activex to handle input from bar code readers etc.

nmcdermaid I suspect that Nothern_Lights is using a VB client to access the MS Access database.

Web apps:

1) The client browser sends a Request to a server. This is done using the URL.

http://myserver/myfile.asp?field1=data1&field2=data2

The request is defined like this:

protocol//servername/documentname?querystring

The operator cannot se it but each time a browser sends a request, it also sends any cookies that the server has given it before. The first time a server receives a request from a scpecific client the server starts a session. A session is like a bucket called the Session object. The software can put stuff into the bucket. Each client has a different bucket. The contents of the bucket stay on the server.  If the operator does not make a request for a few minutes, say 20, the bucket gets emptied (session time-out).

In the example myfile.asp will start to run.  The ASP file is simple and just sets going a VB DLL which you create using ordinary VB using the ActiveX DLL new project model.

As simple ASP page will look like this:

Dim MyDLL
Set MyDLL = Server.CreateObject("MyProject.MyClass")
MyDLL.Run Server, Session,  Request, Response ' process the request

The main IIS objects Server, Session,  Request, Response are passed as parameters to your application

2) The class  decodes the querystring and sends a Response. The response can also include cookies, to identify the user.

The response can include either information or data entry fields.. The response can also include DHTML and scripting, so that when the opertor does stuff code runs in his browser to perform specific tasks. When data entry fields are present they can be returned to the server as a block of data, called POST or as URL fields known as query string fields.  This is control by the HTML.

So how does the software know what data to display:

Private Sub Display
' Create html to send back to the client
sPage =LCase( Request.QueryString("page"))
Select Case sPage
    Case = 'order': DisplayOrder ' run the subroutine to display the order
    Case = 'info': DisplayInfo ' run the subroutine to display some info
etc.
End Select
End Sub

Sample HTML:

<html>
<body>
<form method='post' action='http://server/myfile.asp?page=order&user=12345'>
Enter product code:
<!-- this is a comment. The following hidden item is present on all forms in the system -->
<input type='hidden' name='HID' value='order' size='0'>
<input type='text' name='code' value='ABCDE' size='10'>
Price: <input type='text' name='price' value='10.34' size='10'>

<input type='submit' name='action' value='Add'>
<input type='submit' name='action' value='Hold'>
<input type='submit' name='action' value='Cancel'>
</form>
</body>
</html>

3) The client decodes the response and display the web-page. The user types in the data and clicks on a button (Submit input type). When a submit button is clicked the data in the form is sent back to the server as a new request.

So the Run subroutine will look like this:

Public Sub Run(pServer, pSession, pRequest, pResponse)

' web apps must be very good at recording problems
On Error GoTo ErrorTrap

mSaveTickcount = GetTickCount ' we will want to know how long it took to create a request

' set up IIS objects to be visible throughout the application
Set Server = pServer
Set Session = pSession
Set Request = pRequest
Set Response = pResponse

' Is this a new user?
If Val(Session("UserID")) < 1 Then
    StartSession ' call the sub that sets up data and cookies for a new session
End If

' Log the details of the Hit
LogHit "S"

' Is data present in the request object
mbRequest = Len(Request("HID")) > 0
If mbRequest Then
    HandlePost ' save the incomming data
End If

If OutputMode = Failed Then
    GoTo ReportError
End If

' Did the handling of the response cause a new URL to be needed?
If OutputMode = Redirect Then
     Response.Redirect msRedirect ' tell the client to request a new page
     Exit Sub
End If

' Create the HTML
Display
If OutputMode = Failed Then
    GoTo ReportError
End If

' perhaps display sub needed to go elsewhere
If OutputMode = Redirect Then
     Response.Redirect msRedirect ' tell the client to request a new page
     Exit Sub
Else
      Response.Write msHTML ' send the response to the client
End If

sStatus = "OK"

Exiter:
LogHit Status ' logs details of hit and time taken to process
Exit Sub

ErrorTrap:
ErrN = Err.Number
ErrD = Err.Description

ReportError:
On Error Resume Next ' prevent looping

LogError ' send email with details of any errors
sStatus = "FAIL"
GoTo Exiter

End Sub


 
0
 
LVL 30

Expert Comment

by:nmcdermaid
Comment Utility
Whatever he uses as a client, MS Access is not a 'recoverable' database. Its just not reliable enough.

Anyway I don't seem to be adding anything constructive so I'll bow out now!
0
 
LVL 17

Expert Comment

by:inthedark
Comment Utility
nmcdermaid does have a good point.  Access can be used for vaildation of data. But best place to save POS transactions is a text file using good old binary access opens which support sharing and locking. Which can then be imported by a procedure which can handle recovery.
0
 

Author Comment

by:Nothern_Lights
Comment Utility
inthedark

So what you are saying is that I need to have a procedure to write the all the transaction information into a temp text file and then once the transaction is done clear the text file.

Inthedark do u have IM client or a e-mail address I can contact you on?

Thanks

Nothern_Lights
0
 
LVL 17

Expert Comment

by:inthedark
Comment Utility
No dump the sales transactions into a text file. DO NOT UPDATE YOUR DATABASE WITH LIVE DATA. If your database is down you can carry on trading. You then have a diffent process that updates the database.  In this way you can change the back-end database without affecting the POS or change the pos without affecting the back-end. back-end = sales and stock levels data.  You can update stock levels live if you want but codes needs to be able to work offline.
0
 
LVL 35

Expert Comment

by:[ fanpages ]
Comment Utility
"Inthedark do u have IM client or a e-mail address I can contact you on?"

All correspondence should be restricted to comments posted here only, as private messages can be seen as one Expert having an unfair advantage over any other.

0
 

Author Comment

by:Nothern_Lights
Comment Utility
I am getting a error when i try to run the code Sub OpenPOS

Sub OpenPOS
Dim frm As frmMyChild          - Compile Error "User-Defined type not defined"
Set frm = New frmMyChild
frm.Show
End Sub

The Code for the VB Web Server App there is an error
Set MyDLL = Server.CreateObject("MyProject.MyClass")  - Compile Error "Invalid Outside Procedure

Help

Thanks

Nothern_Lights
0
 

Author Comment

by:Nothern_Lights
Comment Utility
I have another problem i am trying to read inforamtion from the form caption but its reading the origional caption text not the one that is on screen

In the frmSaleToClient properties i have in the caption "Sale To Client"

but i have changed it to show the Transaction ID using the following code

Dim frm As New frmSaleToClient

Transcode = Transcode + 1

frm.Caption = Transcode

frm.Show

then in the

frm_load

I have lblTest.Caption = Me.Caption

so i should read "1" but it still says "Sale To Client"

How do i fix this problem

Thanks

Nothern_Lights
0
 
LVL 35

Expert Comment

by:[ fanpages ]
Comment Utility
All FYI:
"Giving a Form a Unique ID"
[ http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21895348.html ]

I am going to respectfully retire from this question as it seems to have moved on since I made my original comments.

BFN,

fp.
0
 
LVL 17

Expert Comment

by:inthedark
Comment Utility
frmMyChild was just an example form name.  You should use whatever name you gave to your MDI child form.

Also "MyProject.MyClass" was an example. If you want to go the web-server route you ned to create an ActiveX DLL project. You need to have at least one public class. So you would change MyProject to whatever you called your project and
change my class to be the name of your public class.
 
0
 
LVL 17

Accepted Solution

by:
inthedark earned 500 total points
Comment Utility
You have a timing problem with the evnts that are taking place.

1) Make sure the startup object is the MDI master form.

2) You did not copy the code for launching the form here it is again

a) new project standard exe
b) add mdi form to project
c) change project startup object to mdiform
d) change form1 properties: mdichild=true; show in taskbar as false
e) pase the following code into the mdi form
f) hit tun and click on the form to launch a new mdi child


---------------in a smaple mdi form with an mdi child called form1
Option Explicit

Dim id As Long

Private Sub MDIForm_Click()
id = id + 1
Dim frm As Form1
Set frm = New Form1
frm.Caption = CStr(id)
frm.Show
End Sub

0
 

Author Comment

by:Nothern_Lights
Comment Utility
inthedark

It is possible to use and SDI interface instead of using MDI

Thanks

Nothern_Lights
0
 
LVL 17

Expert Comment

by:inthedark
Comment Utility
Yes you can create new forms in sdi in the same way. The difference is that you have to keep a track of which forms you created.

0
 

Author Comment

by:Nothern_Lights
Comment Utility
Thanks for all your help inthedark my program can now handle multiple transactions :)

Nothern_Lights
0
 
LVL 17

Expert Comment

by:inthedark
Comment Utility
Cool. Now all you have to do is make sure it will never crash!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now