Black label documents in Delphi (original)

xiaoxiao2021-03-06  16

For small bills, it is difficult to print up. It will be very serious when printed, so that we can use black standard to solve this problem. When the printer prints a bill, check the black standard, so that the printer will Stop behind the detected black label, you will not run when you print.

Black label printing requires:

1. The printer should support the black labeled invoice. You can find it in the print manual.

2, the torque is to be determined by the printer, and the different printer line will be the same as the font is generally printed.

Here is an example:

Unit printhbunit;

Interface Uses Sysutils, IniFiles, Windows, Forms, Dialogs, Classes

/ / Define the type of recorded record

type TPrintObj = record Hbsbh: string; Dffsny: string; Khmc: string; Khdz: string; Dbcbh1: string; Jsbl1: string; Scbm1: string; Bcbm1: string; Dbcbh2: string; Jsbl2: string; Scbm2: string; Bcbm2: string; Dbcbh3: string; Jsbl3: string; Scbm3: string; Bcbm3: string; YDFLBH1: string; YDFLBH2: string; YDFLBH3: string; Fldl1: string; Fldl2: string; Fldl3: string; Fldj1: string; Fldj2: string; FLDJ3: STRING; SHDL1: STRING; SHDL2: STRING; SHDL3: STRING; FLDF1: STRING; FLDF2: STRING; FLDF3: STRING; DDDF1: String; DDDF2: String; DDDF3: String; hjdl: string; hjdf: string; scjy: STRING; STRING; STRING; STRING; STRING; STRING; String; Blackmark: String; string; blackmark: string; tbdf: string; DDDF: String; // Power Test FLDF: String;

Var Printobj: TPrintobj; MyFile: Tinifile; i: integer; / / For 1 Times Table has taken electricity price, otherwise the price mldjlist: tstrings; ydflbhlist: tstrings;

Procedure setprintobj; procedure pdrPrintobj (zs_bz: string = '0'); procedure getBlackmark; Function JetodX (v_je: real): string; // Report For the amount capital switching function

IMPLEMentation

Uses db;

Function JetodX: String; // The amount of uppercase transformation functions VAR L, I: Integer; JE_ZS, JE_XS, DX, DW, S, S1, DX_JE: STRING; BFS: boolean; begin if v_je = 0 THEN BEGIN RESULT: = 'zero element'; exit; end; if v_je <0 THEN BEGIN BFS: = true; v_je: = (- 1) * v_je; end else bfs: = FALSE

JE_ZS: = ''; JE_XS: = '; if Round (v_je) * 100 = v_je * 100 Then JE_ZS: = floattostr (v_je) else begin s: = floattostr (v_je * 100); je_zs: = Copy (s, 1, Length (s) -2); JE_XS: = COPY (S, Length (JE_ZS) 1, 2); if JE_ZS = '' Then JE_ZS: = '00'; if JE_XS = '' Then JE_XS: = ' 00 '; END; DX: =' Zero 壹 叁 肆 柒捌 柒捌 '; dw: =' Yuan fax 佰 万 万 佰 万 '; dx_je: =' '; if je_zs <>' 'Then Begin L: = Length (JE_ZS); S1: = '; for i: = 1 to l do begin s: = Copy (DX, STRTOINT (COPY (JE_ZS, I, 1)) * 2 1, 2); if S <> zero 'Then Begin DX_JE: = DX_JE S; DX_JE: = DX_JE COPY (DW, (Li) * 2 1, 2); ELSE IF S1 <>' zero 'Then DX_JE: = DX_JE ' Zero '; if i = (l-4) THEN BEGIN S: = COPY (DX_JE, LENGTH (DX_JE) -1, 2); if s =' zero 'TEN DX_JE: = COPY (DX_JE, 1, Length (DX_JE) -2); if s <> "万 'Then DX_JE: = DX_JE ' Wan '; END; S1: = S; End; s: = COPY (DX_JE, Length (DX_JE) -1, 2); if s =' Zero 'TEN DX_JE: = COPY (DX_JE, 1, Length (DX_JE) -2); if S <>' Yuan 'Then DX_JE: = DX_JE 'yuan'; END; if je_xs = '' Then DX_JE: = DX_JE 'Ontario' else Begin if Copy (JE_XS, 1, 1) <> '0' Then Begin if Copy (JE_XS, 2, 1) <> '0' Ten Begin if Length (JE_XS) = 1 THEN JE_XS: = '0' JE_XS; DX_JE: = DX_JE COPY (DX, STRTOINT (COPY (JE_XS, 1, 1)) * 2 1, 2) 'angle';

DX_JE: = DX_JE COPY (DX, STRTOINT (COPY (JE_XS, 2, 1)) * 2 1, 2) 'Divide'; ELSE DX_JE: = DX_JE COPY (DX, STRTOINT (COPY (JE_XS, 1 1)) * 2 1, 2) 'angular whole'; end else begin dx_je: = DX_JE 'zero' Copy (DX, STRTOINT (COPY (JE_XS, 2, 1)) * 2 1, 2) 'Points'; end; end; if copy (dx_je, 1, 2) = 'yuan' Then DX_JE: = 'zero' DX_JE; if bfs the dx_je: = 'Negative' DX_JE; Result: = DX_JE; END Procedure getBlackmark; Var Blackmark: string; begin

