UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Point Of Sale Screen Display, Any Version    
 
   
Peter Hibbs
post Apr 23 2012, 10:26 AM
Post#1


UtterAccess VIP
Posts: 1,613
Joined: 17-June 10
From: Dorset. UK.


On a typical Point-of-Sale screen a form would probably have a number of grouped buttons which represent various options that the user can select as well as a menu system to select groups of items. For example, a restaurant terminal where the check out operator would be able to select a main type of item (Beverages, Drinks, etc) and then choose items within the selected group to add to the bill.
The conventional method to create this sort of form would be to have dozens of separate buttons on the form which would have the captions changed whenever a group was selected and some code behind every button to process the events depending on the currently selected group. The problem with this method is that it is not very flexible and making any changes to the form contents can result in a lot of changes to the VBA code which can be 'messy' and time consuming.
Where the screen buttons are the same size and are in a specific grid pattern it can be easier and more efficient to use a different technique to detect the buttons that are pressed by the user and that is to use a single transparent button over a grid of Label controls and when a square in the grid is clicked, the X and Y co-ordinates of the button are used to determine which grid cell was selected and take the appropriate action. In the attached demo below, there are a possible 192 selections available to the user but there are only two Command buttons on the whole form (see the screen shots below). This means that only a few lines of VBA code are required to give a large number of possible choices to the user which, in turn, is easier to program and maintain. Also, since the button captions (and other parameters such as colors, format, etc) are stored in a table, it is easier for the users to set up their own screen layout by providing them with a form in which they can edit or add to the various groups and sale items on the form (this facility is not provided in this demo though). The main criteria for the grid layout is that all the Label controls must be the same size and shape so that the position of the label can be calculated from the X and Y co-ordinates of the hidden button when the button is clicked.
The table (tblSaleItems) holds the information for each sale item name, the price of the item, the main group in which it belongs and a location reference which determines in which grid cell the item will be displayed. This is the grid co-ordinate in the format 00 (top left cell) to 53 (bottom right cell). The ItemRef field is an AutoNumber field and is not actually used in the demo. The VBA code is fairly well documented but if there is anything that is not clear then feel free to post any questions here. Note that the blank cells need some character (I have used an asterisk) because a Label type control will not display if it has no caption value. Of course, in a real PoS database there would need to be more code to add the prices together for each selected item and display the total on screen, edit an item price, print a bill, etc, etc but this demo is only intended to demonstrate the button selection technique. Also note that if you want to change any of the Label controls on the form you will need to move the 'invisible' button out of the way first. In fact, you could make these buttons very small in Design mode and then resize and re-position them at Run time which would make altering the form controls a bit easier at Design time.
The 12 button keypad (which is separate from the main demo) just shows how the same method could be used to enter a number into a Text field. The button events for the hidden button here are also used to change the label Special Effect property to simulate a button press.
This demo is written in A2003 but works OK in later versions.
Peter Hibbs.
Attached File(s)
Attached File  POS_Image_1.png ( 36.19K )Number of downloads: 869
Attached File  POS_Image_2.png ( 36.62K )Number of downloads: 651
Attached File  POS_Demo.zip ( 133.17K )Number of downloads: 850
 
Go to the top of the page
 
ixxo09
post Oct 25 2018, 06:29 PM
Post#2



Posts: 11
Joined: 30-September 18



Hello Peter nice job with this code.

I need some of your help. if I press a button insted of showing the price, how can I do it to show in a listbox or another control , the quantity, product name, price and total and insert it in a bill table.
I had tried thinking firstable with a bound listbox and later on with unbound but no luck. Could you give me a hand?
Go to the top of the page
 
Peter Hibbs
post Oct 26 2018, 10:40 AM
Post#3


UtterAccess VIP
Posts: 1,613
Joined: 17-June 10
From: Dorset. UK.


Hi ixxo09,

Not sure if this is exactly what you are looking for but maybe you can adapt it for your own requirements.

I have added two tables to the original demo, table tblSales holds one record for each order and table tblSaleGoods holds one record for each item on the order and is linked to the first table.

It works like this :-

When the form first opens the selection buttons are all disabled.
The user would click the New Sale button to start a new order.
The user can then click on the buttons as before and each time a food item is clicked, it is added to the list of items for the order and the total price is calculated.
You can change the Quantity value on an order manually or you can just click the same item again which will increment the Quantity value by one for that item.
If you enter an item in error you can click on that item and then click the Delete Item button to remove it from the list immediately.
If you want to delete the whole order you can click the Cancel Sale button to do that after a warning message.

