1. Control the customer display of the POS machine
Procedure tfrmmain. showmoney (money_port: string; money_string: string );
// Moneey_port Gu Xian interface COM1 or com2 money_string Gu Xian display content
VaR
Prnfilename: 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); // clear Gu Xian
Write (prnfilename, CHR (27) + CHR (81) + CHR (65) + money_string + CHR (13); // display information
Closefile (prnfilename );
End;
2. Printing without changing pages
Procedure tfrmmain. addprintstrings (strings: tstrings );
VaR
PRN: textfile;
I: word;
Begin
Assignfile (PRN, 'lpt1 ');
Printer. Canvas. Font. Name: = ' ';
Printer. Canvas. Font. Size: = 9;
Printer. Canvas. Font. charset: = gb2312_charset;
Try
Rewrite (PRN );
Try
For I: = 0 to strings. Count-1 do
Writeln (PRN, strings. Strings [I]);
Finally
Closefile (PRN );
End;
Except
On einouterror do
MessageBox (handle, pchar ('text printing error! '), 'Warning', mb_iconexclamation or mb_ OK );
End;
End;
3. take the form of paper for Printing
Procedure tfrmmain. printstrings (strings: tstrings );
VaR
PRN: textfile;
I: word;
Begin
Assignprn (PRN );
Try
Rewrite (PRN );
Printer. Canvas. Font. Name: = ' ';
Printer. Canvas. Font. Size: = 9;
Printer. Canvas. Font. charset: = gb2312_charset;
Try
For I: = 0 to strings. Count-1 do
Writeln (PRN, strings. Strings [I]);
Finally
Closefile (PRN );
End;
Except
On einouterror do
MessageBox (handle, pchar ('text printing error! '), 'Warning', mb_iconexclamation or mb_ OK );
End;
End;
4. Open the cash box
Procedure tfrmmain. openmoneybox;
VaR F: textfile;
Pdstr: string;
Begin
// The cash box function is displayed.
Pdstr: = CHR (27) + 'P' + CHR (0) + CHR (60) + CHR (255 );
Assignfile (F, 'lpt1 ');
Rewrite (f );
Write (F, pdstr );
Closefile (f );
End;