added LSL2 stored procedures
This commit is contained in:
122
LSL2/STPROC/PRINT_LABELS2.txt
Normal file
122
LSL2/STPROC/PRINT_LABELS2.txt
Normal file
@ -0,0 +1,122 @@
|
||||
compile function PRINT_LABELS2()
|
||||
begin condition
|
||||
pre:
|
||||
post:
|
||||
end condition
|
||||
declare function msg, set_property, send_event, dialog_box, utility, get_property
|
||||
declare function set_printer, fieldcount, key_sort,Printer_Select
|
||||
declare subroutine rlist, or_view, activate_save_select, yield, extract_si_keys
|
||||
declare subroutine btree.extract
|
||||
$insert logical
|
||||
$insert rlist_equates
|
||||
$insert msg_equates
|
||||
$insert names_equ
|
||||
$insert company_equ
|
||||
|
||||
$insert oiprint_equates
|
||||
|
||||
open 'COMPANY' to COTable else
|
||||
Void = msg( '', 'Unable to open COMPANY table...' )
|
||||
return 0
|
||||
end
|
||||
Stat = utility( 'CURSOR', 'H' )
|
||||
Stmt = 'SELECT COMPANY WITH CO_TYPE = "C" BY CO_NAME'
|
||||
|
||||
rlist( Stmt, target_activelist$, '', '', '' )
|
||||
|
||||
Nrec1 = ''
|
||||
Nrec2 = ''
|
||||
Nrec3 = ''
|
||||
Rcnt = 0
|
||||
RowsPrinted = 0
|
||||
if @reccount then
|
||||
gosub PrinterInit
|
||||
Eof = false$
|
||||
NumKeys = @reccount
|
||||
Cnt = 0
|
||||
loop
|
||||
readnext CId else Eof = true$
|
||||
until Eof
|
||||
read CORec from COTable, CId else
|
||||
Void = msg( '', 'Unable to read COMPANY ':CId )
|
||||
return 0
|
||||
end
|
||||
Column = ''
|
||||
Attn = 'Attn: Y2k Contact/Quality Dept.'
|
||||
CoName = CORec<company_co_name$>
|
||||
Addr1 = CORec<company_address$,1>
|
||||
Addr2 = CORec<company_address$,2>
|
||||
Addr3 = CORec<company_address$,3>
|
||||
City = CORec<company_city$>
|
||||
St = CORec<company_state$>
|
||||
Zip = CORec<company_zip$>
|
||||
|
||||
if City then
|
||||
City := ', '
|
||||
end
|
||||
Column = Attn:@vm:CoName:@vm:Addr1:@vm:Addr2:@vm:Addr3:@vm:City:St:' ':Zip
|
||||
Rcnt += 1
|
||||
begin case
|
||||
case Rcnt = 1
|
||||
Nrec1 = Column
|
||||
case Rcnt = 2
|
||||
Nrec2 = Column
|
||||
case Rcnt = 3
|
||||
Nrec3 = Column
|
||||
end case
|
||||
if Rcnt = 3 then
|
||||
gosub PrintRow
|
||||
end
|
||||
repeat
|
||||
if Nrec1 <> '' or Nrec2 <> '' or Nrec3 <> '' then
|
||||
* print last ones
|
||||
gosub PrintRow
|
||||
end
|
||||
end
|
||||
Void = set_printer( 'TERM' )
|
||||
Stat = utility( 'CURSOR', 'A' )
|
||||
return 0
|
||||
*================================================================================================*
|
||||
PrinterInit:
|
||||
* initialize the printer and set the headings
|
||||
PrintPath = Printer_Select('') ;* Get Printer Path
|
||||
Void = set_printer( 'INIT', '', '', .25:@fm:.38:@fm:'':@fm:.5, '', 2 ,PrintPath)
|
||||
Font = 'Times New Roman,7,L,0' ;* 10 point, Left just, Bold
|
||||
convert ',' to @fm in Font
|
||||
Void = set_printer( 'FONT', Font )
|
||||
Void = set_printer( 'TEXT', '' )
|
||||
return
|
||||
|
||||
*================================================================================================*
|
||||
PrintRow:
|
||||
if RowsPrinted = 10 then
|
||||
Void = set_printer( 'PAGEBREAK' )
|
||||
RowsPrinted = 0
|
||||
Void = set_printer( 'TEXT', '' )
|
||||
end
|
||||
* do printing
|
||||
Table = ''
|
||||
Table<-1> = Nrec1<1,1>:@vm:Nrec2<1,1>:@vm:Nrec3<1,1>
|
||||
x = Set_Printer("TABLE", Table, '', 2.81:@fm:2.81:@fm:2.81, 'L':@fm:'L':@fm:'L', TB_NONE)
|
||||
Table = ''
|
||||
Table<-1> = Nrec1<1,2>:@vm:Nrec2<1,2>:@vm:Nrec3<1,2>
|
||||
x = Set_Printer("TABLE", Table, '', 2.81:@fm:2.81:@fm:2.81, 'L':@fm:'L':@fm:'L', TB_NONE)
|
||||
Table = ''
|
||||
Table<-1> = Nrec1<1,3>:@vm:Nrec2<1,3>:@vm:Nrec3<1,3>
|
||||
x = Set_Printer("TABLE", Table, '', 2.81:@fm:2.81:@fm:2.81, 'L':@fm:'L':@fm:'L', TB_NONE)
|
||||
Table = ''
|
||||
Table<-1> = Nrec1<1,4>:@vm:Nrec2<1,4>:@vm:Nrec3<1,4>
|
||||
x = Set_Printer("TABLE", Table, '', 2.81:@fm:2.81:@fm:2.81, 'L':@fm:'L':@fm:'L', TB_NONE)
|
||||
Table = ''
|
||||
Table<-1> = Nrec1<1,5>:@vm:Nrec2<1,5>:@vm:Nrec3<1,5>
|
||||
x = Set_Printer("TABLE", Table, '', 2.81:@fm:2.81:@fm:2.81, 'L':@fm:'L':@fm:'L', TB_NONE)
|
||||
Table = ''
|
||||
Table<-1> = Nrec1<1,6>:@vm:Nrec2<1,6>:@vm:Nrec3<1,6>
|
||||
x = Set_Printer("TABLE", Table, '', 2.81:@fm:2.81:@fm:2.81, 'L':@fm:'L':@fm:'L', TB_NONE)
|
||||
* reset vars
|
||||
RowsPrinted += 1
|
||||
Rcnt = 0
|
||||
Nrec1 = ''
|
||||
Nrec2 = ''
|
||||
Nrec3 = ''
|
||||
return
|
Reference in New Issue
Block a user