Written by Joe Cocuzzo, Senior VP of Report Writing Services - iatricSystems
If you had to print a sheet of labels for a single patient, in Word you could just type the information, pick the “envelopes and labels” wizard, find your Avery stock number and push a button. In the NPR report writer, life is not as simple.
The first problem is that the Characters Per Inch and Lines/Inch fields on Page One (General Tab) are ignored if you are printing to a laser. The Report Writer selects those values based entirely on the characters per line value. If you try to lay out 6 lines per label, the output will creep up the page, even though your labels are exactly 1” high and the report seems to be set to 6 lines per inch.
Short of breaking out the LA120 or Genicom (dot matrix printing will respect your CPI and LPI values), what can you do?
Years ago, Joel showed a cheesy way to cope with the creeping up the page, by including some code that sent an extra CR/LF every 3 lines as follows:
The \ operator is “modulus” or remainder on division. Each time CNT divides evenly by 3 (line 3, line 6, line 9) we send an extra CR/LF. That sufficiently corrects the creep up the page so we hit our labels, although things shift up and down a bit, as you are not doing exactly 6 or 8 lines per inch but instead are tossing in a correction every 3 lines.
A better method is to call a special Z program that will set the printer characteristics to use the values from the General Tab (Client/Server) or Page 1, and to just use three sets of fields by wrapping them in a DO loop.
The program call is: %Z.printer(/R.CPI,/R.LPI,/R.PS,/R.CPL,/R.LP,{"",{/R.CPI},{"",/R.LPI}})
You can use it AL BEFORE.PRINT or (in a report that does not have any edited sort fields) you can use it AL START. AL START will not work in a report with sorts that have been changed because the printer is released while the records are compiled and the report sort file is built (Number of Records Sorted Message appears), then the printer is re-initialized and your Z.printer call based setting would be over-ridden.
In a report that just prints for one patient, we can use the call in an AL START footnote, directly. This report is going to pick the record and go directly to printing, so the setting up we do in AL START will not be spoiled by a printer re-initialization after the compile of the temp file.
If we were sorting records, we would need to use an AL BEFORE.PRINT footnote and call a macro by name, as the line of code will not quite fit:
The next step is to build three blocks of fields on the report picture in a detail section that is either 6 lines or 8 lines high, depending on whether you have set up your report on page one to be 6 or 8 lines per inch. To allow the three blocks to fit into the three-across labels, I have shortened the name fields (patient and doctor) to 27 characters by adding a LEN=27 attribute. Without this, I cannot push the third set of labels close enough to the right margin to fit.
Once the blocks are aligned to fit the top three labels, I could use the block copy command (MAGIC F1/F2, Client/Server Ctrl F9/CtrlF10) to put nine more sets on the picture. The problem with this approach is that any additions or modifications to the label need to be done in 30 places instead of three.
Instead, we can use the ECB (Extra Code Beginning) and ECE (Extra Code End) commands to wrap a loop around the six lines to print them a total to 10 times:
There is one flaw in this approach, with a 60 line page, the carriage return/line feed at the end of line 60 will cause an extra blank page to print. Changing the page size to 61 will not fix this.
What is happening is that the report writer is sending a CR/LF at the end of line 60 and the printer forces a new page. One way to fix this is to suppress the CR/LF on line 6 (the last line of the block) and send the CR/LF “yourself” for only the first 9 sets of labels. The line attribute on line 6 now becomes:
The report translator wants a “RL” (Record Length) footnote added to any report where you use the NL=N line attribute, so we add RL 92 to the footnotes:
This approach works exactly the same for a C/S report. Example reports ADM.PAT.zcus.is.label.sheet have been added to our NPR Report Library.
Here are the Avery 3 x 10 labels with a Code 128 bar code of the account number: