Subroutine Set_Printer_Object(Type, Data, Font1, Font2, Fill) /******************************************************************************************************** This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written permission from SRP Computer Solutions, Inc. Name : Set Printer Object Description : Tags : [SRP] Parameters : History (Date, Initials, Notes) 12/14/06 fjt Initial development ********************************************************************************************************/ $insert SRP_APP_INSERTS $insert OIPI_FONTS $insert OIPRINT_EQUATES If Assigned(Type) else Type = "" If Assigned(Data) else Data = "" If Assigned(Font1) else Font1 = "" If Assigned(Font2) else Font2 = "" If Assigned(Fill) else Fill = "" xAdj = 0 yAdj = 0 rv = "" If (Font1 EQ "") then Font1 = Tahoma(6,1) If (Font1 EQ No$) then Font1 = "" Cnt = Count(Data, @FM) + (Data NE "") Begin Case Case Type EQ "T" ; GoSub TEXT Case Type EQ "R" ; GoSub RECT Case Type EQ "L" ; GoSub LINE End Case Data = "" Cancel = Get_Printer("CANCEL") Return Cancel !----- INTERNAL ROUTINES ------------------------------------------------------------------------------ TEXT: For i = 1 to Cnt Xpos1 = Data Ypos1 = Data Inches = Data Text = Data Justif = Text[1,1] NoWrap = "~" Twips = NoWrap:Justif:(Abs(Inches) * 1440) Text[1,1] = "" If (Font1 NE "") then rv<-1> = Set_Printer("FONT", Font1) rv<-1> = Set_Printer("POS", 0.00:@FM:Ypos1) rv<-1> = Set_Printer("ADDTABLE", Twips, "", Text, "", "", 0, 0:@FM:Xpos1 + 0.050) Next i Data = "" return RECT: If Assigned(Font2) then DataPos = 0.150 end else DataPos = 0.150 Font2 = Tahoma(10,1) end For i = 1 to Cnt Xpos1 = (Data + xAdj) Ypos1 = (Data + yAdj) Xpos2 = (Data + xAdj) Ypos2 = (Data + yAdj) RectLabel = (Data) RectVar = (Data) Align = (Data) Twips = "<":( (Abs(Xpos2 - Xpos1)) * 1440 ) If (Fill) then rv = Set_Printer("FILLSTYLE", BS_SOLID:@FM:Fill) end rv = Set_Printer("RECT", Xpos1:@FM:Ypos1:@FM:Xpos2:@FM:Ypos2, No$) If (Fill) then rv = Set_Printer("FILLSTYLE", BS_HOLLOW:@FM:White$) If (RectLabel GT "") then rv<-1> = Set_Printer("FONT", Font1) rv<-1> = Set_Printer("POS", 0.00:@FM:Ypos1 + 0.025) rv<-1> = Set_Printer("ADDTABLE", Twips, "", RectLabel, "", "", 0, 0:@FM:Xpos1 + 0.025) end If (RectVar GT "") then Adj = 0.10 If Align then Twips[1,1] = Align Adj = 0 end rv<-1> = Set_Printer("FONT", Font2) rv<-1> = Set_Printer("POS", 0.00:@FM:Ypos1 + DataPos) rv<-1> = Set_Printer("ADDTABLE", Twips, "", RectVar, "", "", 0, 0:@FM:Xpos1 + Adj) end Next i return LINE: For i = 1 to Cnt Xpos1 = (Data + xAdj) Ypos1 = (Data + yAdj) Xpos2 = (Data + xAdj) Ypos2 = (Data + yAdj) Until Xpos1 EQ "" If (Fill GT "") then rv<-1> = Set_Printer("LINESTYLE", 0:@FM:1/2:@FM:Fill) rv<-1> = Set_Printer("LINE", Xpos1:@FM:Ypos1:@FM:Xpos2:@FM:Ypos2, No$) If (Fill GT "") then rv<-1> = Set_Printer("LINESTYLE", 0:@FM:1/2:@FM:0) Next i return