root / UnitDeclaration.pas @ 3
Historique | Voir | Annoter | Télécharger (211,527 ko)
1 | 1 | avalancogn | unit UnitDeclaration;
|
---|---|---|---|
2 | |||
3 | interface
|
||
4 | |||
5 | uses
|
||
6 | SysUtils, Classes, DB, DBTables, DbClient, SQLiteTable3, Forms, Windows, |
||
7 | Dialogs, Variants, Math, MidasLib, LbClass, LbCipher, gnugettext; |
||
8 | |||
9 | const
|
||
10 | CALORIE = 4.184; // Conversion J -> cal |
||
11 | NDF_ADF = 3.0;
|
||
12 | NDF_CB = 3.5;
|
||
13 | CoefMAT = 14.73 * 100 * CALORIE / 1000; |
||
14 | CoefMG = 52.4 * 100 * CALORIE / 1000; |
||
15 | CoefMM = -44.6 * 100 * CALORIE / 1000; |
||
16 | dLys = 0.770;
|
||
17 | dThr = 0.760;
|
||
18 | dMet = 0.846;
|
||
19 | dCys = 0.733;
|
||
20 | dMetCys = 0.788;
|
||
21 | dTrp = 0.772;
|
||
22 | dIle = 0.807;
|
||
23 | dVal = 0.777;
|
||
24 | dLeu = 0.833;
|
||
25 | dPhe = 0.842;
|
||
26 | dTyr = 0.855;
|
||
27 | dPheTyr = 0.847;
|
||
28 | dHis = 0.841;
|
||
29 | dArg = 0.887;
|
||
30 | dAla = 0.773;
|
||
31 | dAsp = 0.791;
|
||
32 | dGlu = 0.861;
|
||
33 | dGly = 0.718;
|
||
34 | dSer = 0.807;
|
||
35 | dPro = 0.787;
|
||
36 | |||
37 | type
|
||
38 | TDataModuleDeclaration = class(TDataModule)
|
||
39 | ClientDataSetClasses: TClientDataSet; |
||
40 | ClientDataSetClassesId: TIntegerField; |
||
41 | ClientDataSetClassesName: TWideStringField; |
||
42 | ClientDataSetInraAfz: TClientDataSet; |
||
43 | ClientDataSetInraAfzId: TAutoIncField; |
||
44 | ClientDataSetInraAfzName: TStringField; |
||
45 | 3 | avalancogn | ClientDataSetInraAfzComment: TStringField; |
46 | 1 | avalancogn | ClientDataSetInraAfzSource: TStringField; |
47 | ClientDataSetInraAfzClass: TIntegerField; |
||
48 | ClientDataSetInraAfzMS: TFloatField; |
||
49 | ClientDataSetInraAfzMM: TFloatField; |
||
50 | ClientDataSetInraAfzMAT: TFloatField; |
||
51 | ClientDataSetInraAfzMG: TFloatField; |
||
52 | ClientDataSetInraAfzCB: TFloatField; |
||
53 | ClientDataSetInraAfzCoefCB: TFloatField; |
||
54 | ClientDataSetInraAfzNDF: TFloatField; |
||
55 | ClientDataSetInraAfzCoefNDF: TFloatField; |
||
56 | ClientDataSetInraAfzADF: TFloatField; |
||
57 | ClientDataSetInraAfzCoefADF: TFloatField; |
||
58 | ClientDataSetInraAfzADL: TFloatField; |
||
59 | ClientDataSetInraAfzAmidon: TFloatField; |
||
60 | ClientDataSetInraAfzSucres: TFloatField; |
||
61 | ClientDataSetInraAfzEB: TFloatField; |
||
62 | ClientDataSetInraAfzdEc: TFloatField; |
||
63 | ClientDataSetInraAfzEMc_EDc: TFloatField; |
||
64 | ClientDataSetInraAfzENc_EMc: TFloatField; |
||
65 | ClientDataSetInraAfzEMt_EDt: TFloatField; |
||
66 | ClientDataSetInraAfzENt_EMt: TFloatField; |
||
67 | ClientDataSetInraAfzEDt_EDc: TFloatField; |
||
68 | ClientDataSetInraAfza: TFloatField; |
||
69 | ClientDataSetInraAfzb: TFloatField; |
||
70 | ClientDataSetInraAfzdNc: TFloatField; |
||
71 | ClientDataSetInraAfzdNt: TFloatField; |
||
72 | ClientDataSetInraAfzLys: TFloatField; |
||
73 | ClientDataSetInraAfzThr: TFloatField; |
||
74 | ClientDataSetInraAfzMet: TFloatField; |
||
75 | ClientDataSetInraAfzCys: TFloatField; |
||
76 | ClientDataSetInraAfzMetCys: TFloatField; |
||
77 | ClientDataSetInraAfzTrp: TFloatField; |
||
78 | ClientDataSetInraAfzIle: TFloatField; |
||
79 | ClientDataSetInraAfzVal: TFloatField; |
||
80 | ClientDataSetInraAfzLeu: TFloatField; |
||
81 | ClientDataSetInraAfzPhe: TFloatField; |
||
82 | ClientDataSetInraAfzTyr: TFloatField; |
||
83 | ClientDataSetInraAfzPheTyr: TFloatField; |
||
84 | ClientDataSetInraAfzHis: TFloatField; |
||
85 | ClientDataSetInraAfzArg: TFloatField; |
||
86 | ClientDataSetInraAfzAla: TFloatField; |
||
87 | ClientDataSetInraAfzAsp: TFloatField; |
||
88 | ClientDataSetInraAfzGlu: TFloatField; |
||
89 | ClientDataSetInraAfzGly: TFloatField; |
||
90 | ClientDataSetInraAfzSer: TFloatField; |
||
91 | ClientDataSetInraAfzPro: TFloatField; |
||
92 | ClientDataSetInraAfzdLys: TFloatField; |
||
93 | ClientDataSetInraAfzdThr: TFloatField; |
||
94 | ClientDataSetInraAfzdMet: TFloatField; |
||
95 | ClientDataSetInraAfzdCys: TFloatField; |
||
96 | ClientDataSetInraAfzdMetCys: TFloatField; |
||
97 | ClientDataSetInraAfzdTrp: TFloatField; |
||
98 | ClientDataSetInraAfzdIle: TFloatField; |
||
99 | ClientDataSetInraAfzdVal: TFloatField; |
||
100 | ClientDataSetInraAfzdLeu: TFloatField; |
||
101 | ClientDataSetInraAfzdPhe: TFloatField; |
||
102 | ClientDataSetInraAfzdTyr: TFloatField; |
||
103 | ClientDataSetInraAfzdPheTyr: TFloatField; |
||
104 | ClientDataSetInraAfzdHis: TFloatField; |
||
105 | ClientDataSetInraAfzdArg: TFloatField; |
||
106 | ClientDataSetInraAfzdAla: TFloatField; |
||
107 | ClientDataSetInraAfzdAsp: TFloatField; |
||
108 | ClientDataSetInraAfzdGlu: TFloatField; |
||
109 | ClientDataSetInraAfzdGly: TFloatField; |
||
110 | ClientDataSetInraAfzdSer: TFloatField; |
||
111 | ClientDataSetInraAfzdPro: TFloatField; |
||
112 | ClientDataSetInraAfzCa: TFloatField; |
||
113 | ClientDataSetInraAfzP: TFloatField; |
||
114 | ClientDataSetInraAfzdP: TFloatField; |
||
115 | ClientDataSetInraAfzdPphy: TFloatField; |
||
116 | 3 | avalancogn | ClientDataSetInraAfzNa: TFloatField; |
117 | ClientDataSetInraAfzK: TFloatField; |
||
118 | ClientDataSetInraAfzCl: TFloatField; |
||
119 | 1 | avalancogn | DataSourceInraAfz: TDataSource; |
120 | ClientDataSetIngredients: TClientDataSet; |
||
121 | ClientDataSetIngredientsId: TIntegerField; |
||
122 | ClientDataSetIngredientsName: TWideStringField; |
||
123 | ClientDataSetIngredientsDefinition: TWideStringField; |
||
124 | ClientDataSetIngredientsClass: TIntegerField; |
||
125 | ClientDataSetIngredientsClassName: TWideStringField; |
||
126 | ClientDataSetIngredientsUser: TBooleanField; |
||
127 | ClientDataSetIngredientsModel: TIntegerField; |
||
128 | ClientDataSetIngredientsSource: TWideStringField; |
||
129 | ClientDataSetIngredientsMS: TFloatField; |
||
130 | ClientDataSetIngredientsMS2: TFloatField; |
||
131 | ClientDataSetIngredientsMM: TFloatField; |
||
132 | ClientDataSetIngredientsMAT: TFloatField; |
||
133 | ClientDataSetIngredientsMG: TFloatField; |
||
134 | ClientDataSetIngredientsCB: TFloatField; |
||
135 | ClientDataSetIngredientsNDF: TFloatField; |
||
136 | ClientDataSetIngredientsADF: TFloatField; |
||
137 | ClientDataSetIngredientsADL: TFloatField; |
||
138 | ClientDataSetIngredientsAmidon: TFloatField; |
||
139 | ClientDataSetIngredientsSucres: TFloatField; |
||
140 | ClientDataSetIngredientsEB: TFloatField; |
||
141 | ClientDataSetIngredientsBonus: TFloatField; |
||
142 | ClientDataSetIngredientsdEc: TFloatField; |
||
143 | ClientDataSetIngredientsEDc: TFloatField; |
||
144 | ClientDataSetIngredientsEMc_EDc: TFloatField; |
||
145 | ClientDataSetIngredientsEMc: TFloatField; |
||
146 | ClientDataSetIngredientsENc_EMc: TFloatField; |
||
147 | ClientDataSetIngredientsENc: TFloatField; |
||
148 | ClientDataSetIngredientsdEt: TFloatField; |
||
149 | ClientDataSetIngredientsEDt: TFloatField; |
||
150 | ClientDataSetIngredientsEMt_EDt: TFloatField; |
||
151 | ClientDataSetIngredientsEMt: TFloatField; |
||
152 | ClientDataSetIngredientsENt_EMt: TFloatField; |
||
153 | ClientDataSetIngredientsENt: TFloatField; |
||
154 | ClientDataSetIngredientsEDt_EDc: TFloatField; |
||
155 | ClientDataSetIngredientsEMt_EMc: TFloatField; |
||
156 | ClientDataSetIngredientsENt_ENc: TFloatField; |
||
157 | ClientDataSetIngredientsdNc: TFloatField; |
||
158 | ClientDataSetIngredientsdNt: TFloatField; |
||
159 | ClientDataSetIngredientsLys: TFloatField; |
||
160 | ClientDataSetIngredientsThr: TFloatField; |
||
161 | ClientDataSetIngredientsMet: TFloatField; |
||
162 | ClientDataSetIngredientsCys: TFloatField; |
||
163 | ClientDataSetIngredientsMetCys: TFloatField; |
||
164 | ClientDataSetIngredientsTrp: TFloatField; |
||
165 | ClientDataSetIngredientsIle: TFloatField; |
||
166 | ClientDataSetIngredientsVal: TFloatField; |
||
167 | ClientDataSetIngredientsLeu: TFloatField; |
||
168 | ClientDataSetIngredientsPhe: TFloatField; |
||
169 | ClientDataSetIngredientsTyr: TFloatField; |
||
170 | ClientDataSetIngredientsPheTyr: TFloatField; |
||
171 | ClientDataSetIngredientsHis: TFloatField; |
||
172 | ClientDataSetIngredientsArg: TFloatField; |
||
173 | ClientDataSetIngredientsAla: TFloatField; |
||
174 | ClientDataSetIngredientsAsp: TFloatField; |
||
175 | ClientDataSetIngredientsGlu: TFloatField; |
||
176 | ClientDataSetIngredientsGly: TFloatField; |
||
177 | ClientDataSetIngredientsSer: TFloatField; |
||
178 | ClientDataSetIngredientsPro: TFloatField; |
||
179 | ClientDataSetIngredientsLys_MAT: TFloatField; |
||
180 | ClientDataSetIngredientsThr_MAT: TFloatField; |
||
181 | ClientDataSetIngredientsMet_MAT: TFloatField; |
||
182 | ClientDataSetIngredientsCys_MAT: TFloatField; |
||
183 | ClientDataSetIngredientsMetCys_MAT: TFloatField; |
||
184 | ClientDataSetIngredientsTrp_MAT: TFloatField; |
||
185 | ClientDataSetIngredientsIle_MAT: TFloatField; |
||
186 | ClientDataSetIngredientsVal_MAT: TFloatField; |
||
187 | ClientDataSetIngredientsLeu_MAT: TFloatField; |
||
188 | ClientDataSetIngredientsPhe_MAT: TFloatField; |
||
189 | ClientDataSetIngredientsTyr_MAT: TFloatField; |
||
190 | ClientDataSetIngredientsPheTyr_MAT: TFloatField; |
||
191 | ClientDataSetIngredientsHis_MAT: TFloatField; |
||
192 | ClientDataSetIngredientsArg_MAT: TFloatField; |
||
193 | ClientDataSetIngredientsAla_MAT: TFloatField; |
||
194 | ClientDataSetIngredientsAsp_MAT: TFloatField; |
||
195 | ClientDataSetIngredientsGlu_MAT: TFloatField; |
||
196 | ClientDataSetIngredientsGly_MAT: TFloatField; |
||
197 | ClientDataSetIngredientsSer_MAT: TFloatField; |
||
198 | ClientDataSetIngredientsPro_MAT: TFloatField; |
||
199 | ClientDataSetIngredientsdLys: TFloatField; |
||
200 | ClientDataSetIngredientsdThr: TFloatField; |
||
201 | ClientDataSetIngredientsdMet: TFloatField; |
||
202 | ClientDataSetIngredientsdCys: TFloatField; |
||
203 | ClientDataSetIngredientsdMetCys: TFloatField; |
||
204 | ClientDataSetIngredientsdTrp: TFloatField; |
||
205 | ClientDataSetIngredientsdIle: TFloatField; |
||
206 | ClientDataSetIngredientsdVal: TFloatField; |
||
207 | ClientDataSetIngredientsdLeu: TFloatField; |
||
208 | ClientDataSetIngredientsdPhe: TFloatField; |
||
209 | ClientDataSetIngredientsdTyr: TFloatField; |
||
210 | ClientDataSetIngredientsdPheTyr: TFloatField; |
||
211 | ClientDataSetIngredientsdHis: TFloatField; |
||
212 | ClientDataSetIngredientsdArg: TFloatField; |
||
213 | ClientDataSetIngredientsdAla: TFloatField; |
||
214 | ClientDataSetIngredientsdAsp: TFloatField; |
||
215 | ClientDataSetIngredientsdGlu: TFloatField; |
||
216 | ClientDataSetIngredientsdGly: TFloatField; |
||
217 | ClientDataSetIngredientsdSer: TFloatField; |
||
218 | ClientDataSetIngredientsdPro: TFloatField; |
||
219 | ClientDataSetIngredientsLysd: TFloatField; |
||
220 | ClientDataSetIngredientsThrd: TFloatField; |
||
221 | ClientDataSetIngredientsMetd: TFloatField; |
||
222 | ClientDataSetIngredientsCysd: TFloatField; |
||
223 | ClientDataSetIngredientsMetCysd: TFloatField; |
||
224 | ClientDataSetIngredientsTrpd: TFloatField; |
||
225 | ClientDataSetIngredientsIled: TFloatField; |
||
226 | ClientDataSetIngredientsVald: TFloatField; |
||
227 | ClientDataSetIngredientsLeud: TFloatField; |
||
228 | ClientDataSetIngredientsPhed: TFloatField; |
||
229 | ClientDataSetIngredientsTyrd: TFloatField; |
||
230 | ClientDataSetIngredientsPheTyrd: TFloatField; |
||
231 | ClientDataSetIngredientsHisd: TFloatField; |
||
232 | ClientDataSetIngredientsArgd: TFloatField; |
||
233 | ClientDataSetIngredientsAlad: TFloatField; |
||
234 | ClientDataSetIngredientsAspd: TFloatField; |
||
235 | ClientDataSetIngredientsGlud: TFloatField; |
||
236 | ClientDataSetIngredientsGlyd: TFloatField; |
||
237 | ClientDataSetIngredientsSerd: TFloatField; |
||
238 | ClientDataSetIngredientsProd: TFloatField; |
||
239 | ClientDataSetIngredientsLysd_ENc: TFloatField; |
||
240 | ClientDataSetIngredientsLysd_ENt: TFloatField; |
||
241 | ClientDataSetIngredientsCa: TFloatField; |
||
242 | ClientDataSetIngredientsP: TFloatField; |
||
243 | ClientDataSetIngredientsdP: TFloatField; |
||
244 | ClientDataSetIngredientsdPphy: TFloatField; |
||
245 | 3 | avalancogn | ClientDataSetIngredientsNa: TFloatField; |
246 | ClientDataSetIngredientsK: TFloatField; |
||
247 | ClientDataSetIngredientsCl: TFloatField; |
||
248 | ClientDataSetIngredientsBE: TFloatField; |
||
249 | 1 | avalancogn | DataSourceIngredients: TDataSource; |
250 | ClientDataSetComposition: TClientDataSet; |
||
251 | ClientDataSetCompositionFeed: TIntegerField; |
||
252 | ClientDataSetCompositionIngredient: TIntegerField; |
||
253 | ClientDataSetCompositionUser: TBooleanField; |
||
254 | ClientDataSetCompositionIngredientName: TWideStringField; |
||
255 | ClientDataSetCompositionRank: TIntegerField; |
||
256 | ClientDataSetCompositionMS: TFloatField; |
||
257 | ClientDataSetCompositionLevel: TFloatField; |
||
258 | DataSourceComposition: TDataSource; |
||
259 | ClientDataSetPhytase: TClientDataSet; |
||
260 | ClientDataSetPhytaseId: TAutoIncField; |
||
261 | ClientDataSetPhytaseType: TFloatField; |
||
262 | ClientDataSetPhytaseCoef: TFloatField; |
||
263 | DataSourcePhytase: TDataSource; |
||
264 | ClientDataSetFeeds: TClientDataSet; |
||
265 | ClientDataSetFeedsId: TIntegerField; |
||
266 | ClientDataSetFeedsName: TWideStringField; |
||
267 | ClientDataSetFeedsDescription: TWideStringField; |
||
268 | ClientDataSetFeedsPresentation: TIntegerField; |
||
269 | ClientDataSetFeedsBonusC: TFloatField; |
||
270 | ClientDataSetFeedsBonusT: TFloatField; |
||
271 | ClientDataSetFeedsMS: TFloatField; |
||
272 | ClientDataSetFeedsMS2: TFloatField; |
||
273 | ClientDataSetFeedsMM: TFloatField; |
||
274 | ClientDataSetFeedsMAT: TFloatField; |
||
275 | ClientDataSetFeedsMG: TFloatField; |
||
276 | ClientDataSetFeedsCB: TFloatField; |
||
277 | ClientDataSetFeedsNDF: TFloatField; |
||
278 | ClientDataSetFeedsADF: TFloatField; |
||
279 | ClientDataSetFeedsADL: TFloatField; |
||
280 | ClientDataSetFeedsAmidon: TFloatField; |
||
281 | ClientDataSetFeedsSucres: TFloatField; |
||
282 | ClientDataSetFeedsEB: TFloatField; |
||
283 | ClientDataSetFeedsdEc: TFloatField; |
||
284 | ClientDataSetFeedsEDc: TFloatField; |
||
285 | ClientDataSetFeedsEMc_EDc: TFloatField; |
||
286 | ClientDataSetFeedsEMc: TFloatField; |
||
287 | ClientDataSetFeedsENc_EMc: TFloatField; |
||
288 | ClientDataSetFeedsENc: TFloatField; |
||
289 | ClientDataSetFeedsdEt: TFloatField; |
||
290 | ClientDataSetFeedsEDt: TFloatField; |
||
291 | ClientDataSetFeedsEMt_EDt: TFloatField; |
||
292 | ClientDataSetFeedsEMt: TFloatField; |
||
293 | ClientDataSetFeedsENt_EMt: TFloatField; |
||
294 | ClientDataSetFeedsENt: TFloatField; |
||
295 | ClientDataSetFeedsEDt_EDc: TFloatField; |
||
296 | ClientDataSetFeedsEMt_EMc: TFloatField; |
||
297 | ClientDataSetFeedsENt_ENc: TFloatField; |
||
298 | ClientDataSetFeedsdNc: TFloatField; |
||
299 | ClientDataSetFeedsdNt: TFloatField; |
||
300 | ClientDataSetFeedsLys: TFloatField; |
||
301 | ClientDataSetFeedsThr: TFloatField; |
||
302 | ClientDataSetFeedsMet: TFloatField; |
||
303 | ClientDataSetFeedsCys: TFloatField; |
||
304 | ClientDataSetFeedsMetCys: TFloatField; |
||
305 | ClientDataSetFeedsTrp: TFloatField; |
||
306 | ClientDataSetFeedsIle: TFloatField; |
||
307 | ClientDataSetFeedsVal: TFloatField; |
||
308 | ClientDataSetFeedsLeu: TFloatField; |
||
309 | ClientDataSetFeedsPhe: TFloatField; |
||
310 | ClientDataSetFeedsTyr: TFloatField; |
||
311 | ClientDataSetFeedsPheTyr: TFloatField; |
||
312 | ClientDataSetFeedsHis: TFloatField; |
||
313 | ClientDataSetFeedsArg: TFloatField; |
||
314 | ClientDataSetFeedsAla: TFloatField; |
||
315 | ClientDataSetFeedsAsp: TFloatField; |
||
316 | ClientDataSetFeedsGlu: TFloatField; |
||
317 | ClientDataSetFeedsGly: TFloatField; |
||
318 | ClientDataSetFeedsSer: TFloatField; |
||
319 | ClientDataSetFeedsPro: TFloatField; |
||
320 | ClientDataSetFeedsLysd: TFloatField; |
||
321 | ClientDataSetFeedsThrd: TFloatField; |
||
322 | ClientDataSetFeedsMetd: TFloatField; |
||
323 | ClientDataSetFeedsCysd: TFloatField; |
||
324 | ClientDataSetFeedsMetCysd: TFloatField; |
||
325 | ClientDataSetFeedsTrpd: TFloatField; |
||
326 | ClientDataSetFeedsIled: TFloatField; |
||
327 | ClientDataSetFeedsVald: TFloatField; |
||
328 | ClientDataSetFeedsLeud: TFloatField; |
||
329 | ClientDataSetFeedsPhed: TFloatField; |
||
330 | ClientDataSetFeedsTyrd: TFloatField; |
||
331 | ClientDataSetFeedsPheTyrd: TFloatField; |
||
332 | ClientDataSetFeedsHisd: TFloatField; |
||
333 | ClientDataSetFeedsArgd: TFloatField; |
||
334 | ClientDataSetFeedsAlad: TFloatField; |
||
335 | ClientDataSetFeedsAspd: TFloatField; |
||
336 | ClientDataSetFeedsGlud: TFloatField; |
||
337 | ClientDataSetFeedsGlyd: TFloatField; |
||
338 | ClientDataSetFeedsSerd: TFloatField; |
||
339 | ClientDataSetFeedsProd: TFloatField; |
||
340 | ClientDataSetFeedsLysd_ENc: TFloatField; |
||
341 | ClientDataSetFeedsLysd_ENt: TFloatField; |
||
342 | ClientDataSetFeedsThrd_Lysd: TFloatField; |
||
343 | ClientDataSetFeedsMetd_Lysd: TFloatField; |
||
344 | ClientDataSetFeedsCysd_Lysd: TFloatField; |
||
345 | ClientDataSetFeedsMetCysd_Lysd: TFloatField; |
||
346 | ClientDataSetFeedsTrpd_Lysd: TFloatField; |
||
347 | ClientDataSetFeedsIled_Lysd: TFloatField; |
||
348 | ClientDataSetFeedsVald_Lysd: TFloatField; |
||
349 | ClientDataSetFeedsLeud_Lysd: TFloatField; |
||
350 | ClientDataSetFeedsPhed_Lysd: TFloatField; |
||
351 | ClientDataSetFeedsTyrd_Lysd: TFloatField; |
||
352 | ClientDataSetFeedsPheTyrd_Lysd: TFloatField; |
||
353 | ClientDataSetFeedsHisd_Lysd: TFloatField; |
||
354 | ClientDataSetFeedsArgd_Lysd: TFloatField; |
||
355 | ClientDataSetFeedsAlad_Lysd: TFloatField; |
||
356 | ClientDataSetFeedsAspd_Lysd: TFloatField; |
||
357 | ClientDataSetFeedsGlud_Lysd: TFloatField; |
||
358 | ClientDataSetFeedsGlyd_Lysd: TFloatField; |
||
359 | ClientDataSetFeedsSerd_Lysd: TFloatField; |
||
360 | ClientDataSetFeedsProd_Lysd: TFloatField; |
||
361 | ClientDataSetFeedsCa: TFloatField; |
||
362 | ClientDataSetFeedsP: TFloatField; |
||
363 | ClientDataSetFeedsPd: TFloatField; |
||
364 | ClientDataSetFeedsCa_Pd: TFloatField; |
||
365 | ClientDataSetFeedsPd_ENc: TFloatField; |
||
366 | ClientDataSetFeedsPd_ENt: TFloatField; |
||
367 | ClientDataSetFeedsPhytaseId: TIntegerField; |
||
368 | ClientDataSetFeedsPhytaseType: TFloatField; |
||
369 | ClientDataSetFeedsPhytaseConcentration: TFloatField; |
||
370 | ClientDataSetFeedsPhytaseIncorporation: TFloatField; |
||
371 | ClientDataSetFeedsPhytaseLevel: TFloatField; |
||
372 | ClientDataSetFeedsLevelSum: TFloatField; |
||
373 | ClientDataSetFeedsTotal: TFloatField; |
||
374 | ClientDataSetFeedsRemain: TFloatField; |
||
375 | 3 | avalancogn | ClientDataSetFeedsNa: TFloatField; |
376 | ClientDataSetFeedsK: TFloatField; |
||
377 | ClientDataSetFeedsCl: TFloatField; |
||
378 | ClientDataSetFeedsBE: TFloatField; |
||
379 | 1 | avalancogn | DataSourceFeeds: TDataSource; |
380 | procedure DataModuleCreate(Sender: TObject);
|
||
381 | procedure DataModuleDestroy(Sender: TObject);
|
||
382 | procedure ClientDataSetIngredientsFilterRecord(DataSet: TDataSet; var Accept: Boolean); |
||
383 | procedure ClientDataSetFeedsCalcFields(DataSet: TDataSet);
|
||
384 | procedure AggregateLevelSumUpdate(Agg: TAggregate);
|
||
385 | private
|
||
386 | { D?clarations priv?es }
|
||
387 | public
|
||
388 | { D?clarations publiques }
|
||
389 | DBUser: TSQLiteDatabase; |
||
390 | TableIngredients: TSQLiteTable; |
||
391 | TableFeeds: TSQLiteTable; |
||
392 | TableComposition: TSQLiteTable; |
||
393 | RapMS, RapMAT: Double; |
||
394 | ClassList, UserList, FeedList: TStrings; |
||
395 | FilterOnClass, FilterOnDatabase, FilterOnName: Boolean; |
||
396 | FilteredClass, FilteredDatabase: Integer; |
||
397 | FilteredName: String;
|
||
398 | procedure CalcInraAfz;
|
||
399 | procedure CalcOriginal;
|
||
400 | procedure CalcCopy;
|
||
401 | procedure CalcFeed;
|
||
402 | 3 | avalancogn | function CalcBilanElectrolytique(Na, K, Cl: Double): Double;
|
403 | 1 | avalancogn | function InputProximal(Value, MS: Double; ExpressionMode, ProximalUnit: Integer): Double;
|
404 | function InputEnergy(Value, MS: Double; ExpressionMode, EnergyUnit: Integer): Double;
|
||
405 | function InputAA(Value, MAT, MS: Double; ExpressionMode, AAUnit: Integer): Double;
|
||
406 | function InputMinerals(Value, MS: Double; ExpressionMode, MineralsUnit: Integer): Double;
|
||
407 | function InputIncorporation(Value: Double; IncorporationUnit: Integer): Double;
|
||
408 | function OutputProximal(Value, MS: Double; ExpressionMode, ProximalUnit: Integer): Double;
|
||
409 | function OutputEnergy(Value, MS: Double; ExpressionMode, EnergyUnit: Integer): Double;
|
||
410 | function OutputAA(Value, MAT, MS: Double; ExpressionMode, AAUnit: Integer): Double;
|
||
411 | function OutputMinerals(Value, MS: Double; ExpressionMode, MineralsUnit: Integer): Double;
|
||
412 | function OutputIncorporation(Value: Double; IncorporationUnit: Integer): Double;
|
||
413 | function StrTrunc(S: String; Max: Integer): String; |
||
414 | end;
|
||
415 | |||
416 | var
|
||
417 | DataModuleDeclaration: TDataModuleDeclaration; |
||
418 | MajorVersion, MinorVersion, ReleaseVersion, BuildVersion: Integer ; |
||
419 | |||
420 | implementation
|
||
421 | |||
422 | {$R *.dfm}
|
||
423 | |||
424 | uses
|
||
425 | SHFolder, StrUtils, UnitOptions; |
||
426 | |||
427 | 3 | avalancogn | procedure TDataModuleDeclaration.AggregateLevelSumUpdate(Agg: TAggregate);
|
428 | begin
|
||
429 | if not ClientDataSetFeeds.Eof |
||
430 | then
|
||
431 | begin
|
||
432 | ClientDataSetFeeds.Edit; |
||
433 | if VarIsEmpty(Agg.Value) or VarIsNull(Agg.Value) |
||
434 | then
|
||
435 | ClientDataSetFeedsLevelSum.Clear |
||
436 | else
|
||
437 | ClientDataSetFeedsLevelSum.AsFloat := Agg.Value; |
||
438 | ClientDataSetFeeds.Post; |
||
439 | end;
|
||
440 | end;
|
||
441 | |||
442 | procedure TDataModuleDeclaration.ClientDataSetFeedsCalcFields(DataSet: TDataSet);
|
||
443 | begin
|
||
444 | if ClientDataSetFeedsPhytaseIncorporation.IsNull or ClientDataSetFeedsPhytaseConcentration.IsNull |
||
445 | or (ClientDataSetFeedsPhytaseConcentration.Value = 0) |
||
446 | then
|
||
447 | ClientDataSetFeedsPhytaseLevel.Clear |
||
448 | else
|
||
449 | ClientDataSetFeedsPhytaseLevel.Value := OutputIncorporation(ClientDataSetFeedsPhytaseIncorporation.Value / ClientDataSetFeedsPhytaseConcentration.Value / 1000, FormOptions.Incorporation);
|
||
450 | ClientDataSetFeedsTotal.Value := ClientDataSetFeedsLevelSum.Value + ClientDataSetFeedsPhytaseLevel.Value; |
||
451 | ClientDataSetFeedsRemain.Value := OutputIncorporation(1, FormOptions.Incorporation) - ClientDataSetFeedsTotal.Value;
|
||
452 | end;
|
||
453 | |||
454 | procedure TDataModuleDeclaration.ClientDataSetIngredientsFilterRecord(DataSet: TDataSet; var Accept: Boolean); |
||
455 | begin
|
||
456 | Accept := True; |
||
457 | if FilterOnClass and (FilteredClass > 0) |
||
458 | then
|
||
459 | Accept := Accept and (DataSet.FieldByName('Class').AsInteger = FilteredClass); |
||
460 | if FilterOnDatabase
|
||
461 | then
|
||
462 | case FilteredDatabase of |
||
463 | 1: // User database |
||
464 | Accept := Accept and DataSet.FieldByName('User').AsBoolean; |
||
465 | 2: // Reference tables |
||
466 | Accept := Accept and not DataSet.FieldByName('User').AsBoolean; |
||
467 | end;
|
||
468 | if FilterOnName and (FilteredName <> '') |
||
469 | then
|
||
470 | Accept := Accept and (Pos(FilteredName, DataSet.FieldByName('Name').AsWideString) > 0); |
||
471 | end;
|
||
472 | |||
473 | procedure TDataModuleDeclaration.DataModuleCreate(Sender: TObject);
|
||
474 | var
|
||
475 | i: Integer; |
||
476 | ExeDir, DataDir, DataFile: String;
|
||
477 | Cryptage: TLbBlowfish; |
||
478 | FluxClair, FluxCrypte: TMemoryStream; |
||
479 | DocumentsPath: array[0..MAX_PATH] of Char; |
||
480 | begin
|
||
481 | // Classes
|
||
482 | ClassList := TStringList.Create; |
||
483 | ClassList.Add('Cereals');
|
||
484 | ClassList.Add('Wheat by-products');
|
||
485 | ClassList.Add('Maize by-products');
|
||
486 | ClassList.Add('Other cereal by-products');
|
||
487 | ClassList.Add('Rice by-products');
|
||
488 | ClassList.Add('Legume and oil seeds');
|
||
489 | ClassList.Add('Oil seed meals');
|
||
490 | ClassList.Add('Starch, roots and tubers');
|
||
491 | ClassList.Add('Fruits and vegetables by-products');
|
||
492 | ClassList.Add('Molasses and vinasses');
|
||
493 | ClassList.Add('Other plant products');
|
||
494 | ClassList.Add('Dehydrated forages');
|
||
495 | ClassList.Add('Dairy products');
|
||
496 | ClassList.Add('Fish meals and solubles');
|
||
497 | ClassList.Add('Other animal by-products');
|
||
498 | ClassList.Add('Fats and oils');
|
||
499 | ClassList.Add('Amino acids');
|
||
500 | ClassList.Add('Mineral sources');
|
||
501 | ClassList.Add('Not referenced');
|
||
502 | ClientDataSetClasses.CreateDataSet; |
||
503 | for i := 0 to ClassList.Count - 1 do |
||
504 | ClientDataSetClasses.AppendRecord([i + 1, dgettext('InraAfz', ClassList[i])]); |
||
505 | // Phytase
|
||
506 | ClientDataSetPhytase.CreateDataSet; |
||
507 | ClientDataSetPhytase.AppendRecord([1, 0.60, 0.67]); |
||
508 | ClientDataSetPhytase.AppendRecord([2, 0.65, 0.76]); |
||
509 | ClientDataSetPhytase.AppendRecord([3, 0.70, 0.87]); |
||
510 | ClientDataSetPhytase.AppendRecord([4, 0.75, 1.00]); |
||
511 | ClientDataSetPhytase.AppendRecord([5, 0.80, 1.15]); |
||
512 | ClientDataSetPhytase.AppendRecord([6, 0.85, 1.34]); |
||
513 | ClientDataSetPhytase.AppendRecord([7, 0.90, 1.60]); |
||
514 | ClientDataSetPhytase.AppendRecord([8, 0.95, 1.98]); |
||
515 | // Tables de r?f?rence
|
||
516 | ExeDir := ExtractFilePath(Application.ExeName); |
||
517 | DataFile := ExeDir + 'EvaPig2020.dat';
|
||
518 | if not FileExists(DataFile) |
||
519 | then // Erreur |
||
520 | begin
|
||
521 | MessageDlg(_('Reference tables of composition and nutritional values of feed materials for pigs') + sLineBreak
|
||
522 | + Format(_('%s: file not found'), [DataFile]), mtError, [mbOK], 0); |
||
523 | Application.Terminate; |
||
524 | Exit; |
||
525 | end;
|
||
526 | ClientDataSetInraAfz.CreateDataSet; |
||
527 | Cryptage := TlbBlowfish.Create(nil);
|
||
528 | Cryptage.GenerateKey('Tables of Composition and Nutritional Value of Feed Materials');
|
||
529 | FluxCrypte := TMemoryStream.Create; |
||
530 | FluxClair := TMemoryStream.Create; |
||
531 | try
|
||
532 | FluxCrypte.LoadFromFile(DataFile); |
||
533 | FluxCrypte.Position := 0;
|
||
534 | Cryptage.DecryptStream(FluxCrypte, FluxClair); |
||
535 | FluxClair.Position := 0;
|
||
536 | try
|
||
537 | ClientDataSetInraAfz.LoadFromStream(FluxClair); |
||
538 | except
|
||
539 | MessageDlg(_('Reference tables of composition and nutritional values of feed materials for pigs') + sLineBreak
|
||
540 | + _('Invalid data format'), mtError, [mbOK], 0); |
||
541 | Application.Terminate; |
||
542 | Exit; |
||
543 | end;
|
||
544 | finally
|
||
545 | FluxCrypte.Free; |
||
546 | FluxClair.Free; |
||
547 | Cryptage.Free; |
||
548 | end;
|
||
549 | // Base User.sqb
|
||
550 | SHGetFolderPath(0, CSIDL_PERSONAL, 0, SHGFP_TYPE_CURRENT, DocumentsPath); |
||
551 | DataDir := IncludeTrailingPathDelimiter(IncludeTrailingPathDelimiter(DocumentsPath) + Application.Title); |
||
552 | ForceDirectories(DataDir); |
||
553 | if not FileExists(ExeDir + 'sqlite3.dll') |
||
554 | then // Erreur |
||
555 | begin
|
||
556 | MessageDlg(_('SQLite') + sLineBreak
|
||
557 | + Format(_('%s: driver missing'), [ExeDir + 'sqlite3.dll']), mtError, [mbOK], 0); |
||
558 | Application.Terminate; |
||
559 | Exit; |
||
560 | end;
|
||
561 | DBUser := TSQLiteDatabase.Create(DataDir + 'User.sqb');
|
||
562 | if not DBUser.TableExists('Ingredients') |
||
563 | then // Cr?ation de la table Ingredients |
||
564 | begin
|
||
565 | DBUser.ExecSQL('CREATE TABLE Ingredients ('
|
||
566 | + 'Id INTEGER PRIMARY KEY, '
|
||
567 | + 'Name TEXT, '
|
||
568 | + 'Definition TEXT, '
|
||
569 | + 'Class INTEGER, '
|
||
570 | + 'Model INTEGER, '
|
||
571 | + 'MS REAL, '
|
||
572 | + 'MM REAL, '
|
||
573 | + 'MAT REAL, '
|
||
574 | + 'MG REAL, '
|
||
575 | + 'CB REAL, '
|
||
576 | + 'NDF REAL, '
|
||
577 | + 'ADF REAL, '
|
||
578 | + 'ADL REAL, '
|
||
579 | + 'Amidon REAL, '
|
||
580 | + 'Sucres REAL, '
|
||
581 | + 'EB REAL, '
|
||
582 | + 'Bonus REAL, '
|
||
583 | + 'Lys REAL, '
|
||
584 | + 'Thr REAL, '
|
||
585 | + 'Met REAL, '
|
||
586 | + 'Cys REAL, '
|
||
587 | + 'MetCys REAL, '
|
||
588 | + 'Trp REAL, '
|
||
589 | + 'Ile REAL, '
|
||
590 | + 'Val REAL, '
|
||
591 | + 'Leu REAL, '
|
||
592 | + 'Phe REAL, '
|
||
593 | + 'Tyr REAL, '
|
||
594 | + 'PheTyr REAL, '
|
||
595 | + 'His REAL, '
|
||
596 | + 'Arg REAL, '
|
||
597 | + 'Ala REAL, '
|
||
598 | + 'Asp REAL, '
|
||
599 | + 'Glu REAL, '
|
||
600 | + 'Gly REAL, '
|
||
601 | + 'Ser REAL, '
|
||
602 | + 'Pro REAL, '
|
||
603 | + 'dLys REAL, '
|
||
604 | + 'dThr REAL, '
|
||
605 | + 'dMet REAL, '
|
||
606 | + 'dCys REAL, '
|
||
607 | + 'dMetCys REAL, '
|
||
608 | + 'dTrp REAL, '
|
||
609 | + 'dIle REAL, '
|
||
610 | + 'dVal REAL, '
|
||
611 | + 'dLeu REAL, '
|
||
612 | + 'dPhe REAL, '
|
||
613 | + 'dTyr REAL, '
|
||
614 | + 'dPheTyr REAL, '
|
||
615 | + 'dHis REAL, '
|
||
616 | + 'dArg REAL, '
|
||
617 | + 'dAla REAL, '
|
||
618 | + 'dAsp REAL, '
|
||
619 | + 'dGlu REAL, '
|
||
620 | + 'dGly REAL, '
|
||
621 | + 'dSer REAL, '
|
||
622 | + 'dPro REAL, '
|
||
623 | + 'Ca REAL, '
|
||
624 | + 'P REAL, '
|
||
625 | + 'dP REAL, '
|
||
626 | + 'dPphy REAL)');
|
||
627 | DBUser.ExecSQL('CREATE INDEX IdxClasses ON Ingredients (Class)');
|
||
628 | DBUser.ExecSQL('CREATE INDEX IdxModels ON Ingredients (Model)');
|
||
629 | end;
|
||
630 | if not DBUser.TableExists('Feeds') |
||
631 | then // Cr?ation de la table Feeds |
||
632 | DBUser.ExecSQL('CREATE TABLE Feeds ('
|
||
633 | + 'Id INTEGER PRIMARY KEY, '
|
||
634 | + 'Name TEXT, '
|
||
635 | + 'Description TEXT, '
|
||
636 | + 'Presentation INTEGER, '
|
||
637 | + 'BonusC REAL, '
|
||
638 | + 'BonusT REAL, '
|
||
639 | + 'Phytase INTEGER, '
|
||
640 | + 'Concentration REAL, '
|
||
641 | + 'Incorporation REAL)');
|
||
642 | if not DBUser.TableExists('Composition') |
||
643 | then // Cr?ation de la table Composition |
||
644 | begin
|
||
645 | DBUser.ExecSQL('CREATE TABLE Composition ('
|
||
646 | + 'Feed INTEGER, '
|
||
647 | + 'Ingredient INTEGER, '
|
||
648 | + 'User BOOLEAN, '
|
||
649 | + 'Rank INTEGER, '
|
||
650 | + 'MS REAL, '
|
||
651 | + 'Level REAL)');
|
||
652 | DBUser.ExecSQL('CREATE INDEX IdxFeeds ON Composition (Feed)');
|
||
653 | DBUser.ExecSQL('CREATE INDEX IdxIngredients ON Composition (Ingredient)');
|
||
654 | end;
|
||
655 | Application.ProcessMessages; |
||
656 | // Liste des mati?res premi?res utilisateur
|
||
657 | UserList := TStringList.Create; |
||
658 | TableIngredients := DBUser.GetTable('SELECT Name FROM Ingredients');
|
||
659 | with TableIngredients do |
||
660 | try
|
||
661 | while not Eof do |
||
662 | begin
|
||
663 | UserList.Add(FieldAsString(FieldIndex['Name']));
|
||
664 | Next; |
||
665 | end;
|
||
666 | finally
|
||
667 | Free; |
||
668 | end;
|
||
669 | // Liste des r?gimes
|
||
670 | FeedList := TStringList.Create; |
||
671 | TableFeeds := DBUser.GetTable('SELECT Name FROM Feeds');
|
||
672 | with TableFeeds do |
||
673 | try
|
||
674 | while not Eof do |
||
675 | begin
|
||
676 | FeedList.Add(FieldAsString(FieldIndex['Name']));
|
||
677 | Next; |
||
678 | end;
|
||
679 | finally
|
||
680 | Free; |
||
681 | end;
|
||
682 | end;
|
||
683 | |||
684 | procedure TDataModuleDeclaration.DataModuleDestroy(Sender: TObject);
|
||
685 | begin
|
||
686 | ClientDataSetClasses.Close; |
||
687 | ClientDataSetPhytase.Close; |
||
688 | ClientDataSetInraAfz.Close; |
||
689 | ClassList.Free; |
||
690 | UserList.Free; |
||
691 | FeedList.Free; |
||
692 | Application.ProcessMessages; |
||
693 | DBUser.ExecSQL('VACUUM'); // Compacter la base User.sqb |
||
694 | DBUser.Free; |
||
695 | Application.ProcessMessages; |
||
696 | end;
|
||
697 | |||
698 | 1 | avalancogn | procedure TDataModuleDeclaration.CalcInraAfz;
|
699 | // Renseigner l'enregistrement courant de ClientDataSetIngredients
|
||
700 | // ? partir de l'enregistrement courant de ClientDataSetInraAfz
|
||
701 | // en tenant compte des unit?s configur?es
|
||
702 | begin
|
||
703 | // Analyse proximale
|
||
704 | RapMS := ClientDataSetInraAfzMS.Value; |
||
705 | ClientDataSetIngredientsMS.Value := OutputProximal(RapMS, 1, 1, FormOptions.Proximal); |
||
706 | ClientDataSetIngredientsMS2.Value := OutputProximal(1, RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
707 | if ClientDataSetInraAfzMM.IsNull
|
||
708 | then
|
||
709 | ClientDataSetIngredientsMM.Clear |
||
710 | else
|
||
711 | ClientDataSetIngredientsMM.Value := OutputProximal(ClientDataSetInraAfzMM.Value, RapMS, FormOptions.Expression, FormOptions.Proximal); |
||
712 | if ClientDataSetInraAfzMAT.IsNull
|
||
713 | then
|
||
714 | ClientDataSetIngredientsMAT.Clear |
||
715 | else
|
||
716 | begin
|
||
717 | RapMAT := ClientDataSetInraAfzMAT.Value; |
||
718 | ClientDataSetIngredientsMAT.Value := OutputProximal(RapMAT, RapMS, FormOptions.Expression, FormOptions.Proximal); |
||
719 | end;
|
||
720 | if ClientDataSetInraAfzMG.IsNull
|
||
721 | then
|
||
722 | ClientDataSetIngredientsMG.Clear |
||
723 | else
|
||
724 | ClientDataSetIngredientsMG.Value := OutputProximal(ClientDataSetInraAfzMG.Value, RapMS, FormOptions.Expression, FormOptions.Proximal); |
||
725 | if ClientDataSetInraAfzCB.IsNull
|
||
726 | then
|
||
727 | ClientDataSetIngredientsCB.Clear |
||
728 | else
|
||
729 | ClientDataSetIngredientsCB.Value := OutputProximal(ClientDataSetInraAfzCB.Value, RapMS, FormOptions.Expression, FormOptions.Proximal); |
||
730 | if ClientDataSetInraAfzNDF.IsNull
|
||
731 | then
|
||
732 | ClientDataSetIngredientsNDF.Clear |
||
733 | else
|
||
734 | ClientDataSetIngredientsNDF.Value := OutputProximal(ClientDataSetInraAfzNDF.Value, RapMS, FormOptions.Expression, FormOptions.Proximal); |
||
735 | if ClientDataSetInraAfzADF.IsNull
|
||
736 | then
|
||
737 | ClientDataSetIngredientsADF.Clear |
||
738 | else
|
||
739 | ClientDataSetIngredientsADF.Value := OutputProximal(ClientDataSetInraAfzADF.Value, RapMS, FormOptions.Expression, FormOptions.Proximal); |
||
740 | if ClientDataSetInraAfzADL.IsNull
|
||
741 | then
|
||
742 | ClientDataSetIngredientsADL.Clear |
||
743 | else
|
||
744 | ClientDataSetIngredientsADL.Value := OutputProximal(ClientDataSetInraAfzADL.Value, RapMS, FormOptions.Expression, FormOptions.Proximal); |
||
745 | if ClientDataSetInraAfzAmidon.IsNull
|
||
746 | then
|
||
747 | ClientDataSetIngredientsAmidon.Clear |
||
748 | else
|
||
749 | ClientDataSetIngredientsAmidon.Value := OutputProximal(ClientDataSetInraAfzAmidon.Value, RapMS, FormOptions.Expression, FormOptions.Proximal); |
||
750 | if ClientDataSetInraAfzSucres.IsNull
|
||
751 | then
|
||
752 | ClientDataSetIngredientsSucres.Clear |
||
753 | else
|
||
754 | ClientDataSetIngredientsSucres.Value := OutputProximal(ClientDataSetInraAfzSucres.Value, RapMS, FormOptions.Expression, FormOptions.Proximal); |
||
755 | // Energie
|
||
756 | ClientDataSetIngredientsEB.Value := OutputEnergy(ClientDataSetInraAfzEB.Value, RapMS, FormOptions.Expression, FormOptions.Energy); |
||
757 | ClientDataSetIngredientsBonus.Value := 0;
|
||
758 | ClientDataSetIngredientsdEc.Value := ClientDataSetInraAfzdEc.Value * 100;
|
||
759 | ClientDataSetIngredientsEDc.Value := ClientDataSetIngredientsEB.Value * ClientDataSetIngredientsdEc.Value / 100;
|
||
760 | ClientDataSetIngredientsEMc_EDc.Value := ClientDataSetInraAfzEMc_EDc.Value * 100;
|
||
761 | ClientDataSetIngredientsEMc.Value := ClientDataSetIngredientsEDc.Value * ClientDataSetIngredientsEMc_EDc.Value / 100;
|
||
762 | ClientDataSetIngredientsENc_EMc.Value := ClientDataSetInraAfzENc_EMc.Value * 100;
|
||
763 | ClientDataSetIngredientsENc.Value := ClientDataSetIngredientsEMc.Value * ClientDataSetIngredientsENc_EMc.Value / 100;
|
||
764 | ClientDataSetIngredientsEDt_EDc.Value := ClientDataSetInraAfzEDt_EDc.Value * 100;
|
||
765 | ClientDataSetIngredientsEDt.Value := ClientDataSetIngredientsEDc.Value * ClientDataSetIngredientsEDt_EDc.Value / 100;
|
||
766 | ClientDataSetIngredientsEMt_EDt.Value := ClientDataSetInraAfzEMt_EDt.Value * 100;
|
||
767 | ClientDataSetIngredientsEMt.Value := ClientDataSetIngredientsEDt.Value * ClientDataSetIngredientsEMt_EDt.Value / 100;
|
||
768 | ClientDataSetIngredientsENt_EMt.Value := ClientDataSetInraAfzENt_EMt.Value * 100;
|
||
769 | ClientDataSetIngredientsENt.Value := ClientDataSetIngredientsEMt.Value * ClientDataSetIngredientsENt_EMt.Value / 100;
|
||
770 | if ClientDataSetIngredientsEB.Value = 0 |
||
771 | then
|
||
772 | ClientDataSetIngredientsdEt.Value := ClientDataSetIngredientsdEc.Value |
||
773 | else
|
||
774 | ClientDataSetIngredientsdEt.Value := ClientDataSetIngredientsEDt.Value / ClientDataSetIngredientsEB.Value * 100;
|
||
775 | if ClientDataSetIngredientsEMc.Value = 0 |
||
776 | then
|
||
777 | ClientDataSetIngredientsEMt_EMc.Value := 100
|
||
778 | else
|
||
779 | ClientDataSetIngredientsEMt_EMc.Value := ClientDataSetIngredientsEMt.Value / ClientDataSetIngredientsEMc.Value * 100;
|
||
780 | if ClientDataSetIngredientsENc.Value = 0 |
||
781 | then
|
||
782 | ClientDataSetIngredientsENt_ENc.Value := 100
|
||
783 | else
|
||
784 | ClientDataSetIngredientsENt_ENc.Value := ClientDataSetIngredientsENt.Value / ClientDataSetIngredientsENc.Value * 100;
|
||
785 | // Digestibilit? f?cale de l'azote
|
||
786 | if ClientDataSetInraAfzdNc.IsNull
|
||
787 | then
|
||
788 | ClientDataSetIngredientsdNc.Clear |
||
789 | else
|
||
790 | ClientDataSetIngredientsdNc.Value := ClientDataSetInraAfzdNc.Value * 100;
|
||
791 | if ClientDataSetInraAfzdNt.IsNull
|
||
792 | then
|
||
793 | ClientDataSetIngredientsdNt.Clear |
||
794 | else
|
||
795 | ClientDataSetIngredientsdNt.Value := ClientDataSetInraAfzdNt.Value * 100;
|
||
796 | // Acides amin?s
|
||
797 | if RapMAT = 0 |
||
798 | then // En l'absence de MAT, il n'y a pas d'acides amin?s |
||
799 | begin
|
||
800 | // Teneurs
|
||
801 | ClientDataSetIngredientsLys.Clear; |
||
802 | ClientDataSetIngredientsThr.Clear; |
||
803 | ClientDataSetIngredientsMet.Clear; |
||
804 | ClientDataSetIngredientsCys.Clear; |
||
805 | ClientDataSetIngredientsMetCys.Clear; |
||
806 | ClientDataSetIngredientsTrp.Clear; |
||
807 | ClientDataSetIngredientsIle.Clear; |
||
808 | ClientDataSetIngredientsVal.Clear; |
||
809 | ClientDataSetIngredientsLeu.Clear; |
||
810 | ClientDataSetIngredientsPhe.Clear; |
||
811 | ClientDataSetIngredientsTyr.Clear; |
||
812 | ClientDataSetIngredientsPheTyr.Clear; |
||
813 | ClientDataSetIngredientsHis.Clear; |
||
814 | ClientDataSetIngredientsArg.Clear; |
||
815 | ClientDataSetIngredientsAla.Clear; |
||
816 | ClientDataSetIngredientsAsp.Clear; |
||
817 | ClientDataSetIngredientsGlu.Clear; |
||
818 | ClientDataSetIngredientsGly.Clear; |
||
819 | ClientDataSetIngredientsSer.Clear; |
||
820 | ClientDataSetIngredientsPro.Clear; |
||
821 | // % MAT
|
||
822 | ClientDataSetIngredientsLys_MAT.Clear; |
||
823 | ClientDataSetIngredientsThr_MAT.Clear; |
||
824 | ClientDataSetIngredientsMet_MAT.Clear; |
||
825 | ClientDataSetIngredientsCys_MAT.Clear; |
||
826 | ClientDataSetIngredientsMetCys_MAT.Clear; |
||
827 | ClientDataSetIngredientsTrp_MAT.Clear; |
||
828 | ClientDataSetIngredientsIle_MAT.Clear; |
||
829 | ClientDataSetIngredientsVal_MAT.Clear; |
||
830 | ClientDataSetIngredientsLeu_MAT.Clear; |
||
831 | ClientDataSetIngredientsPhe_MAT.Clear; |
||
832 | ClientDataSetIngredientsTyr_MAT.Clear; |
||
833 | ClientDataSetIngredientsPheTyr_MAT.Clear; |
||
834 | ClientDataSetIngredientsHis_MAT.Clear; |
||
835 | ClientDataSetIngredientsArg_MAT.Clear; |
||
836 | ClientDataSetIngredientsAla_MAT.Clear; |
||
837 | ClientDataSetIngredientsAsp_MAT.Clear; |
||
838 | ClientDataSetIngredientsGlu_MAT.Clear; |
||
839 | ClientDataSetIngredientsGly_MAT.Clear; |
||
840 | ClientDataSetIngredientsSer_MAT.Clear; |
||
841 | ClientDataSetIngredientsPro_MAT.Clear; |
||
842 | // Digestibilit?s
|
||
843 | ClientDataSetIngredientsdLys.Clear; |
||
844 | ClientDataSetIngredientsdThr.Clear; |
||
845 | ClientDataSetIngredientsdMet.Clear; |
||
846 | ClientDataSetIngredientsdCys.Clear; |
||
847 | ClientDataSetIngredientsdMetCys.Clear; |
||
848 | ClientDataSetIngredientsdTrp.Clear; |
||
849 | ClientDataSetIngredientsdIle.Clear; |
||
850 | ClientDataSetIngredientsdVal.Clear; |
||
851 | ClientDataSetIngredientsdLeu.Clear; |
||
852 | ClientDataSetIngredientsdPhe.Clear; |
||
853 | ClientDataSetIngredientsdTyr.Clear; |
||
854 | ClientDataSetIngredientsdPheTyr.Clear; |
||
855 | ClientDataSetIngredientsdHis.Clear; |
||
856 | ClientDataSetIngredientsdArg.Clear; |
||
857 | ClientDataSetIngredientsdAla.Clear; |
||
858 | ClientDataSetIngredientsdAsp.Clear; |
||
859 | ClientDataSetIngredientsdGlu.Clear; |
||
860 | ClientDataSetIngredientsdGly.Clear; |
||
861 | ClientDataSetIngredientsdSer.Clear; |
||
862 | ClientDataSetIngredientsdPro.Clear; |
||
863 | // Teneurs digestibles
|
||
864 | ClientDataSetIngredientsLysd.Clear; |
||
865 | ClientDataSetIngredientsThrd.Clear; |
||
866 | ClientDataSetIngredientsMetd.Clear; |
||
867 | ClientDataSetIngredientsCysd.Clear; |
||
868 | ClientDataSetIngredientsMetCysd.Clear; |
||
869 | ClientDataSetIngredientsTrpd.Clear; |
||
870 | ClientDataSetIngredientsIled.Clear; |
||
871 | ClientDataSetIngredientsVald.Clear; |
||
872 | ClientDataSetIngredientsLeud.Clear; |
||
873 | ClientDataSetIngredientsPhed.Clear; |
||
874 | ClientDataSetIngredientsTyrd.Clear; |
||
875 | ClientDataSetIngredientsPheTyrd.Clear; |
||
876 | ClientDataSetIngredientsHisd.Clear; |
||
877 | ClientDataSetIngredientsArgd.Clear; |
||
878 | ClientDataSetIngredientsAlad.Clear; |
||
879 | ClientDataSetIngredientsAspd.Clear; |
||
880 | ClientDataSetIngredientsGlud.Clear; |
||
881 | ClientDataSetIngredientsGlyd.Clear; |
||
882 | ClientDataSetIngredientsSerd.Clear; |
||
883 | ClientDataSetIngredientsProd.Clear; |
||
884 | end
|
||
885 | else
|
||
886 | begin
|
||
887 | // Lys
|
||
888 | if ClientDataSetInraAfzLys.IsNull
|
||
889 | then
|
||
890 | begin
|
||
891 | ClientDataSetIngredientsLys.Clear; |
||
892 | ClientDataSetIngredientsLys_MAT.Clear; |
||
893 | ClientDataSetIngredientsdLys.Clear; |
||
894 | ClientDataSetIngredientsLysd.Clear; |
||
895 | end
|
||
896 | else
|
||
897 | begin
|
||
898 | ClientDataSetIngredientsLys.Value := OutputAA(ClientDataSetInraAfzLys.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
899 | ClientDataSetIngredientsLys_MAT.Value := InputAA(ClientDataSetIngredientsLys.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
900 | if ClientDataSetInraAfzdLys.IsNull
|
||
901 | then
|
||
902 | ClientDataSetIngredientsdLys.Value := dLys * 100
|
||
903 | else
|
||
904 | ClientDataSetIngredientsdLys.Value := ClientDataSetInraAfzdLys.Value * 100;
|
||
905 | ClientDataSetIngredientsLysd.Value := ClientDataSetIngredientsdLys.Value / 100 * ClientDataSetIngredientsLys.Value;
|
||
906 | end;
|
||
907 | // Thr
|
||
908 | if ClientDataSetInraAfzThr.IsNull
|
||
909 | then
|
||
910 | begin
|
||
911 | ClientDataSetIngredientsThr.Clear; |
||
912 | ClientDataSetIngredientsThr_MAT.Clear; |
||
913 | ClientDataSetIngredientsdThr.Clear; |
||
914 | ClientDataSetIngredientsThrd.Clear; |
||
915 | end
|
||
916 | else
|
||
917 | begin
|
||
918 | ClientDataSetIngredientsThr.Value := OutputAA(ClientDataSetInraAfzThr.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
919 | ClientDataSetIngredientsThr_MAT.Value := InputAA(ClientDataSetIngredientsThr.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
920 | if ClientDataSetInraAfzdThr.IsNull
|
||
921 | then
|
||
922 | ClientDataSetIngredientsdThr.Value := dThr * 100
|
||
923 | else
|
||
924 | ClientDataSetIngredientsdThr.Value := ClientDataSetInraAfzdThr.Value * 100;
|
||
925 | ClientDataSetIngredientsThrd.Value := ClientDataSetIngredientsdThr.Value / 100 * ClientDataSetIngredientsThr.Value;
|
||
926 | end;
|
||
927 | // Met
|
||
928 | if ClientDataSetInraAfzMet.IsNull
|
||
929 | then
|
||
930 | begin
|
||
931 | ClientDataSetIngredientsMet.Clear; |
||
932 | ClientDataSetIngredientsMet_MAT.Clear; |
||
933 | ClientDataSetIngredientsdMet.Clear; |
||
934 | ClientDataSetIngredientsMetd.Clear; |
||
935 | end
|
||
936 | else
|
||
937 | begin
|
||
938 | ClientDataSetIngredientsMet.Value := OutputAA(ClientDataSetInraAfzMet.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
939 | ClientDataSetIngredientsMet_MAT.Value := InputAA(ClientDataSetIngredientsMet.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
940 | if ClientDataSetInraAfzdMet.IsNull
|
||
941 | then
|
||
942 | ClientDataSetIngredientsdMet.Value := dMet * 100
|
||
943 | else
|
||
944 | ClientDataSetIngredientsdMet.Value := ClientDataSetInraAfzdMet.Value * 100;
|
||
945 | ClientDataSetIngredientsMetd.Value := ClientDataSetIngredientsdMet.Value / 100 * ClientDataSetIngredientsMet.Value;
|
||
946 | end;
|
||
947 | // Cys
|
||
948 | if ClientDataSetInraAfzCys.IsNull
|
||
949 | then
|
||
950 | begin
|
||
951 | ClientDataSetIngredientsCys.Clear; |
||
952 | ClientDataSetIngredientsCys_MAT.Clear; |
||
953 | ClientDataSetIngredientsdCys.Clear; |
||
954 | ClientDataSetIngredientsCysd.Clear; |
||
955 | end
|
||
956 | else
|
||
957 | begin
|
||
958 | ClientDataSetIngredientsCys.Value := OutputAA(ClientDataSetInraAfzCys.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
959 | ClientDataSetIngredientsCys_MAT.Value := InputAA(ClientDataSetIngredientsCys.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
960 | if ClientDataSetInraAfzdCys.IsNull
|
||
961 | then
|
||
962 | ClientDataSetIngredientsdCys.Value := dCys * 100
|
||
963 | else
|
||
964 | ClientDataSetIngredientsdCys.Value := ClientDataSetInraAfzdCys.Value * 100;
|
||
965 | ClientDataSetIngredientsCysd.Value := ClientDataSetIngredientsdCys.Value / 100 * ClientDataSetIngredientsCys.Value;
|
||
966 | end;
|
||
967 | // Met + Cys
|
||
968 | if ClientDataSetInraAfzMetCys.IsNull
|
||
969 | then
|
||
970 | begin
|
||
971 | ClientDataSetIngredientsMetCys.Clear; |
||
972 | ClientDataSetIngredientsMetCys_MAT.Clear; |
||
973 | ClientDataSetIngredientsdMetCys.Clear; |
||
974 | ClientDataSetIngredientsMetCysd.Clear; |
||
975 | end
|
||
976 | else
|
||
977 | begin
|
||
978 | ClientDataSetIngredientsMetCys.Value := OutputAA(ClientDataSetInraAfzMetCys.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
979 | ClientDataSetIngredientsMetCys_MAT.Value := InputAA(ClientDataSetIngredientsMetCys.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
980 | if ClientDataSetInraAfzdMetCys.IsNull
|
||
981 | then
|
||
982 | ClientDataSetIngredientsdMetCys.Value := dMetCys * 100
|
||
983 | else
|
||
984 | ClientDataSetIngredientsdMetCys.Value := ClientDataSetInraAfzdMetCys.Value * 100;
|
||
985 | ClientDataSetIngredientsMetCysd.Value := ClientDataSetIngredientsdMetCys.Value / 100 * ClientDataSetIngredientsMetCys.Value;
|
||
986 | end;
|
||
987 | // Trp
|
||
988 | if ClientDataSetInraAfzTrp.IsNull
|
||
989 | then
|
||
990 | begin
|
||
991 | ClientDataSetIngredientsTrp.Clear; |
||
992 | ClientDataSetIngredientsTrp_MAT.Clear; |
||
993 | ClientDataSetIngredientsdTrp.Clear; |
||
994 | ClientDataSetIngredientsTrpd.Clear; |
||
995 | end
|
||
996 | else
|
||
997 | begin
|
||
998 | ClientDataSetIngredientsTrp.Value := OutputAA(ClientDataSetInraAfzTrp.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
999 | ClientDataSetIngredientsTrp_MAT.Value := InputAA(ClientDataSetIngredientsTrp.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1000 | if ClientDataSetInraAfzdTrp.IsNull
|
||
1001 | then
|
||
1002 | ClientDataSetIngredientsdTrp.Value := dTrp * 100
|
||
1003 | else
|
||
1004 | ClientDataSetIngredientsdTrp.Value := ClientDataSetInraAfzdTrp.Value * 100;
|
||
1005 | ClientDataSetIngredientsTrpd.Value := ClientDataSetIngredientsdTrp.Value / 100 * ClientDataSetIngredientsTrp.Value;
|
||
1006 | end;
|
||
1007 | // Ile
|
||
1008 | if ClientDataSetInraAfzIle.IsNull
|
||
1009 | then
|
||
1010 | begin
|
||
1011 | ClientDataSetIngredientsIle.Clear; |
||
1012 | ClientDataSetIngredientsIle_MAT.Clear; |
||
1013 | ClientDataSetIngredientsdIle.Clear; |
||
1014 | ClientDataSetIngredientsIled.Clear; |
||
1015 | end
|
||
1016 | else
|
||
1017 | begin
|
||
1018 | ClientDataSetIngredientsIle.Value := OutputAA(ClientDataSetInraAfzIle.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
1019 | ClientDataSetIngredientsIle_MAT.Value := InputAA(ClientDataSetIngredientsIle.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1020 | if ClientDataSetInraAfzdIle.IsNull
|
||
1021 | then
|
||
1022 | ClientDataSetIngredientsdIle.Value := dIle * 100
|
||
1023 | else
|
||
1024 | ClientDataSetIngredientsdIle.Value := ClientDataSetInraAfzdIle.Value * 100;
|
||
1025 | ClientDataSetIngredientsIled.Value := ClientDataSetIngredientsdIle.Value / 100 * ClientDataSetIngredientsIle.Value;
|
||
1026 | end;
|
||
1027 | // Val
|
||
1028 | if ClientDataSetInraAfzVal.IsNull
|
||
1029 | then
|
||
1030 | begin
|
||
1031 | ClientDataSetIngredientsVal.Clear; |
||
1032 | ClientDataSetIngredientsVal_MAT.Clear; |
||
1033 | ClientDataSetIngredientsdVal.Clear; |
||
1034 | ClientDataSetIngredientsVald.Clear; |
||
1035 | end
|
||
1036 | else
|
||
1037 | begin
|
||
1038 | ClientDataSetIngredientsVal.Value := OutputAA(ClientDataSetInraAfzVal.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
1039 | ClientDataSetIngredientsVal_MAT.Value := InputAA(ClientDataSetIngredientsVal.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1040 | if ClientDataSetInraAfzdVal.IsNull
|
||
1041 | then
|
||
1042 | ClientDataSetIngredientsdVal.Value := dVal * 100
|
||
1043 | else
|
||
1044 | ClientDataSetIngredientsdVal.Value := ClientDataSetInraAfzdVal.Value * 100;
|
||
1045 | ClientDataSetIngredientsVald.Value := ClientDataSetIngredientsdVal.Value / 100 * ClientDataSetIngredientsVal.Value;
|
||
1046 | end;
|
||
1047 | // Leu
|
||
1048 | if ClientDataSetInraAfzLeu.IsNull
|
||
1049 | then
|
||
1050 | begin
|
||
1051 | ClientDataSetIngredientsLeu.Clear; |
||
1052 | ClientDataSetIngredientsLeu_MAT.Clear; |
||
1053 | ClientDataSetIngredientsdLeu.Clear; |
||
1054 | ClientDataSetIngredientsLeud.Clear; |
||
1055 | end
|
||
1056 | else
|
||
1057 | begin
|
||
1058 | ClientDataSetIngredientsLeu.Value := OutputAA(ClientDataSetInraAfzLeu.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
1059 | ClientDataSetIngredientsLeu_MAT.Value := InputAA(ClientDataSetIngredientsLeu.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1060 | if ClientDataSetInraAfzdLeu.IsNull
|
||
1061 | then
|
||
1062 | ClientDataSetIngredientsdLeu.Value := dLeu * 100
|
||
1063 | else
|
||
1064 | ClientDataSetIngredientsdLeu.Value := ClientDataSetInraAfzdLeu.Value * 100;
|
||
1065 | ClientDataSetIngredientsLeud.Value := ClientDataSetIngredientsdLeu.Value / 100 * ClientDataSetIngredientsLeu.Value;
|
||
1066 | end;
|
||
1067 | // Phe
|
||
1068 | if ClientDataSetInraAfzPhe.IsNull
|
||
1069 | then
|
||
1070 | begin
|
||
1071 | ClientDataSetIngredientsPhe.Clear; |
||
1072 | ClientDataSetIngredientsPhe_MAT.Clear; |
||
1073 | ClientDataSetIngredientsdPhe.Clear; |
||
1074 | ClientDataSetIngredientsPhed.Clear; |
||
1075 | end
|
||
1076 | else
|
||
1077 | begin
|
||
1078 | ClientDataSetIngredientsPhe.Value := OutputAA(ClientDataSetInraAfzPhe.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
1079 | ClientDataSetIngredientsPhe_MAT.Value := InputAA(ClientDataSetIngredientsPhe.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1080 | if ClientDataSetInraAfzdPhe.IsNull
|
||
1081 | then
|
||
1082 | ClientDataSetIngredientsdPhe.Value := dPhe * 100
|
||
1083 | else
|
||
1084 | ClientDataSetIngredientsdPhe.Value := ClientDataSetInraAfzdPhe.Value * 100;
|
||
1085 | ClientDataSetIngredientsPhed.Value := ClientDataSetIngredientsdPhe.Value / 100 * ClientDataSetIngredientsPhe.Value;
|
||
1086 | end;
|
||
1087 | // Tyr
|
||
1088 | if ClientDataSetInraAfzTyr.IsNull
|
||
1089 | then
|
||
1090 | begin
|
||
1091 | ClientDataSetIngredientsTyr.Clear; |
||
1092 | ClientDataSetIngredientsTyr_MAT.Clear; |
||
1093 | ClientDataSetIngredientsdTyr.Clear; |
||
1094 | ClientDataSetIngredientsTyrd.Clear; |
||
1095 | end
|
||
1096 | else
|
||
1097 | begin
|
||
1098 | ClientDataSetIngredientsTyr.Value := OutputAA(ClientDataSetInraAfzTyr.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
1099 | ClientDataSetIngredientsTyr_MAT.Value := InputAA(ClientDataSetIngredientsTyr.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1100 | if ClientDataSetInraAfzdTyr.IsNull
|
||
1101 | then
|
||
1102 | ClientDataSetIngredientsdTyr.Value := dTyr * 100
|
||
1103 | else
|
||
1104 | ClientDataSetIngredientsdTyr.Value := ClientDataSetInraAfzdTyr.Value * 100;
|
||
1105 | ClientDataSetIngredientsTyrd.Value := ClientDataSetIngredientsdTyr.Value / 100 * ClientDataSetIngredientsTyr.Value;
|
||
1106 | end;
|
||
1107 | // Phe + Tyr
|
||
1108 | if ClientDataSetInraAfzPheTyr.IsNull
|
||
1109 | then
|
||
1110 | begin
|
||
1111 | ClientDataSetIngredientsPheTyr.Clear; |
||
1112 | ClientDataSetIngredientsPheTyr_MAT.Clear; |
||
1113 | ClientDataSetIngredientsdPheTyr.Clear; |
||
1114 | ClientDataSetIngredientsPheTyrd.Clear; |
||
1115 | end
|
||
1116 | else
|
||
1117 | begin
|
||
1118 | ClientDataSetIngredientsPheTyr.Value := OutputAA(ClientDataSetInraAfzPheTyr.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
1119 | ClientDataSetIngredientsPheTyr_MAT.Value := InputAA(ClientDataSetIngredientsPheTyr.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1120 | if ClientDataSetInraAfzdPheTyr.IsNull
|
||
1121 | then
|
||
1122 | ClientDataSetIngredientsdPheTyr.Value := dPheTyr * 100
|
||
1123 | else
|
||
1124 | ClientDataSetIngredientsdPheTyr.Value := ClientDataSetInraAfzdPheTyr.Value * 100;
|
||
1125 | ClientDataSetIngredientsPheTyrd.Value := ClientDataSetIngredientsdPheTyr.Value / 100 * ClientDataSetIngredientsPheTyr.Value;
|
||
1126 | end;
|
||
1127 | // His
|
||
1128 | if ClientDataSetInraAfzHis.IsNull
|
||
1129 | then
|
||
1130 | begin
|
||
1131 | ClientDataSetIngredientsHis.Clear; |
||
1132 | ClientDataSetIngredientsHis_MAT.Clear; |
||
1133 | ClientDataSetIngredientsdHis.Clear; |
||
1134 | ClientDataSetIngredientsHisd.Clear; |
||
1135 | end
|
||
1136 | else
|
||
1137 | begin
|
||
1138 | ClientDataSetIngredientsHis.Value := OutputAA(ClientDataSetInraAfzHis.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
1139 | ClientDataSetIngredientsHis_MAT.Value := InputAA(ClientDataSetIngredientsHis.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1140 | if ClientDataSetInraAfzdHis.IsNull
|
||
1141 | then
|
||
1142 | ClientDataSetIngredientsdHis.Value := dHis * 100
|
||
1143 | else
|
||
1144 | ClientDataSetIngredientsdHis.Value := ClientDataSetInraAfzdHis.Value * 100;
|
||
1145 | ClientDataSetIngredientsHisd.Value := ClientDataSetIngredientsdHis.Value / 100 * ClientDataSetIngredientsHis.Value;
|
||
1146 | end;
|
||
1147 | // Arg
|
||
1148 | if ClientDataSetInraAfzArg.IsNull
|
||
1149 | then
|
||
1150 | begin
|
||
1151 | ClientDataSetIngredientsArg.Clear; |
||
1152 | ClientDataSetIngredientsArg_MAT.Clear; |
||
1153 | ClientDataSetIngredientsdArg.Clear; |
||
1154 | ClientDataSetIngredientsArgd.Clear; |
||
1155 | end
|
||
1156 | else
|
||
1157 | begin
|
||
1158 | ClientDataSetIngredientsArg.Value := OutputAA(ClientDataSetInraAfzArg.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
1159 | ClientDataSetIngredientsArg_MAT.Value := InputAA(ClientDataSetIngredientsArg.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1160 | if ClientDataSetInraAfzdArg.IsNull
|
||
1161 | then
|
||
1162 | ClientDataSetIngredientsdArg.Value := dArg * 100
|
||
1163 | else
|
||
1164 | ClientDataSetIngredientsdArg.Value := ClientDataSetInraAfzdArg.Value * 100;
|
||
1165 | ClientDataSetIngredientsArgd.Value := ClientDataSetIngredientsdArg.Value / 100 * ClientDataSetIngredientsArg.Value;
|
||
1166 | end;
|
||
1167 | // Ala
|
||
1168 | if ClientDataSetInraAfzAla.IsNull
|
||
1169 | then
|
||
1170 | begin
|
||
1171 | ClientDataSetIngredientsAla.Clear; |
||
1172 | ClientDataSetIngredientsAla_MAT.Clear; |
||
1173 | ClientDataSetIngredientsdAla.Clear; |
||
1174 | ClientDataSetIngredientsAlad.Clear; |
||
1175 | end
|
||
1176 | else
|
||
1177 | begin
|
||
1178 | ClientDataSetIngredientsAla.Value := OutputAA(ClientDataSetInraAfzAla.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
1179 | ClientDataSetIngredientsAla_MAT.Value := InputAA(ClientDataSetIngredientsAla.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1180 | if ClientDataSetInraAfzdAla.IsNull
|
||
1181 | then
|
||
1182 | ClientDataSetIngredientsdAla.Value := dAla * 100
|
||
1183 | else
|
||
1184 | ClientDataSetIngredientsdAla.Value := ClientDataSetInraAfzdAla.Value * 100;
|
||
1185 | ClientDataSetIngredientsAlad.Value := ClientDataSetIngredientsdAla.Value / 100 * ClientDataSetIngredientsAla.Value;
|
||
1186 | end;
|
||
1187 | // Asp
|
||
1188 | if ClientDataSetInraAfzAsp.IsNull
|
||
1189 | then
|
||
1190 | begin
|
||
1191 | ClientDataSetIngredientsAsp.Clear; |
||
1192 | ClientDataSetIngredientsAsp_MAT.Clear; |
||
1193 | ClientDataSetIngredientsdAsp.Clear; |
||
1194 | ClientDataSetIngredientsAspd.Clear; |
||
1195 | end
|
||
1196 | else
|
||
1197 | begin
|
||
1198 | ClientDataSetIngredientsAsp.Value := OutputAA(ClientDataSetInraAfzAsp.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
1199 | ClientDataSetIngredientsAsp_MAT.Value := InputAA(ClientDataSetIngredientsAsp.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1200 | if ClientDataSetInraAfzdAsp.IsNull
|
||
1201 | then
|
||
1202 | ClientDataSetIngredientsdAsp.Value := dAsp * 100
|
||
1203 | else
|
||
1204 | ClientDataSetIngredientsdAsp.Value := ClientDataSetInraAfzdAsp.Value * 100;
|
||
1205 | ClientDataSetIngredientsAspd.Value := ClientDataSetIngredientsdAsp.Value / 100 * ClientDataSetIngredientsAsp.Value;
|
||
1206 | end;
|
||
1207 | // Glu
|
||
1208 | if ClientDataSetInraAfzGlu.IsNull
|
||
1209 | then
|
||
1210 | begin
|
||
1211 | ClientDataSetIngredientsGlu.Clear; |
||
1212 | ClientDataSetIngredientsGlu_MAT.Clear; |
||
1213 | ClientDataSetIngredientsdGlu.Clear; |
||
1214 | ClientDataSetIngredientsGlud.Clear; |
||
1215 | end
|
||
1216 | else
|
||
1217 | begin
|
||
1218 | ClientDataSetIngredientsGlu.Value := OutputAA(ClientDataSetInraAfzGlu.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
1219 | ClientDataSetIngredientsGlu_MAT.Value := InputAA(ClientDataSetIngredientsGlu.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1220 | if ClientDataSetInraAfzdGlu.IsNull
|
||
1221 | then
|
||
1222 | ClientDataSetIngredientsdGlu.Value := dGlu * 100
|
||
1223 | else
|
||
1224 | ClientDataSetIngredientsdGlu.Value := ClientDataSetInraAfzdGlu.Value * 100;
|
||
1225 | ClientDataSetIngredientsGlud.Value := ClientDataSetIngredientsdGlu.Value / 100 * ClientDataSetIngredientsGlu.Value;
|
||
1226 | end;
|
||
1227 | // Gly
|
||
1228 | if ClientDataSetInraAfzGly.IsNull
|
||
1229 | then
|
||
1230 | begin
|
||
1231 | ClientDataSetIngredientsGly.Clear; |
||
1232 | ClientDataSetIngredientsGly_MAT.Clear; |
||
1233 | ClientDataSetIngredientsdGly.Clear; |
||
1234 | ClientDataSetIngredientsGlyd.Clear; |
||
1235 | end
|
||
1236 | else
|
||
1237 | begin
|
||
1238 | ClientDataSetIngredientsGly.Value := OutputAA(ClientDataSetInraAfzGly.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
1239 | ClientDataSetIngredientsGly_MAT.Value := InputAA(ClientDataSetIngredientsGly.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1240 | if ClientDataSetInraAfzdGly.IsNull
|
||
1241 | then
|
||
1242 | ClientDataSetIngredientsdGly.Value := dGly * 100
|
||
1243 | else
|
||
1244 | ClientDataSetIngredientsdGly.Value := ClientDataSetInraAfzdGly.Value * 100;
|
||
1245 | ClientDataSetIngredientsGlyd.Value := ClientDataSetIngredientsdGly.Value / 100 * ClientDataSetIngredientsGly.Value;
|
||
1246 | end;
|
||
1247 | // Ser
|
||
1248 | if ClientDataSetInraAfzSer.IsNull
|
||
1249 | then
|
||
1250 | begin
|
||
1251 | ClientDataSetIngredientsSer.Clear; |
||
1252 | ClientDataSetIngredientsSer_MAT.Clear; |
||
1253 | ClientDataSetIngredientsdSer.Clear; |
||
1254 | ClientDataSetIngredientsSerd.Clear; |
||
1255 | end
|
||
1256 | else
|
||
1257 | begin
|
||
1258 | ClientDataSetIngredientsSer.Value := OutputAA(ClientDataSetInraAfzSer.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
1259 | ClientDataSetIngredientsSer_MAT.Value := InputAA(ClientDataSetIngredientsSer.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1260 | if ClientDataSetInraAfzdSer.IsNull
|
||
1261 | then
|
||
1262 | ClientDataSetIngredientsdSer.Value := dSer * 100
|
||
1263 | else
|
||
1264 | ClientDataSetIngredientsdSer.Value := ClientDataSetInraAfzdSer.Value * 100;
|
||
1265 | ClientDataSetIngredientsSerd.Value := ClientDataSetIngredientsdSer.Value / 100 * ClientDataSetIngredientsSer.Value;
|
||
1266 | end;
|
||
1267 | // Pro
|
||
1268 | if ClientDataSetInraAfzPro.IsNull
|
||
1269 | then
|
||
1270 | begin
|
||
1271 | ClientDataSetIngredientsPro.Clear; |
||
1272 | ClientDataSetIngredientsPro_MAT.Clear; |
||
1273 | ClientDataSetIngredientsdPro.Clear; |
||
1274 | ClientDataSetIngredientsProd.Clear; |
||
1275 | end
|
||
1276 | else
|
||
1277 | begin
|
||
1278 | ClientDataSetIngredientsPro.Value := OutputAA(ClientDataSetInraAfzPro.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA); |
||
1279 | ClientDataSetIngredientsPro_MAT.Value := InputAA(ClientDataSetIngredientsPro.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1280 | if ClientDataSetInraAfzdPro.IsNull
|
||
1281 | then
|
||
1282 | ClientDataSetIngredientsdPro.Value := dPro * 100
|
||
1283 | else
|
||
1284 | ClientDataSetIngredientsdPro.Value := ClientDataSetInraAfzdPro.Value * 100;
|
||
1285 | ClientDataSetIngredientsProd.Value := ClientDataSetIngredientsdPro.Value / 100 * ClientDataSetIngredientsPro.Value;
|
||
1286 | end;
|
||
1287 | end;
|
||
1288 | // Min?raux
|
||
1289 | if ClientDataSetInraAfzCa.IsNull
|
||
1290 | then
|
||
1291 | ClientDataSetIngredientsCa.Clear |
||
1292 | else
|
||
1293 | ClientDataSetIngredientsCa.Value := OutputMinerals(ClientDataSetInraAfzCa.Value, RapMS, FormOptions.Expression, FormOptions.Minerals); |
||
1294 | if ClientDataSetInraAfzP.IsNull
|
||
1295 | then
|
||
1296 | ClientDataSetIngredientsP.Clear |
||
1297 | else
|
||
1298 | ClientDataSetIngredientsP.Value := OutputMinerals(ClientDataSetInraAfzP.Value, RapMS, FormOptions.Expression, FormOptions.Minerals); |
||
1299 | 3 | avalancogn | if ClientDataSetInraAfzNa.IsNull
|
1300 | then
|
||
1301 | ClientDataSetIngredientsNa.Clear |
||
1302 | else
|
||
1303 | ClientDataSetIngredientsNa.Value := OutputMinerals(ClientDataSetInraAfzNa.Value, RapMS, FormOptions.Expression, FormOptions.Minerals); |
||
1304 | if ClientDataSetInraAfzK.IsNull
|
||
1305 | then
|
||
1306 | ClientDataSetIngredientsK.Clear |
||
1307 | else
|
||
1308 | ClientDataSetIngredientsK.Value := OutputMinerals(ClientDataSetInraAfzK.Value, RapMS, FormOptions.Expression, FormOptions.Minerals); |
||
1309 | if ClientDataSetInraAfzCl.IsNull
|
||
1310 | then
|
||
1311 | ClientDataSetIngredientsCl.Clear |
||
1312 | else
|
||
1313 | ClientDataSetIngredientsCl.Value := OutputMinerals(ClientDataSetInraAfzCl.Value, RapMS, FormOptions.Expression, FormOptions.Minerals); |
||
1314 | if ClientDataSetIngredientsNa.IsNull or ClientDataSetIngredientsK.IsNull or ClientDataSetIngredientsCl.IsNull |
||
1315 | then
|
||
1316 | ClientDataSetIngredientsBE.Clear |
||
1317 | else
|
||
1318 | ClientDataSetIngredientsBE.Value := CalcBilanElectrolytique(InputMinerals(ClientDataSetIngredientsNa.Value, RapMS, FormOptions.Expression, FormOptions.Minerals), InputMinerals(ClientDataSetIngredientsK.Value, RapMS, FormOptions.Expression, FormOptions.Minerals), InputMinerals(ClientDataSetIngredientsCl.Value, RapMS, FormOptions.Expression, FormOptions.Minerals)); |
||
1319 | 1 | avalancogn | if ClientDataSetIngredientsP.Value = 0 |
1320 | then // En l'absence de P, il n'y a pas de dP |
||
1321 | begin
|
||
1322 | ClientDataSetIngredientsdP.Clear; |
||
1323 | ClientDataSetIngredientsdPphy.Clear; |
||
1324 | end
|
||
1325 | else
|
||
1326 | begin
|
||
1327 | if ClientDataSetInraAfzdP.IsNull
|
||
1328 | then // Par d?faut dP = 20% |
||
1329 | ClientDataSetIngredientsdP.Value := 20
|
||
1330 | else
|
||
1331 | ClientDataSetIngredientsdP.Value := ClientDataSetInraAfzdP.Value * 100;
|
||
1332 | if ClientDataSetInraAfzdPphy.IsNull
|
||
1333 | then // Par d?faut dPphy = dP |
||
1334 | ClientDataSetIngredientsdPphy.Value := ClientDataSetIngredientsdP.Value |
||
1335 | else
|
||
1336 | ClientDataSetIngredientsdPphy.Value := ClientDataSetInraAfzdPphy.Value * 100;
|
||
1337 | end;
|
||
1338 | // Autres rapports
|
||
1339 | if ClientDataSetIngredientsLysd.IsNull or ClientDataSetIngredientsENc.IsNull or (ClientDataSetIngredientsENc.Value = 0) |
||
1340 | then
|
||
1341 | ClientDataSetIngredientsLysd_ENc.Clear |
||
1342 | else
|
||
1343 | if FormOptions.Energy = 0 |
||
1344 | then // g / MJ |
||
1345 | if FormOptions.AA = 0 |
||
1346 | then // % (conversion) |
||
1347 | ClientDataSetIngredientsLysd_ENc.Value := ClientDataSetIngredientsLysd.Value / 100 * 1000 / ClientDataSetIngredientsENc.Value |
||
1348 | else // g/kg |
||
1349 | ClientDataSetIngredientsLysd_ENc.Value := ClientDataSetIngredientsLysd.Value / ClientDataSetIngredientsENc.Value |
||
1350 | else // g / 1000 kcal |
||
1351 | if FormOptions.AA = 0 |
||
1352 | then // % (conversion) |
||
1353 | ClientDataSetIngredientsLysd_ENc.Value := ClientDataSetIngredientsLysd.Value / 100 * 1000 / ClientDataSetIngredientsENc.Value * 1000 |
||
1354 | else // g/kg |
||
1355 | ClientDataSetIngredientsLysd_ENc.Value := ClientDataSetIngredientsLysd.Value / ClientDataSetIngredientsENc.Value * 1000;
|
||
1356 | if ClientDataSetIngredientsLysd.IsNull or ClientDataSetIngredientsENt.IsNull or (ClientDataSetIngredientsENt.Value = 0) |
||
1357 | then
|
||
1358 | ClientDataSetIngredientsLysd_ENt.Clear |
||
1359 | else
|
||
1360 | if FormOptions.Energy = 0 |
||
1361 | then // g / MJ |
||
1362 | if FormOptions.AA = 0 |
||
1363 | then // % (conversion) |
||
1364 | ClientDataSetIngredientsLysd_ENt.Value := ClientDataSetIngredientsLysd.Value / 100 * 1000 / ClientDataSetIngredientsENt.Value |
||
1365 | else // g/kg |
||
1366 | ClientDataSetIngredientsLysd_ENt.Value := ClientDataSetIngredientsLysd.Value / ClientDataSetIngredientsENt.Value |
||
1367 | else // g / 1000 kcal |
||
1368 | if FormOptions.AA = 0 |
||
1369 | then // % (conversion) |
||
1370 | ClientDataSetIngredientsLysd_ENt.Value := ClientDataSetIngredientsLysd.Value / 100 * 1000 / ClientDataSetIngredientsENt.Value * 1000 |
||
1371 | else // g/kg |
||
1372 | ClientDataSetIngredientsLysd_ENt.Value := ClientDataSetIngredientsLysd.Value / ClientDataSetIngredientsENt.Value * 1000;
|
||
1373 | end;
|
||
1374 | |||
1375 | procedure TDataModuleDeclaration.CalcOriginal;
|
||
1376 | // Renseigner l'enregistrement courant de ClientDataSetIngredients
|
||
1377 | // ? partir de l'enregistrement courant de TableIngredients
|
||
1378 | // en tenant compte des unit?s configur?es
|
||
1379 | var
|
||
1380 | Nb: Integer; |
||
1381 | Bonus, EB, dE, EDc, EDt, EM, EN, EqCB, EqADF, EqNDF, NUri, EUri, Res, ResD, ECH4, dMO, dN: Double; |
||
1382 | begin
|
||
1383 | // Analyse proximale -> valeurs saisies
|
||
1384 | RapMS := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MS']);
|
||
1385 | ClientDataSetIngredientsMS.Value := OutputProximal(RapMS, 1, 1, FormOptions.Proximal); |
||
1386 | ClientDataSetIngredientsMS2.Value := OutputProximal(1, RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
1387 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MM']) |
||
1388 | then
|
||
1389 | ClientDataSetIngredientsMM.Clear |
||
1390 | else
|
||
1391 | ClientDataSetIngredientsMM.Value := OutputProximal(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MM']), RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
1392 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MAT']) |
||
1393 | then
|
||
1394 | ClientDataSetIngredientsMAT.Clear |
||
1395 | else
|
||
1396 | begin
|
||
1397 | RapMAT := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']);
|
||
1398 | ClientDataSetIngredientsMAT.Value := OutputProximal(RapMAT, RapMS, FormOptions.Expression, FormOptions.Proximal); |
||
1399 | end;
|
||
1400 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MG']) |
||
1401 | then
|
||
1402 | ClientDataSetIngredientsMG.Clear |
||
1403 | else
|
||
1404 | ClientDataSetIngredientsMG.Value := OutputProximal(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']), RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
1405 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['CB']) |
||
1406 | then
|
||
1407 | ClientDataSetIngredientsCB.Clear |
||
1408 | else
|
||
1409 | ClientDataSetIngredientsCB.Value := OutputProximal(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['CB']), RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
1410 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['NDF']) |
||
1411 | then
|
||
1412 | ClientDataSetIngredientsNDF.Clear |
||
1413 | else
|
||
1414 | ClientDataSetIngredientsNDF.Value := OutputProximal(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['NDF']), RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
1415 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['ADF']) |
||
1416 | then
|
||
1417 | ClientDataSetIngredientsADF.Clear |
||
1418 | else
|
||
1419 | ClientDataSetIngredientsADF.Value := OutputProximal(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['ADF']), RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
1420 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['ADL']) |
||
1421 | then
|
||
1422 | ClientDataSetIngredientsADL.Clear |
||
1423 | else
|
||
1424 | ClientDataSetIngredientsADL.Value := OutputProximal(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['ADL']), RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
1425 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Amidon']) |
||
1426 | then
|
||
1427 | ClientDataSetIngredientsAmidon.Clear |
||
1428 | else
|
||
1429 | ClientDataSetIngredientsAmidon.Value := OutputProximal(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Amidon']), RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
1430 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Sucres']) |
||
1431 | then
|
||
1432 | ClientDataSetIngredientsSucres.Clear |
||
1433 | else
|
||
1434 | ClientDataSetIngredientsSucres.Value := OutputProximal(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Sucres']), RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
1435 | // Energie
|
||
1436 | EB := 0;
|
||
1437 | dE := 0;
|
||
1438 | EDc := 0;
|
||
1439 | EDt := 0;
|
||
1440 | EM := 0;
|
||
1441 | // EN := 0;
|
||
1442 | NUri := 0;
|
||
1443 | // EUri := 0;
|
||
1444 | Res := 0;
|
||
1445 | // ResD := 0;
|
||
1446 | // ECH4 := 0;
|
||
1447 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['EB']) |
||
1448 | then // EB calcul?e |
||
1449 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MM']) |
||
1450 | or TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MAT']) |
||
1451 | or TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MG']) |
||
1452 | then // Informations insuffisantes pour calculer (ne devrait pas se produire) |
||
1453 | ClientDataSetIngredientsEB.Clear |
||
1454 | else
|
||
1455 | begin
|
||
1456 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['CB']) |
||
1457 | then
|
||
1458 | EqCB := 0
|
||
1459 | else
|
||
1460 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Sucres']) |
||
1461 | then // Equation SANS sucres |
||
1462 | EqCB := 17.57 + 5.35 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) + 21.68 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) - 18.61 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MM']) + 2.84 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['CB']) |
||
1463 | else // Equation AVEC sucres |
||
1464 | EqCB := 17.56 + 5.51 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) + 21.48 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) - 17.74 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MM']) + 2.59 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['CB']) - 1.14 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Sucres']); |
||
1465 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['ADF']) |
||
1466 | then
|
||
1467 | EqADF := 0
|
||
1468 | else
|
||
1469 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Sucres']) |
||
1470 | then // Equation SANS sucres |
||
1471 | EqADF := 17.58 + 5.29 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) + 21.71 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) - 18.58 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MM']) + 2.38 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['ADF']) |
||
1472 | else // Equation AVEC sucres |
||
1473 | EqADF := 17.56 + 5.45 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) + 21.50 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) - 17.69 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MM']) + 2.16 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['ADF']) - 1.15 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Sucres']); |
||
1474 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['NDF']) |
||
1475 | then
|
||
1476 | EqNDF := 0
|
||
1477 | else
|
||
1478 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Sucres']) |
||
1479 | then // Equation SANS sucres |
||
1480 | EqNDF := 17.40 + 5.73 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) + 21.76 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) - 18.73 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MM']) + 1.61 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['NDF']) |
||
1481 | else // Equation AVEC sucres |
||
1482 | EqNDF := 17.41 + 5.79 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) + 21.63 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) - 18.12 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MM']) + 1.48 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['NDF']) - 0.72 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Sucres']); |
||
1483 | Nb := 0;
|
||
1484 | if EqCB <> 0 then Inc(Nb); |
||
1485 | if EqADF <> 0 then Inc(Nb); |
||
1486 | if EqNDF <> 0 then Inc(Nb); |
||
1487 | if Nb = 0 |
||
1488 | then // Equations sans valeur de fibre (ne devrait pas se produire) |
||
1489 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Amidon']) |
||
1490 | then // Equation SANS amidon |
||
1491 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Sucres']) |
||
1492 | then // Equation SANS sucres |
||
1493 | EB := 17.64 + 4.78 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) + 21.80 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) - 15.88 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MM']) |
||
1494 | else // Equation AVEC sucres |
||
1495 | EB := 17.61 + 5.05 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) + 21.53 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) - 15.06 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MM']) - 1.48 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Sucres']) |
||
1496 | else // Equation AVEC amidon |
||
1497 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Sucres']) |
||
1498 | then // Equation SANS sucres |
||
1499 | EB := 18.47 + 4.14 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) + 21.08 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) - 19.64 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MM']) - 0.92 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Amidon']) |
||
1500 | else // Equation AVEC sucres |
||
1501 | EB := 18.88 + 4.24 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) + 20.25 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) - 20.37 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MM']) - 1.42 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Amidon']) - 2.38 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Sucres']) |
||
1502 | else // Moyenne des ?quations significatives |
||
1503 | EB := (EqCB + EqADF + EqNDF) / Nb; |
||
1504 | ClientDataSetIngredientsEB.Value := OutputEnergy(EB, RapMS, FormOptions.Expression, FormOptions.Energy); |
||
1505 | end
|
||
1506 | else // EB fournie par l'utilisateur |
||
1507 | begin
|
||
1508 | EB := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['EB']);
|
||
1509 | ClientDataSetIngredientsEB.Value := OutputEnergy(EB, RapMS, FormOptions.Expression, FormOptions.Energy); |
||
1510 | end;
|
||
1511 | Bonus := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Bonus']) * 100; |
||
1512 | ClientDataSetIngredientsBonus.Value := Bonus; |
||
1513 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['CB']) |
||
1514 | then
|
||
1515 | EqCB := 0
|
||
1516 | else
|
||
1517 | EqCB := 90.1 - 157.0 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['CB']); |
||
1518 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['NDF']) |
||
1519 | then
|
||
1520 | EqNDF := 0
|
||
1521 | else
|
||
1522 | EqNDF := 98.3 - 90.0 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['NDF']); |
||
1523 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['ADF']) |
||
1524 | then
|
||
1525 | EqADF := 0
|
||
1526 | else
|
||
1527 | EqADF := 90.8 - 143.0 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['ADF']); |
||
1528 | Nb := 0;
|
||
1529 | if EqCB <> 0 then Inc(Nb); |
||
1530 | if EqNDF <> 0 then Inc(Nb); |
||
1531 | if EqADF <> 0 then Inc(Nb); |
||
1532 | if Nb = 0 |
||
1533 | then // Faute de valeur de fibres, on ne peut calculer la digestibilit? (ne devrait pas se produire) |
||
1534 | ClientDataSetIngredientsdEc.Clear |
||
1535 | else // Moyenne des ?quations significatives |
||
1536 | begin
|
||
1537 | dE := (EqCB + EqNDF + EqADF) / Nb + Bonus; |
||
1538 | ClientDataSetIngredientsdEc.Value := dE; |
||
1539 | end;
|
||
1540 | if ClientDataSetIngredientsEB.IsNull or ClientDataSetIngredientsdEc.IsNull |
||
1541 | then // Informations insuffisantes pour calculer (ne devrait pas se produire) |
||
1542 | ClientDataSetIngredientsEDc.Clear |
||
1543 | else
|
||
1544 | begin
|
||
1545 | EDc := EB * dE / 100;
|
||
1546 | ClientDataSetIngredientsEDc.Value := OutputEnergy(EDc, RapMS, FormOptions.Expression, FormOptions.Energy); |
||
1547 | end;
|
||
1548 | if ClientDataSetIngredientsEDc.IsNull
|
||
1549 | or TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MM']) |
||
1550 | or TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MAT']) |
||
1551 | or TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MG']) |
||
1552 | or TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Amidon']) |
||
1553 | then // Informations insuffisantes pour calculer |
||
1554 | begin
|
||
1555 | ClientDataSetIngredientsEMc.Clear; |
||
1556 | ClientDataSetIngredientsEMc_EDc.Clear; |
||
1557 | end
|
||
1558 | else
|
||
1559 | begin
|
||
1560 | NUri := 0.4 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) / 6.25; |
||
1561 | EUri := CALORIE * (0.046 + 7.4 * NUri); |
||
1562 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Sucres']) |
||
1563 | then // par d?faut, on estime les sucres ? 2 % MS |
||
1564 | Res := 1 - TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MM']) - TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) - TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) - TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Amidon']) - 0.02 |
||
1565 | else
|
||
1566 | Res := 1 - TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MM']) - TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) - TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) - TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Amidon']) - TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Sucres']); |
||
1567 | ResD := 0.5 * Res;
|
||
1568 | ECH4 := CALORIE * 0.16 * ResD;
|
||
1569 | EM := EDc - EUri - ECH4; |
||
1570 | ClientDataSetIngredientsEMc.Value := OutputEnergy(EM, RapMS, FormOptions.Expression, FormOptions.Energy); |
||
1571 | if EDc = 0 |
||
1572 | then // Division par 0 |
||
1573 | ClientDataSetIngredientsEMc_EDc.Clear |
||
1574 | else
|
||
1575 | ClientDataSetIngredientsEMc_EDc.Value := EM / EDc * 100;
|
||
1576 | end;
|
||
1577 | if ClientDataSetIngredientsEDc.IsNull
|
||
1578 | or TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MAT']) |
||
1579 | or TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MG']) |
||
1580 | or TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Amidon']) |
||
1581 | then // Informations insuffisantes pour calculer |
||
1582 | begin
|
||
1583 | ClientDataSetIngredientsENc.Clear; |
||
1584 | ClientDataSetIngredientsENc_EMc.Clear; |
||
1585 | end
|
||
1586 | else
|
||
1587 | begin
|
||
1588 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['CB']) |
||
1589 | then
|
||
1590 | EqCB := 0
|
||
1591 | else
|
||
1592 | EqCB := 0.703 * EDc - 4.04 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) + 6.62 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) + 1.97 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Amidon']) - 4.09 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['CB']); |
||
1593 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['NDF']) |
||
1594 | then
|
||
1595 | EqNDF := 0
|
||
1596 | else
|
||
1597 | EqNDF := 0.703 * EDc - 4.10 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) + 6.64 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) + 1.97 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Amidon']) - 1.34 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['NDF']); |
||
1598 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['ADF']) |
||
1599 | then
|
||
1600 | EqADF := 0
|
||
1601 | else
|
||
1602 | EqADF := 0.700 * EDc - 3.82 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) + 6.74 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) + 2.02 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Amidon']) - 3.65 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['ADF']); |
||
1603 | Nb := 0;
|
||
1604 | if EqCB <> 0 then Inc(Nb); |
||
1605 | if EqNDF <> 0 then Inc(Nb); |
||
1606 | if EqADF <> 0 then Inc(Nb); |
||
1607 | if Nb = 0 |
||
1608 | then // Faute de valeur de fibres, on ne peut calculer la digestibilit? (ne devrait pas se produire) |
||
1609 | begin
|
||
1610 | ClientDataSetIngredientsENc.Clear; |
||
1611 | ClientDataSetIngredientsENc_EMc.Clear; |
||
1612 | end
|
||
1613 | else // Moyenne des ?quations significatives |
||
1614 | begin
|
||
1615 | EN := (EqCB + EqNDF + EqADF) / Nb; |
||
1616 | ClientDataSetIngredientsENc.Value := OutputEnergy(EN, RapMS, FormOptions.Expression, FormOptions.Energy); |
||
1617 | if EM = 0 |
||
1618 | then // Division par 0 |
||
1619 | ClientDataSetIngredientsENc_EMc.Clear |
||
1620 | else
|
||
1621 | ClientDataSetIngredientsENc_EMc.Value := EN / EM * 100;
|
||
1622 | end;
|
||
1623 | end;
|
||
1624 | if ClientDataSetIngredientsEDc.IsNull
|
||
1625 | or TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MM']) |
||
1626 | or TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MAT']) |
||
1627 | then // Informations insuffisantes pour calculer (ne devrait pas se produire) |
||
1628 | begin
|
||
1629 | ClientDataSetIngredientsEDt.Clear; |
||
1630 | ClientDataSetIngredientsEDt_EDc.Clear; |
||
1631 | end
|
||
1632 | else
|
||
1633 | begin
|
||
1634 | dMO := (7.45 + 0.949 * dE - 4.0 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT'])) / 100; |
||
1635 | EDt := EDc + CALORIE * (1 - TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MM'])) * (1 - dMO); |
||
1636 | ClientDataSetIngredientsEDt.Value := OutputEnergy(EDt, RapMS, FormOptions.Expression, FormOptions.Energy); |
||
1637 | if EDc = 0 |
||
1638 | then // Division par 0 |
||
1639 | ClientDataSetIngredientsEDt_EDc.Clear |
||
1640 | else
|
||
1641 | ClientDataSetIngredientsEDt_EDc.Value := EDt / EDc * 100;
|
||
1642 | end;
|
||
1643 | if ClientDataSetIngredientsEDt.IsNull
|
||
1644 | or TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MM']) |
||
1645 | or TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MAT']) |
||
1646 | or TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MG']) |
||
1647 | or TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Amidon']) |
||
1648 | then // Informations insuffisantes pour calculer |
||
1649 | begin
|
||
1650 | ClientDataSetIngredientsEMt.Clear; |
||
1651 | ClientDataSetIngredientsEMt_EDt.Clear; |
||
1652 | end
|
||
1653 | else
|
||
1654 | begin
|
||
1655 | // NUri := 0.4 * TableIngredients.FieldByName('MAT').AsFloat / 6.25;
|
||
1656 | EUri := CALORIE * (0.052 + 7.4 * NUri); |
||
1657 | // if TableIngredients.FieldByName('Sucres').IsNull
|
||
1658 | // then // par d?faut, on estime les sucres ? 2 % MS
|
||
1659 | // Res := 1 - TableIngredients.FieldByName('MM').AsFloat - TableIngredients.FieldByName('MAT').AsFloat - TableIngredients.FieldByName('MG').AsFloat - TableIngredients.FieldByName('Amidon').AsFloat - 0.02
|
||
1660 | // else
|
||
1661 | // Res := 1 - TableIngredients.FieldByName('MM').AsFloat - TableIngredients.FieldByName('MAT').AsFloat - TableIngredients.FieldByName('MG').AsFloat - TableIngredients.FieldByName('Amidon').AsFloat - TableIngredients.FieldByName('Sucres').AsFloat;
|
||
1662 | ResD := 0.6 * Res;
|
||
1663 | ECH4 := CALORIE * 0.32 * ResD;
|
||
1664 | EM := EDt - EUri - ECH4; |
||
1665 | ClientDataSetIngredientsEMt.Value := OutputEnergy(EM, RapMS, FormOptions.Expression, FormOptions.Energy); |
||
1666 | if EDt = 0 |
||
1667 | then // Division par 0 |
||
1668 | ClientDataSetIngredientsEMt_EDt.Clear |
||
1669 | else
|
||
1670 | ClientDataSetIngredientsEMt_EDt.Value := EM / EDt * 100;
|
||
1671 | end;
|
||
1672 | if ClientDataSetIngredientsEDt.IsNull
|
||
1673 | or TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MAT']) |
||
1674 | or TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MG']) |
||
1675 | or TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Amidon']) |
||
1676 | then // Informations insuffisantes pour calculer |
||
1677 | begin
|
||
1678 | ClientDataSetIngredientsENt.Clear; |
||
1679 | ClientDataSetIngredientsENt_EMt.Clear; |
||
1680 | end
|
||
1681 | else
|
||
1682 | begin
|
||
1683 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['CB']) |
||
1684 | then
|
||
1685 | EqCB := 0
|
||
1686 | else
|
||
1687 | EqCB := 0.703 * EDt - 4.04 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) + 6.62 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) + 1.97 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Amidon']) - 4.09 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['CB']); |
||
1688 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['NDF']) |
||
1689 | then
|
||
1690 | EqNDF := 0
|
||
1691 | else
|
||
1692 | EqNDF := 0.703 * EDt - 4.10 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) + 6.64 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) + 1.97 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Amidon']) - 1.34 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['NDF']); |
||
1693 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['ADF']) |
||
1694 | then
|
||
1695 | EqADF := 0
|
||
1696 | else
|
||
1697 | EqADF := 0.700 * EDt - 3.82 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) + 6.74 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) + 2.02 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Amidon']) - 3.65 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['ADF']); |
||
1698 | Nb := 0;
|
||
1699 | if EqCB <> 0 then Inc(Nb); |
||
1700 | if EqNDF <> 0 then Inc(Nb); |
||
1701 | if EqADF <> 0 then Inc(Nb); |
||
1702 | if Nb = 0 |
||
1703 | then // Faute de valeur de fibres, on ne peut calculer la digestibilit? (ne devrait pas se produire) |
||
1704 | begin
|
||
1705 | ClientDataSetIngredientsENt.Clear; |
||
1706 | ClientDataSetIngredientsENt_EMt.Clear; |
||
1707 | end
|
||
1708 | else // Moyenne des ?quations significatives |
||
1709 | begin
|
||
1710 | EN := (EqCB + EqNDF + EqADF) / Nb; |
||
1711 | ClientDataSetIngredientsENt.Value := OutputEnergy(EN, RapMS, FormOptions.Expression, FormOptions.Energy); |
||
1712 | if EM = 0 |
||
1713 | then // Division par 0 |
||
1714 | ClientDataSetIngredientsENt_EMt.Clear |
||
1715 | else
|
||
1716 | ClientDataSetIngredientsENt_EMt.Value := EN / EM * 100;
|
||
1717 | end;
|
||
1718 | end;
|
||
1719 | if ClientDataSetIngredientsEDt.IsNull or ClientDataSetIngredientsEB.IsNull or (ClientDataSetIngredientsEB.Value = 0) |
||
1720 | then
|
||
1721 | ClientDataSetIngredientsdEt.Clear |
||
1722 | else
|
||
1723 | ClientDataSetIngredientsdEt.Value := ClientDataSetIngredientsEDt.Value / ClientDataSetIngredientsEB.Value * 100;
|
||
1724 | if ClientDataSetIngredientsEMt.IsNull or ClientDataSetIngredientsEMc.IsNull or (ClientDataSetIngredientsEMc.Value = 0) |
||
1725 | then
|
||
1726 | ClientDataSetIngredientsEMt_EMc.Clear |
||
1727 | else
|
||
1728 | ClientDataSetIngredientsEMt_EMc.Value := ClientDataSetIngredientsEMt.Value / ClientDataSetIngredientsEMc.Value * 100;
|
||
1729 | if ClientDataSetIngredientsENt.IsNull or ClientDataSetIngredientsENc.IsNull or (ClientDataSetIngredientsENc.Value = 0) |
||
1730 | then
|
||
1731 | ClientDataSetIngredientsENt_ENc.Clear |
||
1732 | else
|
||
1733 | ClientDataSetIngredientsENt_ENc.Value := ClientDataSetIngredientsENt.Value / ClientDataSetIngredientsENc.Value * 100;
|
||
1734 | // Digestibilit? f?cale de l'azote
|
||
1735 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MAT']) |
||
1736 | then // Informations insuffisantes pour calculer (ne devrait pas se produire) |
||
1737 | begin
|
||
1738 | ClientDataSetIngredientsdNc.Clear; |
||
1739 | ClientDataSetIngredientsdNt.Clear; |
||
1740 | end
|
||
1741 | else
|
||
1742 | begin
|
||
1743 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['CB']) |
||
1744 | then
|
||
1745 | EqCB := 0
|
||
1746 | else
|
||
1747 | EqCB := 76.8 + 69.0 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) - 122.0 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['CB']); |
||
1748 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['NDF']) |
||
1749 | then
|
||
1750 | EqNDF := 0
|
||
1751 | else
|
||
1752 | EqNDF := 81.3 + 79.0 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) - 69.0 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['NDF']); |
||
1753 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['ADF']) |
||
1754 | then
|
||
1755 | EqADF := 0
|
||
1756 | else
|
||
1757 | EqADF := 77.4 + 70.0 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) - 116.0 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['ADF']); |
||
1758 | Nb := 0;
|
||
1759 | if EqCB <> 0 then Inc(Nb); |
||
1760 | if EqNDF <> 0 then Inc(Nb); |
||
1761 | if EqADF <> 0 then Inc(Nb); |
||
1762 | if Nb = 0 |
||
1763 | then // Faute de valeur de fibres, on ne peut calculer la digestibilit? (ne devrait pas se produire) |
||
1764 | ClientDataSetIngredientsdNc.Clear |
||
1765 | else // Moyenne des ?quations significatives |
||
1766 | begin
|
||
1767 | dN := (EqCB + EqNDF + EqADF) / Nb; |
||
1768 | ClientDataSetIngredientsdNc.Value := dN; |
||
1769 | end;
|
||
1770 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['CB']) |
||
1771 | then
|
||
1772 | EqCB := 0
|
||
1773 | else
|
||
1774 | EqCB := 77.9 + 77.0 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) - 87.0 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['CB']); |
||
1775 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['NDF']) |
||
1776 | then
|
||
1777 | EqNDF := 0
|
||
1778 | else
|
||
1779 | EqNDF := 79.9 + 86.0 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) - 44.0 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['NDF']); |
||
1780 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['ADF']) |
||
1781 | then
|
||
1782 | EqADF := 0
|
||
1783 | else
|
||
1784 | EqADF := 78.3 + 78.0 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) - 83.0 * TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['ADF']); |
||
1785 | Nb := 0;
|
||
1786 | if EqCB <> 0 then Inc(Nb); |
||
1787 | if EqNDF <> 0 then Inc(Nb); |
||
1788 | if EqADF <> 0 then Inc(Nb); |
||
1789 | if Nb = 0 |
||
1790 | then // Faute de valeur de fibres, on ne peut calculer la digestibilit? (ne devrait pas se produire) |
||
1791 | ClientDataSetIngredientsdNt.Clear |
||
1792 | else // Moyenne des ?quations significatives |
||
1793 | begin
|
||
1794 | dN := (EqCB + EqNDF + EqADF) / Nb; |
||
1795 | ClientDataSetIngredientsdNt.Value := dN; |
||
1796 | end;
|
||
1797 | end;
|
||
1798 | // Acides amin?s
|
||
1799 | if RapMAT = 0 |
||
1800 | then // En l'absence de MAT, il n'y a pas d'acides amin?s |
||
1801 | begin
|
||
1802 | // Teneurs
|
||
1803 | ClientDataSetIngredientsLys.Clear; |
||
1804 | ClientDataSetIngredientsThr.Clear; |
||
1805 | ClientDataSetIngredientsMet.Clear; |
||
1806 | ClientDataSetIngredientsCys.Clear; |
||
1807 | ClientDataSetIngredientsMetCys.Clear; |
||
1808 | ClientDataSetIngredientsTrp.Clear; |
||
1809 | ClientDataSetIngredientsIle.Clear; |
||
1810 | ClientDataSetIngredientsVal.Clear; |
||
1811 | ClientDataSetIngredientsLeu.Clear; |
||
1812 | ClientDataSetIngredientsPhe.Clear; |
||
1813 | ClientDataSetIngredientsTyr.Clear; |
||
1814 | ClientDataSetIngredientsPheTyr.Clear; |
||
1815 | ClientDataSetIngredientsHis.Clear; |
||
1816 | ClientDataSetIngredientsArg.Clear; |
||
1817 | ClientDataSetIngredientsAla.Clear; |
||
1818 | ClientDataSetIngredientsAsp.Clear; |
||
1819 | ClientDataSetIngredientsGlu.Clear; |
||
1820 | ClientDataSetIngredientsGly.Clear; |
||
1821 | ClientDataSetIngredientsSer.Clear; |
||
1822 | ClientDataSetIngredientsPro.Clear; |
||
1823 | // % MAT
|
||
1824 | ClientDataSetIngredientsLys_MAT.Clear; |
||
1825 | ClientDataSetIngredientsThr_MAT.Clear; |
||
1826 | ClientDataSetIngredientsMet_MAT.Clear; |
||
1827 | ClientDataSetIngredientsCys_MAT.Clear; |
||
1828 | ClientDataSetIngredientsMetCys_MAT.Clear; |
||
1829 | ClientDataSetIngredientsTrp_MAT.Clear; |
||
1830 | ClientDataSetIngredientsIle_MAT.Clear; |
||
1831 | ClientDataSetIngredientsVal_MAT.Clear; |
||
1832 | ClientDataSetIngredientsLeu_MAT.Clear; |
||
1833 | ClientDataSetIngredientsPhe_MAT.Clear; |
||
1834 | ClientDataSetIngredientsTyr_MAT.Clear; |
||
1835 | ClientDataSetIngredientsPheTyr_MAT.Clear; |
||
1836 | ClientDataSetIngredientsHis_MAT.Clear; |
||
1837 | ClientDataSetIngredientsArg_MAT.Clear; |
||
1838 | ClientDataSetIngredientsAla_MAT.Clear; |
||
1839 | ClientDataSetIngredientsAsp_MAT.Clear; |
||
1840 | ClientDataSetIngredientsGlu_MAT.Clear; |
||
1841 | ClientDataSetIngredientsGly_MAT.Clear; |
||
1842 | ClientDataSetIngredientsSer_MAT.Clear; |
||
1843 | ClientDataSetIngredientsPro_MAT.Clear; |
||
1844 | // Digestibilit?s
|
||
1845 | ClientDataSetIngredientsdLys.Clear; |
||
1846 | ClientDataSetIngredientsdThr.Clear; |
||
1847 | ClientDataSetIngredientsdMet.Clear; |
||
1848 | ClientDataSetIngredientsdCys.Clear; |
||
1849 | ClientDataSetIngredientsdMetCys.Clear; |
||
1850 | ClientDataSetIngredientsdTrp.Clear; |
||
1851 | ClientDataSetIngredientsdIle.Clear; |
||
1852 | ClientDataSetIngredientsdVal.Clear; |
||
1853 | ClientDataSetIngredientsdLeu.Clear; |
||
1854 | ClientDataSetIngredientsdPhe.Clear; |
||
1855 | ClientDataSetIngredientsdTyr.Clear; |
||
1856 | ClientDataSetIngredientsdPheTyr.Clear; |
||
1857 | ClientDataSetIngredientsdHis.Clear; |
||
1858 | ClientDataSetIngredientsdArg.Clear; |
||
1859 | ClientDataSetIngredientsdAla.Clear; |
||
1860 | ClientDataSetIngredientsdAsp.Clear; |
||
1861 | ClientDataSetIngredientsdGlu.Clear; |
||
1862 | ClientDataSetIngredientsdGly.Clear; |
||
1863 | ClientDataSetIngredientsdSer.Clear; |
||
1864 | ClientDataSetIngredientsdPro.Clear; |
||
1865 | // Teneurs digestibles
|
||
1866 | ClientDataSetIngredientsLysd.Clear; |
||
1867 | ClientDataSetIngredientsThrd.Clear; |
||
1868 | ClientDataSetIngredientsMetd.Clear; |
||
1869 | ClientDataSetIngredientsCysd.Clear; |
||
1870 | ClientDataSetIngredientsMetCysd.Clear; |
||
1871 | ClientDataSetIngredientsTrpd.Clear; |
||
1872 | ClientDataSetIngredientsIled.Clear; |
||
1873 | ClientDataSetIngredientsVald.Clear; |
||
1874 | ClientDataSetIngredientsLeud.Clear; |
||
1875 | ClientDataSetIngredientsPhed.Clear; |
||
1876 | ClientDataSetIngredientsTyrd.Clear; |
||
1877 | ClientDataSetIngredientsPheTyrd.Clear; |
||
1878 | ClientDataSetIngredientsHisd.Clear; |
||
1879 | ClientDataSetIngredientsArgd.Clear; |
||
1880 | ClientDataSetIngredientsAlad.Clear; |
||
1881 | ClientDataSetIngredientsAspd.Clear; |
||
1882 | ClientDataSetIngredientsGlud.Clear; |
||
1883 | ClientDataSetIngredientsGlyd.Clear; |
||
1884 | ClientDataSetIngredientsSerd.Clear; |
||
1885 | ClientDataSetIngredientsProd.Clear; |
||
1886 | end
|
||
1887 | else
|
||
1888 | begin
|
||
1889 | // Lys
|
||
1890 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Lys']) |
||
1891 | then
|
||
1892 | begin
|
||
1893 | ClientDataSetIngredientsLys.Clear; |
||
1894 | ClientDataSetIngredientsLys_MAT.Clear; |
||
1895 | ClientDataSetIngredientsdLys.Clear; |
||
1896 | ClientDataSetIngredientsLysd.Clear; |
||
1897 | end
|
||
1898 | else
|
||
1899 | begin
|
||
1900 | ClientDataSetIngredientsLys.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Lys']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
1901 | ClientDataSetIngredientsLys_MAT.Value := InputAA(ClientDataSetIngredientsLys.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1902 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dLys']) |
||
1903 | then
|
||
1904 | ClientDataSetIngredientsdLys.Value := dLys * 100
|
||
1905 | else
|
||
1906 | ClientDataSetIngredientsdLys.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dLys']) * 100; |
||
1907 | ClientDataSetIngredientsLysd.Value := ClientDataSetIngredientsdLys.Value * ClientDataSetIngredientsLys.Value / 100;
|
||
1908 | end;
|
||
1909 | // Thr
|
||
1910 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Thr']) |
||
1911 | then
|
||
1912 | begin
|
||
1913 | ClientDataSetIngredientsThr.Clear; |
||
1914 | ClientDataSetIngredientsThr_MAT.Clear; |
||
1915 | ClientDataSetIngredientsdThr.Clear; |
||
1916 | ClientDataSetIngredientsThrd.Clear; |
||
1917 | end
|
||
1918 | else
|
||
1919 | begin
|
||
1920 | ClientDataSetIngredientsThr.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Thr']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
1921 | ClientDataSetIngredientsThr_MAT.Value := InputAA(ClientDataSetIngredientsThr.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1922 | ClientDataSetIngredientsdThr.Value := dThr * 100;
|
||
1923 | ClientDataSetIngredientsThrd.Value := dThr * ClientDataSetIngredientsThr.Value; |
||
1924 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dThr']) |
||
1925 | then
|
||
1926 | ClientDataSetIngredientsdThr.Value := dThr * 100
|
||
1927 | else
|
||
1928 | ClientDataSetIngredientsdThr.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dThr']) * 100; |
||
1929 | ClientDataSetIngredientsThrd.Value := ClientDataSetIngredientsdThr.Value * ClientDataSetIngredientsThr.Value / 100;
|
||
1930 | end;
|
||
1931 | // Met
|
||
1932 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Met']) |
||
1933 | then
|
||
1934 | begin
|
||
1935 | ClientDataSetIngredientsMet.Clear; |
||
1936 | ClientDataSetIngredientsMet_MAT.Clear; |
||
1937 | ClientDataSetIngredientsdMet.Clear; |
||
1938 | ClientDataSetIngredientsMetd.Clear; |
||
1939 | end
|
||
1940 | else
|
||
1941 | begin
|
||
1942 | ClientDataSetIngredientsMet.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Met']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
1943 | ClientDataSetIngredientsMet_MAT.Value := InputAA(ClientDataSetIngredientsMet.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1944 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dMet']) |
||
1945 | then
|
||
1946 | ClientDataSetIngredientsdMet.Value := dMet * 100
|
||
1947 | else
|
||
1948 | ClientDataSetIngredientsdMet.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dMet']) * 100; |
||
1949 | ClientDataSetIngredientsMetd.Value := ClientDataSetIngredientsdMet.Value * ClientDataSetIngredientsMet.Value / 100;
|
||
1950 | end;
|
||
1951 | // Cys
|
||
1952 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Cys']) |
||
1953 | then
|
||
1954 | begin
|
||
1955 | ClientDataSetIngredientsCys.Clear; |
||
1956 | ClientDataSetIngredientsCys_MAT.Clear; |
||
1957 | ClientDataSetIngredientsdCys.Clear; |
||
1958 | ClientDataSetIngredientsCysd.Clear; |
||
1959 | end
|
||
1960 | else
|
||
1961 | begin
|
||
1962 | ClientDataSetIngredientsCys.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Cys']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
1963 | ClientDataSetIngredientsCys_MAT.Value := InputAA(ClientDataSetIngredientsCys.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1964 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dCys']) |
||
1965 | then
|
||
1966 | ClientDataSetIngredientsdCys.Value := dCys * 100
|
||
1967 | else
|
||
1968 | ClientDataSetIngredientsdCys.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dCys']) * 100; |
||
1969 | ClientDataSetIngredientsCysd.Value := ClientDataSetIngredientsdCys.Value * ClientDataSetIngredientsCys.Value / 100;
|
||
1970 | end;
|
||
1971 | // Met + Cys
|
||
1972 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MetCys']) |
||
1973 | then
|
||
1974 | begin
|
||
1975 | ClientDataSetIngredientsMetCys.Clear; |
||
1976 | ClientDataSetIngredientsMetCys_MAT.Clear; |
||
1977 | ClientDataSetIngredientsdMetCys.Clear; |
||
1978 | ClientDataSetIngredientsMetCysd.Clear; |
||
1979 | end
|
||
1980 | else
|
||
1981 | begin
|
||
1982 | ClientDataSetIngredientsMetCys.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MetCys']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
1983 | ClientDataSetIngredientsMetCys_MAT.Value := InputAA(ClientDataSetIngredientsMetCys.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
1984 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dMetCys']) |
||
1985 | then
|
||
1986 | ClientDataSetIngredientsdMetCys.Value := dMetCys * 100
|
||
1987 | else
|
||
1988 | ClientDataSetIngredientsdMetCys.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dMetCys']) * 100; |
||
1989 | ClientDataSetIngredientsMetCysd.Value := ClientDataSetIngredientsdMetCys.Value * ClientDataSetIngredientsMetCys.Value / 100;
|
||
1990 | end;
|
||
1991 | // Trp
|
||
1992 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Trp']) |
||
1993 | then
|
||
1994 | begin
|
||
1995 | ClientDataSetIngredientsTrp.Clear; |
||
1996 | ClientDataSetIngredientsTrp_MAT.Clear; |
||
1997 | ClientDataSetIngredientsdTrp.Clear; |
||
1998 | ClientDataSetIngredientsTrpd.Clear; |
||
1999 | end
|
||
2000 | else
|
||
2001 | begin
|
||
2002 | ClientDataSetIngredientsTrp.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Trp']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2003 | ClientDataSetIngredientsTrp_MAT.Value := InputAA(ClientDataSetIngredientsTrp.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2004 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dTrp']) |
||
2005 | then
|
||
2006 | ClientDataSetIngredientsdTrp.Value := dTrp * 100
|
||
2007 | else
|
||
2008 | ClientDataSetIngredientsdTrp.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dTrp']) * 100; |
||
2009 | ClientDataSetIngredientsTrpd.Value := ClientDataSetIngredientsdTrp.Value * ClientDataSetIngredientsTrp.Value / 100;
|
||
2010 | end;
|
||
2011 | // Ile
|
||
2012 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Ile']) |
||
2013 | then
|
||
2014 | begin
|
||
2015 | ClientDataSetIngredientsIle.Clear; |
||
2016 | ClientDataSetIngredientsIle_MAT.Clear; |
||
2017 | ClientDataSetIngredientsdIle.Clear; |
||
2018 | ClientDataSetIngredientsIled.Clear; |
||
2019 | end
|
||
2020 | else
|
||
2021 | begin
|
||
2022 | ClientDataSetIngredientsIle.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Ile']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2023 | ClientDataSetIngredientsIle_MAT.Value := InputAA(ClientDataSetIngredientsIle.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2024 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dIle']) |
||
2025 | then
|
||
2026 | ClientDataSetIngredientsdIle.Value := dIle * 100
|
||
2027 | else
|
||
2028 | ClientDataSetIngredientsdIle.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dIle']) * 100; |
||
2029 | ClientDataSetIngredientsIled.Value := ClientDataSetIngredientsdIle.Value * ClientDataSetIngredientsIle.Value / 100;
|
||
2030 | end;
|
||
2031 | // Val
|
||
2032 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Val']) |
||
2033 | then
|
||
2034 | begin
|
||
2035 | ClientDataSetIngredientsVal.Clear; |
||
2036 | ClientDataSetIngredientsVal_MAT.Clear; |
||
2037 | ClientDataSetIngredientsdVal.Clear; |
||
2038 | ClientDataSetIngredientsVald.Clear; |
||
2039 | end
|
||
2040 | else
|
||
2041 | begin
|
||
2042 | ClientDataSetIngredientsVal.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Val']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2043 | ClientDataSetIngredientsVal_MAT.Value := InputAA(ClientDataSetIngredientsVal.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2044 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dVal']) |
||
2045 | then
|
||
2046 | ClientDataSetIngredientsdVal.Value := dVal * 100
|
||
2047 | else
|
||
2048 | ClientDataSetIngredientsdVal.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dVal']) * 100; |
||
2049 | ClientDataSetIngredientsVald.Value := ClientDataSetIngredientsdVal.Value * ClientDataSetIngredientsVal.Value / 100;
|
||
2050 | end;
|
||
2051 | // Leu
|
||
2052 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Leu']) |
||
2053 | then
|
||
2054 | begin
|
||
2055 | ClientDataSetIngredientsLeu.Clear; |
||
2056 | ClientDataSetIngredientsLeu_MAT.Clear; |
||
2057 | ClientDataSetIngredientsdLeu.Clear; |
||
2058 | ClientDataSetIngredientsLeud.Clear; |
||
2059 | end
|
||
2060 | else
|
||
2061 | begin
|
||
2062 | ClientDataSetIngredientsLeu.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Leu']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2063 | ClientDataSetIngredientsLeu_MAT.Value := InputAA(ClientDataSetIngredientsLeu.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2064 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dLeu']) |
||
2065 | then
|
||
2066 | ClientDataSetIngredientsdLeu.Value := dLeu * 100
|
||
2067 | else
|
||
2068 | ClientDataSetIngredientsdLeu.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dLeu']) * 100; |
||
2069 | ClientDataSetIngredientsLeud.Value := ClientDataSetIngredientsdLeu.Value * ClientDataSetIngredientsLeu.Value / 100;
|
||
2070 | end;
|
||
2071 | // Phe
|
||
2072 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Phe']) |
||
2073 | then
|
||
2074 | begin
|
||
2075 | ClientDataSetIngredientsPhe.Clear; |
||
2076 | ClientDataSetIngredientsPhe_MAT.Clear; |
||
2077 | ClientDataSetIngredientsdPhe.Clear; |
||
2078 | ClientDataSetIngredientsPhed.Clear; |
||
2079 | end
|
||
2080 | else
|
||
2081 | begin
|
||
2082 | ClientDataSetIngredientsPhe.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Phe']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2083 | ClientDataSetIngredientsPhe_MAT.Value := InputAA(ClientDataSetIngredientsPhe.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2084 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dPhe']) |
||
2085 | then
|
||
2086 | ClientDataSetIngredientsdPhe.Value := dPhe * 100
|
||
2087 | else
|
||
2088 | ClientDataSetIngredientsdPhe.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dPhe']) * 100; |
||
2089 | ClientDataSetIngredientsPhed.Value := ClientDataSetIngredientsdPhe.Value * ClientDataSetIngredientsPhe.Value / 100;
|
||
2090 | end;
|
||
2091 | // Tyr
|
||
2092 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Tyr']) |
||
2093 | then
|
||
2094 | begin
|
||
2095 | ClientDataSetIngredientsTyr.Clear; |
||
2096 | ClientDataSetIngredientsTyr_MAT.Clear; |
||
2097 | ClientDataSetIngredientsdTyr.Clear; |
||
2098 | ClientDataSetIngredientsTyrd.Clear; |
||
2099 | end
|
||
2100 | else
|
||
2101 | begin
|
||
2102 | ClientDataSetIngredientsTyr.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Tyr']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2103 | ClientDataSetIngredientsTyr_MAT.Value := InputAA(ClientDataSetIngredientsTyr.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2104 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dTyr']) |
||
2105 | then
|
||
2106 | ClientDataSetIngredientsdTyr.Value := dTyr * 100
|
||
2107 | else
|
||
2108 | ClientDataSetIngredientsdTyr.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dTyr']) * 100; |
||
2109 | ClientDataSetIngredientsTyrd.Value := ClientDataSetIngredientsdTyr.Value * ClientDataSetIngredientsTyr.Value / 100;
|
||
2110 | end;
|
||
2111 | // Phe + Tyr
|
||
2112 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['PheTyr']) |
||
2113 | then
|
||
2114 | begin
|
||
2115 | ClientDataSetIngredientsPheTyr.Clear; |
||
2116 | ClientDataSetIngredientsPheTyr_MAT.Clear; |
||
2117 | ClientDataSetIngredientsdPheTyr.Clear; |
||
2118 | ClientDataSetIngredientsPheTyrd.Clear; |
||
2119 | end
|
||
2120 | else
|
||
2121 | begin
|
||
2122 | ClientDataSetIngredientsPheTyr.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['PheTyr']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2123 | ClientDataSetIngredientsPheTyr_MAT.Value := InputAA(ClientDataSetIngredientsPheTyr.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2124 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dPheTyr']) |
||
2125 | then
|
||
2126 | ClientDataSetIngredientsdPheTyr.Value := dPheTyr * 100
|
||
2127 | else
|
||
2128 | ClientDataSetIngredientsdPheTyr.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dPheTyr']) * 100; |
||
2129 | ClientDataSetIngredientsPheTyrd.Value := ClientDataSetIngredientsdPheTyr.Value * ClientDataSetIngredientsPheTyr.Value / 100;
|
||
2130 | end;
|
||
2131 | // His
|
||
2132 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['His']) |
||
2133 | then
|
||
2134 | begin
|
||
2135 | ClientDataSetIngredientsHis.Clear; |
||
2136 | ClientDataSetIngredientsHis_MAT.Clear; |
||
2137 | ClientDataSetIngredientsdHis.Clear; |
||
2138 | ClientDataSetIngredientsHisd.Clear; |
||
2139 | end
|
||
2140 | else
|
||
2141 | begin
|
||
2142 | ClientDataSetIngredientsHis.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['His']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2143 | ClientDataSetIngredientsHis_MAT.Value := InputAA(ClientDataSetIngredientsHis.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2144 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dHis']) |
||
2145 | then
|
||
2146 | ClientDataSetIngredientsdHis.Value := dHis * 100
|
||
2147 | else
|
||
2148 | ClientDataSetIngredientsdHis.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dHis']) * 100; |
||
2149 | ClientDataSetIngredientsHisd.Value := ClientDataSetIngredientsdHis.Value * ClientDataSetIngredientsHis.Value / 100;
|
||
2150 | end;
|
||
2151 | // Arg
|
||
2152 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Arg']) |
||
2153 | then
|
||
2154 | begin
|
||
2155 | ClientDataSetIngredientsArg.Clear; |
||
2156 | ClientDataSetIngredientsArg_MAT.Clear; |
||
2157 | ClientDataSetIngredientsdArg.Clear; |
||
2158 | ClientDataSetIngredientsArgd.Clear; |
||
2159 | end
|
||
2160 | else
|
||
2161 | begin
|
||
2162 | ClientDataSetIngredientsArg.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Arg']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2163 | ClientDataSetIngredientsArg_MAT.Value := InputAA(ClientDataSetIngredientsArg.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2164 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dArg']) |
||
2165 | then
|
||
2166 | ClientDataSetIngredientsdArg.Value := dArg * 100
|
||
2167 | else
|
||
2168 | ClientDataSetIngredientsdArg.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dArg']) * 100; |
||
2169 | ClientDataSetIngredientsArgd.Value := ClientDataSetIngredientsdArg.Value * ClientDataSetIngredientsArg.Value / 100;
|
||
2170 | end;
|
||
2171 | // Ala
|
||
2172 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Ala']) |
||
2173 | then
|
||
2174 | begin
|
||
2175 | ClientDataSetIngredientsAla.Clear; |
||
2176 | ClientDataSetIngredientsAla_MAT.Clear; |
||
2177 | ClientDataSetIngredientsdAla.Clear; |
||
2178 | ClientDataSetIngredientsAlad.Clear; |
||
2179 | end
|
||
2180 | else
|
||
2181 | begin
|
||
2182 | ClientDataSetIngredientsAla.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Ala']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2183 | ClientDataSetIngredientsAla_MAT.Value := InputAA(ClientDataSetIngredientsAla.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2184 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dAla']) |
||
2185 | then
|
||
2186 | ClientDataSetIngredientsdAla.Value := dAla * 100
|
||
2187 | else
|
||
2188 | ClientDataSetIngredientsdAla.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dAla']) * 100; |
||
2189 | ClientDataSetIngredientsAlad.Value := ClientDataSetIngredientsdAla.Value * ClientDataSetIngredientsAla.Value / 100;
|
||
2190 | end;
|
||
2191 | // Asp
|
||
2192 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Asp']) |
||
2193 | then
|
||
2194 | begin
|
||
2195 | ClientDataSetIngredientsAsp.Clear; |
||
2196 | ClientDataSetIngredientsAsp_MAT.Clear; |
||
2197 | ClientDataSetIngredientsdAsp.Clear; |
||
2198 | ClientDataSetIngredientsAspd.Clear; |
||
2199 | end
|
||
2200 | else
|
||
2201 | begin
|
||
2202 | ClientDataSetIngredientsAsp.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Asp']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2203 | ClientDataSetIngredientsAsp_MAT.Value := InputAA(ClientDataSetIngredientsAsp.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2204 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dAsp']) |
||
2205 | then
|
||
2206 | ClientDataSetIngredientsdAsp.Value := dAsp * 100
|
||
2207 | else
|
||
2208 | ClientDataSetIngredientsdAsp.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dAsp']) * 100; |
||
2209 | ClientDataSetIngredientsAspd.Value := ClientDataSetIngredientsdAsp.Value * ClientDataSetIngredientsAsp.Value / 100;
|
||
2210 | end;
|
||
2211 | // Glu
|
||
2212 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Glu']) |
||
2213 | then
|
||
2214 | begin
|
||
2215 | ClientDataSetIngredientsGlu.Clear; |
||
2216 | ClientDataSetIngredientsGlu_MAT.Clear; |
||
2217 | ClientDataSetIngredientsdGlu.Clear; |
||
2218 | ClientDataSetIngredientsGlud.Clear; |
||
2219 | end
|
||
2220 | else
|
||
2221 | begin
|
||
2222 | ClientDataSetIngredientsGlu.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Glu']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2223 | ClientDataSetIngredientsGlu_MAT.Value := InputAA(ClientDataSetIngredientsGlu.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2224 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dGlu']) |
||
2225 | then
|
||
2226 | ClientDataSetIngredientsdGlu.Value := dGlu * 100
|
||
2227 | else
|
||
2228 | ClientDataSetIngredientsdGlu.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dGlu']) * 100; |
||
2229 | ClientDataSetIngredientsGlud.Value := ClientDataSetIngredientsdGlu.Value * ClientDataSetIngredientsGlu.Value / 100;
|
||
2230 | end;
|
||
2231 | // Gly
|
||
2232 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Gly']) |
||
2233 | then
|
||
2234 | begin
|
||
2235 | ClientDataSetIngredientsGly.Clear; |
||
2236 | ClientDataSetIngredientsGly_MAT.Clear; |
||
2237 | ClientDataSetIngredientsdGly.Clear; |
||
2238 | ClientDataSetIngredientsGlyd.Clear; |
||
2239 | end
|
||
2240 | else
|
||
2241 | begin
|
||
2242 | ClientDataSetIngredientsGly.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Gly']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2243 | ClientDataSetIngredientsGly_MAT.Value := InputAA(ClientDataSetIngredientsGly.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2244 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dGly']) |
||
2245 | then
|
||
2246 | ClientDataSetIngredientsdGly.Value := dGly * 100
|
||
2247 | else
|
||
2248 | ClientDataSetIngredientsdGly.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dGly']) * 100; |
||
2249 | ClientDataSetIngredientsGlyd.Value := ClientDataSetIngredientsdGly.Value * ClientDataSetIngredientsGly.Value / 100;
|
||
2250 | end;
|
||
2251 | // Ser
|
||
2252 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Ser']) |
||
2253 | then
|
||
2254 | begin
|
||
2255 | ClientDataSetIngredientsSer.Clear; |
||
2256 | ClientDataSetIngredientsSer_MAT.Clear; |
||
2257 | ClientDataSetIngredientsdSer.Clear; |
||
2258 | ClientDataSetIngredientsSerd.Clear; |
||
2259 | end
|
||
2260 | else
|
||
2261 | begin
|
||
2262 | ClientDataSetIngredientsSer.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Ser']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2263 | ClientDataSetIngredientsSer_MAT.Value := InputAA(ClientDataSetIngredientsSer.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2264 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dSer']) |
||
2265 | then
|
||
2266 | ClientDataSetIngredientsdSer.Value := dSer * 100
|
||
2267 | else
|
||
2268 | ClientDataSetIngredientsdSer.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dSer']) * 100; |
||
2269 | ClientDataSetIngredientsSerd.Value := ClientDataSetIngredientsdSer.Value * ClientDataSetIngredientsSer.Value / 100;
|
||
2270 | end;
|
||
2271 | // Pro
|
||
2272 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Pro']) |
||
2273 | then
|
||
2274 | begin
|
||
2275 | ClientDataSetIngredientsPro.Clear; |
||
2276 | ClientDataSetIngredientsPro_MAT.Clear; |
||
2277 | ClientDataSetIngredientsdPro.Clear; |
||
2278 | ClientDataSetIngredientsProd.Clear; |
||
2279 | end
|
||
2280 | else
|
||
2281 | begin
|
||
2282 | ClientDataSetIngredientsPro.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Pro']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2283 | ClientDataSetIngredientsPro_MAT.Value := InputAA(ClientDataSetIngredientsPro.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2284 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dPro']) |
||
2285 | then
|
||
2286 | ClientDataSetIngredientsdPro.Value := dPro * 100
|
||
2287 | else
|
||
2288 | ClientDataSetIngredientsdPro.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dPro']) * 100; |
||
2289 | ClientDataSetIngredientsProd.Value := ClientDataSetIngredientsdPro.Value * ClientDataSetIngredientsPro.Value / 100;
|
||
2290 | end;
|
||
2291 | end;
|
||
2292 | // Min?raux
|
||
2293 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Ca']) |
||
2294 | then
|
||
2295 | ClientDataSetIngredientsCa.Clear |
||
2296 | else
|
||
2297 | ClientDataSetIngredientsCa.Value := OutputMinerals(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Ca']), RapMS, FormOptions.Expression, FormOptions.Minerals);
|
||
2298 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['P']) |
||
2299 | then
|
||
2300 | ClientDataSetIngredientsP.Clear |
||
2301 | else
|
||
2302 | ClientDataSetIngredientsP.Value := OutputMinerals(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['P']), RapMS, FormOptions.Expression, FormOptions.Minerals);
|
||
2303 | 3 | avalancogn | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Na']) |
2304 | then
|
||
2305 | ClientDataSetIngredientsNa.Clear |
||
2306 | else
|
||
2307 | ClientDataSetIngredientsNa.Value := OutputMinerals(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Na']), RapMS, FormOptions.Expression, FormOptions.Minerals);
|
||
2308 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['K']) |
||
2309 | then
|
||
2310 | ClientDataSetIngredientsK.Clear |
||
2311 | else
|
||
2312 | ClientDataSetIngredientsK.Value := OutputMinerals(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['K']), RapMS, FormOptions.Expression, FormOptions.Minerals);
|
||
2313 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Cl']) |
||
2314 | then
|
||
2315 | ClientDataSetIngredientsCl.Clear |
||
2316 | else
|
||
2317 | ClientDataSetIngredientsCl.Value := OutputMinerals(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Cl']), RapMS, FormOptions.Expression, FormOptions.Minerals);
|
||
2318 | if ClientDataSetIngredientsNa.IsNull or ClientDataSetIngredientsK.IsNull or ClientDataSetIngredientsCl.IsNull |
||
2319 | then
|
||
2320 | ClientDataSetIngredientsBE.Clear |
||
2321 | else
|
||
2322 | ClientDataSetIngredientsBE.Value := CalcBilanElectrolytique(InputMinerals(ClientDataSetIngredientsNa.Value, RapMS, FormOptions.Expression, FormOptions.Minerals), InputMinerals(ClientDataSetIngredientsK.Value, RapMS, FormOptions.Expression, FormOptions.Minerals), InputMinerals(ClientDataSetIngredientsCl.Value, RapMS, FormOptions.Expression, FormOptions.Minerals)); |
||
2323 | 1 | avalancogn | if ClientDataSetIngredientsP.Value = 0 |
2324 | then // En l'absence de P, il n'y a pas de dP |
||
2325 | begin
|
||
2326 | ClientDataSetIngredientsdP.Clear; |
||
2327 | ClientDataSetIngredientsdPphy.Clear; |
||
2328 | end
|
||
2329 | else
|
||
2330 | begin
|
||
2331 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dP']) |
||
2332 | then // Par d?faut dP = 20% |
||
2333 | ClientDataSetIngredientsdP.Value := 20
|
||
2334 | else
|
||
2335 | ClientDataSetIngredientsdP.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dP']) * 100; |
||
2336 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dPphy']) |
||
2337 | then // Par d?faut dPphy = dP |
||
2338 | ClientDataSetIngredientsdPphy.Value := ClientDataSetIngredientsdP.Value |
||
2339 | else
|
||
2340 | ClientDataSetIngredientsdPphy.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dPphy']) * 100; |
||
2341 | end;
|
||
2342 | // Autres rapports
|
||
2343 | if ClientDataSetIngredientsLysd.IsNull or ClientDataSetIngredientsENc.IsNull or (ClientDataSetIngredientsENc.Value = 0) |
||
2344 | then
|
||
2345 | ClientDataSetIngredientsLysd_ENc.Clear |
||
2346 | else
|
||
2347 | if FormOptions.Energy = 0 |
||
2348 | then // g / MJ |
||
2349 | if FormOptions.AA = 0 |
||
2350 | then // % (conversion) |
||
2351 | ClientDataSetIngredientsLysd_ENc.Value := ClientDataSetIngredientsLysd.Value / 100 * 1000 / ClientDataSetIngredientsENc.Value |
||
2352 | else // g/kg |
||
2353 | ClientDataSetIngredientsLysd_ENc.Value := ClientDataSetIngredientsLysd.Value / ClientDataSetIngredientsENc.Value |
||
2354 | else // g / 1000 kcal |
||
2355 | if FormOptions.AA = 0 |
||
2356 | then // % (conversion) |
||
2357 | ClientDataSetIngredientsLysd_ENc.Value := ClientDataSetIngredientsLysd.Value / 100 * 1000 / ClientDataSetIngredientsENc.Value * 1000 |
||
2358 | else // g/kg |
||
2359 | ClientDataSetIngredientsLysd_ENc.Value := ClientDataSetIngredientsLysd.Value / ClientDataSetIngredientsENc.Value * 1000;
|
||
2360 | if ClientDataSetIngredientsLysd.IsNull or ClientDataSetIngredientsENt.IsNull or (ClientDataSetIngredientsENt.Value = 0) |
||
2361 | then
|
||
2362 | ClientDataSetIngredientsLysd_ENt.Clear |
||
2363 | else
|
||
2364 | if FormOptions.Energy = 0 |
||
2365 | then // g / MJ |
||
2366 | if FormOptions.AA = 0 |
||
2367 | then // % (conversion) |
||
2368 | ClientDataSetIngredientsLysd_ENt.Value := ClientDataSetIngredientsLysd.Value / 100 * 1000 / ClientDataSetIngredientsENt.Value |
||
2369 | else // g/kg |
||
2370 | ClientDataSetIngredientsLysd_ENt.Value := ClientDataSetIngredientsLysd.Value / ClientDataSetIngredientsENt.Value |
||
2371 | else // g / 1000 kcal |
||
2372 | if FormOptions.AA = 0 |
||
2373 | then // % (conversion) |
||
2374 | ClientDataSetIngredientsLysd_ENt.Value := ClientDataSetIngredientsLysd.Value / 100 * 1000 / ClientDataSetIngredientsENt.Value * 1000 |
||
2375 | else // g/kg |
||
2376 | ClientDataSetIngredientsLysd_ENt.Value := ClientDataSetIngredientsLysd.Value / ClientDataSetIngredientsENt.Value * 1000;
|
||
2377 | end;
|
||
2378 | |||
2379 | procedure TDataModuleDeclaration.CalcCopy;
|
||
2380 | // Renseigner l'enregistrement courant de ClientDataSetIngredients
|
||
2381 | // ? partir de l'enregistrement courant de TableIngredients
|
||
2382 | // en tenant compte des unit?s configur?es
|
||
2383 | var
|
||
2384 | Nb: Integer; |
||
2385 | Bonus, EB, dE, EDc, EDt, EM, EM_ED, EN_EM, dN: Double; |
||
2386 | CorrMAT, CorrMG, CorrMM, CorrCB, CorrNDF, CorrADF, DiffMAT, DiffMG, DiffAmidon: Double; |
||
2387 | begin
|
||
2388 | // Analyse proximale
|
||
2389 | RapMS := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MS']);
|
||
2390 | ClientDataSetIngredientsMS.Value := OutputProximal(RapMS, 1, 1, FormOptions.Proximal); |
||
2391 | ClientDataSetIngredientsMS2.Value := OutputProximal(1, RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
2392 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MM']) |
||
2393 | then
|
||
2394 | if ClientDataSetInraAfzMM.IsNull
|
||
2395 | then
|
||
2396 | ClientDataSetIngredientsMM.Clear |
||
2397 | else
|
||
2398 | ClientDataSetIngredientsMM.Value := OutputProximal(ClientDataSetInraAfzMM.Value, RapMS, FormOptions.Expression, FormOptions.Proximal) |
||
2399 | else
|
||
2400 | ClientDataSetIngredientsMM.Value := OutputProximal(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MM']), RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
2401 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MAT']) |
||
2402 | then
|
||
2403 | if ClientDataSetInraAfzMAT.IsNull
|
||
2404 | then
|
||
2405 | ClientDataSetIngredientsMAT.Clear |
||
2406 | else
|
||
2407 | begin
|
||
2408 | RapMAT := ClientDataSetInraAfzMAT.Value; |
||
2409 | ClientDataSetIngredientsMAT.Value := OutputProximal(RapMAT, RapMS, FormOptions.Expression, FormOptions.Proximal); |
||
2410 | end
|
||
2411 | else
|
||
2412 | begin
|
||
2413 | RapMAT := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']);
|
||
2414 | ClientDataSetIngredientsMAT.Value := OutputProximal(RapMAT, RapMS, FormOptions.Expression, FormOptions.Proximal); |
||
2415 | end;
|
||
2416 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MG']) |
||
2417 | then
|
||
2418 | if ClientDataSetInraAfzMG.IsNull
|
||
2419 | then
|
||
2420 | ClientDataSetIngredientsMG.Clear |
||
2421 | else
|
||
2422 | ClientDataSetIngredientsMG.Value := OutputProximal(ClientDataSetInraAfzMG.Value, RapMS, FormOptions.Expression, FormOptions.Proximal) |
||
2423 | else
|
||
2424 | ClientDataSetIngredientsMG.Value := OutputProximal(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']), RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
2425 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['CB']) |
||
2426 | then
|
||
2427 | if ClientDataSetInraAfzCB.IsNull
|
||
2428 | then
|
||
2429 | ClientDataSetIngredientsCB.Clear |
||
2430 | else
|
||
2431 | ClientDataSetIngredientsCB.Value := OutputProximal(ClientDataSetInraAfzCB.Value, RapMS, FormOptions.Expression, FormOptions.Proximal) |
||
2432 | else
|
||
2433 | ClientDataSetIngredientsCB.Value := OutputProximal(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['CB']), RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
2434 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['NDF']) |
||
2435 | then
|
||
2436 | if ClientDataSetInraAfzNDF.IsNull
|
||
2437 | then
|
||
2438 | ClientDataSetIngredientsNDF.Clear |
||
2439 | else
|
||
2440 | ClientDataSetIngredientsNDF.Value := OutputProximal(ClientDataSetInraAfzNDF.Value, RapMS, FormOptions.Expression, FormOptions.Proximal) |
||
2441 | else
|
||
2442 | ClientDataSetIngredientsNDF.Value := OutputProximal(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['NDF']), RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
2443 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['ADF']) |
||
2444 | then
|
||
2445 | if ClientDataSetInraAfzADF.IsNull
|
||
2446 | then
|
||
2447 | ClientDataSetIngredientsADF.Clear |
||
2448 | else
|
||
2449 | ClientDataSetIngredientsADF.Value := OutputProximal(ClientDataSetInraAfzADF.Value, RapMS, FormOptions.Expression, FormOptions.Proximal) |
||
2450 | else
|
||
2451 | ClientDataSetIngredientsADF.Value := OutputProximal(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['ADF']), RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
2452 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['ADL']) |
||
2453 | then
|
||
2454 | if ClientDataSetInraAfzADL.IsNull
|
||
2455 | then
|
||
2456 | ClientDataSetIngredientsADL.Clear |
||
2457 | else
|
||
2458 | ClientDataSetIngredientsADL.Value := OutputProximal(ClientDataSetInraAfzADL.Value, RapMS, FormOptions.Expression, FormOptions.Proximal) |
||
2459 | else
|
||
2460 | ClientDataSetIngredientsADL.Value := OutputProximal(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['ADL']), RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
2461 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Amidon']) |
||
2462 | then
|
||
2463 | if ClientDataSetInraAfzAmidon.IsNull
|
||
2464 | then
|
||
2465 | ClientDataSetIngredientsAmidon.Clear |
||
2466 | else
|
||
2467 | ClientDataSetIngredientsAmidon.Value := OutputProximal(ClientDataSetInraAfzAmidon.Value, RapMS, FormOptions.Expression, FormOptions.Proximal) |
||
2468 | else
|
||
2469 | ClientDataSetIngredientsAmidon.Value := OutputProximal(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Amidon']), RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
2470 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Sucres']) |
||
2471 | then
|
||
2472 | if ClientDataSetInraAfzSucres.IsNull
|
||
2473 | then
|
||
2474 | ClientDataSetIngredientsSucres.Clear |
||
2475 | else
|
||
2476 | ClientDataSetIngredientsSucres.Value := OutputProximal(ClientDataSetInraAfzSucres.Value, RapMS, FormOptions.Expression, FormOptions.Proximal) |
||
2477 | else
|
||
2478 | ClientDataSetIngredientsSucres.Value := OutputProximal(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Sucres']), RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
2479 | // Energie -> Valeurs calcul?es
|
||
2480 | EB := ClientDataSetInraAfzEB.Value; |
||
2481 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MAT']) |
||
2482 | then
|
||
2483 | CorrMAT := 0
|
||
2484 | else
|
||
2485 | CorrMAT := CoefMAT * (TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) - ClientDataSetInraAfzMAT.Value);
|
||
2486 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MG']) |
||
2487 | then
|
||
2488 | CorrMG := 0
|
||
2489 | else
|
||
2490 | CorrMG := CoefMG * (TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) - ClientDataSetInraAfzMG.Value);
|
||
2491 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MM']) |
||
2492 | then
|
||
2493 | CorrMM := 0
|
||
2494 | else
|
||
2495 | CorrMM := CoefMM * (TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MM']) - ClientDataSetInraAfzMM.Value);
|
||
2496 | // Correction : somme des corrections (born?e ? 0)
|
||
2497 | EB := Max(0, EB + CorrMAT + CorrMG + CorrMM);
|
||
2498 | ClientDataSetIngredientsEB.Value := OutputEnergy(EB, RapMS, FormOptions.Expression, FormOptions.Energy); |
||
2499 | Bonus := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Bonus']) * 100; |
||
2500 | ClientDataSetIngredientsBonus.Value := Bonus; |
||
2501 | dE := ClientDataSetInraAfzdEc.Value * 100 + Bonus;
|
||
2502 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['CB']) |
||
2503 | then
|
||
2504 | CorrCB := 0
|
||
2505 | else
|
||
2506 | CorrCB := ClientDataSetInraAfzCoefCB.Value * (TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['CB']) - ClientDataSetInraAfzCB.Value) * 100; |
||
2507 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['NDF']) |
||
2508 | then
|
||
2509 | CorrNDF := 0
|
||
2510 | else
|
||
2511 | CorrNDF := ClientDataSetInraAfzCoefNDF.Value * (TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['NDF']) - ClientDataSetInraAfzNDF.Value) * 100; |
||
2512 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['ADF']) |
||
2513 | then
|
||
2514 | CorrADF := 0
|
||
2515 | else
|
||
2516 | CorrADF := ClientDataSetInraAfzCoefADF.Value * (TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['ADF']) - ClientDataSetInraAfzADF.Value) * 100; |
||
2517 | Nb := 0;
|
||
2518 | if CorrCB <> 0 then Inc(Nb); |
||
2519 | if CorrNDF <> 0 then Inc(Nb); |
||
2520 | if CorrADF <> 0 then Inc(Nb); |
||
2521 | if Nb > 0 |
||
2522 | then // Correction : moyenne des ?quations significatives (born?e ? 0) |
||
2523 | dE := Max(0, dE + (CorrCB + CorrNDF + CorrADF) / Nb);
|
||
2524 | ClientDataSetIngredientsdEc.Value := dE; |
||
2525 | EDc := EB * dE / 100;
|
||
2526 | ClientDataSetIngredientsEDc.Value := OutputEnergy(EDc, RapMS, FormOptions.Expression, FormOptions.Energy); |
||
2527 | if EDc = 0 |
||
2528 | then // Division par 0 |
||
2529 | begin
|
||
2530 | ClientDataSetIngredientsEMc_EDc.Value := 0;
|
||
2531 | ClientDataSetIngredientsEMc.Value := 0;
|
||
2532 | EM := 0;
|
||
2533 | end
|
||
2534 | else
|
||
2535 | begin
|
||
2536 | EM_ED := ClientDataSetInraAfzEMc_EDc.Value; |
||
2537 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MAT']) |
||
2538 | then
|
||
2539 | DiffMAT := 0
|
||
2540 | else
|
||
2541 | DiffMAT := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) - ClientDataSetInraAfzMAT.Value;
|
||
2542 | if DiffMAT <> 0 |
||
2543 | then // Correction : variation de l'azote |
||
2544 | EM_ED := EM_ED - 31.0 * 0.4 * DiffMAT / 6.25 / EDc; |
||
2545 | ClientDataSetIngredientsEMc_EDc.Value := EM_ED * 100;
|
||
2546 | EM := EDc * EM_ED; |
||
2547 | ClientDataSetIngredientsEMc.Value := OutputEnergy(EM, RapMS, FormOptions.Expression, FormOptions.Energy); |
||
2548 | end;
|
||
2549 | if EM = 0 |
||
2550 | then // Division par 0 |
||
2551 | begin
|
||
2552 | ClientDataSetIngredientsENc_EMc.Value := 0;
|
||
2553 | ClientDataSetIngredientsENc.Value := 0;
|
||
2554 | end
|
||
2555 | else
|
||
2556 | begin
|
||
2557 | EN_EM := ClientDataSetInraAfzENc_EMc.Value; |
||
2558 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MAT']) |
||
2559 | then
|
||
2560 | DiffMAT := 0
|
||
2561 | else
|
||
2562 | DiffMAT := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) - ClientDataSetInraAfzMAT.Value;
|
||
2563 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MG']) |
||
2564 | then
|
||
2565 | DiffMG := 0
|
||
2566 | else
|
||
2567 | DiffMG := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) - ClientDataSetInraAfzMG.Value;
|
||
2568 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Amidon']) |
||
2569 | then
|
||
2570 | DiffAmidon := 0
|
||
2571 | else
|
||
2572 | DiffAmidon := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Amidon']) - ClientDataSetInraAfzAmidon.Value;
|
||
2573 | if (DiffMAT <> 0) or (DiffMG <> 0) or (DiffAmidon <> 0) |
||
2574 | then // Correction : variation MAT et/ou MG et/ou Amidon |
||
2575 | EN_EM := EN_EM + (-2.8 * DiffMAT + 5.5 * DiffMG + 1.5 * DiffAmidon) / EM; |
||
2576 | ClientDataSetIngredientsENc_EMc.Value := EN_EM * 100;
|
||
2577 | ClientDataSetIngredientsENc.Value := OutputEnergy(EM * EN_EM, RapMS, FormOptions.Expression, FormOptions.Energy); |
||
2578 | end;
|
||
2579 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MM']) |
||
2580 | then
|
||
2581 | EDt := EDc + ClientDataSetInraAfza.Value * CALORIE * (1 - ClientDataSetInraAfzMM.Value) * (1 - ClientDataSetInraAfzb.Value * dE / 100) |
||
2582 | else
|
||
2583 | EDt := EDc + ClientDataSetInraAfza.Value * CALORIE * (1 - TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MM'])) * (1 - ClientDataSetInraAfzb.Value * dE / 100); |
||
2584 | ClientDataSetIngredientsEDt.Value := OutputEnergy(EDt, RapMS, FormOptions.Expression, FormOptions.Energy); |
||
2585 | if EDc = 0 |
||
2586 | then // Division par 0 |
||
2587 | ClientDataSetIngredientsEDt_EDc.Value := 100
|
||
2588 | else
|
||
2589 | ClientDataSetIngredientsEDt_EDc.Value := EDt / EDc * 100;
|
||
2590 | if EDt = 0 |
||
2591 | then // Division par 0 |
||
2592 | begin
|
||
2593 | ClientDataSetIngredientsEMt_EDt.Value := 0;
|
||
2594 | ClientDataSetIngredientsEMt.Value := 0;
|
||
2595 | EM := 0;
|
||
2596 | end
|
||
2597 | else
|
||
2598 | begin
|
||
2599 | EM_ED := ClientDataSetInraAfzEMt_EDt.Value; |
||
2600 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MAT']) |
||
2601 | then
|
||
2602 | DiffMAT := 0
|
||
2603 | else
|
||
2604 | DiffMAT := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) - ClientDataSetInraAfzMAT.Value;
|
||
2605 | if DiffMAT <> 0 |
||
2606 | then // Correction : variation de l'azote |
||
2607 | EM_ED := EM_ED - 31.0 * 0.4 * DiffMAT / 6.25 / EDt; |
||
2608 | ClientDataSetIngredientsEMt_EDt.Value := EM_ED * 100;
|
||
2609 | EM := EDt * EM_ED; |
||
2610 | ClientDataSetIngredientsEMt.Value := OutputEnergy(EM, RapMS, FormOptions.Expression, FormOptions.Energy); |
||
2611 | end;
|
||
2612 | if EM = 0 |
||
2613 | then // Division par 0 |
||
2614 | begin
|
||
2615 | ClientDataSetIngredientsENt_EMt.Value := 0;
|
||
2616 | ClientDataSetIngredientsENt.Value := 0;
|
||
2617 | end
|
||
2618 | else
|
||
2619 | begin
|
||
2620 | EN_EM := ClientDataSetInraAfzENt_EMt.Value; |
||
2621 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MAT']) |
||
2622 | then
|
||
2623 | DiffMAT := 0
|
||
2624 | else
|
||
2625 | DiffMAT := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) - ClientDataSetInraAfzMAT.Value;
|
||
2626 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MG']) |
||
2627 | then
|
||
2628 | DiffMG := 0
|
||
2629 | else
|
||
2630 | DiffMG := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MG']) - ClientDataSetInraAfzMG.Value;
|
||
2631 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Amidon']) |
||
2632 | then
|
||
2633 | DiffAmidon := 0
|
||
2634 | else
|
||
2635 | DiffAmidon := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Amidon']) - ClientDataSetInraAfzAmidon.Value;
|
||
2636 | if (DiffMAT <> 0) or (DiffMG <> 0) or (DiffAmidon <> 0) |
||
2637 | then // Correction : variation MAT et/ou MG et/ou Amidon |
||
2638 | EN_EM := EN_EM + (-2.8 * DiffMAT + 5.5 * DiffMG + 1.5 * DiffAmidon) / EM; |
||
2639 | ClientDataSetIngredientsENt_EMt.Value := EN_EM * 100;
|
||
2640 | ClientDataSetIngredientsENt.Value := OutputEnergy(EM * EN_EM, RapMS, FormOptions.Expression, FormOptions.Energy); |
||
2641 | end;
|
||
2642 | if ClientDataSetIngredientsEB.Value = 0 |
||
2643 | then
|
||
2644 | ClientDataSetIngredientsdEt.Value := ClientDataSetIngredientsdEc.Value |
||
2645 | else
|
||
2646 | ClientDataSetIngredientsdEt.Value := ClientDataSetIngredientsEDt.Value / ClientDataSetIngredientsEB.Value * 100;
|
||
2647 | if ClientDataSetIngredientsEMc.Value = 0 |
||
2648 | then
|
||
2649 | ClientDataSetIngredientsEMt_EMc.Value := 100
|
||
2650 | else
|
||
2651 | ClientDataSetIngredientsEMt_EMc.Value := ClientDataSetIngredientsEMt.Value / ClientDataSetIngredientsEMc.Value * 100;
|
||
2652 | if ClientDataSetIngredientsENc.Value = 0 |
||
2653 | then
|
||
2654 | ClientDataSetIngredientsENt_ENc.Value := 100
|
||
2655 | else
|
||
2656 | ClientDataSetIngredientsENt_ENc.Value := ClientDataSetIngredientsENt.Value / ClientDataSetIngredientsENc.Value * 100;
|
||
2657 | // Digestibilit? f?cale de l'azote
|
||
2658 | if ClientDataSetInraAfzdNc.IsNull
|
||
2659 | then
|
||
2660 | ClientDataSetIngredientsdNc.Clear |
||
2661 | else
|
||
2662 | begin
|
||
2663 | dN := ClientDataSetInraAfzdNc.Value * 100;
|
||
2664 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MAT']) |
||
2665 | then
|
||
2666 | DiffMAT := 0
|
||
2667 | else
|
||
2668 | DiffMAT := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) - ClientDataSetInraAfzMAT.Value;
|
||
2669 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['CB']) |
||
2670 | then
|
||
2671 | CorrCB := 0
|
||
2672 | else
|
||
2673 | CorrCB := 69.0 * DiffMAT - 122.0 * (TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['CB']) - ClientDataSetInraAfzCB.Value); |
||
2674 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['NDF']) |
||
2675 | then
|
||
2676 | CorrNDF := 0
|
||
2677 | else
|
||
2678 | CorrNDF := 79.0 * DiffMAT - 69.0 * (TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['NDF']) - ClientDataSetInraAfzNDF.Value); |
||
2679 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['ADF']) |
||
2680 | then
|
||
2681 | CorrADF := 0
|
||
2682 | else
|
||
2683 | CorrADF := 70.0 * DiffMAT - 116.0 * (TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['ADF']) - ClientDataSetInraAfzADF.Value); |
||
2684 | Nb := 0;
|
||
2685 | if CorrCB <> 0 then Inc(Nb); |
||
2686 | if CorrNDF <> 0 then Inc(Nb); |
||
2687 | if CorrADF <> 0 then Inc(Nb); |
||
2688 | if Nb > 0 |
||
2689 | then // Correction : moyenne des ?quations significatives |
||
2690 | dN := dN + (CorrCB + CorrNDF + CorrADF) / Nb; |
||
2691 | ClientDataSetIngredientsdNc.Value := dN; |
||
2692 | end;
|
||
2693 | if ClientDataSetInraAfzdNt.IsNull
|
||
2694 | then
|
||
2695 | ClientDataSetIngredientsdNt.Clear |
||
2696 | else
|
||
2697 | begin
|
||
2698 | dN := ClientDataSetInraAfzdNt.Value * 100;
|
||
2699 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MAT']) |
||
2700 | then
|
||
2701 | DiffMAT := 0
|
||
2702 | else
|
||
2703 | DiffMAT := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']) - ClientDataSetInraAfzMAT.Value;
|
||
2704 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['CB']) |
||
2705 | then
|
||
2706 | CorrCB := 0
|
||
2707 | else
|
||
2708 | CorrCB := 77.0 * DiffMAT - 87.0 * (TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['CB']) - ClientDataSetInraAfzCB.Value); |
||
2709 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['NDF']) |
||
2710 | then
|
||
2711 | CorrNDF := 0
|
||
2712 | else
|
||
2713 | CorrNDF := 86.0 * DiffMAT - 44.0 * (TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['NDF']) - ClientDataSetInraAfzNDF.Value); |
||
2714 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['ADF']) |
||
2715 | then
|
||
2716 | CorrADF := 0
|
||
2717 | else
|
||
2718 | CorrADF := 78.0 * DiffMAT - 83.0 * (TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['ADF']) - ClientDataSetInraAfzADF.Value); |
||
2719 | Nb := 0;
|
||
2720 | if CorrCB <> 0 then Inc(Nb); |
||
2721 | if CorrNDF <> 0 then Inc(Nb); |
||
2722 | if CorrADF <> 0 then Inc(Nb); |
||
2723 | if Nb > 0 |
||
2724 | then // Correction : moyenne des ?quations significatives |
||
2725 | dN := dN + (CorrCB + CorrNDF + CorrADF) / Nb; |
||
2726 | ClientDataSetIngredientsdNt.Value := dN; |
||
2727 | end;
|
||
2728 | // Acides amin?s
|
||
2729 | if RapMAT = 0 |
||
2730 | then // En l'absence de MAT, il n'y a pas d'acides amin?s |
||
2731 | begin
|
||
2732 | // Teneurs
|
||
2733 | ClientDataSetIngredientsLys.Clear; |
||
2734 | ClientDataSetIngredientsThr.Clear; |
||
2735 | ClientDataSetIngredientsMet.Clear; |
||
2736 | ClientDataSetIngredientsCys.Clear; |
||
2737 | ClientDataSetIngredientsMetCys.Clear; |
||
2738 | ClientDataSetIngredientsTrp.Clear; |
||
2739 | ClientDataSetIngredientsIle.Clear; |
||
2740 | ClientDataSetIngredientsVal.Clear; |
||
2741 | ClientDataSetIngredientsLeu.Clear; |
||
2742 | ClientDataSetIngredientsPhe.Clear; |
||
2743 | ClientDataSetIngredientsTyr.Clear; |
||
2744 | ClientDataSetIngredientsPheTyr.Clear; |
||
2745 | ClientDataSetIngredientsHis.Clear; |
||
2746 | ClientDataSetIngredientsArg.Clear; |
||
2747 | ClientDataSetIngredientsAla.Clear; |
||
2748 | ClientDataSetIngredientsAsp.Clear; |
||
2749 | ClientDataSetIngredientsGlu.Clear; |
||
2750 | ClientDataSetIngredientsGly.Clear; |
||
2751 | ClientDataSetIngredientsSer.Clear; |
||
2752 | ClientDataSetIngredientsPro.Clear; |
||
2753 | // % MAT
|
||
2754 | ClientDataSetIngredientsLys_MAT.Clear; |
||
2755 | ClientDataSetIngredientsThr_MAT.Clear; |
||
2756 | ClientDataSetIngredientsMet_MAT.Clear; |
||
2757 | ClientDataSetIngredientsCys_MAT.Clear; |
||
2758 | ClientDataSetIngredientsMetCys_MAT.Clear; |
||
2759 | ClientDataSetIngredientsTrp_MAT.Clear; |
||
2760 | ClientDataSetIngredientsIle_MAT.Clear; |
||
2761 | ClientDataSetIngredientsVal_MAT.Clear; |
||
2762 | ClientDataSetIngredientsLeu_MAT.Clear; |
||
2763 | ClientDataSetIngredientsPhe_MAT.Clear; |
||
2764 | ClientDataSetIngredientsTyr_MAT.Clear; |
||
2765 | ClientDataSetIngredientsPheTyr_MAT.Clear; |
||
2766 | ClientDataSetIngredientsHis_MAT.Clear; |
||
2767 | ClientDataSetIngredientsArg_MAT.Clear; |
||
2768 | ClientDataSetIngredientsAla_MAT.Clear; |
||
2769 | ClientDataSetIngredientsAsp_MAT.Clear; |
||
2770 | ClientDataSetIngredientsGlu_MAT.Clear; |
||
2771 | ClientDataSetIngredientsGly_MAT.Clear; |
||
2772 | ClientDataSetIngredientsSer_MAT.Clear; |
||
2773 | ClientDataSetIngredientsPro_MAT.Clear; |
||
2774 | // Digestibilit?s
|
||
2775 | ClientDataSetIngredientsdLys.Clear; |
||
2776 | ClientDataSetIngredientsdThr.Clear; |
||
2777 | ClientDataSetIngredientsdMet.Clear; |
||
2778 | ClientDataSetIngredientsdCys.Clear; |
||
2779 | ClientDataSetIngredientsdMetCys.Clear; |
||
2780 | ClientDataSetIngredientsdTrp.Clear; |
||
2781 | ClientDataSetIngredientsdIle.Clear; |
||
2782 | ClientDataSetIngredientsdVal.Clear; |
||
2783 | ClientDataSetIngredientsdLeu.Clear; |
||
2784 | ClientDataSetIngredientsdPhe.Clear; |
||
2785 | ClientDataSetIngredientsdTyr.Clear; |
||
2786 | ClientDataSetIngredientsdPheTyr.Clear; |
||
2787 | ClientDataSetIngredientsdHis.Clear; |
||
2788 | ClientDataSetIngredientsdArg.Clear; |
||
2789 | ClientDataSetIngredientsdAla.Clear; |
||
2790 | ClientDataSetIngredientsdAsp.Clear; |
||
2791 | ClientDataSetIngredientsdGlu.Clear; |
||
2792 | ClientDataSetIngredientsdGly.Clear; |
||
2793 | ClientDataSetIngredientsdSer.Clear; |
||
2794 | ClientDataSetIngredientsdPro.Clear; |
||
2795 | // Teneurs digestibles
|
||
2796 | ClientDataSetIngredientsLysd.Clear; |
||
2797 | ClientDataSetIngredientsThrd.Clear; |
||
2798 | ClientDataSetIngredientsMetd.Clear; |
||
2799 | ClientDataSetIngredientsCysd.Clear; |
||
2800 | ClientDataSetIngredientsMetCysd.Clear; |
||
2801 | ClientDataSetIngredientsTrpd.Clear; |
||
2802 | ClientDataSetIngredientsIled.Clear; |
||
2803 | ClientDataSetIngredientsVald.Clear; |
||
2804 | ClientDataSetIngredientsLeud.Clear; |
||
2805 | ClientDataSetIngredientsPhed.Clear; |
||
2806 | ClientDataSetIngredientsTyrd.Clear; |
||
2807 | ClientDataSetIngredientsPheTyrd.Clear; |
||
2808 | ClientDataSetIngredientsHisd.Clear; |
||
2809 | ClientDataSetIngredientsArgd.Clear; |
||
2810 | ClientDataSetIngredientsAlad.Clear; |
||
2811 | ClientDataSetIngredientsAspd.Clear; |
||
2812 | ClientDataSetIngredientsGlud.Clear; |
||
2813 | ClientDataSetIngredientsGlyd.Clear; |
||
2814 | ClientDataSetIngredientsSerd.Clear; |
||
2815 | ClientDataSetIngredientsProd.Clear; |
||
2816 | end
|
||
2817 | else
|
||
2818 | begin
|
||
2819 | // Lys
|
||
2820 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Lys']) |
||
2821 | and ClientDataSetInraAfzLys.IsNull
|
||
2822 | then
|
||
2823 | begin
|
||
2824 | ClientDataSetIngredientsLys.Clear; |
||
2825 | ClientDataSetIngredientsLys_MAT.Clear; |
||
2826 | ClientDataSetIngredientsdLys.Clear; |
||
2827 | ClientDataSetIngredientsLysd.Clear; |
||
2828 | end
|
||
2829 | else
|
||
2830 | begin
|
||
2831 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Lys']) |
||
2832 | then
|
||
2833 | ClientDataSetIngredientsLys.Value := OutputAA(ClientDataSetInraAfzLys.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
2834 | else
|
||
2835 | ClientDataSetIngredientsLys.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Lys']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2836 | ClientDataSetIngredientsLys_MAT.Value := InputAA(ClientDataSetIngredientsLys.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2837 | if ClientDataSetInraAfzdLys.IsNull
|
||
2838 | then
|
||
2839 | ClientDataSetIngredientsdLys.Value := dLys * 100
|
||
2840 | else
|
||
2841 | ClientDataSetIngredientsdLys.Value := ClientDataSetInraAfzdLys.Value * 100;
|
||
2842 | ClientDataSetIngredientsLysd.Value := ClientDataSetIngredientsdLys.Value / 100 * ClientDataSetIngredientsLys.Value;
|
||
2843 | end;
|
||
2844 | // Thr
|
||
2845 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Thr']) |
||
2846 | and ClientDataSetInraAfzThr.IsNull
|
||
2847 | then
|
||
2848 | begin
|
||
2849 | ClientDataSetIngredientsThr.Clear; |
||
2850 | ClientDataSetIngredientsThr_MAT.Clear; |
||
2851 | ClientDataSetIngredientsdThr.Clear; |
||
2852 | ClientDataSetIngredientsThrd.Clear; |
||
2853 | end
|
||
2854 | else
|
||
2855 | begin
|
||
2856 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Thr']) |
||
2857 | then
|
||
2858 | ClientDataSetIngredientsThr.Value := OutputAA(ClientDataSetInraAfzThr.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
2859 | else
|
||
2860 | ClientDataSetIngredientsThr.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Thr']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2861 | ClientDataSetIngredientsThr_MAT.Value := InputAA(ClientDataSetIngredientsThr.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2862 | if ClientDataSetInraAfzdThr.IsNull
|
||
2863 | then
|
||
2864 | ClientDataSetIngredientsdThr.Value := dThr * 100
|
||
2865 | else
|
||
2866 | ClientDataSetIngredientsdThr.Value := ClientDataSetInraAfzdThr.Value * 100;
|
||
2867 | ClientDataSetIngredientsThrd.Value := ClientDataSetIngredientsdThr.Value / 100 * ClientDataSetIngredientsThr.Value;
|
||
2868 | end;
|
||
2869 | // Met
|
||
2870 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Met']) |
||
2871 | and ClientDataSetInraAfzMet.IsNull
|
||
2872 | then
|
||
2873 | begin
|
||
2874 | ClientDataSetIngredientsMet.Clear; |
||
2875 | ClientDataSetIngredientsMet_MAT.Clear; |
||
2876 | ClientDataSetIngredientsdMet.Clear; |
||
2877 | ClientDataSetIngredientsMetd.Clear; |
||
2878 | end
|
||
2879 | else
|
||
2880 | begin
|
||
2881 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Met']) |
||
2882 | then
|
||
2883 | ClientDataSetIngredientsMet.Value := OutputAA(ClientDataSetInraAfzMet.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
2884 | else
|
||
2885 | ClientDataSetIngredientsMet.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Met']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2886 | ClientDataSetIngredientsMet_MAT.Value := InputAA(ClientDataSetIngredientsMet.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2887 | if ClientDataSetInraAfzdMet.IsNull
|
||
2888 | then
|
||
2889 | ClientDataSetIngredientsdMet.Value := dMet * 100
|
||
2890 | else
|
||
2891 | ClientDataSetIngredientsdMet.Value := ClientDataSetInraAfzdMet.Value * 100;
|
||
2892 | ClientDataSetIngredientsMetd.Value := ClientDataSetIngredientsdMet.Value / 100 * ClientDataSetIngredientsMet.Value;
|
||
2893 | end;
|
||
2894 | // Cys
|
||
2895 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Cys']) |
||
2896 | and ClientDataSetInraAfzCys.IsNull
|
||
2897 | then
|
||
2898 | begin
|
||
2899 | ClientDataSetIngredientsCys.Clear; |
||
2900 | ClientDataSetIngredientsCys_MAT.Clear; |
||
2901 | ClientDataSetIngredientsdCys.Clear; |
||
2902 | ClientDataSetIngredientsCysd.Clear; |
||
2903 | end
|
||
2904 | else
|
||
2905 | begin
|
||
2906 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Cys']) |
||
2907 | then
|
||
2908 | ClientDataSetIngredientsCys.Value := OutputAA(ClientDataSetInraAfzCys.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
2909 | else
|
||
2910 | ClientDataSetIngredientsCys.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Cys']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2911 | ClientDataSetIngredientsCys_MAT.Value := InputAA(ClientDataSetIngredientsCys.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2912 | if ClientDataSetInraAfzdCys.IsNull
|
||
2913 | then
|
||
2914 | ClientDataSetIngredientsdCys.Value := dCys * 100
|
||
2915 | else
|
||
2916 | ClientDataSetIngredientsdCys.Value := ClientDataSetInraAfzdCys.Value * 100;
|
||
2917 | ClientDataSetIngredientsCysd.Value := ClientDataSetIngredientsdCys.Value / 100 * ClientDataSetIngredientsCys.Value;
|
||
2918 | end;
|
||
2919 | // Met + Cys
|
||
2920 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MetCys']) |
||
2921 | and ClientDataSetInraAfzMetCys.IsNull
|
||
2922 | then
|
||
2923 | begin
|
||
2924 | ClientDataSetIngredientsMetCys.Clear; |
||
2925 | ClientDataSetIngredientsMetCys_MAT.Clear; |
||
2926 | ClientDataSetIngredientsdMetCys.Clear; |
||
2927 | ClientDataSetIngredientsMetCysd.Clear; |
||
2928 | end
|
||
2929 | else
|
||
2930 | begin
|
||
2931 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MetCys']) |
||
2932 | then
|
||
2933 | ClientDataSetIngredientsMetCys.Value := OutputAA(ClientDataSetInraAfzMetCys.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
2934 | else
|
||
2935 | ClientDataSetIngredientsMetCys.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MetCys']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2936 | ClientDataSetIngredientsMetCys_MAT.Value := InputAA(ClientDataSetIngredientsMetCys.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2937 | if ClientDataSetInraAfzdMetCys.IsNull
|
||
2938 | then
|
||
2939 | ClientDataSetIngredientsdMetCys.Value := dMetCys * 100
|
||
2940 | else
|
||
2941 | ClientDataSetIngredientsdMetCys.Value := ClientDataSetInraAfzdMetCys.Value * 100;
|
||
2942 | ClientDataSetIngredientsMetCysd.Value := ClientDataSetIngredientsdMetCys.Value / 100 * ClientDataSetIngredientsMetCys.Value;
|
||
2943 | end;
|
||
2944 | // Trp
|
||
2945 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Trp']) |
||
2946 | and ClientDataSetInraAfzTrp.IsNull
|
||
2947 | then
|
||
2948 | begin
|
||
2949 | ClientDataSetIngredientsTrp.Clear; |
||
2950 | ClientDataSetIngredientsTrp_MAT.Clear; |
||
2951 | ClientDataSetIngredientsdTrp.Clear; |
||
2952 | ClientDataSetIngredientsTrpd.Clear; |
||
2953 | end
|
||
2954 | else
|
||
2955 | begin
|
||
2956 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Trp']) |
||
2957 | then
|
||
2958 | ClientDataSetIngredientsTrp.Value := OutputAA(ClientDataSetInraAfzTrp.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
2959 | else
|
||
2960 | ClientDataSetIngredientsTrp.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Trp']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2961 | ClientDataSetIngredientsTrp_MAT.Value := InputAA(ClientDataSetIngredientsTrp.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2962 | if ClientDataSetInraAfzdTrp.IsNull
|
||
2963 | then
|
||
2964 | ClientDataSetIngredientsdTrp.Value := dTrp * 100
|
||
2965 | else
|
||
2966 | ClientDataSetIngredientsdTrp.Value := ClientDataSetInraAfzdTrp.Value * 100;
|
||
2967 | ClientDataSetIngredientsTrpd.Value := ClientDataSetIngredientsdTrp.Value / 100 * ClientDataSetIngredientsTrp.Value;
|
||
2968 | end;
|
||
2969 | // Ile
|
||
2970 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Ile']) |
||
2971 | and ClientDataSetInraAfzIle.IsNull
|
||
2972 | then
|
||
2973 | begin
|
||
2974 | ClientDataSetIngredientsIle.Clear; |
||
2975 | ClientDataSetIngredientsIle_MAT.Clear; |
||
2976 | ClientDataSetIngredientsdIle.Clear; |
||
2977 | ClientDataSetIngredientsIled.Clear; |
||
2978 | end
|
||
2979 | else
|
||
2980 | begin
|
||
2981 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Ile']) |
||
2982 | then
|
||
2983 | ClientDataSetIngredientsIle.Value := OutputAA(ClientDataSetInraAfzIle.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
2984 | else
|
||
2985 | ClientDataSetIngredientsIle.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Ile']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
2986 | ClientDataSetIngredientsIle_MAT.Value := InputAA(ClientDataSetIngredientsIle.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
2987 | if ClientDataSetInraAfzdIle.IsNull
|
||
2988 | then
|
||
2989 | ClientDataSetIngredientsdIle.Value := dIle * 100
|
||
2990 | else
|
||
2991 | ClientDataSetIngredientsdIle.Value := ClientDataSetInraAfzdIle.Value * 100;
|
||
2992 | ClientDataSetIngredientsIled.Value := ClientDataSetIngredientsdIle.Value / 100 * ClientDataSetIngredientsIle.Value;
|
||
2993 | end;
|
||
2994 | // Val
|
||
2995 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Val']) |
||
2996 | and ClientDataSetInraAfzVal.IsNull
|
||
2997 | then
|
||
2998 | begin
|
||
2999 | ClientDataSetIngredientsVal.Clear; |
||
3000 | ClientDataSetIngredientsVal_MAT.Clear; |
||
3001 | ClientDataSetIngredientsdVal.Clear; |
||
3002 | ClientDataSetIngredientsVald.Clear; |
||
3003 | end
|
||
3004 | else
|
||
3005 | begin
|
||
3006 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Val']) |
||
3007 | then
|
||
3008 | ClientDataSetIngredientsVal.Value := OutputAA(ClientDataSetInraAfzVal.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
3009 | else
|
||
3010 | ClientDataSetIngredientsVal.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Val']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
3011 | ClientDataSetIngredientsVal_MAT.Value := InputAA(ClientDataSetIngredientsVal.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
3012 | if ClientDataSetInraAfzdVal.IsNull
|
||
3013 | then
|
||
3014 | ClientDataSetIngredientsdVal.Value := dVal * 100
|
||
3015 | else
|
||
3016 | ClientDataSetIngredientsdVal.Value := ClientDataSetInraAfzdVal.Value * 100;
|
||
3017 | ClientDataSetIngredientsVald.Value := ClientDataSetIngredientsdVal.Value / 100 * ClientDataSetIngredientsVal.Value;
|
||
3018 | end;
|
||
3019 | // Leu
|
||
3020 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Leu']) |
||
3021 | and ClientDataSetInraAfzLeu.IsNull
|
||
3022 | then
|
||
3023 | begin
|
||
3024 | ClientDataSetIngredientsLeu.Clear; |
||
3025 | ClientDataSetIngredientsLeu_MAT.Clear; |
||
3026 | ClientDataSetIngredientsdLeu.Clear; |
||
3027 | ClientDataSetIngredientsLeud.Clear; |
||
3028 | end
|
||
3029 | else
|
||
3030 | begin
|
||
3031 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Leu']) |
||
3032 | then
|
||
3033 | ClientDataSetIngredientsLeu.Value := OutputAA(ClientDataSetInraAfzLeu.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
3034 | else
|
||
3035 | ClientDataSetIngredientsLeu.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Leu']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
3036 | ClientDataSetIngredientsLeu_MAT.Value := InputAA(ClientDataSetIngredientsLeu.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
3037 | if ClientDataSetInraAfzdLeu.IsNull
|
||
3038 | then
|
||
3039 | ClientDataSetIngredientsdLeu.Value := dLeu * 100
|
||
3040 | else
|
||
3041 | ClientDataSetIngredientsdLeu.Value := ClientDataSetInraAfzdLeu.Value * 100;
|
||
3042 | ClientDataSetIngredientsLeud.Value := ClientDataSetIngredientsdLeu.Value / 100 * ClientDataSetIngredientsLeu.Value;
|
||
3043 | end;
|
||
3044 | // Phe
|
||
3045 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Phe']) |
||
3046 | and ClientDataSetInraAfzPhe.IsNull
|
||
3047 | then
|
||
3048 | begin
|
||
3049 | ClientDataSetIngredientsPhe.Clear; |
||
3050 | ClientDataSetIngredientsPhe_MAT.Clear; |
||
3051 | ClientDataSetIngredientsdPhe.Clear; |
||
3052 | ClientDataSetIngredientsPhed.Clear; |
||
3053 | end
|
||
3054 | else
|
||
3055 | begin
|
||
3056 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Phe']) |
||
3057 | then
|
||
3058 | ClientDataSetIngredientsPhe.Value := OutputAA(ClientDataSetInraAfzPhe.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
3059 | else
|
||
3060 | ClientDataSetIngredientsPhe.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Phe']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
3061 | ClientDataSetIngredientsPhe_MAT.Value := InputAA(ClientDataSetIngredientsPhe.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
3062 | if ClientDataSetInraAfzdPhe.IsNull
|
||
3063 | then
|
||
3064 | ClientDataSetIngredientsdPhe.Value := dPhe * 100
|
||
3065 | else
|
||
3066 | ClientDataSetIngredientsdPhe.Value := ClientDataSetInraAfzdPhe.Value * 100;
|
||
3067 | ClientDataSetIngredientsPhed.Value := ClientDataSetIngredientsdPhe.Value / 100 * ClientDataSetIngredientsPhe.Value;
|
||
3068 | end;
|
||
3069 | // Tyr
|
||
3070 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Tyr']) |
||
3071 | and ClientDataSetInraAfzTyr.IsNull
|
||
3072 | then
|
||
3073 | begin
|
||
3074 | ClientDataSetIngredientsTyr.Clear; |
||
3075 | ClientDataSetIngredientsTyr_MAT.Clear; |
||
3076 | ClientDataSetIngredientsdTyr.Clear; |
||
3077 | ClientDataSetIngredientsTyrd.Clear; |
||
3078 | end
|
||
3079 | else
|
||
3080 | begin
|
||
3081 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Tyr']) |
||
3082 | then
|
||
3083 | ClientDataSetIngredientsTyr.Value := OutputAA(ClientDataSetInraAfzTyr.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
3084 | else
|
||
3085 | ClientDataSetIngredientsTyr.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Tyr']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
3086 | ClientDataSetIngredientsTyr_MAT.Value := InputAA(ClientDataSetIngredientsTyr.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
3087 | if ClientDataSetInraAfzdTyr.IsNull
|
||
3088 | then
|
||
3089 | ClientDataSetIngredientsdTyr.Value := dTyr * 100
|
||
3090 | else
|
||
3091 | ClientDataSetIngredientsdTyr.Value := ClientDataSetInraAfzdTyr.Value * 100;
|
||
3092 | ClientDataSetIngredientsTyrd.Value := ClientDataSetIngredientsdTyr.Value / 100 * ClientDataSetIngredientsTyr.Value;
|
||
3093 | end;
|
||
3094 | // Phe + Tyr
|
||
3095 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['PheTyr']) |
||
3096 | and ClientDataSetInraAfzPheTyr.IsNull
|
||
3097 | then
|
||
3098 | begin
|
||
3099 | ClientDataSetIngredientsPheTyr.Clear; |
||
3100 | ClientDataSetIngredientsPheTyr_MAT.Clear; |
||
3101 | ClientDataSetIngredientsdPheTyr.Clear; |
||
3102 | ClientDataSetIngredientsPheTyrd.Clear; |
||
3103 | end
|
||
3104 | else
|
||
3105 | begin
|
||
3106 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['PheTyr']) |
||
3107 | then
|
||
3108 | ClientDataSetIngredientsPheTyr.Value := OutputAA(ClientDataSetInraAfzPheTyr.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
3109 | else
|
||
3110 | ClientDataSetIngredientsPheTyr.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['PheTyr']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
3111 | ClientDataSetIngredientsPheTyr_MAT.Value := InputAA(ClientDataSetIngredientsPheTyr.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
3112 | if ClientDataSetInraAfzdPheTyr.IsNull
|
||
3113 | then
|
||
3114 | ClientDataSetIngredientsdPheTyr.Value := dPheTyr * 100
|
||
3115 | else
|
||
3116 | ClientDataSetIngredientsdPheTyr.Value := ClientDataSetInraAfzdPheTyr.Value * 100;
|
||
3117 | ClientDataSetIngredientsPheTyrd.Value := ClientDataSetIngredientsdPheTyr.Value / 100 * ClientDataSetIngredientsPheTyr.Value;
|
||
3118 | end;
|
||
3119 | // His
|
||
3120 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['His']) |
||
3121 | and ClientDataSetInraAfzHis.IsNull
|
||
3122 | then
|
||
3123 | begin
|
||
3124 | ClientDataSetIngredientsHis.Clear; |
||
3125 | ClientDataSetIngredientsHis_MAT.Clear; |
||
3126 | ClientDataSetIngredientsdHis.Clear; |
||
3127 | ClientDataSetIngredientsHisd.Clear; |
||
3128 | end
|
||
3129 | else
|
||
3130 | begin
|
||
3131 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['His']) |
||
3132 | then
|
||
3133 | ClientDataSetIngredientsHis.Value := OutputAA(ClientDataSetInraAfzHis.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
3134 | else
|
||
3135 | ClientDataSetIngredientsHis.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['His']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
3136 | ClientDataSetIngredientsHis_MAT.Value := InputAA(ClientDataSetIngredientsHis.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
3137 | if ClientDataSetInraAfzdHis.IsNull
|
||
3138 | then
|
||
3139 | ClientDataSetIngredientsdHis.Value := dHis * 100
|
||
3140 | else
|
||
3141 | ClientDataSetIngredientsdHis.Value := ClientDataSetInraAfzdHis.Value * 100;
|
||
3142 | ClientDataSetIngredientsHisd.Value := ClientDataSetIngredientsdHis.Value / 100 * ClientDataSetIngredientsHis.Value;
|
||
3143 | end;
|
||
3144 | // Arg
|
||
3145 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Arg']) |
||
3146 | and ClientDataSetInraAfzArg.IsNull
|
||
3147 | then
|
||
3148 | begin
|
||
3149 | ClientDataSetIngredientsArg.Clear; |
||
3150 | ClientDataSetIngredientsArg_MAT.Clear; |
||
3151 | ClientDataSetIngredientsdArg.Clear; |
||
3152 | ClientDataSetIngredientsArgd.Clear; |
||
3153 | end
|
||
3154 | else
|
||
3155 | begin
|
||
3156 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Arg']) |
||
3157 | then
|
||
3158 | ClientDataSetIngredientsArg.Value := OutputAA(ClientDataSetInraAfzArg.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
3159 | else
|
||
3160 | ClientDataSetIngredientsArg.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Arg']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
3161 | ClientDataSetIngredientsArg_MAT.Value := InputAA(ClientDataSetIngredientsArg.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
3162 | if ClientDataSetInraAfzdArg.IsNull
|
||
3163 | then
|
||
3164 | ClientDataSetIngredientsdArg.Value := dArg * 100
|
||
3165 | else
|
||
3166 | ClientDataSetIngredientsdArg.Value := ClientDataSetInraAfzdArg.Value * 100;
|
||
3167 | ClientDataSetIngredientsArgd.Value := ClientDataSetIngredientsdArg.Value / 100 * ClientDataSetIngredientsArg.Value;
|
||
3168 | end;
|
||
3169 | // Ala
|
||
3170 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Ala']) |
||
3171 | and ClientDataSetInraAfzAla.IsNull
|
||
3172 | then
|
||
3173 | begin
|
||
3174 | ClientDataSetIngredientsAla.Clear; |
||
3175 | ClientDataSetIngredientsAla_MAT.Clear; |
||
3176 | ClientDataSetIngredientsdAla.Clear; |
||
3177 | ClientDataSetIngredientsAlad.Clear; |
||
3178 | end
|
||
3179 | else
|
||
3180 | begin
|
||
3181 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Ala']) |
||
3182 | then
|
||
3183 | ClientDataSetIngredientsAla.Value := OutputAA(ClientDataSetInraAfzAla.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
3184 | else
|
||
3185 | ClientDataSetIngredientsAla.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Ala']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
3186 | ClientDataSetIngredientsAla_MAT.Value := InputAA(ClientDataSetIngredientsAla.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
3187 | if ClientDataSetInraAfzdAla.IsNull
|
||
3188 | then
|
||
3189 | ClientDataSetIngredientsdAla.Value := dAla * 100
|
||
3190 | else
|
||
3191 | ClientDataSetIngredientsdAla.Value := ClientDataSetInraAfzdAla.Value * 100;
|
||
3192 | ClientDataSetIngredientsAlad.Value := ClientDataSetIngredientsdAla.Value / 100 * ClientDataSetIngredientsAla.Value;
|
||
3193 | end;
|
||
3194 | // Asp
|
||
3195 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Asp']) |
||
3196 | and ClientDataSetInraAfzAsp.IsNull
|
||
3197 | then
|
||
3198 | begin
|
||
3199 | ClientDataSetIngredientsAsp.Clear; |
||
3200 | ClientDataSetIngredientsAsp_MAT.Clear; |
||
3201 | ClientDataSetIngredientsdAsp.Clear; |
||
3202 | ClientDataSetIngredientsAspd.Clear; |
||
3203 | end
|
||
3204 | else
|
||
3205 | begin
|
||
3206 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Asp']) |
||
3207 | then
|
||
3208 | ClientDataSetIngredientsAsp.Value := OutputAA(ClientDataSetInraAfzAsp.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
3209 | else
|
||
3210 | ClientDataSetIngredientsAsp.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Asp']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
3211 | ClientDataSetIngredientsAsp_MAT.Value := InputAA(ClientDataSetIngredientsAsp.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
3212 | if ClientDataSetInraAfzdAsp.IsNull
|
||
3213 | then
|
||
3214 | ClientDataSetIngredientsdAsp.Value := dAsp * 100
|
||
3215 | else
|
||
3216 | ClientDataSetIngredientsdAsp.Value := ClientDataSetInraAfzdAsp.Value * 100;
|
||
3217 | ClientDataSetIngredientsAspd.Value := ClientDataSetIngredientsdAsp.Value / 100 * ClientDataSetIngredientsAsp.Value;
|
||
3218 | end;
|
||
3219 | // Glu
|
||
3220 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Glu']) |
||
3221 | and ClientDataSetInraAfzGlu.IsNull
|
||
3222 | then
|
||
3223 | begin
|
||
3224 | ClientDataSetIngredientsGlu.Clear; |
||
3225 | ClientDataSetIngredientsGlu_MAT.Clear; |
||
3226 | ClientDataSetIngredientsdGlu.Clear; |
||
3227 | ClientDataSetIngredientsGlud.Clear; |
||
3228 | end
|
||
3229 | else
|
||
3230 | begin
|
||
3231 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Glu']) |
||
3232 | then
|
||
3233 | ClientDataSetIngredientsGlu.Value := OutputAA(ClientDataSetInraAfzGlu.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
3234 | else
|
||
3235 | ClientDataSetIngredientsGlu.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Glu']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
3236 | ClientDataSetIngredientsGlu_MAT.Value := InputAA(ClientDataSetIngredientsGlu.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
3237 | if ClientDataSetInraAfzdGlu.IsNull
|
||
3238 | then
|
||
3239 | ClientDataSetIngredientsdGlu.Value := dGlu * 100
|
||
3240 | else
|
||
3241 | ClientDataSetIngredientsdGlu.Value := ClientDataSetInraAfzdGlu.Value * 100;
|
||
3242 | ClientDataSetIngredientsGlud.Value := ClientDataSetIngredientsdGlu.Value / 100 * ClientDataSetIngredientsGlu.Value;
|
||
3243 | end;
|
||
3244 | // Gly
|
||
3245 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Gly']) |
||
3246 | and ClientDataSetInraAfzGly.IsNull
|
||
3247 | then
|
||
3248 | begin
|
||
3249 | ClientDataSetIngredientsGly.Clear; |
||
3250 | ClientDataSetIngredientsGly_MAT.Clear; |
||
3251 | ClientDataSetIngredientsdGly.Clear; |
||
3252 | ClientDataSetIngredientsGlyd.Clear; |
||
3253 | end
|
||
3254 | else
|
||
3255 | begin
|
||
3256 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Gly']) |
||
3257 | then
|
||
3258 | ClientDataSetIngredientsGly.Value := OutputAA(ClientDataSetInraAfzGly.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
3259 | else
|
||
3260 | ClientDataSetIngredientsGly.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Gly']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
3261 | ClientDataSetIngredientsGly_MAT.Value := InputAA(ClientDataSetIngredientsGly.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
3262 | if ClientDataSetInraAfzdGly.IsNull
|
||
3263 | then
|
||
3264 | ClientDataSetIngredientsdGly.Value := dGly * 100
|
||
3265 | else
|
||
3266 | ClientDataSetIngredientsdGly.Value := ClientDataSetInraAfzdGly.Value * 100;
|
||
3267 | ClientDataSetIngredientsGlyd.Value := ClientDataSetIngredientsdGly.Value / 100 * ClientDataSetIngredientsGly.Value;
|
||
3268 | end;
|
||
3269 | // Ser
|
||
3270 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Ser']) |
||
3271 | and ClientDataSetInraAfzSer.IsNull
|
||
3272 | then
|
||
3273 | begin
|
||
3274 | ClientDataSetIngredientsSer.Clear; |
||
3275 | ClientDataSetIngredientsSer_MAT.Clear; |
||
3276 | ClientDataSetIngredientsdSer.Clear; |
||
3277 | ClientDataSetIngredientsSerd.Clear; |
||
3278 | end
|
||
3279 | else
|
||
3280 | begin
|
||
3281 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Ser']) |
||
3282 | then
|
||
3283 | ClientDataSetIngredientsSer.Value := OutputAA(ClientDataSetInraAfzSer.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
3284 | else
|
||
3285 | ClientDataSetIngredientsSer.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Ser']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
3286 | ClientDataSetIngredientsSer_MAT.Value := InputAA(ClientDataSetIngredientsSer.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
3287 | if ClientDataSetInraAfzdSer.IsNull
|
||
3288 | then
|
||
3289 | ClientDataSetIngredientsdSer.Value := dSer * 100
|
||
3290 | else
|
||
3291 | ClientDataSetIngredientsdSer.Value := ClientDataSetInraAfzdSer.Value * 100;
|
||
3292 | ClientDataSetIngredientsSerd.Value := ClientDataSetIngredientsdSer.Value / 100 * ClientDataSetIngredientsSer.Value;
|
||
3293 | end;
|
||
3294 | // Pro
|
||
3295 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Pro']) |
||
3296 | and ClientDataSetInraAfzPro.IsNull
|
||
3297 | then
|
||
3298 | begin
|
||
3299 | ClientDataSetIngredientsPro.Clear; |
||
3300 | ClientDataSetIngredientsPro_MAT.Clear; |
||
3301 | ClientDataSetIngredientsdPro.Clear; |
||
3302 | ClientDataSetIngredientsProd.Clear; |
||
3303 | end
|
||
3304 | else
|
||
3305 | begin
|
||
3306 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Pro']) |
||
3307 | then
|
||
3308 | ClientDataSetIngredientsPro.Value := OutputAA(ClientDataSetInraAfzPro.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) |
||
3309 | else
|
||
3310 | ClientDataSetIngredientsPro.Value := OutputAA(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Pro']), RapMAT, RapMS, FormOptions.Expression, FormOptions.AA);
|
||
3311 | ClientDataSetIngredientsPro_MAT.Value := InputAA(ClientDataSetIngredientsPro.Value, RapMAT, RapMS, FormOptions.Expression, FormOptions.AA) * 100;
|
||
3312 | if ClientDataSetInraAfzdPro.IsNull
|
||
3313 | then
|
||
3314 | ClientDataSetIngredientsdPro.Value := dPro * 100
|
||
3315 | else
|
||
3316 | ClientDataSetIngredientsdPro.Value := ClientDataSetInraAfzdPro.Value * 100;
|
||
3317 | ClientDataSetIngredientsProd.Value := ClientDataSetIngredientsdPro.Value / 100 * ClientDataSetIngredientsPro.Value;
|
||
3318 | end;
|
||
3319 | end;
|
||
3320 | // Min?raux
|
||
3321 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Ca']) |
||
3322 | then
|
||
3323 | if ClientDataSetInraAfzCa.IsNull
|
||
3324 | then
|
||
3325 | ClientDataSetIngredientsCa.Clear |
||
3326 | else
|
||
3327 | ClientDataSetIngredientsCa.Value := OutputMinerals(ClientDataSetInraAfzCa.Value, RapMS, FormOptions.Expression, FormOptions.Minerals) |
||
3328 | else
|
||
3329 | ClientDataSetIngredientsCa.Value := OutputMinerals(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Ca']), RapMS, FormOptions.Expression, FormOptions.Minerals);
|
||
3330 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['P']) |
||
3331 | then
|
||
3332 | if ClientDataSetInraAfzP.IsNull
|
||
3333 | then
|
||
3334 | ClientDataSetIngredientsP.Clear |
||
3335 | else
|
||
3336 | ClientDataSetIngredientsP.Value := OutputMinerals(ClientDataSetInraAfzP.Value, RapMS, FormOptions.Expression, FormOptions.Minerals) |
||
3337 | else
|
||
3338 | ClientDataSetIngredientsP.Value := OutputMinerals(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['P']), RapMS, FormOptions.Expression, FormOptions.Minerals);
|
||
3339 | 3 | avalancogn | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Na']) |
3340 | then
|
||
3341 | if ClientDataSetInraAfzNa.IsNull
|
||
3342 | then
|
||
3343 | ClientDataSetIngredientsNa.Clear |
||
3344 | else
|
||
3345 | ClientDataSetIngredientsNa.Value := OutputMinerals(ClientDataSetInraAfzNa.Value, RapMS, FormOptions.Expression, FormOptions.Minerals) |
||
3346 | else
|
||
3347 | ClientDataSetIngredientsNa.Value := OutputMinerals(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Na']), RapMS, FormOptions.Expression, FormOptions.Minerals);
|
||
3348 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['K']) |
||
3349 | then
|
||
3350 | if ClientDataSetInraAfzK.IsNull
|
||
3351 | then
|
||
3352 | ClientDataSetIngredientsK.Clear |
||
3353 | else
|
||
3354 | ClientDataSetIngredientsK.Value := OutputMinerals(ClientDataSetInraAfzK.Value, RapMS, FormOptions.Expression, FormOptions.Minerals) |
||
3355 | else
|
||
3356 | ClientDataSetIngredientsK.Value := OutputMinerals(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['K']), RapMS, FormOptions.Expression, FormOptions.Minerals);
|
||
3357 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Cl']) |
||
3358 | then
|
||
3359 | if ClientDataSetInraAfzCl.IsNull
|
||
3360 | then
|
||
3361 | ClientDataSetIngredientsCl.Clear |
||
3362 | else
|
||
3363 | ClientDataSetIngredientsCl.Value := OutputMinerals(ClientDataSetInraAfzCl.Value, RapMS, FormOptions.Expression, FormOptions.Minerals) |
||
3364 | else
|
||
3365 | ClientDataSetIngredientsCl.Value := OutputMinerals(TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['Cl']), RapMS, FormOptions.Expression, FormOptions.Minerals);
|
||
3366 | if ClientDataSetIngredientsNa.IsNull or ClientDataSetIngredientsK.IsNull or ClientDataSetIngredientsCl.IsNull |
||
3367 | then
|
||
3368 | ClientDataSetIngredientsBE.Clear |
||
3369 | else
|
||
3370 | ClientDataSetIngredientsBE.Value := CalcBilanElectrolytique(InputMinerals(ClientDataSetIngredientsNa.Value, RapMS, FormOptions.Expression, FormOptions.Minerals), InputMinerals(ClientDataSetIngredientsK.Value, RapMS, FormOptions.Expression, FormOptions.Minerals), InputMinerals(ClientDataSetIngredientsCl.Value, RapMS, FormOptions.Expression, FormOptions.Minerals)); |
||
3371 | 1 | avalancogn | if ClientDataSetIngredientsP.Value = 0 |
3372 | then // En l'absence de P, il n'y a pas de dP |
||
3373 | begin
|
||
3374 | ClientDataSetIngredientsdP.Clear; |
||
3375 | ClientDataSetIngredientsdPphy.Clear; |
||
3376 | end
|
||
3377 | else
|
||
3378 | begin
|
||
3379 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dP']) |
||
3380 | then
|
||
3381 | if ClientDataSetInraAfzdP.IsNull
|
||
3382 | then // Par d?faut dP = 20% |
||
3383 | ClientDataSetIngredientsdP.Value := 20
|
||
3384 | else
|
||
3385 | ClientDataSetIngredientsdP.Value := ClientDataSetInraAfzdP.Value * 100
|
||
3386 | else
|
||
3387 | ClientDataSetIngredientsdP.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dP']) * 100; |
||
3388 | if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dPphy']) |
||
3389 | then
|
||
3390 | if ClientDataSetInraAfzdPphy.IsNull
|
||
3391 | then // Par d?faut dPphy = dP |
||
3392 | ClientDataSetIngredientsdPphy.Value := ClientDataSetIngredientsdP.Value |
||
3393 | else
|
||
3394 | ClientDataSetIngredientsdPphy.Value := ClientDataSetInraAfzdPphy.Value * 100
|
||
3395 | else
|
||
3396 | ClientDataSetIngredientsdPphy.Value := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['dPphy']) * 100; |
||
3397 | end;
|
||
3398 | // Autres rapports
|
||
3399 | if ClientDataSetIngredientsLysd.IsNull or ClientDataSetIngredientsENc.IsNull or (ClientDataSetIngredientsENc.Value = 0) |
||
3400 | then
|
||
3401 | ClientDataSetIngredientsLysd_ENc.Clear |
||
3402 | else
|
||
3403 | if FormOptions.Energy = 0 |
||
3404 | then // g / MJ |
||
3405 | if FormOptions.AA = 0 |
||
3406 | then // % (conversion) |
||
3407 | ClientDataSetIngredientsLysd_ENc.Value := ClientDataSetIngredientsLysd.Value / 100 * 1000 / ClientDataSetIngredientsENc.Value |
||
3408 | else // g/kg |
||
3409 | ClientDataSetIngredientsLysd_ENc.Value := ClientDataSetIngredientsLysd.Value / ClientDataSetIngredientsENc.Value |
||
3410 | else // g / 1000 kcal |
||
3411 | if FormOptions.AA = 0 |
||
3412 | then // % (conversion) |
||
3413 | ClientDataSetIngredientsLysd_ENc.Value := ClientDataSetIngredientsLysd.Value / 100 * 1000 / ClientDataSetIngredientsENc.Value * 1000 |
||
3414 | else // g/kg |
||
3415 | ClientDataSetIngredientsLysd_ENc.Value := ClientDataSetIngredientsLysd.Value / ClientDataSetIngredientsENc.Value * 1000;
|
||
3416 | if ClientDataSetIngredientsLysd.IsNull or ClientDataSetIngredientsENt.IsNull or (ClientDataSetIngredientsENt.Value = 0) |
||
3417 | then
|
||
3418 | ClientDataSetIngredientsLysd_ENt.Clear |
||
3419 | else
|
||
3420 | if FormOptions.Energy = 0 |
||
3421 | then // g / MJ |
||
3422 | if FormOptions.AA = 0 |
||
3423 | then // % (conversion) |
||
3424 | ClientDataSetIngredientsLysd_ENt.Value := ClientDataSetIngredientsLysd.Value / 100 * 1000 / ClientDataSetIngredientsENt.Value |
||
3425 | else // g/kg |
||
3426 | ClientDataSetIngredientsLysd_ENt.Value := ClientDataSetIngredientsLysd.Value / ClientDataSetIngredientsENt.Value |
||
3427 | else // g / 1000 kcal |
||
3428 | if FormOptions.AA = 0 |
||
3429 | then // % (conversion) |
||
3430 | ClientDataSetIngredientsLysd_ENt.Value := ClientDataSetIngredientsLysd.Value / 100 * 1000 / ClientDataSetIngredientsENt.Value * 1000 |
||
3431 | else // g/kg |
||
3432 | ClientDataSetIngredientsLysd_ENt.Value := ClientDataSetIngredientsLysd.Value / ClientDataSetIngredientsENt.Value * 1000;
|
||
3433 | end;
|
||
3434 | |||
3435 | procedure TDataModuleDeclaration.CalcFeed;
|
||
3436 | // Renseigner l'enregistrement courant de ClientDataSetFeeds
|
||
3437 | // ? partir de l'enregistrement courant de TableFeeds
|
||
3438 | // en tenant compte des unit?s configur?es
|
||
3439 | const
|
||
3440 | a = 1.026;
|
||
3441 | b = 0.00263;
|
||
3442 | var
|
||
3443 | Ratio, CoefPhytase, PdEndo, PhytaseEndo, PhytaseMicro, PdMicro: Double; |
||
3444 | begin
|
||
3445 | if ClientDataSetComposition.RecordCount = 0 |
||
3446 | then // En l'absence de composition cent?simale toutes les valeurs sont nulles |
||
3447 | begin
|
||
3448 | // Analyse proximale
|
||
3449 | ClientDataSetFeedsMS.Clear; |
||
3450 | ClientDataSetFeedsMS2.Clear; |
||
3451 | ClientDataSetFeedsMM.Clear; |
||
3452 | ClientDataSetFeedsMAT.Clear; |
||
3453 | ClientDataSetFeedsMG.Clear; |
||
3454 | ClientDataSetFeedsCB.Clear; |
||
3455 | ClientDataSetFeedsNDF.Clear; |
||
3456 | ClientDataSetFeedsADF.Clear; |
||
3457 | ClientDataSetFeedsADL.Clear; |
||
3458 | ClientDataSetFeedsAmidon.Clear; |
||
3459 | ClientDataSetFeedsSucres.Clear; |
||
3460 | // Energie
|
||
3461 | ClientDataSetFeedsEB.Clear; |
||
3462 | ClientDataSetFeedsEDc.Clear; |
||
3463 | ClientDataSetFeedsEMc.Clear; |
||
3464 | ClientDataSetFeedsENc.Clear; |
||
3465 | ClientDataSetFeedsEDt.Clear; |
||
3466 | ClientDataSetFeedsEMt.Clear; |
||
3467 | ClientDataSetFeedsENt.Clear; |
||
3468 | // Digestibilit? f?cale de l'azote
|
||
3469 | ClientDataSetFeedsdNc.Clear; |
||
3470 | ClientDataSetFeedsdNt.Clear; |
||
3471 | // Acides amin?s
|
||
3472 | ClientDataSetFeedsLys.Clear; |
||
3473 | ClientDataSetFeedsThr.Clear; |
||
3474 | ClientDataSetFeedsMet.Clear; |
||
3475 | ClientDataSetFeedsCys.Clear; |
||
3476 | ClientDataSetFeedsMetCys.Clear; |
||
3477 | ClientDataSetFeedsTrp.Clear; |
||
3478 | ClientDataSetFeedsIle.Clear; |
||
3479 | ClientDataSetFeedsVal.Clear; |
||
3480 | ClientDataSetFeedsLeu.Clear; |
||
3481 | ClientDataSetFeedsPhe.Clear; |
||
3482 | ClientDataSetFeedsTyr.Clear; |
||
3483 | ClientDataSetFeedsPheTyr.Clear; |
||
3484 | ClientDataSetFeedsHis.Clear; |
||
3485 | ClientDataSetFeedsArg.Clear; |
||
3486 | ClientDataSetFeedsAla.Clear; |
||
3487 | ClientDataSetFeedsAsp.Clear; |
||
3488 | ClientDataSetFeedsGlu.Clear; |
||
3489 | ClientDataSetFeedsGly.Clear; |
||
3490 | ClientDataSetFeedsSer.Clear; |
||
3491 | ClientDataSetFeedsPro.Clear; |
||
3492 | ClientDataSetFeedsLysd.Clear; |
||
3493 | ClientDataSetFeedsThrd.Clear; |
||
3494 | ClientDataSetFeedsMetd.Clear; |
||
3495 | ClientDataSetFeedsCysd.Clear; |
||
3496 | ClientDataSetFeedsMetCysd.Clear; |
||
3497 | ClientDataSetFeedsTrpd.Clear; |
||
3498 | ClientDataSetFeedsIled.Clear; |
||
3499 | ClientDataSetFeedsVald.Clear; |
||
3500 | ClientDataSetFeedsLeud.Clear; |
||
3501 | ClientDataSetFeedsPhed.Clear; |
||
3502 | ClientDataSetFeedsTyrd.Clear; |
||
3503 | ClientDataSetFeedsPheTyrd.Clear; |
||
3504 | ClientDataSetFeedsHisd.Clear; |
||
3505 | ClientDataSetFeedsArgd.Clear; |
||
3506 | ClientDataSetFeedsAlad.Clear; |
||
3507 | ClientDataSetFeedsAspd.Clear; |
||
3508 | ClientDataSetFeedsGlud.Clear; |
||
3509 | ClientDataSetFeedsGlyd.Clear; |
||
3510 | ClientDataSetFeedsSerd.Clear; |
||
3511 | ClientDataSetFeedsProd.Clear; |
||
3512 | // Min?raux
|
||
3513 | ClientDataSetFeedsCa.Clear; |
||
3514 | ClientDataSetFeedsP.Clear; |
||
3515 | 3 | avalancogn | ClientDataSetFeedsNa.Clear; |
3516 | ClientDataSetFeedsK.Clear; |
||
3517 | ClientDataSetFeedsCl.Clear; |
||
3518 | 1 | avalancogn | ClientDataSetFeedsPd.Clear; |
3519 | end
|
||
3520 | else
|
||
3521 | begin
|
||
3522 | // COMPOSITON CHIMIQUE - Initialisation ? z?ro
|
||
3523 | // Analyse proximale
|
||
3524 | ClientDataSetFeedsMS.Value := 0;
|
||
3525 | ClientDataSetFeedsMM.Value := 0;
|
||
3526 | ClientDataSetFeedsMAT.Value := 0;
|
||
3527 | ClientDataSetFeedsMG.Value := 0;
|
||
3528 | ClientDataSetFeedsCB.Value := 0;
|
||
3529 | ClientDataSetFeedsNDF.Value := 0;
|
||
3530 | ClientDataSetFeedsADF.Value := 0;
|
||
3531 | ClientDataSetFeedsADL.Value := 0;
|
||
3532 | ClientDataSetFeedsAmidon.Value := 0;
|
||
3533 | ClientDataSetFeedsSucres.Value := 0;
|
||
3534 | // Energie
|
||
3535 | ClientDataSetFeedsEB.Value := 0;
|
||
3536 | ClientDataSetFeedsEDc.Value := 0;
|
||
3537 | ClientDataSetFeedsEMc.Value := 0;
|
||
3538 | ClientDataSetFeedsENc.Value := 0;
|
||
3539 | ClientDataSetFeedsEDt.Value := 0;
|
||
3540 | ClientDataSetFeedsEMt.Value := 0;
|
||
3541 | ClientDataSetFeedsENt.Value := 0;
|
||
3542 | // Digestibilit? f?cale de l'azote
|
||
3543 | ClientDataSetFeedsdNc.Value := 0;
|
||
3544 | ClientDataSetFeedsdNt.Value := 0;
|
||
3545 | // Acides amin?s
|
||
3546 | ClientDataSetFeedsLys.Value := 0;
|
||
3547 | ClientDataSetFeedsThr.Value := 0;
|
||
3548 | ClientDataSetFeedsMet.Value := 0;
|
||
3549 | ClientDataSetFeedsCys.Value := 0;
|
||
3550 | ClientDataSetFeedsMetCys.Value := 0;
|
||
3551 | ClientDataSetFeedsTrp.Value := 0;
|
||
3552 | ClientDataSetFeedsIle.Value := 0;
|
||
3553 | ClientDataSetFeedsVal.Value := 0;
|
||
3554 | ClientDataSetFeedsLeu.Value := 0;
|
||
3555 | ClientDataSetFeedsPhe.Value := 0;
|
||
3556 | ClientDataSetFeedsTyr.Value := 0;
|
||
3557 | ClientDataSetFeedsPheTyr.Value := 0;
|
||
3558 | ClientDataSetFeedsHis.Value := 0;
|
||
3559 | ClientDataSetFeedsArg.Value := 0;
|
||
3560 | ClientDataSetFeedsAla.Value := 0;
|
||
3561 | ClientDataSetFeedsAsp.Value := 0;
|
||
3562 | ClientDataSetFeedsGlu.Value := 0;
|
||
3563 | ClientDataSetFeedsGly.Value := 0;
|
||
3564 | ClientDataSetFeedsSer.Value := 0;
|
||
3565 | ClientDataSetFeedsPro.Value := 0;
|
||
3566 | ClientDataSetFeedsLysd.Value := 0;
|
||
3567 | ClientDataSetFeedsThrd.Value := 0;
|
||
3568 | ClientDataSetFeedsMetd.Value := 0;
|
||
3569 | ClientDataSetFeedsCysd.Value := 0;
|
||
3570 | ClientDataSetFeedsMetCysd.Value := 0;
|
||
3571 | ClientDataSetFeedsTrpd.Value := 0;
|
||
3572 | ClientDataSetFeedsIled.Value := 0;
|
||
3573 | ClientDataSetFeedsVald.Value := 0;
|
||
3574 | ClientDataSetFeedsLeud.Value := 0;
|
||
3575 | ClientDataSetFeedsPhed.Value := 0;
|
||
3576 | ClientDataSetFeedsTyrd.Value := 0;
|
||
3577 | ClientDataSetFeedsPheTyrd.Value := 0;
|
||
3578 | ClientDataSetFeedsHisd.Value := 0;
|
||
3579 | ClientDataSetFeedsArgd.Value := 0;
|
||
3580 | ClientDataSetFeedsAlad.Value := 0;
|
||
3581 | ClientDataSetFeedsAspd.Value := 0;
|
||
3582 | ClientDataSetFeedsGlud.Value := 0;
|
||
3583 | ClientDataSetFeedsGlyd.Value := 0;
|
||
3584 | ClientDataSetFeedsSerd.Value := 0;
|
||
3585 | ClientDataSetFeedsProd.Value := 0;
|
||
3586 | // Min?raux
|
||
3587 | ClientDataSetFeedsCa.Value := 0;
|
||
3588 | ClientDataSetFeedsP.Value := 0;
|
||
3589 | 3 | avalancogn | ClientDataSetFeedsNa.Value := 0;
|
3590 | ClientDataSetFeedsK.Value := 0;
|
||
3591 | ClientDataSetFeedsCl.Value := 0;
|
||
3592 | 1 | avalancogn | ClientDataSetFeedsPd.Value := 0;
|
3593 | PdEndo := 0;
|
||
3594 | ClientDataSetComposition.First; |
||
3595 | while not ClientDataSetComposition.Eof do |
||
3596 | begin
|
||
3597 | if ClientDataSetCompositionUser.Value
|
||
3598 | then
|
||
3599 | ClientDataSetIngredients.Filter := Format('Id = %d and User', [ClientDataSetCompositionIngredient.Value])
|
||
3600 | else
|
||
3601 | ClientDataSetIngredients.Filter := Format('Id = %d and not User', [ClientDataSetCompositionIngredient.Value]);
|
||
3602 | ClientDataSetIngredients.Filtered := True; |
||
3603 | // COMPOSITON CHIMIQUE - Incr?mentation
|
||
3604 | Ratio := InputIncorporation(ClientDataSetCompositionLevel.Value, FormOptions.Incorporation); |
||
3605 | ClientDataSetFeedsMS.Value := ClientDataSetFeedsMS.Value + ClientDataSetCompositionMS.Value * Ratio; |
||
3606 | if FormOptions.Expression = 0 |
||
3607 | then // Conversion frais -> sec (mati?re s?che de la mati?re premi?re) |
||
3608 | Ratio := Ratio / InputProximal(ClientDataSetIngredientsMS.Value, 1, 1, FormOptions.Proximal); |
||
3609 | RapMS := InputProximal(ClientDataSetCompositionMS.Value, 1, 1, FormOptions.Proximal); |
||
3610 | // Conversion sec -> frais (mati?re s?che de la composition)
|
||
3611 | Ratio := Ratio * RapMS; |
||
3612 | // Analyse proximale
|
||
3613 | ClientDataSetFeedsMM.Value := ClientDataSetFeedsMM.Value + ClientDataSetIngredientsMM.Value * Ratio; |
||
3614 | ClientDataSetFeedsMAT.Value := ClientDataSetFeedsMAT.Value + ClientDataSetIngredientsMAT.Value * Ratio; |
||
3615 | if not ClientDataSetFeedsMG.IsNull |
||
3616 | then
|
||
3617 | if ClientDataSetIngredientsMG.IsNull
|
||
3618 | then
|
||
3619 | ClientDataSetFeedsMG.Clear |
||
3620 | else
|
||
3621 | ClientDataSetFeedsMG.Value := ClientDataSetFeedsMG.Value + ClientDataSetIngredientsMG.Value * Ratio; |
||
3622 | if not ClientDataSetFeedsCB.IsNull |
||
3623 | then
|
||
3624 | if ClientDataSetIngredientsCB.IsNull
|
||
3625 | then
|
||
3626 | ClientDataSetFeedsCB.Clear |
||
3627 | else
|
||
3628 | ClientDataSetFeedsCB.Value := ClientDataSetFeedsCB.Value + ClientDataSetIngredientsCB.Value * Ratio; |
||
3629 | if not ClientDataSetFeedsNDF.IsNull |
||
3630 | then
|
||
3631 | if ClientDataSetIngredientsNDF.IsNull
|
||
3632 | then
|
||
3633 | ClientDataSetFeedsNDF.Clear |
||
3634 | else
|
||
3635 | ClientDataSetFeedsNDF.Value := ClientDataSetFeedsNDF.Value + ClientDataSetIngredientsNDF.Value * Ratio; |
||
3636 | if not ClientDataSetFeedsADF.IsNull |
||
3637 | then
|
||
3638 | if ClientDataSetIngredientsADF.IsNull
|
||
3639 | then
|
||
3640 | ClientDataSetFeedsADF.Clear |
||
3641 | else
|
||
3642 | ClientDataSetFeedsADF.Value := ClientDataSetFeedsADF.Value + ClientDataSetIngredientsADF.Value * Ratio; |
||
3643 | if not ClientDataSetFeedsADL.IsNull |
||
3644 | then
|
||
3645 | if ClientDataSetIngredientsADL.IsNull
|
||
3646 | then
|
||
3647 | ClientDataSetFeedsADL.Clear |
||
3648 | else
|
||
3649 | ClientDataSetFeedsADL.Value := ClientDataSetFeedsADL.Value + ClientDataSetIngredientsADL.Value * Ratio; |
||
3650 | if not ClientDataSetFeedsAmidon.IsNull |
||
3651 | then
|
||
3652 | if ClientDataSetIngredientsAmidon.IsNull
|
||
3653 | then
|
||
3654 | ClientDataSetFeedsAmidon.Clear |
||
3655 | else
|
||
3656 | ClientDataSetFeedsAmidon.Value := ClientDataSetFeedsAmidon.Value + ClientDataSetIngredientsAmidon.Value * Ratio; |
||
3657 | if not ClientDataSetFeedsSucres.IsNull |
||
3658 | then
|
||
3659 | if ClientDataSetIngredientsSucres.IsNull
|
||
3660 | then
|
||
3661 | ClientDataSetFeedsSucres.Clear |
||
3662 | else
|
||
3663 | ClientDataSetFeedsSucres.Value := ClientDataSetFeedsSucres.Value + ClientDataSetIngredientsSucres.Value * Ratio; |
||
3664 | // Energie
|
||
3665 | if not ClientDataSetFeedsEB.IsNull |
||
3666 | then
|
||
3667 | if ClientDataSetIngredientsEB.IsNull
|
||
3668 | then
|
||
3669 | ClientDataSetFeedsEB.Clear |
||
3670 | else
|
||
3671 | ClientDataSetFeedsEB.Value := ClientDataSetFeedsEB.Value + ClientDataSetIngredientsEB.Value * Ratio; |
||
3672 | if not ClientDataSetFeedsEDc.IsNull |
||
3673 | then
|
||
3674 | if ClientDataSetIngredientsEDc.IsNull
|
||
3675 | then
|
||
3676 | ClientDataSetFeedsEDc.Clear |
||
3677 | else
|
||
3678 | ClientDataSetFeedsEDc.Value := ClientDataSetFeedsEDc.Value + ClientDataSetIngredientsEDc.Value * Ratio; |
||
3679 | if not ClientDataSetFeedsEMc.IsNull |
||
3680 | then
|
||
3681 | if ClientDataSetIngredientsEMc.IsNull
|
||
3682 | then
|
||
3683 | ClientDataSetFeedsEMc.Clear |
||
3684 | else
|
||
3685 | ClientDataSetFeedsEMc.Value := ClientDataSetFeedsEMc.Value + ClientDataSetIngredientsEMc.Value * Ratio; |
||
3686 | if not ClientDataSetFeedsENc.IsNull |
||
3687 | then
|
||
3688 | if ClientDataSetIngredientsENc.IsNull
|
||
3689 | then
|
||
3690 | ClientDataSetFeedsENc.Clear |
||
3691 | else
|
||
3692 | ClientDataSetFeedsENc.Value := ClientDataSetFeedsENc.Value + ClientDataSetIngredientsENc.Value * Ratio; |
||
3693 | if not ClientDataSetFeedsEDt.IsNull |
||
3694 | then
|
||
3695 | if ClientDataSetIngredientsEDt.IsNull
|
||
3696 | then
|
||
3697 | ClientDataSetFeedsEDt.Clear |
||
3698 | else
|
||
3699 | ClientDataSetFeedsEDt.Value := ClientDataSetFeedsEDt.Value + ClientDataSetIngredientsEDt.Value * Ratio; |
||
3700 | if not ClientDataSetFeedsEMt.IsNull |
||
3701 | then
|
||
3702 | if ClientDataSetIngredientsEMt.IsNull
|
||
3703 | then
|
||
3704 | ClientDataSetFeedsEMt.Clear |
||
3705 | else
|
||
3706 | ClientDataSetFeedsEMt.Value := ClientDataSetFeedsEMt.Value + ClientDataSetIngredientsEMt.Value * Ratio; |
||
3707 | if not ClientDataSetFeedsENt.IsNull |
||
3708 | then
|
||
3709 | if ClientDataSetIngredientsENt.IsNull
|
||
3710 | then
|
||
3711 | ClientDataSetFeedsENt.Clear |
||
3712 | else
|
||
3713 | ClientDataSetFeedsENt.Value := ClientDataSetFeedsENt.Value + ClientDataSetIngredientsENt.Value * Ratio; |
||
3714 | // Digestibilit? f?cale de l'azote
|
||
3715 | if not ClientDataSetFeedsdNc.IsNull |
||
3716 | then
|
||
3717 | if ClientDataSetIngredientsdNc.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3718 | then // Ne devrait pas se produire |
||
3719 | ClientDataSetFeedsdNc.Clear |
||
3720 | else // MATd = MAT * dN |
||
3721 | ClientDataSetFeedsdNc.Value := ClientDataSetFeedsdNc.Value + ClientDataSetIngredientsMAT.Value * ClientDataSetIngredientsdNc.Value / 100 * Ratio;
|
||
3722 | if not ClientDataSetFeedsdNt.IsNull |
||
3723 | then
|
||
3724 | if ClientDataSetIngredientsdNt.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3725 | then // Ne devrait pas se produire |
||
3726 | ClientDataSetFeedsdNt.Clear |
||
3727 | else // MATd = MAT * dN |
||
3728 | ClientDataSetFeedsdNt.Value := ClientDataSetFeedsdNt.Value + ClientDataSetIngredientsMAT.Value * ClientDataSetIngredientsdNt.Value / 100 * Ratio;
|
||
3729 | // Acides amin?s
|
||
3730 | if not ClientDataSetFeedsLys.IsNull |
||
3731 | then
|
||
3732 | if ClientDataSetIngredientsLys.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3733 | then
|
||
3734 | begin
|
||
3735 | ClientDataSetFeedsLys.Clear; |
||
3736 | ClientDataSetFeedsLysd.Clear; |
||
3737 | end
|
||
3738 | else
|
||
3739 | begin
|
||
3740 | ClientDataSetFeedsLys.Value := ClientDataSetFeedsLys.Value + ClientDataSetIngredientsLys.Value * Ratio; |
||
3741 | ClientDataSetFeedsLysd.Value := ClientDataSetFeedsLysd.Value + ClientDataSetIngredientsLysd.Value * Ratio; |
||
3742 | end;
|
||
3743 | if not ClientDataSetFeedsThr.IsNull |
||
3744 | then
|
||
3745 | if ClientDataSetIngredientsThr.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3746 | then
|
||
3747 | begin
|
||
3748 | ClientDataSetFeedsThr.Clear; |
||
3749 | ClientDataSetFeedsThrd.Clear; |
||
3750 | end
|
||
3751 | else
|
||
3752 | begin
|
||
3753 | ClientDataSetFeedsThr.Value := ClientDataSetFeedsThr.Value + ClientDataSetIngredientsThr.Value * Ratio; |
||
3754 | ClientDataSetFeedsThrd.Value := ClientDataSetFeedsThrd.Value + ClientDataSetIngredientsThrd.Value * Ratio; |
||
3755 | end;
|
||
3756 | if not ClientDataSetFeedsMet.IsNull |
||
3757 | then
|
||
3758 | if ClientDataSetIngredientsMet.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3759 | then
|
||
3760 | begin
|
||
3761 | ClientDataSetFeedsMet.Clear; |
||
3762 | ClientDataSetFeedsMetd.Clear; |
||
3763 | end
|
||
3764 | else
|
||
3765 | begin
|
||
3766 | ClientDataSetFeedsMet.Value := ClientDataSetFeedsMet.Value + ClientDataSetIngredientsMet.Value * Ratio; |
||
3767 | ClientDataSetFeedsMetd.Value := ClientDataSetFeedsMetd.Value + ClientDataSetIngredientsMetd.Value * Ratio; |
||
3768 | end;
|
||
3769 | if not ClientDataSetFeedsCys.IsNull |
||
3770 | then
|
||
3771 | if ClientDataSetIngredientsCys.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3772 | then
|
||
3773 | begin
|
||
3774 | ClientDataSetFeedsCys.Clear; |
||
3775 | ClientDataSetFeedsCysd.Clear; |
||
3776 | end
|
||
3777 | else
|
||
3778 | begin
|
||
3779 | ClientDataSetFeedsCys.Value := ClientDataSetFeedsCys.Value + ClientDataSetIngredientsCys.Value * Ratio; |
||
3780 | ClientDataSetFeedsCysd.Value := ClientDataSetFeedsCysd.Value + ClientDataSetIngredientsCysd.Value * Ratio; |
||
3781 | end;
|
||
3782 | if not ClientDataSetFeedsMetCys.IsNull |
||
3783 | then
|
||
3784 | if ClientDataSetIngredientsMetCys.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3785 | then
|
||
3786 | begin
|
||
3787 | ClientDataSetFeedsMetCys.Clear; |
||
3788 | ClientDataSetFeedsMetCysd.Clear; |
||
3789 | end
|
||
3790 | else
|
||
3791 | begin
|
||
3792 | ClientDataSetFeedsMetCys.Value := ClientDataSetFeedsMetCys.Value + ClientDataSetIngredientsMetCys.Value * Ratio; |
||
3793 | ClientDataSetFeedsMetCysd.Value := ClientDataSetFeedsMetCysd.Value + ClientDataSetIngredientsMetCysd.Value * Ratio; |
||
3794 | end;
|
||
3795 | if not ClientDataSetFeedsTrp.IsNull |
||
3796 | then
|
||
3797 | if ClientDataSetIngredientsTrp.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3798 | then
|
||
3799 | begin
|
||
3800 | ClientDataSetFeedsTrp.Clear; |
||
3801 | ClientDataSetFeedsTrpd.Clear; |
||
3802 | end
|
||
3803 | else
|
||
3804 | begin
|
||
3805 | ClientDataSetFeedsTrp.Value := ClientDataSetFeedsTrp.Value + ClientDataSetIngredientsTrp.Value * Ratio; |
||
3806 | ClientDataSetFeedsTrpd.Value := ClientDataSetFeedsTrpd.Value + ClientDataSetIngredientsTrpd.Value * Ratio; |
||
3807 | end;
|
||
3808 | if not ClientDataSetFeedsIle.IsNull |
||
3809 | then
|
||
3810 | if ClientDataSetIngredientsIle.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3811 | then
|
||
3812 | begin
|
||
3813 | ClientDataSetFeedsIle.Clear; |
||
3814 | ClientDataSetFeedsIled.Clear; |
||
3815 | end
|
||
3816 | else
|
||
3817 | begin
|
||
3818 | ClientDataSetFeedsIle.Value := ClientDataSetFeedsIle.Value + ClientDataSetIngredientsIle.Value * Ratio; |
||
3819 | ClientDataSetFeedsIled.Value := ClientDataSetFeedsIled.Value + ClientDataSetIngredientsIled.Value * Ratio; |
||
3820 | end;
|
||
3821 | if not ClientDataSetFeedsVal.IsNull |
||
3822 | then
|
||
3823 | if ClientDataSetIngredientsVal.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3824 | then
|
||
3825 | begin
|
||
3826 | ClientDataSetFeedsVal.Clear; |
||
3827 | ClientDataSetFeedsVald.Clear; |
||
3828 | end
|
||
3829 | else
|
||
3830 | begin
|
||
3831 | ClientDataSetFeedsVal.Value := ClientDataSetFeedsVal.Value + ClientDataSetIngredientsVal.Value * Ratio; |
||
3832 | ClientDataSetFeedsVald.Value := ClientDataSetFeedsVald.Value + ClientDataSetIngredientsVald.Value * Ratio; |
||
3833 | end;
|
||
3834 | if not ClientDataSetFeedsLeu.IsNull |
||
3835 | then
|
||
3836 | if ClientDataSetIngredientsLeu.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3837 | then
|
||
3838 | begin
|
||
3839 | ClientDataSetFeedsLeu.Clear; |
||
3840 | ClientDataSetFeedsLeud.Clear; |
||
3841 | end
|
||
3842 | else
|
||
3843 | begin
|
||
3844 | ClientDataSetFeedsLeu.Value := ClientDataSetFeedsLeu.Value + ClientDataSetIngredientsLeu.Value * Ratio; |
||
3845 | ClientDataSetFeedsLeud.Value := ClientDataSetFeedsLeud.Value + ClientDataSetIngredientsLeud.Value * Ratio; |
||
3846 | end;
|
||
3847 | if not ClientDataSetFeedsPhe.IsNull |
||
3848 | then
|
||
3849 | if ClientDataSetIngredientsPhe.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3850 | then
|
||
3851 | begin
|
||
3852 | ClientDataSetFeedsPhe.Clear; |
||
3853 | ClientDataSetFeedsPhed.Clear; |
||
3854 | end
|
||
3855 | else
|
||
3856 | begin
|
||
3857 | ClientDataSetFeedsPhe.Value := ClientDataSetFeedsPhe.Value + ClientDataSetIngredientsPhe.Value * Ratio; |
||
3858 | ClientDataSetFeedsPhed.Value := ClientDataSetFeedsPhed.Value + ClientDataSetIngredientsPhed.Value * Ratio; |
||
3859 | end;
|
||
3860 | if not ClientDataSetFeedsTyr.IsNull |
||
3861 | then
|
||
3862 | if ClientDataSetIngredientsTyr.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3863 | then
|
||
3864 | begin
|
||
3865 | ClientDataSetFeedsTyr.Clear; |
||
3866 | ClientDataSetFeedsTyrd.Clear; |
||
3867 | end
|
||
3868 | else
|
||
3869 | begin
|
||
3870 | ClientDataSetFeedsTyr.Value := ClientDataSetFeedsTyr.Value + ClientDataSetIngredientsTyr.Value * Ratio; |
||
3871 | ClientDataSetFeedsTyrd.Value := ClientDataSetFeedsTyrd.Value + ClientDataSetIngredientsTyrd.Value * Ratio; |
||
3872 | end;
|
||
3873 | if not ClientDataSetFeedsPheTyr.IsNull |
||
3874 | then
|
||
3875 | if ClientDataSetIngredientsPheTyr.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3876 | then
|
||
3877 | begin
|
||
3878 | ClientDataSetFeedsPheTyr.Clear; |
||
3879 | ClientDataSetFeedsPheTyrd.Clear; |
||
3880 | end
|
||
3881 | else
|
||
3882 | begin
|
||
3883 | ClientDataSetFeedsPheTyr.Value := ClientDataSetFeedsPheTyr.Value + ClientDataSetIngredientsPheTyr.Value * Ratio; |
||
3884 | ClientDataSetFeedsPheTyrd.Value := ClientDataSetFeedsPheTyrd.Value + ClientDataSetIngredientsPheTyrd.Value * Ratio; |
||
3885 | end;
|
||
3886 | if not ClientDataSetFeedsHis.IsNull |
||
3887 | then
|
||
3888 | if ClientDataSetIngredientsHis.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3889 | then
|
||
3890 | begin
|
||
3891 | ClientDataSetFeedsHis.Clear; |
||
3892 | ClientDataSetFeedsHisd.Clear; |
||
3893 | end
|
||
3894 | else
|
||
3895 | begin
|
||
3896 | ClientDataSetFeedsHis.Value := ClientDataSetFeedsHis.Value + ClientDataSetIngredientsHis.Value * Ratio; |
||
3897 | ClientDataSetFeedsHisd.Value := ClientDataSetFeedsHisd.Value + ClientDataSetIngredientsHisd.Value * Ratio; |
||
3898 | end;
|
||
3899 | if not ClientDataSetFeedsArg.IsNull |
||
3900 | then
|
||
3901 | if ClientDataSetIngredientsArg.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3902 | then
|
||
3903 | begin
|
||
3904 | ClientDataSetFeedsArg.Clear; |
||
3905 | ClientDataSetFeedsArgd.Clear; |
||
3906 | end
|
||
3907 | else
|
||
3908 | begin
|
||
3909 | ClientDataSetFeedsArg.Value := ClientDataSetFeedsArg.Value + ClientDataSetIngredientsArg.Value * Ratio; |
||
3910 | ClientDataSetFeedsArgd.Value := ClientDataSetFeedsArgd.Value + ClientDataSetIngredientsArgd.Value * Ratio; |
||
3911 | end;
|
||
3912 | if not ClientDataSetFeedsAla.IsNull |
||
3913 | then
|
||
3914 | if ClientDataSetIngredientsAla.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3915 | then
|
||
3916 | begin
|
||
3917 | ClientDataSetFeedsAla.Clear; |
||
3918 | ClientDataSetFeedsAlad.Clear; |
||
3919 | end
|
||
3920 | else
|
||
3921 | begin
|
||
3922 | ClientDataSetFeedsAla.Value := ClientDataSetFeedsAla.Value + ClientDataSetIngredientsAla.Value * Ratio; |
||
3923 | ClientDataSetFeedsAlad.Value := ClientDataSetFeedsAlad.Value + ClientDataSetIngredientsAlad.Value * Ratio; |
||
3924 | end;
|
||
3925 | if not ClientDataSetFeedsAsp.IsNull |
||
3926 | then
|
||
3927 | if ClientDataSetIngredientsAsp.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3928 | then
|
||
3929 | begin
|
||
3930 | ClientDataSetFeedsAsp.Clear; |
||
3931 | ClientDataSetFeedsAspd.Clear; |
||
3932 | end
|
||
3933 | else
|
||
3934 | begin
|
||
3935 | ClientDataSetFeedsAsp.Value := ClientDataSetFeedsAsp.Value + ClientDataSetIngredientsAsp.Value * Ratio; |
||
3936 | ClientDataSetFeedsAspd.Value := ClientDataSetFeedsAspd.Value + ClientDataSetIngredientsAspd.Value * Ratio; |
||
3937 | end;
|
||
3938 | if not ClientDataSetFeedsGlu.IsNull |
||
3939 | then
|
||
3940 | if ClientDataSetIngredientsGlu.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3941 | then
|
||
3942 | begin
|
||
3943 | ClientDataSetFeedsGlu.Clear; |
||
3944 | ClientDataSetFeedsGlud.Clear; |
||
3945 | end
|
||
3946 | else
|
||
3947 | begin
|
||
3948 | ClientDataSetFeedsGlu.Value := ClientDataSetFeedsGlu.Value + ClientDataSetIngredientsGlu.Value * Ratio; |
||
3949 | ClientDataSetFeedsGlud.Value := ClientDataSetFeedsGlud.Value + ClientDataSetIngredientsGlud.Value * Ratio; |
||
3950 | end;
|
||
3951 | if not ClientDataSetFeedsGly.IsNull |
||
3952 | then
|
||
3953 | if ClientDataSetIngredientsGly.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3954 | then
|
||
3955 | begin
|
||
3956 | ClientDataSetFeedsGly.Clear; |
||
3957 | ClientDataSetFeedsGlyd.Clear; |
||
3958 | end
|
||
3959 | else
|
||
3960 | begin
|
||
3961 | ClientDataSetFeedsGly.Value := ClientDataSetFeedsGly.Value + ClientDataSetIngredientsGly.Value * Ratio; |
||
3962 | ClientDataSetFeedsGlyd.Value := ClientDataSetFeedsGlyd.Value + ClientDataSetIngredientsGlyd.Value * Ratio; |
||
3963 | end;
|
||
3964 | if not ClientDataSetFeedsSer.IsNull |
||
3965 | then
|
||
3966 | if ClientDataSetIngredientsSer.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3967 | then
|
||
3968 | begin
|
||
3969 | ClientDataSetFeedsSer.Clear; |
||
3970 | ClientDataSetFeedsSerd.Clear; |
||
3971 | end
|
||
3972 | else
|
||
3973 | begin
|
||
3974 | ClientDataSetFeedsSer.Value := ClientDataSetFeedsSer.Value + ClientDataSetIngredientsSer.Value * Ratio; |
||
3975 | ClientDataSetFeedsSerd.Value := ClientDataSetFeedsSerd.Value + ClientDataSetIngredientsSerd.Value * Ratio; |
||
3976 | end;
|
||
3977 | if not ClientDataSetFeedsPro.IsNull |
||
3978 | then
|
||
3979 | if ClientDataSetIngredientsPro.IsNull and (ClientDataSetIngredientsMAT.Value <> 0) |
||
3980 | then
|
||
3981 | begin
|
||
3982 | ClientDataSetFeedsPro.Clear; |
||
3983 | ClientDataSetFeedsProd.Clear; |
||
3984 | end
|
||
3985 | else
|
||
3986 | begin
|
||
3987 | ClientDataSetFeedsPro.Value := ClientDataSetFeedsPro.Value + ClientDataSetIngredientsPro.Value * Ratio; |
||
3988 | ClientDataSetFeedsProd.Value := ClientDataSetFeedsProd.Value + ClientDataSetIngredientsProd.Value * Ratio; |
||
3989 | end;
|
||
3990 | // Min?raux
|
||
3991 | if not ClientDataSetFeedsCa.IsNull |
||
3992 | then
|
||
3993 | if ClientDataSetIngredientsCa.IsNull and (ClientDataSetIngredientsMM.Value <> 0) |
||
3994 | then
|
||
3995 | ClientDataSetFeedsCa.Clear |
||
3996 | else
|
||
3997 | ClientDataSetFeedsCa.Value := ClientDataSetFeedsCa.Value + ClientDataSetIngredientsCa.Value * Ratio; |
||
3998 | if not ClientDataSetFeedsP.IsNull |
||
3999 | then
|
||
4000 | if ClientDataSetIngredientsP.IsNull and (ClientDataSetIngredientsMM.Value <> 0) |
||
4001 | then
|
||
4002 | ClientDataSetFeedsP.Clear |
||
4003 | else
|
||
4004 | ClientDataSetFeedsP.Value := ClientDataSetFeedsP.Value + ClientDataSetIngredientsP.Value * Ratio; |
||
4005 | 3 | avalancogn | if not ClientDataSetFeedsNa.IsNull |
4006 | then
|
||
4007 | if ClientDataSetIngredientsNa.IsNull and (ClientDataSetIngredientsMM.Value <> 0) |
||
4008 | then
|
||
4009 | ClientDataSetFeedsNa.Clear |
||
4010 | else
|
||
4011 | ClientDataSetFeedsNa.Value := ClientDataSetFeedsNa.Value + ClientDataSetIngredientsNa.Value * Ratio; |
||
4012 | if not ClientDataSetFeedsK.IsNull |
||
4013 | then
|
||
4014 | if ClientDataSetIngredientsK.IsNull and (ClientDataSetIngredientsMM.Value <> 0) |
||
4015 | then
|
||
4016 | ClientDataSetFeedsK.Clear |
||
4017 | else
|
||
4018 | ClientDataSetFeedsK.Value := ClientDataSetFeedsK.Value + ClientDataSetIngredientsK.Value * Ratio; |
||
4019 | if not ClientDataSetFeedsCl.IsNull |
||
4020 | then
|
||
4021 | if ClientDataSetIngredientsCl.IsNull and (ClientDataSetIngredientsMM.Value <> 0) |
||
4022 | then
|
||
4023 | ClientDataSetFeedsCl.Clear |
||
4024 | else
|
||
4025 | ClientDataSetFeedsCl.Value := ClientDataSetFeedsCl.Value + ClientDataSetIngredientsCl.Value * Ratio; |
||
4026 | 1 | avalancogn | if not ClientDataSetFeedsPd.IsNull |
4027 | then
|
||
4028 | if ClientDataSetFeedsPresentation.Value = 0 |
||
4029 | then // Farine (dPphy) |
||
4030 | if ClientDataSetIngredientsdPphy.IsNull and (ClientDataSetIngredientsP.Value <> 0) and (ClientDataSetIngredientsMM.Value <> 0) |
||
4031 | then
|
||
4032 | ClientDataSetFeedsPd.Clear |
||
4033 | else
|
||
4034 | ClientDataSetFeedsPd.Value := ClientDataSetFeedsPd.Value + (ClientDataSetIngredientsdPphy.Value / 100 * ClientDataSetIngredientsP.Value) * Ratio
|
||
4035 | else // Granul?s (dP) |
||
4036 | if ClientDataSetIngredientsdP.IsNull and (ClientDataSetIngredientsP.Value <> 0) and (ClientDataSetIngredientsMM.Value <> 0) |
||
4037 | then
|
||
4038 | ClientDataSetFeedsPd.Clear |
||
4039 | else
|
||
4040 | ClientDataSetFeedsPd.Value := ClientDataSetFeedsPd.Value + (ClientDataSetIngredientsdP.Value / 100 * ClientDataSetIngredientsP.Value) * Ratio;
|
||
4041 | PdEndo := PdEndo + ((ClientDataSetIngredientsdPphy.Value - ClientDataSetIngredientsdP.Value) / 100 * ClientDataSetIngredientsP.Value) * Ratio;
|
||
4042 | ClientDataSetIngredients.Filtered := False; |
||
4043 | ClientDataSetIngredients.Filter := '';
|
||
4044 | ClientDataSetComposition.Next; |
||
4045 | end;
|
||
4046 | // Phytase
|
||
4047 | if not TableFeeds.FieldIsNull(TableFeeds.FieldIndex['Phytase']) |
||
4048 | and not ClientDataSetFeedsPd.IsNull |
||
4049 | then // Phosphore digestible lib?r? par la phytase |
||
4050 | begin
|
||
4051 | PhytaseMicro := ClientDataSetFeedsPhytaseIncorporation.Value; |
||
4052 | ClientDataSetPhytase.Locate('Id', ClientDataSetFeedsPhytaseId.Value, []);
|
||
4053 | CoefPhytase := ClientDataSetPhytaseCoef.Value; |
||
4054 | if ClientDataSetFeedsPresentation.Value = 0 |
||
4055 | then // Farine (dPphy) |
||
4056 | begin
|
||
4057 | if FormOptions.Minerals = 0 |
||
4058 | then // Conversion % -> g/kg |
||
4059 | PdEndo := PdEndo / 100 * 1000; |
||
4060 | PdEndo := Min(PdEndo, 0.4); // Limiter ? 0.4 g/kg |
||
4061 | PhytaseEndo := -Ln(1 - PdEndo / a) / (b * CoefPhytase);
|
||
4062 | PdMicro := a * (1 - Exp(-b * (PhytaseMicro + PhytaseEndo) * CoefPhytase))
|
||
4063 | - a * (1 - Exp(-b * PhytaseEndo * CoefPhytase));
|
||
4064 | end
|
||
4065 | else // Granul?s (dP) |
||
4066 | PdMicro := a * (1 - Exp(-b * PhytaseMicro * CoefPhytase));
|
||
4067 | if FormOptions.Minerals = 0 |
||
4068 | then // Conversion g/kg -> % |
||
4069 | PdMicro := PdMicro / 1000 * 100; |
||
4070 | ClientDataSetFeedsPd.Value := ClientDataSetFeedsPd.Value + PdMicro; |
||
4071 | end;
|
||
4072 | RapMS := InputProximal(ClientDataSetFeedsMS.Value, 1, 1, FormOptions.Proximal); |
||
4073 | ClientDataSetFeedsMS2.Value := OutputProximal(1, RapMS, FormOptions.Expression, FormOptions.Proximal);
|
||
4074 | if FormOptions.Expression = 1 |
||
4075 | then // Conversion frais -> sec (mati?re s?che du r?gime) |
||
4076 | begin
|
||
4077 | // Analyse proximale
|
||
4078 | ClientDataSetFeedsMM.Value := ClientDataSetFeedsMM.Value / RapMS; |
||
4079 | ClientDataSetFeedsMAT.Value := ClientDataSetFeedsMAT.Value / RapMS; |
||
4080 | if not ClientDataSetFeedsMG.IsNull |
||
4081 | then
|
||
4082 | ClientDataSetFeedsMG.Value := ClientDataSetFeedsMG.Value / RapMS; |
||
4083 | if not ClientDataSetFeedsCB.IsNull |
||
4084 | then
|
||
4085 | ClientDataSetFeedsCB.Value := ClientDataSetFeedsCB.Value / RapMS; |
||
4086 | if not ClientDataSetFeedsNDF.IsNull |
||
4087 | then
|
||
4088 | ClientDataSetFeedsNDF.Value := ClientDataSetFeedsNDF.Value / RapMS; |
||
4089 | if not ClientDataSetFeedsADF.IsNull |
||
4090 | then
|
||
4091 | ClientDataSetFeedsADF.Value := ClientDataSetFeedsADF.Value / RapMS; |
||
4092 | if not ClientDataSetFeedsADL.IsNull |
||
4093 | then
|
||
4094 | ClientDataSetFeedsADL.Value := ClientDataSetFeedsADL.Value / RapMS; |
||
4095 | if not ClientDataSetFeedsAmidon.IsNull |
||
4096 | then
|
||
4097 | ClientDataSetFeedsAmidon.Value := ClientDataSetFeedsAmidon.Value / RapMS; |
||
4098 | if not ClientDataSetFeedsSucres.IsNull |
||
4099 | then
|
||
4100 | ClientDataSetFeedsSucres.Value := ClientDataSetFeedsSucres.Value / RapMS; |
||
4101 | // Energie
|
||
4102 | if not ClientDataSetFeedsEB.IsNull |
||
4103 | then
|
||
4104 | ClientDataSetFeedsEB.Value := ClientDataSetFeedsEB.Value / RapMS; |
||
4105 | if not ClientDataSetFeedsEDc.IsNull |
||
4106 | then
|
||
4107 | ClientDataSetFeedsEDc.Value := ClientDataSetFeedsEDc.Value / RapMS; |
||
4108 | if not ClientDataSetFeedsEMc.IsNull |
||
4109 | then
|
||
4110 | ClientDataSetFeedsEMc.Value := ClientDataSetFeedsEMc.Value / RapMS; |
||
4111 | if not ClientDataSetFeedsENc.IsNull |
||
4112 | then
|
||
4113 | ClientDataSetFeedsENc.Value := ClientDataSetFeedsENc.Value / RapMS; |
||
4114 | if not ClientDataSetFeedsEDt.IsNull |
||
4115 | then
|
||
4116 | ClientDataSetFeedsEDt.Value := ClientDataSetFeedsEDt.Value / RapMS; |
||
4117 | if not ClientDataSetFeedsEMt.IsNull |
||
4118 | then
|
||
4119 | ClientDataSetFeedsEMt.Value := ClientDataSetFeedsEMt.Value / RapMS; |
||
4120 | if not ClientDataSetFeedsENt.IsNull |
||
4121 | then
|
||
4122 | ClientDataSetFeedsENt.Value := ClientDataSetFeedsENt.Value / RapMS; |
||
4123 | // Digestibilit? f?cale de l'azote
|
||
4124 | if not ClientDataSetFeedsdNc.IsNull |
||
4125 | then
|
||
4126 | ClientDataSetFeedsdNc.Value := ClientDataSetFeedsdNc.Value / RapMS; |
||
4127 | if not ClientDataSetFeedsdNt.IsNull |
||
4128 | then
|
||
4129 | ClientDataSetFeedsdNt.Value := ClientDataSetFeedsdNt.Value / RapMS; |
||
4130 | // Acides amin?s
|
||
4131 | if not ClientDataSetFeedsLys.IsNull |
||
4132 | then
|
||
4133 | begin
|
||
4134 | ClientDataSetFeedsLys.Value := ClientDataSetFeedsLys.Value / RapMS; |
||
4135 | ClientDataSetFeedsLysd.Value := ClientDataSetFeedsLysd.Value / RapMS; |
||
4136 | end;
|
||
4137 | if not ClientDataSetFeedsThr.IsNull |
||
4138 | then
|
||
4139 | begin
|
||
4140 | ClientDataSetFeedsThr.Value := ClientDataSetFeedsThr.Value / RapMS; |
||
4141 | ClientDataSetFeedsThrd.Value := ClientDataSetFeedsThrd.Value / RapMS; |
||
4142 | end;
|
||
4143 | if not ClientDataSetFeedsMet.IsNull |
||
4144 | then
|
||
4145 | begin
|
||
4146 | ClientDataSetFeedsMet.Value := ClientDataSetFeedsMet.Value / RapMS; |
||
4147 | ClientDataSetFeedsMetd.Value := ClientDataSetFeedsMetd.Value / RapMS; |
||
4148 | end;
|
||
4149 | if not ClientDataSetFeedsCys.IsNull |
||
4150 | then
|
||
4151 | begin
|
||
4152 | ClientDataSetFeedsCys.Value := ClientDataSetFeedsCys.Value / RapMS; |
||
4153 | ClientDataSetFeedsCysd.Value := ClientDataSetFeedsCysd.Value / RapMS; |
||
4154 | end;
|
||
4155 | if not ClientDataSetFeedsMetCys.IsNull |
||
4156 | then
|
||
4157 | begin
|
||
4158 | ClientDataSetFeedsMetCys.Value := ClientDataSetFeedsMetCys.Value / RapMS; |
||
4159 | ClientDataSetFeedsMetCysd.Value := ClientDataSetFeedsMetCysd.Value / RapMS; |
||
4160 | end;
|
||
4161 | if not ClientDataSetFeedsTrp.IsNull |
||
4162 | then
|
||
4163 | begin
|
||
4164 | ClientDataSetFeedsTrp.Value := ClientDataSetFeedsTrp.Value / RapMS; |
||
4165 | ClientDataSetFeedsTrpd.Value := ClientDataSetFeedsTrpd.Value / RapMS; |
||
4166 | end;
|
||
4167 | if not ClientDataSetFeedsIle.IsNull |
||
4168 | then
|
||
4169 | begin
|
||
4170 | ClientDataSetFeedsIle.Value := ClientDataSetFeedsIle.Value / RapMS; |
||
4171 | ClientDataSetFeedsIled.Value := ClientDataSetFeedsIled.Value / RapMS; |
||
4172 | end;
|
||
4173 | if not ClientDataSetFeedsVal.IsNull |
||
4174 | then
|
||
4175 | begin
|
||
4176 | ClientDataSetFeedsVal.Value := ClientDataSetFeedsVal.Value / RapMS; |
||
4177 | ClientDataSetFeedsVald.Value := ClientDataSetFeedsVald.Value / RapMS; |
||
4178 | end;
|
||
4179 | if not ClientDataSetFeedsLeu.IsNull |
||
4180 | then
|
||
4181 | begin
|
||
4182 | ClientDataSetFeedsLeu.Value := ClientDataSetFeedsLeu.Value / RapMS; |
||
4183 | ClientDataSetFeedsLeud.Value := ClientDataSetFeedsLeud.Value / RapMS; |
||
4184 | end;
|
||
4185 | if not ClientDataSetFeedsPhe.IsNull |
||
4186 | then
|
||
4187 | begin
|
||
4188 | ClientDataSetFeedsPhe.Value := ClientDataSetFeedsPhe.Value / RapMS; |
||
4189 | ClientDataSetFeedsPhed.Value := ClientDataSetFeedsPhed.Value / RapMS; |
||
4190 | end;
|
||
4191 | if not ClientDataSetFeedsTyr.IsNull |
||
4192 | then
|
||
4193 | begin
|
||
4194 | ClientDataSetFeedsTyr.Value := ClientDataSetFeedsTyr.Value / RapMS; |
||
4195 | ClientDataSetFeedsTyrd.Value := ClientDataSetFeedsTyrd.Value / RapMS; |
||
4196 | end;
|
||
4197 | if not ClientDataSetFeedsPheTyr.IsNull |
||
4198 | then
|
||
4199 | begin
|
||
4200 | ClientDataSetFeedsPheTyr.Value := ClientDataSetFeedsPheTyr.Value / RapMS; |
||
4201 | ClientDataSetFeedsPheTyrd.Value := ClientDataSetFeedsPheTyrd.Value / RapMS; |
||
4202 | end;
|
||
4203 | if not ClientDataSetFeedsHis.IsNull |
||
4204 | then
|
||
4205 | begin
|
||
4206 | ClientDataSetFeedsHis.Value := ClientDataSetFeedsHis.Value / RapMS; |
||
4207 | ClientDataSetFeedsHisd.Value := ClientDataSetFeedsHisd.Value / RapMS; |
||
4208 | end;
|
||
4209 | if not ClientDataSetFeedsArg.IsNull |
||
4210 | then
|
||
4211 | begin
|
||
4212 | ClientDataSetFeedsArg.Value := ClientDataSetFeedsArg.Value / RapMS; |
||
4213 | ClientDataSetFeedsArgd.Value := ClientDataSetFeedsArgd.Value / RapMS; |
||
4214 | end;
|
||
4215 | if not ClientDataSetFeedsAla.IsNull |
||
4216 | then
|
||
4217 | begin
|
||
4218 | ClientDataSetFeedsAla.Value := ClientDataSetFeedsAla.Value / RapMS; |
||
4219 | ClientDataSetFeedsAlad.Value := ClientDataSetFeedsAlad.Value / RapMS; |
||
4220 | end;
|
||
4221 | if not ClientDataSetFeedsAsp.IsNull |
||
4222 | then
|
||
4223 | begin
|
||
4224 | ClientDataSetFeedsAsp.Value := ClientDataSetFeedsAsp.Value / RapMS; |
||
4225 | ClientDataSetFeedsAspd.Value := ClientDataSetFeedsAspd.Value / RapMS; |
||
4226 | end;
|
||
4227 | if not ClientDataSetFeedsGlu.IsNull |
||
4228 | then
|
||
4229 | begin
|
||
4230 | ClientDataSetFeedsGlu.Value := ClientDataSetFeedsGlu.Value / RapMS; |
||
4231 | ClientDataSetFeedsGlud.Value := ClientDataSetFeedsGlud.Value / RapMS; |
||
4232 | end;
|
||
4233 | if not ClientDataSetFeedsGly.IsNull |
||
4234 | then
|
||
4235 | begin
|
||
4236 | ClientDataSetFeedsGly.Value := ClientDataSetFeedsGly.Value / RapMS; |
||
4237 | ClientDataSetFeedsGlyd.Value := ClientDataSetFeedsGlyd.Value / RapMS; |
||
4238 | end;
|
||
4239 | if not ClientDataSetFeedsSer.IsNull |
||
4240 | then
|
||
4241 | begin
|
||
4242 | ClientDataSetFeedsSer.Value := ClientDataSetFeedsSer.Value / RapMS; |
||
4243 | ClientDataSetFeedsSerd.Value := ClientDataSetFeedsSerd.Value / RapMS; |
||
4244 | end;
|
||
4245 | if not ClientDataSetFeedsPro.IsNull |
||
4246 | then
|
||
4247 | begin
|
||
4248 | ClientDataSetFeedsPro.Value := ClientDataSetFeedsPro.Value / RapMS; |
||
4249 | ClientDataSetFeedsProd.Value := ClientDataSetFeedsProd.Value / RapMS; |
||
4250 | end;
|
||
4251 | // Min?raux
|
||
4252 | if not ClientDataSetFeedsCa.IsNull |
||
4253 | then
|
||
4254 | ClientDataSetFeedsCa.Value := ClientDataSetFeedsCa.Value / RapMS; |
||
4255 | if not ClientDataSetFeedsP.IsNull |
||
4256 | then
|
||
4257 | ClientDataSetFeedsP.Value := ClientDataSetFeedsP.Value / RapMS; |
||
4258 | 3 | avalancogn | if not ClientDataSetFeedsNa.IsNull |
4259 | then
|
||
4260 | ClientDataSetFeedsNa.Value := ClientDataSetFeedsNa.Value / RapMS; |
||
4261 | if not ClientDataSetFeedsK.IsNull |
||
4262 | then
|
||
4263 | ClientDataSetFeedsK.Value := ClientDataSetFeedsK.Value / RapMS; |
||
4264 | if not ClientDataSetFeedsCl.IsNull |
||
4265 | then
|
||
4266 | ClientDataSetFeedsCl.Value := ClientDataSetFeedsCl.Value / RapMS; |
||
4267 | 1 | avalancogn | if not ClientDataSetFeedsPd.IsNull |
4268 | then
|
||
4269 | ClientDataSetFeedsPd.Value := ClientDataSetFeedsPd.Value / RapMS; |
||
4270 | end;
|
||
4271 | end;
|
||
4272 | 3 | avalancogn | if ClientDataSetFeedsNa.IsNull or ClientDataSetFeedsK.IsNull or ClientDataSetFeedsCl.IsNull |
4273 | then
|
||
4274 | ClientDataSetFeedsBE.Clear |
||
4275 | else
|
||
4276 | ClientDataSetFeedsBE.Value := CalcBilanElectrolytique(InputMinerals(ClientDataSetFeedsNa.Value, RapMS, FormOptions.Expression, FormOptions.Minerals), InputMinerals(ClientDataSetFeedsK.Value, RapMS, FormOptions.Expression, FormOptions.Minerals), InputMinerals(ClientDataSetFeedsCl.Value, RapMS, FormOptions.Expression, FormOptions.Minerals)); |
||
4277 | 1 | avalancogn | // Rapports
|
4278 | if ClientDataSetFeedsEDc.IsNull or ClientDataSetFeedsEB.IsNull or (ClientDataSetFeedsEB.Value = 0) |
||
4279 | then
|
||
4280 | ClientDataSetFeedsdEc.Clear |
||
4281 | else
|
||
4282 | ClientDataSetFeedsdEc.Value := ClientDataSetFeedsEDc.Value / ClientDataSetFeedsEB.Value * 100;
|
||
4283 | if ClientDataSetFeedsEMc.IsNull or ClientDataSetFeedsEDc.IsNull or (ClientDataSetFeedsEDc.Value = 0) |
||
4284 | then
|
||
4285 | ClientDataSetFeedsEMc_EDc.Clear |
||
4286 | else
|
||
4287 | ClientDataSetFeedsEMc_EDc.Value := ClientDataSetFeedsEMc.Value / ClientDataSetFeedsEDc.Value * 100;
|
||
4288 | if ClientDataSetFeedsENc.IsNull or ClientDataSetFeedsEMc.IsNull or (ClientDataSetFeedsEMc.Value = 0) |
||
4289 | then
|
||
4290 | ClientDataSetFeedsENc_EMc.Clear |
||
4291 | else
|
||
4292 | ClientDataSetFeedsENc_EMc.Value := ClientDataSetFeedsENc.Value / ClientDataSetFeedsEMc.Value * 100;
|
||
4293 | if ClientDataSetFeedsEDt.IsNull or ClientDataSetFeedsEB.IsNull or (ClientDataSetFeedsEB.Value = 0) |
||
4294 | then
|
||
4295 | ClientDataSetFeedsdEt.Clear |
||
4296 | else
|
||
4297 | ClientDataSetFeedsdEt.Value := ClientDataSetFeedsEDt.Value / ClientDataSetFeedsEB.Value * 100;
|
||
4298 | if ClientDataSetFeedsEMt.IsNull or ClientDataSetFeedsEDt.IsNull or (ClientDataSetFeedsEDt.Value = 0) |
||
4299 | then
|
||
4300 | ClientDataSetFeedsEMt_EDt.Clear |
||
4301 | else
|
||
4302 | ClientDataSetFeedsEMt_EDt.Value := ClientDataSetFeedsEMt.Value / ClientDataSetFeedsEDt.Value * 100;
|
||
4303 | if ClientDataSetFeedsENt.IsNull or ClientDataSetFeedsEMt.IsNull or (ClientDataSetFeedsEMt.Value = 0) |
||
4304 | then
|
||
4305 | ClientDataSetFeedsENt_EMt.Clear |
||
4306 | else
|
||
4307 | ClientDataSetFeedsENt_EMt.Value := ClientDataSetFeedsENt.Value / ClientDataSetFeedsEMt.Value * 100;
|
||
4308 | if ClientDataSetFeedsBonusC.Value <> 0 |
||
4309 | then // Prise en compte du bonus (porc croissance) |
||
4310 | begin
|
||
4311 | if not ClientDataSetFeedsdEc.IsNull |
||
4312 | then
|
||
4313 | ClientDataSetFeedsdEc.Value := ClientDataSetFeedsdEc.Value + ClientDataSetFeedsBonusC.Value; |
||
4314 | if not ClientDataSetFeedsEB.IsNull and not ClientDataSetFeedsdEc.IsNull |
||
4315 | then
|
||
4316 | ClientDataSetFeedsEDc.Value := ClientDataSetFeedsEB.Value * ClientDataSetFeedsdEc.Value / 100;
|
||
4317 | if not ClientDataSetFeedsEDc.IsNull and not ClientDataSetFeedsEMc_EDc.IsNull |
||
4318 | then
|
||
4319 | ClientDataSetFeedsEMc.Value := ClientDataSetFeedsEDc.Value * ClientDataSetFeedsEMc_EDc.Value / 100;
|
||
4320 | if not ClientDataSetFeedsEMc.IsNull and not ClientDataSetFeedsENc_EMc.IsNull |
||
4321 | then
|
||
4322 | ClientDataSetFeedsENc.Value := ClientDataSetFeedsEMc.Value * ClientDataSetFeedsENc_EMc.Value / 100;
|
||
4323 | end;
|
||
4324 | if ClientDataSetFeedsBonusT.Value <> 0 |
||
4325 | then // Prise en compte du bonus (porce adulte) |
||
4326 | begin
|
||
4327 | if not ClientDataSetFeedsdEt.IsNull |
||
4328 | then
|
||
4329 | ClientDataSetFeedsdEt.Value := ClientDataSetFeedsdEt.Value + ClientDataSetFeedsBonusT.Value; |
||
4330 | if not ClientDataSetFeedsEB.IsNull and not ClientDataSetFeedsdEt.IsNull |
||
4331 | then
|
||
4332 | ClientDataSetFeedsEDt.Value := ClientDataSetFeedsEB.Value * ClientDataSetFeedsdEt.Value / 100;
|
||
4333 | if not ClientDataSetFeedsEDt.IsNull and not ClientDataSetFeedsEMt_EDt.IsNull |
||
4334 | then
|
||
4335 | ClientDataSetFeedsEMt.Value := ClientDataSetFeedsEDt.Value * ClientDataSetFeedsEMt_EDt.Value / 100;
|
||
4336 | if not ClientDataSetFeedsEMt.IsNull and not ClientDataSetFeedsENt_EMt.IsNull |
||
4337 | then
|
||
4338 | ClientDataSetFeedsENt.Value := ClientDataSetFeedsEMt.Value * ClientDataSetFeedsENt_EMt.Value / 100;
|
||
4339 | end;
|
||
4340 | if ClientDataSetFeedsEDt.IsNull or ClientDataSetFeedsEDc.IsNull or (ClientDataSetFeedsEDc.Value = 0) |
||
4341 | then
|
||
4342 | ClientDataSetFeedsEDt_EDc.Clear |
||
4343 | else
|
||
4344 | ClientDataSetFeedsEDt_EDc.Value := ClientDataSetFeedsEDt.Value / ClientDataSetFeedsEDc.Value * 100;
|
||
4345 | if ClientDataSetFeedsEMt.IsNull or ClientDataSetFeedsEMc.IsNull or (ClientDataSetFeedsEMc.Value = 0) |
||
4346 | then
|
||
4347 | ClientDataSetFeedsEMt_EMc.Clear |
||
4348 | else
|
||
4349 | ClientDataSetFeedsEMt_EMc.Value := ClientDataSetFeedsEMt.Value / ClientDataSetFeedsEMc.Value * 100;
|
||
4350 | if ClientDataSetFeedsENt.IsNull or ClientDataSetFeedsENc.IsNull or (ClientDataSetFeedsENc.Value = 0) |
||
4351 | then
|
||
4352 | ClientDataSetFeedsENt_ENc.Clear |
||
4353 | else
|
||
4354 | ClientDataSetFeedsENt_ENc.Value := ClientDataSetFeedsENt.Value / ClientDataSetFeedsENc.Value * 100;
|
||
4355 | if not ClientDataSetFeedsdNc.IsNull |
||
4356 | then
|
||
4357 | if ClientDataSetFeedsMAT.IsNull or (ClientDataSetFeedsMAT.Value = 0) |
||
4358 | then
|
||
4359 | ClientDataSetFeedsdNc.Clear |
||
4360 | else // dN = MATd / MAT |
||
4361 | ClientDataSetFeedsdNc.Value := ClientDataSetFeedsdNc.Value / ClientDataSetFeedsMAT.Value * 100;
|
||
4362 | if not ClientDataSetFeedsdNt.IsNull |
||
4363 | then
|
||
4364 | if ClientDataSetFeedsMAT.IsNull or (ClientDataSetFeedsMAT.Value = 0) |
||
4365 | then
|
||
4366 | ClientDataSetFeedsdNt.Clear |
||
4367 | else // dN = MATd / MAT |
||
4368 | ClientDataSetFeedsdNt.Value := ClientDataSetFeedsdNt.Value / ClientDataSetFeedsMAT.Value * 100;
|
||
4369 | if ClientDataSetFeedsLysd.IsNull or ClientDataSetFeedsENc.IsNull or (ClientDataSetFeedsENc.Value = 0) |
||
4370 | then
|
||
4371 | ClientDataSetFeedsLysd_ENc.Clear |
||
4372 | else
|
||
4373 | if FormOptions.Energy = 0 |
||
4374 | then // g/MJ |
||
4375 | if FormOptions.AA = 0 |
||
4376 | then // % (conversion) |
||
4377 | ClientDataSetFeedsLysd_ENc.Value := ClientDataSetFeedsLysd.Value / 100 * 1000 / ClientDataSetFeedsENc.Value |
||
4378 | else // g/kg |
||
4379 | ClientDataSetFeedsLysd_ENc.Value := ClientDataSetFeedsLysd.Value / ClientDataSetFeedsENc.Value |
||
4380 | else // g/1000kcal |
||
4381 | if FormOptions.AA = 0 |
||
4382 | then // % (conversion) |
||
4383 | ClientDataSetFeedsLysd_ENc.Value := ClientDataSetFeedsLysd.Value / 100 * 1000 / ClientDataSetFeedsENc.Value * 1000 |
||
4384 | else // g/kg |
||
4385 | ClientDataSetFeedsLysd_ENc.Value := ClientDataSetFeedsLysd.Value / ClientDataSetFeedsENc.Value * 1000;
|
||
4386 | if ClientDataSetFeedsLysd.IsNull or ClientDataSetFeedsENt.IsNull or (ClientDataSetFeedsENt.Value = 0) |
||
4387 | then
|
||
4388 | ClientDataSetFeedsLysd_ENt.Clear |
||
4389 | else
|
||
4390 | if FormOptions.Energy = 0 |
||
4391 | then // g/MJ |
||
4392 | if FormOptions.AA = 0 |
||
4393 | then // % (conversion) |
||
4394 | ClientDataSetFeedsLysd_ENt.Value := ClientDataSetFeedsLysd.Value / 100 * 1000 / ClientDataSetFeedsENt.Value |
||
4395 | else // g/kg |
||
4396 | ClientDataSetFeedsLysd_ENt.Value := ClientDataSetFeedsLysd.Value / ClientDataSetFeedsENt.Value |
||
4397 | else // g/1000kcal |
||
4398 | if FormOptions.AA = 0 |
||
4399 | then // % (conversion) |
||
4400 | ClientDataSetFeedsLysd_ENt.Value := ClientDataSetFeedsLysd.Value / 100 * 1000 / ClientDataSetFeedsENt.Value * 1000 |
||
4401 | else // g/kg |
||
4402 | ClientDataSetFeedsLysd_ENt.Value := ClientDataSetFeedsLysd.Value / ClientDataSetFeedsENt.Value * 1000;
|
||
4403 | if ClientDataSetFeedsCa.IsNull or ClientDataSetFeedsPd.IsNull or (ClientDataSetFeedsPd.Value = 0) |
||
4404 | then
|
||
4405 | ClientDataSetFeedsCa_Pd.Clear |
||
4406 | else
|
||
4407 | ClientDataSetFeedsCa_Pd.Value := ClientDataSetFeedsCa.Value / ClientDataSetFeedsPd.Value; |
||
4408 | if ClientDataSetFeedsPd.IsNull or ClientDataSetFeedsENc.IsNull or (ClientDataSetFeedsENc.Value = 0) |
||
4409 | then
|
||
4410 | ClientDataSetFeedsPd_ENc.Clear |
||
4411 | else
|
||
4412 | if FormOptions.Energy = 0 |
||
4413 | then // g/MJ |
||
4414 | if FormOptions.Minerals = 0 |
||
4415 | then // % (conversion) |
||
4416 | ClientDataSetFeedsPd_ENc.Value := ClientDataSetFeedsPd.Value / 100 * 1000 / ClientDataSetFeedsENc.Value |
||
4417 | else // g/kg |
||
4418 | ClientDataSetFeedsPd_ENc.Value := ClientDataSetFeedsPd.Value / ClientDataSetFeedsENc.Value |
||
4419 | else // g/1000kcal |
||
4420 | if FormOptions.Minerals = 0 |
||
4421 | then // % (conversion) |
||
4422 | ClientDataSetFeedsPd_ENc.Value := ClientDataSetFeedsPd.Value / 100 * 1000 / ClientDataSetFeedsENc.Value * 1000 |
||
4423 | else // g/kg |
||
4424 | ClientDataSetFeedsPd_ENc.Value := ClientDataSetFeedsPd.Value / ClientDataSetFeedsENc.Value * 1000;
|
||
4425 | if ClientDataSetFeedsPd.IsNull or ClientDataSetFeedsENt.IsNull or (ClientDataSetFeedsENt.Value = 0) |
||
4426 | then
|
||
4427 | ClientDataSetFeedsPd_ENt.Clear |
||
4428 | else
|
||
4429 | if FormOptions.Energy = 0 |
||
4430 | then // g/MJ |
||
4431 | if FormOptions.Minerals = 0 |
||
4432 | then // % (conversion) |
||
4433 | ClientDataSetFeedsPd_ENt.Value := ClientDataSetFeedsPd.Value / 100 * 1000 / ClientDataSetFeedsENt.Value |
||
4434 | else // g/kg |
||
4435 | ClientDataSetFeedsPd_ENt.Value := ClientDataSetFeedsPd.Value / ClientDataSetFeedsENt.Value |
||
4436 | else // g/1000 kcal |
||
4437 | if FormOptions.Minerals = 0 |
||
4438 | then // % (conversion) |
||
4439 | ClientDataSetFeedsPd_ENt.Value := ClientDataSetFeedsPd.Value / 100 * 1000 / ClientDataSetFeedsENt.Value * 1000 |
||
4440 | else // g/kg |
||
4441 | ClientDataSetFeedsPd_ENt.Value := ClientDataSetFeedsPd.Value / ClientDataSetFeedsENt.Value * 1000;
|
||
4442 | if ClientDataSetFeedsThrd.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4443 | then
|
||
4444 | ClientDataSetFeedsThrd_Lysd.Clear |
||
4445 | else
|
||
4446 | ClientDataSetFeedsThrd_Lysd.Value := ClientDataSetFeedsThrd.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4447 | if ClientDataSetFeedsMetd.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4448 | then
|
||
4449 | ClientDataSetFeedsMetd_Lysd.Clear |
||
4450 | else
|
||
4451 | ClientDataSetFeedsMetd_Lysd.Value := ClientDataSetFeedsMetd.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4452 | if ClientDataSetFeedsCysd.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4453 | then
|
||
4454 | ClientDataSetFeedsCysd_Lysd.Clear |
||
4455 | else
|
||
4456 | ClientDataSetFeedsCysd_Lysd.Value := ClientDataSetFeedsCysd.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4457 | if ClientDataSetFeedsMetCysd.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4458 | then
|
||
4459 | ClientDataSetFeedsMetCysd_Lysd.Clear |
||
4460 | else
|
||
4461 | ClientDataSetFeedsMetCysd_Lysd.Value := ClientDataSetFeedsMetCysd.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4462 | if ClientDataSetFeedsTrpd.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4463 | then
|
||
4464 | ClientDataSetFeedsTrpd_Lysd.Clear |
||
4465 | else
|
||
4466 | ClientDataSetFeedsTrpd_Lysd.Value := ClientDataSetFeedsTrpd.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4467 | if ClientDataSetFeedsIled.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4468 | then
|
||
4469 | ClientDataSetFeedsIled_Lysd.Clear |
||
4470 | else
|
||
4471 | ClientDataSetFeedsIled_Lysd.Value := ClientDataSetFeedsIled.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4472 | if ClientDataSetFeedsVald.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4473 | then
|
||
4474 | ClientDataSetFeedsVald_Lysd.Clear |
||
4475 | else
|
||
4476 | ClientDataSetFeedsVald_Lysd.Value := ClientDataSetFeedsVald.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4477 | if ClientDataSetFeedsLeud.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4478 | then
|
||
4479 | ClientDataSetFeedsLeud_Lysd.Clear |
||
4480 | else
|
||
4481 | ClientDataSetFeedsLeud_Lysd.Value := ClientDataSetFeedsLeud.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4482 | if ClientDataSetFeedsPhed.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4483 | then
|
||
4484 | ClientDataSetFeedsPhed_Lysd.Clear |
||
4485 | else
|
||
4486 | ClientDataSetFeedsPhed_Lysd.Value := ClientDataSetFeedsPhed.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4487 | if ClientDataSetFeedsTyrd.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4488 | then
|
||
4489 | ClientDataSetFeedsTyrd_Lysd.Clear |
||
4490 | else
|
||
4491 | ClientDataSetFeedsTyrd_Lysd.Value := ClientDataSetFeedsTyrd.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4492 | if ClientDataSetFeedsPheTyrd.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4493 | then
|
||
4494 | ClientDataSetFeedsPheTyrd_Lysd.Clear |
||
4495 | else
|
||
4496 | ClientDataSetFeedsPheTyrd_Lysd.Value := ClientDataSetFeedsPheTyrd.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4497 | if ClientDataSetFeedsHisd.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4498 | then
|
||
4499 | ClientDataSetFeedsHisd_Lysd.Clear |
||
4500 | else
|
||
4501 | ClientDataSetFeedsHisd_Lysd.Value := ClientDataSetFeedsHisd.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4502 | if ClientDataSetFeedsArgd.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4503 | then
|
||
4504 | ClientDataSetFeedsArgd_Lysd.Clear |
||
4505 | else
|
||
4506 | ClientDataSetFeedsArgd_Lysd.Value := ClientDataSetFeedsArgd.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4507 | if ClientDataSetFeedsAlad.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4508 | then
|
||
4509 | ClientDataSetFeedsAlad_Lysd.Clear |
||
4510 | else
|
||
4511 | ClientDataSetFeedsAlad_Lysd.Value := ClientDataSetFeedsAlad.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4512 | if ClientDataSetFeedsAspd.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4513 | then
|
||
4514 | ClientDataSetFeedsAspd_Lysd.Clear |
||
4515 | else
|
||
4516 | ClientDataSetFeedsAspd_Lysd.Value := ClientDataSetFeedsAspd.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4517 | if ClientDataSetFeedsGlud.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4518 | then
|
||
4519 | ClientDataSetFeedsGlud_Lysd.Clear |
||
4520 | else
|
||
4521 | ClientDataSetFeedsGlud_Lysd.Value := ClientDataSetFeedsGlud.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4522 | if ClientDataSetFeedsGlyd.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4523 | then
|
||
4524 | ClientDataSetFeedsGlyd_Lysd.Clear |
||
4525 | else
|
||
4526 | ClientDataSetFeedsGlyd_Lysd.Value := ClientDataSetFeedsGlyd.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4527 | if ClientDataSetFeedsSerd.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4528 | then
|
||
4529 | ClientDataSetFeedsSerd_Lysd.Clear |
||
4530 | else
|
||
4531 | ClientDataSetFeedsSerd_Lysd.Value := ClientDataSetFeedsSerd.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4532 | if ClientDataSetFeedsProd.IsNull or ClientDataSetFeedsLysd.IsNull or (ClientDataSetFeedsLysd.Value = 0) |
||
4533 | then
|
||
4534 | ClientDataSetFeedsProd_Lysd.Clear |
||
4535 | else
|
||
4536 | ClientDataSetFeedsProd_Lysd.Value := ClientDataSetFeedsProd.Value / ClientDataSetFeedsLysd.Value * 100;
|
||
4537 | end;
|
||
4538 | |||
4539 | 3 | avalancogn | function TDataModuleDeclaration.CalcBilanElectrolytique(Na, K, Cl: Double): Double;
|
4540 | 1 | avalancogn | begin
|
4541 | 3 | avalancogn | Result := (Na / 23 + K / 39 - Cl / 35.5) * 1000000; |
4542 | if FormOptions.Expression = 0 |
||
4543 | then // sur frais |
||
4544 | Result := Result * RapMS; |
||
4545 | 1 | avalancogn | end;
|
4546 | |||
4547 | function TDataModuleDeclaration.InputProximal(Value, MS: Double; ExpressionMode, ProximalUnit: Integer): Double;
|
||
4548 | begin
|
||
4549 | if ProximalUnit = 0 |
||
4550 | then // % |
||
4551 | Result := Value / 100
|
||
4552 | else // g/kg |
||
4553 | Result := Value / 1000;
|
||
4554 | if ExpressionMode = 0 |
||
4555 | then // sur frais |
||
4556 | Result := Result / MS; |
||
4557 | end;
|
||
4558 | |||
4559 | function TDataModuleDeclaration.InputEnergy(Value, MS: Double; ExpressionMode, EnergyUnit: Integer): Double;
|
||
4560 | begin
|
||
4561 | if EnergyUnit = 0 |
||
4562 | then // MJ/kg |
||
4563 | Result := Value |
||
4564 | else // kcal/kg |
||
4565 | Result := Value * CALORIE / 1000;
|
||
4566 | if ExpressionMode = 0 |
||
4567 | then // sur frais |
||
4568 | Result := Result / MS; |
||
4569 | end;
|
||
4570 | |||
4571 | function TDataModuleDeclaration.InputAA(Value, MAT, MS: Double; ExpressionMode, AAUnit: Integer): Double;
|
||
4572 | begin
|
||
4573 | if AAUnit = 0 |
||
4574 | then // % |
||
4575 | Result := Value / MAT / 100
|
||
4576 | else // g/kg |
||
4577 | Result := Value / MAT / 1000;
|
||
4578 | if ExpressionMode = 0 |
||
4579 | then // sur frais |
||
4580 | Result := Result / MS; |
||
4581 | end;
|
||
4582 | |||
4583 | function TDataModuleDeclaration.InputMinerals(Value, MS: Double; ExpressionMode, MineralsUnit: Integer): Double;
|
||
4584 | begin
|
||
4585 | if MineralsUnit = 0 |
||
4586 | then // % |
||
4587 | Result := Value / 100
|
||
4588 | else // g/kg |
||
4589 | Result := Value / 1000;
|
||
4590 | if ExpressionMode = 0 |
||
4591 | then // sur frais |
||
4592 | Result := Result / MS; |
||
4593 | end;
|
||
4594 | |||
4595 | function TDataModuleDeclaration.InputIncorporation(Value: Double; IncorporationUnit: Integer): Double;
|
||
4596 | begin
|
||
4597 | if IncorporationUnit = 0 |
||
4598 | then // % |
||
4599 | Result := Value / 100
|
||
4600 | else // g/kg |
||
4601 | Result := Value / 1000;
|
||
4602 | end;
|
||
4603 | |||
4604 | function TDataModuleDeclaration.OutputProximal(Value, MS: Double; ExpressionMode, ProximalUnit: Integer): Double;
|
||
4605 | begin
|
||
4606 | if ProximalUnit = 0 |
||
4607 | then // % |
||
4608 | Result := Value * 100
|
||
4609 | else // g/kg |
||
4610 | Result := Value * 1000;
|
||
4611 | if ExpressionMode = 0 |
||
4612 | then // sur frais |
||
4613 | Result := Result * MS; |
||
4614 | end;
|
||
4615 | |||
4616 | function TDataModuleDeclaration.OutputEnergy(Value, MS: Double; ExpressionMode, EnergyUnit: Integer): Double;
|
||
4617 | begin
|
||
4618 | if EnergyUnit = 0 |
||
4619 | then // MJ/kg |
||
4620 | Result := Value |
||
4621 | else // kcal/kg |
||
4622 | Result := Value / CALORIE * 1000;
|
||
4623 | if ExpressionMode = 0 |
||
4624 | then // sur frais |
||
4625 | Result := Result * MS; |
||
4626 | end;
|
||
4627 | |||
4628 | function TDataModuleDeclaration.OutputAA(Value, MAT, MS: Double; ExpressionMode, AAUnit: Integer): Double;
|
||
4629 | begin
|
||
4630 | if AAUnit = 0 |
||
4631 | then // % |
||
4632 | Result := Value * MAT * 100
|
||
4633 | else // g/kg |
||
4634 | Result := Value * MAT * 1000;
|
||
4635 | if ExpressionMode = 0 |
||
4636 | then // sur frais |
||
4637 | Result := Result * MS; |
||
4638 | end;
|
||
4639 | |||
4640 | function TDataModuleDeclaration.OutputMinerals(Value, MS: Double; ExpressionMode, MineralsUnit: Integer): Double;
|
||
4641 | begin
|
||
4642 | if MineralsUnit = 0 |
||
4643 | then // % |
||
4644 | Result := Value * 100
|
||
4645 | else // g/kg |
||
4646 | Result := Value * 1000;
|
||
4647 | if ExpressionMode = 0 |
||
4648 | then // sur frais |
||
4649 | Result := Result * MS; |
||
4650 | end;
|
||
4651 | |||
4652 | function TDataModuleDeclaration.OutputIncorporation(Value: Double; IncorporationUnit: Integer): Double;
|
||
4653 | begin
|
||
4654 | if IncorporationUnit = 0 |
||
4655 | then // % |
||
4656 | Result := Value * 100
|
||
4657 | else // g/kg |
||
4658 | Result := Value * 1000;
|
||
4659 | end;
|
||
4660 | |||
4661 | function TDataModuleDeclaration.StrTrunc(S: String; Max: Integer): String; |
||
4662 | var
|
||
4663 | l, r: Integer; |
||
4664 | begin
|
||
4665 | if ElementToCharLen(S, Length(S)) > Max
|
||
4666 | then // Cut string S to Max chars |
||
4667 | begin
|
||
4668 | l := Max div 2; |
||
4669 | r := Max - l - 3;
|
||
4670 | Result := AnsiLeftStr(S, l) + '...' + AnsiRightStr(S, r);
|
||
4671 | end
|
||
4672 | else
|
||
4673 | Result := S; |
||
4674 | end;
|
||
4675 | |||
4676 | end. |