Blogs Home
Wednesday, July 18, 2012 5:08 PM

Rotated Bar Codes Revisited (MAGIC Only)

Written by Joe Cocuzzo, Senior VP of Report Writing Services - iatricSystems

Recently, a MAGIC customer wrote (or obtained) a wristband/sheet of labels report and asked me to add some rotated Code 128 bar codes to the wristband portion.

Years ago, we published a tip showing how you could write some computed fields to do the following:

Save the “printer cursor” position (this is called Cursor Push in PCL-5 speak)
Change the print direction to rotate 270 degrees
Allow a computed field to print the bar code
Change the print direction back to 0 degrees
Restore the “printer cursor” (this is called Cursor Pop)

This approach works fine, but it is a little tedious to fool with a set of computed fields on the picture to do this, and I decided to add a macro to the customer’s report to do things in an easier fashion.

Step 1 is to write a macro as a program. Using a macro as a program is convenient because we can then just edit the macro itself and file/translate, and we do not have to then translate the report to get our changes to take effect. When you attach a macro written as a program to a report, you need to specify the entire name in the footnote, and call it as a program.

Edit Footnotes

Notice that we “pass” the URN of the patient to the program as argument A. This is because the program has its own variables and will not know which patient the report is on, so we will pass in the patient’s admission URN as the A argument and place it “back” into URN at the top of our macro code. Using a macro as a program also allows you to write to or change subscripts without affecting your main report.

Here is the code to print two rotated bar codes:

Enter/Edit Macro Logic

Is this all too scary? In the screen shot below, I have identified all the places you need to change to print 2 rotated bar code to some other locations on the page:

Details for Enter/Edit Macro Logic

Here is a scan of the printed output.
Printed Output

Note that everything EXCEPT the rotated bar codes comes from fields placed on the picture:

Enter/Edit Report

A sample report has been added to our MAGIC report library: