32printer User Manual

Thank you for choosing 32printer. This page is dedicated for frequently asked questions and answers about 32printer. If you can’t find answer or solution to you problem in this page, please feel free to contact us, we will be happy to help. We want to be a part of your success!!!

32printer Home

Excel Reports

 

32printer User Manual

What is 32printer?
How does it work?
Getting familiar with 32printer
How 32printer converts QAD reports to Excel?
Setting up 32printer in User Desktop
Setup in MFG/Pro
Running 32printer for the first time
Printing to Local (USB) Printers from QAD

Terminal Emulator

Network Setup
Improving Performance by enabling Compression
Making PuTTY Functional Keys Working Properly in QAD
Making PuTTY with 32printer connecting directly to MFG/Pro without Unix login
Persistent telnet / SSH sessions
Troubleshooting third party terminal emulators
Printing to local printers from Terminal server
Working with Netterm or Secure Netterm
Working with WRQ Reflections

Output To MS Excel

Direct Output to Excel
Fixing Leading Zero dropping issue in Excel / Controlling column types
Generating Multi Sheet Excel Workbook from MFG/Pro
Writing MFG/Pro custom Report for Excel
Using Excel Templates with 32printer
Internationalization: decimal point, thousand separator, date format
Issues Exporting data to MS Excel

Output to PDF

Generating multi-page PDF document
Issues with PDF templates
PDF Page Parameter Reference

What is 32printer?

32printer is MFG/Pro client software for Character and GUI interfaces. It redirects MFG/Pro raw output data to most popular desktop applications such as Microsoft Excel, Adobe Acrobat Reader, Notepad, Outlook or Lotus Notes, any other program of your choice. It’s simple yet powerful application, designed to empower your QAD users to perform their job faster with greater accuracy and efficiency. 32printer bridges the gap between server row ERP data and Microsoft Desktop Applications, delivering ultimate convenience to you.

How it works?

PDF documents today are commonly accepted as substitutes of regular paper documents, but generation of PDFs cost you nothing and also is environmentally friendly compare to the paper documents. The speed you exchange PDF documents with your partners is like you would fly the rocket compare to walking by foot.

Out-of-the-box 32printer generates nice looking PDF documents from your QAD system, you may immediately take advantage of emailing Purchase Orders or Invoices or Sales Order confirmations, with a click of the mouse. The chart explains how 32PRINTER overlays PDF templates with MFG/Pro output. Use MS Word for preparing your template and then use any genuine Adobe PDF product to convert it to PDF.

Getting familiar with 32printer

When printing a report from MFG/Pro, select 32prn output and next thing you see is 32printer window:

Use radio buttons to select the output and drop down box for PDF background templates.

How 32printer converts QAD reports to Excel?

32printer is designed to convert majority of QAD reports, standard and custom, to Microsoft Excel. Built-in logic parses text into rows and columns according to the report layout, it expects QAD report to conform single frame structure, like the following example:


      Site Location Description. Type Perm
      ---- -------- ------------ ---- ----
      1000 A0000001 Raw Material A001 No
      1000 A0000002 Raw Material B001 No
      1000 C0000005 Raw Material B005 No
      .....
      1000 Z0000100 Raw Material Z999 No

The report has to have underlined column labels and each field should be printed under respective label, when this condition is met, you get nice looking Excel spreadsheet, which can be conditionally colored, pivot table applied, converted to a multi sheet workbook, etc (see below). If report has different structure, such as multi frame layout (headers details, subtotals, etc) please refer to this topic.

Setting up 32printer in User Desktop

After downloading, 32printer package from our website, double click on the file, this is self-extracting archive and it will prompt you for the location, to unzip the content of the package.

In case you want to have a centralized location for 32printer select a network drive, or you may still select your local drive and copy it to the network drive later on.

Next thing, it prompts you to select terminal emulator.

Chose whether you will be using putty or your own terminal emulator. In case you selected putty, the program creates a shortcut “Putty with 32printer” on your desktop. Please note that our putty is slightly different from the original putty emulator, you will need to use our icon, “Putty with 32printer” to enjoy 32printer functionality. You can use the original putty at the same time, however 32printer functionality will not work with it. Our putty has title “Putty with 32printer” as shown below.

Creating a new connection profile, will be exactly the same as you would be using the original putty: enter host IP address or server name, port and select protocol. Make sure putty session parameters are set properly, on the left hand side, then select “session” again and click save button. When new profile is created, our PuTTY automatically assigns “32PRINTER” as a default local printer as shown below.

If you use an existing putty profile, i.e. previously created putty sessions are stored in windows registry, you need to manually change default printer to “32PRINTER” and save the session settings. Please check if it is saved properly, otherwise 32printer won’t work in the previously created putty session.In case you have many people who have been using putty.exe and have pre-configured putty sessions on their PCs, the following action step is required in order to make it work with 32printer: windows register entries located under [HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions] should have the value of “32PRINTER” for parameter “Printer”, i.e.

“Printer”=”32PRINTER”

on each PC. It can be done manually or you can develop VB script to do so in batch mode during user login to windows. You may find this articles handy:

http://technet.microsoft.com/en-us/library/bb727154.aspx
http://www.rgagnon.com/gp/gp-0005.html

Once you finished this step, move on to setup a new printer in QAD application.

Using third party terminal emulators

If you selected to use your own terminal emulator, the program creates a new shortcut “32printer” on your desktop, it is pointing to the 32printer.exe module in 32prn home directory. Launch it. You always need to start this icon prior to start your telnet client application.

Once started, a 32printer icon appears in Windows application tray (bottom right corner in the desktop).

To stop 32printer, use mouse right click on the icon and select Exit. There is another selection “Pause”, use it when you would like QAD data to bypass 32printer application and to be sent to Windows default printer.Configuring telnet parameter

32printer has been designed to work with virtually any telnet client software. 32printer.ini is a configuration file, located in 32printer home directory.

If 32printer does not work with your telnet client, please make sure the executable module name is listed in 32printer.ini as telnet or as telnet2 parameter. If not listed, find out the executable module name (use Processes Tab in Windows Task Manager) and add it. Restart your pc.Parameter “Term” defines the terminal emulator type, used in the telnet session and normally it should be blank, but it may be changed to the following values when required:


Term     Print ON      Print OFF    Note
=======  ===========   ===========  ==============================
""       "\033[5i"     "\033[4i"    Use Print ON and OFF commands
wyse60   "\033d#"      "\024"       in the 32prn script for your
wyse50   "\030"        "\024"       terminal type, more details.
dg215    "\036F`"      "\036Fa"
ibm3151  "\020\022"    "\020\024"
vt52     "\033W"       "\033X"
tvi955   "\033`"       "\033a"

Main Configuration fileThere is a main output configuration file "main.ini" in the 32printer home directory. Here is its content:


iniFilesDir = .\ini
defaultForm = .\reportP80.ini
dateFormat = MM/DD/YY
inputDecSeparator = .
inputGroupSeparator = ,

prtSwitch  = @@@^32PRINTER-SWITCH^@@@
prt_mytest = Duplex ML-2150 Series PS
prt_COM1   = COM1:
prt_COM2   = COM2:
prt_LPT1   = LPT1:
prt_LPT2   = LPT2:
prt_lex    = Lexmark
prt_locdj  = Samsung ML-2150 Series PS (Copy 1)
prt_chk    = Samsung ML-2150 Series PS (Copy 1)

# These are Excel Switches, for more details check this page:
# http://www.32soft.com/site/modules/xt_conteudo/index.php?id=40
excelSwitch = directExcelOutput
excelTemplates = .\xlt
excelDirective = #Excel
nextSheet = NextExcelWorksheet
# NOTE: nextSheet is deprecated.
#       Use excelDirective with "nextsheet" parameter instead.

customApp  = "%ProgramFiles%\Windows NT\Accessories\WORDPAD.EXE" %RawFile%
#customApp  = "%ProgramFiles%\Microsoft Office\OFFICE11\WINWORD.EXE" %RawFile%
# NOTE: %RawFile% is replaced with quoted full path of the 32Printer Raw File.

customAppLabel = Send To &Wordpad (My Appl.)
# default value: Send To Custom &Application

iniFilesDir is a pointer to a directory where to PDF forms configuration files are located. It can be local directory (default) or network share, for example \\server1\pdfini.

PDF form configuration filesEach PDF form configuration file outlines parameters, instructions to 32printer, how it should generate output PDF document.


[form 1]
formName    = Generic PO Form
template    = .\pdf\poform.pdf
pageParams  =  -t 22 -l 60 -s 13
mergeBefore =
mergeAfter  = .\pdf\POterms.pdf

formName is a name that appears in 32PRINTER Template drop down selection box
template is the PDF template name and location
pageParams is a list of parameters, instructing how PDF document should be generated, check here for details.
mergeBefore – a parameter pointing to a static PDF file which the resulting PDF file will be appended to.
mergeAfter – similar to mergeBefore, PDF file which will be appended to the resulting PDF document.

Setup in MFG/Pro

Character Interface

Create a new printer in 36.13.2 menu of MFG/Pro as following:


mgmgmt05.p b+            36.13.2 Printer Setup Maintenance            08/15/07
+----------------------------- Printer Definition -----------------------------+
¦      Output To: 32prn                             Destination Type: Default  ¦
¦                                                       Printer Type:          ¦
¦    Description: 32printer output                      Lines / Page: 64       ¦
¦      Max Pages: 0                                    Scroll Output: no       ¦
¦Device Pathname: cat >lb$PPID                               Spooler: yes      ¦
+------------------------------ Printer Control -------------------------------+
¦ Initialize Command:                                                          ¦
¦                                                                              ¦
¦    Initialize Ctrl:                                                          ¦
¦                                                                              ¦
¦  80-Col Start Ctrl:                                                          ¦
¦                                                                              ¦
¦ 132-Col Start Ctrl:                                                          ¦
¦                                                                              ¦
¦         Reset Ctrl:                                                          ¦
¦                                                                              ¦
¦      Reset Command: /qad/bin/32prn.sh lb$PPID                                ¦
+------------------------------------------------------------------------------+