If you want to find an existing order you can click the Find Sale button, select the required order in the pop-up form list and then click the Show Sale button (or just double-click the relevant order in the list). This list shows the date and times of each order along with the total quantity and prices for each order.

The VBA code is pretty well commented so you should be able to see how it works and make any changes you require for your situation. Good luck and I hope this helps.

Peter Hibbs.
Attached File(s)
Attached File  POS1.png ( 48.97K )Number of downloads: 38
Attached File  POS_Demo_V2.zip ( 151.68K )Number of downloads: 59
 
Go to the top of the page
 
JtrilloJ
post Oct 26 2018, 12:08 PM
Post#4



Posts: 1
Joined: 5-January 18



Peter: An excellent work of yours. Congratulations
However, for the countries that use the comma in the decimal separation, it gives an unimportant error, but in case it interests some reader, the Instruction
"INSERT INTO TblSaleGoods (SaleNo, SaleItem, Quantity, SalePrice) VALUES (" & Me.txtSaleNo & "," _
& "" "" & vItem & "" "" & "," & "1," & vPrice & ")" 'insert new item into main order

Must be:
"INSERT INTO TblSaleGoods (SaleNo, SaleItem, Quantity, SalePrice) VALUES (" & Me.txtSaleNo & "," _
& "" "" & vItem & "" "" & "," & "1," & Replace (vPrice, ",", ".") & ")" 'insert new item into main order
My best regards >> Jacinto Trillo
Go to the top of the page
 
ixxo09
post Oct 26 2018, 12:10 PM
Post#5



Posts: 11
Joined: 30-September 18



Hello Peter

First of all thank you very much !! for the code. It's amazing how quickly you've done it. I will adapt it to my needs. Many thanks.

joe

Go to the top of the page
 
Peter Hibbs
post Oct 26 2018, 01:01 PM
Post#6


UtterAccess VIP
Posts: 1,613
Joined: 17-June 10
From: Dorset. UK.


Hi Jacinto,

OK, thanks very much for that update, I am sure it will be useful for some developers.

Hi Joe,

OK, good luck with your project.

Peter Hibbs.
Go to the top of the page
 
tserhung
post Nov 19 2018, 01:36 AM
Post#7



Posts: 20
Joined: 4-April 18



Attached File  POS_Design_View.JPG ( 149.39K )Number of downloads: 40
Hi Peter Hibbs,

Thank you for sharing your amazing codes which l'm looking for quite some time. Could you please advise me when I wanted to add more Main Menu Buttons - 8 Vertical x 3 Horizontal (yours is 9 Buttons in 1 Vertical). I'm stuck in assign the value to txtGroupNo and Label naming for Submenu - 7 Vertical x 4 Horizontal.

I attach the image for your kind advice.

I'm appreciated if you could help me

Thank you
This post has been edited by tserhung: Nov 19 2018, 01:37 AM
Go to the top of the page
 
Peter Hibbs
post Nov 19 2018, 07:22 AM
Post#8


UtterAccess VIP
Posts: 1,613
Joined: 17-June 10
From: Dorset. UK.


hi tserhung,

OK, firstly, if you want to use the same method that I am using to identify which button is being clicked, you must make all the buttons exactly the same size and they must be equally spaced apart vertically and horizontally because the code to find the button being clicked uses the positions and sizes of the buttons to calculate the button name. For example, to add more buttons to the 'Items' group you should add the extra row (as you have done) and change the button name property to match the existing button names. So the seventh row that you added should have the button names as Label60, Label61, Label62 and Label63. Then, in the code for the cmdItem_MouseDown event, you would change the line vY = Y \ (Me.cmdItem.Height \ 6) to vY = Y \ (Me.cmdItem.Height \ 7) because you now have 7 rows of buttons. You would also need to make a similar change to the code in the ClearSelections sub-routine so that those extra buttons are cleared when a button is clicked.

The 'Group' menu is a bit trickier because I did not need multiple columns so I did not need the extra code to identify the column buttons but basically you would need to use the same technique that is used in the 'Items' code for this group. You should name the buttons in the Group using the same system but obviously you must use a different prefix than the 'Items' group of buttons, perhaps something like Group00, Group01, Group02 and so on. Then you can use similar code in the cmdGroup_MouseDown event that is used in the cmdItem_MouseDown event to calculate which button was clicked.