// Read the ticket type in the INI file Myfile: = tinifile.create (extractFilePath (Application.exename) 'YDGL.INI'); try blackmark: = myfile.readstring ('print', 'printType', '' ); If Length (Blackmark) <> 0 Then Printobj.Blackmark: = Blackmark Else Begin Application.MessageBox ('Automatically configures YDGL.INI file, the default printer type is: BS-310K, please check!', 'Prompt', MB_OK); MyFile.WritString ('Print', 'PrintType', 'BS-310K'); End; Finally MyFile.Free; end; end;

Procedure setPrintobj; Begin With Printobj Do Begin Hbsbh: = '; Dffsny: =' 200401 '; KHMC: =' Test User '; KHDZ: =' Nanchang '; DBCBH1: =' A0001 '; JSBL1: =' 1 '; SCBM1: =' 100 '; BCBM1: =' 150 '; DBCBH2: =' A0002 '; JSBL2: =' 1 '; SCBM2: =' 10 '; BCBM2: =' 110 '; DBCBH3: =' '; JSBL3: = ''; SCBM3: = '; fldl1: =' 150 '; FLDL2: =' '; FLDL3: =' '; FLDJ1: =' 0.50 '; FLDJ2: =' '; FLDJ3: = '; SHDL1: ='; SHDL2: = '; SHDL3: ='; FLDF1: = '75.00 '; FLDF2: ='; FLDF3: = ''; DDDF1: = '75 .00 '; DDDF2: = ''; DDDF3: = ''; hjdl: = '150'; hjdf: = '75 .00 '; scjy: =' 0 '; bcss: =' 100.00 '; bcxz: = '75 .00'; bcjy: = '25.00 '; ssdx: =' 元 整 '; CBY: =' Xiao Wang '; Sky: =' Xiao Li '; fPHM: =' 001 '; RQ: ​​=' 2004-01-30 '; sswyj: = '0'; DYQDF: = '; DDDF: =' '; FLDF: =' '; end; end;

procedure pdrPrintObj (zs_bz: String = '0'); var lpt: TextFile; str, Other: String; begin AssignFile (lpt, 'LPT1'); try ReWrite (lpt); with PrintObj do begin BlackMark: = 'SP512MC'; If Uppercase (Blackmark) = Uppercase ('sp512mc') Then Begin Writeln (LPT, ''); Writeln (LPT, Format ('% s', [SSWYJ])); Writeln (LPT, Format ('% s% s ', [Hbsbh, dffsny]); Writeln (LPT, Format ('% s', [khmc])); Writeln (LPT, Format ('% s', [kHDZ])); Writeln (LPT, Format '% -11s% -11s% -11s', [DBCBH1, DBCBH2, DBCBH3])); Writeln (LPT, Format ('% -11S% -11S%-11S', [JSBL1, JSBL2, JSBL3])); Writeln (LPT, Format ('% -11S% -11S%-11S', [SCBM1, SCBM2, SCBM3])); Writeln (LPT, Format ('% -11S% -11S%-11S', [BCBM1, BCBM2 , BCBM3])); Writeln (LPT, ''); Writeln (LPT, Format ('% - 11S% -11S% -11S% s', [FLDL1, SHDL1, FLDJ1, FLDF1]); Writeln (LPT, Format ('% - 11S% -11S% -11S% s', [FLDL2, SHDL2, FLDJ2, FLDF2])); Writeln (LPT, Format ('% - 11S% -11S% -11S% s', [FLDL3, SHDL3, FLDJ3, FLDF3])); Writeln (LPT, Format ('% -20S% s' , [Hjdl, hjdf]))); // ZS_BZ: Take Peugeot "1" for the "0" non-Zs_bz = '0' Then Begin Writeln (LPT, Format ('% -20S% s' [Scjy, bcss]); Writeln (LPT, Format ('%-20s% s', [bcxz, bcjy]); Writeln (LPT, Format ('% s', [SSDX])); ELSE Begin Writeln (LPT, Format ('% -20S% s', [''

, Hjdf])); Writeln (LPT, Format ('% -20S% s', [hjdf, ''])); Writeln (LPT, Format ('% s', [JetodX (strtofloatdef (hjdf, 0)) ]); End; Writeln (LPT, Format ('% -15S% -15S% s', [CBY, SKY, RQ]); Writeln (LPT,' '); Writeln (LPT, Format ('% S ', [Fphm])); Writeln (LPT, Format ('%-24S% s ', [hbsbh, dffsny]); if Zs_bz =' 0 'Then Begin Writeln (LPT, Format ('%-24s% s ', [Bcss, bcjy]); ELSE BEGIN WRITELN (LPT, Format ('%-24S% S ', [HJDF JetoDX (STRTOFLOATDEF (HJDF, 0)),' ']); END; WRITELN LPT, Format ('% -23S% s', [SKY, RQ])); // Send Black Boot Command Write (LPT, # 12); end end; finally closefile (lpt); end; end; end.

转载请注明原文地址:https://www.9cbs.com/read-42444.html

New Post(0)