-
Notifications
You must be signed in to change notification settings - Fork 1
/
Multi.pas
146 lines (126 loc) · 3.84 KB
/
Multi.pas
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
unit Multi;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
SkinCtrls, SkinBoxCtrls, DynamicSkinForm, StdCtrls, Mask,
spSkinShellCtrls, ComCtrls;
type
TMultiTrt = class(TForm)
spDynamicSkinForm1: TspDynamicSkinForm;
spSkinCheckListBox1: TspSkinCheckListBox;
spSkinStdLabel1: TspSkinStdLabel;
spSkinButton1: TspSkinButton;
spSkinButton2: TspSkinButton;
Options: TspSkinCheckListBox;
spSkinStatusBar1: TspSkinStatusBar;
spSkinStatusPanel1: TspSkinStatusPanel;
spSkinGroupBox1: TspSkinGroupBox;
spSkinScrollBar1: TspSkinScrollBar;
spSkinListView1: TspSkinListView;
spSkinFileEdit1: TspSkinEdit;
procedure FormShow(Sender: TObject);
procedure spSkinButton2Click(Sender: TObject);
procedure spSkinButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
MultiTrt: TMultiTrt;
implementation
uses Main, uExportExcel, DataModFr;
{$R *.DFM}
procedure TMultiTrt.FormShow(Sender: TObject);
var
s,t : string;
f : TextFile;
begin
if spSkinCheckListBox1.Items.Count > 0 then
begin
s := ExtractFileName (spSkinCheckListBox1.Items.Strings[0]);
if FileExists (spSkinCheckListBox1.Items.Strings[0]) then
begin
AssignFile (f,spSkinCheckListBox1.Items.Strings[0]);
reset (f);
Readln (f,t);
spSkinFileEdit1.Text := ChangeFileExt (copy (t,23,8),'.dbf');
end else
spSkinFileEdit1.Text := ChangeFileExt(s,'.dbf');
end;
Options.Checked[4] := true;
end;
procedure TMultiTrt.spSkinButton2Click(Sender: TObject);
begin
Exit;
end;
procedure TMultiTrt.spSkinButton1Click(Sender: TObject);
var
i,j : integer;
ReportFile : string;
fname : string;
EffTrt,ET : string;
EffVal,EV : double;
FirstTime : Integer;
begin
FirstTime := 0;
Screen.Cursor := crHourGlass;
spSkinStatusBar1.Visible := true;
for i := 0 to spSkinCheckListBox1.Items.Count - 1 do
begin
spSkinStatuspanel1.Caption := ExtractFileName (spSkinCheckListBox1.Items.Strings[i]) +' '+
inttostr (i)+' of '+ inttostr (spSkinCheckListBox1.Items.Count - 1);
spSkinStatusPanel1.Refresh;
if spSkinCheckListBox1.Checked[i] then
begin
Inc (FirstTime);
fName := spSkinCheckListBox1.Items.Strings[i];
FileLoaded := true;
SNSFile := fName;
MainForm.ReadSNSHeader (SNSFile);
MainForm.ReadSNSFile (SNSFile);
MainForm.Caption := 'Seasonal Analysis : '+SNSFile;
MainForm.LMDMruList1.Add (SNSFile);
MainForm.LoadPriceFile;
MainForm.SpeedButton11Click (self);
if FirstTime = 1 then
begin
ReportFile := spSkinFileEdit1.Text;
MainForm.CreateOutputTable (ReportFile);
MainForm.Table1.Active := true;
MainForm.Table1.First;
MainForm.ReadSNSHeader (SNSFile);
MainForm.ReadSNSFile (SNSFile);
end;
MainForm.Table1.Edit;
MainForm.Table1.Fields[0].AsString := ExtractFileName (fName);
MainForm.Table1.Edit;
MainForm.Table1.Fields[1].AsString := WSTA;
MainForm.Table1.Edit;
MainForm.Table1.Fields[2].AsString := IDSOIL;
EffVal := -1000.0;
for j := 1 to NTreat do
begin
if Effish[j] = 'Yes' then
begin
ET := tnam[j];
EV := adj[j];
if EV > EffVal then
begin
EffVal := EV;
EffTrt := tnam[j];
end;
end;
end;
MainForm.Table1.Edit;
MainForm.Table1.Fields[3].AsString := trim(EffTrt);
MainForm.Table1.Append;
end;
end;
MainForm.Table1.Active := false;
spSkinStatusBar1.Visible := false;
Screen.Cursor := crDefault;
if MainForm.ABSDatabase1.TableExists (ReportFile) then
ExportToExcel(MainForm.DataSource1, Options.Checked[5], spSkinStatusBar1);
end;
end.