201 lines
4.0 KiB
Plaintext
201 lines
4.0 KiB
Plaintext
COMPILE SUBROUTINE Print_Notification(Dummy)
|
|
|
|
/*
|
|
Print Notifications Report
|
|
09/27/2005 - John C. Henry, J.C. Henry & Co., Inc. - Initial coding
|
|
*/
|
|
|
|
|
|
DECLARE SUBROUTINE Utility, ErrMsg, Set_Status, Set_Printer, RList
|
|
DECLARE FUNCTION Set_Printer, Get_Printer, Msg, Get_Status, Printer_Select, obj_Install, Dialog_Box
|
|
|
|
$INSERT OIPRINT_EQUATES
|
|
$INSERT APPCOLORS
|
|
$INSERT MSG_EQUATES
|
|
|
|
|
|
EQU TAB$ TO \09\
|
|
EQU TARGET_ACTIVELIST$ TO 5
|
|
|
|
|
|
ErrorTitle = 'Error in stored procedure Print_Notifications'
|
|
|
|
OPEN 'NOTIFICATION' TO NotificationTable ELSE
|
|
ErrorMsg = 'Unable to open "NOTIFICATION" table.'
|
|
ErrMsg(ErrorTitle:@SVM:ErrorMsg)
|
|
RETURN
|
|
END
|
|
|
|
|
|
OPEN 'DICT.NOTIFICATION' TO @DICT ELSE
|
|
ErrorMsg = 'Unable to open "DICT>NOTIFICATION" table.'
|
|
ErrMsg(ErrorTitle:@SVM:ErrorMsg)
|
|
RETURN
|
|
END
|
|
|
|
|
|
|
|
SELECT NotificationTable
|
|
|
|
|
|
* Start of printing process
|
|
|
|
FileName = 'Print Notifications by Company Report'
|
|
Title = 'Printing Notifications by Company'
|
|
|
|
TopMargin = 1.0
|
|
BottomMargin = 0.75
|
|
LeftMargin = 0.5
|
|
RightMargin = 0.5
|
|
|
|
Margins = LeftMargin:@FM:TopMargin:@FM:RightMargin:@FM:BottomMargin
|
|
|
|
PageSetup = '1' ;* Landscape = 1
|
|
PrintSetup = '2' ;* Preview Normal
|
|
PrintPath = Printer_Select()
|
|
|
|
stat = Set_Printer('INIT',FileName,Title,Margins,PageSetup,PrintSetup,PrintPath)
|
|
IF stat < 0 THEN GOTO OIPrintErr
|
|
|
|
|
|
Header = "'D'":@VM:obj_Install('Get_Prop','CompTitle'):' Notifications Report':@VM:"Page 'P'"
|
|
Header<-1> = '' ;* Blank line following heading
|
|
|
|
font = 'Arial'
|
|
font<2> = '10'
|
|
font<4> = '1' ;* Bold
|
|
|
|
stat = Set_Printer('FONTHEADFOOT',font) ; IF stat < 0 THEN GOTO OIPrintErr
|
|
stat = Set_Printer('HEADER',Header) ; IF stat < 0 THEN GOTO OIPrintErr
|
|
|
|
Footer = " 'D' 'T'":@VM:@VM:"Page: 'P'"
|
|
stat = Set_Printer('FOOTER',Footer) ; IF stat < 0 THEN GOTO OIPrintErr
|
|
|
|
@RECCOUNT= 0
|
|
|
|
FirstPass = 1
|
|
LastRecord = 0
|
|
FirstLine = 1
|
|
|
|
* Make Column Heading
|
|
|
|
colHead = '' ; colFmt = ''
|
|
colHead<1,1> = 'Notify ID' ; colFmt<1,1> = '<2880'
|
|
colHead<1,2> = 'Description' ; colFmt<1,2> = '<5760'
|
|
colHead<1,3> = 'User ID' ; colFmt<1,3> = '<1800'
|
|
colHead<1,4> = 'User Name' ; colFmt<1,4> = '<2880'
|
|
|
|
* Zero Accumulators For Each Break
|
|
|
|
|
|
* * * * * * *
|
|
ReadRecord:
|
|
* * * * * * *
|
|
|
|
|
|
|
|
READNEXT @ID, WhichValue ELSE
|
|
LastRecord = 1
|
|
END
|
|
|
|
S.NOTIFY_ID = @ID
|
|
|
|
IF FirstPass AND LastRecord THEN
|
|
GOTO Bail
|
|
END
|
|
|
|
|
|
IF LastRecord THEN GOTO Bail
|
|
|
|
READO @RECORD FROM NotificationTable,@ID ELSE
|
|
GOTO ReadRecord
|
|
END
|
|
|
|
|
|
@RECCOUNT += 1
|
|
|
|
* Calculate Value(s) For Column(s)
|
|
|
|
S.NOTIFY_ID = { @ID}
|
|
S.DESC = {DESC}
|
|
S.USER_ID = {USER_ID}
|
|
S.USER_NAME = {USER_NAME}
|
|
|
|
SWAP @VM WITH CRLF$ IN S.USER_ID
|
|
SWAP @VM WITH CRLF$ IN S.USER_NAME
|
|
|
|
IF FirstPass THEN FirstPass= 0
|
|
|
|
colData = ""
|
|
colData<1,1> = S.NOTIFY_ID
|
|
colData<1,2> = S.DESC
|
|
colData<1,3> = S.USER_ID
|
|
colData<1,4> = S.USER_NAME
|
|
|
|
GOSUB PrintTable
|
|
|
|
IF LastRecord THEN GOTO Bail
|
|
|
|
GOTO ReadRecord
|
|
|
|
|
|
* * * * * * *
|
|
Bail:
|
|
* * * * * * *
|
|
|
|
stat = Set_Printer('TERM',1)
|
|
|
|
RETURN
|
|
|
|
|
|
* * * * * * *
|
|
OIPrintErr:
|
|
* * * * * * *
|
|
|
|
ErrMsg(ErrorTitle:@SVM:ErrorMsg)
|
|
ErrMsg(ErrorTitle:@SVM:'Set_Printer returned errorcode ':stat)
|
|
stat = Set_Printer('TERM',1)
|
|
|
|
RETURN
|
|
|
|
|
|
* * * * * *
|
|
PrintTable:
|
|
* * * * * *
|
|
|
|
|
|
stat = Set_Printer('CALCTABLE',colFmt:@FM:colData)
|
|
TableSize = Get_Printer('CALCTABLE')
|
|
TableHeight = TableSize<2>
|
|
Test = Get_Printer('POS')<2>
|
|
|
|
IF Get_Printer('POS')<2> + TableHeight > 9.00 OR FirstLine THEN
|
|
IF NOT(FirstLine) THEN
|
|
stat = Set_Printer('PAGEBREAK')
|
|
END
|
|
FirstLine = 0
|
|
font<2> = 10
|
|
font<4> = 1 ;* Bold
|
|
stat = Set_Printer('FONT',font,'100')
|
|
|
|
stat = Set_Printer('ADDTABLE',colFmt,colHead,'',LTGREY$,'',0,TB_ALL)
|
|
|
|
|
|
font<4> = 0
|
|
stat = Set_Printer('FONT',font,fontSpacing)
|
|
|
|
stat = Set_Printer('ADDTABLE',colFmt,'',colData,LTGREY$,'',0,7)
|
|
|
|
END ELSE
|
|
font<2> = 10
|
|
font<4> = 0
|
|
stat = Set_Printer('FONT',font,fontSpacing)
|
|
stat = Set_Printer('ADDTABLE',colFmt,'',colData,LTGREY$,'',1,TB_ALL)
|
|
|
|
END
|
|
|
|
|
|
RETURN
|
|
|
|
|