You will, of course, also need to change the main table (tblSaleItems) to cater for the extra buttons and slightly different button names. For example, the ItemGroup field would need to be changed to a Text type field and have two digit codes rather than one digit as it has now.

Hope that helps but let us know how you get on and good luck with the project.

Peter Hibbs.
Go to the top of the page
 
tserhung
post Nov 21 2018, 01:05 AM
Post#9



Posts: 20
Joined: 4-April 18



Hi Peter

Thank you for your valuable advice and time.

Yes, the 'Group Main Menu' is most tricky part for me because I'm not so familiar with VBA coding. I'm still learning from your codes and hope it's working.

tserhung


Go to the top of the page
 
ZapDude
post Nov 23 2018, 03:22 PM
Post#10



Posts: 296
Joined: 27-February 06
From: Long Beach CA


QUOTE
I have used an asterisk) because a Label type control will not display if it has no caption value.


Actually, what is happening is that your recordset object creates an error if there is no data (Null) in the field that supplies the label captions. So I made two quick changes to your code.

First change: Look for this line in the DisplayMenuItems procedure:

CODE
vCtrl.Caption = rst!ItemName

Simply add the Nz function to the recordset item to create a zero-length string as follows:

CODE
vCtrl.Caption = Nz(rst!ItemName, "")

Next, locate the following line in the cmdItem_MouseDown procedure:

CODE
If vCtrl.Caption <> "*" Then

... and substitute "*" with "" (zero-length string).
Finally, go to your table and delete the *'s from the records.

That takes care of label captions. Now, if you want to take it a step further, add this line of code right below the line you adjusted for the Nz function in the DisplayMenuItems procedure as follows:

CODE
vCtrl.BackStyle = IIf(vCtrl.Caption <> "", 1, 0)

This sets the BackStyle property of the labels to transparent if there is no caption. Now when you navigate the Items board you will notice that there are no unlabeled buttons at all.

Now, one last change. Go back to the cmdItem_MouseDown procedure, and locate the following line:

CODE
ClearSelections

Now, move that line below the If statement you adjusted earlier

CODE
If vCtrl.Caption <> "" Then
              ClearSelections

Now, if you click on a label with no caption, then it won't perform the True conditions on the If statement, which now includes the sub ClearSelections. This means that no changes are made to the screen unless you select an item with a label on it.

Of course, this is just a Q&D (quick and dirty) method for display purposes, but it does add to the ease of user interoperability.
This post has been edited by ZapDude: Nov 23 2018, 03:48 PM
Go to the top of the page
 
Peter Hibbs
post Nov 25 2018, 07:54 AM
Post#11


UtterAccess VIP
Posts: 1,613
Joined: 17-June 10
From: Dorset. UK.


Hi ZapDude,

OK, thanks for the info, I am sure there will be some users that will find this useful.

Cheers,

Peter Hibbs.
Go to the top of the page
 
ixxo09
post Nov 30 2018, 04:22 AM
Post#12



Posts: 11
Joined: 30-September 18



Hello everybody:

I need a little bit of help. Does somebody knows whow I pass the query´s parameter to a listbox control?. I appreciate the help. Thanks.


CODE
Private Sub RunParameterQuery_DAO(ByVal pstrDate As String)
  ' Comments: Runs a query containing parameters

    Dim rs As DAO.Recordset

    With CurrentDb().QueryDefs("qryCloseCashDrawler")
        .Parameters("[Month]").Value = pstrDate
        Set rs = .OpenRecordset()
        With lstCashDrawler
            .RowSource = rs.Name     ???
            .Requery
        End With
    End With

End Sub

rs.Close
set rs = Nothing
Go to the top of the page
 
Peter Hibbs
post Dec 5 2018, 07:15 AM
Post#13


UtterAccess VIP
Posts: 1,613
Joined: 17-June 10
From: Dorset. UK.


Hi ixxo09,

What exactly are you trying to do and has it got anything to do with the Point of Sale demo which does not use a List box control?

Peter Hibbs.
Go to the top of the page
 
ixxo09
post Dec 5 2018, 08:21 AM
Post#14



Posts: 11
Joined: 30-September 18



Hello Peter thanks for reply. Already Sorted It out. Instad of using a subforn I used a lisbox control. Regards joe
Go to the top of the page
 
Peter Hibbs
post Dec 5 2018, 08:55 AM
Post#15


UtterAccess VIP
Posts: 1,613
Joined: 17-June 10
From: Dorset. UK.


OK, excellent.

Peter.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    13th December 2018 - 10:30 AM