` Printed Icetips Article

Icetips Article



Par2: POS: two ways to open cash drawer
1999-05-07 -- Geoff Bomford
 
MEMBER('pd5.clw')                                  ! This is a MEMBER
module

                     MAP
                       INCLUDE('PD5008.INC')        !Local module prodecure
declarations
                     END


CashDrawerOpen       PROCEDURE                        ! Declare Procedure
RetCode  BYTE
Local:CString  CSTRING(20)
RecBufSize  EQUATE(256)
PrinterPort  STRING(4)
OutFile   FILE,DRIVER('DOS'),CREATE,NAME(GLOB:PathString)
Record      RECORD
Line          CSTRING(RecBufSize)
            END
          END
  CODE
  IF Def:CashDrawerCode
    Local:CString = Def:CashDrawerCode
    ComPutS(COM2,Local:CString)
  ELSE
    PrinterPort = PRINTER{PropPrint:Port}   !'LPTx'
    Glob:PathString = 'CDOpen.Txt'
    CREATE(OutFile)
    IF ERRORCODE()
      STOP(ERROR())
    END
    OPEN(OutFile,11h)
    IF ERRORCODE()
      STOP(ERROR())
    END
    OutFile.Line = '<7>'
    APPEND(OutFile,LEN(OutFile.Line))
    CLOSE(OutFile)
    COPY(OutFile,PrinterPort)
  END

There are two ways to open a cash drawer - either via the serial port -
Def:CashDrawerCode = 'E' (For example) - or Via the Printer port, if the
cash drawer is wired to the printer (Def:CashDrawerCode = '')



Printed November 21, 2024, 1:07 pm
This article has been viewed/printed 35208 times.