Page 1 of 1

opos drivers for cash drawers, mage strip readers, printers

Posted: Thu Dec 27, 2007 8:37 pm
by Mike Buckler
Has anyone an example of using the opos drivers for cash drawers, mage strip readers, printers etc.

Thanks In advance Mike

Posted: Thu Dec 27, 2007 10:18 pm
by Otto
Regards,
Otto

func ladeauf

LOCAL oPrn
LOCAL cPrnName := GetPvProfString( "LadeDruck", "DruckerName", "Generic / Text Only", ".\INI\TOUCH.INI" )
LOCAL oPrnDos
LOCAL oFntNormal
*----------------------------------------------------------------
if GetPvProfString( "Kassenlade", "INSTALLIERT" , "N", ".\INI\TOUCH.INI" ) = "J"
msginfo(GetPvProfString( "Kassenlade", "UEBERDRUCKER" , "N", ".\INI\TOUCH.INI" ))
if GetPvProfString( "Kassenlade", "UEBERDRUCKER" , "N", ".\INI\TOUCH.INI" ) ="J"
oPrnDOS := TDosPrn():New("LPT1")
*Print #1, Chr$(27); Chr$(112); Chr$(0); Chr$(15); Chr$(15);
*oPrnDOS:write(chr(27)+chr(112)+chr(15)+chr(15))
oPrnDOS:write(chr(27)+chr(112)+chr(0)+chr(10)+chr(100))
oPrnDOS:cFormFeed:="0"
oPrnDOS:EndPage() // optional
oPrnDOS:End()
else
oPrn := PrintBegin("DRUCKER", .f., .f.,cPrnName )
PAGE
DEFINE FONT oFntNormal NAME "ARIAL" SIZE 16,40
oPrn:Say( 0,5 , (chr(27)+chr(112)+chr(0)+chr(10)+chr(100)) , oFntNormal )
ENDPAGE
ENDPRINT
RELEASE FONT oFntNormal
ENDIF
ENDIF

RETURN nil

Posted: Thu Dec 27, 2007 10:23 pm
by Otto
This is for DOS if you use windows then I does not matter which printer you address.
oPrnDOS := TDosPrn():New("LPT1")

oPrnDOS:Newline()
oPrnDOS:write(chr(27)+chr(33)+chr(32))
oPrnDOS:write(cFirma )
oPrnDOS:Newline()
oPrnDOS:write(chr(27)+chr(64))
oPrnDOS:Newline()

oPrnDOS:write(space((42 - len(cCompany)) /2) + cCompany )

oPrnDOS:Newline()
oPrnDOS:write(space((42 - len(cAddr1)) /2) +cAddr1 )
oPrnDOS:Newline()
oPrnDOS:write(space((42 - len(cAddr2)) /2) +cAddr2 )
oPrnDOS:Newline()
oPrnDOS:write(space((42 - len(cATU)) /2) +cATU )
oPrnDOS:Newline()
oPrnDOS:write("------------------------------------------")
oPrnDOS:Newline()

oPrnDOS:Newline()
oPrnDOS:write(chr(27)+chr(33)+chr(32))
oPrnDOS:write("RECHNUNG")
oPrnDOS:Newline()
oPrnDOS:write(chr(27)+chr(64))


oPrnDOS:cFormFeed := "0"
oPrnDOS:EndPage() // optional
oPrnDOS:End()

Posted: Thu Dec 27, 2007 10:31 pm
by Otto
This is code I use for the display.




func f_KUNDENDISPLAY
#ifdef KUNDENDISPLAY
LOCAL lReady
LOCAL nDelTime := 1
*--------------------------------------------

if aSetup[4]="J" //GetPvProfString( "SETUPDATEN","DSO800", "N", ".\INI\TOUCH.INI" )

WriteComm( DSP_COM, Chr(4) + Chr(1) + Chr(67) + Chr(49) + Chr(88) )
WriteComm( DSP_COM, Chr(23) )
WriteComm( DSP_COM, Chr(4) + Chr(1) + Chr(80) + "1" )
WriteComm( DSP_COM, Chr(23) )
WriteComm( DSP_COM, DISPLINE1 )

WriteComm( DSP_COM, Chr(4) + Chr(1) + Chr(80) + CHR(70) )
WriteComm( DSP_COM, Chr(23) )
WriteComm( DSP_COM, DISPLINE2 )

ELSE

lReady := SetCommState( cDcb )

WriteComm( DSP_COM, Chr(27) + Chr(64) )

WriteComm( DSP_COM, Chr(12) )
WriteComm( DSP_COM, Chr(11) )
WriteComm( DSP_COM, DISPLINE1 )
WriteComm( DSP_COM, Chr(31) + Chr(36) + chr(1) + chr(2) )
WriteComm( DSP_COM, DISPLINE2 )
ENDIF



#ENDIF

RETURN nil

