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 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
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.
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.
Related
First of all, sorry for my English, I have been with this problem for quite a few days. I will comment on my situation: I am doing an online ordering system, where once an order is created the ticket printing is triggered. I have tried using Google Cloud Print, it prints but it takes a long time and it does not work as it should, I tried a library called mike42, it prints perfect but not from a website.
The system is in a hosting and I am using PHP together with slim 3, if any of you know how to solve this I would really appreciate it.
The result I want (to be more specific) is the following: The employed user logs on the web (system hosted in the hosting), goes to the orders menu, when he clicks on create the order, this function is executed and prints the ticket directly on the thermal printer connected to the local machine. The same works only if the web is on the local server, which is not what I want.
The title is clear and complete. Printing must take place in client side browser. Client may be connected to a cloud based accounting or purchase system and POS termal printer is connected through a USB port. Computer mat be a zero client with just a browser.
Well, PHP is a server side language, that means it has no communication with the hardware of the local machine.
I've already had to do similar work, and there are two possible solutions:
1- Install PHP on a machine connected to the printer directly, and then print, which is a little impracticable since the server would have to be physically on site.
2 - Generate an output in text formatted for the width of the print and use the window.print () javascript function to call up the print screen, and the user would just click on print.
When I needed it I ended up opting for the second alternative, and it worked well, it is a bit boring to get the print size right, but it worked well.
I'm looking for a solution with POS printing.
The scenario is:
A restaurant currently has a POS system up and running, they take orders from iPads in store and have a network setup that processes the orders and automatically prints them out on the thermal printer in the kitchen (pretty cool, huh?). Anyway, this restaurant also has a website for online ordering (written in PHP) which have to be checked via email manually. The restaurant wants their online system to send each order to the printer, automatically.
I must add that I haven't been involved with the development of their site or their in-house ordering system. I haven't worked with PHP to POS systems before - is it even possible? What are the alternative solutions for sending data from website forms to a POS printer automatically?
Webservice on the php website with a status flag for processed or not.
Query the webservice from the internal application/an internal application every x minutes (1 is probably sufficient) lists all unprocessed orders and flags them as processed when its retrieved (hack but will suffice)
c#/java/c++ etc will be best to avoid the issue of web based not able to access local printer interface/queue app simply takes result set back from web service and formats/prints it.
Fairly simple about 20 lines of php perhaps and probably less than 100k of c# would do it nicely.
I would be thinking less about the printer, and more about how to interface with the POS software that they use. Find out the manufacturer, product name, and version number (if you can). Then check with that manufacturer to see if they have an SDK or API that you can hook into.
When it comes to actually hooking it into the web site, I wouldn't make the call directly from your PHP page into their POS system. Even if possible, this sort of tight coupling would mean that if the POS system was offline or inaccessible, that the web site would be broken.
Instead, use a database or queuing system to store the orders from the web site. Write a small bit of middleware (such as a daemon or service) that will read from the database or queue, and feed orders to the POS system using their SDK or API.
Keeping these systems decoupled will save you much time and money in the long run. Without it, you are certain to have scalability issues.
Think about this for a second - if you did write directly to the printer, what would happen if two orders came in simultaneously? Would the ticket get garbled with data from both orders? Would one order fail while the other went through? This is more likely than you think, since restaurants tend to be busy during peak times. Go ask anyone that's worked in a pizza delivery restaurant on Superbowl Sunday.
If the Tablet application is really connecting via WIFI to a configured network printer, and the printer is only Network connected, and there is no other PC, then it means you have a bit more work cut out for you. There are a couple of approaches you can take. Either way you are going to have to have a PC on site. If you can print to the network printer on the local network, from a web browser, you have a shot with an easy approach. If you set up a PC with Web Application access, you can configure the same network printer on the local network, and then just create an html page with a stylesheet media=print that formats the order appropriately, then a javascript print call on button click should do it. This requires a PC logged in to the web site, and a person managing the orders and clicking print in order to get the order data to the printer using standard methods. The second approach is to identify the printer manufacturer, download the POS drivers for the printer model and get a class written up to handle acquiring, queuing, and releasing invoices to the printer, and then create a scheduled job that writes orders to the printer similar to a service. This would require a PC on-site as well, but would not require a person monitoring the orders and printing the queue. The second approach is going to cost the client significantly more money to develop.
Im working on a project where i need to use POS printer to generate the reciept. The client asked for a new request where the paper need to be cut automatically when the print has been done.. so that if he needs to print 10 recipts at a time it cuts 10 times and makes some difference.
I am having to make a few assumptions here.
The POS printer is connected to the client computer, not the PHP
server.
This is an internal application supporting Windows based POS terminals.
With this said, there are several Serial/COM port plugins available. We currently use an ActiveX plugin at work, though I wont make any recommendations -- I don't know enough about the alternatives. This will need to be installed/approved by the client computer.
Find the Make/Model of your printer and find the control codes for cutting the paper. They should be listed in the back of the manual. You will need to program your PHP script to output the correct data/control codes to the plugin to send to the printer.
Just for the record, I am not a fan of this solution.
I am currently adding features to a PHP web application for a client. They require to be able to print some raw data to a ticket / thermal printer direct from the php which will be run on an internet browser from a self service kiosk.
The data needs to printed on the local kiosk's in built ticket printer.
From my preliminary research I understand that I must perform this task using javascript for any client side actions and wondered if anybody knew of any method or example function that will allow the printing of a string to a designated printer / com port which would bypass the printer dialog box?
Thanks in advance for any help
Alex
This plugin requires Java installed client-side, but after the first security prompt, this will do what you need (works with Linux, Mac, Windows, Solaris -- anything that can run Java desktop application)
https://github.com/qzind/tray
If it has to be cross browser and platform independent, stop right now and run. There is NOT way, and I mean NO way for Javascript to access information about printers, margins, paper size, and all the variables in printers. Even if your browser has some sort of fast print button, print using default settings and default printers, you have no idea the type of paper, the ink, the margins, etc, and you could be printing on A4 paper, or in the US, our legal size, 8.5" X 11.5".
Browsers, for security, do NOT give javascript any access to this information that is supplied to them by the Windows API and the printer drivers. The closest possible that I know of, is in small networks, where the variables are known, and configured using Internet Explorer's JScript or ActiveX. Short of this, your only other easy option is to write your own web browser/addon/plugin, or to modify one that will run on these platforms, that has this built in capability.
More info available here.
EDIT: Though if you really want to make your life simple, tell them to install Firefox, and check out this article for the simplest solution possible. Also, have you considered VBScript? It has this capability, I've seen it done before.
Not possible, at least not without some extra steps.
Without knowing more about the kiosk environment, you have three main options:
1). Install a Web service on the local kiosk. This Web service would manage printing and ultimately be the most extensible solution.
2). Create a plug-in for the print service. This would be uglier, and really tie you to a single browser solution forever.
3). Wrap the browser in custom code to allow external calls. Again, somewhat ugly, but since you're running a kiosk, you're likely to have some sort of custom/extensible wrapper anyway.
I am having a CRM (Customer Relationship Management Software) built on php and running it on localhost (windows XP system). This contains the list of my clients. I want to be able to call these clients directly from my CRM and keep a log of the same. (Call time, call duration and record the calls). For incoming calls, I should be able to link it to my CRM, display the client details and log the data.
I have a voice enabled 3G GSM Modem (with USB connector) which can be used for this purpose. From my search, I understand I would need to send AT commands from PHP to interact with the modem. But I am not able to move ahead as I am completely new to this. I have never done any device interfacing before this.
Can you help me to understand how can I go about solving the above issue? Any leads, resources in this direction will be of great help.
I wouldn't try to do this with pure PHP since then you would have to have PHP interface with the hardware through the webserver, which can be a pain, if it is manageable at all. There are (edit) three options in my view:
1: AKA the hard way:
Write a PHP extension in C that does what you want, but this would mean a lot of programming for a relative small task.
2: The eas[y/ier] way:
Find a program (Maybe Skype?) that can do voice communication with your modem and has an API or a CLI so you can make PHP run:
voiceprogram.exe --call=555-000-5555 --saveTo=client1_20113103_1200.mp3
This allows the application to do what it's good as and only use PHP as the controller. The resulting MP3 (or Wav, OGG, etc) can be saved back to the CRM.
3: Other options
If you are able to program in a different language that does communicate easily with your modem you can write some custom code that can be triggered by PHP (sockets/SOAP/CLI) and handles the call. When finished it can 'POST' the call information back to your PHP script.
The first 2 solutions only work when the CRM runs on localhost, if you plan on using this in a shared network environment complexity will go up. The last option, if done correctly, can be used in a shared environment.