206 lines
5.4 KiB
Plaintext
206 lines
5.4 KiB
Plaintext
COMPILE SUBROUTINE Print_GaN_Label(Parm1,Parm2)
|
|
|
|
/*
|
|
Print a label to the Zebra 105-s printer
|
|
|
|
12/07/2016 JCH - Initial coding - J.C.Henry, Inc. 2016
|
|
|
|
*/
|
|
|
|
|
|
DECLARE FUNCTION Set_Printer, Get_Printer, Get_Status, Msg, Printer_Select,Get_Property,Print_Init,Print_End,Print_Text
|
|
DECLARE FUNCTION obj_Install, Direct_Print, Environment_Services
|
|
DECLARE SUBROUTINE Set_Status, ErrMsg, Msg
|
|
|
|
$INSERT OIPRINT_EQUATES
|
|
$INSERT MSG_EQUATES
|
|
*$INSERT LOCATION_EQUATES
|
|
|
|
EQU PI$LEFT TO 1
|
|
EQU PI$TOP TO 2
|
|
EQU PI$RIGHT TO 3
|
|
EQU PI$BOTTOM TO 4
|
|
EQU PI$WIDTH TO 5
|
|
EQU PI$HEIGHT TO 6
|
|
EQU PI$SIZE TO 7
|
|
|
|
|
|
|
|
|
|
Parm1 = '69021hvfet'
|
|
Parm2 = '163138'
|
|
|
|
|
|
ErrorTitle = 'WTFO'
|
|
|
|
/*
|
|
BitMap = obj_Install('Get_Prop','ZebraGRF') ;* Substitute company logo converted to .GRF (Zebra graphics format)
|
|
OSREAD ImageData FROM BitMap ELSE
|
|
ErrMsg('Unable to Read ':BitMap:' graphic for use on Carton Labels.')
|
|
END
|
|
GRFName = FIELD(BitMap,'.',1)
|
|
*/
|
|
|
|
|
|
* * * * * * * * * * * *
|
|
*Start Printing Process
|
|
* * * * * * * * * * * *
|
|
|
|
FileName = "Printing Label"
|
|
Title = "Printing Label" ;* Initialize Printing
|
|
|
|
FileName = "Printing Label"
|
|
Title = "Printing Label" ;* Initialize Printing
|
|
|
|
PageInfo = ''
|
|
PageInfo<PI$LEFT> = 0.1
|
|
PageInfo<PI$TOP> = 0.1
|
|
PageInfo<PI$RIGHT> = 0.1
|
|
PageInfo<PI$BOTTOM> = 0.1
|
|
|
|
PageSetup = '1' ;* Landscape
|
|
PrintSetup = '' ;* Preview
|
|
|
|
|
|
* Get List of available printers and associated Ports from Windows OS *
|
|
|
|
AvailPrinters = ''
|
|
|
|
WshNetwork = OleCreateInstance("WScript.Network")
|
|
Printers = OleCallMethod(WshNetwork, 'EnumPrinterConnections')
|
|
|
|
pCnt = OleGetProperty(Printers, 'Length')
|
|
|
|
For I = 1 To pCnt step 2
|
|
|
|
thisPort = OleCallMethod(Printers, 'item', I-1)
|
|
thisPrinter = OleCallMethod(Printers, 'item', I)
|
|
|
|
AvailPrinters<-1> = thisPrinter:@VM:thisPort
|
|
|
|
Next I
|
|
|
|
PrintPath = 'Zebra Text Printer':@VM:'USB001'
|
|
|
|
LOCATE PrintPath IN AvailPrinters USING @FM SETTING Pos ELSE
|
|
* Put up a popup since we cant find the specified printer
|
|
END
|
|
|
|
IF PrintPath = '' THEN
|
|
Def = ""
|
|
Def<MTYPE$> = "TA3"
|
|
Def<MTEXT$> = 'Destination Printer not Selected..'
|
|
Def<MCAPTION$> = ''
|
|
Def<MICON$> = '*'
|
|
Msg(@WINDOW, Def, '')
|
|
RETURN
|
|
END
|
|
|
|
If Environment_Services('GetLabelPrintMethod') _EQC 'OIPI' then
|
|
stat = Set_Printer("INIT",FileName,Title,PageInfo,PageSetup,PrintSetup,PrintPath)
|
|
end else
|
|
stat = Direct_Print('START', PrintPath<1>, '', '')
|
|
end
|
|
|
|
IF stat < 0 THEN GOTO OIPrint_Err
|
|
|
|
|
|
|
|
|
|
* Label is 203 x 406 dots at 8dots/mm (203 dots/inch)
|
|
* Leave periodic spaces in Label String - OIPrint interface wraps text on spaces and will cut off
|
|
* the LabelString if there aren't any spaces. Printer Width needs to be set to 132 or greater
|
|
|
|
|
|
LabelString = '^XA' ;* Start of label format
|
|
LabelString := '^FWR' ;* Field orientation rotated 90
|
|
|
|
LabelString := '^LH0,0' ;* Label home for 'Landscape' printing
|
|
|
|
|
|
DEBUG
|
|
|
|
FOR I = 20 TO 400 STEP 20
|
|
|
|
LabelString := '^FO':I',0^A0,,12^FS'
|
|
|
|
NEXT I
|
|
|
|
LabelString := '^FO2,2^GB203,102,4,B^FS':CRLF$ ;* Line under Warehouse & Logo
|
|
|
|
|
|
/*
|
|
|
|
Company = 'IFX Epi Services' ;* Changed to hardcoded 10/25/2016 dkk
|
|
LabelString := '^FO0,0^A0,,36^FD':Company:'^FS'
|
|
|
|
LabelString := '^FO450,0^GB0,100,4,B^FS':CRLF$ ;* Vertical Before Lot data
|
|
|
|
LabelString := '^FO20,100^GB1150,0,4,B^FS':CRLF$ ;* Line under Warehouse & Logo
|
|
|
|
*/
|
|
*********************************************************************************
|
|
/*
|
|
|
|
LabelString := '^FO510,320^A0,,40^FDIFX Epi Services^FS':CRLF$ ;* Added Text for 'IFX Epi Services * * * * * * * * * *
|
|
|
|
IF SuppCd NE '' THEN
|
|
|
|
LabelString := '^FO590,430^A0,25^FDSupp Cd (1V):^FS':CRLF$ ;* Label Line - Added 8/17/2005 JCH Supplier Code Info
|
|
LabelString := '^FO740,430^A0,36,40^FD':SuppCd:'^FS':CRLF$ ;* Readable
|
|
|
|
LabelString := '^FO590,370^BY2^B3,,50,N^FD1V':SuppCd:'^FS':CRLF$ ;* Code 39 Supplier Code - This bar code is in line 1 ;*Changed ^FD' to ^FD1V' - dkk 7/27/15
|
|
LabelString := '^BY3,3.0':CRLF$
|
|
END
|
|
|
|
|
|
|
|
* Block 4 2nd Line
|
|
|
|
LabelString := '^FO0,515^A0,25^FD':CassIDLabel :'^FS':CRLF$ ;* Label Line
|
|
LabelString := '^FO130,515^A0,36,40^FD':CassID:'^FS':CRLF$ ;* Readable
|
|
|
|
LabelString := '^FO340,515^BY2^B3,,40,N^FD':CassID:'^FS':CRLF$ ;* Code 39 (This is the Cass ID) ;*Changed ^FD' to ^FD1T' - dkk 7/30/15
|
|
LabelString := '^BY3,3.0':CRLF$
|
|
*/
|
|
|
|
|
|
********************************************************************************
|
|
|
|
/*
|
|
BCString = Top:'*':Bottom
|
|
SWAP '*' WITH '/J' IN BCString
|
|
|
|
NarrowBarWidth = 2
|
|
LabelString := '^FO424,110^BY':NarrowBarWidth:',,^B3,N,150,Y,^FD':BCString:'^FS':CRLF$ ;* BarCode
|
|
|
|
LabelString := '^FO20,300^A0,40^FDWTop: ^FS':CRLF$ ;* Warehouse Label
|
|
LabelString := '^FO230,300^A0,40^FD':Top:'^FS':CRLF$ ;* Warehouse Data
|
|
|
|
*LabelString := '^FO450,300^A0,40^FDBottom: ^FS':CRLF$
|
|
*LabelString := '^FO620,300^A0,40^FD':Bottom:'^FS':CRLF$
|
|
|
|
LabelString := '^FO20,340^GB1150,0,4,B^FS':CRLF$ ;* Line 1.25" down the label
|
|
LabelString := '^FO20,580^GB1150,0,4,B^FS':CRLF$ ;* Line 1.25" down the label
|
|
|
|
*/
|
|
LabelString := '^XZ':CRLF$
|
|
|
|
If Environment_Services('GetLabelPrintMethod') _EQC 'OIPI' then
|
|
stat = Set_Printer('TEXT',LabelString)
|
|
end else
|
|
stat = Direct_Print('PRINT', LabelString)
|
|
end
|
|
|
|
* * * * * * *
|
|
OIPrint_Err:
|
|
* * * * * * *
|
|
|
|
If Environment_Services('GetLabelPrintMethod') _EQC 'OIPI' then
|
|
stat = Set_Printer("TERM")
|
|
end else
|
|
stat = Direct_Print('STOP')
|
|
end
|
|
|
|
RETURN
|