Adjust the following parameters if needed:

Lines / page: 63-66
Max Pages: 0 (enter integer if would like to restrict maximum number of pages)
Create a simple script in operating system, 32prn.sh with the following content :


echo -n -e '\033[5i'
cat $1
echo -n -e '\033[4i'

Parameters "-n" and "-e" are optional in first and last lines. Save the script to a directory with public access for execution, 755. If the directory is a part of global $PATH variable for all QAD users, then no need to specify full path to 32printer script. Otherwise, specify the full absolute path to 32printer script, as in the example above.32PRINTER is ready to use.

For majority of terminal types the script woks fine, it should be changed for wyse60, wyse50, dg215, ibm3151, vt52, tvi955, as well as 32printer.ini settings, see User Desktop Setup. Contact us for details.

GUI Interface

Create a new printer as following:


mgmgmt05.p b+            36.13.2 Printer Setup Maintenance            08/15/07
+----------------------------- Printer Definition -----------------------------+
¦      Output To: 32prn                             Destination Type: Default  ¦
¦                                                       Printer Type:          ¦
¦    Description: 32printer output                      Lines / Page: 64       ¦
¦      Max Pages: 0                                    Scroll Output: no       ¦
¦Device Pathname: tmp.txt                                    Spooler: no       ¦
+------------------------------ Printer Control -------------------------------+
¦ Initialize Command:                                                          ¦
¦                                                                              ¦
¦    Initialize Ctrl:                                                          ¦
¦                                                                              ¦
¦  80-Col Start Ctrl:                                                          ¦
¦                                                                              ¦
¦ 132-Col Start Ctrl:                                                          ¦
¦                                                                              ¦
¦         Reset Ctrl:                                                          ¦
¦                                                                              ¦
¦      Reset Command: "c:\32prn\prnloc" tmp.txt                                ¦
+------------------------------------------------------------------------------+

Reset Command "\\network share name\prnloc" tmp.txt
Lines / Page : 66 (variable, adjust if required)
Max Pages : 0 (enter any integer to restrict maximum output file length)

32printer is ready to go. No need to launch 32printer icon for GUI interface. Simply run a report and select 32prn as output.

If it's a DEMO version, the DEMO banner will appear. Hit ESC or Enter to bypass, 32printer window will appear.

 

Running 32printer for the first time

If you are using "Putty with 32printer" – just double click on the icon and login to the system. If you are using your own telnet client software, make sure you start "32printer" icon prior to your telnet client session, then login to MFG/Pro as usual.

Run a report for example 1.5.1 for a short range of Items, like shown below and select 32prn as printer output.


 ppptrp.p b+                  1.5.1 Item Master Report                 07/10/09
+------------------------------------------------------------------------------+
¦     Prod Line:                               To:                             ¦
¦   Item Number:                               To: 22-130                      ¦
¦     Item Type:                               To:                             ¦
¦         Group:                               To:                             ¦
¦         Added:                               To:                             ¦
¦                                                                              ¦
¦               Print Comments: no                                             ¦
¦           Reporting Currency:                               Output: 32prn    ¦
¦                                                           Batch ID:          ¦
+------------------------------------------------------------------------------+

If it's a demo version, the DEMO banner will appear on your screen, hit Enter or ESC key to by pass it, then 32printer window should appear on the screen. Select Excel and either click on GO button or simply hit Enter key. Make sure everything is displayed properly in excel spreadsheet. Run the report few more times and try other output destinations, make sure everything works properly. Congratulations!!!

If 32printer window does not come up, try to trouble shoot the problem as following:

If you use 32printer with your Terminal Emulator software, make sure the 32printer icon is launched first, prior to your terminal emulator client. Make sure telnet client module is listed in telnet or telent2 parameter in 32printer.ini file. If still no luck try the following:

1) Check if MS Excel and Acrobat Reader are installed on your PC.

2) The Next step is to make sure 32printer is working properly, please start 32printer and go to Start Menu -> Run -> type cmd.exe and then in DOS window type: "telnet your_host_ip"

Then login to mfg/pro and try to print a report (for example 1.5.1) to 32PRN, if F1 and F4 keys do not work, use CRTL-X as F1 and CTRL-E as F4. If 32printer popup window appears it means that 32printer is working properly.

3) The next step, to try your telnet client software. Please make sure your telnet client module is listed in 32printer.ini file, as described in User Manual. If not listed, please add it. Launch 32printer and then you telnet client, try any report to 32prn. If still 32printer window does not popup, please contact us.

If you are using putty and selecting an existing session - make sure the default printer is set to 32PRINTER. If still no luck contact us.

Printing to Local (USB) Printers from QAD

