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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
| unit ScfWrn;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, DateUtils, StrUtils;
type
TWarSCF = class(TForm)
ReportWRN: TButton;
ValidWRN: TButton;
ViewWRN: TRichEdit;
procedure ValidWRNClick(Sender: TObject);
procedure ReportWRNClick(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
procedure ShowWrn(DirSet: ShortString; NivWrn: Byte); stdcall;
var
WarSCF: TWarSCF;
ViewWRN: TRichEdit;
implementation
{$R *.dfm}
procedure ShowWrn(DirSet: ShortString; NivWrn: Byte);
var FindWRN: TextFile; Mss1, DtAna, DtTmp, DtFile, DtNext, CfTmp: String[50];
Mss3, Mss2, Dir: String; Level: Char; Idx, I, IdxWRN, LgnWRN: Integer; Cf: array[1..2000] of String;
Y, M, D, H, MN, SC, MS: Word;
begin
LgnWRN:=0; IdxWRN:=0; Idx:=0;
WarSCF:=TWarSCF.create(application);
WarSCF.Show;
AssignFile(FindWRN,DirSet+'WarBck.rpt');
{$I-}
Reset(FindWRN);
{$I+}
if IoResult = 0 then begin
try
ViewWRN.Lines.Clear;
repeat
Inc(LgnWRN);
Readln(FindWRN);
Readln(FindWRN,Dir);
Readln(FindWRN,Mss2);
Readln(FindWRN);
Readln(FindWRN,DtFile);
Readln(FindWRN,DtAna);
Readln(FindWRN,DtNext);
Readln(FindWRN,CfTmp);
Readln(FindWRN,Level);
Readln(FindWRN,Mss1);
Readln(FindWRN,Mss3);
Readln(FindWRN);
if StrToInt(Level) = NivWrn then begin
DecodeDate(Now,Y,M,D);
DecodeTime(Now,H,MN,SC,MS);
DtTmp:=FormatDateTime('ddd dd/mm/yy hh:nn',EncodeDateTime(Y,M,D,H,MN,SC,MS));
if DtAna = DtTmp then begin
if Idx = 0 then WarSCF.Show;
if not AnsiMatchText(CfTmp,Cf) then begin
Inc(Idx);
Cf[Idx]:=CfTmp;
end;
for I:=1 to Idx do
if CfTmp = Cf[I] then IdxWRN:=I;
ViewWRN.SelText:=Mss1;
ViewWRN.SelAttributes.Color:=clYellow;
ViewWRN.SelAttributes.Size:=9;
Dir:=Dir+Mss2+' ('+IntToStr(IdxWRN)+')';
ViewWRN.SelText:=Dir;
ViewWRN.SelAttributes.Color:=clWhite;
ViewWRN.SelAttributes.Size:=8;
Dir:=Mss3;
if Length(Mss3) <= 21 then ViewWRN.SelText:=Dir
else ViewWRN.Lines.Add(Dir);
ViewWRN.Lines.Add('');
ViewWRN.Lines.Add('');
ViewWRN.Lines.Add('Fichier du '+#9+':'+#9+DtFile);
ViewWRN.Lines.Add('Analyse du '+#9+':'+#9+DtAna+#9+'-->'+#9+DtNext);
ViewWRN.Lines.Add('---------------------------------------------------------------------------------------');
end;
end;
until (Eof(FindWRN)) or (LgnWRN >= 2000);
ViewWRN.Lines.Add('');
ViewWRN.Lines.Add('-> ** Fin de rapport **');
finally
CloseFile(FindWRN);
end;
end;
end;
procedure TWarSCF.ValidWRNClick(Sender: TObject);
begin
WarSCF.Close;
WarSCF.Free;
end;
procedure TWarSCF.ReportWRNClick(Sender: TObject);
begin
WarSCF.Close;
WarSCF.Free;
end;
exports ShowWrn;
end. |
Partager