A NEW TODAY IS DAWNING!

BuildPro Printing

 

Introduction

This document refers to printing OCS/BuildProfessional reports on a linux/unix operation system. For details on printing Crystal Reports please refer to the technical bulletin Crystal Reporting.

All OCS reports generate a standard ASCII text file on the linux/unix system which is passed to a lpr script. This script controls all printing of the reports. Optionally the file can also save the report to file, email it or fax the report.


Example of lpr

This is an example of a typical lpr script. NOTE: This script must be edited to suit your linux/unix environment.

#
# lpr script -
# Makes lp look like lpr.
# If $lpr_file is set then cat the files to $lpr_file instead of lp.
#
thiscmd=`basename $0`
usage="$thiscmd: Usage: $thiscmd [-c] [-d<dest>] [-m] [-n<copies>] [-o<option>] [-r] [-s] [-t<title>] [-w] [files]"
options="-o cpi=18"
files=
remove=false
set -- `getopt cd:mn:o:rst:w: $*`
if [ $? -ne 0 ]; then
  echo "$usage" 1>&2; exit 1
fi
while [ $# -gt 0 ]
do
  case $1 in
    -c) options="$options $1";;
    -d) shift; options="$options -d$1"; prt=$1 ;;
    -m) options="$options $1";;
    -n) shift; options="$options -n$1";;
    -o) shift; options="$options -o$1";;
    -r) remove=true;;
    -s) ;; # This is default
    -t) shift; options="$options -t$1";;
    -w) shift; options="$options -w$1";;
    --) shift; break;;
  esac
  shift
done
files="$*"
if [ ! "$prt" ] ; then
  prt=`lpstat -d | awk '{print $NF}'` # set default printer may differ per unix
fi
if [ "$lprFile" -a "$lprFile" != " " ] ; then
  if [ `echo "$lprFile" | cut -c 1` = "/" ] ; then
    cat $files > "$lprFile"
  else
    cat $files > "/dsk1/ocs/reports/$lprFile"
  fi
elif [ "$lprEmail" -a "$lprEmail" != " " ] ; then
  cat $files | mail -s "OCS Report" "$lprEmail"
elif [ "$lprFaxNo" -a "$lprFaxNo" != " " ] ; then
  $Utools/Utools/bin/faxcmd send $files "$1" -type ascii -ok -now > /dev/null
else
  if [ -z "$lpr_file" ]; then
    cat $files | lp -s $options
  else
    cat $files >> $lpr_file
  fi
fi
lperrcode=$?
if [ remove = true ]; then
  rm -f $files
fi
exit $lperrcode