With 32printer you can print to any Windows printer directly from QAD, including your USB printers. You need to specify "printer switching record" in the 32prn.sh script (on QAD server), just after the "TURN ON PRINTER" sequence ESC[5i.

Start of the record must be equal to "prtSwitch" parameter from the "main.ini" file. The rest of the record must be equal to "printer-queue-id" also defined in the "main.ini" file.

When defining printing support in the main.ini file:

- Select unique literal constant string as the value of the "prtSwitch" parameter.

- Define a parameter for every windows print queue you are going to use from QAD.

The name should start with "prt_" prefix following by the "printer-queue-id". The value of the parameter is used to identify specific Windows printer.

Select Windows printers by port name or by printer name. If the parameter value has colon ':' as the last character, the value is considered to be the port name. Otherwise, it's considered to be a substring of the Windows printer name (it's not mandatory to define the full printer name).

For example, if Windows system has "Apple LaserWriter II NT v47.0" printer and some other printer attached to the LPT2 port, you can include the following lines to main.ini file:


 ...
prtSwitch  = @@@^32PRINTER-SWITCH^@@@
prt_lazer  = LaserWriter II NT
prt_lpt2   = LPT2:

To send print job to "Apple LaserWriter" printer you can use the following sequence:
@@@^32PRINTER-SWITCH^@@@lazer

To send print job to any printer, attached to the LPT2 port, use the following sequence:
@@@^32PRINTER-SWITCH^@@@lpt2

On the Unix/Linux-side update the 32printer shell-script 32prn.sh as following:


#!/bin/sh
#
# $1 - file to print
# $2 - "" or printer-id (main.ini must contain line "prt_${2}=...")
#

prtSwitch='@@@^32PRINTER-SWITCH^@@@'
# NOTE: prtSwitch variable MUST BE the same as in main.ini file

echo -ne "\033[5i"
if [ ! -z "$2" ]; then
    echo -ne "${prtSwitch}${2}\n"
fi
cat "$1"
echo -ne "\033[4i"

 

 

Network Setup

This applies only to versions 3.06 onward. Traditional putty module is using windows registry for session profiles storage. It causes few problems that sysadmins complained about. It was impossible managing session settings from a single place. Now, it's easy, since session settings are stored centrally in a sub directory and are set as read only for users. When you use a new command line key with putty.exe module, "-fl", windows registry is ignored. First, you need to run putty with the key:

$32prn_home\putty.exe -fl

Create a new session, change all the settings as required and save it. It's saved to .putty sub directory. Make this sub directory as read only for network users. Make a new shortcut with a command line:

$32prn_home\putty.exe -load mySession -fl

where mySession is the session name created in the previous step. The shortcut can be "placed" automatically to user desktop, at the windows login.

Improving Performance by enabling Compression

This applies only to versions 3.04 onward. In the poor network bandwidth, remote users may complain on the slowdowns when large reports are sent to 32printer. This enhancement decreases data traffic to 7-8 times and the overall performance is improved to 3-4 times. Remote users will notice the difference right away. Here is how it's accomplished: instead of the 32printer shell script described in the user manual, use the following script on the server side, which compresses the raw data files and transfers it over to desktop.

On Linux host use this one:

#!/bin/sh
#
# $1 - file to print
#

prtSwitch='@@@^32PRINTER-SWITCH^@@@'
# NOTE: prtSwitch variable MUST BE the same as in main.ini file

echo -ne "\033[5i"
if [ ! -z "$2" ]; then
    echo -ne "${prtSwitch}${2}\n"
fi

gzip -c9 < "$1" | uuencode 32PRINTER
# NOTE: uuencode must have '32PRINTER' parameter (checked by prnloc.exe)

echo -ne "\033[4i"

On Unix hosts, AIX, HP-UX use this one:

#!/bin/sh
#
# $1 - file to print
# $2 - "" or printer-id (main.ini must contain line "prt_${2}=...")
#

prtSwitch='@@@^32PRINTER-SWITCH^@@@'
# NOTE: prtSwitch variable MUST BE the same as in main.ini file

echo "\033[5i\c"
if [ ! -z "$2" ]; then
    echo "${prtSwitch}${2}\n\c"
fi

gzip -c9 < "$1" | uuencode 32PRINTER
# NOTE: uuencode must have '32PRINTER' parameter (checked by prnloc.exe)

echo "\033[4i\c"

Making Functional Keys Working Properly

In order to access some special keys (PAGE-UP, PAGE-DOWN, HOME, END, DELETE) in the Mfg/Pro application using putty, both putty keyboard and Progress protermcap file need to be changed

Putty profile set-up

  • Start putty
  • Load Mfg/Pro saved session
  • Open Terminal->Keyboard
  • Set The Backspace Key to "Control-H"
  • Set The Home and End Keys to "Standard"
  • Set The Function keys and keypad to "Xterm R6"
  • Set Initial state of cursor keys to "Normal"
  • Set Initial state of numeric keypad to "Normal"
  • Select Session and click "Save" to save the changed settings

