shawnmiller77 wrote on Thursday, February 04, 2010:
Update:
I have configured LPR services for Windows and setup an OKI 320 dot matrix printer with a external HP Jetdirect with the IP address of 10.0.0.200. I can print out of Windows using the Oki printer with an Epson FX 80 driver. I still cannot print out any statements and the statements are not being stored in any tmp file to be printed out. This is my statement.inc.php file. Can someone please tell me why this is not working? Or why the statements are not being sent to a tmp file so I can print them?
Any help is greatly appreciated.
Thanks
Shawn
?php
// Copyright (C) 2005-2006 Rod Roark <rod@sunsetsystems.com> // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version.
//////////////////////////////////////////////////////////////////////
// This is a template for printing patient statements and collection // letters. You must customize it to suit your practice. If your // needs are simple then you do not need programming experience to do // this - just read the comments and make appropriate substitutions.
// All you really need to do is replace the .
//////////////////////////////////////////////////////////////////////
// The location/name of a temporary file to hold printable statements.
$STMT_TEMP_FILE = “C:\tmp\openemr”;
// This is the command to be used for printing (without the filename).
// The word following “-P” should be the name of your printer. This // example is designed for 8.5x11-inch paper with 1-inch margins, // 10 CPI, 6 LPI, 65 columns, 54 lines per page.
$STMT_PRINT_CMD = “lpr -P epson -o cpi=10 -o lpi=6 -o page-left=72 -o page-top=72”;
// This function builds a printable statement or collection letter from // an associative array having the following keys:
//
// today = statement date yyyy-mm-dd
// pid = patient ID
// patient = patient name
// amount = total amount due
// to = array of addressee name/address lines
// lines = array of lines, each with the following keys:
// dos = date of service yyyy-mm-dd
// desc = description
// amount = charge less adjustments
// paid = amount paid
// notice = 1 for first notice, 2 for second, etc.
// detail = associative array of details
//
// Each detail array is keyed on a string beginning with a date in // yyyy-mm-dd format, or blanks in the case of the original charge // items. Its values are associative arrays like this:
//
// pmt - payment amount as a positive number, only for payments // src - check number or other source, only for payments // chg - invoice line item amount amount, only for charges or
// adjustments (adjustments may be zero)
// rsn - adjustment reason, only for adjustments // // The returned value is a string that can be sent to a printer.
// This example is plain text, but if you are a hotshot programmer // then you could make a PDF or PostScript or whatever peels your // banana. These strings are sent in succession, so append a form // feed if that is appropriate.
//
function create_statement($stmt) {
if (! $stmt) return “”; // get out if no data
// This is the text for the top part of the page, up to but not // including the detail lines. Some examples of variable fields are:
// %s = string with no minimum width
// %9s = right-justified string of 9 characters padded with spaces
// %-25s = left-justified string of 25 characters padded with spaces // Note that “\n” is a line feed (new line) character.
//
$out = sprintf(
" %-23s %s\n" .
" Chart Number %s\n" .
" Insurance information on file\n" .
" Total amount due: %s\n" .
“\n” .
“\n” .
“ADDRESSEE: REMIT TO:\n” .
“\n” .
“%-32s \n” .
“%-32s \n” .
“%-32s \n” .
“%-32s If paying by VISA/MC/AMEX/Disc:\n” .
“\n” .
“Card#_____________________ Exp______ Signature__________________\n” .
" (Return above part with your payment)\n" .
“-------------------------------------------\n” .
“\n” .
“_______________________ STATEMENT SUMMARY _______________________\n” .
“\n” .
“Visit Date Description Amount\n” .
“\n”,
// These are the values for the variable fields. They must appear
// here in the same order as in the above text!
//
$stmt,
$stmt,
$stmt,
$stmt,
$stmt,
$stmt,
$stmt,
$stmt);
// This must be set to the number of lines generated above.
//
$count = 21;
// This generates the detail lines. Again, note that the values must // be specified in the order used.
//
foreach ($stmt as $line) {
$description = $line;
$tmp = substr($description, 0, 14);
if ($tmp == ‘Procedure 9920’ || $tmp == ‘Procedure 9921’)
$description = ‘Office Visit’;
$dos = $line;
ksort($line);
foreach ($line as $dkey => $ddata) {
$ddate = substr($dkey, 0, 10);
if (preg_match(’/^(\d\d\d\d)(\d\d)(\d\d)\s*$/’, $ddate, $matches)) {
$ddate = $matches . ‘-’ . $matches . ‘-’ . $matches;
}
$amount = ‘’;
if ($ddata) {
$amount = sprintf("%.2f", 0 - $ddata);
$desc = “Paid $ddate: " . $ddata;
} else if ($ddata) {
if ($ddata) {
$amount = sprintf(”%.2f", $ddata);
$desc = “Adj $ddate: " . $ddata;
} else {
$desc = “Note $ddate: " . $ddata;
}
} else if ($ddata < 0) {
$amount = sprintf(”%.2f”, $ddata);
$desc = “Patient Payment”;
} else {
$amount = sprintf("%.2f", $ddata);
$desc = $description;
}
$out .= sprintf("%-10s %-45s%8s\n", $dos, $desc, $amount);
$dos = ‘’;
++$count;
}
}
// This generates blank lines until we are at line 42.
//
while ($count++ < 42) $out .= “\n”;
// This is the bottom portion of the page. You know the drill.
//
$out .= sprintf(
“Name: %-25s Date: %-10s Due:%8s\n” .
“_________________________________________________________________\n” .
“\n” .
“Thank you for choosing .\n” .
“\n” .
“Please call if any of the above information is incorrect.\n” .
“We appreciate prompt payment of balances due.\n” .
“\n” .
“\n” .
“Billing Department\n” .
“” .
“\014”, // this is a form feed
$stmt, // values start here
$stmt,
$stmt);
return $out;
}
?>