Patient statement printing

gutiersa wrote on Wednesday, December 09, 2009:

sorry if this is not the correct forum.

Refer to: sl\_eob\_search.php  located in openerm/interface/billing

The following works beautifully from the command line:

lpr -P printer -o cpi=10 -o lpi=6 -o page-left=80 -o page-top=96 /some\_temp\_folder/openemr\_statements.txt

however,

exec("$STMT\_PRINT\_CMD $STMT\_TEMP\_FILE");

generates the full comand but without a space between $STMT\_PRINT\_CMD and $STMT\_TEMP\_FILE, ie:

lpr -P printer -o cpi=10 -o lpi=6 -o page-left=80 -o page-top=96/some\_temp\_folder/openemr\_statements.txt

so when I try to print statements from openemr it does not work for me.

I use freebsd.
How can I insert a space between those two values?

Please help!
thanks a lot!

gutiersa wrote on Wednesday, December 09, 2009:

ok never mind, I added the space in /custom/statement.inc.php, the print command is generated correctly, but the command is still not executed from openemr. It works correctly from the command line. What is wrong? all users are allowed in my printer!

freebsd 7.2

php5

cups1.4

gutiersa wrote on Wednesday, December 09, 2009:

OMG, was it really this simple?

in unix, the complete path to the print command must be included. In my case $STMT\_PRINT_CMD (in openemr-custom-statement.inc.php) needs to be:

$STMT\_PRINT_CMD = "/usr/local/bin/lpr -P Home -o cpi=10 -o lpi=6 -o page-left=65 -o page-top=75 ";

Question for programers:

In openemr/billing/sl\_eob_search.php the line to print reads:

exec("$STMT\_PRINT\_CMD $STMT\_TEMP_FILE");

I was reading somewhere that popen() is safer. In my system, this also worked for printing:

$file = popen("$STMT\_PRINT\_CMD $STMT\_TEMP\_FILE",“w”);

$file = popen("/usr/local/bin/lpr -P Home /tmp/openemr\_statements.txt",“w”);

pclose($file);

If this is correct, should the code be changed?

Ty