Progress protermcap file set-up

  • Change the original Progress protermcap file
  • Save the original Progress protermcap file from the $DLC directory
  • For example: cp /opt/dlc/protermcap /opt/dlc/protermcap.orig

  • Edit the protermcap file:
    • vi /opt/dlc/protermcap
    • Delete line ":BACKSPACE(DEL-CHAR)=\EW:\" from under the vt100 entry
    • Add next lines under the xterm entry, for example after the INSERT-MODE(INS) line:
      • :DELETE(DELETE)=\E[3~:\
      • :PAGE-UP(PAGE-UP)=\E[5~:\
      • :PAGE-DOWN(PAGE-DOWN)=\E[6~:\
      • :LEFT-END(ESC-LEFT-ARROW)=\E[1~:\
      • :RIGHT-END(ESC-RIGHT-ARROW)=\E[4~:\

Done.

Making PuTTY with 32printer connecting directly to MFG/Pro

A user can connect securely to a Unix server running SSH without needing to enter a password every time.

In order to accomplish this, the user needs to generate a key pair, consisting of a public key and a private key. The public key needs to be stored on the server, where the user wants to connect to, in the $HOME/.ssh/authorized_keys file, and the private key is stored on the user's PC and used by the putty session to connect to the server.

In order to set-up a public key authentication, next steps should be followed:

Generate a public/private key pair:

  • Use the PuTTYgen utility; the utility will generate 2 files, for example mfg.pub for the public key, and mfg.ppk for the private key (this file contains also a copy of the public key).

On the Unix server, the administrator should

  • Create directory /home/userid/.ssh, with access rights rwx------ (700), owned by "userid"
  • Create file /home/userid/.ssh/authorized_keys with access rights r-------- (400), owned by "userid"
  • Add next line: "ssh-rsa userid@hostname."
    • Replace with the public key obtained previously, userid@hostname. is just a comment.

Configure putty for using the private key:

  • Start putty
  • Load the Mfg/Pro saved session
  • In Connection->SSH->Auth, set the Private key for authentication with the location of the private key file, for example C:\putty\mfg.ppk

There are a few other advantages of using the public key authentication:

  • The administrator can lock the account, so the user cannot telnet or ftp to the box. Even though the account is locked, the user can connect using the public authentication method. If the account needs to be locked for this authentication method too, the authorized_keys file access rights can be changed to 000.
  • The administrator can control what commands a user can execute on the server, by using the "command" option of the public key entry, for example:
    • command="/opt/qad/bin/client.mfg" ssh-rsa userid@hostname.
      In this case the user executes only the client.mfg script, when the script ends the session terminates.
      By using the "command" option, the SFTP connections are also denied.
  • The administrator can restrict the machines from which the user can connect, by using the "from" option of the public key entry, for example:
    • from="10.7.8.*",command="/opt/qad/bin/client.mfg" ssh-rsa userid@hostname.

Writing MFG/Pro custom Report for Excel

Majority of MFG/Pro standard and custom reports can be forwarded to MS Excel with 32printer. You can write any report following generic QAD programming rules and the report will be parsed properly in Excel as long as the report layout contains a single frame (see below). There is also a limit on the maximum number of columns in the report and is set to 156 columns.

Here is a template that could be used to write wide custom report for Excel.

/* Custom Wide report template for 32printer Excel Output*/
{mfdtitle.i "2+ "}
define variable nbr  like so_nbr no-undo.
...
define variable nbr1 like so_nbr no-undo.

form
   nbr   colon 15   nbr1   label "To" colon 49
   skip
with frame a side-labels width 80.

/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).
repeat:
  if nbr1   = hi_char  then nbr1   = "".
  update nbr    nbr1   with frame a.

  bcdparm = "".
  {mfquoter.i nbr    }
  {mfquoter.i nbr1   }

  if nbr1   = "" then nbr1   = hi_char .

  /* OUTPUT DESTINATION SELECTION */
  {gpselout.i &ampprintType                = "printer"
              &ampprintWidth               = 132
              &amppagedFlag                = " "
              &ampstream                   = " "
              &ampappendToFile             = " "
              &ampstreamedOutputToTerminal = " "
              &ampwithBatchOption          = "yes"
              &ampdisplayStatementType     = 1
              &ampwithCancelMessage        = "yes"
              &amppageBottomMargin         = 6
              &ampwithEmail                = "yes"
              &ampwithWinprint             = "yes"
              &ampdefineVariables          = "yes"}
  {mfphead.i}
   put unformatted
     "SO Nbr   Ordered  AM       SRep2    SRep3    Group    BUM....." skip
     "-------- -------- -------- -------- -------- -------- --------"
     skip.

  for each so_mstr no-lock
    where ...    :

    put so_nbr
        so_ord_date  space(1)
        slspsn[1]    space(1)
        slspsn[2]    space(1)
        slspsn[3]    space(1)
        user1        space(1)
        so_cust      space(1)
        name         space(1)
        so_po        space(1)
        sod_line     space(1)
        ....
        sod_site     space(1)
        sod_type     space(1)
        so_cr_terms        skip.
     {mfrpchk.i &ampwarn=false}
  end. /* FOR EACH so_mstr */

  /*  REPORT TRAILER  */
  {mfrtrail.i}
end. /* REPEAT */

In the case you do not want user to prompt for printer output the report logic may look like the following:

{mfdtitle.i "2+ "}
define variable nbr  like so_nbr no-undo.
define variable nbr1 like so_nbr no-undo.
...
form
   nbr   colon 15   nbr1   label "To" colon 49
   skip
with frame a side-labels width 80.

/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).repeat:
  if nbr1   = hi_char  then nbr1   = "".
  update nbr    nbr1   with frame a.

  bcdparm = "".
  {mfquoter.i nbr    }
  {mfquoter.i nbr1   }

  if nbr1   = "" then nbr1   = hi_char .

  /* SEND DIRECTLY TO 32PRN OUTPUT*/
  put screen row 22 "Report is running...".
  output through ("32printer") . /*or use "paged" keyword if need to*/
  
  /*32printer script should be in the PATH VAR, here is the content"
  #######################
  echo -n -e '\033[5i'
  cat $1
  echo -n -e '\033[4i'
  #######################*/

  for each so_mstr no-lock
    where ...    :
    display so_nbr
        so_ord_date slspsn[1
        user1 so_cust name so_po sod_line
        ....
        sod_site sod_type so_cr_terms
        with width 200.
    {mfrpchk.i &ampwarn=false}
  end. /* FOR EACH so_mstr */

  output close.
  put screen row 22 "".
end. /* REPEAT */

 

Issues Exporting data to MS Excel

Some QAD reports are not properly transferred to Excel, for example 7.15.1. There are a few options of how you may get the information in the proper format to Excel using 32printer software.

1) Lookup another report with the required data, where the information is presented in a flat (single frame) format such as the following:


      Site Location Description. Type Perm
      ---- -------- ------------ ---- ----
      1000 A0000001 Raw Material A001 No
      1000 A0000002 Raw Material B001 No
      1000 C0000005 Raw Material B005 No
      .....
      1000 Z0000100 Raw Material Z999 No

This format layout fits the best for 32printer. Most of QAD reports are designed this way, however some of them have two or more frames (header-details), excessive subtotals, etc... These won't be parsed properly by 32printer when sending to Excel.

2) You may use any custom report, which presents data in the single frame format (see above).

3) You may use existing QAD browses or inquiries. They generate proper output format too.

4) QAD has a built-in capability to create power browses in the system. These browses also generate proper output format.

