Quantcast

Re: POS CounterSales and remote printing esc/p sample

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: POS CounterSales and remote printing esc/p sample

gsavix
hi. please what is your environment? windows , dos, linux, mac ?
and is your printer usb, serial or tcp/ip.

if you use protocol esc/p on windows (use this batch dos comands (remember that need auth for connect or send to devices and / or share devices:

commands that you will use:  
------------------------------
command 1 - net use 
C:\d16down>net use /?
A sintaxe deste comando é:

NET USE
[nome_do_dispositivo | *] [\\nome_do_computador\nome_do_compartilhamento
[\volume] [senha | *]]
        [/USER:[nome_do_domínio\]nome_do_usuário]
        [/USER:[nome do domínio com pontos\]nome_do_usuário]
        [/USER:[nome_do_usuário@nome do domínio com pontos]
        [/SMARTCARD]
        [/SAVECRED]
        [[/DELETE] | [/PERSISTENT:{YES | NO}]]

NET USE {nome_do_dispositivo | *} [senha | *] /HOME

NET USE [/PERSISTENT:{YES | NO}]
------------------------------
command 2 - type your-file > lpt1

===================

steps to implement part A of B:

suppose your printer is connect on computer1 on port usb001

1 - first of all share resource usb001 from computer1 

on windows control panel, printer, share for users with assign share name like cupom


2- suppose thar you are in computer5 accessing weberp using firefox

you need capture resource share with name cupom. you will need this only 1 time for every session or use /persistent:yes (but there are many issues with windows versions, etc) i recommend this two commands:

net use lpt1 /delete
net use lpt1 \\computer1\cupom

first command release any previous assing of port lpt2 of computer5
second command assing port lpt1 (printer) of computer5 to computer1 shared name cupom

be sure that all commands execute with ok (return code 0).


ok now your computer5 knows and could send any text file to computer1 to port usb001 shared name cupom

try send your text file named spool-text-file.prn  (that have esc/p commands inside) be carefully with page code (dos uses dos457, but we use dos850, or dos860 with accents, unicode iso-8859-1, or utf-8 code pages) pay attentions what your printer was configured to.

========================

steps to implement part B of B:

create one weberp-lpt1.bat that contains this command:

@echo off
type %1 > lpt1


first command make off echo on console (cmd windows)
second command print %1 (argument 1 (file name [in our case spool-text-file.prn])
to our local lpt1 that is assign to \\computer1\cupom 
pay attention on \\computer-name case windows / dos uses backslash.

as standard firefox will ask what action you whant when handle spool-text-file.prn and you could point to open with your batch dos file weberp-lpt1.bat (if you check box memorize firefox not ask again (see mime types) i choose .prn could be any you want.

this fragment of php code show how to convert code page and header necessary to http server handle your text esc/p files

$RECIBOCONT is your variables with all contents and esc/p commands.

$RECIBOCONT = $RECIBOCONT . "\n" . "\n";
//
header('Content-type: application/prn');
$axdoscp850 = mb_convert_encoding($RECIBOCONT, "CP850", 
mb_detect_encoding($RECIBOCONT, "UTF-8, ISO-8859-1", true));
// converte para codepage cp850 tradicional codigo dos, impressoras etc 
header('Content-Length: ' . mb_strlen($axdoscp850));
header('Content-Disposition: inline; filename=spool-text-file.prn');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
// saida do mimetype;
echo $axdoscp850;

2016-08-24 23:11 GMT-03:00 Pak Ricard <[hidden email]>:
Hi all:

I'm trying to modify webERP POS CounterSales.php to be able to print receipts in a mini printer in a silent (or as silent as possible) way. 

After a search, I think qz-print https://qz.io/ looks like the best way to go

Has anyone succeed integrating qz-print in webERP?
Is there any other better option available?

Regards,
Ricard

------------------------------------------------------------------------------

_______________________________________________
Web-erp-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/web-erp-developers




--
gilberto dos santos alves
+55(11)9-8646-5049
sao paulo - sp - brasil





------------------------------------------------------------------------------

_______________________________________________
Web-erp-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/web-erp-developers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: POS CounterSales and remote printing esc/p sample

Pak Ricard
Many thanks Gilberto.
Will look in detail and test it and come back with news.

Regards,
Ricard

2016-08-25 11:45 GMT+08:00 gilberto dos santos alves <[hidden email]>:
hi. please what is your environment? windows , dos, linux, mac ?
and is your printer usb, serial or tcp/ip.

if you use protocol esc/p on windows (use this batch dos comands (remember that need auth for connect or send to devices and / or share devices:

commands that you will use:  
------------------------------
command 1 - net use 
C:\d16down>net use /?
A sintaxe deste comando é:

NET USE
[nome_do_dispositivo | *] [\\nome_do_computador\nome_do_compartilhamento
[\volume] [senha | *]]
        [/USER:[nome_do_domínio\]nome_do_usuário]
        [/USER:[nome do domínio com pontos\]nome_do_usuário]
        [/USER:[nome_do_usuário@nome do domínio com pontos]
        [/SMARTCARD]
        [/SAVECRED]
        [[/DELETE] | [/PERSISTENT:{YES | NO}]]

NET USE {nome_do_dispositivo | *} [senha | *] /HOME

NET USE [/PERSISTENT:{YES | NO}]
------------------------------
command 2 - type your-file > lpt1

===================

steps to implement part A of B:

suppose your printer is connect on computer1 on port usb001

1 - first of all share resource usb001 from computer1 

on windows control panel, printer, share for users with assign share name like cupom


2- suppose thar you are in computer5 accessing weberp using firefox

you need capture resource share with name cupom. you will need this only 1 time for every session or use /persistent:yes (but there are many issues with windows versions, etc) i recommend this two commands:

net use lpt1 /delete
net use lpt1 \\computer1\cupom

first command release any previous assing of port lpt2 of computer5
second command assing port lpt1 (printer) of computer5 to computer1 shared name cupom

be sure that all commands execute with ok (return code 0).


ok now your computer5 knows and could send any text file to computer1 to port usb001 shared name cupom

try send your text file named spool-text-file.prn  (that have esc/p commands inside) be carefully with page code (dos uses dos457, but we use dos850, or dos860 with accents, unicode iso-8859-1, or utf-8 code pages) pay attentions what your printer was configured to.

========================

steps to implement part B of B:

create one weberp-lpt1.bat that contains this command:

@echo off
type %1 > lpt1


first command make off echo on console (cmd windows)
second command print %1 (argument 1 (file name [in our case spool-text-file.prn])
to our local lpt1 that is assign to \\computer1\cupom 
pay attention on \\computer-name case windows / dos uses backslash.

as standard firefox will ask what action you whant when handle spool-text-file.prn and you could point to open with your batch dos file weberp-lpt1.bat (if you check box memorize firefox not ask again (see mime types) i choose .prn could be any you want.

this fragment of php code show how to convert code page and header necessary to http server handle your text esc/p files

$RECIBOCONT is your variables with all contents and esc/p commands.

$RECIBOCONT = $RECIBOCONT . "\n" . "\n";
//
header('Content-type: application/prn');
$axdoscp850 = mb_convert_encoding($RECIBOCONT, "CP850", 
mb_detect_encoding($RECIBOCONT, "UTF-8, ISO-8859-1", true));
// converte para codepage cp850 tradicional codigo dos, impressoras etc 
header('Content-Length: ' . mb_strlen($axdoscp850));
header('Content-Disposition: inline; filename=spool-text-file.prn');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
// saida do mimetype;
echo $axdoscp850;

2016-08-24 23:11 GMT-03:00 Pak Ricard <[hidden email]>:
Hi all:

I'm trying to modify webERP POS CounterSales.php to be able to print receipts in a mini printer in a silent (or as silent as possible) way. 

After a search, I think qz-print https://qz.io/ looks like the best way to go

Has anyone succeed integrating qz-print in webERP?
Is there any other better option available?

Regards,
Ricard

------------------------------------------------------------------------------

_______________________________________________
Web-erp-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/web-erp-developers




--
gilberto dos santos alves
+55(11)9-8646-5049
sao paulo - sp - brasil





------------------------------------------------------------------------------

_______________________________________________
Web-erp-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/web-erp-developers



------------------------------------------------------------------------------

_______________________________________________
Web-erp-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/web-erp-developers
Loading...