Delphi print invoice

Source: Internet
Author: User

 

Procedure tform1.button1click (Sender: tobject );
VaR
F: textfile;
Begin
Assignfile (F, 'lpt1 ');

Rewrite (f );
Write (F, CHR (27) + '@'); // CHR (27) + '@' That is, ESC @ command

Writeln (F, 'test1 first line ');
Writeln (F, CHR (12); // move the paper to a new page

Flush (f );
Closefile (f );

End;

 

 

 

 

 

 

 

Procedure tform1.button2click (Sender: tobject );
VaR
F: textfile;
Begin
Try
Assignfile (F, 'lpt1 ');
Rewrite (f );

// Print the title
Writeln (F, CHR ($ 1b) + CHR ($40); // [initialize the printer
Writeln (F, CHR ($ 1b) + CHR ($72) + '1'); // set red print
Writeln (F, CHR ($ 1b) + CHR ($61) + '1'); // center print
Writeln (F, CHR ($ 1c) + CHR ($21) + '4'); // print the width

Writeln (F, 'click print ');

writeln (F, CHR ($ 1b) + CHR ($61) + '0'); // cancel center printing
// writeln (F, 'order No.: '+ fgroupid); // display the bill No. And Room No.
// writeln (F, 'room No.:' + rmname );
writeln (F, 'order No.: '+ '000000'); // display the bill No. And Room No.
writeln (F,' Room No: '+ 'error');
writeln (F, CHR ($ 1c) + CHR ($21) + '0');
writeln (F, 'print time: '+ datetimetostr (now);
writeln (F,' ------------------------------------------ ');
writeln (F, 'item name quantity unit price total ');
writeln (F,' ---------------------------------------- ');

// Print the ending mark
Writeln (F ,'----------------------------------------');
// Writeln (F, 'total: '+ currtostr (ftotalsum) + 'meta ');
Writeln (F, 'total: '+ '25 yuan ');
// Print and cut the paper
Writeln (F, CHR ($ 1D) + 'V' + CHR (66) + CHR (0); // Paper Cutting
Finally
Closefile (f );
End;

End;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.