5) If you have a progress programmer skills in house, an existing report may be easily reformatted to the flat format above.

6) If you do not have a progress programmer skills, we can help you with reformatting of the standard QAD report (free of charge or for a small fee). So, when you install the new report instance, it will work properly to MS Excel.

Working with third party terminal emulators

When you use 32printer with your existing Terminal Emulator software, make sure the 32printer icon is launched first, prior to your terminal emulator client. Please check 32printer user manual how the telnet client settings should be set in the 32printer.ini file. In the case 32printer popup window does not appear when printing to 32prn output, please try the following steps to troubleshoot:

1) Check if MS Excel and Acrobat Reader are installed on your PC.

2) The Next step is to make sure 32printer is working properly, please start 32printer and go to Start Menu -> Run -> type cmd.exe and then in DOS window type: "telnet your_host_ip"

Then login to mfg/pro and try to print a report (for example 1.5.1) to 32PRN, if F1 and F4 keys do not work, use CRTL-X as F1 and CTRL-E as F4. If 32printer popup window appears it means that 32printer is working properly.

3) The next step, to try your telnet client software. Please make sure your telnet client module is listed in 32printer.ini file, as described in User Manual. If not listed, please add it. Launch 32printer and then you telnet client, try any report to 32prn. If still 32printer window does not popup, please contact us.

Fixing Leading Zero dropping issue in Excel

Some of the character values in Excel may be misinterpreted as numeric type, which will cause leading zeros to be dropped. To avoid the problem you will need to add a column label to a file called "columns.ini" located in the 32printer directory. You may enter either a full label name or partial one with "*" at the end. For example:

LOT
SERIAL*
Lot/Serial*

 

Generating Multi Sheet Excel Workbook from MFG/Pro

This is a very nice 32printer feature, version 3.03 and higher, when you need detail and summary information in the same Excel Workbook. Or when you need various reports combined into Excel Workbook.

1) Add a line to main.ini file as following:

nextSheet = NextExcelWorksheet

2) Write a report which may contain a few sections or can consist of a few reports. Add the following code between sections or between reports

 

/* Custom Wide report template for 32printer Excel Output*/
{mfdtitle.i "2+ "}
define variable nbr  like so_nbr no-undo.
...
define variable nbr1 like so_nbr no-undo.
form
   nbr   colon 15   nbr1   label "To" colon 49
   skip
with frame a side-labels width 80.

