views:

142

answers:

2

We're using Crystal to create receipts using a USB port connector to our printer. We'd now like Crystal to 'ping' the serial port to open a cash draw. Is there any way of getting Crystal to do that?

A: 

That depends on the connection, the type of printer used and the cash drawer. Since you did not supply what language can crystal interact with (activex, dll)? I will edit this answer again once more information is supplied.

Edit: Ok, it might be worth it to use a serial activex such as MSComm.ocx, and write to the serial port via the MSComm.ocx. The appropriate code to eject the cash drawer is dependant on the hardware. (Can you provide more information on this please?) Also I need to know how is the crystal report generated - is there a third party source code that you have access to that generates the report (Again, a sample code highlighting where the report gets generated please? as for example below in pseudocode)

load crystal report
print it
; Here is where you need to emit a code to send to serial port to open cash drawer

Hope this helps, Best regards, Tom.

tommieb75
Tom, - "..what language can crystal interact with.." is effectively what I'm asking. Assuming Crystal can talk COM has anyone got some serial port code?
MrTelly
+1  A: 

If you are printing your receipt to a USB port you will not be able to ping the COM port to open the drawer from Crystal.

Something you can try is to create a windows Generic Text Printer connected the the COM port. Then go to the properties and select the Printer Commands Tab and enter the code to open the drawer in the Begin Print Job. That will send the code every time you send a job to that printer. Then send an empty report to that new printer right after the receipt. That trick has worked for me.

The code that you have to use depends on the drawer / printer brand. Check this site

Jose Chama
@Jose: Elegant solution but...that means the crystal reports is going to one printer, that would mean two print jobs, one for the report and the other going through the generic text printer using some escape code sequence I guess to open drawer..be aware that the question remains is how the report gets generated - is it through another program that is invoking the report such as VB.NET/C# that calls the ActiveX crystal reports...
tommieb75
@Tommieb75: I assumed that MrTelly cannot modify the program that is invoking the report. I used to customize canned POS software that I could not change and came up with some workarounds to solve this kind of problems. If the cash drawer is connected to the printer then he can send the code through the printer driver using the Begin Print Job. But in this case he would have to send two print jobs to different printers.
Jose Chama
@Jose: See MrTelly's comment above his question, the cash drawer is not hooked up to the printer, what do you think? :)
tommieb75
Jose's experience and my situation are the same, code we can't change, and in this case two print jobs maybe the answer. It's ugly but kind of elegant when you haven't got the source.
MrTelly