سؤال

i have been googling around wether PHP can handle to print a receipt and kick the cash drawer through a web server?
i read about PHP-GTK2, but it seems cant handle trhough a web server, only for desktop use or standalong apps. is there anyway or sample code or links would be appriciated, please!

هل كانت مفيدة؟

المحلول

You're talking about a browser-based POS? The question should be more along the lines of "can I control the drawer/printer from a browser". PHP's involvement with this process would be to generate the page attempting to control either device. PHP will never execute on the client-side, so can't do anything about the hardware. You'd need Javascript or some other API in the browser to talk to the hardware.

نصائح أخرى

You will have to have software running on the client machine the drawer is hooked up to if not running a cash drawer receipt printer. You are not able to directly access the client machine for security reasons. Most cashdrawers connect via a printer that also sends the signal to pop the drawer on receipt printing. You would be able to pop the drawer in this method because the browser can be set up to print to that receipt printer just like any other normal printer.

If you are not using a receipt printer you can look into a fairly new drawer made by APG that is networked but last I knew it was not available yet.

Ethernet cash drawer

It's not beyond the realm of possibility to have a Java applet or Flash object kick the drawer open. A good number of them, as grantk noted, connect with a receipt printer and open on print -- or in some cases, when a certain character string is present. (I think.)

Now, since you can have JavaScript initiate a print, you could conceivably kick the drawer from any webpage. But, for the duration of the POS project I was working on, we never got the drawer auto-pop to work.) In the worst case, you can write a plugin to do the work. I'd try an applet first, of course.

However, if your PHP application runs on the same network as your POS stations, you can actually just add each printer to the server and print directly from the PHP app. And presumably, you can trigger the drawer similarly.

With WiFi enabled cash draws and printers I think you could be able to trigger a cash draw (located on a network) to open from anything that will kick off a web or socket request.

I have to build an EPOS system for work - as the old one is 20 years old and is crap! - plus building it yourself you have total control to design the stock and reporting exactly how you fancy.

Once I have played with the hardware I will report back :)

I know this is an old question, but the most simple solution is from within the printer/device configuration itself. Most POS printers have an option to trigger a drawer open, both on print or after printing. This goes for ALL Star, Citizen POS printers (or any POS printer for that matter). To access these settings, go into the device configuration options (in Windows based OS' - under Control Panel/Devices) and set it there.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top