GallusMax / open-source-self-check

An OpenSource Selfcheck system that is FAST, intuitive and - Free Software! Enhancements against the code from code.google.com/p/open-source-self-check
GNU General Public License v3.0
6 stars 4 forks source link

Automatically return focus to main self-check window after printing receipt #8

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Auto-printing receipts takes focus from self-check main window
2. This may be the result of using a touchscreen monitor with auto-printing
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
We are running version 1.043 on Windows XP.

Please provide any additional information below.
Eric,

A few months ago, you revised the print.js file used in your software so that 
receipts would print automatically after each item was scanned in our 
implementation of your self-checkout software. We have upgraded to a touch 
screen monitor for our self-check station at this point. This works well, but 
when receipts are auto-printed cursor focus is lost from the main screen. 
Patrons can checkout one item and get a receipt. If they try to scan another 
item barcode nothing happens - unless they touch the screen again to return 
cursor focus to the main screen. 

Is there a way to return focus to the main self-check window after 
auto-printing a receipt? I see the "parent.focus();" line at the end of the 
print.js file - but it is not returning focus to the main screen. Would another 
command return focus from print.js to the checkout screen?

If it is not possible to return focus after printing a receipt automatically, 
there may be another approach that would work. After each checkout, we could 
display a window directing patrons to insert receipts into the item just 
checked out. The window could have one button to "Checkout Another Item" and 
one button to "End Checkout Session." Pressing either button would grab focus 
from the auto-print child window - and let patrons choose what to do next. 

If we need to add a window with the action buttons described above, is there 
another file we could use as a starting point? Unfortunately, I do not know 
anything about javascript. It would be a great help if you could point me in 
the right direction. Thank you for any help you can provide.

Eric at Town & Country PL

Original issue reported on code.google.com by amendic...@gmail.com on 22 Apr 2011 at 1:03

GoogleCodeExporter commented 8 years ago
Strange. I remember testing it on our touchscreens and it worked. Try changing 
parent.focus() to:

