FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour opos drivers for cash drawers, mage strip readers, printers
Posts: 67
Joined: Thu Jan 05, 2006 10:35 PM
opos drivers for cash drawers, mage strip readers, printers
Posted: Thu Dec 27, 2007 08:37 PM

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

Thanks In advance Mike

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
opos drivers for cash drawers, mage strip readers, printers
Posted: Thu Dec 27, 2007 10:18 PM

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

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
opos drivers for cash drawers, mage strip readers, printers
Posted: Thu Dec 27, 2007 10:23 PM

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()

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
opos drivers for cash drawers, mage strip readers, printers
Posted: Thu Dec 27, 2007 10:31 PM

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)

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
opos drivers for cash drawers, mage strip readers, printers
Posted: Fri Dec 28, 2007 12:36 AM

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

thanks

Best Regards, Saludos



Falconi Silvio
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
opos drivers for cash drawers, mage strip readers, printers
Posted: Fri Dec 28, 2007 02:00 AM
Posts: 67
Joined: Thu Jan 05, 2006 10:35 PM
opos drivers for cash drawers, mage strip readers, printers
Posted: Sun Dec 30, 2007 12:34 AM

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.

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
opos drivers for cash drawers, mage strip readers, printers
Posted: Sun Dec 30, 2007 12:52 AM

Thank you for the information. Didn't knew of this driver.
Regards,
Otto

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
opos drivers for cash drawers, mage strip readers, printers
Posted: Sun Dec 30, 2007 12:03 PM

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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion