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
|
Image_Bouton(Main.IAeverButton8, 'MainB8_In');
Date_Impression := FormatDateTime('yyyy"" mm"" dd"" hh"" mm"" ss', Now); // On définit l'heure de l'impression.
If Consulte then // Volet de consultations.
begin
If MDIChildCount = 0 then
begin
StatusBar1.SimpleText := ' Aucun titre n''a été sélectionné.';
Exit;
end;
If Printer.Printers.Count > 0 then Printer.PrinterIndex := -1;
If PrintDialog1.Execute then If Printer.Aborted = True
then Exit
else
begin
Printer.Orientation := poLandscape;
Type_Enfant := MDIChildren[0].Tag;
case Type_Enfant of // Ici c'est simplement pour s'y retrouver dans les identifications (une seule ligne aurait fait l'affaire).
0: Oui_Ascenseur := TEnfant_Net(MDIChildren[0]).Ascenceur; // icone d'identification "PN"
1: Oui_Ascenseur := TEnfant_Fisc(MDIChildren[0]).Ascenceur; // icone d'identification "PF"
3,4: Oui_Ascenseur := TEnfant_Frais(MDIChildren[0]).Ascenceur; // icone d'identification "St"
5: Oui_Ascenseur := TEnfant_Cessions(MDIChildren[0]).Ascenceur; // icone d'identification "Cs"
6: Oui_Ascenseur := TEnfant_Histo(MDIChildren[0]).Ascenceur; // icone d'identification "Ht"
7: Oui_Ascenseur := TEnfant_Abattement(MDIChildren[0]).Ascenceur; // icone d'identification "Ab"
8: Oui_Ascenseur := TEnfant_Abat_Annee(MDIChildren[0]).Ascenceur; // icone d'identification "+/-"
9: Oui_Ascenseur := TEnfant_Titre_Dispo(MDIChildren[0]).Ascenceur; // icone d'identification "Td"
end;
Titre := MDIChildren[0].Caption;
// Vérifie la fin du titre...
// Si il se termine par "P.E.A." ou "...", on conserve le titre tel quel,
If (AnsiPos('P.E.A', Titre) <> 0) or (AnsiPos('...', Titre) <> 0)
then Titre_Imprimante := Titre // On attribut le titre du document pour l'imprimante.
// sinon suppression du point à la fin du titre.
else Titre_Imprimante := Copy(Titre, 1, Length(Titre) -1); // On corrige le titre du document pour l'imprimante.
case Type_Enfant of // On complète le titre du document pour l'imprimante avec la date et l'heure d'impression.
0: Titre_Imprimante := Titre_Imprimante + ' - PR Net - ' + Date_Impression;
1: Titre_Imprimante := Titre_Imprimante + ' - PR Fiscal - ' + Date_Impression;
3,4,5: Titre_Imprimante := Titre_Imprimante + ' - ' + Date_Impression;
6: Titre_Imprimante := Titre_Imprimante + ' - ' + Date_Impression;
7,8,9: Titre_Imprimante := Titre_Imprimante + ' - ' + Date_Impression;
end;
Printer.Title := Titre_Imprimante; // On définit le titre du document à imprimer ou à sauvegarder au format .pdf par exemple.
// et oui ... valable pour n'importe quel type de fiche ...
ImprimeGrille(TEnfant_Net(MDIChildren[0]).Grille, Titre, Type_Enfant, Oui_Ascenseur);
end;
Application.ProcessMessages;
If not Desactivationdescommandes1.Checked // Mise à jour du journal de bord.
then EcrireFichierLog('-> demande d''impression d''un document.', 2);
end;
If not Consulte then // Volet de saisies.
begin
If LigneStringGrid = 1 then
begin
StatusBar1.SimpleText := ' Aucune opération n''a été effectuée.';
Exit;
end;
If PrintDialog1.Execute then If Printer.Aborted = True
then Exit
else
begin
for i := 0 to StringGrid1.ColCount -1 do // réaligne les colonnes.
StringGrid1.ColWidths[i] := Largeur_Colonne[Numero_Colonne[i]];
StringGrid1MouseUp(Sender, (mbLeft),[],0, 0); // formate les contenus.
Printer.Orientation := poLandscape;
Titre := 'Liste des opérations saisies le '
+ FormatDateTime('dddd d mmmm yyyy"."', Now);
Printer.Title := Copy(Titre, 1, Length(Titre) -1) + ' - ' + Date_Impression;
ImprimeGrille(StringGrid1, Titre, 2, UpDownStrGrid, LigneStringGrid);
end;
Application.ProcessMessages; |
Partager