opos drivers for cash drawers, mage strip readers, printers

Post Reply
Mike Buckler
Posts: 67
Joined: Thu Jan 05, 2006 10:35 pm
Location: Canada
Contact:

opos drivers for cash drawers, mage strip readers, printers

Post by Mike Buckler »

Has anyone an example of using the opos drivers for cash drawers, mage strip readers, printers etc.

Thanks In advance Mike
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post 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
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post 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()
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post 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)
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

otto which cash and touch monitor you use ?
( model and macfature)

thanks
Best Regards, Saludos

Falconi Silvio
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Image
Mike Buckler
Posts: 67
Joined: Thu Jan 05, 2006 10:35 pm
Location: Canada
Contact:

Post 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.
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Thank you for the information. Didn't knew of this driver.
Regards,
Otto
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
Post Reply