cancel
Showing results for 
Search instead for 
Did you mean: 

Opening Cash Drawer from report

Former Member
0 Kudos

I understand CR doesn't permit embedded esc codes in the report (in this case for opening a cash drawer). How do I open a cash drawer from a report? Thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Crystal sends a "picture" of the page to the printer which is why we don't work with escape sequences.

Former Member
0 Kudos

Can't you use CHR(27) for the escape character, other ASCII numbers for various other characters? For example (basic syntax):


formula = chr(27) + "A"  ' Send <ESC>A

HTH,

Carl

Former Member
0 Kudos

Hello Carl, thanks for responding. But according to CR knowledgebase article: "Crystal Reports sends data to the printer in a per page format. This feature is by design. Escape codes require a per line data transfer to read the escape codes. Therefore, CR does not support printer escape codes."

CR chokes on any basic syntax for this purpose. Someone suggested using an OLE object, but I'm not sure how this would be set up or how it would execute. Scanning the web, I see I'm not the only one who has attempted to do this.

Former Member
0 Kudos

I don't understand the quoted CR KB article. Data going to a printer is a stream of bytes, no?? I don't see how sending an escap character has anything to do with "per page" vs. "per line". (But then again, I could be missing something...) Did you try it?

I can't think of any other suggestions. Sorry.

Carl

Former Member
0 Kudos

Hi Carl: when the knowledgebase article refers to "printer escape codes", I believe they are referring to the printer control codes such as [you find here|http://printers.necsam.com/public/printers/pclcodes/pcl5hp.htm]. Opening another device (LPT2, say) from within the report and sending commands directly to that device via escape sequences/control codes (in this case a cash register on LPT2: telling the port to "honey, open the goddamned door") seems to be precluded. This is, I believe, the gist of the knowledgebase quote. And this is unhappy-making. I have the control codes for the device, but just can't seem to open the device and pass them to it from within the report. And some snippets of BASIC code I've found elsewhere, which claim to control for this, don't seem to work anyway when added to the report.

Thanks.

blair_wheadon
Contributor
0 Kudos

If you're on CR 2008 you might want to try embedding a Flash button into the report that would open the cash drawer when clicked. This might have rights to send control codes to a local device, but I'm not sure.

Former Member
0 Kudos

Unfortunately, no. This is CR 10, and is a bundled version that comes with BusinessVision, so I don't think it's entirely full-featured. The CR help file states that it does support some VisualBasic syntax, but so far I haven't found that it supports much. Probably need to have some VB class libraries that aren't included (VB's never been my cup-a-tea, though. I was suckled on Delphi and ReportSmith). Anyway, I found some VB code for opening POS drawers that might be able to be shoehorned into a CR report (unbelievably lengthy code for such a minor function!). I'll let you know if it works, and post it if it does.