open-insight/LSL2/STPROC/PRINT_POPUP.txt
Infineon\StieberD 7762b129af pre cutover push
2024-09-04 20:33:41 -07:00

109 lines
2.4 KiB
Plaintext

COMPILE SUBROUTINE PRINT_POPUP(PopupName)
/*
Print a Popup on printer
07/29/1999 JCH - Initial coding - J.C.Henry, Inc. 1999
*/
DECLARE FUNCTION Set_Printer, Get_Printer, Get_Status, Msg, RGB, Printer_Select, obj_Install
DECLARE SUBROUTINE Set_Status, ErrMsg, Msg
$INSERT OIPRINT_EQUATES
$INSERT POPUP_EQUATES
$INSERT MSG_EQUATES
ErrorTitle = 'Error in Stored Procedure "PRINT_POPUP"'
IF NOT(ASSIGNED(PopupName)) THEN
ErrMsg(ErrorTitle:@SVM:"Unassigned Variable 'PopupName' Passed to Routine")
RETURN
END
AppName = @APPID<1>
PopupRec = XLATE('SYSREPOSPOPUPS',AppName:'**':PopupName,'','X')
IF PopupRec = '' THEN RETURN
Width = PopupRec<PWIDTH$>
Formats = PopupRec<PFORMAT$>
PopData = PopupRec<PDISPLAY$>
PTitle = PopupRec<PTITLE$>
**START PRINTING PROCESS**
FileName = ''
Title = PTitle:' Popup Listing':@VM:PTitle:' Popup Listing'
PageInfo = 1.0:@FM:1.0:@FM:1.0:@FM:0.6
PageSetup = 0 ;* Portrait
PrintSetup = 2:@VM:2
*PrintPath = Printer_Select() ;* Select printer without changing default printer
PrintPath = ''
/*
IF PrintPath = '' THEN
Def = ""
Def<MTYPE$> = "TA3"
Def<MTEXT$> = 'Destination Printer not Selected..'
Def<MCAPTION$> = ''
Def<MICON$> = '*'
Msg(@WINDOW, Def, '')
RETURN
END
*/
stat = Set_Printer("INIT",FileName,Title,PageInfo,PageSetup,PrintSetup,PrintPath)
font = "Arial"
font<2> = "10"
font<3> = "L"
font<4> = 0 ;* Normal font
stat = Set_Printer("FONT",font)
font<4> = 1 ;* Bold font
stat = Set_Printer("FONTHEADFOOT",font)
header = @VM:obj_Install('Get_Prop','CompTitle')
header<2> = @VM:PTitle
header<3> = ''
header<4> = ''
stat = Set_Printer("HEADER",header,colLen,colHead,colJust)
footer = "Page: 'P' - 'D' 'T'"
colfooter = ""
stat = Set_Printer("FOOTER", footer, colfooter)
colHead = ''
colFmt = ''
FOR I = 1 TO COUNT(Formats,@VM) + (Formats NE '')
ColHead<1,I> = Formats<1,I,6>
colWide = Formats<1,I,2>
colWidth = (Formats<1,I,2>/10)*1440
colJust = ''
IF Formats<1,I,3> = 'L' THEN colJust = '<'
IF Formats<1,I,3> = 'C' THEN colJust = '^'
IF Formats<1,I,3> = 'R' THEN colJust = '>'
colFmt<1,I> = colJust:colWidth
NEXT I
SWAP @VM WITH @FM IN PopData
SWAP @SVM WITH @VM IN PopData
stat = Set_Printer("ADDTABLE",colFmt,colHead,PopData,RGB(192,192,192),"",0,7)
stat = Set_Printer("TEXT")
stat = Set_Printer("TERM",1)
RETURN