compile function LSL_USERS_RPT1() 
begin condition
pre:
post:
end condition
declare function set_printer, fieldcount, utility, dialog_box, Printer_Select
$insert oiprint_equates
$insert rlist_equates
$insert lsl_users_equ
$insert sec_groups_equ

Params = dialog_box( 'LSL_USERS_RPT1', @window, '*CENTER' )
if Params = 'CANCEL' or Params = '' then
    return 0
end
convert '*' to @fm in Params
Users      = Params<1>
Expand     = ( Params<2> = 'Yes' )
DirToPrint = ( Params<3> = 'Yes' )
Stat = utility( 'CURSOR', 'H' )
if DirToPrint then
   PrnSetup = '' ;* defaults to printer
end else
   PrnSetup = 3
end

PrintPath = Printer_Select('',1)	;* Get default printer path
Stat = set_printer( 'INIT', '', '', '':@fm:'':@fm:0:@fm:'', '', PrnSetup ,PrintPath)

Ucnt = fieldcount( Users, @vm )
for i = 1 to Ucnt
   ThisUser = Users<1,i>
   URec = xlate( 'LSL_USERS', ThisUser, '', 'X' )
   Font = 'Times New Roman,16,L,1,,1'
   convert ',' to @fm in Font
   Void = set_printer( 'FONT', Font )
   Lout = fmt( 'UserName', 'L#25' ):'  ':fmt( 'FirstName', 'L#25' ):'  LastName'
   Void = set_printer( 'TEXT', Lout )
   Font<6> = 0 ;*no underline
   Void = set_printer( 'FONT', Font )   
   Lout = fmt( ThisUser, 'L#25' ):'  ':fmt( URec<lsl_users_first$>, 'L#25' ):'  ':URec<lsl_users_last$>
   Void = set_printer( 'TEXT', Lout )   
   Void = set_printer( 'TEXT', '' )
   Void = set_printer( 'TEXT', '' )
   Lout = 'R=READ     W=WRITE     D=DELETE     E=EDIT     P=PRINT'
   Void = set_printer( 'TEXT', Lout )  
   Void = set_printer( 'TEXT', '' )   
   Table = 'Tables~Rights'
   UTables = URec<lsl_users_tables$>
   URights = URec<lsl_users_rights$>
   TCnt = fieldcount( UTables, @vm )
   for j = 1 to TCnt
      Table<-1> = UTables<1,j>:'~':URights<1,j>
   next j
   convert '~' to @vm in Table
   TableColInfo = '<+2880':@vm:'<+1440'
   x = Set_Printer("ADDTABLE", TableColInfo, '', Table, '', '', 1, TB_ALL )
   Void = set_printer( 'TEXT', '' )
   LOut = fmt( 'Administrative User: ':oconv( URec<lsl_users_admin_user$>, 'B' ), 'L#40' )
   LOut := fmt( 'Process Tech: ':oconv( URec<lsl_users_process_tech$>, 'B' ), 'L#40' )
   Void = set_printer( 'TEXT', Lout )
   LOut = fmt( 'RDS Master Rights: ':oconv( URec<lsl_users_rds_master$>, 'B' ), 'L#40' )
   LOut := fmt( 'Active: ':oconv( URec<lsl_users_active$>, 'B' ), 'L#40' )
   Void = set_printer( 'TEXT', Lout )   
   Void = set_printer( 'TEXT', '' )
   Font<6> = 1 ;* underline
   Void = set_printer( 'FONT', Font )
   Void = set_printer( 'TEXT', 'S E C U R I T Y    G  R  O  U  P  S' )   
   Font<6> = 0 ;*no underline
   Void = set_printer( 'FONT', Font )
   Void = set_printer( 'TEXT', '' )   
   Groups = URec<lsl_users_groups$>
   Gcnt = fieldcount( Groups, @vm )
   for j = 1 to Gcnt
      ThisGroup = Groups<1,j>
      Void = set_printer( 'TEXT', ThisGroup )
      if Expand then
         GroupRec = xlate( 'SEC_GROUPS', ThisGroup, '', 'X' )
         Table = ''
		   Table = 'Tables~Rights'
		   UTables = GroupRec<sec_groups_tables$>
		   URights = GroupRec<sec_groups_rights$>
		   TCnt = fieldcount( UTables, @vm )
		   for k = 1 to TCnt
		      Table<-1> = UTables<1,k>:'~':URights<1,k>
		   next k
		   convert '~' to @vm in Table
         TableColInfo = '<+2880':@vm:'<+1440'		   
		   x = Set_Printer("ADDTABLE", TableColInfo, '', Table, '', '', 1, TB_ALL )
      end
      Void = set_printer( 'TEXT', '' )
   next j
   Void = set_printer( 'PAGEBREAK' )
next i
Void = set_printer( 'TERM' )
return 0
