root / UnitFeedCharts.pas @ 5
Historique | Voir | Annoter | Télécharger (116,727 ko)
1 | 1 | avalancogn | unit UnitFeedCharts;
|
---|---|---|---|
2 | |||
3 | interface
|
||
4 | |||
5 | uses
|
||
6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, |
||
7 | gnugettext, StdCtrls, ExtCtrls, TeeProcs, TeEngine, Chart, Series, Buttons, |
||
8 | Math, ComCtrls, JvExStdCtrls, JvButton, JvCtrls, ActnList, ImgList; |
||
9 | |||
10 | type
|
||
11 | TFormFeedCharts = class(TForm)
|
||
12 | Chart0: TChart; |
||
13 | SeriesPie: TPieSeries; |
||
14 | SpeedButton2D3D0: TSpeedButton; |
||
15 | SpeedButtonPrint0: TSpeedButton; |
||
16 | GroupBoxChart0: TGroupBox; |
||
17 | PageControlFeedCharts: TPageControl; |
||
18 | TabSheetSingleChart: TTabSheet; |
||
19 | TabSheetChartsComparison: TTabSheet; |
||
20 | GroupBoxChart1: TGroupBox; |
||
21 | GroupBoxChart2: TGroupBox; |
||
22 | GroupBoxChart3: TGroupBox; |
||
23 | GroupBoxChart4: TGroupBox; |
||
24 | Chart1: TChart; |
||
25 | SpeedButton2D3D1: TSpeedButton; |
||
26 | SpeedButtonPrint1: TSpeedButton; |
||
27 | PanelChart1: TPanel; |
||
28 | PanelChart2: TPanel; |
||
29 | PanelChart3: TPanel; |
||
30 | PanelChart4: TPanel; |
||
31 | Chart2: TChart; |
||
32 | SpeedButton2D3D2: TSpeedButton; |
||
33 | SpeedButtonPrint2: TSpeedButton; |
||
34 | Chart3: TChart; |
||
35 | SpeedButton2D3D3: TSpeedButton; |
||
36 | SpeedButtonPrint3: TSpeedButton; |
||
37 | Chart4: TChart; |
||
38 | SpeedButton2D3D4: TSpeedButton; |
||
39 | SpeedButtonPrint4: TSpeedButton; |
||
40 | PanelButtons: TPanel; |
||
41 | ComboBoxAA0: TComboBox; |
||
42 | ComboBoxEnergy0: TComboBox; |
||
43 | ComboBoxMinerals0: TComboBox; |
||
44 | ComboBoxProximal0: TComboBox; |
||
45 | ComboBoxType0: TComboBox; |
||
46 | ComboBoxAA1: TComboBox; |
||
47 | ComboBoxEnergy1: TComboBox; |
||
48 | ComboBoxMinerals1: TComboBox; |
||
49 | ComboBoxProximal1: TComboBox; |
||
50 | ComboBoxType1: TComboBox; |
||
51 | ComboBoxAA2: TComboBox; |
||
52 | ComboBoxEnergy2: TComboBox; |
||
53 | ComboBoxMinerals2: TComboBox; |
||
54 | ComboBoxProximal2: TComboBox; |
||
55 | ComboBoxType2: TComboBox; |
||
56 | ComboBoxAA3: TComboBox; |
||
57 | ComboBoxEnergy3: TComboBox; |
||
58 | ComboBoxMinerals3: TComboBox; |
||
59 | ComboBoxProximal3: TComboBox; |
||
60 | ComboBoxType3: TComboBox; |
||
61 | ComboBoxAA4: TComboBox; |
||
62 | ComboBoxEnergy4: TComboBox; |
||
63 | ComboBoxMinerals4: TComboBox; |
||
64 | ComboBoxProximal4: TComboBox; |
||
65 | ComboBoxType4: TComboBox; |
||
66 | ImageListIcons: TImageList; |
||
67 | ActionListButtons: TActionList; |
||
68 | ActionHelp: TAction; |
||
69 | ActionClose: TAction; |
||
70 | JvImgBtnClose: TJvImgBtn; |
||
71 | JvImgBtnHelp: TJvImgBtn; |
||
72 | procedure FormCreate(Sender: TObject);
|
||
73 | procedure ComboBoxType0Change(Sender: TObject);
|
||
74 | procedure FormShow(Sender: TObject);
|
||
75 | procedure ComboBoxOption0Change(Sender: TObject);
|
||
76 | procedure SpeedButton2D3D0Click(Sender: TObject);
|
||
77 | procedure SpeedButtonPrint0Click(Sender: TObject);
|
||
78 | procedure FormDestroy(Sender: TObject);
|
||
79 | procedure FormResize(Sender: TObject);
|
||
80 | procedure ComboBoxType1Change(Sender: TObject);
|
||
81 | procedure ComboBoxType2Change(Sender: TObject);
|
||
82 | procedure ComboBoxType3Change(Sender: TObject);
|
||
83 | procedure ComboBoxType4Change(Sender: TObject);
|
||
84 | procedure ComboBoxOption1Change(Sender: TObject);
|
||
85 | procedure ComboBoxOption2Change(Sender: TObject);
|
||
86 | procedure ComboBoxOption3Change(Sender: TObject);
|
||
87 | procedure ComboBoxOption4Change(Sender: TObject);
|
||
88 | procedure SpeedButton2D3D1Click(Sender: TObject);
|
||
89 | procedure SpeedButton2D3D2Click(Sender: TObject);
|
||
90 | procedure SpeedButton2D3D3Click(Sender: TObject);
|
||
91 | procedure SpeedButton2D3D4Click(Sender: TObject);
|
||
92 | procedure SpeedButtonPrint1Click(Sender: TObject);
|
||
93 | procedure SpeedButtonPrint2Click(Sender: TObject);
|
||
94 | procedure SpeedButtonPrint3Click(Sender: TObject);
|
||
95 | procedure SpeedButtonPrint4Click(Sender: TObject);
|
||
96 | procedure WMSysCommand(var Message: TWMSysCommand); message WM_SYSCOMMAND; |
||
97 | procedure ActionHelpExecute(Sender: TObject);
|
||
98 | procedure ActionCloseExecute(Sender: TObject);
|
||
99 | private
|
||
100 | { D?clarations priv?es }
|
||
101 | public
|
||
102 | { D?clarations publiques }
|
||
103 | end;
|
||
104 | |||
105 | var
|
||
106 | FormFeedCharts: TFormFeedCharts; |
||
107 | |||
108 | implementation
|
||
109 | |||
110 | uses
|
||
111 | UnitDeclaration, UnitOptions, UnitChartHReport; |
||
112 | |||
113 | {$R *.dfm}
|
||
114 | |||
115 | procedure TFormFeedCharts.ActionCloseExecute(Sender: TObject);
|
||
116 | begin
|
||
117 | ModalResult := mrClose; |
||
118 | end;
|
||
119 | |||
120 | procedure TFormFeedCharts.ActionHelpExecute(Sender: TObject);
|
||
121 | begin
|
||
122 | Application.HelpContext(HelpContext); |
||
123 | end;
|
||
124 | |||
125 | procedure TFormFeedCharts.ComboBoxOption0Change(Sender: TObject);
|
||
126 | var
|
||
127 | IngredientName: String;
|
||
128 | Ratio, Total, Value: Double; |
||
129 | begin
|
||
130 | SeriesPie.Clear; |
||
131 | Chart0.SubTitle.Clear; |
||
132 | with DataModuleDeclaration do |
||
133 | begin
|
||
134 | Chart0.Title.Caption := ClientDataSetFeedsName.Value; |
||
135 | Chart0.SubTitle.Text.Add(ComboBoxType0.Text); |
||
136 | case ComboBoxType0.ItemIndex of |
||
137 | 0: // Analyse proximale |
||
138 | Chart0.SubTitle.Text.Add(ComboBoxProximal0.Text); |
||
139 | 1: // Valeurs ?nerg?tiques |
||
140 | Chart0.SubTitle.Text.Add(ComboBoxEnergy0.Text); |
||
141 | 2, 3: // Acides amin?s |
||
142 | Chart0.SubTitle.Text.Add(ComboBoxAA0.Text); |
||
143 | 4: // Min?raux |
||
144 | Chart0.SubTitle.Text.Add(ComboBoxMinerals0.Text); |
||
145 | end;
|
||
146 | ClientDataSetComposition.First; |
||
147 | Total := 0;
|
||
148 | while not ClientDataSetComposition.Eof do |
||
149 | begin
|
||
150 | if ClientDataSetCompositionUser.Value
|
||
151 | then
|
||
152 | ClientDataSetIngredients.Filter := Format('Id = %d and User', [ClientDataSetCompositionIngredient.Value])
|
||
153 | else
|
||
154 | ClientDataSetIngredients.Filter := Format('Id = %d and not User', [ClientDataSetCompositionIngredient.Value]);
|
||
155 | ClientDataSetIngredients.Filtered := True; |
||
156 | IngredientName := StrTrunc(ClientDataSetIngredientsName.Value, 25);
|
||
157 | Ratio := InputIncorporation(ClientDataSetCompositionLevel.Value, FormOptions.Incorporation); |
||
158 | if (FormOptions.Expression = 0) |
||
159 | and ((ComboBoxType0.ItemIndex <> 0) or (ComboBoxProximal0.ItemIndex > 1)) |
||
160 | then // Conversion frais -> sec (mati?re s?che de la mati?re premi?re) - except? pour Composition et MS |
||
161 | Ratio := Ratio / InputProximal(ClientDataSetIngredientsMS.Value, 1, 1, FormOptions.Proximal); |
||
162 | RapMS := InputProximal(ClientDataSetCompositionMS.Value, 1, 1, FormOptions.Proximal); |
||
163 | if ((ComboBoxType0.ItemIndex <> 0) or (ComboBoxProximal0.ItemIndex > 1)) |
||
164 | then // Conversion sec -> frais (mati?re s?che de la composition) - except? pour Composition et MS |
||
165 | Ratio := Ratio * RapMS; |
||
166 | case ComboBoxType0.ItemIndex of |
||
167 | 0: // Analyse proximale |
||
168 | case ComboBoxProximal0.ItemIndex of |
||
169 | 0: // Composition |
||
170 | Value := OutputProximal(Ratio, 1, 1, FormOptions.Proximal); |
||
171 | 1: // MS |
||
172 | Value := ClientDataSetCompositionMS.Value * Ratio; |
||
173 | 2: // MM |
||
174 | Value := ClientDataSetIngredientsMM.Value * Ratio; |
||
175 | 3: // MAT |
||
176 | Value := ClientDataSetIngredientsMAT.Value * Ratio; |
||
177 | 4: // MG |
||
178 | Value := ClientDataSetIngredientsMG.Value * Ratio; |
||
179 | 5: // CB |
||
180 | Value := ClientDataSetIngredientsCB.Value * Ratio; |
||
181 | 6: // NDF |
||
182 | Value := ClientDataSetIngredientsNDF.Value * Ratio; |
||
183 | 7: // ADF |
||
184 | Value := ClientDataSetIngredientsADF.Value * Ratio; |
||
185 | 8: // ADL |
||
186 | Value := ClientDataSetIngredientsADL.Value * Ratio; |
||
187 | 9: // Amidon |
||
188 | Value := ClientDataSetIngredientsAmidon.Value * Ratio; |
||
189 | 10: // Sucres |
||
190 | Value := ClientDataSetIngredientsSucres.Value * Ratio; |
||
191 | else
|
||
192 | Value := 0;
|
||
193 | end;
|
||
194 | 1: // Valeurs ?nerg?tiques |
||
195 | case ComboBoxEnergy0.ItemIndex of |
||
196 | 0: // Energie brute |
||
197 | Value := ClientDataSetIngredientsEB.Value * Ratio; |
||
198 | 1: // Energie digestible (porc croissance) |
||
199 | Value := ClientDataSetIngredientsEDc.Value * Ratio; |
||
200 | 2: // Energie digestible (porc adulte) |
||
201 | Value := ClientDataSetIngredientsEDt.Value * Ratio; |
||
202 | 3: // Energie m?tabolisable (porc croissance) |
||
203 | Value := ClientDataSetIngredientsEMc.Value * Ratio; |
||
204 | 4: // Energie m?tabolisable (porc adulte) |
||
205 | Value := ClientDataSetIngredientsEMt.Value * Ratio; |
||
206 | 5: // Energie nette (porc croissance) |
||
207 | Value := ClientDataSetIngredientsENc.Value * Ratio; |
||
208 | 6: // Energie nette (porc adulte) |
||
209 | Value := ClientDataSetIngredientsENt.Value * Ratio; |
||
210 | else
|
||
211 | Value := 0;
|
||
212 | end;
|
||
213 | 2: // Acides amin?s totaux |
||
214 | case ComboBoxAA0.ItemIndex of |
||
215 | 0: // Lysine |
||
216 | Value := ClientDataSetIngredientsLys.Value * Ratio; |
||
217 | 1: // Thr?onine |
||
218 | Value := ClientDataSetIngredientsThr.Value * Ratio; |
||
219 | 2: // M?thionine |
||
220 | Value := ClientDataSetIngredientsMet.Value * Ratio; |
||
221 | 3: // Cyst?ine |
||
222 | Value := ClientDataSetIngredientsCys.Value * Ratio; |
||
223 | 4: // M?thionine + Cyst?ine |
||
224 | Value := ClientDataSetIngredientsMetCys.Value * Ratio; |
||
225 | 5: // Tryptophane |
||
226 | Value := ClientDataSetIngredientsTrp.Value * Ratio; |
||
227 | 6: // Isoleucine |
||
228 | Value := ClientDataSetIngredientsIle.Value * Ratio; |
||
229 | 7: // Valine |
||
230 | Value := ClientDataSetIngredientsVal.Value * Ratio; |
||
231 | 8: // Leucine |
||
232 | Value := ClientDataSetIngredientsLeu.Value * Ratio; |
||
233 | 9: // Ph?nylalanine |
||
234 | Value := ClientDataSetIngredientsPhe.Value * Ratio; |
||
235 | 10: // Tyrosine |
||
236 | Value := ClientDataSetIngredientsTyr.Value * Ratio; |
||
237 | 11: // Ph?nylalanine + Tyrosine |
||
238 | Value := ClientDataSetIngredientsPheTyr.Value * Ratio; |
||
239 | 12: // Histidine |
||
240 | Value := ClientDataSetIngredientsHis.Value * Ratio; |
||
241 | 13: // Arginine |
||
242 | Value := ClientDataSetIngredientsArg.Value * Ratio; |
||
243 | 14: // Alanine |
||
244 | Value := ClientDataSetIngredientsAla.Value * Ratio; |
||
245 | 15: // Aspartate |
||
246 | Value := ClientDataSetIngredientsAsp.Value * Ratio; |
||
247 | 16: // Glutamate |
||
248 | Value := ClientDataSetIngredientsGlu.Value * Ratio; |
||
249 | 17: // Glycine |
||
250 | Value := ClientDataSetIngredientsGly.Value * Ratio; |
||
251 | 18: // S?rine |
||
252 | Value := ClientDataSetIngredientsSer.Value * Ratio; |
||
253 | 19: // Proline |
||
254 | Value := ClientDataSetIngredientsPro.Value * Ratio; |
||
255 | else
|
||
256 | Value := 0;
|
||
257 | end;
|
||
258 | 3: // Acides amin?s digestibles |
||
259 | case ComboBoxAA0.ItemIndex of |
||
260 | 0: // Lysine |
||
261 | Value := ClientDataSetIngredientsLysd.Value * Ratio; |
||
262 | 1: // Thr?onine |
||
263 | Value := ClientDataSetIngredientsThrd.Value * Ratio; |
||
264 | 2: // M?thionine |
||
265 | Value := ClientDataSetIngredientsMetd.Value * Ratio; |
||
266 | 3: // Cyst?ine |
||
267 | Value := ClientDataSetIngredientsCysd.Value * Ratio; |
||
268 | 4: // M?thionine + Cyst?ine |
||
269 | Value := ClientDataSetIngredientsMetCysd.Value * Ratio; |
||
270 | 5: // Tryptophane |
||
271 | Value := ClientDataSetIngredientsTrpd.Value * Ratio; |
||
272 | 6: // Isoleucine |
||
273 | Value := ClientDataSetIngredientsIled.Value * Ratio; |
||
274 | 7: // Valine |
||
275 | Value := ClientDataSetIngredientsVald.Value * Ratio; |
||
276 | 8: // Leucine |
||
277 | Value := ClientDataSetIngredientsLeud.Value * Ratio; |
||
278 | 9: // Ph?nylalanine |
||
279 | Value := ClientDataSetIngredientsPhed.Value * Ratio; |
||
280 | 10: // Tyrosine |
||
281 | Value := ClientDataSetIngredientsTyrd.Value * Ratio; |
||
282 | 11: // Ph?nylalanine + Tyrosine |
||
283 | Value := ClientDataSetIngredientsPheTyrd.Value * Ratio; |
||
284 | 12: // Histidine |
||
285 | Value := ClientDataSetIngredientsHisd.Value * Ratio; |
||
286 | 13: // Arginine |
||
287 | Value := ClientDataSetIngredientsArgd.Value * Ratio; |
||
288 | 14: // Alanine |
||
289 | Value := ClientDataSetIngredientsAlad.Value * Ratio; |
||
290 | 15: // Aspartate |
||
291 | Value := ClientDataSetIngredientsAspd.Value * Ratio; |
||
292 | 16: // Glutamate |
||
293 | Value := ClientDataSetIngredientsGlud.Value * Ratio; |
||
294 | 17: // Glycine |
||
295 | Value := ClientDataSetIngredientsGlyd.Value * Ratio; |
||
296 | 18: // S?rine |
||
297 | Value := ClientDataSetIngredientsSerd.Value * Ratio; |
||
298 | 19: // Proline |
||
299 | Value := ClientDataSetIngredientsProd.Value * Ratio; |
||
300 | else
|
||
301 | Value := 0;
|
||
302 | end;
|
||
303 | 4: // Min?raux |
||
304 | case ComboBoxMinerals0.ItemIndex of |
||
305 | 0: // Calcium |
||
306 | Value := ClientDataSetIngredientsCa.Value * Ratio; |
||
307 | 1: // Phosphore |
||
308 | Value := ClientDataSetIngredientsP.Value * Ratio; |
||
309 | 4 | avalancogn | 2: // Sodium |
310 | Value := ClientDataSetIngredientsNa.Value * Ratio; |
||
311 | 3: // Potassium |
||
312 | Value := ClientDataSetIngredientsK.Value * Ratio; |
||
313 | 4: // Chlore |
||
314 | Value := ClientDataSetIngredientsCl.Value * Ratio; |
||
315 | 5: // Phosphore digestible |
||
316 | 1 | avalancogn | if ClientDataSetFeedsPresentation.Value = 0 |
317 | then // Farine (dPphy) |
||
318 | Value := ClientDataSetIngredientsdPphy.Value / 100 * ClientDataSetIngredientsP.Value * Ratio
|
||
319 | else // Granul?s (dP) |
||
320 | Value := ClientDataSetIngredientsdP.Value / 100 * ClientDataSetIngredientsP.Value * Ratio;
|
||
321 | 5 | avalancogn | 6: // Bilan ?lectrolytique |
322 | Value := ClientDataSetIngredientsBE.Value * Ratio; |
||
323 | 1 | avalancogn | else
|
324 | Value := 0;
|
||
325 | end;
|
||
326 | else
|
||
327 | Value := 0;
|
||
328 | end;
|
||
329 | if (FormOptions.Expression = 1) |
||
330 | and ((ComboBoxType0.ItemIndex <> 0) or (ComboBoxProximal0.ItemIndex > 1)) |
||
331 | then // Conversion frais -> sec (mati?re s?che du r?gime) - except? pour Composition et MS |
||
332 | Value := Value / InputProximal(ClientDataSetFeedsMS.Value, 1, 1, FormOptions.Proximal); |
||
333 | if Value > 0 |
||
334 | then // Prendre en compte la valeur |
||
335 | begin
|
||
336 | SeriesPie.AddPie(Value, IngredientName); |
||
337 | Total := Total + Value; |
||
338 | end;
|
||
339 | ClientDataSetComposition.Next; |
||
340 | end;
|
||
341 | ClientDataSetIngredients.Filtered := False; |
||
342 | ClientDataSetIngredients.Filter := '';
|
||
343 | // Cas particuliers
|
||
344 | if (ComboBoxType0.ItemIndex = 1) |
||
345 | and ((ComboBoxEnergy0.ItemIndex = 1) |
||
346 | or (ComboBoxEnergy0.ItemIndex = 3) |
||
347 | or (ComboBoxEnergy0.ItemIndex = 5)) |
||
348 | and (ClientDataSetFeedsBonusC.Value > 0) |
||
349 | then // Bonus ?nergie (porc croissance) |
||
350 | begin
|
||
351 | case ComboBoxEnergy0.ItemIndex of |
||
352 | 1: Value := ClientDataSetFeedsEDc.Value - Total;
|
||
353 | 3: Value := ClientDataSetFeedsEMc.Value - Total;
|
||
354 | 5: Value := ClientDataSetFeedsENc.Value - Total;
|
||
355 | else Value := 0; |
||
356 | end;
|
||
357 | SeriesPie.AddPie(Value, _('Energy bonus'));
|
||
358 | Total := Total + Value; |
||
359 | end;
|
||
360 | if (ComboBoxType0.ItemIndex = 1) |
||
361 | and ((ComboBoxEnergy0.ItemIndex = 2) |
||
362 | or (ComboBoxEnergy0.ItemIndex = 4) |
||
363 | or (ComboBoxEnergy0.ItemIndex = 6)) |
||
364 | and (ClientDataSetFeedsBonusT.Value > 0) |
||
365 | then // Bonus ?nergie (porc adulte) |
||
366 | begin
|
||
367 | case ComboBoxEnergy0.ItemIndex of |
||
368 | 2: Value := ClientDataSetFeedsEDt.Value - Total;
|
||
369 | 4: Value := ClientDataSetFeedsEMt.Value - Total;
|
||
370 | 6: Value := ClientDataSetFeedsENt.Value - Total;
|
||
371 | else Value := 0; |
||
372 | end;
|
||
373 | SeriesPie.AddPie(Value, _('Energy bonus'));
|
||
374 | Total := Total + Value; |
||
375 | end;
|
||
376 | if (ComboBoxType0.ItemIndex = 0) |
||
377 | and (ComboBoxProximal0.ItemIndex = 0) |
||
378 | and not ClientDataSetFeedsPhytaseId.IsNull |
||
379 | and (ClientDataSetFeedsPhytaseLevel.Value > 0) |
||
380 | then // Phytase (taux d'incorporation) |
||
381 | begin
|
||
382 | Ratio := InputIncorporation(ClientDataSetFeedsPhytaseLevel.Value, FormOptions.Incorporation); |
||
383 | Value := OutputProximal(Ratio, 1, 1, FormOptions.Proximal); |
||
384 | SeriesPie.AddPie(Value, _('Phytase'));
|
||
385 | Total := Total + Value; |
||
386 | end;
|
||
387 | if (ComboBoxType0.ItemIndex = 4) |
||
388 | and (ComboBoxMinerals0.ItemIndex = 2) |
||
389 | and not ClientDataSetFeedsPhytaseId.IsNull |
||
390 | and (ClientDataSetFeedsPd.Value > Total)
|
||
391 | then // Phytase (Phosphore digestible) |
||
392 | begin
|
||
393 | Value := ClientDataSetFeedsPd.Value - Total; |
||
394 | SeriesPie.AddPie(Value, _('Phytase'));
|
||
395 | Total := Total + Value; |
||
396 | end;
|
||
397 | end;
|
||
398 | // Total
|
||
399 | case ComboBoxType0.ItemIndex of |
||
400 | 0: // Analyse proximale |
||
401 | if (FormOptions.Expression = 0) or (ComboBoxProximal0.ItemIndex < 2) |
||
402 | then // sur frais |
||
403 | Chart0.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.ProximalDecimals, Total, FormOptions.ComboBoxProximal.Items[FormOptions.Proximal]])) |
||
404 | else // sur mati?re s?che - except? pour Composition et MS |
||
405 | Chart0.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.ProximalDecimals, Total, FormOptions.ComboBoxProximal.Items[FormOptions.Proximal], _('DM')])); |
||
406 | 1: // Valeurs ?nerg?tiques |
||
407 | if FormOptions.Expression = 0 |
||
408 | then // sur frais |
||
409 | Chart0.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.EnergyDecimals, Total, FormOptions.ComboBoxEnergy.Items[FormOptions.Energy]])) |
||
410 | else // sur mati?re s?che |
||
411 | Chart0.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.EnergyDecimals, Total, FormOptions.ComboBoxEnergy.Items[FormOptions.Energy], _('DM')])); |
||
412 | 2, 3: // Acides amin?s |
||
413 | if FormOptions.Expression = 0 |
||
414 | then // sur frais |
||
415 | Chart0.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.AADecimals, Total, FormOptions.ComboBoxAA.Items[FormOptions.AA]])) |
||
416 | else // sur mati?re s?che |
||
417 | Chart0.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.AADecimals, Total, FormOptions.ComboBoxAA.Items[FormOptions.AA], _('DM')])); |
||
418 | 4: // Min?raux |
||
419 | 5 | avalancogn | if ComboBoxMinerals0.ItemIndex = 6 |
420 | then // Bilan ?lectrolytique |
||
421 | if FormOptions.Expression = 0 |
||
422 | then // sur frais |
||
423 | Chart0.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), 1, Total, _('mEq/kg')])) |
||
424 | else // sur mati?re s?che |
||
425 | Chart0.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), 1, Total, _('mEq/kg'), _('DM')])) |
||
426 | else
|
||
427 | if FormOptions.Expression = 0 |
||
428 | then // sur frais |
||
429 | Chart0.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.MineralsDecimals, Total, FormOptions.ComboBoxMinerals.Items[FormOptions.Minerals]])) |
||
430 | else // sur mati?re s?che |
||
431 | Chart0.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.MineralsDecimals, Total, FormOptions.ComboBoxMinerals.Items[FormOptions.Minerals], _('DM')])); |
||
432 | 1 | avalancogn | end;
|
433 | end;
|
||
434 | |||
435 | procedure TFormFeedCharts.ComboBoxOption1Change(Sender: TObject);
|
||
436 | var
|
||
437 | IngredientName: String;
|
||
438 | Cumul, Ratio, Total, Value: Double; |
||
439 | FeedBar: TBarSeries; |
||
440 | begin
|
||
441 | // while Chart1.SeriesCount > 0 do
|
||
442 | // Chart1.Series[0].Free;
|
||
443 | Chart1.FreeAllSeries(nil);
|
||
444 | Chart1.SubTitle.Clear; |
||
445 | with DataModuleDeclaration do |
||
446 | begin
|
||
447 | Chart1.AxisVisible := True; |
||
448 | Chart1.SubTitle.Text.Add(ComboBoxType1.Text); |
||
449 | case ComboBoxType1.ItemIndex of |
||
450 | 0: // Analyse proximale |
||
451 | Chart1.SubTitle.Text.Add(ComboBoxProximal1.Text); |
||
452 | 1: // Valeurs ?nerg?tiques |
||
453 | Chart1.SubTitle.Text.Add(ComboBoxEnergy1.Text); |
||
454 | 2, 3: // Acides amin?s |
||
455 | Chart1.SubTitle.Text.Add(ComboBoxAA1.Text); |
||
456 | 4: // Min?raux |
||
457 | Chart1.SubTitle.Text.Add(ComboBoxMinerals1.Text); |
||
458 | end;
|
||
459 | case ComboBoxType1.ItemIndex of |
||
460 | 0: // Analyse proximale |
||
461 | case ComboBoxProximal1.ItemIndex of |
||
462 | 0: // Composition |
||
463 | Cumul := OutputIncorporation(1, FormOptions.Incorporation);
|
||
464 | 1: // MS |
||
465 | Cumul := ClientDataSetFeedsMS.Value; |
||
466 | 2: // MM |
||
467 | Cumul := ClientDataSetFeedsMM.Value; |
||
468 | 3: // MAT |
||
469 | Cumul := ClientDataSetFeedsMAT.Value; |
||
470 | 4: // MG |
||
471 | Cumul := ClientDataSetFeedsMG.Value; |
||
472 | 5: // CB |
||
473 | Cumul := ClientDataSetFeedsCB.Value; |
||
474 | 6: // NDF |
||
475 | Cumul := ClientDataSetFeedsNDF.Value; |
||
476 | 7: // ADF |
||
477 | Cumul := ClientDataSetFeedsADF.Value; |
||
478 | 8: // ADL |
||
479 | Cumul := ClientDataSetFeedsADL.Value; |
||
480 | 9: // Amidon |
||
481 | Cumul := ClientDataSetFeedsAmidon.Value; |
||
482 | 10: // Sucres |
||
483 | Cumul := ClientDataSetFeedsSucres.Value; |
||
484 | else
|
||
485 | Cumul := 0;
|
||
486 | end;
|
||
487 | 1: // Valeurs ?nerg?tiques |
||
488 | case ComboBoxEnergy1.ItemIndex of |
||
489 | 0: // Energie brute |
||
490 | Cumul := ClientDataSetFeedsEB.Value; |
||
491 | 1: // Energie digestible (porc croissance) |
||
492 | Cumul := ClientDataSetFeedsEDc.Value; |
||
493 | 2: // Energie digestible (porc adulte) |
||
494 | Cumul := ClientDataSetFeedsEDt.Value; |
||
495 | 3: // Energie m?tabolisable (porc croissance) |
||
496 | Cumul := ClientDataSetFeedsEMc.Value; |
||
497 | 4: // Energie m?tabolisable (porc adulte) |
||
498 | Cumul := ClientDataSetFeedsEMt.Value; |
||
499 | 5: // Energie nette (porc croissance) |
||
500 | Cumul := ClientDataSetFeedsENc.Value; |
||
501 | 6: // Energie nette (porc adulte) |
||
502 | Cumul := ClientDataSetFeedsENt.Value; |
||
503 | else
|
||
504 | Cumul := 0;
|
||
505 | end;
|
||
506 | 2: // Acides amin?s totaux |
||
507 | case ComboBoxAA1.ItemIndex of |
||
508 | 0: // Lysine |
||
509 | Cumul := ClientDataSetFeedsLys.Value; |
||
510 | 1: // Thr?onine |
||
511 | Cumul := ClientDataSetFeedsThr.Value; |
||
512 | 2: // M?thionine |
||
513 | Cumul := ClientDataSetFeedsMet.Value; |
||
514 | 3: // Cyst?ine |
||
515 | Cumul := ClientDataSetFeedsCys.Value; |
||
516 | 4: // M?thionine + Cyst?ine |
||
517 | Cumul := ClientDataSetFeedsMetCys.Value; |
||
518 | 5: // Tryptophane |
||
519 | Cumul := ClientDataSetFeedsTrp.Value; |
||
520 | 6: // Isoleucine |
||
521 | Cumul := ClientDataSetFeedsIle.Value; |
||
522 | 7: // Valine |
||
523 | Cumul := ClientDataSetFeedsVal.Value; |
||
524 | 8: // Leucine |
||
525 | Cumul := ClientDataSetFeedsLeu.Value; |
||
526 | 9: // Ph?nylalanine |
||
527 | Cumul := ClientDataSetFeedsPhe.Value; |
||
528 | 10: // Tyrosine |
||
529 | Cumul := ClientDataSetFeedsTyr.Value; |
||
530 | 11: // Ph?nylalanine + Tyrosine |
||
531 | Cumul := ClientDataSetFeedsPheTyr.Value; |
||
532 | 12: // Histidine |
||
533 | Cumul := ClientDataSetFeedsHis.Value; |
||
534 | 13: // Arginine |
||
535 | Cumul := ClientDataSetFeedsArg.Value; |
||
536 | 14: // Alanine |
||
537 | Cumul := ClientDataSetFeedsAla.Value; |
||
538 | 15: // Aspartate |
||
539 | Cumul := ClientDataSetFeedsAsp.Value; |
||
540 | 16: // Glutamate |
||
541 | Cumul := ClientDataSetFeedsGlu.Value; |
||
542 | 17: // Glycine |
||
543 | Cumul := ClientDataSetFeedsGly.Value; |
||
544 | 18: // S?rine |
||
545 | Cumul := ClientDataSetFeedsSer.Value; |
||
546 | 19: // Proline |
||
547 | Cumul := ClientDataSetFeedsPro.Value; |
||
548 | else
|
||
549 | Cumul := 0;
|
||
550 | end;
|
||
551 | 3: // Acides amin?s digestibles |
||
552 | case ComboBoxAA1.ItemIndex of |
||
553 | 0: // Lysine |
||
554 | Cumul := ClientDataSetFeedsLysd.Value; |
||
555 | 1: // Thr?onine |
||
556 | Cumul := ClientDataSetFeedsThrd.Value; |
||
557 | 2: // M?thionine |
||
558 | Cumul := ClientDataSetFeedsMetd.Value; |
||
559 | 3: // Cyst?ine |
||
560 | Cumul := ClientDataSetFeedsCysd.Value; |
||
561 | 4: // M?thionine + Cyst?ine |
||
562 | Cumul := ClientDataSetFeedsMetCysd.Value; |
||
563 | 5: // Tryptophane |
||
564 | Cumul := ClientDataSetFeedsTrpd.Value; |
||
565 | 6: // Isoleucine |
||
566 | Cumul := ClientDataSetFeedsIled.Value; |
||
567 | 7: // Valine |
||
568 | Cumul := ClientDataSetFeedsVald.Value; |
||
569 | 8: // Leucine |
||
570 | Cumul := ClientDataSetFeedsLeud.Value; |
||
571 | 9: // Ph?nylalanine |
||
572 | Cumul := ClientDataSetFeedsPhed.Value; |
||
573 | 10: // Tyrosine |
||
574 | Cumul := ClientDataSetFeedsTyrd.Value; |
||
575 | 11: // Ph?nylalanine + Tyrosine |
||
576 | Cumul := ClientDataSetFeedsPheTyrd.Value; |
||
577 | 12: // Histidine |
||
578 | Cumul := ClientDataSetFeedsHisd.Value; |
||
579 | 13: // Arginine |
||
580 | Cumul := ClientDataSetFeedsArgd.Value; |
||
581 | 14: // Alanine |
||
582 | Cumul := ClientDataSetFeedsAlad.Value; |
||
583 | 15: // Aspartate |
||
584 | Cumul := ClientDataSetFeedsAspd.Value; |
||
585 | 16: // Glutamate |
||
586 | Cumul := ClientDataSetFeedsGlud.Value; |
||
587 | 17: // Glycine |
||
588 | Cumul := ClientDataSetFeedsGlyd.Value; |
||
589 | 18: // S?rine |
||
590 | Cumul := ClientDataSetFeedsSerd.Value; |
||
591 | 19: // Proline |
||
592 | Cumul := ClientDataSetFeedsProd.Value; |
||
593 | else
|
||
594 | Cumul := 0;
|
||
595 | end;
|
||
596 | 4: // Min?raux |
||
597 | case ComboBoxMinerals1.ItemIndex of |
||
598 | 0: // Calcium |
||
599 | Cumul := ClientDataSetFeedsCa.Value; |
||
600 | 1: // Phosphore |
||
601 | Cumul := ClientDataSetFeedsP.Value; |
||
602 | 4 | avalancogn | 2: // Sodium |
603 | Cumul := ClientDataSetFeedsNa.Value; |
||
604 | 3: // Potassium |
||
605 | Cumul := ClientDataSetFeedsK.Value; |
||
606 | 4: // Chlore |
||
607 | Cumul := ClientDataSetFeedsCl.Value; |
||
608 | 5: // Phosphore digestible |
||
609 | 1 | avalancogn | Cumul := ClientDataSetFeedsPd.Value; |
610 | 5 | avalancogn | 6: // Bilan ?lectrolytique |
611 | Cumul := ClientDataSetFeedsBE.Value; |
||
612 | 1 | avalancogn | else
|
613 | Cumul := 0;
|
||
614 | end;
|
||
615 | else
|
||
616 | Cumul := 0;
|
||
617 | end;
|
||
618 | if Cumul = 0 |
||
619 | then // Division par z?ro |
||
620 | Cumul := 1;
|
||
621 | ClientDataSetComposition.First; |
||
622 | Total := 0;
|
||
623 | while not ClientDataSetComposition.Eof do |
||
624 | begin
|
||
625 | if ClientDataSetCompositionUser.Value
|
||
626 | then
|
||
627 | ClientDataSetIngredients.Filter := Format('Id = %d and User', [ClientDataSetCompositionIngredient.Value])
|
||
628 | else
|
||
629 | ClientDataSetIngredients.Filter := Format('Id = %d and not User', [ClientDataSetCompositionIngredient.Value]);
|
||
630 | ClientDataSetIngredients.Filtered := True; |
||
631 | IngredientName := StrTrunc(ClientDataSetIngredientsName.Value, 25);
|
||
632 | Ratio := InputIncorporation(ClientDataSetCompositionLevel.Value, FormOptions.Incorporation); |
||
633 | if (FormOptions.Expression = 0) |
||
634 | and ((ComboBoxType1.ItemIndex <> 0) or (ComboBoxProximal1.ItemIndex > 1)) |
||
635 | then // Conversion frais -> sec (mati?re s?che de la mati?re premi?re) - except? pour Composition et MS |
||
636 | Ratio := Ratio / InputProximal(ClientDataSetIngredientsMS.Value, 1, 1, FormOptions.Proximal); |
||
637 | RapMS := InputProximal(ClientDataSetCompositionMS.Value, 1, 1, FormOptions.Proximal); |
||
638 | if ((ComboBoxType1.ItemIndex <> 0) or (ComboBoxProximal1.ItemIndex > 1)) |
||
639 | then // Conversion sec -> frais (mati?re s?che de la composition) - except? pour Composition et MS |
||
640 | Ratio := Ratio * RapMS; |
||
641 | case ComboBoxType1.ItemIndex of |
||
642 | 0: // Analyse proximale |
||
643 | case ComboBoxProximal1.ItemIndex of |
||
644 | 0: // Composition |
||
645 | Value := OutputProximal(Ratio, 1, 1, FormOptions.Proximal); |
||
646 | 1: // MS |
||
647 | Value := ClientDataSetCompositionMS.Value * Ratio; |
||
648 | 2: // MM |
||
649 | Value := ClientDataSetIngredientsMM.Value * Ratio; |
||
650 | 3: // MAT |
||
651 | Value := ClientDataSetIngredientsMAT.Value * Ratio; |
||
652 | 4: // MG |
||
653 | Value := ClientDataSetIngredientsMG.Value * Ratio; |
||
654 | 5: // CB |
||
655 | Value := ClientDataSetIngredientsCB.Value * Ratio; |
||
656 | 6: // NDF |
||
657 | Value := ClientDataSetIngredientsNDF.Value * Ratio; |
||
658 | 7: // ADF |
||
659 | Value := ClientDataSetIngredientsADF.Value * Ratio; |
||
660 | 8: // ADL |
||
661 | Value := ClientDataSetIngredientsADL.Value * Ratio; |
||
662 | 9: // Amidon |
||
663 | Value := ClientDataSetIngredientsAmidon.Value * Ratio; |
||
664 | 10: // Sucres |
||
665 | Value := ClientDataSetIngredientsSucres.Value * Ratio; |
||
666 | else
|
||
667 | Value := 0;
|
||
668 | end;
|
||
669 | 1: // Valeurs ?nerg?tiques |
||
670 | case ComboBoxEnergy1.ItemIndex of |
||
671 | 0: // Energie brute |
||
672 | Value := ClientDataSetIngredientsEB.Value * Ratio; |
||
673 | 1: // Energie digestible (porc croissance) |
||
674 | Value := ClientDataSetIngredientsEDc.Value * Ratio; |
||
675 | 2: // Energie digestible (porc adulte) |
||
676 | Value := ClientDataSetIngredientsEDt.Value * Ratio; |
||
677 | 3: // Energie m?tabolisable (porc croissance) |
||
678 | Value := ClientDataSetIngredientsEMc.Value * Ratio; |
||
679 | 4: // Energie m?tabolisable (porc adulte) |
||
680 | Value := ClientDataSetIngredientsEMt.Value * Ratio; |
||
681 | 5: // Energie nette (porc croissance) |
||
682 | Value := ClientDataSetIngredientsENc.Value * Ratio; |
||
683 | 6: // Energie nette (porc adulte) |
||
684 | Value := ClientDataSetIngredientsENt.Value * Ratio; |
||
685 | else
|
||
686 | Value := 0;
|
||
687 | end;
|
||
688 | 2: // Acides amin?s totaux |
||
689 | case ComboBoxAA1.ItemIndex of |
||
690 | 0: // Lysine |
||
691 | Value := ClientDataSetIngredientsLys.Value * Ratio; |
||
692 | 1: // Thr?onine |
||
693 | Value := ClientDataSetIngredientsThr.Value * Ratio; |
||
694 | 2: // M?thionine |
||
695 | Value := ClientDataSetIngredientsMet.Value * Ratio; |
||
696 | 3: // Cyst?ine |
||
697 | Value := ClientDataSetIngredientsCys.Value * Ratio; |
||
698 | 4: // M?thionine + Cyst?ine |
||
699 | Value := ClientDataSetIngredientsMetCys.Value * Ratio; |
||
700 | 5: // Tryptophane |
||
701 | Value := ClientDataSetIngredientsTrp.Value * Ratio; |
||
702 | 6: // Isoleucine |
||
703 | Value := ClientDataSetIngredientsIle.Value * Ratio; |
||
704 | 7: // Valine |
||
705 | Value := ClientDataSetIngredientsVal.Value * Ratio; |
||
706 | 8: // Leucine |
||
707 | Value := ClientDataSetIngredientsLeu.Value * Ratio; |
||
708 | 9: // Ph?nylalanine |
||
709 | Value := ClientDataSetIngredientsPhe.Value * Ratio; |
||
710 | 10: // Tyrosine |
||
711 | Value := ClientDataSetIngredientsTyr.Value * Ratio; |
||
712 | 11: // Ph?nylalanine + Tyrosine |
||
713 | Value := ClientDataSetIngredientsPheTyr.Value * Ratio; |
||
714 | 12: // Histidine |
||
715 | Value := ClientDataSetIngredientsHis.Value * Ratio; |
||
716 | 13: // Arginine |
||
717 | Value := ClientDataSetIngredientsArg.Value * Ratio; |
||
718 | 14: // Alanine |
||
719 | Value := ClientDataSetIngredientsAla.Value * Ratio; |
||
720 | 15: // Aspartate |
||
721 | Value := ClientDataSetIngredientsAsp.Value * Ratio; |
||
722 | 16: // Glutamate |
||
723 | Value := ClientDataSetIngredientsGlu.Value * Ratio; |
||
724 | 17: // Glycine |
||
725 | Value := ClientDataSetIngredientsGly.Value * Ratio; |
||
726 | 18: // S?rine |
||
727 | Value := ClientDataSetIngredientsSer.Value * Ratio; |
||
728 | 19: // Proline |
||
729 | Value := ClientDataSetIngredientsPro.Value * Ratio; |
||
730 | else
|
||
731 | Value := 0;
|
||
732 | end;
|
||
733 | 3: // Acides amin?s digestibles |
||
734 | case ComboBoxAA1.ItemIndex of |
||
735 | 0: // Lysine |
||
736 | Value := ClientDataSetIngredientsLysd.Value * Ratio; |
||
737 | 1: // Thr?onine |
||
738 | Value := ClientDataSetIngredientsThrd.Value * Ratio; |
||
739 | 2: // M?thionine |
||
740 | Value := ClientDataSetIngredientsMetd.Value * Ratio; |
||
741 | 3: // Cyst?ine |
||
742 | Value := ClientDataSetIngredientsCysd.Value * Ratio; |
||
743 | 4: // M?thionine + Cyst?ine |
||
744 | Value := ClientDataSetIngredientsMetCysd.Value * Ratio; |
||
745 | 5: // Tryptophane |
||
746 | Value := ClientDataSetIngredientsTrpd.Value * Ratio; |
||
747 | 6: // Isoleucine |
||
748 | Value := ClientDataSetIngredientsIled.Value * Ratio; |
||
749 | 7: // Valine |
||
750 | Value := ClientDataSetIngredientsVald.Value * Ratio; |
||
751 | 8: // Leucine |
||
752 | Value := ClientDataSetIngredientsLeud.Value * Ratio; |
||
753 | 9: // Ph?nylalanine |
||
754 | Value := ClientDataSetIngredientsPhed.Value * Ratio; |
||
755 | 10: // Tyrosine |
||
756 | Value := ClientDataSetIngredientsTyrd.Value * Ratio; |
||
757 | 11: // Ph?nylalanine + Tyrosine |
||
758 | Value := ClientDataSetIngredientsPheTyrd.Value * Ratio; |
||
759 | 12: // Histidine |
||
760 | Value := ClientDataSetIngredientsHisd.Value * Ratio; |
||
761 | 13: // Arginine |
||
762 | Value := ClientDataSetIngredientsArgd.Value * Ratio; |
||
763 | 14: // Alanine |
||
764 | Value := ClientDataSetIngredientsAlad.Value * Ratio; |
||
765 | 15: // Aspartate |
||
766 | Value := ClientDataSetIngredientsAspd.Value * Ratio; |
||
767 | 16: // Glutamate |
||
768 | Value := ClientDataSetIngredientsGlud.Value * Ratio; |
||
769 | 17: // Glycine |
||
770 | Value := ClientDataSetIngredientsGlyd.Value * Ratio; |
||
771 | 18: // S?rine |
||
772 | Value := ClientDataSetIngredientsSerd.Value * Ratio; |
||
773 | 19: // Proline |
||
774 | Value := ClientDataSetIngredientsProd.Value * Ratio; |
||
775 | else
|
||
776 | Value := 0;
|
||
777 | end;
|
||
778 | 4: // Min?raux |
||
779 | case ComboBoxMinerals1.ItemIndex of |
||
780 | 0: // Calcium |
||
781 | Value := ClientDataSetIngredientsCa.Value * Ratio; |
||
782 | 1: // Phosphore |
||
783 | Value := ClientDataSetIngredientsP.Value * Ratio; |
||
784 | 4 | avalancogn | 2: // Sodium |
785 | Value := ClientDataSetIngredientsNa.Value * Ratio; |
||
786 | 3: // Potassium |
||
787 | Value := ClientDataSetIngredientsK.Value * Ratio; |
||
788 | 4: // Chlore |
||
789 | Value := ClientDataSetIngredientsCl.Value * Ratio; |
||
790 | 5: // Phosphore digestible |
||
791 | 1 | avalancogn | if ClientDataSetFeedsPresentation.Value = 0 |
792 | then // Farine (dPphy) |
||
793 | Value := ClientDataSetIngredientsdPphy.Value / 100 * ClientDataSetIngredientsP.Value * Ratio
|
||
794 | else // Granul?s (dP) |
||
795 | Value := ClientDataSetIngredientsdP.Value / 100 * ClientDataSetIngredientsP.Value * Ratio;
|
||
796 | 5 | avalancogn | 6: // Bilan ?lectrolytique |
797 | Value := ClientDataSetIngredientsBE.Value * Ratio; |
||
798 | 1 | avalancogn | else
|
799 | Value := 0;
|
||
800 | end;
|
||
801 | else
|
||
802 | Value := 0;
|
||
803 | end;
|
||
804 | if (FormOptions.Expression = 1) |
||
805 | and ((ComboBoxType1.ItemIndex <> 0) or (ComboBoxProximal1.ItemIndex > 1)) |
||
806 | then // Conversion frais -> sec (mati?re s?che du r?gime) - except? pour Composition et MS |
||
807 | Value := Value / InputProximal(ClientDataSetFeedsMS.Value, 1, 1, FormOptions.Proximal); |
||
808 | if Value > 0 |
||
809 | then // Prendre en compte la valeur |
||
810 | begin
|
||
811 | FeedBar := TBarSeries.Create(Chart1); |
||
812 | FeedBar.ParentChart := Chart1; |
||
813 | FeedBar.Title := Format('%s (%1.2f %%)', [IngredientName, Value / Cumul * 100]); |
||
814 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
815 | FeedBar.MultiBar := mbStacked100; |
||
816 | FeedBar.Marks.Visible := False; |
||
817 | Chart1.AddSeries(FeedBar); |
||
818 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
819 | Total := Total + Value; |
||
820 | end;
|
||
821 | ClientDataSetComposition.Next; |
||
822 | end;
|
||
823 | ClientDataSetIngredients.Filtered := False; |
||
824 | ClientDataSetIngredients.Filter := '';
|
||
825 | // Cas particuliers
|
||
826 | if (ComboBoxType1.ItemIndex = 1) |
||
827 | and ((ComboBoxEnergy1.ItemIndex = 1) |
||
828 | or (ComboBoxEnergy1.ItemIndex = 3) |
||
829 | or (ComboBoxEnergy1.ItemIndex = 5)) |
||
830 | and (ClientDataSetFeedsBonusC.Value > 0) |
||
831 | then // Bonus ?nergie (porc croissance) |
||
832 | begin
|
||
833 | case ComboBoxEnergy1.ItemIndex of |
||
834 | 1: Value := ClientDataSetFeedsEDc.Value - Total;
|
||
835 | 3: Value := ClientDataSetFeedsEMc.Value - Total;
|
||
836 | 5: Value := ClientDataSetFeedsENc.Value - Total;
|
||
837 | else Value := 0; |
||
838 | end;
|
||
839 | FeedBar := TBarSeries.Create(Chart1); |
||
840 | FeedBar.ParentChart := Chart1; |
||
841 | FeedBar.Title := Format('%s (%1.2f %%)', [_('Energy bonus'), Value / Cumul * 100]); |
||
842 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
843 | FeedBar.MultiBar := mbStacked100; |
||
844 | FeedBar.Marks.Visible := False; |
||
845 | Chart1.AddSeries(FeedBar); |
||
846 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
847 | Total := Total + Value; |
||
848 | end;
|
||
849 | if (ComboBoxType1.ItemIndex = 1) |
||
850 | and ((ComboBoxEnergy1.ItemIndex = 2) |
||
851 | or (ComboBoxEnergy1.ItemIndex = 4) |
||
852 | or (ComboBoxEnergy1.ItemIndex = 6)) |
||
853 | and (ClientDataSetFeedsBonusT.Value > 0) |
||
854 | then // Bonus ?nergie (porc adulte) |
||
855 | begin
|
||
856 | case ComboBoxEnergy1.ItemIndex of |
||
857 | 2: Value := ClientDataSetFeedsEDt.Value - Total;
|
||
858 | 4: Value := ClientDataSetFeedsEMt.Value - Total;
|
||
859 | 6: Value := ClientDataSetFeedsENt.Value - Total;
|
||
860 | else Value := 0; |
||
861 | end;
|
||
862 | FeedBar := TBarSeries.Create(Chart1); |
||
863 | FeedBar.ParentChart := Chart1; |
||
864 | FeedBar.Title := Format('%s (%1.2f %%)', [_('Energy bonus'), Value / Cumul * 100]); |
||
865 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
866 | FeedBar.MultiBar := mbStacked100; |
||
867 | FeedBar.Marks.Visible := False; |
||
868 | Chart1.AddSeries(FeedBar); |
||
869 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
870 | Total := Total + Value; |
||
871 | end;
|
||
872 | if (ComboBoxType1.ItemIndex = 0) |
||
873 | and (ComboBoxProximal1.ItemIndex = 0) |
||
874 | and not ClientDataSetFeedsPhytaseId.IsNull |
||
875 | and (ClientDataSetFeedsPhytaseLevel.Value > 0) |
||
876 | then // Phytase (taux d'incorporation) |
||
877 | begin
|
||
878 | Ratio := InputIncorporation(ClientDataSetFeedsPhytaseLevel.Value, FormOptions.Incorporation); |
||
879 | Value := OutputProximal(Ratio, 1, 1, FormOptions.Proximal); |
||
880 | FeedBar := TBarSeries.Create(Chart1); |
||
881 | FeedBar.ParentChart := Chart1; |
||
882 | FeedBar.Title := Format('%s (%1.2f %%)', [_('Phytase'), Value / Cumul * 100]); |
||
883 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
884 | FeedBar.MultiBar := mbStacked100; |
||
885 | FeedBar.Marks.Visible := False; |
||
886 | Chart1.AddSeries(FeedBar); |
||
887 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
888 | Total := Total + Value; |
||
889 | end;
|
||
890 | if (ComboBoxType1.ItemIndex = 4) |
||
891 | and (ComboBoxMinerals1.ItemIndex = 2) |
||
892 | and not ClientDataSetFeedsPhytaseId.IsNull |
||
893 | and (ClientDataSetFeedsPd.Value > Total)
|
||
894 | then // Phytase (Phosphore digestible) |
||
895 | begin
|
||
896 | Value := ClientDataSetFeedsPd.Value - Total; |
||
897 | FeedBar := TBarSeries.Create(Chart1); |
||
898 | FeedBar.ParentChart := Chart1; |
||
899 | FeedBar.Title := Format('%s (%1.2f %%)', [_('Phytase'), Value / Cumul * 100]); |
||
900 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
901 | FeedBar.MultiBar := mbStacked100; |
||
902 | FeedBar.Marks.Visible := False; |
||
903 | Chart1.AddSeries(FeedBar); |
||
904 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
905 | Total := Total + Value; |
||
906 | end;
|
||
907 | // Total
|
||
908 | case ComboBoxType1.ItemIndex of |
||
909 | 0: // Analyse proximale |
||
910 | if (FormOptions.Expression = 0) or (ComboBoxProximal1.ItemIndex < 2) |
||
911 | then // sur frais |
||
912 | Chart1.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.ProximalDecimals, Total, FormOptions.ComboBoxProximal.Items[FormOptions.Proximal]])) |
||
913 | else // sur mati?re s?che - except? pour Composition et MS |
||
914 | Chart1.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.ProximalDecimals, Total, FormOptions.ComboBoxProximal.Items[FormOptions.Proximal], _('DM')])); |
||
915 | 1: // Valeurs ?nerg?tiques |
||
916 | if FormOptions.Expression = 0 |
||
917 | then // sur frais |
||
918 | Chart1.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.EnergyDecimals, Total, FormOptions.ComboBoxEnergy.Items[FormOptions.Energy]])) |
||
919 | else // sur mati?re s?che |
||
920 | Chart1.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.EnergyDecimals, Total, FormOptions.ComboBoxEnergy.Items[FormOptions.Energy], _('DM')])); |
||
921 | 2, 3: // Acides amin?s |
||
922 | if FormOptions.Expression = 0 |
||
923 | then // sur frais |
||
924 | Chart1.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.AADecimals, Total, FormOptions.ComboBoxAA.Items[FormOptions.AA]])) |
||
925 | else // sur mati?re s?che |
||
926 | Chart1.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.AADecimals, Total, FormOptions.ComboBoxAA.Items[FormOptions.AA], _('DM')])); |
||
927 | 4: // Min?raux |
||
928 | 5 | avalancogn | if ComboBoxMinerals1.ItemIndex = 6 |
929 | then // Bilan ?lectrolytique |
||
930 | if FormOptions.Expression = 0 |
||
931 | then // sur frais |
||
932 | Chart1.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), 1, Total, _('mEq/kg')])) |
||
933 | else // sur mati?re s?che |
||
934 | Chart1.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), 1, Total, _('mEq/kg'), _('DM')])) |
||
935 | else
|
||
936 | if FormOptions.Expression = 0 |
||
937 | then // sur frais |
||
938 | Chart1.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.MineralsDecimals, Total, FormOptions.ComboBoxMinerals.Items[FormOptions.Minerals]])) |
||
939 | else // sur mati?re s?che |
||
940 | Chart1.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.MineralsDecimals, Total, FormOptions.ComboBoxMinerals.Items[FormOptions.Minerals], _('DM')])); |
||
941 | 1 | avalancogn | end;
|
942 | end;
|
||
943 | end;
|
||
944 | |||
945 | procedure TFormFeedCharts.ComboBoxOption2Change(Sender: TObject);
|
||
946 | var
|
||
947 | IngredientName: String;
|
||
948 | Cumul, Ratio, Total, Value: Double; |
||
949 | FeedBar: TBarSeries; |
||
950 | begin
|
||
951 | // while Chart2.SeriesCount > 0 do
|
||
952 | // Chart2.Series[0].Free;
|
||
953 | Chart2.FreeAllSeries(nil);
|
||
954 | Chart2.SubTitle.Clear; |
||
955 | with DataModuleDeclaration do |
||
956 | begin
|
||
957 | Chart2.AxisVisible := True; |
||
958 | Chart2.SubTitle.Text.Add(ComboBoxType2.Text); |
||
959 | case ComboBoxType2.ItemIndex of |
||
960 | 0: // Analyse proximale |
||
961 | Chart2.SubTitle.Text.Add(ComboBoxProximal2.Text); |
||
962 | 1: // Valeurs ?nerg?tiques |
||
963 | Chart2.SubTitle.Text.Add(ComboBoxEnergy2.Text); |
||
964 | 2, 3: // Acides amin?s |
||
965 | Chart2.SubTitle.Text.Add(ComboBoxAA2.Text); |
||
966 | 4: // Min?raux |
||
967 | Chart2.SubTitle.Text.Add(ComboBoxMinerals2.Text); |
||
968 | end;
|
||
969 | case ComboBoxType2.ItemIndex of |
||
970 | 0: // Analyse proximale |
||
971 | case ComboBoxProximal2.ItemIndex of |
||
972 | 0: // Composition |
||
973 | Cumul := OutputIncorporation(1, FormOptions.Incorporation);
|
||
974 | 1: // MS |
||
975 | Cumul := ClientDataSetFeedsMS.Value; |
||
976 | 2: // MM |
||
977 | Cumul := ClientDataSetFeedsMM.Value; |
||
978 | 3: // MAT |
||
979 | Cumul := ClientDataSetFeedsMAT.Value; |
||
980 | 4: // MG |
||
981 | Cumul := ClientDataSetFeedsMG.Value; |
||
982 | 5: // CB |
||
983 | Cumul := ClientDataSetFeedsCB.Value; |
||
984 | 6: // NDF |
||
985 | Cumul := ClientDataSetFeedsNDF.Value; |
||
986 | 7: // ADF |
||
987 | Cumul := ClientDataSetFeedsADF.Value; |
||
988 | 8: // ADL |
||
989 | Cumul := ClientDataSetFeedsADL.Value; |
||
990 | 9: // Amidon |
||
991 | Cumul := ClientDataSetFeedsAmidon.Value; |
||
992 | 10: // Sucres |
||
993 | Cumul := ClientDataSetFeedsSucres.Value; |
||
994 | else
|
||
995 | Cumul := 0;
|
||
996 | end;
|
||
997 | 1: // Valeurs ?nerg?tiques |
||
998 | case ComboBoxEnergy2.ItemIndex of |
||
999 | 0: // Energie brute |
||
1000 | Cumul := ClientDataSetFeedsEB.Value; |
||
1001 | 1: // Energie digestible (porc croissance) |
||
1002 | Cumul := ClientDataSetFeedsEDc.Value; |
||
1003 | 2: // Energie digestible (porc adulte) |
||
1004 | Cumul := ClientDataSetFeedsEDt.Value; |
||
1005 | 3: // Energie m?tabolisable (porc croissance) |
||
1006 | Cumul := ClientDataSetFeedsEMc.Value; |
||
1007 | 4: // Energie m?tabolisable (porc adulte) |
||
1008 | Cumul := ClientDataSetFeedsEMt.Value; |
||
1009 | 5: // Energie nette (porc croissance) |
||
1010 | Cumul := ClientDataSetFeedsENc.Value; |
||
1011 | 6: // Energie nette (porc adulte) |
||
1012 | Cumul := ClientDataSetFeedsENt.Value; |
||
1013 | else
|
||
1014 | Cumul := 0;
|
||
1015 | end;
|
||
1016 | 2: // Acides amin?s totaux |
||
1017 | case ComboBoxAA2.ItemIndex of |
||
1018 | 0: // Lysine |
||
1019 | Cumul := ClientDataSetFeedsLys.Value; |
||
1020 | 1: // Thr?onine |
||
1021 | Cumul := ClientDataSetFeedsThr.Value; |
||
1022 | 2: // M?thionine |
||
1023 | Cumul := ClientDataSetFeedsMet.Value; |
||
1024 | 3: // Cyst?ine |
||
1025 | Cumul := ClientDataSetFeedsCys.Value; |
||
1026 | 4: // M?thionine + Cyst?ine |
||
1027 | Cumul := ClientDataSetFeedsMetCys.Value; |
||
1028 | 5: // Tryptophane |
||
1029 | Cumul := ClientDataSetFeedsTrp.Value; |
||
1030 | 6: // Isoleucine |
||
1031 | Cumul := ClientDataSetFeedsIle.Value; |
||
1032 | 7: // Valine |
||
1033 | Cumul := ClientDataSetFeedsVal.Value; |
||
1034 | 8: // Leucine |
||
1035 | Cumul := ClientDataSetFeedsLeu.Value; |
||
1036 | 9: // Ph?nylalanine |
||
1037 | Cumul := ClientDataSetFeedsPhe.Value; |
||
1038 | 10: // Tyrosine |
||
1039 | Cumul := ClientDataSetFeedsTyr.Value; |
||
1040 | 11: // Ph?nylalanine + Tyrosine |
||
1041 | Cumul := ClientDataSetFeedsPheTyr.Value; |
||
1042 | 12: // Histidine |
||
1043 | Cumul := ClientDataSetFeedsHis.Value; |
||
1044 | 13: // Arginine |
||
1045 | Cumul := ClientDataSetFeedsArg.Value; |
||
1046 | 14: // Alanine |
||
1047 | Cumul := ClientDataSetFeedsAla.Value; |
||
1048 | 15: // Aspartate |
||
1049 | Cumul := ClientDataSetFeedsAsp.Value; |
||
1050 | 16: // Glutamate |
||
1051 | Cumul := ClientDataSetFeedsGlu.Value; |
||
1052 | 17: // Glycine |
||
1053 | Cumul := ClientDataSetFeedsGly.Value; |
||
1054 | 18: // S?rine |
||
1055 | Cumul := ClientDataSetFeedsSer.Value; |
||
1056 | 19: // Proline |
||
1057 | Cumul := ClientDataSetFeedsPro.Value; |
||
1058 | else
|
||
1059 | Cumul := 0;
|
||
1060 | end;
|
||
1061 | 3: // Acides amin?s digestibles |
||
1062 | case ComboBoxAA2.ItemIndex of |
||
1063 | 0: // Lysine |
||
1064 | Cumul := ClientDataSetFeedsLysd.Value; |
||
1065 | 1: // Thr?onine |
||
1066 | Cumul := ClientDataSetFeedsThrd.Value; |
||
1067 | 2: // M?thionine |
||
1068 | Cumul := ClientDataSetFeedsMetd.Value; |
||
1069 | 3: // Cyst?ine |
||
1070 | Cumul := ClientDataSetFeedsCysd.Value; |
||
1071 | 4: // M?thionine + Cyst?ine |
||
1072 | Cumul := ClientDataSetFeedsMetCysd.Value; |
||
1073 | 5: // Tryptophane |
||
1074 | Cumul := ClientDataSetFeedsTrpd.Value; |
||
1075 | 6: // Isoleucine |
||
1076 | Cumul := ClientDataSetFeedsIled.Value; |
||
1077 | 7: // Valine |
||
1078 | Cumul := ClientDataSetFeedsVald.Value; |
||
1079 | 8: // Leucine |
||
1080 | Cumul := ClientDataSetFeedsLeud.Value; |
||
1081 | 9: // Ph?nylalanine |
||
1082 | Cumul := ClientDataSetFeedsPhed.Value; |
||
1083 | 10: // Tyrosine |
||
1084 | Cumul := ClientDataSetFeedsTyrd.Value; |
||
1085 | 11: // Ph?nylalanine + Tyrosine |
||
1086 | Cumul := ClientDataSetFeedsPheTyrd.Value; |
||
1087 | 12: // Histidine |
||
1088 | Cumul := ClientDataSetFeedsHisd.Value; |
||
1089 | 13: // Arginine |
||
1090 | Cumul := ClientDataSetFeedsArgd.Value; |
||
1091 | 14: // Alanine |
||
1092 | Cumul := ClientDataSetFeedsAlad.Value; |
||
1093 | 15: // Aspartate |
||
1094 | Cumul := ClientDataSetFeedsAspd.Value; |
||
1095 | 16: // Glutamate |
||
1096 | Cumul := ClientDataSetFeedsGlud.Value; |
||
1097 | 17: // Glycine |
||
1098 | Cumul := ClientDataSetFeedsGlyd.Value; |
||
1099 | 18: // S?rine |
||
1100 | Cumul := ClientDataSetFeedsSerd.Value; |
||
1101 | 19: // Proline |
||
1102 | Cumul := ClientDataSetFeedsProd.Value; |
||
1103 | else
|
||
1104 | Cumul := 0;
|
||
1105 | end;
|
||
1106 | 4: // Min?raux |
||
1107 | case ComboBoxMinerals2.ItemIndex of |
||
1108 | 0: // Calcium |
||
1109 | Cumul := ClientDataSetFeedsCa.Value; |
||
1110 | 1: // Phosphore |
||
1111 | Cumul := ClientDataSetFeedsP.Value; |
||
1112 | 4 | avalancogn | 2: // Sodium |
1113 | Cumul := ClientDataSetFeedsNa.Value; |
||
1114 | 3: // Potassium |
||
1115 | Cumul := ClientDataSetFeedsK.Value; |
||
1116 | 4: // Chlore |
||
1117 | Cumul := ClientDataSetFeedsCl.Value; |
||
1118 | 5: // Phosphore digestible |
||
1119 | 1 | avalancogn | Cumul := ClientDataSetFeedsPd.Value; |
1120 | 5 | avalancogn | 6: // Bilan ?lectrolytique |
1121 | Cumul := ClientDataSetFeedsBE.Value; |
||
1122 | 1 | avalancogn | else
|
1123 | Cumul := 0;
|
||
1124 | end;
|
||
1125 | else
|
||
1126 | Cumul := 0;
|
||
1127 | end;
|
||
1128 | if Cumul = 0 |
||
1129 | then // Division par z?ro |
||
1130 | Cumul := 1;
|
||
1131 | ClientDataSetComposition.First; |
||
1132 | Total := 0;
|
||
1133 | while not ClientDataSetComposition.Eof do |
||
1134 | begin
|
||
1135 | if ClientDataSetCompositionUser.Value
|
||
1136 | then
|
||
1137 | ClientDataSetIngredients.Filter := Format('Id = %d and User', [ClientDataSetCompositionIngredient.Value])
|
||
1138 | else
|
||
1139 | ClientDataSetIngredients.Filter := Format('Id = %d and not User', [ClientDataSetCompositionIngredient.Value]);
|
||
1140 | ClientDataSetIngredients.Filtered := True; |
||
1141 | IngredientName := StrTrunc(ClientDataSetIngredientsName.Value, 25);
|
||
1142 | Ratio := InputIncorporation(ClientDataSetCompositionLevel.Value, FormOptions.Incorporation); |
||
1143 | if (FormOptions.Expression = 0) |
||
1144 | and ((ComboBoxType2.ItemIndex <> 0) or (ComboBoxProximal2.ItemIndex > 1)) |
||
1145 | then // Conversion frais -> sec (mati?re s?che de la mati?re premi?re) - except? pour Composition et MS |
||
1146 | Ratio := Ratio / InputProximal(ClientDataSetIngredientsMS.Value, 1, 1, FormOptions.Proximal); |
||
1147 | RapMS := InputProximal(ClientDataSetCompositionMS.Value, 1, 1, FormOptions.Proximal); |
||
1148 | if ((ComboBoxType2.ItemIndex <> 0) or (ComboBoxProximal2.ItemIndex > 1)) |
||
1149 | then // Conversion sec -> frais (mati?re s?che de la composition) - except? pour Composition et MS |
||
1150 | Ratio := Ratio * RapMS; |
||
1151 | case ComboBoxType2.ItemIndex of |
||
1152 | 0: // Analyse proximale |
||
1153 | case ComboBoxProximal2.ItemIndex of |
||
1154 | 0: // Composition |
||
1155 | Value := OutputProximal(Ratio, 1, 1, FormOptions.Proximal); |
||
1156 | 1: // MS |
||
1157 | Value := ClientDataSetCompositionMS.Value * Ratio; |
||
1158 | 2: // MM |
||
1159 | Value := ClientDataSetIngredientsMM.Value * Ratio; |
||
1160 | 3: // MAT |
||
1161 | Value := ClientDataSetIngredientsMAT.Value * Ratio; |
||
1162 | 4: // MG |
||
1163 | Value := ClientDataSetIngredientsMG.Value * Ratio; |
||
1164 | 5: // CB |
||
1165 | Value := ClientDataSetIngredientsCB.Value * Ratio; |
||
1166 | 6: // NDF |
||
1167 | Value := ClientDataSetIngredientsNDF.Value * Ratio; |
||
1168 | 7: // ADF |
||
1169 | Value := ClientDataSetIngredientsADF.Value * Ratio; |
||
1170 | 8: // ADL |
||
1171 | Value := ClientDataSetIngredientsADL.Value * Ratio; |
||
1172 | 9: // Amidon |
||
1173 | Value := ClientDataSetIngredientsAmidon.Value * Ratio; |
||
1174 | 10: // Sucres |
||
1175 | Value := ClientDataSetIngredientsSucres.Value * Ratio; |
||
1176 | else
|
||
1177 | Value := 0;
|
||
1178 | end;
|
||
1179 | 1: // Valeurs ?nerg?tiques |
||
1180 | case ComboBoxEnergy2.ItemIndex of |
||
1181 | 0: // Energie brute |
||
1182 | Value := ClientDataSetIngredientsEB.Value * Ratio; |
||
1183 | 1: // Energie digestible (porc croissance) |
||
1184 | Value := ClientDataSetIngredientsEDc.Value * Ratio; |
||
1185 | 2: // Energie digestible (porc adulte) |
||
1186 | Value := ClientDataSetIngredientsEDt.Value * Ratio; |
||
1187 | 3: // Energie m?tabolisable (porc croissance) |
||
1188 | Value := ClientDataSetIngredientsEMc.Value * Ratio; |
||
1189 | 4: // Energie m?tabolisable (porc adulte) |
||
1190 | Value := ClientDataSetIngredientsEMt.Value * Ratio; |
||
1191 | 5: // Energie nette (porc croissance) |
||
1192 | Value := ClientDataSetIngredientsENc.Value * Ratio; |
||
1193 | 6: // Energie nette (porc adulte) |
||
1194 | Value := ClientDataSetIngredientsENt.Value * Ratio; |
||
1195 | else
|
||
1196 | Value := 0;
|
||
1197 | end;
|
||
1198 | 2: // Acides amin?s totaux |
||
1199 | case ComboBoxAA2.ItemIndex of |
||
1200 | 0: // Lysine |
||
1201 | Value := ClientDataSetIngredientsLys.Value * Ratio; |
||
1202 | 1: // Thr?onine |
||
1203 | Value := ClientDataSetIngredientsThr.Value * Ratio; |
||
1204 | 2: // M?thionine |
||
1205 | Value := ClientDataSetIngredientsMet.Value * Ratio; |
||
1206 | 3: // Cyst?ine |
||
1207 | Value := ClientDataSetIngredientsCys.Value * Ratio; |
||
1208 | 4: // M?thionine + Cyst?ine |
||
1209 | Value := ClientDataSetIngredientsMetCys.Value * Ratio; |
||
1210 | 5: // Tryptophane |
||
1211 | Value := ClientDataSetIngredientsTrp.Value * Ratio; |
||
1212 | 6: // Isoleucine |
||
1213 | Value := ClientDataSetIngredientsIle.Value * Ratio; |
||
1214 | 7: // Valine |
||
1215 | Value := ClientDataSetIngredientsVal.Value * Ratio; |
||
1216 | 8: // Leucine |
||
1217 | Value := ClientDataSetIngredientsLeu.Value * Ratio; |
||
1218 | 9: // Ph?nylalanine |
||
1219 | Value := ClientDataSetIngredientsPhe.Value * Ratio; |
||
1220 | 10: // Tyrosine |
||
1221 | Value := ClientDataSetIngredientsTyr.Value * Ratio; |
||
1222 | 11: // Ph?nylalanine + Tyrosine |
||
1223 | Value := ClientDataSetIngredientsPheTyr.Value * Ratio; |
||
1224 | 12: // Histidine |
||
1225 | Value := ClientDataSetIngredientsHis.Value * Ratio; |
||
1226 | 13: // Arginine |
||
1227 | Value := ClientDataSetIngredientsArg.Value * Ratio; |
||
1228 | 14: // Alanine |
||
1229 | Value := ClientDataSetIngredientsAla.Value * Ratio; |
||
1230 | 15: // Aspartate |
||
1231 | Value := ClientDataSetIngredientsAsp.Value * Ratio; |
||
1232 | 16: // Glutamate |
||
1233 | Value := ClientDataSetIngredientsGlu.Value * Ratio; |
||
1234 | 17: // Glycine |
||
1235 | Value := ClientDataSetIngredientsGly.Value * Ratio; |
||
1236 | 18: // S?rine |
||
1237 | Value := ClientDataSetIngredientsSer.Value * Ratio; |
||
1238 | 19: // Proline |
||
1239 | Value := ClientDataSetIngredientsPro.Value * Ratio; |
||
1240 | else
|
||
1241 | Value := 0;
|
||
1242 | end;
|
||
1243 | 3: // Acides amin?s digestibles |
||
1244 | case ComboBoxAA2.ItemIndex of |
||
1245 | 0: // Lysine |
||
1246 | Value := ClientDataSetIngredientsLysd.Value * Ratio; |
||
1247 | 1: // Thr?onine |
||
1248 | Value := ClientDataSetIngredientsThrd.Value * Ratio; |
||
1249 | 2: // M?thionine |
||
1250 | Value := ClientDataSetIngredientsMetd.Value * Ratio; |
||
1251 | 3: // Cyst?ine |
||
1252 | Value := ClientDataSetIngredientsCysd.Value * Ratio; |
||
1253 | 4: // M?thionine + Cyst?ine |
||
1254 | Value := ClientDataSetIngredientsMetCysd.Value * Ratio; |
||
1255 | 5: // Tryptophane |
||
1256 | Value := ClientDataSetIngredientsTrpd.Value * Ratio; |
||
1257 | 6: // Isoleucine |
||
1258 | Value := ClientDataSetIngredientsIled.Value * Ratio; |
||
1259 | 7: // Valine |
||
1260 | Value := ClientDataSetIngredientsVald.Value * Ratio; |
||
1261 | 8: // Leucine |
||
1262 | Value := ClientDataSetIngredientsLeud.Value * Ratio; |
||
1263 | 9: // Ph?nylalanine |
||
1264 | Value := ClientDataSetIngredientsPhed.Value * Ratio; |
||
1265 | 10: // Tyrosine |
||
1266 | Value := ClientDataSetIngredientsTyrd.Value * Ratio; |
||
1267 | 11: // Ph?nylalanine + Tyrosine |
||
1268 | Value := ClientDataSetIngredientsPheTyrd.Value * Ratio; |
||
1269 | 12: // Histidine |
||
1270 | Value := ClientDataSetIngredientsHisd.Value * Ratio; |
||
1271 | 13: // Arginine |
||
1272 | Value := ClientDataSetIngredientsArgd.Value * Ratio; |
||
1273 | 14: // Alanine |
||
1274 | Value := ClientDataSetIngredientsAlad.Value * Ratio; |
||
1275 | 15: // Aspartate |
||
1276 | Value := ClientDataSetIngredientsAspd.Value * Ratio; |
||
1277 | 16: // Glutamate |
||
1278 | Value := ClientDataSetIngredientsGlud.Value * Ratio; |
||
1279 | 17: // Glycine |
||
1280 | Value := ClientDataSetIngredientsGlyd.Value * Ratio; |
||
1281 | 18: // S?rine |
||
1282 | Value := ClientDataSetIngredientsSerd.Value * Ratio; |
||
1283 | 19: // Proline |
||
1284 | Value := ClientDataSetIngredientsProd.Value * Ratio; |
||
1285 | else
|
||
1286 | Value := 0;
|
||
1287 | end;
|
||
1288 | 4: // Min?raux |
||
1289 | case ComboBoxMinerals2.ItemIndex of |
||
1290 | 0: // Calcium |
||
1291 | Value := ClientDataSetIngredientsCa.Value * Ratio; |
||
1292 | 1: // Phosphore |
||
1293 | Value := ClientDataSetIngredientsP.Value * Ratio; |
||
1294 | 4 | avalancogn | 2: // Sodium |
1295 | Value := ClientDataSetIngredientsNa.Value * Ratio; |
||
1296 | 3: // Potassium |
||
1297 | Value := ClientDataSetIngredientsK.Value * Ratio; |
||
1298 | 4: // Chlore |
||
1299 | Value := ClientDataSetIngredientsCl.Value * Ratio; |
||
1300 | 5: // Phosphore digestible |
||
1301 | 1 | avalancogn | if ClientDataSetFeedsPresentation.Value = 0 |
1302 | then // Farine (dPphy) |
||
1303 | Value := ClientDataSetIngredientsdPphy.Value / 100 * ClientDataSetIngredientsP.Value * Ratio
|
||
1304 | else // Granul?s (dP) |
||
1305 | Value := ClientDataSetIngredientsdP.Value / 100 * ClientDataSetIngredientsP.Value * Ratio;
|
||
1306 | 5 | avalancogn | 6: // Bilan ?lectrolytique |
1307 | Value := ClientDataSetIngredientsBE.Value * Ratio; |
||
1308 | 1 | avalancogn | else
|
1309 | Value := 0;
|
||
1310 | end;
|
||
1311 | else
|
||
1312 | Value := 0;
|
||
1313 | end;
|
||
1314 | if (FormOptions.Expression = 1) |
||
1315 | and ((ComboBoxType2.ItemIndex <> 0) or (ComboBoxProximal2.ItemIndex > 1)) |
||
1316 | then // Conversion frais -> sec (mati?re s?che du r?gime) - except? pour Composition et MS |
||
1317 | Value := Value / InputProximal(ClientDataSetFeedsMS.Value, 1, 1, FormOptions.Proximal); |
||
1318 | if Value > 0 |
||
1319 | then // Prendre en compte la valeur |
||
1320 | begin
|
||
1321 | FeedBar := TBarSeries.Create(Chart2); |
||
1322 | FeedBar.ParentChart := Chart2; |
||
1323 | FeedBar.Title := Format('%s (%1.2f %%)', [IngredientName, Value / Cumul * 100]); |
||
1324 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
1325 | FeedBar.MultiBar := mbStacked100; |
||
1326 | FeedBar.Marks.Visible := False; |
||
1327 | Chart2.AddSeries(FeedBar); |
||
1328 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
1329 | Total := Total + Value; |
||
1330 | end;
|
||
1331 | ClientDataSetComposition.Next; |
||
1332 | end;
|
||
1333 | ClientDataSetIngredients.Filtered := False; |
||
1334 | ClientDataSetIngredients.Filter := '';
|
||
1335 | // Cas particuliers
|
||
1336 | if (ComboBoxType2.ItemIndex = 1) |
||
1337 | and ((ComboBoxEnergy2.ItemIndex = 1) |
||
1338 | or (ComboBoxEnergy2.ItemIndex = 3) |
||
1339 | or (ComboBoxEnergy2.ItemIndex = 5)) |
||
1340 | and (ClientDataSetFeedsBonusC.Value > 0) |
||
1341 | then // Bonus ?nergie (porc croissance) |
||
1342 | begin
|
||
1343 | case ComboBoxEnergy2.ItemIndex of |
||
1344 | 1: Value := ClientDataSetFeedsEDc.Value - Total;
|
||
1345 | 3: Value := ClientDataSetFeedsEMc.Value - Total;
|
||
1346 | 5: Value := ClientDataSetFeedsENc.Value - Total;
|
||
1347 | else Value := 0; |
||
1348 | end;
|
||
1349 | FeedBar := TBarSeries.Create(Chart2); |
||
1350 | FeedBar.ParentChart := Chart2; |
||
1351 | FeedBar.Title := Format('%s (%1.2f %%)', [_('Energy bonus'), Value / Cumul * 100]); |
||
1352 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
1353 | FeedBar.MultiBar := mbStacked100; |
||
1354 | FeedBar.Marks.Visible := False; |
||
1355 | Chart2.AddSeries(FeedBar); |
||
1356 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
1357 | Total := Total + Value; |
||
1358 | end;
|
||
1359 | if (ComboBoxType2.ItemIndex = 1) |
||
1360 | and ((ComboBoxEnergy2.ItemIndex = 2) |
||
1361 | or (ComboBoxEnergy2.ItemIndex = 4) |
||
1362 | or (ComboBoxEnergy2.ItemIndex = 6)) |
||
1363 | and (ClientDataSetFeedsBonusT.Value > 0) |
||
1364 | then // Bonus ?nergie (porc adulte) |
||
1365 | begin
|
||
1366 | case ComboBoxEnergy2.ItemIndex of |
||
1367 | 2: Value := ClientDataSetFeedsEDt.Value - Total;
|
||
1368 | 4: Value := ClientDataSetFeedsEMt.Value - Total;
|
||
1369 | 6: Value := ClientDataSetFeedsENt.Value - Total;
|
||
1370 | else Value := 0; |
||
1371 | end;
|
||
1372 | FeedBar := TBarSeries.Create(Chart2); |
||
1373 | FeedBar.ParentChart := Chart2; |
||
1374 | FeedBar.Title := Format('%s (%1.2f %%)', [_('Energy bonus'), Value / Cumul * 100]); |
||
1375 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
1376 | FeedBar.MultiBar := mbStacked100; |
||
1377 | FeedBar.Marks.Visible := False; |
||
1378 | Chart2.AddSeries(FeedBar); |
||
1379 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
1380 | Total := Total + Value; |
||
1381 | end;
|
||
1382 | if (ComboBoxType2.ItemIndex = 0) |
||
1383 | and (ComboBoxProximal2.ItemIndex = 0) |
||
1384 | and not ClientDataSetFeedsPhytaseId.IsNull |
||
1385 | and (ClientDataSetFeedsPhytaseLevel.Value > 0) |
||
1386 | then // Phytase (taux d'incorporation) |
||
1387 | begin
|
||
1388 | Ratio := InputIncorporation(ClientDataSetFeedsPhytaseLevel.Value, FormOptions.Incorporation); |
||
1389 | Value := OutputProximal(Ratio, 1, 1, FormOptions.Proximal); |
||
1390 | FeedBar := TBarSeries.Create(Chart2); |
||
1391 | FeedBar.ParentChart := Chart2; |
||
1392 | FeedBar.Title := Format('%s (%1.2f %%)', [_('Phytase'), Value / Cumul * 100]); |
||
1393 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
1394 | FeedBar.MultiBar := mbStacked100; |
||
1395 | FeedBar.Marks.Visible := False; |
||
1396 | Chart2.AddSeries(FeedBar); |
||
1397 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
1398 | Total := Total + Value; |
||
1399 | end;
|
||
1400 | if (ComboBoxType2.ItemIndex = 4) |
||
1401 | and (ComboBoxMinerals2.ItemIndex = 2) |
||
1402 | and not ClientDataSetFeedsPhytaseId.IsNull |
||
1403 | and (ClientDataSetFeedsPd.Value > Total)
|
||
1404 | then // Phytase (Phosphore digestible) |
||
1405 | begin
|
||
1406 | Value := ClientDataSetFeedsPd.Value - Total; |
||
1407 | FeedBar := TBarSeries.Create(Chart2); |
||
1408 | FeedBar.ParentChart := Chart2; |
||
1409 | FeedBar.Title := Format('%s (%1.2f %%)', [_('Phytase'), Value / Cumul * 100]); |
||
1410 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
1411 | FeedBar.MultiBar := mbStacked100; |
||
1412 | FeedBar.Marks.Visible := False; |
||
1413 | Chart2.AddSeries(FeedBar); |
||
1414 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
1415 | Total := Total + Value; |
||
1416 | end;
|
||
1417 | // Total
|
||
1418 | case ComboBoxType2.ItemIndex of |
||
1419 | 0: // Analyse proximale |
||
1420 | if (FormOptions.Expression = 0) or (ComboBoxProximal2.ItemIndex < 2) |
||
1421 | then // sur frais |
||
1422 | Chart2.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.ProximalDecimals, Total, FormOptions.ComboBoxProximal.Items[FormOptions.Proximal]])) |
||
1423 | else // sur mati?re s?che - except? pour Composition et MS |
||
1424 | Chart2.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.ProximalDecimals, Total, FormOptions.ComboBoxProximal.Items[FormOptions.Proximal], _('DM')])); |
||
1425 | 1: // Valeurs ?nerg?tiques |
||
1426 | if FormOptions.Expression = 0 |
||
1427 | then // sur frais |
||
1428 | Chart2.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.EnergyDecimals, Total, FormOptions.ComboBoxEnergy.Items[FormOptions.Energy]])) |
||
1429 | else // sur mati?re s?che |
||
1430 | Chart2.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.EnergyDecimals, Total, FormOptions.ComboBoxEnergy.Items[FormOptions.Energy], _('DM')])); |
||
1431 | 2, 3: // Acides amin?s |
||
1432 | if FormOptions.Expression = 0 |
||
1433 | then // sur frais |
||
1434 | Chart2.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.AADecimals, Total, FormOptions.ComboBoxAA.Items[FormOptions.AA]])) |
||
1435 | else // sur mati?re s?che |
||
1436 | Chart2.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.AADecimals, Total, FormOptions.ComboBoxAA.Items[FormOptions.AA], _('DM')])); |
||
1437 | 4: // Min?raux |
||
1438 | 5 | avalancogn | if ComboBoxMinerals2.ItemIndex = 6 |
1439 | then // Bilan ?lectrolytique |
||
1440 | if FormOptions.Expression = 0 |
||
1441 | then // sur frais |
||
1442 | Chart2.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), 1, Total, _('mEq/kg')])) |
||
1443 | else // sur mati?re s?che |
||
1444 | Chart2.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), 1, Total, _('mEq/kg'), _('DM')])) |
||
1445 | else
|
||
1446 | if FormOptions.Expression = 0 |
||
1447 | then // sur frais |
||
1448 | Chart2.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.MineralsDecimals, Total, FormOptions.ComboBoxMinerals.Items[FormOptions.Minerals]])) |
||
1449 | else // sur mati?re s?che |
||
1450 | Chart2.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.MineralsDecimals, Total, FormOptions.ComboBoxMinerals.Items[FormOptions.Minerals], _('DM')])); |
||
1451 | 1 | avalancogn | end;
|
1452 | end;
|
||
1453 | end;
|
||
1454 | |||
1455 | procedure TFormFeedCharts.ComboBoxOption3Change(Sender: TObject);
|
||
1456 | var
|
||
1457 | IngredientName: String;
|
||
1458 | Cumul, Ratio, Total, Value: Double; |
||
1459 | FeedBar: TBarSeries; |
||
1460 | begin
|
||
1461 | // while Chart3.SeriesCount > 0 do
|
||
1462 | // Chart3.Series[0].Free;
|
||
1463 | Chart3.FreeAllSeries(nil);
|
||
1464 | Chart3.SubTitle.Clear; |
||
1465 | with DataModuleDeclaration do |
||
1466 | begin
|
||
1467 | Chart3.AxisVisible := True; |
||
1468 | Chart3.SubTitle.Text.Add(ComboBoxType3.Text); |
||
1469 | case ComboBoxType3.ItemIndex of |
||
1470 | 0: // Analyse proximale |
||
1471 | Chart3.SubTitle.Text.Add(ComboBoxProximal3.Text); |
||
1472 | 1: // Valeurs ?nerg?tiques |
||
1473 | Chart3.SubTitle.Text.Add(ComboBoxEnergy3.Text); |
||
1474 | 2, 3: // Acides amin?s |
||
1475 | Chart3.SubTitle.Text.Add(ComboBoxAA3.Text); |
||
1476 | 4: // Min?raux |
||
1477 | Chart3.SubTitle.Text.Add(ComboBoxMinerals3.Text); |
||
1478 | end;
|
||
1479 | case ComboBoxType3.ItemIndex of |
||
1480 | 0: // Analyse proximale |
||
1481 | case ComboBoxProximal3.ItemIndex of |
||
1482 | 0: // Composition |
||
1483 | Cumul := OutputIncorporation(1, FormOptions.Incorporation);
|
||
1484 | 1: // MS |
||
1485 | Cumul := ClientDataSetFeedsMS.Value; |
||
1486 | 2: // MM |
||
1487 | Cumul := ClientDataSetFeedsMM.Value; |
||
1488 | 3: // MAT |
||
1489 | Cumul := ClientDataSetFeedsMAT.Value; |
||
1490 | 4: // MG |
||
1491 | Cumul := ClientDataSetFeedsMG.Value; |
||
1492 | 5: // CB |
||
1493 | Cumul := ClientDataSetFeedsCB.Value; |
||
1494 | 6: // NDF |
||
1495 | Cumul := ClientDataSetFeedsNDF.Value; |
||
1496 | 7: // ADF |
||
1497 | Cumul := ClientDataSetFeedsADF.Value; |
||
1498 | 8: // ADL |
||
1499 | Cumul := ClientDataSetFeedsADL.Value; |
||
1500 | 9: // Amidon |
||
1501 | Cumul := ClientDataSetFeedsAmidon.Value; |
||
1502 | 10: // Sucres |
||
1503 | Cumul := ClientDataSetFeedsSucres.Value; |
||
1504 | else
|
||
1505 | Cumul := 0;
|
||
1506 | end;
|
||
1507 | 1: // Valeurs ?nerg?tiques |
||
1508 | case ComboBoxEnergy3.ItemIndex of |
||
1509 | 0: // Energie brute |
||
1510 | Cumul := ClientDataSetFeedsEB.Value; |
||
1511 | 1: // Energie digestible (porc croissance) |
||
1512 | Cumul := ClientDataSetFeedsEDc.Value; |
||
1513 | 2: // Energie digestible (porc adulte) |
||
1514 | Cumul := ClientDataSetFeedsEDt.Value; |
||
1515 | 3: // Energie m?tabolisable (porc croissance) |
||
1516 | Cumul := ClientDataSetFeedsEMc.Value; |
||
1517 | 4: // Energie m?tabolisable (porc adulte) |
||
1518 | Cumul := ClientDataSetFeedsEMt.Value; |
||
1519 | 5: // Energie nette (porc croissance) |
||
1520 | Cumul := ClientDataSetFeedsENc.Value; |
||
1521 | 6: // Energie nette (porc adulte) |
||
1522 | Cumul := ClientDataSetFeedsENt.Value; |
||
1523 | else
|
||
1524 | Cumul := 0;
|
||
1525 | end;
|
||
1526 | 2: // Acides amin?s totaux |
||
1527 | case ComboBoxAA3.ItemIndex of |
||
1528 | 0: // Lysine |
||
1529 | Cumul := ClientDataSetFeedsLys.Value; |
||
1530 | 1: // Thr?onine |
||
1531 | Cumul := ClientDataSetFeedsThr.Value; |
||
1532 | 2: // M?thionine |
||
1533 | Cumul := ClientDataSetFeedsMet.Value; |
||
1534 | 3: // Cyst?ine |
||
1535 | Cumul := ClientDataSetFeedsCys.Value; |
||
1536 | 4: // M?thionine + Cyst?ine |
||
1537 | Cumul := ClientDataSetFeedsMetCys.Value; |
||
1538 | 5: // Tryptophane |
||
1539 | Cumul := ClientDataSetFeedsTrp.Value; |
||
1540 | 6: // Isoleucine |
||
1541 | Cumul := ClientDataSetFeedsIle.Value; |
||
1542 | 7: // Valine |
||
1543 | Cumul := ClientDataSetFeedsVal.Value; |
||
1544 | 8: // Leucine |
||
1545 | Cumul := ClientDataSetFeedsLeu.Value; |
||
1546 | 9: // Ph?nylalanine |
||
1547 | Cumul := ClientDataSetFeedsPhe.Value; |
||
1548 | 10: // Tyrosine |
||
1549 | Cumul := ClientDataSetFeedsTyr.Value; |
||
1550 | 11: // Ph?nylalanine + Tyrosine |
||
1551 | Cumul := ClientDataSetFeedsPheTyr.Value; |
||
1552 | 12: // Histidine |
||
1553 | Cumul := ClientDataSetFeedsHis.Value; |
||
1554 | 13: // Arginine |
||
1555 | Cumul := ClientDataSetFeedsArg.Value; |
||
1556 | 14: // Alanine |
||
1557 | Cumul := ClientDataSetFeedsAla.Value; |
||
1558 | 15: // Aspartate |
||
1559 | Cumul := ClientDataSetFeedsAsp.Value; |
||
1560 | 16: // Glutamate |
||
1561 | Cumul := ClientDataSetFeedsGlu.Value; |
||
1562 | 17: // Glycine |
||
1563 | Cumul := ClientDataSetFeedsGly.Value; |
||
1564 | 18: // S?rine |
||
1565 | Cumul := ClientDataSetFeedsSer.Value; |
||
1566 | 19: // Proline |
||
1567 | Cumul := ClientDataSetFeedsPro.Value; |
||
1568 | else
|
||
1569 | Cumul := 0;
|
||
1570 | end;
|
||
1571 | 3: // Acides amin?s digestibles |
||
1572 | case ComboBoxAA3.ItemIndex of |
||
1573 | 0: // Lysine |
||
1574 | Cumul := ClientDataSetFeedsLysd.Value; |
||
1575 | 1: // Thr?onine |
||
1576 | Cumul := ClientDataSetFeedsThrd.Value; |
||
1577 | 2: // M?thionine |
||
1578 | Cumul := ClientDataSetFeedsMetd.Value; |
||
1579 | 3: // Cyst?ine |
||
1580 | Cumul := ClientDataSetFeedsCysd.Value; |
||
1581 | 4: // M?thionine + Cyst?ine |
||
1582 | Cumul := ClientDataSetFeedsMetCysd.Value; |
||
1583 | 5: // Tryptophane |
||
1584 | Cumul := ClientDataSetFeedsTrpd.Value; |
||
1585 | 6: // Isoleucine |
||
1586 | Cumul := ClientDataSetFeedsIled.Value; |
||
1587 | 7: // Valine |
||
1588 | Cumul := ClientDataSetFeedsVald.Value; |
||
1589 | 8: // Leucine |
||
1590 | Cumul := ClientDataSetFeedsLeud.Value; |
||
1591 | 9: // Ph?nylalanine |
||
1592 | Cumul := ClientDataSetFeedsPhed.Value; |
||
1593 | 10: // Tyrosine |
||
1594 | Cumul := ClientDataSetFeedsTyrd.Value; |
||
1595 | 11: // Ph?nylalanine + Tyrosine |
||
1596 | Cumul := ClientDataSetFeedsPheTyrd.Value; |
||
1597 | 12: // Histidine |
||
1598 | Cumul := ClientDataSetFeedsHisd.Value; |
||
1599 | 13: // Arginine |
||
1600 | Cumul := ClientDataSetFeedsArgd.Value; |
||
1601 | 14: // Alanine |
||
1602 | Cumul := ClientDataSetFeedsAlad.Value; |
||
1603 | 15: // Aspartate |
||
1604 | Cumul := ClientDataSetFeedsAspd.Value; |
||
1605 | 16: // Glutamate |
||
1606 | Cumul := ClientDataSetFeedsGlud.Value; |
||
1607 | 17: // Glycine |
||
1608 | Cumul := ClientDataSetFeedsGlyd.Value; |
||
1609 | 18: // S?rine |
||
1610 | Cumul := ClientDataSetFeedsSerd.Value; |
||
1611 | 19: // Proline |
||
1612 | Cumul := ClientDataSetFeedsProd.Value; |
||
1613 | else
|
||
1614 | Cumul := 0;
|
||
1615 | end;
|
||
1616 | 4: // Min?raux |
||
1617 | case ComboBoxMinerals3.ItemIndex of |
||
1618 | 0: // Calcium |
||
1619 | Cumul := ClientDataSetFeedsCa.Value; |
||
1620 | 1: // Phosphore |
||
1621 | Cumul := ClientDataSetFeedsP.Value; |
||
1622 | 4 | avalancogn | 2: // Sodium |
1623 | Cumul := ClientDataSetFeedsNa.Value; |
||
1624 | 3: // Potassium |
||
1625 | Cumul := ClientDataSetFeedsK.Value; |
||
1626 | 4: // Chlore |
||
1627 | Cumul := ClientDataSetFeedsCl.Value; |
||
1628 | 5: // Phosphore digestible |
||
1629 | 1 | avalancogn | Cumul := ClientDataSetFeedsPd.Value; |
1630 | 5 | avalancogn | 6: // Bilan ?lectrolytique |
1631 | Cumul := ClientDataSetFeedsBE.Value; |
||
1632 | 1 | avalancogn | else
|
1633 | Cumul := 0;
|
||
1634 | end;
|
||
1635 | else
|
||
1636 | Cumul := 0;
|
||
1637 | end;
|
||
1638 | if Cumul = 0 |
||
1639 | then // Division par z?ro |
||
1640 | Cumul := 1;
|
||
1641 | ClientDataSetComposition.First; |
||
1642 | Total := 0;
|
||
1643 | while not ClientDataSetComposition.Eof do |
||
1644 | begin
|
||
1645 | if ClientDataSetCompositionUser.Value
|
||
1646 | then
|
||
1647 | ClientDataSetIngredients.Filter := Format('Id = %d and User', [ClientDataSetCompositionIngredient.Value])
|
||
1648 | else
|
||
1649 | ClientDataSetIngredients.Filter := Format('Id = %d and not User', [ClientDataSetCompositionIngredient.Value]);
|
||
1650 | ClientDataSetIngredients.Filtered := True; |
||
1651 | IngredientName := StrTrunc(ClientDataSetIngredientsName.Value, 25);
|
||
1652 | Ratio := InputIncorporation(ClientDataSetCompositionLevel.Value, FormOptions.Incorporation); |
||
1653 | if (FormOptions.Expression = 0) |
||
1654 | and ((ComboBoxType3.ItemIndex <> 0) or (ComboBoxProximal3.ItemIndex > 1)) |
||
1655 | then // Conversion frais -> sec (mati?re s?che de la mati?re premi?re) - except? pour Composition et MS |
||
1656 | Ratio := Ratio / InputProximal(ClientDataSetIngredientsMS.Value, 1, 1, FormOptions.Proximal); |
||
1657 | RapMS := InputProximal(ClientDataSetCompositionMS.Value, 1, 1, FormOptions.Proximal); |
||
1658 | if ((ComboBoxType3.ItemIndex <> 0) or (ComboBoxProximal3.ItemIndex > 1)) |
||
1659 | then // Conversion sec -> frais (mati?re s?che de la composition) - except? pour Composition et MS |
||
1660 | Ratio := Ratio * RapMS; |
||
1661 | case ComboBoxType3.ItemIndex of |
||
1662 | 0: // Analyse proximale |
||
1663 | case ComboBoxProximal3.ItemIndex of |
||
1664 | 0: // Composition |
||
1665 | Value := OutputProximal(Ratio, 1, 1, FormOptions.Proximal); |
||
1666 | 1: // MS |
||
1667 | Value := ClientDataSetCompositionMS.Value * Ratio; |
||
1668 | 2: // MM |
||
1669 | Value := ClientDataSetIngredientsMM.Value * Ratio; |
||
1670 | 3: // MAT |
||
1671 | Value := ClientDataSetIngredientsMAT.Value * Ratio; |
||
1672 | 4: // MG |
||
1673 | Value := ClientDataSetIngredientsMG.Value * Ratio; |
||
1674 | 5: // CB |
||
1675 | Value := ClientDataSetIngredientsCB.Value * Ratio; |
||
1676 | 6: // NDF |
||
1677 | Value := ClientDataSetIngredientsNDF.Value * Ratio; |
||
1678 | 7: // ADF |
||
1679 | Value := ClientDataSetIngredientsADF.Value * Ratio; |
||
1680 | 8: // ADL |
||
1681 | Value := ClientDataSetIngredientsADL.Value * Ratio; |
||
1682 | 9: // Amidon |
||
1683 | Value := ClientDataSetIngredientsAmidon.Value * Ratio; |
||
1684 | 10: // Sucres |
||
1685 | Value := ClientDataSetIngredientsSucres.Value * Ratio; |
||
1686 | else
|
||
1687 | Value := 0;
|
||
1688 | end;
|
||
1689 | 1: // Valeurs ?nerg?tiques |
||
1690 | case ComboBoxEnergy3.ItemIndex of |
||
1691 | 0: // Energie brute |
||
1692 | Value := ClientDataSetIngredientsEB.Value * Ratio; |
||
1693 | 1: // Energie digestible (porc croissance) |
||
1694 | Value := ClientDataSetIngredientsEDc.Value * Ratio; |
||
1695 | 2: // Energie digestible (porc adulte) |
||
1696 | Value := ClientDataSetIngredientsEDt.Value * Ratio; |
||
1697 | 3: // Energie m?tabolisable (porc croissance) |
||
1698 | Value := ClientDataSetIngredientsEMc.Value * Ratio; |
||
1699 | 4: // Energie m?tabolisable (porc adulte) |
||
1700 | Value := ClientDataSetIngredientsEMt.Value * Ratio; |
||
1701 | 5: // Energie nette (porc croissance) |
||
1702 | Value := ClientDataSetIngredientsENc.Value * Ratio; |
||
1703 | 6: // Energie nette (porc adulte) |
||
1704 | Value := ClientDataSetIngredientsENt.Value * Ratio; |
||
1705 | else
|
||
1706 | Value := 0;
|
||
1707 | end;
|
||
1708 | 2: // Acides amin?s totaux |
||
1709 | case ComboBoxAA3.ItemIndex of |
||
1710 | 0: // Lysine |
||
1711 | Value := ClientDataSetIngredientsLys.Value * Ratio; |
||
1712 | 1: // Thr?onine |
||
1713 | Value := ClientDataSetIngredientsThr.Value * Ratio; |
||
1714 | 2: // M?thionine |
||
1715 | Value := ClientDataSetIngredientsMet.Value * Ratio; |
||
1716 | 3: // Cyst?ine |
||
1717 | Value := ClientDataSetIngredientsCys.Value * Ratio; |
||
1718 | 4: // M?thionine + Cyst?ine |
||
1719 | Value := ClientDataSetIngredientsMetCys.Value * Ratio; |
||
1720 | 5: // Tryptophane |
||
1721 | Value := ClientDataSetIngredientsTrp.Value * Ratio; |
||
1722 | 6: // Isoleucine |
||
1723 | Value := ClientDataSetIngredientsIle.Value * Ratio; |
||
1724 | 7: // Valine |
||
1725 | Value := ClientDataSetIngredientsVal.Value * Ratio; |
||
1726 | 8: // Leucine |
||
1727 | Value := ClientDataSetIngredientsLeu.Value * Ratio; |
||
1728 | 9: // Ph?nylalanine |
||
1729 | Value := ClientDataSetIngredientsPhe.Value * Ratio; |
||
1730 | 10: // Tyrosine |
||
1731 | Value := ClientDataSetIngredientsTyr.Value * Ratio; |
||
1732 | 11: // Ph?nylalanine + Tyrosine |
||
1733 | Value := ClientDataSetIngredientsPheTyr.Value * Ratio; |
||
1734 | 12: // Histidine |
||
1735 | Value := ClientDataSetIngredientsHis.Value * Ratio; |
||
1736 | 13: // Arginine |
||
1737 | Value := ClientDataSetIngredientsArg.Value * Ratio; |
||
1738 | 14: // Alanine |
||
1739 | Value := ClientDataSetIngredientsAla.Value * Ratio; |
||
1740 | 15: // Aspartate |
||
1741 | Value := ClientDataSetIngredientsAsp.Value * Ratio; |
||
1742 | 16: // Glutamate |
||
1743 | Value := ClientDataSetIngredientsGlu.Value * Ratio; |
||
1744 | 17: // Glycine |
||
1745 | Value := ClientDataSetIngredientsGly.Value * Ratio; |
||
1746 | 18: // S?rine |
||
1747 | Value := ClientDataSetIngredientsSer.Value * Ratio; |
||
1748 | 19: // Proline |
||
1749 | Value := ClientDataSetIngredientsPro.Value * Ratio; |
||
1750 | else
|
||
1751 | Value := 0;
|
||
1752 | end;
|
||
1753 | 3: // Acides amin?s digestibles |
||
1754 | case ComboBoxAA3.ItemIndex of |
||
1755 | 0: // Lysine |
||
1756 | Value := ClientDataSetIngredientsLysd.Value * Ratio; |
||
1757 | 1: // Thr?onine |
||
1758 | Value := ClientDataSetIngredientsThrd.Value * Ratio; |
||
1759 | 2: // M?thionine |
||
1760 | Value := ClientDataSetIngredientsMetd.Value * Ratio; |
||
1761 | 3: // Cyst?ine |
||
1762 | Value := ClientDataSetIngredientsCysd.Value * Ratio; |
||
1763 | 4: // M?thionine + Cyst?ine |
||
1764 | Value := ClientDataSetIngredientsMetCysd.Value * Ratio; |
||
1765 | 5: // Tryptophane |
||
1766 | Value := ClientDataSetIngredientsTrpd.Value * Ratio; |
||
1767 | 6: // Isoleucine |
||
1768 | Value := ClientDataSetIngredientsIled.Value * Ratio; |
||
1769 | 7: // Valine |
||
1770 | Value := ClientDataSetIngredientsVald.Value * Ratio; |
||
1771 | 8: // Leucine |
||
1772 | Value := ClientDataSetIngredientsLeud.Value * Ratio; |
||
1773 | 9: // Ph?nylalanine |
||
1774 | Value := ClientDataSetIngredientsPhed.Value * Ratio; |
||
1775 | 10: // Tyrosine |
||
1776 | Value := ClientDataSetIngredientsTyrd.Value * Ratio; |
||
1777 | 11: // Ph?nylalanine + Tyrosine |
||
1778 | Value := ClientDataSetIngredientsPheTyrd.Value * Ratio; |
||
1779 | 12: // Histidine |
||
1780 | Value := ClientDataSetIngredientsHisd.Value * Ratio; |
||
1781 | 13: // Arginine |
||
1782 | Value := ClientDataSetIngredientsArgd.Value * Ratio; |
||
1783 | 14: // Alanine |
||
1784 | Value := ClientDataSetIngredientsAlad.Value * Ratio; |
||
1785 | 15: // Aspartate |
||
1786 | Value := ClientDataSetIngredientsAspd.Value * Ratio; |
||
1787 | 16: // Glutamate |
||
1788 | Value := ClientDataSetIngredientsGlud.Value * Ratio; |
||
1789 | 17: // Glycine |
||
1790 | Value := ClientDataSetIngredientsGlyd.Value * Ratio; |
||
1791 | 18: // S?rine |
||
1792 | Value := ClientDataSetIngredientsSerd.Value * Ratio; |
||
1793 | 19: // Proline |
||
1794 | Value := ClientDataSetIngredientsProd.Value * Ratio; |
||
1795 | else
|
||
1796 | Value := 0;
|
||
1797 | end;
|
||
1798 | 4: // Min?raux |
||
1799 | case ComboBoxMinerals3.ItemIndex of |
||
1800 | 0: // Calcium |
||
1801 | Value := ClientDataSetIngredientsCa.Value * Ratio; |
||
1802 | 1: // Phosphore |
||
1803 | Value := ClientDataSetIngredientsP.Value * Ratio; |
||
1804 | 4 | avalancogn | 2: // Sodium |
1805 | Value := ClientDataSetIngredientsNa.Value * Ratio; |
||
1806 | 3: // Potassium |
||
1807 | Value := ClientDataSetIngredientsK.Value * Ratio; |
||
1808 | 4: // Chlore |
||
1809 | Value := ClientDataSetIngredientsCl.Value * Ratio; |
||
1810 | 5: // Phosphore digestible |
||
1811 | 1 | avalancogn | if ClientDataSetFeedsPresentation.Value = 0 |
1812 | then // Farine (dPphy) |
||
1813 | Value := ClientDataSetIngredientsdPphy.Value / 100 * ClientDataSetIngredientsP.Value * Ratio
|
||
1814 | else // Granul?s (dP) |
||
1815 | Value := ClientDataSetIngredientsdP.Value / 100 * ClientDataSetIngredientsP.Value * Ratio;
|
||
1816 | 5 | avalancogn | 6: // Bilan ?lectrolytique |
1817 | Value := ClientDataSetIngredientsBE.Value * Ratio; |
||
1818 | 1 | avalancogn | else
|
1819 | Value := 0;
|
||
1820 | end;
|
||
1821 | else
|
||
1822 | Value := 0;
|
||
1823 | end;
|
||
1824 | if (FormOptions.Expression = 1) |
||
1825 | and ((ComboBoxType3.ItemIndex <> 0) or (ComboBoxProximal3.ItemIndex > 1)) |
||
1826 | then // Conversion frais -> sec (mati?re s?che du r?gime) - except? pour Composition et MS |
||
1827 | Value := Value / InputProximal(ClientDataSetFeedsMS.Value, 1, 1, FormOptions.Proximal); |
||
1828 | if Value > 0 |
||
1829 | then // Prendre en compte la valeur |
||
1830 | begin
|
||
1831 | FeedBar := TBarSeries.Create(Chart3); |
||
1832 | FeedBar.ParentChart := Chart3; |
||
1833 | FeedBar.Title := Format('%s (%1.2f %%)', [IngredientName, Value / Cumul * 100]); |
||
1834 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
1835 | FeedBar.MultiBar := mbStacked100; |
||
1836 | FeedBar.Marks.Visible := False; |
||
1837 | Chart3.AddSeries(FeedBar); |
||
1838 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
1839 | Total := Total + Value; |
||
1840 | end;
|
||
1841 | ClientDataSetComposition.Next; |
||
1842 | end;
|
||
1843 | ClientDataSetIngredients.Filtered := False; |
||
1844 | ClientDataSetIngredients.Filter := '';
|
||
1845 | // Cas particuliers
|
||
1846 | if (ComboBoxType3.ItemIndex = 1) |
||
1847 | and ((ComboBoxEnergy3.ItemIndex = 1) |
||
1848 | or (ComboBoxEnergy3.ItemIndex = 3) |
||
1849 | or (ComboBoxEnergy3.ItemIndex = 5)) |
||
1850 | and (ClientDataSetFeedsBonusC.Value > 0) |
||
1851 | then // Bonus ?nergie (porc croissance) |
||
1852 | begin
|
||
1853 | case ComboBoxEnergy3.ItemIndex of |
||
1854 | 1: Value := ClientDataSetFeedsEDc.Value - Total;
|
||
1855 | 3: Value := ClientDataSetFeedsEMc.Value - Total;
|
||
1856 | 5: Value := ClientDataSetFeedsENc.Value - Total;
|
||
1857 | else Value := 0; |
||
1858 | end;
|
||
1859 | FeedBar := TBarSeries.Create(Chart3); |
||
1860 | FeedBar.ParentChart := Chart3; |
||
1861 | FeedBar.Title := Format('%s (%1.2f %%)', [_('Energy bonus'), Value / Cumul * 100]); |
||
1862 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
1863 | FeedBar.MultiBar := mbStacked100; |
||
1864 | FeedBar.Marks.Visible := False; |
||
1865 | Chart3.AddSeries(FeedBar); |
||
1866 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
1867 | Total := Total + Value; |
||
1868 | end;
|
||
1869 | if (ComboBoxType3.ItemIndex = 1) |
||
1870 | and ((ComboBoxEnergy3.ItemIndex = 2) |
||
1871 | or (ComboBoxEnergy3.ItemIndex = 4) |
||
1872 | or (ComboBoxEnergy3.ItemIndex = 6)) |
||
1873 | and (ClientDataSetFeedsBonusT.Value > 0) |
||
1874 | then // Bonus ?nergie (porc adulte) |
||
1875 | begin
|
||
1876 | case ComboBoxEnergy3.ItemIndex of |
||
1877 | 2: Value := ClientDataSetFeedsEDt.Value - Total;
|
||
1878 | 4: Value := ClientDataSetFeedsEMt.Value - Total;
|
||
1879 | 6: Value := ClientDataSetFeedsENt.Value - Total;
|
||
1880 | else Value := 0; |
||
1881 | end;
|
||
1882 | FeedBar := TBarSeries.Create(Chart3); |
||
1883 | FeedBar.ParentChart := Chart3; |
||
1884 | FeedBar.Title := Format('%s (%1.2f %%)', [_('Energy bonus'), Value / Cumul * 100]); |
||
1885 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
1886 | FeedBar.MultiBar := mbStacked100; |
||
1887 | FeedBar.Marks.Visible := False; |
||
1888 | Chart3.AddSeries(FeedBar); |
||
1889 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
1890 | Total := Total + Value; |
||
1891 | end;
|
||
1892 | if (ComboBoxType3.ItemIndex = 0) |
||
1893 | and (ComboBoxProximal3.ItemIndex = 0) |
||
1894 | and not ClientDataSetFeedsPhytaseId.IsNull |
||
1895 | and (ClientDataSetFeedsPhytaseLevel.Value > 0) |
||
1896 | then // Phytase (taux d'incorporation) |
||
1897 | begin
|
||
1898 | Ratio := InputIncorporation(ClientDataSetFeedsPhytaseLevel.Value, FormOptions.Incorporation); |
||
1899 | Value := OutputProximal(Ratio, 1, 1, FormOptions.Proximal); |
||
1900 | FeedBar := TBarSeries.Create(Chart3); |
||
1901 | FeedBar.ParentChart := Chart3; |
||
1902 | FeedBar.Title := Format('%s (%1.2f %%)', [_('Phytase'), Value / Cumul * 100]); |
||
1903 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
1904 | FeedBar.MultiBar := mbStacked100; |
||
1905 | FeedBar.Marks.Visible := False; |
||
1906 | Chart3.AddSeries(FeedBar); |
||
1907 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
1908 | Total := Total + Value; |
||
1909 | end;
|
||
1910 | if (ComboBoxType3.ItemIndex = 4) |
||
1911 | and (ComboBoxMinerals3.ItemIndex = 2) |
||
1912 | and not ClientDataSetFeedsPhytaseId.IsNull |
||
1913 | and (ClientDataSetFeedsPd.Value > Total)
|
||
1914 | then // Phytase (Phosphore digestible) |
||
1915 | begin
|
||
1916 | Value := ClientDataSetFeedsPd.Value - Total; |
||
1917 | FeedBar := TBarSeries.Create(Chart3); |
||
1918 | FeedBar.ParentChart := Chart3; |
||
1919 | FeedBar.Title := Format('%s (%1.2f %%)', [_('Phytase'), Value / Cumul * 100]); |
||
1920 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
1921 | FeedBar.MultiBar := mbStacked100; |
||
1922 | FeedBar.Marks.Visible := False; |
||
1923 | Chart3.AddSeries(FeedBar); |
||
1924 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
1925 | Total := Total + Value; |
||
1926 | end;
|
||
1927 | // Total
|
||
1928 | case ComboBoxType3.ItemIndex of |
||
1929 | 0: // Analyse proximale |
||
1930 | if (FormOptions.Expression = 0) or (ComboBoxProximal3.ItemIndex < 2) |
||
1931 | then // sur frais |
||
1932 | Chart3.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.ProximalDecimals, Total, FormOptions.ComboBoxProximal.Items[FormOptions.Proximal]])) |
||
1933 | else // sur mati?re s?che - except? pour Composition et MS |
||
1934 | Chart3.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.ProximalDecimals, Total, FormOptions.ComboBoxProximal.Items[FormOptions.Proximal], _('DM')])); |
||
1935 | 1: // Valeurs ?nerg?tiques |
||
1936 | if FormOptions.Expression = 0 |
||
1937 | then // sur frais |
||
1938 | Chart3.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.EnergyDecimals, Total, FormOptions.ComboBoxEnergy.Items[FormOptions.Energy]])) |
||
1939 | else // sur mati?re s?che |
||
1940 | Chart3.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.EnergyDecimals, Total, FormOptions.ComboBoxEnergy.Items[FormOptions.Energy], _('DM')])); |
||
1941 | 2, 3: // Acides amin?s |
||
1942 | if FormOptions.Expression = 0 |
||
1943 | then // sur frais |
||
1944 | Chart3.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.AADecimals, Total, FormOptions.ComboBoxAA.Items[FormOptions.AA]])) |
||
1945 | else // sur mati?re s?che |
||
1946 | Chart3.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.AADecimals, Total, FormOptions.ComboBoxAA.Items[FormOptions.AA], _('DM')])); |
||
1947 | 4: // Min?raux |
||
1948 | 5 | avalancogn | if ComboBoxMinerals3.ItemIndex = 6 |
1949 | then // Bilan ?lectrolytique |
||
1950 | if FormOptions.Expression = 0 |
||
1951 | then // sur frais |
||
1952 | Chart3.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), 1, Total, _('mEq/kg')])) |
||
1953 | else // sur mati?re s?che |
||
1954 | Chart3.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), 1, Total, _('mEq/kg'), _('DM')])) |
||
1955 | else
|
||
1956 | if FormOptions.Expression = 0 |
||
1957 | then // sur frais |
||
1958 | Chart3.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.MineralsDecimals, Total, FormOptions.ComboBoxMinerals.Items[FormOptions.Minerals]])) |
||
1959 | else // sur mati?re s?che |
||
1960 | Chart3.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.MineralsDecimals, Total, FormOptions.ComboBoxMinerals.Items[FormOptions.Minerals], _('DM')])); |
||
1961 | 1 | avalancogn | end;
|
1962 | end;
|
||
1963 | end;
|
||
1964 | |||
1965 | procedure TFormFeedCharts.ComboBoxOption4Change(Sender: TObject);
|
||
1966 | var
|
||
1967 | IngredientName: String;
|
||
1968 | Cumul, Ratio, Total, Value: Double; |
||
1969 | FeedBar: TBarSeries; |
||
1970 | begin
|
||
1971 | // while Chart4.SeriesCount > 0 do
|
||
1972 | // Chart4.Series[0].Free;
|
||
1973 | Chart4.FreeAllSeries(nil);
|
||
1974 | Chart4.SubTitle.Clear; |
||
1975 | with DataModuleDeclaration do |
||
1976 | begin
|
||
1977 | Chart4.AxisVisible := True; |
||
1978 | Chart4.SubTitle.Text.Add(ComboBoxType4.Text); |
||
1979 | case ComboBoxType4.ItemIndex of |
||
1980 | 0: // Analyse proximale |
||
1981 | Chart4.SubTitle.Text.Add(ComboBoxProximal4.Text); |
||
1982 | 1: // Valeurs ?nerg?tiques |
||
1983 | Chart4.SubTitle.Text.Add(ComboBoxEnergy4.Text); |
||
1984 | 2, 3: // Acides amin?s |
||
1985 | Chart4.SubTitle.Text.Add(ComboBoxAA4.Text); |
||
1986 | 4: // Min?raux |
||
1987 | Chart4.SubTitle.Text.Add(ComboBoxMinerals4.Text); |
||
1988 | end;
|
||
1989 | case ComboBoxType4.ItemIndex of |
||
1990 | 0: // Analyse proximale |
||
1991 | case ComboBoxProximal4.ItemIndex of |
||
1992 | 0: // Composition |
||
1993 | Cumul := OutputIncorporation(1, FormOptions.Incorporation);
|
||
1994 | 1: // MS |
||
1995 | Cumul := ClientDataSetFeedsMS.Value; |
||
1996 | 2: // MM |
||
1997 | Cumul := ClientDataSetFeedsMM.Value; |
||
1998 | 3: // MAT |
||
1999 | Cumul := ClientDataSetFeedsMAT.Value; |
||
2000 | 4: // MG |
||
2001 | Cumul := ClientDataSetFeedsMG.Value; |
||
2002 | 5: // CB |
||
2003 | Cumul := ClientDataSetFeedsCB.Value; |
||
2004 | 6: // NDF |
||
2005 | Cumul := ClientDataSetFeedsNDF.Value; |
||
2006 | 7: // ADF |
||
2007 | Cumul := ClientDataSetFeedsADF.Value; |
||
2008 | 8: // ADL |
||
2009 | Cumul := ClientDataSetFeedsADL.Value; |
||
2010 | 9: // Amidon |
||
2011 | Cumul := ClientDataSetFeedsAmidon.Value; |
||
2012 | 10: // Sucres |
||
2013 | Cumul := ClientDataSetFeedsSucres.Value; |
||
2014 | else
|
||
2015 | Cumul := 0;
|
||
2016 | end;
|
||
2017 | 1: // Valeurs ?nerg?tiques |
||
2018 | case ComboBoxEnergy4.ItemIndex of |
||
2019 | 0: // Energie brute |
||
2020 | Cumul := ClientDataSetFeedsEB.Value; |
||
2021 | 1: // Energie digestible (porc croissance) |
||
2022 | Cumul := ClientDataSetFeedsEDc.Value; |
||
2023 | 2: // Energie digestible (porc adulte) |
||
2024 | Cumul := ClientDataSetFeedsEDt.Value; |
||
2025 | 3: // Energie m?tabolisable (porc croissance) |
||
2026 | Cumul := ClientDataSetFeedsEMc.Value; |
||
2027 | 4: // Energie m?tabolisable (porc adulte) |
||
2028 | Cumul := ClientDataSetFeedsEMt.Value; |
||
2029 | 5: // Energie nette (porc croissance) |
||
2030 | Cumul := ClientDataSetFeedsENc.Value; |
||
2031 | 6: // Energie nette (porc adulte) |
||
2032 | Cumul := ClientDataSetFeedsENt.Value; |
||
2033 | else
|
||
2034 | Cumul := 0;
|
||
2035 | end;
|
||
2036 | 2: // Acides amin?s totaux |
||
2037 | case ComboBoxAA4.ItemIndex of |
||
2038 | 0: // Lysine |
||
2039 | Cumul := ClientDataSetFeedsLys.Value; |
||
2040 | 1: // Thr?onine |
||
2041 | Cumul := ClientDataSetFeedsThr.Value; |
||
2042 | 2: // M?thionine |
||
2043 | Cumul := ClientDataSetFeedsMet.Value; |
||
2044 | 3: // Cyst?ine |
||
2045 | Cumul := ClientDataSetFeedsCys.Value; |
||
2046 | 4: // M?thionine + Cyst?ine |
||
2047 | Cumul := ClientDataSetFeedsMetCys.Value; |
||
2048 | 5: // Tryptophane |
||
2049 | Cumul := ClientDataSetFeedsTrp.Value; |
||
2050 | 6: // Isoleucine |
||
2051 | Cumul := ClientDataSetFeedsIle.Value; |
||
2052 | 7: // Valine |
||
2053 | Cumul := ClientDataSetFeedsVal.Value; |
||
2054 | 8: // Leucine |
||
2055 | Cumul := ClientDataSetFeedsLeu.Value; |
||
2056 | 9: // Ph?nylalanine |
||
2057 | Cumul := ClientDataSetFeedsPhe.Value; |
||
2058 | 10: // Tyrosine |
||
2059 | Cumul := ClientDataSetFeedsTyr.Value; |
||
2060 | 11: // Ph?nylalanine + Tyrosine |
||
2061 | Cumul := ClientDataSetFeedsPheTyr.Value; |
||
2062 | 12: // Histidine |
||
2063 | Cumul := ClientDataSetFeedsHis.Value; |
||
2064 | 13: // Arginine |
||
2065 | Cumul := ClientDataSetFeedsArg.Value; |
||
2066 | 14: // Alanine |
||
2067 | Cumul := ClientDataSetFeedsAla.Value; |
||
2068 | 15: // Aspartate |
||
2069 | Cumul := ClientDataSetFeedsAsp.Value; |
||
2070 | 16: // Glutamate |
||
2071 | Cumul := ClientDataSetFeedsGlu.Value; |
||
2072 | 17: // Glycine |
||
2073 | Cumul := ClientDataSetFeedsGly.Value; |
||
2074 | 18: // S?rine |
||
2075 | Cumul := ClientDataSetFeedsSer.Value; |
||
2076 | 19: // Proline |
||
2077 | Cumul := ClientDataSetFeedsPro.Value; |
||
2078 | else
|
||
2079 | Cumul := 0;
|
||
2080 | end;
|
||
2081 | 3: // Acides amin?s digestibles |
||
2082 | case ComboBoxAA4.ItemIndex of |
||
2083 | 0: // Lysine |
||
2084 | Cumul := ClientDataSetFeedsLysd.Value; |
||
2085 | 1: // Thr?onine |
||
2086 | Cumul := ClientDataSetFeedsThrd.Value; |
||
2087 | 2: // M?thionine |
||
2088 | Cumul := ClientDataSetFeedsMetd.Value; |
||
2089 | 3: // Cyst?ine |
||
2090 | Cumul := ClientDataSetFeedsCysd.Value; |
||
2091 | 4: // M?thionine + Cyst?ine |
||
2092 | Cumul := ClientDataSetFeedsMetCysd.Value; |
||
2093 | 5: // Tryptophane |
||
2094 | Cumul := ClientDataSetFeedsTrpd.Value; |
||
2095 | 6: // Isoleucine |
||
2096 | Cumul := ClientDataSetFeedsIled.Value; |
||
2097 | 7: // Valine |
||
2098 | Cumul := ClientDataSetFeedsVald.Value; |
||
2099 | 8: // Leucine |
||
2100 | Cumul := ClientDataSetFeedsLeud.Value; |
||
2101 | 9: // Ph?nylalanine |
||
2102 | Cumul := ClientDataSetFeedsPhed.Value; |
||
2103 | 10: // Tyrosine |
||
2104 | Cumul := ClientDataSetFeedsTyrd.Value; |
||
2105 | 11: // Ph?nylalanine + Tyrosine |
||
2106 | Cumul := ClientDataSetFeedsPheTyrd.Value; |
||
2107 | 12: // Histidine |
||
2108 | Cumul := ClientDataSetFeedsHisd.Value; |
||
2109 | 13: // Arginine |
||
2110 | Cumul := ClientDataSetFeedsArgd.Value; |
||
2111 | 14: // Alanine |
||
2112 | Cumul := ClientDataSetFeedsAlad.Value; |
||
2113 | 15: // Aspartate |
||
2114 | Cumul := ClientDataSetFeedsAspd.Value; |
||
2115 | 16: // Glutamate |
||
2116 | Cumul := ClientDataSetFeedsGlud.Value; |
||
2117 | 17: // Glycine |
||
2118 | Cumul := ClientDataSetFeedsGlyd.Value; |
||
2119 | 18: // S?rine |
||
2120 | Cumul := ClientDataSetFeedsSerd.Value; |
||
2121 | 19: // Proline |
||
2122 | Cumul := ClientDataSetFeedsProd.Value; |
||
2123 | else
|
||
2124 | Cumul := 0;
|
||
2125 | end;
|
||
2126 | 4: // Min?raux |
||
2127 | case ComboBoxMinerals4.ItemIndex of |
||
2128 | 0: // Calcium |
||
2129 | Cumul := ClientDataSetFeedsCa.Value; |
||
2130 | 1: // Phosphore |
||
2131 | Cumul := ClientDataSetFeedsP.Value; |
||
2132 | 4 | avalancogn | 2: // Sodium |
2133 | Cumul := ClientDataSetFeedsNa.Value; |
||
2134 | 3: // Potassium |
||
2135 | Cumul := ClientDataSetFeedsK.Value; |
||
2136 | 4: // Chlore |
||
2137 | Cumul := ClientDataSetFeedsCl.Value; |
||
2138 | 5: // Phosphore digestible |
||
2139 | 1 | avalancogn | Cumul := ClientDataSetFeedsPd.Value; |
2140 | 5 | avalancogn | 6: // Bilan ?lectrolytique |
2141 | Cumul := ClientDataSetFeedsBE.Value; |
||
2142 | 1 | avalancogn | else
|
2143 | Cumul := 0;
|
||
2144 | end;
|
||
2145 | else
|
||
2146 | Cumul := 0;
|
||
2147 | end;
|
||
2148 | if Cumul = 0 |
||
2149 | then // Division par z?ro |
||
2150 | Cumul := 1;
|
||
2151 | ClientDataSetComposition.First; |
||
2152 | Total := 0;
|
||
2153 | while not ClientDataSetComposition.Eof do |
||
2154 | begin
|
||
2155 | if ClientDataSetCompositionUser.Value
|
||
2156 | then
|
||
2157 | ClientDataSetIngredients.Filter := Format('Id = %d and User', [ClientDataSetCompositionIngredient.Value])
|
||
2158 | else
|
||
2159 | ClientDataSetIngredients.Filter := Format('Id = %d and not User', [ClientDataSetCompositionIngredient.Value]);
|
||
2160 | ClientDataSetIngredients.Filtered := True; |
||
2161 | IngredientName := StrTrunc(ClientDataSetIngredientsName.Value, 25);
|
||
2162 | Ratio := InputIncorporation(ClientDataSetCompositionLevel.Value, FormOptions.Incorporation); |
||
2163 | if (FormOptions.Expression = 0) |
||
2164 | and ((ComboBoxType4.ItemIndex <> 0) or (ComboBoxProximal4.ItemIndex > 1)) |
||
2165 | then // Conversion frais -> sec (mati?re s?che de la mati?re premi?re) - except? pour Composition et MS |
||
2166 | Ratio := Ratio / InputProximal(ClientDataSetIngredientsMS.Value, 1, 1, FormOptions.Proximal); |
||
2167 | RapMS := InputProximal(ClientDataSetCompositionMS.Value, 1, 1, FormOptions.Proximal); |
||
2168 | if ((ComboBoxType4.ItemIndex <> 0) or (ComboBoxProximal4.ItemIndex > 1)) |
||
2169 | then // Conversion sec -> frais (mati?re s?che de la composition) - except? pour Composition et MS |
||
2170 | Ratio := Ratio * RapMS; |
||
2171 | case ComboBoxType4.ItemIndex of |
||
2172 | 0: // Analyse proximale |
||
2173 | case ComboBoxProximal4.ItemIndex of |
||
2174 | 0: // Composition |
||
2175 | Value := OutputProximal(Ratio, 1, 1, FormOptions.Proximal); |
||
2176 | 1: // MS |
||
2177 | Value := ClientDataSetCompositionMS.Value * Ratio; |
||
2178 | 2: // MM |
||
2179 | Value := ClientDataSetIngredientsMM.Value * Ratio; |
||
2180 | 3: // MAT |
||
2181 | Value := ClientDataSetIngredientsMAT.Value * Ratio; |
||
2182 | 4: // MG |
||
2183 | Value := ClientDataSetIngredientsMG.Value * Ratio; |
||
2184 | 5: // CB |
||
2185 | Value := ClientDataSetIngredientsCB.Value * Ratio; |
||
2186 | 6: // NDF |
||
2187 | Value := ClientDataSetIngredientsNDF.Value * Ratio; |
||
2188 | 7: // ADF |
||
2189 | Value := ClientDataSetIngredientsADF.Value * Ratio; |
||
2190 | 8: // ADL |
||
2191 | Value := ClientDataSetIngredientsADL.Value * Ratio; |
||
2192 | 9: // Amidon |
||
2193 | Value := ClientDataSetIngredientsAmidon.Value * Ratio; |
||
2194 | 10: // Sucres |
||
2195 | Value := ClientDataSetIngredientsSucres.Value * Ratio; |
||
2196 | else
|
||
2197 | Value := 0;
|
||
2198 | end;
|
||
2199 | 1: // Valeurs ?nerg?tiques |
||
2200 | case ComboBoxEnergy4.ItemIndex of |
||
2201 | 0: // Energie brute |
||
2202 | Value := ClientDataSetIngredientsEB.Value * Ratio; |
||
2203 | 1: // Energie digestible (porc croissance) |
||
2204 | Value := ClientDataSetIngredientsEDc.Value * Ratio; |
||
2205 | 2: // Energie digestible (porc adulte) |
||
2206 | Value := ClientDataSetIngredientsEDt.Value * Ratio; |
||
2207 | 3: // Energie m?tabolisable (porc croissance) |
||
2208 | Value := ClientDataSetIngredientsEMc.Value * Ratio; |
||
2209 | 4: // Energie m?tabolisable (porc adulte) |
||
2210 | Value := ClientDataSetIngredientsEMt.Value * Ratio; |
||
2211 | 5: // Energie nette (porc croissance) |
||
2212 | Value := ClientDataSetIngredientsENc.Value * Ratio; |
||
2213 | 6: // Energie nette (porc adulte) |
||
2214 | Value := ClientDataSetIngredientsENt.Value * Ratio; |
||
2215 | else
|
||
2216 | Value := 0;
|
||
2217 | end;
|
||
2218 | 2: // Acides amin?s totaux |
||
2219 | case ComboBoxAA4.ItemIndex of |
||
2220 | 0: // Lysine |
||
2221 | Value := ClientDataSetIngredientsLys.Value * Ratio; |
||
2222 | 1: // Thr?onine |
||
2223 | Value := ClientDataSetIngredientsThr.Value * Ratio; |
||
2224 | 2: // M?thionine |
||
2225 | Value := ClientDataSetIngredientsMet.Value * Ratio; |
||
2226 | 3: // Cyst?ine |
||
2227 | Value := ClientDataSetIngredientsCys.Value * Ratio; |
||
2228 | 4: // M?thionine + Cyst?ine |
||
2229 | Value := ClientDataSetIngredientsMetCys.Value * Ratio; |
||
2230 | 5: // Tryptophane |
||
2231 | Value := ClientDataSetIngredientsTrp.Value * Ratio; |
||
2232 | 6: // Isoleucine |
||
2233 | Value := ClientDataSetIngredientsIle.Value * Ratio; |
||
2234 | 7: // Valine |
||
2235 | Value := ClientDataSetIngredientsVal.Value * Ratio; |
||
2236 | 8: // Leucine |
||
2237 | Value := ClientDataSetIngredientsLeu.Value * Ratio; |
||
2238 | 9: // Ph?nylalanine |
||
2239 | Value := ClientDataSetIngredientsPhe.Value * Ratio; |
||
2240 | 10: // Tyrosine |
||
2241 | Value := ClientDataSetIngredientsTyr.Value * Ratio; |
||
2242 | 11: // Ph?nylalanine + Tyrosine |
||
2243 | Value := ClientDataSetIngredientsPheTyr.Value * Ratio; |
||
2244 | 12: // Histidine |
||
2245 | Value := ClientDataSetIngredientsHis.Value * Ratio; |
||
2246 | 13: // Arginine |
||
2247 | Value := ClientDataSetIngredientsArg.Value * Ratio; |
||
2248 | 14: // Alanine |
||
2249 | Value := ClientDataSetIngredientsAla.Value * Ratio; |
||
2250 | 15: // Aspartate |
||
2251 | Value := ClientDataSetIngredientsAsp.Value * Ratio; |
||
2252 | 16: // Glutamate |
||
2253 | Value := ClientDataSetIngredientsGlu.Value * Ratio; |
||
2254 | 17: // Glycine |
||
2255 | Value := ClientDataSetIngredientsGly.Value * Ratio; |
||
2256 | 18: // S?rine |
||
2257 | Value := ClientDataSetIngredientsSer.Value * Ratio; |
||
2258 | 19: // Proline |
||
2259 | Value := ClientDataSetIngredientsPro.Value * Ratio; |
||
2260 | else
|
||
2261 | Value := 0;
|
||
2262 | end;
|
||
2263 | 3: // Acides amin?s digestibles |
||
2264 | case ComboBoxAA4.ItemIndex of |
||
2265 | 0: // Lysine |
||
2266 | Value := ClientDataSetIngredientsLysd.Value * Ratio; |
||
2267 | 1: // Thr?onine |
||
2268 | Value := ClientDataSetIngredientsThrd.Value * Ratio; |
||
2269 | 2: // M?thionine |
||
2270 | Value := ClientDataSetIngredientsMetd.Value * Ratio; |
||
2271 | 3: // Cyst?ine |
||
2272 | Value := ClientDataSetIngredientsCysd.Value * Ratio; |
||
2273 | 4: // M?thionine + Cyst?ine |
||
2274 | Value := ClientDataSetIngredientsMetCysd.Value * Ratio; |
||
2275 | 5: // Tryptophane |
||
2276 | Value := ClientDataSetIngredientsTrpd.Value * Ratio; |
||
2277 | 6: // Isoleucine |
||
2278 | Value := ClientDataSetIngredientsIled.Value * Ratio; |
||
2279 | 7: // Valine |
||
2280 | Value := ClientDataSetIngredientsVald.Value * Ratio; |
||
2281 | 8: // Leucine |
||
2282 | Value := ClientDataSetIngredientsLeud.Value * Ratio; |
||
2283 | 9: // Ph?nylalanine |
||
2284 | Value := ClientDataSetIngredientsPhed.Value * Ratio; |
||
2285 | 10: // Tyrosine |
||
2286 | Value := ClientDataSetIngredientsTyrd.Value * Ratio; |
||
2287 | 11: // Ph?nylalanine + Tyrosine |
||
2288 | Value := ClientDataSetIngredientsPheTyrd.Value * Ratio; |
||
2289 | 12: // Histidine |
||
2290 | Value := ClientDataSetIngredientsHisd.Value * Ratio; |
||
2291 | 13: // Arginine |
||
2292 | Value := ClientDataSetIngredientsArgd.Value * Ratio; |
||
2293 | 14: // Alanine |
||
2294 | Value := ClientDataSetIngredientsAlad.Value * Ratio; |
||
2295 | 15: // Aspartate |
||
2296 | Value := ClientDataSetIngredientsAspd.Value * Ratio; |
||
2297 | 16: // Glutamate |
||
2298 | Value := ClientDataSetIngredientsGlud.Value * Ratio; |
||
2299 | 17: // Glycine |
||
2300 | Value := ClientDataSetIngredientsGlyd.Value * Ratio; |
||
2301 | 18: // S?rine |
||
2302 | Value := ClientDataSetIngredientsSerd.Value * Ratio; |
||
2303 | 19: // Proline |
||
2304 | Value := ClientDataSetIngredientsProd.Value * Ratio; |
||
2305 | else
|
||
2306 | Value := 0;
|
||
2307 | end;
|
||
2308 | 4: // Min?raux |
||
2309 | case ComboBoxMinerals4.ItemIndex of |
||
2310 | 0: // Calcium |
||
2311 | Value := ClientDataSetIngredientsCa.Value * Ratio; |
||
2312 | 1: // Phosphore |
||
2313 | Value := ClientDataSetIngredientsP.Value * Ratio; |
||
2314 | 4 | avalancogn | 2: // Sodium |
2315 | Value := ClientDataSetIngredientsNa.Value * Ratio; |
||
2316 | 3: // Potassium |
||
2317 | Value := ClientDataSetIngredientsK.Value * Ratio; |
||
2318 | 4: // Chlore |
||
2319 | Value := ClientDataSetIngredientsCl.Value * Ratio; |
||
2320 | 5: // Phosphore digestible |
||
2321 | 1 | avalancogn | if ClientDataSetFeedsPresentation.Value = 0 |
2322 | then // Farine (dPphy) |
||
2323 | Value := ClientDataSetIngredientsdPphy.Value / 100 * ClientDataSetIngredientsP.Value * Ratio
|
||
2324 | else // Granul?s (dP) |
||
2325 | Value := ClientDataSetIngredientsdP.Value / 100 * ClientDataSetIngredientsP.Value * Ratio;
|
||
2326 | 5 | avalancogn | 6: // Bilan ?lectrolytique |
2327 | Value := ClientDataSetIngredientsBE.Value * Ratio; |
||
2328 | 1 | avalancogn | else
|
2329 | Value := 0;
|
||
2330 | end;
|
||
2331 | else
|
||
2332 | Value := 0;
|
||
2333 | end;
|
||
2334 | if (FormOptions.Expression = 1) |
||
2335 | and ((ComboBoxType4.ItemIndex <> 0) or (ComboBoxProximal4.ItemIndex > 1)) |
||
2336 | then // Conversion frais -> sec (mati?re s?che du r?gime) - except? pour Composition et MS |
||
2337 | Value := Value / InputProximal(ClientDataSetFeedsMS.Value, 1, 1, FormOptions.Proximal); |
||
2338 | if Value > 0 |
||
2339 | then // Prendre en compte la valeur |
||
2340 | begin
|
||
2341 | FeedBar := TBarSeries.Create(Chart4); |
||
2342 | FeedBar.ParentChart := Chart4; |
||
2343 | FeedBar.Title := Format('%s (%1.2f %%)', [IngredientName, Value / Cumul * 100]); |
||
2344 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
2345 | FeedBar.MultiBar := mbStacked100; |
||
2346 | FeedBar.Marks.Visible := False; |
||
2347 | Chart4.AddSeries(FeedBar); |
||
2348 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
2349 | Total := Total + Value; |
||
2350 | end;
|
||
2351 | ClientDataSetComposition.Next; |
||
2352 | end;
|
||
2353 | ClientDataSetIngredients.Filtered := False; |
||
2354 | ClientDataSetIngredients.Filter := '';
|
||
2355 | // Cas particuliers
|
||
2356 | if (ComboBoxType4.ItemIndex = 1) |
||
2357 | and ((ComboBoxEnergy4.ItemIndex = 1) |
||
2358 | or (ComboBoxEnergy4.ItemIndex = 3) |
||
2359 | or (ComboBoxEnergy4.ItemIndex = 5)) |
||
2360 | and (ClientDataSetFeedsBonusC.Value > 0) |
||
2361 | then // Bonus ?nergie (porc croissance) |
||
2362 | begin
|
||
2363 | case ComboBoxEnergy4.ItemIndex of |
||
2364 | 1: Value := ClientDataSetFeedsEDc.Value - Total;
|
||
2365 | 3: Value := ClientDataSetFeedsEMc.Value - Total;
|
||
2366 | 5: Value := ClientDataSetFeedsENc.Value - Total;
|
||
2367 | else Value := 0; |
||
2368 | end;
|
||
2369 | FeedBar := TBarSeries.Create(Chart4); |
||
2370 | FeedBar.ParentChart := Chart4; |
||
2371 | FeedBar.Title := Format('%s (%1.2f %%)', [_('Energy bonus'), Value / Cumul * 100]); |
||
2372 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
2373 | FeedBar.MultiBar := mbStacked100; |
||
2374 | FeedBar.Marks.Visible := False; |
||
2375 | Chart4.AddSeries(FeedBar); |
||
2376 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
2377 | Total := Total + Value; |
||
2378 | end;
|
||
2379 | if (ComboBoxType4.ItemIndex = 1) |
||
2380 | and ((ComboBoxEnergy4.ItemIndex = 2) |
||
2381 | or (ComboBoxEnergy4.ItemIndex = 4) |
||
2382 | or (ComboBoxEnergy4.ItemIndex = 6)) |
||
2383 | and (ClientDataSetFeedsBonusT.Value > 0) |
||
2384 | then // Bonus ?nergie (porc adulte) |
||
2385 | begin
|
||
2386 | case ComboBoxEnergy4.ItemIndex of |
||
2387 | 2: Value := ClientDataSetFeedsEDt.Value - Total;
|
||
2388 | 4: Value := ClientDataSetFeedsEMt.Value - Total;
|
||
2389 | 6: Value := ClientDataSetFeedsENt.Value - Total;
|
||
2390 | else Value := 0; |
||
2391 | end;
|
||
2392 | FeedBar := TBarSeries.Create(Chart4); |
||
2393 | FeedBar.ParentChart := Chart4; |
||
2394 | FeedBar.Title := Format('%s (%1.2f %%)', [_('Energy bonus'), Value / Cumul * 100]); |
||
2395 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
2396 | FeedBar.MultiBar := mbStacked100; |
||
2397 | FeedBar.Marks.Visible := False; |
||
2398 | Chart4.AddSeries(FeedBar); |
||
2399 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
2400 | Total := Total + Value; |
||
2401 | end;
|
||
2402 | if (ComboBoxType4.ItemIndex = 0) |
||
2403 | and (ComboBoxProximal4.ItemIndex = 0) |
||
2404 | and not ClientDataSetFeedsPhytaseId.IsNull |
||
2405 | and (ClientDataSetFeedsPhytaseLevel.Value > 0) |
||
2406 | then // Phytase (taux d'incorporation) |
||
2407 | begin
|
||
2408 | Ratio := InputIncorporation(ClientDataSetFeedsPhytaseLevel.Value, FormOptions.Incorporation); |
||
2409 | Value := OutputProximal(Ratio, 1, 1, FormOptions.Proximal); |
||
2410 | FeedBar := TBarSeries.Create(Chart4); |
||
2411 | FeedBar.ParentChart := Chart4; |
||
2412 | FeedBar.Title := Format('%s (%1.2f %%)', [_('Phytase'), Value / Cumul * 100]); |
||
2413 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
2414 | FeedBar.MultiBar := mbStacked100; |
||
2415 | FeedBar.Marks.Visible := False; |
||
2416 | Chart4.AddSeries(FeedBar); |
||
2417 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
2418 | Total := Total + Value; |
||
2419 | end;
|
||
2420 | if (ComboBoxType4.ItemIndex = 4) |
||
2421 | and (ComboBoxMinerals4.ItemIndex = 2) |
||
2422 | and not ClientDataSetFeedsPhytaseId.IsNull |
||
2423 | and (ClientDataSetFeedsPd.Value > Total)
|
||
2424 | then // Phytase (Phosphore digestible) |
||
2425 | begin
|
||
2426 | Value := ClientDataSetFeedsPd.Value - Total; |
||
2427 | FeedBar := TBarSeries.Create(Chart4); |
||
2428 | FeedBar.ParentChart := Chart4; |
||
2429 | FeedBar.Title := Format('%s (%1.2f %%)', [_('Phytase'), Value / Cumul * 100]); |
||
2430 | FeedBar.BarPen.Color := FeedBar.SeriesColor; |
||
2431 | FeedBar.MultiBar := mbStacked100; |
||
2432 | FeedBar.Marks.Visible := False; |
||
2433 | Chart4.AddSeries(FeedBar); |
||
2434 | FeedBar.AddBar(Value, '', clTeeColor);
|
||
2435 | Total := Total + Value; |
||
2436 | end;
|
||
2437 | // Total
|
||
2438 | case ComboBoxType4.ItemIndex of |
||
2439 | 0: // Analyse proximale |
||
2440 | if (FormOptions.Expression = 0) or (ComboBoxProximal4.ItemIndex < 2) |
||
2441 | then // sur frais |
||
2442 | Chart4.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.ProximalDecimals, Total, FormOptions.ComboBoxProximal.Items[FormOptions.Proximal]])) |
||
2443 | else // sur mati?re s?che - except? pour Composition et MS |
||
2444 | Chart4.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.ProximalDecimals, Total, FormOptions.ComboBoxProximal.Items[FormOptions.Proximal], _('DM')])); |
||
2445 | 1: // Valeurs ?nerg?tiques |
||
2446 | if FormOptions.Expression = 0 |
||
2447 | then // sur frais |
||
2448 | Chart4.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.EnergyDecimals, Total, FormOptions.ComboBoxEnergy.Items[FormOptions.Energy]])) |
||
2449 | else // sur mati?re s?che |
||
2450 | Chart4.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.EnergyDecimals, Total, FormOptions.ComboBoxEnergy.Items[FormOptions.Energy], _('DM')])); |
||
2451 | 2, 3: // Acides amin?s |
||
2452 | if FormOptions.Expression = 0 |
||
2453 | then // sur frais |
||
2454 | Chart4.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.AADecimals, Total, FormOptions.ComboBoxAA.Items[FormOptions.AA]])) |
||
2455 | else // sur mati?re s?che |
||
2456 | Chart4.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.AADecimals, Total, FormOptions.ComboBoxAA.Items[FormOptions.AA], _('DM')])); |
||
2457 | 4: // Min?raux |
||
2458 | 5 | avalancogn | if ComboBoxMinerals4.ItemIndex = 6 |
2459 | then // Bilan ?lectrolytique |
||
2460 | if FormOptions.Expression = 0 |
||
2461 | then // sur frais |
||
2462 | Chart4.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), 1, Total, _('mEq/kg')])) |
||
2463 | else // sur mati?re s?che |
||
2464 | Chart4.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), 1, Total, _('mEq/kg'), _('DM')])) |
||
2465 | else
|
||
2466 | if FormOptions.Expression = 0 |
||
2467 | then // sur frais |
||
2468 | Chart4.SubTitle.Text.Add(Format('%s %1.*f %s', [_('Total:'), FormOptions.MineralsDecimals, Total, FormOptions.ComboBoxMinerals.Items[FormOptions.Minerals]])) |
||
2469 | else // sur mati?re s?che |
||
2470 | Chart4.SubTitle.Text.Add(Format('%s %1.*f %s %s', [_('Total:'), FormOptions.MineralsDecimals, Total, FormOptions.ComboBoxMinerals.Items[FormOptions.Minerals], _('DM')])); |
||
2471 | 1 | avalancogn | end;
|
2472 | end;
|
||
2473 | end;
|
||
2474 | |||
2475 | procedure TFormFeedCharts.ComboBoxType0Change(Sender: TObject);
|
||
2476 | begin
|
||
2477 | ComboBoxProximal0.Visible := False; |
||
2478 | ComboBoxEnergy0.Visible := False; |
||
2479 | ComboBoxAA0.Visible := False; |
||
2480 | ComboBoxMinerals0.Visible := False; |
||
2481 | case ComboBoxType0.ItemIndex of |
||
2482 | 0: // Analyse proximale |
||
2483 | ComboBoxProximal0.Visible := True; |
||
2484 | 1: // Valeurs ?nerg?tiques |
||
2485 | ComboBoxEnergy0.Visible := True; |
||
2486 | 2, 3: // Acides amin?s |
||
2487 | ComboBoxAA0.Visible := True; |
||
2488 | 4: // Min?raux |
||
2489 | ComboBoxMinerals0.Visible := True; |
||
2490 | end;
|
||
2491 | ComboBoxOption0Change(nil);
|
||
2492 | end;
|
||
2493 | |||
2494 | procedure TFormFeedCharts.ComboBoxType1Change(Sender: TObject);
|
||
2495 | begin
|
||
2496 | ComboBoxProximal1.Visible := False; |
||
2497 | ComboBoxEnergy1.Visible := False; |
||
2498 | ComboBoxAA1.Visible := False; |
||
2499 | ComboBoxMinerals1.Visible := False; |
||
2500 | case ComboBoxType1.ItemIndex of |
||
2501 | 0: // Analyse proximale |
||
2502 | ComboBoxProximal1.Visible := True; |
||
2503 | 1: // Valeurs ?nerg?tiques |
||
2504 | ComboBoxEnergy1.Visible := True; |
||
2505 | 2, 3: // Acides amin?s |
||
2506 | ComboBoxAA1.Visible := True; |
||
2507 | 4: // Min?raux |
||
2508 | ComboBoxMinerals1.Visible := True; |
||
2509 | end;
|
||
2510 | ComboBoxOption1Change(nil);
|
||
2511 | end;
|
||
2512 | |||
2513 | procedure TFormFeedCharts.ComboBoxType2Change(Sender: TObject);
|
||
2514 | begin
|
||
2515 | ComboBoxProximal2.Visible := False; |
||
2516 | ComboBoxEnergy2.Visible := False; |
||
2517 | ComboBoxAA2.Visible := False; |
||
2518 | ComboBoxMinerals2.Visible := False; |
||
2519 | case ComboBoxType2.ItemIndex of |
||
2520 | 0: // Analyse proximale |
||
2521 | ComboBoxProximal2.Visible := True; |
||
2522 | 1: // Valeurs ?nerg?tiques |
||
2523 | ComboBoxEnergy2.Visible := True; |
||
2524 | 2, 3: // Acides amin?s |
||
2525 | ComboBoxAA2.Visible := True; |
||
2526 | 4: // Min?raux |
||
2527 | ComboBoxMinerals2.Visible := True; |
||
2528 | end;
|
||
2529 | ComboBoxOption2Change(nil);
|
||
2530 | end;
|
||
2531 | |||
2532 | procedure TFormFeedCharts.ComboBoxType3Change(Sender: TObject);
|
||
2533 | begin
|
||
2534 | ComboBoxProximal3.Visible := False; |
||
2535 | ComboBoxEnergy3.Visible := False; |
||
2536 | ComboBoxAA3.Visible := False; |
||
2537 | ComboBoxMinerals3.Visible := False; |
||
2538 | case ComboBoxType3.ItemIndex of |
||
2539 | 0: // Analyse proximale |
||
2540 | ComboBoxProximal3.Visible := True; |
||
2541 | 1: // Valeurs ?nerg?tiques |
||
2542 | ComboBoxEnergy3.Visible := True; |
||
2543 | 2, 3: // Acides amin?s |
||
2544 | ComboBoxAA3.Visible := True; |
||
2545 | 4: // Min?raux |
||
2546 | ComboBoxMinerals3.Visible := True; |
||
2547 | end;
|
||
2548 | ComboBoxOption3Change(nil);
|
||
2549 | end;
|
||
2550 | |||
2551 | procedure TFormFeedCharts.ComboBoxType4Change(Sender: TObject);
|
||
2552 | begin
|
||
2553 | ComboBoxProximal4.Visible := False; |
||
2554 | ComboBoxEnergy4.Visible := False; |
||
2555 | ComboBoxAA4.Visible := False; |
||
2556 | ComboBoxMinerals4.Visible := False; |
||
2557 | case ComboBoxType4.ItemIndex of |
||
2558 | 0: // Analyse proximale |
||
2559 | ComboBoxProximal4.Visible := True; |
||
2560 | 1: // Valeurs ?nerg?tiques |
||
2561 | ComboBoxEnergy4.Visible := True; |
||
2562 | 2, 3: // Acides amin?s |
||
2563 | ComboBoxAA4.Visible := True; |
||
2564 | 4: // Min?raux |
||
2565 | ComboBoxMinerals4.Visible := True; |
||
2566 | end;
|
||
2567 | ComboBoxOption4Change(nil);
|
||
2568 | end;
|
||
2569 | |||
2570 | procedure TFormFeedCharts.FormCreate(Sender: TObject);
|
||
2571 | begin
|
||
2572 | if Screen.Fonts.IndexOf('Arial Unicode MS') <> -1 |
||
2573 | then
|
||
2574 | begin
|
||
2575 | Font.Name := 'Arial Unicode MS';
|
||
2576 | SetChartFont(Chart0, 'Arial Unicode MS');
|
||
2577 | SeriesPie.Marks.Font.Name := 'Arial Unicode MS';
|
||
2578 | // SeriesPie.OtherSlice.Legend.Font.Name := 'Arial Unicode MS';
|
||
2579 | SetChartFont(Chart1, 'Arial Unicode MS');
|
||
2580 | SetChartFont(Chart2, 'Arial Unicode MS');
|
||
2581 | SetChartFont(Chart3, 'Arial Unicode MS');
|
||
2582 | SetChartFont(Chart4, 'Arial Unicode MS');
|
||
2583 | end;
|
||
2584 | // PanelButtons.Font.Size := PanelButtons.Font.Size + 2;
|
||
2585 | PanelButtons.Font.Style := [fsBold]; |
||
2586 | TranslateComponent(Self); |
||
2587 | // S?lection des ?l?ments par d?faut apr?s traduction des listes
|
||
2588 | ComboBoxType0.ItemIndex := 0;
|
||
2589 | ComboBoxProximal0.ItemIndex := 0;
|
||
2590 | ComboBoxEnergy0.ItemIndex := 0;
|
||
2591 | ComboBoxAA0.ItemIndex := 0;
|
||
2592 | ComboBoxMinerals0.ItemIndex := 0;
|
||
2593 | Chart0.SubTitle.Clear; |
||
2594 | Chart1.Title.Clear; |
||
2595 | Chart1.SubTitle.Clear; |
||
2596 | Chart2.Title.Clear; |
||
2597 | Chart2.SubTitle.Clear; |
||
2598 | Chart3.Title.Clear; |
||
2599 | Chart3.SubTitle.Clear; |
||
2600 | Chart4.Title.Clear; |
||
2601 | Chart4.SubTitle.Clear; |
||
2602 | with DataModuleDeclaration do |
||
2603 | begin
|
||
2604 | ClientDataSetComposition.Filter := Format('Feed = %d', [ClientDataSetFeedsId.Value]);
|
||
2605 | ClientDataSetComposition.Filtered := True; |
||
2606 | Chart0.Title.Caption := ClientDataSetFeedsName.Value; |
||
2607 | Chart1.Title.Caption := ClientDataSetFeedsName.Value; |
||
2608 | Chart2.Title.Caption := ClientDataSetFeedsName.Value; |
||
2609 | Chart3.Title.Caption := ClientDataSetFeedsName.Value; |
||
2610 | Chart4.Title.Caption := ClientDataSetFeedsName.Value; |
||
2611 | end;
|
||
2612 | end;
|
||
2613 | |||
2614 | procedure TFormFeedCharts.FormDestroy(Sender: TObject);
|
||
2615 | begin
|
||
2616 | with DataModuleDeclaration do |
||
2617 | begin
|
||
2618 | ClientDataSetComposition.Filtered := False; |
||
2619 | ClientDataSetComposition.Filter := '';
|
||
2620 | end;
|
||
2621 | end;
|
||
2622 | |||
2623 | procedure TFormFeedCharts.FormShow(Sender: TObject);
|
||
2624 | begin
|
||
2625 | ComboBoxOption0Change(nil);
|
||
2626 | end;
|
||
2627 | |||
2628 | procedure TFormFeedCharts.FormResize(Sender: TObject);
|
||
2629 | var
|
||
2630 | W, H: Integer; |
||
2631 | begin
|
||
2632 | W := TabSheetChartsComparison.Width div 2; |
||
2633 | H := TabSheetChartsComparison.Height div 2; |
||
2634 | GroupBoxChart1.SetBounds(0, 0, W, H); |
||
2635 | GroupBoxChart2.SetBounds(W, 0, W, H);
|
||
2636 | GroupBoxChart3.SetBounds(0, H, W, H);
|
||
2637 | GroupBoxChart4.SetBounds(W, H, W, H); |
||
2638 | end;
|
||
2639 | |||
2640 | procedure TFormFeedCharts.SpeedButton2D3D0Click(Sender: TObject);
|
||
2641 | begin
|
||
2642 | Chart0.View3D := not Chart0.View3D;
|
||
2643 | if Chart0.View3D
|
||
2644 | then
|
||
2645 | SpeedButton2D3D0.Caption := _('2D')
|
||
2646 | else
|
||
2647 | SpeedButton2D3D0.Caption := _('3D');
|
||
2648 | end;
|
||
2649 | |||
2650 | procedure TFormFeedCharts.SpeedButton2D3D1Click(Sender: TObject);
|
||
2651 | begin
|
||
2652 | Chart1.View3D := not Chart1.View3D;
|
||
2653 | if Chart1.View3D
|
||
2654 | then
|
||
2655 | SpeedButton2D3D1.Caption := _('2D')
|
||
2656 | else
|
||
2657 | SpeedButton2D3D1.Caption := _('3D');
|
||
2658 | end;
|
||
2659 | |||
2660 | procedure TFormFeedCharts.SpeedButton2D3D2Click(Sender: TObject);
|
||
2661 | begin
|
||
2662 | Chart2.View3D := not Chart2.View3D;
|
||
2663 | if Chart2.View3D
|
||
2664 | then
|
||
2665 | SpeedButton2D3D2.Caption := _('2D')
|
||
2666 | else
|
||
2667 | SpeedButton2D3D2.Caption := _('3D');
|
||
2668 | end;
|
||
2669 | |||
2670 | procedure TFormFeedCharts.SpeedButton2D3D3Click(Sender: TObject);
|
||
2671 | begin
|
||
2672 | Chart3.View3D := not Chart3.View3D;
|
||
2673 | if Chart3.View3D
|
||
2674 | then
|
||
2675 | SpeedButton2D3D3.Caption := _('2D')
|
||
2676 | else
|
||
2677 | SpeedButton2D3D3.Caption := _('3D');
|
||
2678 | end;
|
||
2679 | |||
2680 | procedure TFormFeedCharts.SpeedButton2D3D4Click(Sender: TObject);
|
||
2681 | begin
|
||
2682 | Chart4.View3D := not Chart4.View3D;
|
||
2683 | if Chart4.View3D
|
||
2684 | then
|
||
2685 | SpeedButton2D3D4.Caption := _('2D')
|
||
2686 | else
|
||
2687 | SpeedButton2D3D4.Caption := _('3D');
|
||
2688 | end;
|
||
2689 | |||
2690 | procedure TFormFeedCharts.SpeedButtonPrint0Click(Sender: TObject);
|
||
2691 | begin
|
||
2692 | FormChartHReport := TFormChartHReport.Create(nil);
|
||
2693 | try
|
||
2694 | FormChartHReport.QRChart1.Chart.View3D := Chart0.View3D; |
||
2695 | FormChartHReport.QRChart1.Chart.Title.Assign(Chart0.Title); |
||
2696 | FormChartHReport.QRChart1.Chart.SubTitle.Assign(Chart0.SubTitle); |
||
2697 | FormChartHReport.QRChart1.Chart.Legend.Visible := False; |
||
2698 | SeriesPie.OtherSlice.Style := poNone; |
||
2699 | CloneChartSeries(SeriesPie).ParentChart := FormChartHReport.QRChart1.Chart; |
||
2700 | if Chart0.View3D
|
||
2701 | then
|
||
2702 | begin
|
||
2703 | FormChartHReport.QRChart1.Chart.FreeAllSeries(nil);
|
||
2704 | CloneChartSeries(SeriesPie).ParentChart := FormChartHReport.QRChart1.Chart; |
||
2705 | end;
|
||
2706 | SeriesPie.OtherSlice.Style := poBelowPercent; |
||
2707 | TPieSeries(FormChartHReport.QRChart1.Chart[0]).OtherSlice.Style := poBelowPercent;
|
||
2708 | FormChartHReport.QuickRepChart.PrinterSetup; |
||
2709 | if FormChartHReport.QuickRepChart.Tag = 0 |
||
2710 | then
|
||
2711 | FormChartHReport.QuickRepChart.Print; |
||
2712 | finally
|
||
2713 | FormChartHReport.Release; |
||
2714 | end;
|
||
2715 | end;
|
||
2716 | |||
2717 | procedure TFormFeedCharts.SpeedButtonPrint1Click(Sender: TObject);
|
||
2718 | var
|
||
2719 | i: Integer; |
||
2720 | begin
|
||
2721 | FormChartHReport := TFormChartHReport.Create(nil);
|
||
2722 | try
|
||
2723 | FormChartHReport.QRChart1.Chart.View3D := Chart1.View3D; |
||
2724 | FormChartHReport.QRChart1.Chart.Title.Assign(Chart1.Title); |
||
2725 | FormChartHReport.QRChart1.Chart.SubTitle.Assign(Chart1.SubTitle); |
||
2726 | FormChartHReport.QRChart1.Chart.BottomAxis.Labels := False; |
||
2727 | for i := 0 to Chart1.SeriesCount - 1 do |
||
2728 | CloneChartSeries(Chart1[i]).ParentChart := FormChartHReport.QRChart1.Chart; |
||
2729 | FormChartHReport.QuickRepChart.PrinterSetup; |
||
2730 | if FormChartHReport.QuickRepChart.Tag = 0 |
||
2731 | then
|
||
2732 | FormChartHReport.QuickRepChart.Print; |
||
2733 | finally
|
||
2734 | FormChartHReport.Release; |
||
2735 | end;
|
||
2736 | end;
|
||
2737 | |||
2738 | procedure TFormFeedCharts.SpeedButtonPrint2Click(Sender: TObject);
|
||
2739 | var
|
||
2740 | i: Integer; |
||
2741 | begin
|
||
2742 | FormChartHReport := TFormChartHReport.Create(nil);
|
||
2743 | try
|
||
2744 | FormChartHReport.QRChart1.Chart.View3D := Chart2.View3D; |
||
2745 | FormChartHReport.QRChart1.Chart.Title.Assign(Chart2.Title); |
||
2746 | FormChartHReport.QRChart1.Chart.SubTitle.Assign(Chart2.SubTitle); |
||
2747 | FormChartHReport.QRChart1.Chart.BottomAxis.Labels := False; |
||
2748 | for i := 0 to Chart2.SeriesCount - 1 do |
||
2749 | CloneChartSeries(Chart2[i]).ParentChart := FormChartHReport.QRChart1.Chart; |
||
2750 | FormChartHReport.QuickRepChart.PrinterSetup; |
||
2751 | if FormChartHReport.QuickRepChart.Tag = 0 |
||
2752 | then
|
||
2753 | FormChartHReport.QuickRepChart.Print; |
||
2754 | finally
|
||
2755 | FormChartHReport.Release; |
||
2756 | end;
|
||
2757 | end;
|
||
2758 | |||
2759 | procedure TFormFeedCharts.SpeedButtonPrint3Click(Sender: TObject);
|
||
2760 | var
|
||
2761 | i: Integer; |
||
2762 | begin
|
||
2763 | FormChartHReport := TFormChartHReport.Create(nil);
|
||
2764 | try
|
||
2765 | FormChartHReport.QRChart1.Chart.View3D := Chart3.View3D; |
||
2766 | FormChartHReport.QRChart1.Chart.Title.Assign(Chart3.Title); |
||
2767 | FormChartHReport.QRChart1.Chart.SubTitle.Assign(Chart3.SubTitle); |
||
2768 | FormChartHReport.QRChart1.Chart.BottomAxis.Labels := False; |
||
2769 | for i := 0 to Chart3.SeriesCount - 1 do |
||
2770 | CloneChartSeries(Chart3[i]).ParentChart := FormChartHReport.QRChart1.Chart; |
||
2771 | FormChartHReport.QuickRepChart.PrinterSetup; |
||
2772 | if FormChartHReport.QuickRepChart.Tag = 0 |
||
2773 | then
|
||
2774 | FormChartHReport.QuickRepChart.Print; |
||
2775 | finally
|
||
2776 | FormChartHReport.Release; |
||
2777 | end;
|
||
2778 | end;
|
||
2779 | |||
2780 | procedure TFormFeedCharts.SpeedButtonPrint4Click(Sender: TObject);
|
||
2781 | var
|
||
2782 | i: Integer; |
||
2783 | begin
|
||
2784 | FormChartHReport := TFormChartHReport.Create(nil);
|
||
2785 | try
|
||
2786 | FormChartHReport.QRChart1.Chart.View3D := Chart4.View3D; |
||
2787 | FormChartHReport.QRChart1.Chart.Title.Assign(Chart4.Title); |
||
2788 | FormChartHReport.QRChart1.Chart.SubTitle.Assign(Chart4.SubTitle); |
||
2789 | FormChartHReport.QRChart1.Chart.BottomAxis.Labels := False; |
||
2790 | for i := 0 to Chart4.SeriesCount - 1 do |
||
2791 | CloneChartSeries(Chart4[i]).ParentChart := FormChartHReport.QRChart1.Chart; |
||
2792 | FormChartHReport.QuickRepChart.PrinterSetup; |
||
2793 | if FormChartHReport.QuickRepChart.Tag = 0 |
||
2794 | then
|
||
2795 | FormChartHReport.QuickRepChart.Print; |
||
2796 | finally
|
||
2797 | FormChartHReport.Release; |
||
2798 | end;
|
||
2799 | end;
|
||
2800 | |||
2801 | procedure TFormFeedCharts.WMSysCommand(var Message: TWMSysCommand); |
||
2802 | begin
|
||
2803 | if Message.CmdType = SC_MINIMIZE
|
||
2804 | then
|
||
2805 | Application.Minimize |
||
2806 | else
|
||
2807 | inherited;
|
||
2808 | end;
|
||
2809 | |||
2810 | end. |