/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).repeat:
  if nbr1   = hi_char  then nbr1   = "".
  update nbr    nbr1   with frame a.
  bcdparm = "".
  {mfquoter.i nbr    }
  {mfquoter.i nbr1   }

  if nbr1   = "" then nbr1   = hi_char .

  /* OUTPUT DESTINATION SELECTION */
  {gpselout.i &ampprintType                = "printer"
              &ampprintWidth               = 132
              &amppagedFlag                = " "
              &ampstream                   = " "
              &ampappendToFile             = " "
              &ampstreamedOutputToTerminal = " "
              &ampwithBatchOption          = "yes"
              &ampdisplayStatementType     = 1
              &ampwithCancelMessage        = "yes"
              &amppageBottomMargin         = 6
              &ampwithEmail                = "yes"
              &ampwithWinprint             = "yes"
              &ampdefineVariables          = "yes"}
  {mfphead.i}

  /* FIRST REPORT */
  for each so_mstr no-lock
    where ...    :
    display so_nbr
            so_ord_date
            so_cust
            name
            so_po
      with width 132.
  end. 

  /* JUMP TO THE NEXT EXCEL SHEET */
  put "NextExcelWorksheet" at 1 skip.   page.

  /* SECOND REPORT */
  for each sod_det no-lock
    where ...    :
    display sod_nbr
            sod_line
            sod_part
            sod_qty_ord
         ....
      with width 132.
  end.
...
...
/*  REPORT TRAILER  */
  {mfrtrail.i}
end. /* REPEAT */

Using Excel Templates with 32printer

By using Excel Templates you will be able to turn exported data into a pivot table or a graph or highlight spreadsheet ranges with different colors (conditional formatting) for better visibility and faster decision making. Any data or format manipulations are possible on the Excel side via VBA. 32printer exports data to excel sheet, lookup macro in the template called "processData" and runs it, then shows Excel window to user.

1) Add or make sure main.ini has the following lines:

excelTemplates = .\xlt
excelDirective = #Excel

The first one points to a directory, the location where all Excel template files reside.
The second defines a keyword of the Excel directive, in the raw files, so these will be interpreted as control lines and excluded from the excel output.

2) Prepare a excel template, for example mytemplate.xls, and save it to [excelTemplates] from the step #1.

Add a macro to the Excel template (ALT-F11), called "processData". It may have the whole VB logic or it may call other macro subs or functions.

Sub processData()
 ...
 doHighLight
 ...
End Sub

Private Sub doHighLight()
    Dim oSheet              As Excel.Worksheet
    Dim counter             As Long
    Set oSheet = Worksheets(1)

    ' Calculate real sheet dimensions
    Dim sheetWidth          As Integer
    Dim sheetHeight         As Integer

    sheetWidth = oSheet.UsedRange.Columns.Count
    sheetHeight = oSheet.UsedRange.Rows.Count
    If sheetWidth = 0 Or sheetHeight = 0 Then
        Exit Sub
    End If
    For counter = 2 To sheetHeight
        If counter Mod 2 > 0 Then
          Rows(counter).Interior.Color = RGB(255, 255, 0) 'YELLOW
        Else
          Rows(counter).Font.Color = RGB(255, 0, 0) 'RED
        End If
    Next counter
    oSheet.Activate
End Sub

3) Add Excel directive, to the report raw output file, which will point to the Excel template to use. This directive can be added anywhere in the report raw output file.

#Excel template mytemplate.xls

This can be done by either modifying QAD report, add a statement anywhere in the report logic:

put "#Excel template mytemplate.xls" skip.

or create a dedicated QAD output in 36.13.2

mgmgmt05.p b+            36.13.2 Printer Setup Maintenance            08/15/07
+----------------------------- Printer Definition -----------------------------+
¦      Output To: 32prnM                            Destination Type: Default  ¦
¦                                                       Printer Type:          ¦
¦    Description: 32prn macro sample                    Lines / Page: 66       ¦
¦      Max Pages: 0                                    Scroll Output: no       ¦
¦Device Pathname: tmp                                        Spooler: no       ¦
+------------------------------ Printer Control -------------------------------+
¦ Initialize Command:                                                          ¦
¦                                                                              ¦
¦    Initialize Ctrl: #Excel template mytemplate.xls/010/012               ¦
¦                                                                              ¦
¦  80-Col Start Ctrl:                                                          ¦
¦                                                                              ¦
¦ 132-Col Start Ctrl:                                                          ¦
¦                                                                              ¦
¦         Reset Ctrl:                                                          ¦
¦                                                                              ¦
¦      Reset Command: 32prn.sh tmp                                             ¦
+------------------------------------------------------------------------------+

Printing to local printers from Terminal server

32Printer works well on the terminal server. Here is how printing to the local printers can be done from the terminal server:

Make sure or add printers on each client machine, add to the printer names corresponding port names. For example:

Apple LaserWriter II NT v47.0 (LPT1)
Lexmark Z13 (LPT2)

Add the following directives in main.ini file:

prt_LPT1 = (LPT1)
prt_LPT2 = (LPT2)

This way the printers will be available from the terminal server sessions, and from MFG/PRO.


 

Issues with PDF templates

Use MS Word sample template included into the package as a starting point, when creating a new PDF template. Add a new content to the document, logo, boxes, legal text if required, or simply change existing content. Use ONLY Adobe Acrobat Writer or Distiller or other genuine Adobe products to convert MS Word document to PDF template. Do not use any 3rd party PDF converters as 32printer engine won't process such templates. If you do not have Adobe converters feel free to send us your Word template, we will convert it for you.

 

