root / UFGraphAli.pas @ 5
Historique | Voir | Annoter | Télécharger (17,899 ko)
1 | 3 | avalancogn | unit UFGraphAli ;
|
---|---|---|---|
2 | |||
3 | interface
|
||
4 | |||
5 | uses
|
||
6 | Windows, Forms, Classes, Controls, Messages, Graphics, Dialogs, StdCtrls, |
||
7 | ExtCtrls, Menus, Chart, Series, TeeProcs, TeEngine; |
||
8 | |||
9 | type
|
||
10 | TFGraphAli = class(TForm)
|
||
11 | GBConfig: TGroupBox; |
||
12 | CBOnglet: TComboBox; |
||
13 | Graph: TChart; |
||
14 | Series1: TPieSeries; |
||
15 | RBCrois: TRadioButton; |
||
16 | RBTruie: TRadioButton; |
||
17 | PM: TPopupMenu; |
||
18 | MI3D: TMenuItem; |
||
19 | MIPrint: TMenuItem; |
||
20 | CBTSAA: TComboBox; |
||
21 | CBTSMineraux: TComboBox; |
||
22 | CBTSFibres: TComboBox; |
||
23 | CBTSElem: TComboBox; |
||
24 | CBTSAG: TComboBox; |
||
25 | MIPreview: TMenuItem; |
||
26 | PD: TPrintDialog; |
||
27 | procedure FormShow(Sender: TObject);
|
||
28 | procedure CBOngletChange(Sender: TObject);
|
||
29 | procedure RBTypeClick(Sender: TObject);
|
||
30 | procedure CBTSElemChange(Sender: TObject);
|
||
31 | procedure CBTSAAChange(Sender: TObject);
|
||
32 | procedure CBTSAGChange(Sender: TObject);
|
||
33 | procedure CBTSMinerauxChange(Sender: TObject);
|
||
34 | procedure CBTSFibresChange(Sender: TObject);
|
||
35 | procedure MI3DClick(Sender: TObject);
|
||
36 | procedure MIPreviewClick(Sender: TObject);
|
||
37 | procedure MIPrintClick(Sender: TObject);
|
||
38 | procedure FormCreate(Sender: TObject);
|
||
39 | procedure WMSysCommand(var Message: TWMSysCommand); message WM_SYSCOMMAND; |
||
40 | private
|
||
41 | { D?clarations priv?es }
|
||
42 | procedure AffGraph ;
|
||
43 | public
|
||
44 | { D?clarations publiques }
|
||
45 | end;
|
||
46 | |||
47 | var
|
||
48 | FGraphAli: TFGraphAli; |
||
49 | |||
50 | implementation
|
||
51 | |||
52 | uses
|
||
53 | Printers, SysUtils, gnugettext, UVariables, UStrings, UFindRec, UUtil, |
||
54 | UFAliment, UFPrevGraph; |
||
55 | |||
56 | {$R *.dfm}
|
||
57 | |||
58 | { TFGraphAli }
|
||
59 | |||
60 | procedure TFGraphAli.FormCreate(Sender: TObject);
|
||
61 | begin
|
||
62 | if Screen.Fonts.IndexOf('Arial Unicode MS') <> -1 |
||
63 | then
|
||
64 | Font.Name := 'Arial Unicode MS';
|
||
65 | TranslateComponent(Self); |
||
66 | Constraints.MinWidth := 544 + (Width - ClientWidth);
|
||
67 | Width := 640;
|
||
68 | Constraints.MinHeight := 354 + (Height - ClientHeight);
|
||
69 | Height := 480;
|
||
70 | CBOnglet.ItemIndex := 0;
|
||
71 | CBTSElem.ItemIndex := 0;
|
||
72 | end;
|
||
73 | |||
74 | procedure TFGraphAli.FormShow (Sender : TObject) ;
|
||
75 | begin
|
||
76 | MIPrint.Enabled := IsComplete or IsEducation ;
|
||
77 | if PAliment.Typ = 2 |
||
78 | then
|
||
79 | RBTruie.Checked := TRUE |
||
80 | else
|
||
81 | RBCrois.Checked := TRUE ; |
||
82 | Graph.UndoZoom ; |
||
83 | Graph.Foot.Text.Clear ; |
||
84 | Graph.Foot.Text.Add (PAliment.Nom) ; |
||
85 | Series1.OtherSlice.Text := StrAutres ; |
||
86 | Series1.Marks.ArrowLength := 24 ;
|
||
87 | CBOngletChange (nil) ;
|
||
88 | end ;
|
||
89 | |||
90 | procedure TFGraphAli.CBOngletChange (Sender : TObject) ;
|
||
91 | begin
|
||
92 | case CBOnglet.ItemIndex of |
||
93 | 0 : // Composition ?l?mentaire |
||
94 | begin
|
||
95 | CBTSElem.Visible := TRUE ; |
||
96 | CBTSAA.Visible := FALSE ; |
||
97 | CBTSAG.Visible := FALSE ; |
||
98 | CBTSMineraux.Visible := FALSE ; |
||
99 | CBTSFibres.Visible := FALSE ; |
||
100 | CBTSElemChange (nil) ;
|
||
101 | end ;
|
||
102 | 1 : // Acides amin?s |
||
103 | begin
|
||
104 | CBTSElem.Visible := FALSE ; |
||
105 | CBTSAA.Visible := TRUE ; |
||
106 | CBTSAG.Visible := FALSE ; |
||
107 | CBTSMineraux.Visible := FALSE ; |
||
108 | CBTSFibres.Visible := FALSE ; |
||
109 | CBTSAAChange (nil) ;
|
||
110 | end ;
|
||
111 | 2 : // Acides gras |
||
112 | begin
|
||
113 | CBTSElem.Visible := FALSE ; |
||
114 | CBTSAA.Visible := FALSE ; |
||
115 | CBTSAG.Visible := TRUE ; |
||
116 | CBTSMineraux.Visible := FALSE ; |
||
117 | CBTSFibres.Visible := FALSE ; |
||
118 | CBTSAGChange (nil) ;
|
||
119 | end ;
|
||
120 | 3 : // Min?raux |
||
121 | begin
|
||
122 | CBTSElem.Visible := FALSE ; |
||
123 | CBTSAA.Visible := FALSE ; |
||
124 | CBTSAG.Visible := FALSE ; |
||
125 | CBTSMineraux.Visible := TRUE ; |
||
126 | CBTSFibres.Visible := FALSE ; |
||
127 | CBTSMinerauxChange (nil) ;
|
||
128 | end ;
|
||
129 | 4 : // Fibres |
||
130 | begin
|
||
131 | CBTSElem.Visible := FALSE ; |
||
132 | CBTSAA.Visible := FALSE ; |
||
133 | CBTSAG.Visible := FALSE ; |
||
134 | CBTSMineraux.Visible := FALSE ; |
||
135 | CBTSFibres.Visible := TRUE ; |
||
136 | CBTSFibresChange (nil) ;
|
||
137 | end ;
|
||
138 | end ;
|
||
139 | end ;
|
||
140 | |||
141 | procedure TFGraphAli.CBTSElemChange (Sender : TObject) ;
|
||
142 | begin
|
||
143 | Graph.Title.Text.Clear ; |
||
144 | if CBTSElem.ItemIndex in [8, 9, 10, 12, 13, 14] |
||
145 | then
|
||
146 | begin
|
||
147 | if RBCrois.Checked
|
||
148 | then
|
||
149 | Graph.Title.Text.Add (Format ('%s (%s)', [CBTSElem.Text, RBCrois.Caption]))
|
||
150 | else
|
||
151 | Graph.Title.Text.Add (Format ('%s (%s)', [CBTSElem.Text, RBTruie.Caption])) ;
|
||
152 | RBCrois.Enabled := TRUE ; |
||
153 | RBTruie.Enabled := TRUE ; |
||
154 | end
|
||
155 | else
|
||
156 | begin
|
||
157 | Graph.Title.Text.Add (CBTSElem.Text) ; |
||
158 | RBCrois.Enabled := FALSE ; |
||
159 | RBTruie.Enabled := FALSE ; |
||
160 | end ;
|
||
161 | AffGraph ; |
||
162 | end ;
|
||
163 | |||
164 | procedure TFGraphAli.CBTSAAChange (Sender : TObject) ;
|
||
165 | begin
|
||
166 | Graph.Title.Text.Clear ; |
||
167 | Graph.Title.Text.Add (CBTSAA.Text) ; |
||
168 | RBCrois.Enabled := FALSE ; |
||
169 | RBTruie.Enabled := FALSE ; |
||
170 | AffGraph ; |
||
171 | end ;
|
||
172 | |||
173 | procedure TFGraphAli.CBTSAGChange (Sender : TObject) ;
|
||
174 | begin
|
||
175 | Graph.Title.Text.Clear ; |
||
176 | Graph.Title.Text.Add (CBTSAG.Text) ; |
||
177 | RBCrois.Enabled := FALSE ; |
||
178 | RBTruie.Enabled := FALSE ; |
||
179 | AffGraph ; |
||
180 | end ;
|
||
181 | |||
182 | procedure TFGraphAli.CBTSMinerauxChange (Sender : TObject) ;
|
||
183 | begin
|
||
184 | Graph.Title.Text.Clear ; |
||
185 | Graph.Title.Text.Add (CBTSMineraux.Text) ; |
||
186 | RBCrois.Enabled := FALSE ; |
||
187 | RBTruie.Enabled := FALSE ; |
||
188 | AffGraph ; |
||
189 | end ;
|
||
190 | |||
191 | procedure TFGraphAli.CBTSFibresChange (Sender : TObject) ;
|
||
192 | begin
|
||
193 | Graph.Title.Text.Clear ; |
||
194 | Graph.Title.Text.Add (CBTSFibres.Text) ; |
||
195 | RBCrois.Enabled := FALSE ; |
||
196 | RBTruie.Enabled := FALSE ; |
||
197 | AffGraph ; |
||
198 | end ;
|
||
199 | |||
200 | procedure TFGraphAli.AffGraph ;
|
||
201 | var
|
||
202 | i, d : integer ; |
||
203 | t, v : double ; |
||
204 | u : string ;
|
||
205 | begin
|
||
206 | t := 0 ;
|
||
207 | Series1.Clear ; |
||
208 | for i := 0 to PAliment.MP.NbMat - 1 do |
||
209 | begin
|
||
210 | PMatiere := ListMatiere[FindIdxMatiere(FindNomMatiere(PAliment.MP.NumMat[i]))] ; |
||
211 | case CBOnglet.ItemIndex of |
||
212 | 0 : // Composition ?l?mentaire |
||
213 | case CBTSElem.ItemIndex of |
||
214 | 0 : // Frais |
||
215 | v := PAliment.MP.Qte[i] ; |
||
216 | 1 : // Mati?re s?che |
||
217 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 ;
|
||
218 | 2 : // Mati?res min?rales |
||
219 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.MM / 1000 ; |
||
220 | 3 : // Mati?re organique |
||
221 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.MO / 1000 ; |
||
222 | 4 : // Mati?res grasses |
||
223 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 ; |
||
224 | 5 : // Mati?res azot?es |
||
225 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.MAT / 1000 ; |
||
226 | 6 : // Amidon |
||
227 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Amidon / 1000 ; |
||
228 | 7 : // Sucres |
||
229 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Sucres / 1000 ; |
||
230 | 8 : // Mati?re organique digestible |
||
231 | if RBCrois.Checked
|
||
232 | then
|
||
233 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.MO / 1000 * PMatiere.CC.dMO_C / 100 |
||
234 | else
|
||
235 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.MO / 1000 * PMatiere.CC.dMO_T / 100 ; |
||
236 | 9 : // Mati?res grasses digestible |
||
237 | if RBCrois.Checked
|
||
238 | then
|
||
239 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.dLip_C / 100 |
||
240 | else
|
||
241 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.dLip_T / 100 ; |
||
242 | 10 : // Mati?res azot?es digestible |
||
243 | if RBCrois.Checked
|
||
244 | then
|
||
245 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.MAT / 1000 * PMatiere.CC.dMAT_C / 100 |
||
246 | else
|
||
247 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.MAT / 1000 * PMatiere.CC.dMAT_T / 100 ; |
||
248 | 11 : // Energie brute |
||
249 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.EB / 1000 ; |
||
250 | 12 : // Energie digestible |
||
251 | if RBCrois.Checked
|
||
252 | then
|
||
253 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.ED_C / 1000 |
||
254 | else
|
||
255 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.ED_T / 1000 ; |
||
256 | 13 : // Energie m?tabolisable |
||
257 | if RBCrois.Checked
|
||
258 | then
|
||
259 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.EM_C / 1000 |
||
260 | else
|
||
261 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.EM_T / 1000 ; |
||
262 | 14 : // Energie nette |
||
263 | if RBCrois.Checked
|
||
264 | then
|
||
265 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.EN_C / 1000 |
||
266 | else
|
||
267 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.EN_T / 1000 ; |
||
268 | else
|
||
269 | v := 0 ;
|
||
270 | end ;
|
||
271 | 1 : // Acides amin?s |
||
272 | case CBTSAA.ItemIndex of |
||
273 | 0..12 : // Teneurs |
||
274 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.AAtotal[CBTSAA.ItemIndex] / 1000 ; |
||
275 | 13..25 : // Teneurs digestibles |
||
276 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.AAtotal[CBTSAA.ItemIndex - 13] / 1000 * PMatiere.CUDAA[CBTSAA.ItemIndex - 13] / 100 ; |
||
277 | else
|
||
278 | v := 0 ;
|
||
279 | end ;
|
||
280 | 2 : // Acides gras |
||
281 | case CBTSAG.ItemIndex of |
||
282 | 0 : // C6:0 + C8:0 + C10:0 |
||
283 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C6C8C10 / 100 ; |
||
284 | 1 : // C12:0 |
||
285 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C12_0 / 100 ; |
||
286 | 2 : // C14:0 |
||
287 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C14_0 / 100 ; |
||
288 | 3 : // C16:0 |
||
289 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C16_0 / 100 ; |
||
290 | 4 : // C16:1 |
||
291 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C16_1 / 100 ; |
||
292 | 5 : // C18:0 |
||
293 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C18_0 / 100 ; |
||
294 | 6 : // C18:1 |
||
295 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C18_1 / 100 ; |
||
296 | 7 : // C18:2 |
||
297 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C18_2 / 100 ; |
||
298 | 8 : // C18:3 |
||
299 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C18_3 / 100 ; |
||
300 | 9 : // C18:4 |
||
301 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C18_4 / 100 ; |
||
302 | 10 : // C20:0 |
||
303 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C20_0 / 100 ; |
||
304 | 11 : // C20:1 |
||
305 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C20_1 / 100 ; |
||
306 | 12 : // C20:4 |
||
307 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C20_4 / 100 ; |
||
308 | 13 : // C20:5 |
||
309 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C20_5 / 100 ; |
||
310 | 14 : // C22:0 |
||
311 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C22_0 / 100 ; |
||
312 | 15 : // C22:1 |
||
313 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C22_1 / 100 ; |
||
314 | 16 : // C22:5 |
||
315 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C22_5 / 100 ; |
||
316 | 17 : // C22:6 |
||
317 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C22_6 / 100 ; |
||
318 | 18 : // C24:0 |
||
319 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Lip / 1000 * PMatiere.CC.AGsLip / 100 * PMatiere.CC.C24_0 / 100 ; |
||
320 | else
|
||
321 | v := 0 ;
|
||
322 | end ;
|
||
323 | 3 : // Min?raux |
||
324 | case CBTSMineraux.ItemIndex of |
||
325 | 0 : // Calcium (Ca) |
||
326 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Ca / 1000 ; |
||
327 | 1 : // Phosphore (P) |
||
328 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.P / 1000 ; |
||
329 | 2 : // Sodium (Na) |
||
330 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Na / 1000 ; |
||
331 | 3 : // Potassium (K) |
||
332 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.K / 1000 ; |
||
333 | 4 : // Magn?sium (Mg) |
||
334 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Mg / 1000 ; |
||
335 | 5 : // Chlore (Cl) |
||
336 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Cl / 1000 ; |
||
337 | 6 : // Soufre (S) |
||
338 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.S / 1000 ; |
||
339 | 7 : // Cuivre (Cu) |
||
340 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Cu / 1000 ; |
||
341 | 8 : // Zinc (Zn) |
||
342 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Zn / 1000 ; |
||
343 | 9 : // Mangan?se (Mn) |
||
344 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Mn / 1000 ; |
||
345 | 10 : // Fer (Fe) |
||
346 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Fe / 1000 ; |
||
347 | 11 : // S?l?nium (Se) |
||
348 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Se / 1000 ; |
||
349 | 12 : // Cobalt (Co) |
||
350 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Co / 1000 ; |
||
351 | 13 : // Molybd?ne (Mo) |
||
352 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Mb / 1000 ; |
||
353 | 14 : // Iode (I) |
||
354 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.I / 1000 ; |
||
355 | 15 : // Phosphore digestible |
||
356 | if PAliment.Presentation = 0 |
||
357 | then // Granul?s |
||
358 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.PdigG / 1000 |
||
359 | else // Farine |
||
360 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.PdigF / 1000 ; |
||
361 | 16 : // Phosphore phytique |
||
362 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.P / 1000 * PMatiere.CC.Phytase / 100 ; |
||
363 | 17 : // Activit? phytasique |
||
364 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * (PMatiere.CC.ActPhytE + PMatiere.CC.ActPhytM) / 1000 ; |
||
365 | else
|
||
366 | v := 0 ;
|
||
367 | end ;
|
||
368 | 4 : // Fibres |
||
369 | case CBTSFibres.ItemIndex of |
||
370 | 0 : // Cellulose brute |
||
371 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.CB / 1000 ; |
||
372 | 1 : // NDF |
||
373 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.NDF / 1000 ; |
||
374 | 2 : // ADF |
||
375 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.ADF / 1000 ; |
||
376 | 3 : // ADL |
||
377 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.ADL / 1000 ; |
||
378 | 4 : // Parois v?g?tale |
||
379 | v := PAliment.MP.Qte[i] * PAliment.MP.MS[i] / 1000 * PMatiere.CC.Parois / 1000 ; |
||
380 | else
|
||
381 | v := 0 ;
|
||
382 | end ;
|
||
383 | else
|
||
384 | v := 0 ;
|
||
385 | end ;
|
||
386 | // Series1.AddPie (v, PMatiere.Nom) ;
|
||
387 | if PMatiere.Num > 0 |
||
388 | then // Mati?re premi?re utilisateur |
||
389 | Series1.AddPie(v, PMatiere.Nom) |
||
390 | else // Mati?re premi?re INRA-AFZ (traduction) |
||
391 | Series1.AddPie(v, dgettext('InraAfz', PMatiere.Nom));
|
||
392 | t := t + v ; |
||
393 | end ;
|
||
394 | case CBOnglet.ItemIndex of |
||
395 | 0 : // Composition ?l?mentaire |
||
396 | case CBTSElem.ItemIndex of |
||
397 | 11..14 : // Valeurs ?nerg?tiques |
||
398 | begin
|
||
399 | d := 1 ;
|
||
400 | u := Format ('%s/%s %s', [StrMJ, StrKg, StrFrais]) ;
|
||
401 | end ;
|
||
402 | else // Teneur et digestibilit? f?cale |
||
403 | begin
|
||
404 | d := 0 ;
|
||
405 | u := Format ('%s/%s %s', [StrG, StrKg, StrFrais]) ;
|
||
406 | end ;
|
||
407 | end ;
|
||
408 | 3 : // Min?raux |
||
409 | case CBTSMineraux.ItemIndex of |
||
410 | 7..14 : // Oligo-?l?ments |
||
411 | begin
|
||
412 | d := 2 ;
|
||
413 | u := Format ('%s/%s %s', [StrMg, StrKg, StrFrais]) ;
|
||
414 | end ;
|
||
415 | 17 : // Activit? phytasique |
||
416 | begin
|
||
417 | d := 0 ;
|
||
418 | u := Format ('%s/%s %s', [StrUI, StrKg, StrFrais]) ;
|
||
419 | end ;
|
||
420 | else // Macro-?l?ments / Phosphore digestible / Phosphore phytique |
||
421 | begin
|
||
422 | d := 2 ;
|
||
423 | u := Format ('%s/%s %s', [StrG, StrKg, StrFrais]) ;
|
||
424 | end ;
|
||
425 | end ;
|
||
426 | 4 : // Fibres |
||
427 | begin
|
||
428 | d := 1 ;
|
||
429 | u := Format ('%s/%s %s', [StrG, StrKg, StrFrais]) ;
|
||
430 | end ;
|
||
431 | else // Acides amin?s / Acides gras |
||
432 | begin
|
||
433 | d := 2 ;
|
||
434 | u := Format ('%s/%s %s', [StrG, StrKg, StrFrais]) ;
|
||
435 | end ;
|
||
436 | end ;
|
||
437 | // Je m'assure que le frais est de 1000 g/kg
|
||
438 | t := t / FAliment.PBTotal.AsFloat * 1000 ;
|
||
439 | Graph.SubTitle.Text.Clear ; |
||
440 | Graph.SubTitle.Text.Add (Format ('Total : %1.*f %s', [d, t, u])) ;
|
||
441 | if t = 0 |
||
442 | then
|
||
443 | Series1.Active := FALSE |
||
444 | else
|
||
445 | Series1.Active := TRUE ; |
||
446 | end ;
|
||
447 | |||
448 | procedure TFGraphAli.RBTypeClick (Sender : TObject) ;
|
||
449 | begin
|
||
450 | CBTSElemChange (nil) ;
|
||
451 | end ;
|
||
452 | |||
453 | procedure TFGraphAli.MI3DClick (Sender : TObject) ;
|
||
454 | begin
|
||
455 | Graph.View3D := not (Graph.View3D) ;
|
||
456 | end ;
|
||
457 | |||
458 | procedure TFGraphAli.MIPreviewClick (Sender : TObject) ;
|
||
459 | begin
|
||
460 | FPrevGraph := TFPrevGraph.Create (Self) ; |
||
461 | with FPrevGraph do |
||
462 | begin
|
||
463 | TPPGraph.Panels.Add (Graph) ; |
||
464 | ShowModal ; |
||
465 | Release ; |
||
466 | end ;
|
||
467 | end ;
|
||
468 | |||
469 | procedure TFGraphAli.MIPrintClick (Sender : TObject) ;
|
||
470 | begin
|
||
471 | if PD.Execute
|
||
472 | then
|
||
473 | begin
|
||
474 | Printer.Orientation := poLandscape ; |
||
475 | Graph.Print ; |
||
476 | end ;
|
||
477 | end ;
|
||
478 | |||
479 | procedure TFGraphAli.WMSysCommand(var Message: TWMSysCommand); |
||
480 | begin
|
||
481 | if Message.CmdType = SC_MINIMIZE
|
||
482 | then
|
||
483 | Application.Minimize |
||
484 | else
|
||
485 | inherited;
|
||
486 | end;
|
||
487 | |||
488 | end. |