parent.top.$('#barcode).focus();

Let me know the result.

Original comment by ericmelton1@gmail.com on 22 Apr 2011 at 1:34

GoogleCodeExporter commented 8 years ago
Eric,

Thank you for your reply. Unfortunately, replacing the
"parent.focus();" text with "parent.top.$('#barcode).focus();" in
print.js appears to break the application. After making the change,
scanning item/patron barcodes never produces any result.

Is there another option to return focus to the checkout screen? Or is
it necessary for us to create buttons that display after every
checkout for patrons to return focus to the checkout screen? One
button to "Checkout Another Item" and another to "End Checkout
Session" could work.

Thank you for your continued help.

Original comment by amendic...@gmail.com on 29 Apr 2011 at 12:42

GoogleCodeExporter commented 8 years ago
If I remember right, one of the files I sent you a while back was 
processes/checkout.php and one of the changes was a line that contained 
something like 
$('print_item_list_div').print(); or something like that. Try adding this after 
that line

setTimeout(function(){ $('#barcode').focus(); }, 200);

Let me know how it works out.

Original comment by ericmelton1@gmail.com on 29 Apr 2011 at 1:06

GoogleCodeExporter commented 8 years ago
Eric,

I think that I put the text in the appropriate place in the
checkout.php file, but an error displays when I try to checkout an
item. The error reads, "Parse error: syntax error, unexpected
T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in
C:\wamp\www\selfcheck\processes\checkout.php on line 165."

The relevant section of the checkout.php reads:
$(document).ready(function(){
    $("#loading").hide();
    $("#cancel").hide();
    $("#user_cko_buttons").show();
    $("#checkout_count").html("'.$_SESSION['checkouts'].'");
    $("#print_item_list_table .checked_out_item").html(item);
    $("#item_list_div").attr({ scrollTop:
$("#item_list_div").attr("scrollHeight") });
    $("#print_item_list_div").print();
    setTimeout(function(){ $('#barcode').focus(); }, 200);
';

When I put the text "setTimeout(function(){ $('#barcode').focus(); },
200);" after the closing " '; " as follows:
$(document).ready(function(){
    $("#loading").hide();
    $("#cancel").hide();
    $("#user_cko_buttons").show();
    $("#checkout_count").html("'.$_SESSION['checkouts'].'");
    $("#print_item_list_table .checked_out_item").html(item);
    $("#item_list_div").attr({ scrollTop:
$("#item_list_div").attr("scrollHeight") });
    $("#print_item_list_div").print();
';
    setTimeout(function(){ $('#barcode').focus(); }, 200);

I see another error, "Parse error: syntax error, unexpected '(',
expecting T_VARIABLE or '$' in
C:\wamp\www\selfcheck\processes\checkout.php on line 160."

Am I pasting the string in the wrong place? Thank you for your
continued help; have a good day.

Eric at Town & Country PL

Original comment by amendic...@gmail.com on 29 Apr 2011 at 11:18

GoogleCodeExporter commented 8 years ago
My bad. The single quotes (') are messing it up.

try...

setTimeout(function(){ $("#barcode").focus(); }, 200);

The whole bit you included in your messages should look as follows...

$(document).ready(function(){
    $("#loading").hide();
    $("#cancel").hide();
    $("#user_cko_buttons").show();
    $("#checkout_count").html("'.$_SESSION['checkouts'].'");
    $("#print_item_list_table .checked_out_item").html(item);
    $("#item_list_div").attr({ scrollTop:
        $("#item_list_div").attr("scrollHeight") });
    $("#print_item_list_div").print();
        setTimeout(function(){ $("#barcode").focus(); }, 200);
';

Original comment by ericmelton1@gmail.com on 30 Apr 2011 at 12:26

GoogleCodeExporter commented 8 years ago
Eric,

Adding that line to the ...processes/checkout.php file doesn't break
anything, but it doesn't return focus to the checkout screen either.
The first checkout always works and auto-prints a receipt. However, if
I scan another item nothing happens - until I touch the touch screen
monitor to return focus to the checkout window. After that, I can
checkout an item and a receipt prints. If I touch the monitor screen
again, I can checkout another item.

Are there other commands that I should try?

If not, would the other option I mentioned work? Since touching the
touch screen monitor would return focus to the checkout screen, would
adding a button that does nothing be a passable workaround? It could
be displayed to the left of the "Finish/Logout" button at the bottom
of the screen. Patrons would touch it after each item was checked out
- just to return focus to the checkout window.

Of course, the button approach is not as elegant as using a "focus"
command. It seems like a feasible backup plan though. How would I add
a "Checkout Another Item" button to the left of the "Finish/Logout"
button on the checkout screen. Since the new button would not actually
do anything in your self-checkout software, I'm assuming it would be
pretty easy to manage.

Thank you for your continued help; have a good day.

Eric at Town & Country PL

Original comment by amendic...@gmail.com on 30 Apr 2011 at 10:45

GoogleCodeExporter commented 8 years ago
Try one more thing...

in js/print.js after objFrame.print();

put...

setTimeout(function(){ objFrame.remove(); }, 200);
setTimeout(function(){ $("#barcode").focus(); }, 300);

Original comment by ericmelton1@gmail.com on 30 Apr 2011 at 11:17

GoogleCodeExporter commented 8 years ago
Eric,

Unfortunately, that did not change anything. Just to make sure that
I've made the correct changes, I'll list them below.

The relevant section of ...js/print.js is:
    // Print the document.
    objFrame.focus();
    objFrame.print();
    setTimeout(function(){ objFrame.remove(); }, 200);
    setTimeout(function(){ $("#barcode").focus(); }, 300);
    parent.focus();
    // parent.top.$('#barcode).focus();
If I comment out the "parent.focus();" and enable
"parent.top.$('#barcode).focus();" the self-check software stops
responding to barcode scans.

The relevant section of .../processes/checkout.php is:
 $(document).ready(function(){
    $("#loading").hide();
    $("#cancel").hide();
    $("#user_cko_buttons").show();
    $("#checkout_count").html("'.$_SESSION['checkouts'].'");
    $("#print_item_list_table .checked_out_item").html(item);
    $("#item_list_div").attr({ scrollTop:
$("#item_list_div").attr("scrollHeight") });
    $("#print_item_list_div").print();
    setTimeout(function(){ $("#barcode").focus(); }, 200);
';

Have I made the wrong changes somewhere?

Thank you for your continued help.

Eric at Town & Country PL

Original comment by amendic...@gmail.com on 30 Apr 2011 at 11:40

GoogleCodeExporter commented 8 years ago
Remove..
setTimeout(function(){ $("#barcode").focus(); }, 200);
from processes/checkout.php

remove...
parent.focus(); 
//parent.top.$('#barcode).focus();

from js/print.js

let me know..

Original comment by ericmelton1@gmail.com on 30 Apr 2011 at 11:44

GoogleCodeExporter commented 8 years ago
Eric,

I made the changes you suggested, saved them, reloaded the page and
tried two different test checkouts. Unfortunately, the focus problem
persists.

Do you have any other suggestions?

Thank you for your continued help.

Eric at Town & Country PL

Original comment by amendic...@gmail.com on 30 Apr 2011 at 11:51

GoogleCodeExporter commented 8 years ago
I'm working on a possible solution.

Original comment by ericmelton1@gmail.com on 2 May 2011 at 2:08

GoogleCodeExporter commented 8 years ago
Everything ok now?

Original comment by ericmelton1@gmail.com on 3 May 2011 at 12:34

GoogleCodeExporter commented 8 years ago
Eric,

Everything with the selfcheck is working great - thanks to your
special attention. Our library is grateful for your work. I don't know
why anyone would pay for a commercial unit when yours works just as
well. I just wish your site had a "donations" link, so that we could
help you continue to help other libraries.

Thank you for all of your help. I can't promise that I won't have more
questions, but you've made the staff at Town & Country PL very happy.

Eric at Town & Country PL

Original comment by amendic...@gmail.com on 3 May 2011 at 12:23

GoogleCodeExporter commented 8 years ago
Great! Glad it's working.

Original comment by ericmelton1@gmail.com on 3 May 2011 at 1:40