Write a hospital's complex statement with Delphi

zhaozj2021-02-11  226

Write a hospital's complex statement with Delphi

Yuan Bo, a computer room in Wuxi Hospital, Jiangsu Province, China, the information management system in our hospital adopts Delphi programming. Due to different requirements of each subject, the form of reports is varied, and it is written to make a headache. Delphi is running under the Windows platform, printing with DOS is completely different, and Quick Report is difficult to control and occupy the resources. For a slightly complex, there are special requirements, Quick Report cannot be implemented. Here is a method of implementing a relatively typical report encountered in programming.

---- 1, which unit's financial selection has several thick accounts, the financial selection of our hospital proposes the account of the printed drug store, and take off the hand-to-hand account, and it is also an office modernization. Requires reasonable, Dean Also said that it should be. Looking at the red greenery provided by the Finance Department, uniformly printed, the line-related 3 mm account special card, I can't help but think of the virtues of Chinese people. Considering that each drug prints at least one, and the table line is not less, add more than 2,000 drugs, so this report must be printed with a laser printer (as for the dean agreed to buy a laser printer, Is another thing, how can office automation? The idea of ​​the program implementation is basically a small rectangle that is drawn as a canvas as a canvas, which is implemented by the following processes: (set the Form name TTZView).

First define two classes in the program: TitleRecord = RecordCurRect: TRECT; atTle: String; end; detailrecord = Recordarect: TRECT; Alignment: Word;

---- Built the following four processes; ---- RectDraw (Acanvas: Tcanvas; S: String; r: TRECT; FRAME: BOOLEAN; Position: Word);

---- This process is the use of the moment, and the frame decides whether to draw line (here is of course to draw!);

---- PrintInitit (Firsttop, Firstleft: Integer);

---- This process is initialized, which is to define the position of each small rectangle on paper;

---- PrintTitle (Acanvas: Tcanvas);

---- This process is the printhead, because the word of the head is always large;

---- PrintDetail (Acanvas: Tcanvas; Qtz: TDataSet; ACOUNT: Integer; Firstpage: Integer);

---- This process is the print specific content, one page prints 40 lines, not enough to change the page, the page can only be a drug;

---- Printhj (Acanvas: Tcanvas);

---- When you look at it, this process is a printing!

---- As long as you build a Botton, you call PrintInitit, PrintTitle, PrintDetail, Printhj,

---- (Call format: printer.canvas;)

---- Right, QTZ is querying the account data, how to generate it here.

---- The specific procedure is as follows

---- This program runs through the Delphi1, Delphi3 version Win3.2, Win95, Win97, Win98 platform, by the way, by the way, the library structure of the account database

---- 2, very complicated, unable to take statements

---- The Oncology Department of our hospital needs to print the patient's disease, which can be part of the modernization of specialty specialties, the Health Bureau to check, so you must complete the task. There are more than 100 items in every disease. If you use QREPORT, if you want to add a project (this is often there), dozens of project adjustment will make people faint. I found more than 100 temporary variables at once, painting on the virtual canvas painted, running on my PII233, 64M memory, but it is shunted on the machine, but when the 486, 8M memory of the Oncology is changed. (Don't laugh, the system stack is immediately overflowing, so I have to sacrifice Dafa (my programming level seems to have grown into the way: first establish the TitlePrint class: titleprint = ^ TitleRecord; TitleRecord = RecordcurRect: TRECT Atitle: String [50]; END; Re-establishment Process PrintNow (the name of Form is ZLK, PrintDot is the number of printers, general needle is 180); Procedure Tzlk.printNow (acanvas: tcanvas); Var i, x, y , PC_Count: Integer; MyPrint: Array [0..200] of titlePrint; beginfirsttop: = ROUND (int (0.5 / 2.54 * printdot); firstleft: = round (int (0.1 / 2.54 * printdot); RowHeight: = Round (int (0.7 / 2.54 * printdot); x: = 0 firstleft; y: = round (int (1.3 / 2.54 * printDot) firsttop; pc_count: = 0; Inc (pc_count); new (MyPrint [ Pc_count]); myprint [pc_count] ^. CurRect: = Re (x round (int (0.1 / 2.54 * printDot) First (3.0 / 2.54 * printdot) Firstlex, Y FirstTop Round (int (0.5 / 2.54 * printDot)); myprint [pc_count] ^. atitle: = lname.caption dbname.text; acanvas.moveto (MyPrint [pc_count] ^. curRect.Left, MyPrint [pc_count ] ^. curRect.top-Round (RowHeight / 5)); {below the four lines below more than 100 times, basically almost, do not write to earn a draft fee} incnative; new (MyPrint [pc_count] MYPRI NT [pc_count] ^. CurRect: = Scalence (MyPrint [pc_count-1] ^. Currect, Round (int (2.5 / 2.54 * printDot)), 0); myprint [pc_count] ^. atitle: = lxb.caption CXB .text; acanvas.lineto (MyPrint [i] ^. curRect.right, myprint [i] ^. Currect.top-round (RowHeight / 5)); .......

{Print} PRINTTILE (ACANVAS); {This function is not available, the head should not do 没} for i: = 1 to pc_count dobeginRecTdraw (Acanvas, MyPrint [i] ^. CURRECT, MYPRINT [I] ^. CURRECT, FALSE , DT_LEFT or DT_SINGLINE OR DT_VCENTER; END; Dispose (MyPrint [PC_COUNT]); {Don't forget to release the memory release of the pointer} END; ---- Finally build a botton, add a trick, then the judgment, and then Call these functions. ---- (Call format: printer.canvas;)

---- I have seen two examples. Is it very simple to find the print under Windows, just like your hand drawing, and the location of the table content is in the middle, the left, or the right, all by print content Alignment Decided, the print format is determined by the Display Format, and it is not necessary to calculate it.

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

New Post(0)