Jump to content

Help with two things I don't know how to do (if they're even possible) , please?


Jablesdactyl

Recommended Posts

I wonder if you can help.

 

I've been approached to make a point of sale for a friend of mine who's opening a shop. Not something I've done before, but I figure that I can probably make it completely web based using PHP.

 

There's a couple of things I don't know if I can do though. One of the big things is that in order to open the cash drawer... actually, I'll quote from the site...

 

What is my cash drawer opening code?

 

POS software programs must generate a series of ASCII characters to open the cash drawer. Different cash drawer configurations require different opening codes.

 

a) Printer-driven

The cash drawer opening sequence is printer specific. Refer to your printer manufacturer's documentation for opening sequence. Some test examples are shown below:

 

Sample Opening Code for ESC/POS® compliant printer in Visual Basic

The first step in enabling RS-232 serial communication in Visual Basic is to install the Microsoft COM ActiveX control into the Components Toolbar then add MSCOMM to the form.

Sample code:

MSComm1.CommPort = 1 ' Define COM1 as port to be opened

MSComm1.PortOpen = True ' Open the serial port

MSComm1.Settings = "9600,n, 8,1" ' Define the communication parameters per printer specifications

MSComm1.Output = CHR$(27) & CHR$(112) & CHR$(48) & CHR$(40) & CHR$(40)

 

Sample Opening Code for Star Micronics printer in Visual Basic

Printer I/F - Transmits cash drawer opening sequence to Star Micronics standard code:

MSComm1.CommPort = 1 ' Define COM1 as port to be opened

MSComm1.PortOpen = True ' Open the serial port

MSComm1.Settings = "9600,n, 8,1" ' Define the communication parameters per printer specifications

MSComm1.Output = CHR$(7)

 

b) Serial/Parallel driven (484A/212/182)

The opening code sequence must match the DIP switch settings on the bottom of the drawer. The cash drawer manual includes instructions on how to interpret and set the DIP switches.

 

For a copy of the 484 Manual, download:

  SerialPRO® II Dedicated Serial User's Guide

 

 

 

For a copy of the 212 manual, download:

  Smart SerialPRO® Programmable Serial User's Guide

 

 

 

For a copy of the 182 manual, download:

  ParallelPRO™ Programmable Parallel User's Guide

 

 

 

Here are examples using factory default switch settings for the interfaces listed above:

212A or 484A Serial Interface

MSComm1.CommPort = 1 ' Define COM1 as port to be opened

MSComm1.PortOpen = True ' Open the serial port

MSComm1.Settings = "9600,n,8,1" ' Define the communication parameters per printer specifications

MSComm1.DTREnable = True ' Turn DTR high ' Recommend that DTR remain high during entire session

MSComm1.RTSEnable = True ' Turn RTS high ' Recommend that DTR remain high during entire session

If (MSComm1.DCDHolding = True and MSComm1.DSRHolding = True) Then . . . ' Cash

drawer is attached and detected by host.

...

MSComm1.Output = chr$(91);chr$(91) ' Transmits ASCII character dec 91 to open cash drawer

...

If MSComm1.CTSHolding = True Then ' Cash drawer is closed if CTS drawer status reporting is enabled

...

If MSComm1.CTSHolding = False Then ' Cash drawer is open if CTS drawer status reporting is enabled

 

182 Parallel Interface - Transmits cash drawer opening sequence to 182 interface set to default switch settings:

Open "LPT1:" For Output As #1

Print #1, Chr$(91); Chr$(91)

Close #1

 

I want to know if there's a way I can make the cash drawer open when I push the total button on my web based POS.

 

My second question, regarding the printing of receipts for customers. Receipts are going to be printed on a small standalone thermal printer, I just wondered if there was any way I can make php (rather, just html, even) print directly onto the printer in the correct format. I guess it's probably one of those things I'm going to have to have the printer connected to my computer and have a play around with, but maybe you guys might have some more information on it, so that'd be great.

 

 

Oh.... Actually, I'm not sure if MSCOMM is accessible via a COM object in PHP.  I had assumed it was, because of the COMM, but I just realized that that's probably short for Communication or something.  Anyone know if ActiveX controls can be loaded in PHP?

 

 

 

Anyway, you could always make a simple command line application and launch it from inside of PHP.

 

 

exec("send_register.exe <message>");

 

 

For example, where <message> is what you want to send to the register.

No PHP can not natively do this. If your using windows you can use com0com and have Perl pipe commands to serial or usb ports through a Perl based TCP/IP server. I have some perl scripts that use com0com emulator for handling a Apache based network of (12) touch screens (Elo 1715L), barcode scanners, (Metrologic MS1633) that have cash draws, (Logic Controls CR1600) and thermal receipt printers, (Epson TM T88II) and it works great. Once you get started and you need some help with coding feel free to ask me.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.