Apertura cajn portamonedas

Hola.

Alguien sabe cmo abrir un cajn portamonedas. ? Est conectado a una impresora Bixolon mod. SRP-350II. Conectada por usb.

Imagino que hay que enviarle un cdigo de escapa de 3 o 4 dgitos. Pero no se como hacer para enviar a la impresara esos cdigos.

Saludos

Me contesto y pregunto de nuevo:

Buscando he creado este mtodo:

[code]Dim g As Graphics
Dim s As string

s =chr(27)+chr(112)+chr(0)+chr(64) // Cdigos de escape de apertura de cajn.

g = OpenPrinterDialog

If g <> Nil Then
g.TextFont = “Helvetica”
g.TextSize = 9

g.DrawString(s, 10,10)

End If[/code]

En vez de OpenPrinterDialog Como puedo hacer para que tome la predeterminada sin preguntar o una que yo designe ??

Saludos.

No puedes escribir al puerto serie que crea USB los caracteres ASCII de la secuencia de escape directamente?

No se como hacerlo en xojo.

Esta informacin debera ser suficiente (siempre que el sistema de impresin no tenga bloqueado (uso exclusivo) el puerto virtual serie). Abrir, escribir, cerrar.

http://developer.xojo.com/userguide/serial-devices

http://documentation.xojo.com/index.php/Serial

yo uso
https://www.monkeybreadsoftware.de/xojo/plugin-win.shtml

por ahora voy a seguir con el mtodo del informe porque lo del puerto es otra historia con los usb… y si el programa corre en linux o mac… ya entraramos en problemas.

Lo que no localizo es como hacer para que imprima en la impresora predeterminada y que no salga el dialogo de impresoras.

por eso uso las lib

Para imprimir sin que salga el dialogo de impresoras uso Valentina ADK Reportes.
mi POS trabaja sin problemas

Alexis y como lo haces. ¿ puedes poner un ejemplo ? Yo uso también Valentina ADK R.

Saludos

In windows write directly to port for use Escape command;
Connect your printer with driver and share this
When have the device ( sharing name ) use \\pcname\printername
Just copy a text file with data on \\pcname\printername

On MacOS/Linux find the device name on cups and just copy text file on device /dev/devicename
Other system for find the device name, use lsusb commad at prompt.

with this system ( i use this for toshiba label printer ) u can use only escape codes text, and not graphics printing.
Max.

NB: this system do not need libraries

Dim RepStrConn As String
Dim mReport AS New VReport
Dim SqlStr01 As String
Dim vCounts As Integer

SqlStr01=""

RepStrConn=“postgresql://host=’” + vServerIP + “’ port=‘5432’ dbname=’” + vServerDbName + "’ user=‘pg’ password=“123”

SqlStr01=" Select itemnum,description,qtyonhand From inventory Where departamento=’" + QtyRepDep + "’ and inactive=0 "

mprojectPath = GetFolderItem( “OrdenCompras.vsp” )

mProject = new VProject(mprojectPath)

try
mProject.Open()
catch e as VException
dim errNumber as Integer = e.ErrorNumber
dim errString as String = e.Message
MsgBox errString
end

if mProject <> nil then
vCounts = mProject.ReportCount()
end if

try
mReport = mProject.MakeNewReport(“Close_Store_Qty”, RepStrConn, SqlStr01 )
mReport.SetParameterValue(“param1”,Str(ActiveCajaReg))
catch e as VException
dim errNumber as Integer = e.ErrorNumber
dim errString as String = e.Message
MsgBox errString
end

Try
mReport.PrintToLocalPrinter(CashDrawar(1), “paper=PosPrinter” )
catch e as VException
dim errNumber as Integer = e.ErrorNumber
dim errString as String = e.Message
MsgBox " Report Print PDF " + errString
end

mReport=nil
mProject.Close
mProject=nil

Ok but graphics (pdf rendered) not send escape code at printer.

no
to open Cash Drawer i use this code
if CashDrawar(1)=“No” Then
Dim g As Graphics
g = OpenPrinter()
g.DrawString " ", 100, 100
exit Sub
end if

// Print Postscript directly to Postscript printer
//const PrinterName = “Star BSC10”

sPrinterName=CashDrawar(1)

dim w as new WindowsAddPrintJobMBS
Dim tmpSetupString as MemoryBlock

if not w.OpenPrinter(sPrinterName) then
MsgBox “OpenPrinter failed. Is the printer name correct in the source code?”
Return
end if

const DocName = “My Document”

if not w.StartDocPrinter(“My Document”, w.kDataFormatRAW) then
MsgBox “StartDocPrinter failed.”
Return
end if

//MsgBox "Print Job ID: "+str(w.JobID)

call w.StartPagePrinter

dim PostScript as string
//PostScript=Chr(27) + “p” +Chr(0) + Chr(250) + Chr(250)

If (CashDraweCode.Trim="") Then
PostScript=Chr(27) + Chr(112) + Chr(48) + Chr(64) + Chr(64)
Else
PostScript=CashDraweCode
End If

dim BytesSent as integer = w.WritePrinter(PostScript)

//MsgBox str(BytesSent)+" bytes of “+str(lenb(PostScript))+” bytes sent."

call w.EndPagePrinter
call w.EndDocPrinter

w = nil // close printer

Muchisimas gracias Alexis.

Me ha sido de gran ayuda.