控制錢箱,客顯,列印

2022-06-08 23:54:18 字數 2054 閱讀 2723

1、控制pos機的客戶顯示屏

procedure tfrmmain.showmoney(money_port:   string;money_string:string);

//moneey_port     顧顯介面com1   or   com2     money_string     顧顯顯示的內容

varprnfilename:textfile;

begin

assignfile(prnfilename,money_port);

printer.canvas.font.name:='宋體';

printer.canvas.font.size:=8;

printer.canvas.font.charset:=gb2312_charset;

rewrite(prnfilename);

write(prnfilename,chr(12));         //清除顧顯

write(prnfilename,chr(27)+chr(81)+chr(65)+money_string+chr(13));       //顯示資訊

closefile(prnfilename);

end;

2、不換頁走紙的列印

procedure tfrmmain.addprintstrings(strings: tstrings);

varprn: textfile;

i: word;

begin

assignfile(prn,'lpt1');

printer.canvas.font.name:='宋體';

printer.canvas.font.size:=9;

printer.canvas.font.charset:=gb2312_charset;

tryrewrite(prn);

tryfor i := 0 to strings.count - 1 do

writeln(prn, strings.strings[i]);

finally

closefile(prn);

end;

except

on einouterror do

messagebox(handle,pchar('文字列印出錯!'),'警告',mb_iconexclamation or mb_ok);

end;

end;

3、走紙換頁的列印

procedure tfrmmain.printstrings(strings: tstrings);

varprn: textfile;

i: word;

begin

assignprn(prn);

tryrewrite(prn);

printer.canvas.font.name:='宋體';

printer.canvas.font.size:=9;

printer.canvas.font.charset:=gb2312_charset;

tryfor i := 0 to strings.count - 1 do

writeln(prn, strings.strings[i]);

finally

closefile(prn);

end;

except

on einouterror do

messagebox(handle,pchar('文字列印出錯!'),'警告',mb_iconexclamation or mb_ok);

end;

end;

4、開啟錢箱

procedure tfrmmain.openmoneybox;

var f:textfile;

pdstr:string;

begin

//彈出錢箱功能

pdstr:= chr(27)+'p'+chr(0)+chr(60)+chr(255);

assignfile(f, 'lpt1');

rewrite(f);

write(f, pdstr);

closefile(f);

end;

控制錢箱,客顯,列印

1 控制pos機的客戶顯示屏 procedure tfrmmain.showmoney money port string money string string moneey port 顧顯介面com1 or com2 money string 顧顯顯示的內容 varprnfilename tex...