1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
procedure TSynthese.prn_btnClick(Sender: TObject);
var espace,
Debx, Deby,
moitie,
marge : integer ;
begin
Printer.Orientation:=poPortrait;
if PrintDialog1.Execute then
with Printer do
begin
espace := 2*canvas.TextHeight('O'); { Interligne (10 par
défaut).}
marge := PageWidth div 20 ; { Marge. }
deby := PageHeight div 20 ; { Début d'écriture par
rapport au haut de la page.}
moitie := round(PageWidth/2);
BeginDoc;
with Courbes.indiv.data do
begin
// Entête
Canvas.Font.Size := 20;
Canvas.Font.Style := [fsBold,fsUnderline];
Canvas.TextOut(round(moitie-canvas.textWidth('FICHE DE
SYNTHESE')/2),
deby, 'FICHE DE SYNTHESE') ;
debX := marge;
deby := deby + 3*espace;
// Ecriture du texte
Canvas.Font.Size := 14;
Canvas.Font.Style := [];
// Confidentialité du nom du patient
if (ModeAnonyme) and (MessageDlg('Voulez vous rendre
anonyme les nom et prénom du patient ?',
mtInformation, [mbYes, mbNo], 0) = mrYes)
then
begin
Canvas.TextOut(DebX, DebY, 'Nom : ' + 'Anonyme');
end
else
begin
Courbes.indiv.Get_info_patient(patient);
Canvas.TextOut(DebX, DebY, 'Nom : '+patient.nom);
Canvas.TextOut(moitie, DebY, 'Prénom :
'+patient.prenom);
end;
deby := deby + espace;
Canvas.TextOut(DebX, DebY, 'Sexe : '+patient.sexe);
Canvas.TextOut(moitie, DebY, 'Age :
'+IntToStr(patient.age)+' ans');
deby := deby + espace;
Canvas.TextOut(DebX, DebY, 'Activité :
'+patient.profession);
deby := deby + espace;
Canvas.TextOut(DebX, DebY, 'Entreprise :
'+patient.entreprise);
deby := deby + espace;
Canvas.TextOut(DebX+canvas.textWidth('Entreprise :
'),DebY,patient.adresse_1);
deby := deby + espace;
(...)
Canvas.TextOut(DebX+marge, DebY, TB_Concl[8]);
deby := deby + 3*espace;
Canvas.Font.Style := [fsUnderline, fsItalic];
Canvas.TextOut(DebX, DebY, 'Nom du médecin');
Canvas.TextOut(moitie+2*marge, DebY, 'Signature');
Canvas.Font.Style := [];
Canvas.TextOut(DebX+canvas.textWidth('Nom du médecin
'),DebY,Courbes.indiv.Get_nom_medecin);
EndDoc;
end; { with Courbes.indiv.data }
end; { with printer }
end; |
Partager