Persistent telnet / SSH sessions

This solution is found and designed by Ove, we are publishing with his kind consent. Persistent telnet or SSH sessions (GNU Screen http://www.gnu.org/software/screen/) are very handy in environments where remote users experience frequent disconnects from our QAD Unix system. Normally users need to re-login to unix after they have been disconnected, but with persistent session it automatically logs them in to previous session. 32printer.sh script needs to be adjusted when persistent sessions are used.

### check for environment variable $STY which is only set when in persistent session
if [ $STY != "" 2>/dev/null ]
then
 ## Assumes that .profile is setting :  session=`tty`; export tty
 ## echo "THIS IS PERSISTENT SESSION"
 ## sessiontype="PERSISTENT"; export sessiontype
 echo '\033[5i' > "$session"
 cat $1         > "$session"
 echo '\033[4i' > "$session"
else
 ## echo "this is regular session"
 ## sessiontype="REGULAR"; export sessiontype
 echo '\033[5i'
 cat $1
 echo '\033[4i'
fi

Add to user .profile that requires persistent session :

session=`tty`; export session

In the case of SSH, the session variable is not needed but you could look up $SSH_TTY, which always contains correct shell terminal id. Also in case (SSH again) you are inside screen your $SSH_TTY would differ from tty command output, otherwise they would be same.

Generating multi-page PDF document

32printer has functionality to merge static PDF pages to generated PDF documents, for example appending Terms and Condition page to PO document. That is done by setting form parameters described in PDF form Configuration Files . Starting from v3.06 32printer can generate multi page PDF documents, so each PDF page of the document can have a different background template with a different content.

In the progress program that generate row output file, add the following command: put control chr(27) "n%template_2.pdf". Here n% is a literal constant, template_2.pdf is the file name of the new template. The command should be inserted anywhere in the first page, before page-break symbol. This will force 32printer to replace the default background template, defined in configuration file, with the new template "template_2.pdf". Of course, the second template should be located in the same location as the default template. The row output file should look like this:

Content of the first page...
Content of the first page...
Content of the first page...
.....

(ESC)n%template_2.pdf

PAGE-BREAK Symbol

Content of the second page...
Content of the second page...
Content of the second page...
.....

 

Direct Excel Output

Starting from v3.08 32printer exports QAD custom or standard reports directly to Excel window, i.e. user selects "32prn" printer in QAD and program opens Excel window with report data, without showing 32printer selection. To enable this functionality first you need a new "switch" added to main.ini file. Type the following line anywhere in main.ini

excelSwitch = directExcelOutput

Note: the value of excelSwitch can be a random name, i.e. "directExcelOutput" can be replaced to any other, but should be unique enough. The second step you will need to create a new printer in 36.13.2 as following:

mgmgmt05.p b+            36.13.2 Printer Setup Maintenance            08/15/07
+----------------------------- Printer Definition -----------------------------+
¦      Output To: 32prnXL                           Destination Type: Default  ¦
¦                                                       Printer Type:          ¦
¦    Description: Direct Excel Output                   Lines / Page: 66       ¦
¦      Max Pages: 0                                    Scroll Output: no       ¦
¦Device Pathname: tmp                                        Spooler: no       ¦
+------------------------------ Printer Control -------------------------------+
¦ Initialize Command:                                                          ¦
¦                                                                              ¦
¦    Initialize Ctrl: directExcelOutput                                        ¦
¦                                                                              ¦
¦  80-Col Start Ctrl:                                                          ¦
¦                                                                              ¦
¦ 132-Col Start Ctrl:                                                          ¦
¦                                                                              ¦
¦         Reset Ctrl:                                                          ¦
¦                                                                              ¦
¦      Reset Command: 32prn.sh tmp                                             ¦
+------------------------------------------------------------------------------+

It's important to enter exactly the same value of the excelSwitch parameter to "Initialize Ctrl:" field.

Internationalization: decimal point, thousand separator, date format

Starting from v 3.08 Excel output no longer has problems with incorrect decimal point, thousand separator or incorrect date format. In case Excel shows incorrect decimal or date format, please add or revise the following parameters in the main.ini file:

dateFormat = MM/DD/YY
inputDecSeparator = ,
inputGroupSeparator = .

In the case these settings are missing from main.ini file, the program will take them from windows regional settings.

Working with Netterm and Secure Netterm

Some of our clients successfully use netterm and secure netterm with 32prn, here is how to set it up: (User manual page 30: http://www.securenetterm.com/pub/SecureNetTerm.pdf )

In secure netterm window go to menu options -> global settings -> printing ->
Select "Invoke user defined editing program" and click browse to select executable file, locate 32prn directory on your drive or on the network drive and select file prnloc.exe. Click OK to save. Go to QAD and send a report to 32prn output. With this setup, you do not need to launch 32printer.exe.

 

Working with WRQ Reflections

32printer works successfully with WRQ Reflections, although you have to be administrator on the PC to launch 32printer.exe for the first time. It creates an entry in the registry, specific to WRQ users. After that, other users can work on the PC without admin privileges.