func f_EIN_KUNDENDISPLAY()
#ifdef KUNDENDISPLAY
LOCAL lReady
LOCAL nDelTime := 1
*--------------------------------------------
DSP_COM := OpenCOMM( GetPvProfString( "SETUPDATEN","DISPLAY" ,"COM2" , ".\INI\TOUCH.INI" ), 1024, 128 )
if ! BuildCommDcb( GetPvProfString( "SETUPDATEN","DISPLAY" ,"COM2" , ".\INI\TOUCH.INI" )+":9600,n,8,1", @cDcb )
nError = GetCommError( DSP_COM )
MsgInfo( "BuildCommDcb Error: " + Str( nError ) )
ENDIF
lReady := SetCommState( cDcb )
WriteComm( DSP_COM, Chr(27) + Chr(64) )


IF GetPvProfString( "SETUPDATEN","DSO800", "N", ".\INI\TOUCH.INI" )="J"
WriteComm( DSP_COM, Chr(4) + Chr(1) + Chr(67) + Chr(49) + Chr(88) )
WriteComm( DSP_COM, Chr(23) )
WriteComm( DSP_COM, Chr(4) + Chr(1) + "P" + "1" )
WriteComm( DSP_COM, Chr(23) )

WriteComm( DSP_COM, Chr(4) + Chr(1) + "P" + chr(75) )
WriteComm( DSP_COM, Chr(23) )


else
WriteComm( DSP_COM, Chr(12) )
WriteComm( DSP_COM, Chr(11) )
ENDIF


#ENDIF
RETURN nil



func f_AUS_KUNDENDISPLAY()
#ifdef KUNDENDISPLAY
LOCAL lReady
LOCAL nDelTime := 1
*--------------------------------------------

DelPrnt(nDelTime)
CloseComm(DSP_COM)
#ENDIF
RETURN nil


static function DelPrnt(nDelTime)
LOCAL oTimer,lWaitIng := .F.,oDlg

nDelTime := nDelTime * 1
DEFINE DIALOG oDlg RESOURCE "TELEFON"

ACTIVATE DIALOG oDlg CENTERED ;
ON INIT(oTimer := TTimer():New( nDelTime,{||oTimer:Deactivate(),lWaiting := .T.,oDlg:End()},oDlg ),oTimer:Activate()) valid(lWaiting)

RETURN(nil)




#ifdef KUNDENDISPLAY
f_EIN_KUNDENDISPLAY()
DISPLINE1:= rg_umsetz(20,left(GetPvProfString( "DISPLAY", "Display11","" ,".\INI\TOUCH.INI" ),20))
DISPLINE2:= rg_umsetz(20,left(GetPvProfString( "DISPLAY", "Display12","" ,".\INI\TOUCH.INI" ),20))
f_KUNDENDISPLAY(DISPLINE1,DISPLINE2)
f_AUS_KUNDENDISPLAY()
#ENDIF




func rg_umsetz(nBezLaenge,wort)
wort := ansitooem(left(wort,nBezLaenge))
RETURN (wort)

Posted: Fri Dec 28, 2007 12:36 am
by Silvio
otto which cash and touch monitor you use ?
( model and macfature)

thanks

Posted: Fri Dec 28, 2007 2:00 am
by Otto
Image

Posted: Sun Dec 30, 2007 12:34 am
by Mike Buckler
Thanks Otto for all of your examples.

What I am actually looking for is a way to interface to OPOS and UPOS com objects.

OPOS and UPOS are Point-Of-Sale device standards this means that you can implement a function to open a cash drawer use the OPOS commands and now your application supports all cash drawers that have an OPOS or UPOS interface.

Just think of how great it would be to interface to the OPOS Printer interface and instantly support all receipt printers.

Currently the supported devices are-
POS Keyboard
POS Printer
Cash Changer
Tone Indicator
Bump Bar
Fiscal Printer
Pin Pad
Remote Order Display
Scale
Power Reporting
Credit Authorization Terminal
Point Card Reader/Writer
Line Display
Check Scanner
Smart Card Reader/Writer
Biometrics
Bill Acceptor
Bill Dispenser
Coin Acceptor
Image Scanner
You can read about OPOS at http://www.monroecs.com/oposreleases.htm
And UPOS at http://www.monroecs.com/unifiedpos.htm

Here is what I have tried for cash drawer.
Procedure Opendrawer(oWnd,dr)
hie:=TActiveX():New( oWnd,"OPOS.CashDrawer" )
if dr = 1
hie:do("Open","cdrwr1") //cdrwr1 is the name that was set for drawer 1 in the OPOS interface
else
hie:do("Open","cdrwr2") //cdrwr2 is the name that was set for drawer 2 in the OPOS interface
endif
hie:do("ClaimDevice",1000)
hie:do("DeviceEnabled",.t.)
hie:do("OpenDrawer")
hie:do("WaitForDrawerClose",10000,2000,100,1000)
hie:do("ReleaseDevice")
hie:do("Close")

Currently the above code executes properly on a Panasonic pos station and errors on a Partner Tec pos station.

Posted: Sun Dec 30, 2007 12:52 am
by Otto
Thank you for the information. Didn't knew of this driver.
Regards,
Otto

Posted: Sun Dec 30, 2007 12:03 pm
by James Bott
Mike,

>Currently the above code executes properly on a Panasonic pos station and errors on a Partner Tec pos station.

What statement does it error out on? What is the error?

James