root / UnitIngredientEditionOriginal.pas @ 1
Historique | Voir | Annoter | Télécharger (99,932 ko)
1 |
unit UnitIngredientEditionOriginal;
|
---|---|
2 |
|
3 |
interface
|
4 |
|
5 |
uses
|
6 |
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, |
7 |
Dialogs, StdCtrls, ComCtrls, ExtCtrls, DBCtrls, Mask, ToolWin, ActnList, |
8 |
ImgList, JvExStdCtrls, JvEdit, JvValidateEdit, JvExMask, JvSpin, JvExControls, |
9 |
JvEnterTab, gnugettext, JvButton, JvCtrls; |
10 |
|
11 |
type
|
12 |
TFormIngredientEditionOriginal = class(TForm)
|
13 |
GroupBoxProximal: TGroupBox; |
14 |
GroupBoxAA: TGroupBox; |
15 |
ValidateEditMAT: TJvValidateEdit; |
16 |
ValidateEditCB: TJvValidateEdit; |
17 |
ValidateEditMG: TJvValidateEdit; |
18 |
ValidateEditMM: TJvValidateEdit; |
19 |
ValidateEditNDF: TJvValidateEdit; |
20 |
ValidateEditADF: TJvValidateEdit; |
21 |
ValidateEditADL: TJvValidateEdit; |
22 |
ValidateEditAmidon: TJvValidateEdit; |
23 |
ValidateEditSucres: TJvValidateEdit; |
24 |
CheckBoxMAT: TCheckBox; |
25 |
CheckBoxCB: TCheckBox; |
26 |
CheckBoxMG: TCheckBox; |
27 |
CheckBoxMM: TCheckBox; |
28 |
CheckBoxNDF: TCheckBox; |
29 |
CheckBoxADF: TCheckBox; |
30 |
CheckBoxADL: TCheckBox; |
31 |
CheckBoxAmidon: TCheckBox; |
32 |
CheckBoxSucres: TCheckBox; |
33 |
ValidateEditLys: TJvValidateEdit; |
34 |
CheckBoxLys: TCheckBox; |
35 |
ValidateEditThr: TJvValidateEdit; |
36 |
CheckBoxThr: TCheckBox; |
37 |
ValidateEditMet: TJvValidateEdit; |
38 |
CheckBoxMet: TCheckBox; |
39 |
ValidateEditCys: TJvValidateEdit; |
40 |
CheckBoxCys: TCheckBox; |
41 |
ValidateEditMetCys: TJvValidateEdit; |
42 |
CheckBoxMetCys: TCheckBox; |
43 |
ValidateEditTrp: TJvValidateEdit; |
44 |
CheckBoxTrp: TCheckBox; |
45 |
ValidateEditIle: TJvValidateEdit; |
46 |
CheckBoxIle: TCheckBox; |
47 |
ValidateEditVal: TJvValidateEdit; |
48 |
CheckBoxVal: TCheckBox; |
49 |
ValidateEditLeu: TJvValidateEdit; |
50 |
CheckBoxLeu: TCheckBox; |
51 |
ValidateEditPhe: TJvValidateEdit; |
52 |
CheckBoxPhe: TCheckBox; |
53 |
ValidateEditTyr: TJvValidateEdit; |
54 |
CheckBoxTyr: TCheckBox; |
55 |
ValidateEditPheTyr: TJvValidateEdit; |
56 |
CheckBoxPheTyr: TCheckBox; |
57 |
ValidateEditHis: TJvValidateEdit; |
58 |
CheckBoxHis: TCheckBox; |
59 |
ValidateEditArg: TJvValidateEdit; |
60 |
CheckBoxArg: TCheckBox; |
61 |
ValidateEditAla: TJvValidateEdit; |
62 |
CheckBoxAla: TCheckBox; |
63 |
ValidateEditAsp: TJvValidateEdit; |
64 |
CheckBoxAsp: TCheckBox; |
65 |
ValidateEditGlu: TJvValidateEdit; |
66 |
CheckBoxGlu: TCheckBox; |
67 |
ValidateEditGly: TJvValidateEdit; |
68 |
CheckBoxGly: TCheckBox; |
69 |
ValidateEditSer: TJvValidateEdit; |
70 |
CheckBoxSer: TCheckBox; |
71 |
ValidateEditPro: TJvValidateEdit; |
72 |
CheckBoxPro: TCheckBox; |
73 |
GroupBoxEnergy: TGroupBox; |
74 |
ValidateEditEB: TJvValidateEdit; |
75 |
CheckBoxEB: TCheckBox; |
76 |
SpinEditBonus: TJvSpinEdit; |
77 |
GroupBoxMinerals: TGroupBox; |
78 |
ValidateEditCa: TJvValidateEdit; |
79 |
CheckBoxCa: TCheckBox; |
80 |
ValidateEditP: TJvValidateEdit; |
81 |
CheckBoxP: TCheckBox; |
82 |
ValidateEditdPphy: TJvValidateEdit; |
83 |
CheckBoxdPphy: TCheckBox; |
84 |
ValidateEditdP: TJvValidateEdit; |
85 |
CheckBoxdP: TCheckBox; |
86 |
DBEditName: TDBEdit; |
87 |
DBEditClass: TDBEdit; |
88 |
DBEditMS: TDBEdit; |
89 |
EnterAsTab: TJvEnterAsTab; |
90 |
ValidateEditdLys: TJvValidateEdit; |
91 |
CheckBoxdLys: TCheckBox; |
92 |
ValidateEditdThr: TJvValidateEdit; |
93 |
CheckBoxdThr: TCheckBox; |
94 |
ValidateEditdMet: TJvValidateEdit; |
95 |
CheckBoxdMet: TCheckBox; |
96 |
ValidateEditdCys: TJvValidateEdit; |
97 |
CheckBoxdCys: TCheckBox; |
98 |
ValidateEditdMetCys: TJvValidateEdit; |
99 |
CheckBoxdMetCys: TCheckBox; |
100 |
ValidateEditdTrp: TJvValidateEdit; |
101 |
CheckBoxdTrp: TCheckBox; |
102 |
ValidateEditdIle: TJvValidateEdit; |
103 |
CheckBoxdIle: TCheckBox; |
104 |
ValidateEditdVal: TJvValidateEdit; |
105 |
CheckBoxdVal: TCheckBox; |
106 |
ValidateEditdLeu: TJvValidateEdit; |
107 |
CheckBoxdLeu: TCheckBox; |
108 |
ValidateEditdPhe: TJvValidateEdit; |
109 |
CheckBoxdPhe: TCheckBox; |
110 |
ValidateEditdTyr: TJvValidateEdit; |
111 |
CheckBoxdTyr: TCheckBox; |
112 |
ValidateEditdPheTyr: TJvValidateEdit; |
113 |
CheckBoxdPheTyr: TCheckBox; |
114 |
ValidateEditdHis: TJvValidateEdit; |
115 |
CheckBoxdHis: TCheckBox; |
116 |
ValidateEditdArg: TJvValidateEdit; |
117 |
CheckBoxdArg: TCheckBox; |
118 |
ValidateEditdAla: TJvValidateEdit; |
119 |
CheckBoxdAla: TCheckBox; |
120 |
ValidateEditdAsp: TJvValidateEdit; |
121 |
CheckBoxdAsp: TCheckBox; |
122 |
ValidateEditdGlu: TJvValidateEdit; |
123 |
CheckBoxdGlu: TCheckBox; |
124 |
ValidateEditdGly: TJvValidateEdit; |
125 |
CheckBoxdGly: TCheckBox; |
126 |
ValidateEditdSer: TJvValidateEdit; |
127 |
CheckBoxdSer: TCheckBox; |
128 |
ValidateEditdPro: TJvValidateEdit; |
129 |
CheckBoxdPro: TCheckBox; |
130 |
PanelButtons: TPanel; |
131 |
PanelMain: TPanel; |
132 |
PanelHeader: TPanel; |
133 |
ImageListIcons: TImageList; |
134 |
ActionListButtons: TActionList; |
135 |
ActionRename: TAction; |
136 |
ActionComment: TAction; |
137 |
ActionHelp: TAction; |
138 |
ActionOK: TAction; |
139 |
ActionCancel: TAction; |
140 |
LabelWarning: TLabel; |
141 |
LabelBonus: TLabel; |
142 |
LabelEB: TLabel; |
143 |
LabelCa: TLabel; |
144 |
LabelP: TLabel; |
145 |
LabeldP: TLabel; |
146 |
LabelFarine: TLabel; |
147 |
LabelGranule: TLabel; |
148 |
LabelMAT: TLabel; |
149 |
LabelCB: TLabel; |
150 |
LabelMG: TLabel; |
151 |
LabelMM: TLabel; |
152 |
LabelNDF: TLabel; |
153 |
LabelADF: TLabel; |
154 |
LabelADL: TLabel; |
155 |
LabelAmidon: TLabel; |
156 |
LabelSucres: TLabel; |
157 |
LabelLys: TLabel; |
158 |
LabelTyr: TLabel; |
159 |
LabelThr: TLabel; |
160 |
LabelPheTyr: TLabel; |
161 |
LabelMet: TLabel; |
162 |
LabelHis: TLabel; |
163 |
LabelCys: TLabel; |
164 |
LabelArg: TLabel; |
165 |
LabelMetCys: TLabel; |
166 |
LabelAla: TLabel; |
167 |
LabelTrp: TLabel; |
168 |
LabelAsp: TLabel; |
169 |
LabelIle: TLabel; |
170 |
LabelGlu: TLabel; |
171 |
LabelVal: TLabel; |
172 |
LabelGly: TLabel; |
173 |
LabelLeu: TLabel; |
174 |
LabelSer: TLabel; |
175 |
LabelPhe: TLabel; |
176 |
LabelPro: TLabel; |
177 |
LabeldAA: TLabel; |
178 |
LabelAATot: TLabel; |
179 |
LabelClass: TLabel; |
180 |
LabelMS: TLabel; |
181 |
LabelName: TLabel; |
182 |
ComboBoxEnergy: TComboBox; |
183 |
ComboBoxMinerals: TComboBox; |
184 |
ComboBoxProximal: TComboBox; |
185 |
ComboBoxAA: TComboBox; |
186 |
JvImgBtnCancel: TJvImgBtn; |
187 |
JvImgBtnOK: TJvImgBtn; |
188 |
JvImgBtnHelp: TJvImgBtn; |
189 |
JvImgBtnRename: TJvImgBtn; |
190 |
JvImgBtnComment: TJvImgBtn; |
191 |
procedure FormCreate(Sender: TObject);
|
192 |
procedure CheckBoxMATClick(Sender: TObject);
|
193 |
procedure CheckBoxCBClick(Sender: TObject);
|
194 |
procedure CheckBoxMGClick(Sender: TObject);
|
195 |
procedure CheckBoxMMClick(Sender: TObject);
|
196 |
procedure CheckBoxNDFClick(Sender: TObject);
|
197 |
procedure CheckBoxADFClick(Sender: TObject);
|
198 |
procedure CheckBoxADLClick(Sender: TObject);
|
199 |
procedure CheckBoxAmidonClick(Sender: TObject);
|
200 |
procedure CheckBoxSucresClick(Sender: TObject);
|
201 |
procedure CheckBoxEBClick(Sender: TObject);
|
202 |
procedure CheckBoxLysClick(Sender: TObject);
|
203 |
procedure CheckBoxThrClick(Sender: TObject);
|
204 |
procedure CheckBoxMetClick(Sender: TObject);
|
205 |
procedure CheckBoxCysClick(Sender: TObject);
|
206 |
procedure CheckBoxMetCysClick(Sender: TObject);
|
207 |
procedure CheckBoxTrpClick(Sender: TObject);
|
208 |
procedure CheckBoxIleClick(Sender: TObject);
|
209 |
procedure CheckBoxValClick(Sender: TObject);
|
210 |
procedure CheckBoxLeuClick(Sender: TObject);
|
211 |
procedure CheckBoxPheClick(Sender: TObject);
|
212 |
procedure CheckBoxTyrClick(Sender: TObject);
|
213 |
procedure CheckBoxPheTyrClick(Sender: TObject);
|
214 |
procedure CheckBoxHisClick(Sender: TObject);
|
215 |
procedure CheckBoxArgClick(Sender: TObject);
|
216 |
procedure CheckBoxAlaClick(Sender: TObject);
|
217 |
procedure CheckBoxAspClick(Sender: TObject);
|
218 |
procedure CheckBoxGluClick(Sender: TObject);
|
219 |
procedure CheckBoxGlyClick(Sender: TObject);
|
220 |
procedure CheckBoxSerClick(Sender: TObject);
|
221 |
procedure CheckBoxProClick(Sender: TObject);
|
222 |
procedure ComboBoxProximalChange(Sender: TObject);
|
223 |
procedure ComboBoxEnergyChange(Sender: TObject);
|
224 |
procedure ComboBoxAAChange(Sender: TObject);
|
225 |
procedure ValidateEditMATChange(Sender: TObject);
|
226 |
procedure ComboBoxMineralsChange(Sender: TObject);
|
227 |
procedure CheckBoxCaClick(Sender: TObject);
|
228 |
procedure CheckBoxPClick(Sender: TObject);
|
229 |
procedure CheckBoxdPphyClick(Sender: TObject);
|
230 |
procedure CheckBoxdPClick(Sender: TObject);
|
231 |
procedure ValidateEditPChange(Sender: TObject);
|
232 |
procedure ButtonRenameClick(Sender: TObject);
|
233 |
procedure ButtonCommentClick(Sender: TObject);
|
234 |
procedure CheckBoxdLysClick(Sender: TObject);
|
235 |
procedure CheckBoxdThrClick(Sender: TObject);
|
236 |
procedure CheckBoxdMetClick(Sender: TObject);
|
237 |
procedure CheckBoxdCysClick(Sender: TObject);
|
238 |
procedure CheckBoxdMetCysClick(Sender: TObject);
|
239 |
procedure CheckBoxdTrpClick(Sender: TObject);
|
240 |
procedure CheckBoxdIleClick(Sender: TObject);
|
241 |
procedure CheckBoxdValClick(Sender: TObject);
|
242 |
procedure CheckBoxdLeuClick(Sender: TObject);
|
243 |
procedure CheckBoxdPheClick(Sender: TObject);
|
244 |
procedure CheckBoxdTyrClick(Sender: TObject);
|
245 |
procedure CheckBoxdPheTyrClick(Sender: TObject);
|
246 |
procedure CheckBoxdHisClick(Sender: TObject);
|
247 |
procedure CheckBoxdArgClick(Sender: TObject);
|
248 |
procedure CheckBoxdAlaClick(Sender: TObject);
|
249 |
procedure CheckBoxdAspClick(Sender: TObject);
|
250 |
procedure CheckBoxdGluClick(Sender: TObject);
|
251 |
procedure CheckBoxdGlyClick(Sender: TObject);
|
252 |
procedure CheckBoxdSerClick(Sender: TObject);
|
253 |
procedure CheckBoxdProClick(Sender: TObject);
|
254 |
procedure ButtonHelpClick(Sender: TObject);
|
255 |
procedure ActionRenameExecute(Sender: TObject);
|
256 |
procedure ActionCommentExecute(Sender: TObject);
|
257 |
procedure ActionHelpExecute(Sender: TObject);
|
258 |
procedure ActionOKExecute(Sender: TObject);
|
259 |
procedure ActionCancelExecute(Sender: TObject);
|
260 |
procedure NumEditKeyDown(Sender: TObject; var Key: Word; |
261 |
Shift: TShiftState); |
262 |
procedure NumEditKeyPress(Sender: TObject; var Key: Char); |
263 |
private
|
264 |
{ D?clarations priv?es }
|
265 |
ProximalUnit, EnergyUnit, MineralsUnit, AAUnit: Integer; |
266 |
procedure EditActivate(Edit: TJvValidateEdit);
|
267 |
procedure EditEmpty(Edit: TJvValidateEdit);
|
268 |
procedure EditShow(Edit: TJvValidateEdit; const Value: Double); |
269 |
procedure DisableAA;
|
270 |
procedure DisabledP;
|
271 |
procedure EnableAA;
|
272 |
procedure EnabledP;
|
273 |
public
|
274 |
{ D?clarations publiques }
|
275 |
end;
|
276 |
|
277 |
var
|
278 |
FormIngredientEditionOriginal: TFormIngredientEditionOriginal; |
279 |
|
280 |
implementation
|
281 |
|
282 |
{$R *.dfm}
|
283 |
|
284 |
uses
|
285 |
UnitDeclaration, UnitOptions, UnitRename, UnitComment, UnitIngredientsList; |
286 |
|
287 |
var
|
288 |
VK_Separator: boolean; |
289 |
|
290 |
procedure TFormIngredientEditionOriginal.ActionCancelExecute(Sender: TObject);
|
291 |
begin
|
292 |
ModalResult := mrCancel; |
293 |
end;
|
294 |
|
295 |
procedure TFormIngredientEditionOriginal.ActionCommentExecute(Sender: TObject);
|
296 |
begin
|
297 |
FormComment := TFormComment.Create(nil);
|
298 |
try
|
299 |
// FormComment.Caption := ButtonComment.Hint;
|
300 |
FormComment.Name := DataModuleDeclaration.ClientDataSetIngredientsName.Value; |
301 |
FormComment.OldComment := DataModuleDeclaration.ClientDataSetIngredientsDefinition.Value; |
302 |
if (FormComment.ShowModal = mrOk) and (FormComment.NewComment <> FormComment.OldComment) |
303 |
then // Commenter |
304 |
with DataModuleDeclaration do |
305 |
begin
|
306 |
DBUser.BeginTransaction; |
307 |
try
|
308 |
DBUser.ExecSQL('UPDATE Ingredients '
|
309 |
+ Format('SET Definition = %s ', [QuotedStr(FormComment.NewComment)])
|
310 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
311 |
DBUser.Commit; |
312 |
except
|
313 |
DBUser.RollBack; |
314 |
MessageDlg(Format(_('Unknown error: %s %s %s'), ['UnitIngredientEditionOriginal', 'ActionCommentExecute', 'DBUser (UPDATE Ingredients)']), mtError, [mbOK], 0); |
315 |
Exit; |
316 |
end;
|
317 |
// Commenter dans ClientDataSetIngredients
|
318 |
ClientDataSetIngredients.Edit; |
319 |
ClientDataSetIngredientsDefinition.Value := FormComment.NewComment; |
320 |
ClientDataSetIngredients.Post; |
321 |
end;
|
322 |
finally
|
323 |
FormComment.Release; |
324 |
end;
|
325 |
end;
|
326 |
|
327 |
procedure TFormIngredientEditionOriginal.ActionHelpExecute(Sender: TObject);
|
328 |
begin
|
329 |
Application.HelpContext(HelpContext); |
330 |
end;
|
331 |
|
332 |
procedure TFormIngredientEditionOriginal.ActionOKExecute(Sender: TObject);
|
333 |
var
|
334 |
Nb: Integer; |
335 |
MM, MAT, MG, Fibre, Amidon, Sucres, CB, NDF, ADF, AASum: Double; |
336 |
USFormatSettings: TFormatSettings; |
337 |
begin
|
338 |
with DataModuleDeclaration do |
339 |
begin
|
340 |
// V?rifier la saisie
|
341 |
if not CheckBoxMM.Checked |
342 |
then
|
343 |
begin
|
344 |
MessageDlg(_('You must specify an ash value for this ingredient.'), mtError, [mbOK], 0); |
345 |
ActiveControl := CheckBoxMM; |
346 |
Exit; |
347 |
end;
|
348 |
if not CheckBoxMAT.Checked |
349 |
then
|
350 |
begin
|
351 |
MessageDlg(_('You must specify a crude protein value for this ingredient.'), mtError, [mbOK], 0); |
352 |
ActiveControl := CheckBoxMAT; |
353 |
Exit; |
354 |
end;
|
355 |
if not CheckBoxMG.Checked and not CheckBoxEB.Checked |
356 |
then
|
357 |
begin
|
358 |
MessageDlg(_('You must specify a crude fat value or a gross energy value for this ingredient.'), mtError, [mbOK], 0); |
359 |
ActiveControl := CheckBoxMG; |
360 |
Exit; |
361 |
end;
|
362 |
if not CheckBoxCB.Checked and not CheckBoxNDF.Checked and not CheckBoxADF.Checked |
363 |
then
|
364 |
begin
|
365 |
MessageDlg(_('You must specify a fiber value (crude fiber, NDF or ADF) for this ingredient.'), mtError, [mbOK], 0); |
366 |
ActiveControl := CheckBoxCB; |
367 |
Exit; |
368 |
end;
|
369 |
if CheckBoxMM.Checked
|
370 |
then
|
371 |
MM := InputProximal(ValidateEditMM.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2) |
372 |
else
|
373 |
MM := 0;
|
374 |
if CheckBoxMAT.Checked
|
375 |
then
|
376 |
MAT := InputProximal(ValidateEditMAT.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2) |
377 |
else
|
378 |
MAT := 0;
|
379 |
if CheckBoxMG.Checked
|
380 |
then
|
381 |
MG := InputProximal(ValidateEditMG.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2) |
382 |
else
|
383 |
MG := 0;
|
384 |
Nb := 0;
|
385 |
if CheckBoxCB.Checked
|
386 |
then
|
387 |
begin
|
388 |
CB := InputProximal(ValidateEditCB.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2); |
389 |
Inc(Nb); |
390 |
end
|
391 |
else
|
392 |
CB := 0;
|
393 |
if CheckBoxNDF.Checked
|
394 |
then
|
395 |
begin
|
396 |
NDF := InputProximal(ValidateEditNDF.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2); |
397 |
Inc(Nb); |
398 |
end
|
399 |
else
|
400 |
NDF := 0;
|
401 |
if CheckBoxADF.Checked
|
402 |
then
|
403 |
begin
|
404 |
ADF := InputProximal(ValidateEditADF.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2); |
405 |
Inc(Nb); |
406 |
end
|
407 |
else
|
408 |
ADF := 0;
|
409 |
if Nb = 0 |
410 |
then
|
411 |
Fibre := 0
|
412 |
else // Moyenne des ?quations significatives |
413 |
Fibre := (CB * NDF_CB + NDF + ADF * NDF_ADF) / Nb; |
414 |
if CheckBoxAmidon.Checked
|
415 |
then
|
416 |
Amidon := InputProximal(ValidateEditAmidon.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2) |
417 |
else
|
418 |
Amidon := 0;
|
419 |
if CheckBoxSucres.Checked
|
420 |
then
|
421 |
Sucres := InputProximal(ValidateEditSucres.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2) |
422 |
else
|
423 |
Sucres := 0;
|
424 |
if MM + MAT + MG + Fibre + Amidon + Sucres > 1.05 |
425 |
then
|
426 |
if MessageDlg(_('The sum of nutrients is estimated to more than 100% of the dry matter.' + sLineBreak + 'Are you sure you want to continue?'), mtError, [mbYes, mbNo], 0) <> mrYes |
427 |
then
|
428 |
Exit; |
429 |
AASum := 0;
|
430 |
if CheckBoxLys.Checked
|
431 |
then
|
432 |
AASum := AASum + InputAA(ValidateEditLys.AsFloat, RapMAT,RapMS, AAUnit div 2, AAUnit mod 2); |
433 |
if CheckBoxThr.Checked
|
434 |
then
|
435 |
AASum := AASum + InputAA(ValidateEditThr.AsFloat, RapMAT,RapMS, AAUnit div 2, AAUnit mod 2); |
436 |
if CheckBoxMet.Checked
|
437 |
then
|
438 |
AASum := AASum + InputAA(ValidateEditMet.AsFloat, RapMAT,RapMS, AAUnit div 2, AAUnit mod 2); |
439 |
if CheckBoxCys.Checked
|
440 |
then
|
441 |
AASum := AASum + InputAA(ValidateEditCys.AsFloat, RapMAT,RapMS, AAUnit div 2, AAUnit mod 2); |
442 |
if CheckBoxTrp.Checked
|
443 |
then
|
444 |
AASum := AASum + InputAA(ValidateEditTrp.AsFloat, RapMAT,RapMS, AAUnit div 2, AAUnit mod 2); |
445 |
if CheckBoxIle.Checked
|
446 |
then
|
447 |
AASum := AASum + InputAA(ValidateEditIle.AsFloat, RapMAT,RapMS, AAUnit div 2, AAUnit mod 2); |
448 |
if CheckBoxVal.Checked
|
449 |
then
|
450 |
AASum := AASum + InputAA(ValidateEditVal.AsFloat, RapMAT,RapMS, AAUnit div 2, AAUnit mod 2); |
451 |
if CheckBoxLeu.Checked
|
452 |
then
|
453 |
AASum := AASum + InputAA(ValidateEditLeu.AsFloat, RapMAT,RapMS, AAUnit div 2, AAUnit mod 2); |
454 |
if CheckBoxPhe.Checked
|
455 |
then
|
456 |
AASum := AASum + InputAA(ValidateEditPhe.AsFloat, RapMAT,RapMS, AAUnit div 2, AAUnit mod 2); |
457 |
if CheckBoxTyr.Checked
|
458 |
then
|
459 |
AASum := AASum + InputAA(ValidateEditTyr.AsFloat, RapMAT,RapMS, AAUnit div 2, AAUnit mod 2); |
460 |
if CheckBoxHis.Checked
|
461 |
then
|
462 |
AASum := AASum + InputAA(ValidateEditHis.AsFloat, RapMAT,RapMS, AAUnit div 2, AAUnit mod 2); |
463 |
if CheckBoxArg.Checked
|
464 |
then
|
465 |
AASum := AASum + InputAA(ValidateEditArg.AsFloat, RapMAT,RapMS, AAUnit div 2, AAUnit mod 2); |
466 |
if CheckBoxAla.Checked
|
467 |
then
|
468 |
AASum := AASum + InputAA(ValidateEditAla.AsFloat, RapMAT,RapMS, AAUnit div 2, AAUnit mod 2); |
469 |
if CheckBoxAsp.Checked
|
470 |
then
|
471 |
AASum := AASum + InputAA(ValidateEditAsp.AsFloat, RapMAT,RapMS, AAUnit div 2, AAUnit mod 2); |
472 |
if CheckBoxGlu.Checked
|
473 |
then
|
474 |
AASum := AASum + InputAA(ValidateEditGlu.AsFloat, RapMAT,RapMS, AAUnit div 2, AAUnit mod 2); |
475 |
if CheckBoxGly.Checked
|
476 |
then
|
477 |
AASum := AASum + InputAA(ValidateEditGly.AsFloat, RapMAT,RapMS, AAUnit div 2, AAUnit mod 2); |
478 |
if CheckBoxSer.Checked
|
479 |
then
|
480 |
AASum := AASum + InputAA(ValidateEditSer.AsFloat, RapMAT,RapMS, AAUnit div 2, AAUnit mod 2); |
481 |
if CheckBoxPro.Checked
|
482 |
then
|
483 |
AASum := AASum + InputAA(ValidateEditPro.AsFloat, RapMAT,RapMS, AAUnit div 2, AAUnit mod 2); |
484 |
if AASum > 1.1 |
485 |
then
|
486 |
if MessageDlg(_('The sum of total amino acids is more than the crude protein.' + sLineBreak + 'Are you sure you want to continue?'), mtError, [mbYes, mbNo], 0) <> mrYes |
487 |
then
|
488 |
begin
|
489 |
Exit; |
490 |
end;
|
491 |
// Modifier la mati?re premi?re
|
492 |
GetLocaleFormatSettings(1033, USFormatSettings);
|
493 |
DBUser.BeginTransaction; |
494 |
try
|
495 |
// Analyse proximale
|
496 |
if CheckBoxMM.Checked
|
497 |
then
|
498 |
DBUser.ExecSQL('UPDATE Ingredients '
|
499 |
+ Format('SET MM = %.15f ', [InputProximal(ValidateEditMM.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2)], USFormatSettings) |
500 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
501 |
else
|
502 |
DBUser.ExecSQL('UPDATE Ingredients '
|
503 |
+ 'SET MM = null '
|
504 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
505 |
if CheckBoxMAT.Checked
|
506 |
then
|
507 |
DBUser.ExecSQL('UPDATE Ingredients '
|
508 |
+ Format('SET MAT = %.15f ', [InputProximal(ValidateEditMAT.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2)], USFormatSettings) |
509 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
510 |
else
|
511 |
DBUser.ExecSQL('UPDATE Ingredients '
|
512 |
+ 'SET MAT = null '
|
513 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
514 |
if CheckBoxMG.Checked
|
515 |
then
|
516 |
DBUser.ExecSQL('UPDATE Ingredients '
|
517 |
+ Format('SET MG = %.15f ', [InputProximal(ValidateEditMG.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2)], USFormatSettings) |
518 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
519 |
else
|
520 |
DBUser.ExecSQL('UPDATE Ingredients '
|
521 |
+ 'SET MG = null '
|
522 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
523 |
if CheckBoxCB.Checked
|
524 |
then
|
525 |
DBUser.ExecSQL('UPDATE Ingredients '
|
526 |
+ Format('SET CB = %.15f ', [InputProximal(ValidateEditCB.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2)], USFormatSettings) |
527 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
528 |
else
|
529 |
DBUser.ExecSQL('UPDATE Ingredients '
|
530 |
+ 'SET CB = null '
|
531 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
532 |
if CheckBoxNDF.Checked
|
533 |
then
|
534 |
DBUser.ExecSQL('UPDATE Ingredients '
|
535 |
+ Format('SET NDF = %.15f ', [InputProximal(ValidateEditNDF.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2)], USFormatSettings) |
536 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
537 |
else
|
538 |
DBUser.ExecSQL('UPDATE Ingredients '
|
539 |
+ 'SET NDF = null '
|
540 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
541 |
if CheckBoxADF.Checked
|
542 |
then
|
543 |
DBUser.ExecSQL('UPDATE Ingredients '
|
544 |
+ Format('SET ADF = %.15f ', [InputProximal(ValidateEditADF.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2)], USFormatSettings) |
545 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
546 |
else
|
547 |
DBUser.ExecSQL('UPDATE Ingredients '
|
548 |
+ 'SET ADF = null '
|
549 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
550 |
if CheckBoxADL.Checked
|
551 |
then
|
552 |
DBUser.ExecSQL('UPDATE Ingredients '
|
553 |
+ Format('SET ADL = %.15f ', [InputProximal(ValidateEditADL.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2)], USFormatSettings) |
554 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
555 |
else
|
556 |
DBUser.ExecSQL('UPDATE Ingredients '
|
557 |
+ 'SET ADL = null '
|
558 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
559 |
if CheckBoxAmidon.Checked
|
560 |
then
|
561 |
DBUser.ExecSQL('UPDATE Ingredients '
|
562 |
+ Format('SET Amidon = %.15f ', [InputProximal(ValidateEditAmidon.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2)], USFormatSettings) |
563 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
564 |
else
|
565 |
DBUser.ExecSQL('UPDATE Ingredients '
|
566 |
+ 'SET Amidon = null '
|
567 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
568 |
if CheckBoxSucres.Checked
|
569 |
then
|
570 |
DBUser.ExecSQL('UPDATE Ingredients '
|
571 |
+ Format('SET Sucres = %.15f ', [InputProximal(ValidateEditSucres.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2)], USFormatSettings) |
572 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
573 |
else
|
574 |
DBUser.ExecSQL('UPDATE Ingredients '
|
575 |
+ 'SET Sucres = null '
|
576 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
577 |
// Energie
|
578 |
if CheckBoxEB.Checked
|
579 |
then
|
580 |
DBUser.ExecSQL('UPDATE Ingredients '
|
581 |
+ Format('SET EB = %.15f ', [InputEnergy(ValidateEditEB.AsFloat, RapMS, EnergyUnit div 2, EnergyUnit mod 2)], USFormatSettings) |
582 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
583 |
else
|
584 |
DBUser.ExecSQL('UPDATE Ingredients '
|
585 |
+ 'SET EB = null '
|
586 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
587 |
DBUser.ExecSQL('UPDATE Ingredients '
|
588 |
+ Format('SET Bonus = %.3f ', [SpinEditBonus.Value / 100], USFormatSettings) |
589 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
590 |
// Acides amin?s
|
591 |
if CheckBoxLys.Checked
|
592 |
then
|
593 |
DBUser.ExecSQL('UPDATE Ingredients '
|
594 |
+ Format('SET Lys = %.15f ', [InputAA(ValidateEditLys.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
595 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
596 |
else
|
597 |
DBUser.ExecSQL('UPDATE Ingredients '
|
598 |
+ 'SET Lys = null '
|
599 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
600 |
if CheckBoxThr.Checked
|
601 |
then
|
602 |
DBUser.ExecSQL('UPDATE Ingredients '
|
603 |
+ Format('SET Thr = %.15f ', [InputAA(ValidateEditThr.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
604 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
605 |
else
|
606 |
DBUser.ExecSQL('UPDATE Ingredients '
|
607 |
+ 'SET Thr = null '
|
608 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
609 |
if CheckBoxMet.Checked
|
610 |
then
|
611 |
DBUser.ExecSQL('UPDATE Ingredients '
|
612 |
+ Format('SET Met = %.15f ', [InputAA(ValidateEditMet.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
613 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
614 |
else
|
615 |
DBUser.ExecSQL('UPDATE Ingredients '
|
616 |
+ 'SET Met = null '
|
617 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
618 |
if CheckBoxCys.Checked
|
619 |
then
|
620 |
DBUser.ExecSQL('UPDATE Ingredients '
|
621 |
+ Format('SET Cys = %.15f ', [InputAA(ValidateEditCys.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
622 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
623 |
else
|
624 |
DBUser.ExecSQL('UPDATE Ingredients '
|
625 |
+ 'SET Cys = null '
|
626 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
627 |
if CheckBoxMetCys.Checked
|
628 |
then
|
629 |
DBUser.ExecSQL('UPDATE Ingredients '
|
630 |
+ Format('SET MetCys = %.15f ', [InputAA(ValidateEditMetCys.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
631 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
632 |
else
|
633 |
DBUser.ExecSQL('UPDATE Ingredients '
|
634 |
+ 'SET MetCys = null '
|
635 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
636 |
if CheckBoxTrp.Checked
|
637 |
then
|
638 |
DBUser.ExecSQL('UPDATE Ingredients '
|
639 |
+ Format('SET Trp = %.15f ', [InputAA(ValidateEditTrp.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
640 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
641 |
else
|
642 |
DBUser.ExecSQL('UPDATE Ingredients '
|
643 |
+ 'SET Trp = null '
|
644 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
645 |
if CheckBoxIle.Checked
|
646 |
then
|
647 |
DBUser.ExecSQL('UPDATE Ingredients '
|
648 |
+ Format('SET Ile = %.15f ', [InputAA(ValidateEditIle.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
649 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
650 |
else
|
651 |
DBUser.ExecSQL('UPDATE Ingredients '
|
652 |
+ 'SET Ile = null '
|
653 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
654 |
if CheckBoxVal.Checked
|
655 |
then
|
656 |
DBUser.ExecSQL('UPDATE Ingredients '
|
657 |
+ Format('SET Val = %.15f ', [InputAA(ValidateEditVal.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
658 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
659 |
else
|
660 |
DBUser.ExecSQL('UPDATE Ingredients '
|
661 |
+ 'SET Val = null '
|
662 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
663 |
if CheckBoxLeu.Checked
|
664 |
then
|
665 |
DBUser.ExecSQL('UPDATE Ingredients '
|
666 |
+ Format('SET Leu = %.15f ', [InputAA(ValidateEditLeu.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
667 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
668 |
else
|
669 |
DBUser.ExecSQL('UPDATE Ingredients '
|
670 |
+ 'SET Leu = null '
|
671 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
672 |
if CheckBoxPhe.Checked
|
673 |
then
|
674 |
DBUser.ExecSQL('UPDATE Ingredients '
|
675 |
+ Format('SET Phe = %.15f ', [InputAA(ValidateEditPhe.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
676 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
677 |
else
|
678 |
DBUser.ExecSQL('UPDATE Ingredients '
|
679 |
+ 'SET Phe = null '
|
680 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
681 |
if CheckBoxTyr.Checked
|
682 |
then
|
683 |
DBUser.ExecSQL('UPDATE Ingredients '
|
684 |
+ Format('SET Tyr = %.15f ', [InputAA(ValidateEditTyr.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
685 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
686 |
else
|
687 |
DBUser.ExecSQL('UPDATE Ingredients '
|
688 |
+ 'SET Tyr = null '
|
689 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
690 |
if CheckBoxPheTyr.Checked
|
691 |
then
|
692 |
DBUser.ExecSQL('UPDATE Ingredients '
|
693 |
+ Format('SET PheTyr = %.15f ', [InputAA(ValidateEditPheTyr.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
694 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
695 |
else
|
696 |
DBUser.ExecSQL('UPDATE Ingredients '
|
697 |
+ 'SET PheTyr = null '
|
698 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
699 |
if CheckBoxHis.Checked
|
700 |
then
|
701 |
DBUser.ExecSQL('UPDATE Ingredients '
|
702 |
+ Format('SET His = %.15f ', [InputAA(ValidateEditHis.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
703 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
704 |
else
|
705 |
DBUser.ExecSQL('UPDATE Ingredients '
|
706 |
+ 'SET His = null '
|
707 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
708 |
if CheckBoxArg.Checked
|
709 |
then
|
710 |
DBUser.ExecSQL('UPDATE Ingredients '
|
711 |
+ Format('SET Arg = %.15f ', [InputAA(ValidateEditArg.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
712 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
713 |
else
|
714 |
DBUser.ExecSQL('UPDATE Ingredients '
|
715 |
+ 'SET Arg = null '
|
716 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
717 |
if CheckBoxAla.Checked
|
718 |
then
|
719 |
DBUser.ExecSQL('UPDATE Ingredients '
|
720 |
+ Format('SET Ala = %.15f ', [InputAA(ValidateEditAla.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
721 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
722 |
else
|
723 |
DBUser.ExecSQL('UPDATE Ingredients '
|
724 |
+ 'SET Ala = null '
|
725 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
726 |
if CheckBoxAsp.Checked
|
727 |
then
|
728 |
DBUser.ExecSQL('UPDATE Ingredients '
|
729 |
+ Format('SET Asp = %.15f ', [InputAA(ValidateEditAsp.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
730 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
731 |
else
|
732 |
DBUser.ExecSQL('UPDATE Ingredients '
|
733 |
+ 'SET Asp = null '
|
734 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
735 |
if CheckBoxGlu.Checked
|
736 |
then
|
737 |
DBUser.ExecSQL('UPDATE Ingredients '
|
738 |
+ Format('SET Glu = %.15f ', [InputAA(ValidateEditGlu.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
739 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
740 |
else
|
741 |
DBUser.ExecSQL('UPDATE Ingredients '
|
742 |
+ 'SET Glu = null '
|
743 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
744 |
if CheckBoxGly.Checked
|
745 |
then
|
746 |
DBUser.ExecSQL('UPDATE Ingredients '
|
747 |
+ Format('SET Gly = %.15f ', [InputAA(ValidateEditGly.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
748 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
749 |
else
|
750 |
DBUser.ExecSQL('UPDATE Ingredients '
|
751 |
+ 'SET Gly = null '
|
752 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
753 |
if CheckBoxSer.Checked
|
754 |
then
|
755 |
DBUser.ExecSQL('UPDATE Ingredients '
|
756 |
+ Format('SET Ser = %.15f ', [InputAA(ValidateEditSer.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
757 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
758 |
else
|
759 |
DBUser.ExecSQL('UPDATE Ingredients '
|
760 |
+ 'SET Ser = null '
|
761 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
762 |
if CheckBoxPro.Checked
|
763 |
then
|
764 |
DBUser.ExecSQL('UPDATE Ingredients '
|
765 |
+ Format('SET Pro = %.15f ', [InputAA(ValidateEditPro.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2)], USFormatSettings) |
766 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
767 |
else
|
768 |
DBUser.ExecSQL('UPDATE Ingredients '
|
769 |
+ 'SET Pro = null '
|
770 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
771 |
if CheckBoxdLys.Checked
|
772 |
then
|
773 |
DBUser.ExecSQL('UPDATE Ingredients '
|
774 |
+ Format('SET dLys = %.15f ', [ValidateEditdLys.AsFloat / 100], USFormatSettings) |
775 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
776 |
else
|
777 |
DBUser.ExecSQL('UPDATE Ingredients '
|
778 |
+ 'SET dLys = null '
|
779 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
780 |
if CheckBoxdThr.Checked
|
781 |
then
|
782 |
DBUser.ExecSQL('UPDATE Ingredients '
|
783 |
+ Format('SET dThr = %.15f ', [ValidateEditdThr.AsFloat / 100], USFormatSettings) |
784 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
785 |
else
|
786 |
DBUser.ExecSQL('UPDATE Ingredients '
|
787 |
+ 'SET dThr = null '
|
788 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
789 |
if CheckBoxdMet.Checked
|
790 |
then
|
791 |
DBUser.ExecSQL('UPDATE Ingredients '
|
792 |
+ Format('SET dMet = %.15f ', [ValidateEditdMet.AsFloat / 100], USFormatSettings) |
793 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
794 |
else
|
795 |
DBUser.ExecSQL('UPDATE Ingredients '
|
796 |
+ 'SET dMet = null '
|
797 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
798 |
if CheckBoxdCys.Checked
|
799 |
then
|
800 |
DBUser.ExecSQL('UPDATE Ingredients '
|
801 |
+ Format('SET dCys = %.15f ', [ValidateEditdCys.AsFloat / 100], USFormatSettings) |
802 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
803 |
else
|
804 |
DBUser.ExecSQL('UPDATE Ingredients '
|
805 |
+ 'SET dCys = null '
|
806 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
807 |
if CheckBoxdMetCys.Checked
|
808 |
then
|
809 |
DBUser.ExecSQL('UPDATE Ingredients '
|
810 |
+ Format('SET dMetCys = %.15f ', [ValidateEditdMetCys.AsFloat / 100], USFormatSettings) |
811 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
812 |
else
|
813 |
DBUser.ExecSQL('UPDATE Ingredients '
|
814 |
+ 'SET dMetCys = null '
|
815 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
816 |
if CheckBoxdTrp.Checked
|
817 |
then
|
818 |
DBUser.ExecSQL('UPDATE Ingredients '
|
819 |
+ Format('SET dTrp = %.15f ', [ValidateEditdTrp.AsFloat / 100], USFormatSettings) |
820 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
821 |
else
|
822 |
DBUser.ExecSQL('UPDATE Ingredients '
|
823 |
+ 'SET dTrp = null '
|
824 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
825 |
if CheckBoxdIle.Checked
|
826 |
then
|
827 |
DBUser.ExecSQL('UPDATE Ingredients '
|
828 |
+ Format('SET dIle = %.15f ', [ValidateEditdIle.AsFloat / 100], USFormatSettings) |
829 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
830 |
else
|
831 |
DBUser.ExecSQL('UPDATE Ingredients '
|
832 |
+ 'SET dIle = null '
|
833 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
834 |
if CheckBoxdVal.Checked
|
835 |
then
|
836 |
DBUser.ExecSQL('UPDATE Ingredients '
|
837 |
+ Format('SET dVal = %.15f ', [ValidateEditdVal.AsFloat / 100], USFormatSettings) |
838 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
839 |
else
|
840 |
DBUser.ExecSQL('UPDATE Ingredients '
|
841 |
+ 'SET dVal = null '
|
842 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
843 |
if CheckBoxdLeu.Checked
|
844 |
then
|
845 |
DBUser.ExecSQL('UPDATE Ingredients '
|
846 |
+ Format('SET dLeu = %.15f ', [ValidateEditdLeu.AsFloat / 100], USFormatSettings) |
847 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
848 |
else
|
849 |
DBUser.ExecSQL('UPDATE Ingredients '
|
850 |
+ 'SET dLeu = null '
|
851 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
852 |
if CheckBoxdPhe.Checked
|
853 |
then
|
854 |
DBUser.ExecSQL('UPDATE Ingredients '
|
855 |
+ Format('SET dPhe = %.15f ', [ValidateEditdPhe.AsFloat / 100], USFormatSettings) |
856 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
857 |
else
|
858 |
DBUser.ExecSQL('UPDATE Ingredients '
|
859 |
+ 'SET dPhe = null '
|
860 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
861 |
if CheckBoxdTyr.Checked
|
862 |
then
|
863 |
DBUser.ExecSQL('UPDATE Ingredients '
|
864 |
+ Format('SET dTyr = %.15f ', [ValidateEditdTyr.AsFloat / 100], USFormatSettings) |
865 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
866 |
else
|
867 |
DBUser.ExecSQL('UPDATE Ingredients '
|
868 |
+ 'SET dTyr = null '
|
869 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
870 |
if CheckBoxdPheTyr.Checked
|
871 |
then
|
872 |
DBUser.ExecSQL('UPDATE Ingredients '
|
873 |
+ Format('SET dPheTyr = %.15f ', [ValidateEditdPheTyr.AsFloat / 100], USFormatSettings) |
874 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
875 |
else
|
876 |
DBUser.ExecSQL('UPDATE Ingredients '
|
877 |
+ 'SET dPheTyr = null '
|
878 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
879 |
if CheckBoxdHis.Checked
|
880 |
then
|
881 |
DBUser.ExecSQL('UPDATE Ingredients '
|
882 |
+ Format('SET dHis = %.15f ', [ValidateEditdHis.AsFloat / 100], USFormatSettings) |
883 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
884 |
else
|
885 |
DBUser.ExecSQL('UPDATE Ingredients '
|
886 |
+ 'SET dHis = null '
|
887 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
888 |
if CheckBoxdArg.Checked
|
889 |
then
|
890 |
DBUser.ExecSQL('UPDATE Ingredients '
|
891 |
+ Format('SET dArg = %.15f ', [ValidateEditdArg.AsFloat / 100], USFormatSettings) |
892 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
893 |
else
|
894 |
DBUser.ExecSQL('UPDATE Ingredients '
|
895 |
+ 'SET dArg = null '
|
896 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
897 |
if CheckBoxdAla.Checked
|
898 |
then
|
899 |
DBUser.ExecSQL('UPDATE Ingredients '
|
900 |
+ Format('SET dAla = %.15f ', [ValidateEditdAla.AsFloat / 100], USFormatSettings) |
901 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
902 |
else
|
903 |
DBUser.ExecSQL('UPDATE Ingredients '
|
904 |
+ 'SET dAla = null '
|
905 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
906 |
if CheckBoxdAsp.Checked
|
907 |
then
|
908 |
DBUser.ExecSQL('UPDATE Ingredients '
|
909 |
+ Format('SET dAsp = %.15f ', [ValidateEditdAsp.AsFloat / 100], USFormatSettings) |
910 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
911 |
else
|
912 |
DBUser.ExecSQL('UPDATE Ingredients '
|
913 |
+ 'SET dAsp = null '
|
914 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
915 |
if CheckBoxdGlu.Checked
|
916 |
then
|
917 |
DBUser.ExecSQL('UPDATE Ingredients '
|
918 |
+ Format('SET dGlu = %.15f ', [ValidateEditdGlu.AsFloat / 100], USFormatSettings) |
919 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
920 |
else
|
921 |
DBUser.ExecSQL('UPDATE Ingredients '
|
922 |
+ 'SET dGlu = null '
|
923 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
924 |
if CheckBoxdGly.Checked
|
925 |
then
|
926 |
DBUser.ExecSQL('UPDATE Ingredients '
|
927 |
+ Format('SET dGly = %.15f ', [ValidateEditdGly.AsFloat / 100], USFormatSettings) |
928 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
929 |
else
|
930 |
DBUser.ExecSQL('UPDATE Ingredients '
|
931 |
+ 'SET dGly = null '
|
932 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
933 |
if CheckBoxdSer.Checked
|
934 |
then
|
935 |
DBUser.ExecSQL('UPDATE Ingredients '
|
936 |
+ Format('SET dSer = %.15f ', [ValidateEditdSer.AsFloat / 100], USFormatSettings) |
937 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
938 |
else
|
939 |
DBUser.ExecSQL('UPDATE Ingredients '
|
940 |
+ 'SET dSer = null '
|
941 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
942 |
if CheckBoxdPro.Checked
|
943 |
then
|
944 |
DBUser.ExecSQL('UPDATE Ingredients '
|
945 |
+ Format('SET dPro = %.15f ', [ValidateEditdPro.AsFloat / 100], USFormatSettings) |
946 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
947 |
else
|
948 |
DBUser.ExecSQL('UPDATE Ingredients '
|
949 |
+ 'SET dPro = null '
|
950 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
951 |
// Min?raux
|
952 |
if CheckBoxCa.Checked
|
953 |
then
|
954 |
DBUser.ExecSQL('UPDATE Ingredients '
|
955 |
+ Format('SET Ca = %.15f ', [InputMinerals(ValidateEditCa.AsFloat, RapMS, MineralsUnit div 2, MineralsUnit mod 2)], USFormatSettings) |
956 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
957 |
else
|
958 |
DBUser.ExecSQL('UPDATE Ingredients '
|
959 |
+ 'SET Ca = null '
|
960 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
961 |
if CheckBoxP.Checked
|
962 |
then
|
963 |
DBUser.ExecSQL('UPDATE Ingredients '
|
964 |
+ Format('SET P = %.15f ', [InputMinerals(ValidateEditP.AsFloat, RapMS, MineralsUnit div 2, MineralsUnit mod 2)], USFormatSettings) |
965 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
966 |
else
|
967 |
DBUser.ExecSQL('UPDATE Ingredients '
|
968 |
+ 'SET P = null '
|
969 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
970 |
if CheckBoxdP.Checked
|
971 |
then
|
972 |
DBUser.ExecSQL('UPDATE Ingredients '
|
973 |
+ Format('SET dP = %.15f ', [ValidateEditdP.AsFloat / 100], USFormatSettings) |
974 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
975 |
else
|
976 |
DBUser.ExecSQL('UPDATE Ingredients '
|
977 |
+ 'SET dP = null '
|
978 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
979 |
if CheckBoxdPphy.Checked
|
980 |
then
|
981 |
DBUser.ExecSQL('UPDATE Ingredients '
|
982 |
+ Format('SET dPphy = %.15f ', [ValidateEditdPphy.AsFloat / 100], USFormatSettings) |
983 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]))
|
984 |
else
|
985 |
DBUser.ExecSQL('UPDATE Ingredients '
|
986 |
+ 'SET dPphy = null '
|
987 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
988 |
DBUser.Commit; |
989 |
except
|
990 |
DBUser.RollBack; |
991 |
MessageDlg(Format(_('Unknown error: %s %s %s'), ['UnitIngredientEditionOriginal', 'ActionOKExecute', 'DBUser (UPDATE Ingredients)']), mtError, [mbOK], 0); |
992 |
Exit; |
993 |
end;
|
994 |
// Calculer les valeurs de ClientDataSetIngredients
|
995 |
Application.ProcessMessages; |
996 |
TableIngredients := DBUser.GetTable('SELECT * FROM Ingredients '
|
997 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
998 |
ClientDataSetIngredients.Edit; |
999 |
try
|
1000 |
CalcOriginal; |
1001 |
ClientDataSetIngredients.Post; |
1002 |
except
|
1003 |
ClientDataSetIngredients.Cancel; |
1004 |
MessageDlg(Format(_('Unknown error: %s %s %s'), ['UnitIngredientEditionOriginal', 'ActionOKExecute', 'ClientDataSetIngredients']), mtError, [mbOK], 0); |
1005 |
Exit; |
1006 |
end;
|
1007 |
TableIngredients.Free; |
1008 |
end;
|
1009 |
ModalResult := mrOk; |
1010 |
end;
|
1011 |
|
1012 |
procedure TFormIngredientEditionOriginal.ActionRenameExecute(Sender: TObject);
|
1013 |
begin
|
1014 |
FormRename := TFormRename.Create(nil);
|
1015 |
try
|
1016 |
FormIngredientsList.CheckBoxName.Checked := False; // D?sactiver le filtre sur le nom
|
1017 |
// FormRename.Caption := ButtonRename.Hint;
|
1018 |
FormRename.OldName := DataModuleDeclaration.ClientDataSetIngredientsName.Value; |
1019 |
FormRename.NameList.Assign(DataModuleDeclaration.UserList); |
1020 |
if (FormRename.ShowModal = mrOk) and (FormRename.NewName <> FormRename.OldName) |
1021 |
then // Renommer |
1022 |
with DataModuleDeclaration do |
1023 |
begin
|
1024 |
DBUser.BeginTransaction; |
1025 |
try
|
1026 |
DBUser.ExecSQL('UPDATE Ingredients '
|
1027 |
+ Format('SET Name = %s ', [QuotedStr(FormRename.NewName)])
|
1028 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
1029 |
DBUser.Commit; |
1030 |
except
|
1031 |
DBUser.RollBack; |
1032 |
MessageDlg(Format(_('Unknown error: %s %s %s'), ['UnitIngredientEditionOriginal', 'ActionRenameExecute', 'DBUser (UPDATE Ingredients)']), mtError, [mbOK], 0); |
1033 |
Exit; |
1034 |
end;
|
1035 |
// Renommer dans ClientDataSetIngredients
|
1036 |
ClientDataSetIngredients.Edit; |
1037 |
ClientDataSetIngredientsName.Value := FormRename.NewName; |
1038 |
ClientDataSetIngredients.Post; |
1039 |
// Modifier le nom dans la liste des mati?res premi?res utilisateur
|
1040 |
UserList[UserList.IndexOf(FormRename.OldName)] := FormRename.NewName; |
1041 |
// R?percuter le changement dans ClientDataSetComposition
|
1042 |
ClientDataSetComposition.Filter := Format('Ingredient = %d and User', [ClientDataSetIngredientsId.Value]);
|
1043 |
ClientDataSetComposition.Filtered := True; |
1044 |
try
|
1045 |
ClientDataSetComposition.First; |
1046 |
while not ClientDataSetComposition.Eof do |
1047 |
begin
|
1048 |
ClientDataSetComposition.Edit; |
1049 |
try
|
1050 |
ClientDataSetCompositionIngredientName.Value := FormRename.NewName; |
1051 |
ClientDataSetComposition.Post; |
1052 |
except
|
1053 |
ClientDataSetComposition.Cancel; |
1054 |
end;
|
1055 |
ClientDataSetComposition.Next; |
1056 |
end;
|
1057 |
finally
|
1058 |
ClientDataSetComposition.Filtered := False; |
1059 |
ClientDataSetComposition.Filter := '';
|
1060 |
end;
|
1061 |
end;
|
1062 |
finally
|
1063 |
FormRename.Release; |
1064 |
end;
|
1065 |
end;
|
1066 |
|
1067 |
procedure TFormIngredientEditionOriginal.ButtonCommentClick(Sender: TObject);
|
1068 |
begin
|
1069 |
ActionCommentExecute(Sender); |
1070 |
end;
|
1071 |
|
1072 |
procedure TFormIngredientEditionOriginal.ButtonHelpClick(Sender: TObject);
|
1073 |
begin
|
1074 |
ActionHelpExecute(Sender); |
1075 |
end;
|
1076 |
|
1077 |
procedure TFormIngredientEditionOriginal.ButtonRenameClick(Sender: TObject);
|
1078 |
begin
|
1079 |
ActionRenameExecute(Sender); |
1080 |
end;
|
1081 |
|
1082 |
procedure TFormIngredientEditionOriginal.CheckBoxADFClick(Sender: TObject);
|
1083 |
begin
|
1084 |
if CheckBoxADF.Checked
|
1085 |
then // Activer la saisie |
1086 |
EditActivate(ValidateEditADF) |
1087 |
else // Valeur inconnue |
1088 |
EditEmpty(ValidateEditADF); |
1089 |
end;
|
1090 |
|
1091 |
procedure TFormIngredientEditionOriginal.CheckBoxADLClick(Sender: TObject);
|
1092 |
begin
|
1093 |
if CheckBoxADL.Checked
|
1094 |
then // Activer la saisie |
1095 |
EditActivate(ValidateEditADL) |
1096 |
else // Valeur inconnue |
1097 |
EditEmpty(ValidateEditADL); |
1098 |
end;
|
1099 |
|
1100 |
procedure TFormIngredientEditionOriginal.CheckBoxAlaClick(Sender: TObject);
|
1101 |
begin
|
1102 |
if CheckBoxAla.Checked
|
1103 |
then // Activer la saisie |
1104 |
EditActivate(ValidateEditAla) |
1105 |
else // Valeur inconnue |
1106 |
EditEmpty(ValidateEditAla); |
1107 |
end;
|
1108 |
|
1109 |
procedure TFormIngredientEditionOriginal.CheckBoxAmidonClick(Sender: TObject);
|
1110 |
begin
|
1111 |
if CheckBoxAmidon.Checked
|
1112 |
then // Activer la saisie |
1113 |
EditActivate(ValidateEditAmidon) |
1114 |
else // Valeur inconnue |
1115 |
EditEmpty(ValidateEditAmidon); |
1116 |
end;
|
1117 |
|
1118 |
procedure TFormIngredientEditionOriginal.CheckBoxArgClick(Sender: TObject);
|
1119 |
begin
|
1120 |
if CheckBoxArg.Checked
|
1121 |
then // Activer la saisie |
1122 |
EditActivate(ValidateEditArg) |
1123 |
else // Valeur inconnue |
1124 |
EditEmpty(ValidateEditArg); |
1125 |
end;
|
1126 |
|
1127 |
procedure TFormIngredientEditionOriginal.CheckBoxAspClick(Sender: TObject);
|
1128 |
begin
|
1129 |
if CheckBoxAsp.Checked
|
1130 |
then // Activer la saisie |
1131 |
EditActivate(ValidateEditAsp) |
1132 |
else // Valeur inconnue |
1133 |
EditEmpty(ValidateEditAsp); |
1134 |
end;
|
1135 |
|
1136 |
procedure TFormIngredientEditionOriginal.CheckBoxCaClick(Sender: TObject);
|
1137 |
begin
|
1138 |
if CheckBoxCa.Checked
|
1139 |
then // Activer la saisie |
1140 |
EditActivate(ValidateEditCa) |
1141 |
else // Valeur inconnue |
1142 |
EditEmpty(ValidateEditCa); |
1143 |
end;
|
1144 |
|
1145 |
procedure TFormIngredientEditionOriginal.CheckBoxCBClick(Sender: TObject);
|
1146 |
begin
|
1147 |
if CheckBoxCB.Checked
|
1148 |
then // Activer la saisie |
1149 |
EditActivate(ValidateEditCB) |
1150 |
else // Valeur inconnue |
1151 |
EditEmpty(ValidateEditCB); |
1152 |
end;
|
1153 |
|
1154 |
procedure TFormIngredientEditionOriginal.CheckBoxCysClick(Sender: TObject);
|
1155 |
begin
|
1156 |
if CheckBoxCys.Checked
|
1157 |
then // Activer la saisie |
1158 |
EditActivate(ValidateEditCys) |
1159 |
else // Valeur inconnue |
1160 |
EditEmpty(ValidateEditCys); |
1161 |
end;
|
1162 |
|
1163 |
procedure TFormIngredientEditionOriginal.CheckBoxdAlaClick(Sender: TObject);
|
1164 |
begin
|
1165 |
if CheckBoxdAla.Checked
|
1166 |
then // Activer la saisie |
1167 |
EditActivate(ValidateEditdAla) |
1168 |
else // Afficher la valeur par d?faut |
1169 |
EditShow(ValidateEditdAla, dAla * 100);
|
1170 |
end;
|
1171 |
|
1172 |
procedure TFormIngredientEditionOriginal.CheckBoxdArgClick(Sender: TObject);
|
1173 |
begin
|
1174 |
if CheckBoxdArg.Checked
|
1175 |
then // Activer la saisie |
1176 |
EditActivate(ValidateEditdArg) |
1177 |
else // Afficher la valeur par d?faut |
1178 |
EditShow(ValidateEditdArg, dArg * 100);
|
1179 |
end;
|
1180 |
|
1181 |
procedure TFormIngredientEditionOriginal.CheckBoxdAspClick(Sender: TObject);
|
1182 |
begin
|
1183 |
if CheckBoxdAsp.Checked
|
1184 |
then // Activer la saisie |
1185 |
EditActivate(ValidateEditdAsp) |
1186 |
else // Afficher la valeur par d?faut |
1187 |
EditShow(ValidateEditdAsp, dAsp * 100);
|
1188 |
end;
|
1189 |
|
1190 |
procedure TFormIngredientEditionOriginal.CheckBoxdCysClick(Sender: TObject);
|
1191 |
begin
|
1192 |
if CheckBoxdCys.Checked
|
1193 |
then // Activer la saisie |
1194 |
EditActivate(ValidateEditdCys) |
1195 |
else // Afficher la valeur par d?faut |
1196 |
EditShow(ValidateEditdCys, dCys * 100);
|
1197 |
end;
|
1198 |
|
1199 |
procedure TFormIngredientEditionOriginal.CheckBoxdGluClick(Sender: TObject);
|
1200 |
begin
|
1201 |
if CheckBoxdGlu.Checked
|
1202 |
then // Activer la saisie |
1203 |
EditActivate(ValidateEditdGlu) |
1204 |
else // Afficher la valeur par d?faut |
1205 |
EditShow(ValidateEditdGlu, dGlu * 100);
|
1206 |
end;
|
1207 |
|
1208 |
procedure TFormIngredientEditionOriginal.CheckBoxdGlyClick(Sender: TObject);
|
1209 |
begin
|
1210 |
if CheckBoxdGly.Checked
|
1211 |
then // Activer la saisie |
1212 |
EditActivate(ValidateEditdGly) |
1213 |
else // Afficher la valeur par d?faut |
1214 |
EditShow(ValidateEditdGly, dGly * 100);
|
1215 |
end;
|
1216 |
|
1217 |
procedure TFormIngredientEditionOriginal.CheckBoxdHisClick(Sender: TObject);
|
1218 |
begin
|
1219 |
if CheckBoxdHis.Checked
|
1220 |
then // Activer la saisie |
1221 |
EditActivate(ValidateEditdHis) |
1222 |
else // Afficher la valeur par d?faut |
1223 |
EditShow(ValidateEditdHis, dHis * 100);
|
1224 |
end;
|
1225 |
|
1226 |
procedure TFormIngredientEditionOriginal.CheckBoxdIleClick(Sender: TObject);
|
1227 |
begin
|
1228 |
if CheckBoxdIle.Checked
|
1229 |
then // Activer la saisie |
1230 |
EditActivate(ValidateEditdIle) |
1231 |
else // Afficher la valeur par d?faut |
1232 |
EditShow(ValidateEditdIle, dIle * 100);
|
1233 |
end;
|
1234 |
|
1235 |
procedure TFormIngredientEditionOriginal.CheckBoxdLeuClick(Sender: TObject);
|
1236 |
begin
|
1237 |
if CheckBoxdLeu.Checked
|
1238 |
then // Activer la saisie |
1239 |
EditActivate(ValidateEditdLeu) |
1240 |
else // Afficher la valeur par d?faut |
1241 |
EditShow(ValidateEditdLeu, dLeu * 100);
|
1242 |
end;
|
1243 |
|
1244 |
procedure TFormIngredientEditionOriginal.CheckBoxdLysClick(Sender: TObject);
|
1245 |
begin
|
1246 |
if CheckBoxdLys.Checked
|
1247 |
then // Activer la saisie |
1248 |
EditActivate(ValidateEditdLys) |
1249 |
else // Afficher la valeur par d?faut |
1250 |
EditShow(ValidateEditdLys, dLys * 100);
|
1251 |
end;
|
1252 |
|
1253 |
procedure TFormIngredientEditionOriginal.CheckBoxdMetClick(Sender: TObject);
|
1254 |
begin
|
1255 |
if CheckBoxdMet.Checked
|
1256 |
then // Activer la saisie |
1257 |
EditActivate(ValidateEditdMet) |
1258 |
else // Afficher la valeur par d?faut |
1259 |
EditShow(ValidateEditdMet, dMet * 100);
|
1260 |
end;
|
1261 |
|
1262 |
procedure TFormIngredientEditionOriginal.CheckBoxdMetCysClick(Sender: TObject);
|
1263 |
begin
|
1264 |
if CheckBoxdMetCys.Checked
|
1265 |
then // Activer la saisie |
1266 |
EditActivate(ValidateEditdMetCys) |
1267 |
else // Afficher la valeur par d?faut |
1268 |
EditShow(ValidateEditdMetCys, dMetCys * 100);
|
1269 |
end;
|
1270 |
|
1271 |
procedure TFormIngredientEditionOriginal.CheckBoxdPClick(Sender: TObject);
|
1272 |
begin
|
1273 |
if CheckBoxdP.Checked
|
1274 |
then // Activer la saisie |
1275 |
EditActivate(ValidateEditdP) |
1276 |
else // Afficher la valeur par d?faut |
1277 |
if ValidateEditP.AsFloat = 0 |
1278 |
then // Null |
1279 |
EditEmpty(ValidateEditdP) |
1280 |
else // Par d?faut dP = 20% |
1281 |
EditShow(ValidateEditdP, 20);
|
1282 |
end;
|
1283 |
|
1284 |
procedure TFormIngredientEditionOriginal.CheckBoxdPheClick(Sender: TObject);
|
1285 |
begin
|
1286 |
if CheckBoxdPhe.Checked
|
1287 |
then // Activer la saisie |
1288 |
EditActivate(ValidateEditdPhe) |
1289 |
else // Afficher la valeur par d?faut |
1290 |
EditShow(ValidateEditdPhe, dPhe * 100);
|
1291 |
end;
|
1292 |
|
1293 |
procedure TFormIngredientEditionOriginal.CheckBoxdPheTyrClick(Sender: TObject);
|
1294 |
begin
|
1295 |
if CheckBoxdPheTyr.Checked
|
1296 |
then // Activer la saisie |
1297 |
EditActivate(ValidateEditdPheTyr) |
1298 |
else // Afficher la valeur par d?faut |
1299 |
EditShow(ValidateEditdPheTyr, dPheTyr * 100);
|
1300 |
end;
|
1301 |
|
1302 |
procedure TFormIngredientEditionOriginal.CheckBoxdPphyClick(Sender: TObject);
|
1303 |
begin
|
1304 |
if CheckBoxdPphy.Checked
|
1305 |
then // Activer la saisie |
1306 |
EditActivate(ValidateEditdPphy) |
1307 |
else // Afficher la valeur par d?faut |
1308 |
if ValidateEditP.AsFloat = 0 |
1309 |
then // Null |
1310 |
EditEmpty(ValidateEditdPphy) |
1311 |
else // Par d?faut dPphy = dP |
1312 |
EditShow(ValidateEditdPphy, ValidateEditdP.AsFloat); |
1313 |
end;
|
1314 |
|
1315 |
procedure TFormIngredientEditionOriginal.CheckBoxdProClick(Sender: TObject);
|
1316 |
begin
|
1317 |
if CheckBoxdPro.Checked
|
1318 |
then // Activer la saisie |
1319 |
EditActivate(ValidateEditdPro) |
1320 |
else // Afficher la valeur par d?faut |
1321 |
EditShow(ValidateEditdPro, dPro * 100);
|
1322 |
end;
|
1323 |
|
1324 |
procedure TFormIngredientEditionOriginal.CheckBoxdSerClick(Sender: TObject);
|
1325 |
begin
|
1326 |
if CheckBoxdSer.Checked
|
1327 |
then // Activer la saisie |
1328 |
EditActivate(ValidateEditdSer) |
1329 |
else // Afficher la valeur par d?faut |
1330 |
EditShow(ValidateEditdSer, dSer * 100);
|
1331 |
end;
|
1332 |
|
1333 |
procedure TFormIngredientEditionOriginal.CheckBoxdThrClick(Sender: TObject);
|
1334 |
begin
|
1335 |
if CheckBoxdThr.Checked
|
1336 |
then // Activer la saisie |
1337 |
EditActivate(ValidateEditdThr) |
1338 |
else // Afficher la valeur par d?faut |
1339 |
EditShow(ValidateEditdThr, dThr * 100);
|
1340 |
end;
|
1341 |
|
1342 |
procedure TFormIngredientEditionOriginal.CheckBoxdTrpClick(Sender: TObject);
|
1343 |
begin
|
1344 |
if CheckBoxdTrp.Checked
|
1345 |
then // Activer la saisie |
1346 |
EditActivate(ValidateEditdTrp) |
1347 |
else // Afficher la valeur par d?faut |
1348 |
EditShow(ValidateEditdTrp, dTrp * 100);
|
1349 |
end;
|
1350 |
|
1351 |
procedure TFormIngredientEditionOriginal.CheckBoxdTyrClick(Sender: TObject);
|
1352 |
begin
|
1353 |
if CheckBoxdTyr.Checked
|
1354 |
then // Activer la saisie |
1355 |
EditActivate(ValidateEditdTyr) |
1356 |
else // Afficher la valeur par d?faut |
1357 |
EditShow(ValidateEditdTyr, dTyr * 100);
|
1358 |
end;
|
1359 |
|
1360 |
procedure TFormIngredientEditionOriginal.CheckBoxdValClick(Sender: TObject);
|
1361 |
begin
|
1362 |
if CheckBoxdVal.Checked
|
1363 |
then // Activer la saisie |
1364 |
EditActivate(ValidateEditdVal) |
1365 |
else // Afficher la valeur par d?faut |
1366 |
EditShow(ValidateEditdVal, dVal * 100);
|
1367 |
end;
|
1368 |
|
1369 |
procedure TFormIngredientEditionOriginal.CheckBoxEBClick(Sender: TObject);
|
1370 |
begin
|
1371 |
if CheckBoxEB.Checked
|
1372 |
then // Activer la saisie |
1373 |
EditActivate(ValidateEditEB) |
1374 |
else // Valeur inconnue |
1375 |
EditEmpty(ValidateEditEB); |
1376 |
end;
|
1377 |
|
1378 |
procedure TFormIngredientEditionOriginal.CheckBoxGluClick(Sender: TObject);
|
1379 |
begin
|
1380 |
if CheckBoxGlu.Checked
|
1381 |
then // Activer la saisie |
1382 |
EditActivate(ValidateEditGlu) |
1383 |
else // Valeur inconnue |
1384 |
EditEmpty(ValidateEditGlu); |
1385 |
end;
|
1386 |
|
1387 |
procedure TFormIngredientEditionOriginal.CheckBoxGlyClick(Sender: TObject);
|
1388 |
begin
|
1389 |
if CheckBoxGly.Checked
|
1390 |
then // Activer la saisie |
1391 |
EditActivate(ValidateEditGly) |
1392 |
else // Valeur inconnue |
1393 |
EditEmpty(ValidateEditGly); |
1394 |
end;
|
1395 |
|
1396 |
procedure TFormIngredientEditionOriginal.CheckBoxHisClick(Sender: TObject);
|
1397 |
begin
|
1398 |
if CheckBoxHis.Checked
|
1399 |
then // Activer la saisie |
1400 |
EditActivate(ValidateEditHis) |
1401 |
else // Valeur inconnue |
1402 |
EditEmpty(ValidateEditHis); |
1403 |
end;
|
1404 |
|
1405 |
procedure TFormIngredientEditionOriginal.CheckBoxIleClick(Sender: TObject);
|
1406 |
begin
|
1407 |
if CheckBoxIle.Checked
|
1408 |
then // Activer la saisie |
1409 |
EditActivate(ValidateEditIle) |
1410 |
else // Valeur inconnue |
1411 |
EditEmpty(ValidateEditIle); |
1412 |
end;
|
1413 |
|
1414 |
procedure TFormIngredientEditionOriginal.CheckBoxLeuClick(Sender: TObject);
|
1415 |
begin
|
1416 |
if CheckBoxLeu.Checked
|
1417 |
then // Activer la saisie |
1418 |
EditActivate(ValidateEditLeu) |
1419 |
else // Valeur inconnue |
1420 |
EditEmpty(ValidateEditLeu); |
1421 |
end;
|
1422 |
|
1423 |
procedure TFormIngredientEditionOriginal.CheckBoxLysClick(Sender: TObject);
|
1424 |
begin
|
1425 |
if CheckBoxLys.Checked
|
1426 |
then // Activer la saisie |
1427 |
EditActivate(ValidateEditLys) |
1428 |
else // Valeur inconnue |
1429 |
EditEmpty(ValidateEditLys); |
1430 |
end;
|
1431 |
|
1432 |
procedure TFormIngredientEditionOriginal.CheckBoxMATClick(Sender: TObject);
|
1433 |
begin
|
1434 |
if CheckBoxMAT.Checked
|
1435 |
then // Activer la saisie |
1436 |
EditActivate(ValidateEditMAT) |
1437 |
else // Valeur inconnue |
1438 |
begin
|
1439 |
DataModuleDeclaration.RapMAT := 0;
|
1440 |
EditEmpty(ValidateEditMAT); |
1441 |
// D?sactiver la saisie des acides amin?s
|
1442 |
DisableAA; |
1443 |
end;
|
1444 |
end;
|
1445 |
|
1446 |
procedure TFormIngredientEditionOriginal.CheckBoxMetClick(Sender: TObject);
|
1447 |
begin
|
1448 |
if CheckBoxMet.Checked
|
1449 |
then // Activer la saisie |
1450 |
EditActivate(ValidateEditMet) |
1451 |
else // Valeur inconnue |
1452 |
EditEmpty(ValidateEditMet); |
1453 |
end;
|
1454 |
|
1455 |
procedure TFormIngredientEditionOriginal.CheckBoxMetCysClick(Sender: TObject);
|
1456 |
begin
|
1457 |
if CheckBoxMetCys.Checked
|
1458 |
then // Activer la saisie |
1459 |
EditActivate(ValidateEditMetCys) |
1460 |
else // Valeur inconnue |
1461 |
EditEmpty(ValidateEditMetCys); |
1462 |
end;
|
1463 |
|
1464 |
procedure TFormIngredientEditionOriginal.CheckBoxMGClick(Sender: TObject);
|
1465 |
begin
|
1466 |
if CheckBoxMG.Checked
|
1467 |
then // Activer la saisie |
1468 |
EditActivate(ValidateEditMG) |
1469 |
else // Valeur inconnue |
1470 |
EditEmpty(ValidateEditMG); |
1471 |
end;
|
1472 |
|
1473 |
procedure TFormIngredientEditionOriginal.CheckBoxMMClick(Sender: TObject);
|
1474 |
begin
|
1475 |
if CheckBoxMM.Checked
|
1476 |
then // Activer la saisie |
1477 |
EditActivate(ValidateEditMM) |
1478 |
else // Valeur inconnue |
1479 |
EditEmpty(ValidateEditMM); |
1480 |
end;
|
1481 |
|
1482 |
procedure TFormIngredientEditionOriginal.CheckBoxNDFClick(Sender: TObject);
|
1483 |
begin
|
1484 |
if CheckBoxNDF.Checked
|
1485 |
then // Activer la saisie |
1486 |
EditActivate(ValidateEditNDF) |
1487 |
else // Valeur inconnue |
1488 |
EditEmpty(ValidateEditNDF); |
1489 |
end;
|
1490 |
|
1491 |
procedure TFormIngredientEditionOriginal.CheckBoxPClick(Sender: TObject);
|
1492 |
begin
|
1493 |
if CheckBoxP.Checked
|
1494 |
then // Activer la saisie |
1495 |
EditActivate(ValidateEditP) |
1496 |
else // Valeur inconnue |
1497 |
begin
|
1498 |
EditEmpty(ValidateEditP); |
1499 |
// D?sactiver la saisie du phosphore digestible
|
1500 |
DisabledP; |
1501 |
end;
|
1502 |
end;
|
1503 |
|
1504 |
procedure TFormIngredientEditionOriginal.CheckBoxPheClick(Sender: TObject);
|
1505 |
begin
|
1506 |
if CheckBoxPhe.Checked
|
1507 |
then // Activer la saisie |
1508 |
EditActivate(ValidateEditPhe) |
1509 |
else // Valeur inconnue |
1510 |
EditEmpty(ValidateEditPhe); |
1511 |
end;
|
1512 |
|
1513 |
procedure TFormIngredientEditionOriginal.CheckBoxPheTyrClick(Sender: TObject);
|
1514 |
begin
|
1515 |
if CheckBoxPheTyr.Checked
|
1516 |
then // Activer la saisie |
1517 |
EditActivate(ValidateEditPheTyr) |
1518 |
else // Valeur inconnue |
1519 |
EditEmpty(ValidateEditPheTyr); |
1520 |
end;
|
1521 |
|
1522 |
procedure TFormIngredientEditionOriginal.CheckBoxProClick(Sender: TObject);
|
1523 |
begin
|
1524 |
if CheckBoxPro.Checked
|
1525 |
then // Activer la saisie |
1526 |
EditActivate(ValidateEditPro) |
1527 |
else // Valeur inconnue |
1528 |
EditEmpty(ValidateEditPro); |
1529 |
end;
|
1530 |
|
1531 |
procedure TFormIngredientEditionOriginal.CheckBoxSerClick(Sender: TObject);
|
1532 |
begin
|
1533 |
if CheckBoxSer.Checked
|
1534 |
then // Activer la saisie |
1535 |
EditActivate(ValidateEditSer) |
1536 |
else // Valeur inconnue |
1537 |
EditEmpty(ValidateEditSer); |
1538 |
end;
|
1539 |
|
1540 |
procedure TFormIngredientEditionOriginal.CheckBoxSucresClick(Sender: TObject);
|
1541 |
begin
|
1542 |
if CheckBoxSucres.Checked
|
1543 |
then // Activer la saisie |
1544 |
EditActivate(ValidateEditSucres) |
1545 |
else // Valeur inconnue |
1546 |
EditEmpty(ValidateEditSucres); |
1547 |
end;
|
1548 |
|
1549 |
procedure TFormIngredientEditionOriginal.CheckBoxThrClick(Sender: TObject);
|
1550 |
begin
|
1551 |
if CheckBoxThr.Checked
|
1552 |
then // Activer la saisie |
1553 |
EditActivate(ValidateEditThr) |
1554 |
else // Valeur inconnue |
1555 |
EditEmpty(ValidateEditThr); |
1556 |
end;
|
1557 |
|
1558 |
procedure TFormIngredientEditionOriginal.CheckBoxTrpClick(Sender: TObject);
|
1559 |
begin
|
1560 |
if CheckBoxTrp.Checked
|
1561 |
then // Activer la saisie |
1562 |
EditActivate(ValidateEditTrp) |
1563 |
else // Valeur inconnue |
1564 |
EditEmpty(ValidateEditTrp); |
1565 |
end;
|
1566 |
|
1567 |
procedure TFormIngredientEditionOriginal.CheckBoxTyrClick(Sender: TObject);
|
1568 |
begin
|
1569 |
if CheckBoxTyr.Checked
|
1570 |
then // Activer la saisie |
1571 |
EditActivate(ValidateEditTyr) |
1572 |
else // Valeur inconnue |
1573 |
EditEmpty(ValidateEditTyr); |
1574 |
end;
|
1575 |
|
1576 |
procedure TFormIngredientEditionOriginal.CheckBoxValClick(Sender: TObject);
|
1577 |
begin
|
1578 |
if CheckBoxVal.Checked
|
1579 |
then // Activer la saisie |
1580 |
EditActivate(ValidateEditVal) |
1581 |
else // Valeur inconnue |
1582 |
EditEmpty(ValidateEditVal); |
1583 |
end;
|
1584 |
|
1585 |
procedure TFormIngredientEditionOriginal.ComboBoxAAChange(Sender: TObject);
|
1586 |
begin
|
1587 |
if ComboBoxAA.ItemIndex <> AAUnit
|
1588 |
then // Changement d'unit? |
1589 |
begin
|
1590 |
if ComboBoxAA.ItemIndex mod 2 = 0 |
1591 |
then // % |
1592 |
begin
|
1593 |
ValidateEditLys.DecimalPlaces := 2;
|
1594 |
ValidateEditThr.DecimalPlaces := 2;
|
1595 |
ValidateEditMet.DecimalPlaces := 2;
|
1596 |
ValidateEditCys.DecimalPlaces := 2;
|
1597 |
ValidateEditMetCys.DecimalPlaces := 2;
|
1598 |
ValidateEditTrp.DecimalPlaces := 2;
|
1599 |
ValidateEditIle.DecimalPlaces := 2;
|
1600 |
ValidateEditVal.DecimalPlaces := 2;
|
1601 |
ValidateEditLeu.DecimalPlaces := 2;
|
1602 |
ValidateEditPhe.DecimalPlaces := 2;
|
1603 |
ValidateEditTyr.DecimalPlaces := 2;
|
1604 |
ValidateEditPheTyr.DecimalPlaces := 2;
|
1605 |
ValidateEditHis.DecimalPlaces := 2;
|
1606 |
ValidateEditArg.DecimalPlaces := 2;
|
1607 |
ValidateEditAla.DecimalPlaces := 2;
|
1608 |
ValidateEditAsp.DecimalPlaces := 2;
|
1609 |
ValidateEditGlu.DecimalPlaces := 2;
|
1610 |
ValidateEditGly.DecimalPlaces := 2;
|
1611 |
ValidateEditSer.DecimalPlaces := 2;
|
1612 |
ValidateEditPro.DecimalPlaces := 2;
|
1613 |
end
|
1614 |
else // g/kg |
1615 |
begin
|
1616 |
ValidateEditLys.MaxValue := 1000;
|
1617 |
ValidateEditThr.MaxValue := 1000;
|
1618 |
ValidateEditMet.MaxValue := 1000;
|
1619 |
ValidateEditCys.MaxValue := 1000;
|
1620 |
ValidateEditMetCys.MaxValue := 1000;
|
1621 |
ValidateEditTrp.MaxValue := 1000;
|
1622 |
ValidateEditIle.MaxValue := 1000;
|
1623 |
ValidateEditVal.MaxValue := 1000;
|
1624 |
ValidateEditLeu.MaxValue := 1000;
|
1625 |
ValidateEditPhe.MaxValue := 1000;
|
1626 |
ValidateEditTyr.MaxValue := 1000;
|
1627 |
ValidateEditPheTyr.MaxValue := 1000;
|
1628 |
ValidateEditHis.MaxValue := 1000;
|
1629 |
ValidateEditArg.MaxValue := 1000;
|
1630 |
ValidateEditAla.MaxValue := 1000;
|
1631 |
ValidateEditAsp.MaxValue := 1000;
|
1632 |
ValidateEditGlu.MaxValue := 1000;
|
1633 |
ValidateEditGly.MaxValue := 1000;
|
1634 |
ValidateEditSer.MaxValue := 1000;
|
1635 |
ValidateEditPro.MaxValue := 1000;
|
1636 |
end;
|
1637 |
if AAUnit <> -1 |
1638 |
then
|
1639 |
with DataModuleDeclaration do |
1640 |
begin
|
1641 |
if CheckBoxLys.Checked
|
1642 |
then // Conversion |
1643 |
ValidateEditLys.AsFloat := OutputAA(InputAA(ValidateEditLys.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1644 |
if CheckBoxThr.Checked
|
1645 |
then // Conversion |
1646 |
ValidateEditThr.AsFloat := OutputAA(InputAA(ValidateEditThr.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1647 |
if CheckBoxMet.Checked
|
1648 |
then // Conversion |
1649 |
ValidateEditMet.AsFloat := OutputAA(InputAA(ValidateEditMet.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1650 |
if CheckBoxCys.Checked
|
1651 |
then // Conversion |
1652 |
ValidateEditCys.AsFloat := OutputAA(InputAA(ValidateEditCys.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1653 |
if CheckBoxMetCys.Checked
|
1654 |
then // Conversion |
1655 |
ValidateEditMetCys.AsFloat := OutputAA(InputAA(ValidateEditMetCys.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1656 |
if CheckBoxTrp.Checked
|
1657 |
then // Conversion |
1658 |
ValidateEditTrp.AsFloat := OutputAA(InputAA(ValidateEditTrp.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1659 |
if CheckBoxIle.Checked
|
1660 |
then // Conversion |
1661 |
ValidateEditIle.AsFloat := OutputAA(InputAA(ValidateEditIle.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1662 |
if CheckBoxVal.Checked
|
1663 |
then // Conversion |
1664 |
ValidateEditVal.AsFloat := OutputAA(InputAA(ValidateEditVal.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1665 |
if CheckBoxLeu.Checked
|
1666 |
then // Conversion |
1667 |
ValidateEditLeu.AsFloat := OutputAA(InputAA(ValidateEditLeu.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1668 |
if CheckBoxPhe.Checked
|
1669 |
then // Conversion |
1670 |
ValidateEditPhe.AsFloat := OutputAA(InputAA(ValidateEditPhe.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1671 |
if CheckBoxTyr.Checked
|
1672 |
then // Conversion |
1673 |
ValidateEditTyr.AsFloat := OutputAA(InputAA(ValidateEditTyr.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1674 |
if CheckBoxPheTyr.Checked
|
1675 |
then // Conversion |
1676 |
ValidateEditPheTyr.AsFloat := OutputAA(InputAA(ValidateEditPheTyr.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1677 |
if CheckBoxHis.Checked
|
1678 |
then // Conversion |
1679 |
ValidateEditHis.AsFloat := OutputAA(InputAA(ValidateEditHis.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1680 |
if CheckBoxArg.Checked
|
1681 |
then // Conversion |
1682 |
ValidateEditArg.AsFloat := OutputAA(InputAA(ValidateEditArg.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1683 |
if CheckBoxAla.Checked
|
1684 |
then // Conversion |
1685 |
ValidateEditAla.AsFloat := OutputAA(InputAA(ValidateEditAla.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1686 |
if CheckBoxAsp.Checked
|
1687 |
then // Conversion |
1688 |
ValidateEditAsp.AsFloat := OutputAA(InputAA(ValidateEditAsp.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1689 |
if CheckBoxGlu.Checked
|
1690 |
then // Conversion |
1691 |
ValidateEditGlu.AsFloat := OutputAA(InputAA(ValidateEditGlu.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1692 |
if CheckBoxGly.Checked
|
1693 |
then // Conversion |
1694 |
ValidateEditGly.AsFloat := OutputAA(InputAA(ValidateEditGly.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1695 |
if CheckBoxSer.Checked
|
1696 |
then // Conversion |
1697 |
ValidateEditSer.AsFloat := OutputAA(InputAA(ValidateEditSer.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1698 |
if CheckBoxPro.Checked
|
1699 |
then // Conversion |
1700 |
ValidateEditPro.AsFloat := OutputAA(InputAA(ValidateEditPro.AsFloat, RapMAT, RapMS, AAUnit div 2, AAUnit mod 2), RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2); |
1701 |
end;
|
1702 |
if ComboBoxAA.ItemIndex mod 2 = 0 |
1703 |
then // % |
1704 |
begin
|
1705 |
ValidateEditLys.MaxValue := 100;
|
1706 |
ValidateEditThr.MaxValue := 100;
|
1707 |
ValidateEditMet.MaxValue := 100;
|
1708 |
ValidateEditCys.MaxValue := 100;
|
1709 |
ValidateEditMetCys.MaxValue := 100;
|
1710 |
ValidateEditTrp.MaxValue := 100;
|
1711 |
ValidateEditIle.MaxValue := 100;
|
1712 |
ValidateEditVal.MaxValue := 100;
|
1713 |
ValidateEditLeu.MaxValue := 100;
|
1714 |
ValidateEditPhe.MaxValue := 100;
|
1715 |
ValidateEditTyr.MaxValue := 100;
|
1716 |
ValidateEditPheTyr.MaxValue := 100;
|
1717 |
ValidateEditHis.MaxValue := 100;
|
1718 |
ValidateEditArg.MaxValue := 100;
|
1719 |
ValidateEditAla.MaxValue := 100;
|
1720 |
ValidateEditAsp.MaxValue := 100;
|
1721 |
ValidateEditGlu.MaxValue := 100;
|
1722 |
ValidateEditGly.MaxValue := 100;
|
1723 |
ValidateEditSer.MaxValue := 100;
|
1724 |
ValidateEditPro.MaxValue := 100;
|
1725 |
end
|
1726 |
else // g/kg |
1727 |
begin
|
1728 |
ValidateEditLys.DecimalPlaces := 1;
|
1729 |
ValidateEditThr.DecimalPlaces := 1;
|
1730 |
ValidateEditMet.DecimalPlaces := 1;
|
1731 |
ValidateEditCys.DecimalPlaces := 1;
|
1732 |
ValidateEditMetCys.DecimalPlaces := 1;
|
1733 |
ValidateEditTrp.DecimalPlaces := 1;
|
1734 |
ValidateEditIle.DecimalPlaces := 1;
|
1735 |
ValidateEditVal.DecimalPlaces := 1;
|
1736 |
ValidateEditLeu.DecimalPlaces := 1;
|
1737 |
ValidateEditPhe.DecimalPlaces := 1;
|
1738 |
ValidateEditTyr.DecimalPlaces := 1;
|
1739 |
ValidateEditPheTyr.DecimalPlaces := 1;
|
1740 |
ValidateEditHis.DecimalPlaces := 1;
|
1741 |
ValidateEditArg.DecimalPlaces := 1;
|
1742 |
ValidateEditAla.DecimalPlaces := 1;
|
1743 |
ValidateEditAsp.DecimalPlaces := 1;
|
1744 |
ValidateEditGlu.DecimalPlaces := 1;
|
1745 |
ValidateEditGly.DecimalPlaces := 1;
|
1746 |
ValidateEditSer.DecimalPlaces := 1;
|
1747 |
ValidateEditPro.DecimalPlaces := 1;
|
1748 |
end;
|
1749 |
AAUnit := ComboBoxAA.ItemIndex; |
1750 |
end;
|
1751 |
end;
|
1752 |
|
1753 |
procedure TFormIngredientEditionOriginal.ComboBoxEnergyChange(Sender: TObject);
|
1754 |
begin
|
1755 |
if ComboBoxEnergy.ItemIndex <> EnergyUnit
|
1756 |
then // Changement d'unit? |
1757 |
begin
|
1758 |
if ComboBoxEnergy.ItemIndex mod 2 = 0 |
1759 |
then // MJ/kg |
1760 |
ValidateEditEB.DecimalPlaces := 2;
|
1761 |
if CheckBoxEB.Checked
|
1762 |
then // Conversion |
1763 |
with DataModuleDeclaration do |
1764 |
ValidateEditEB.AsFloat := OutputEnergy(InputEnergy(ValidateEditEB.AsFloat, RapMS, EnergyUnit div 2, EnergyUnit mod 2), RapMS, ComboBoxEnergy.ItemIndex div 2, ComboBoxEnergy.ItemIndex mod 2); |
1765 |
if ComboBoxEnergy.ItemIndex mod 2 = 1 |
1766 |
then // kcal/kg |
1767 |
ValidateEditEB.DecimalPlaces := 0;
|
1768 |
EnergyUnit := ComboBoxEnergy.ItemIndex; |
1769 |
end;
|
1770 |
end;
|
1771 |
|
1772 |
procedure TFormIngredientEditionOriginal.ComboBoxMineralsChange(Sender: TObject);
|
1773 |
begin
|
1774 |
if ComboBoxMinerals.ItemIndex <> MineralsUnit
|
1775 |
then // Changement d'unit? |
1776 |
begin
|
1777 |
if ComboBoxMinerals.ItemIndex mod 2 = 0 |
1778 |
then // % |
1779 |
begin
|
1780 |
ValidateEditCa.DecimalPlaces := 2;
|
1781 |
ValidateEditP.DecimalPlaces := 2;
|
1782 |
end
|
1783 |
else // g/kg |
1784 |
begin
|
1785 |
ValidateEditCa.MaxValue := 1000;
|
1786 |
ValidateEditP.MaxValue := 1000;
|
1787 |
end;
|
1788 |
with DataModuleDeclaration do |
1789 |
begin
|
1790 |
if CheckBoxCa.Checked
|
1791 |
then // Conversion |
1792 |
ValidateEditCa.AsFloat := OutputMinerals(InputMinerals(ValidateEditCa.AsFloat, RapMS, MineralsUnit div 2, MineralsUnit mod 2), RapMS, ComboBoxMinerals.ItemIndex div 2, ComboBoxMinerals.ItemIndex mod 2); |
1793 |
if CheckBoxP.Checked
|
1794 |
then // Conversion |
1795 |
ValidateEditP.AsFloat := OutputMinerals(InputMinerals(ValidateEditP.AsFloat, RapMS, MineralsUnit div 2, MineralsUnit mod 2), RapMS, ComboBoxMinerals.ItemIndex div 2, ComboBoxMinerals.ItemIndex mod 2); |
1796 |
end;
|
1797 |
if ComboBoxMinerals.ItemIndex mod 2 = 0 |
1798 |
then // % |
1799 |
begin
|
1800 |
ValidateEditCa.MaxValue := 100;
|
1801 |
ValidateEditP.MaxValue := 100;
|
1802 |
end
|
1803 |
else // g/kg |
1804 |
begin
|
1805 |
ValidateEditCa.DecimalPlaces := 1;
|
1806 |
ValidateEditP.DecimalPlaces := 1;
|
1807 |
end;
|
1808 |
MineralsUnit := ComboBoxMinerals.ItemIndex; |
1809 |
end;
|
1810 |
end;
|
1811 |
|
1812 |
procedure TFormIngredientEditionOriginal.ComboBoxProximalChange(Sender: TObject);
|
1813 |
begin
|
1814 |
if ComboBoxProximal.ItemIndex <> ProximalUnit
|
1815 |
then // Changement d'unit? |
1816 |
begin
|
1817 |
if ComboBoxProximal.ItemIndex mod 2 = 0 |
1818 |
then // % |
1819 |
begin
|
1820 |
ValidateEditMM.DecimalPlaces := 2;
|
1821 |
ValidateEditMAT.DecimalPlaces := 2;
|
1822 |
ValidateEditMG.DecimalPlaces := 2;
|
1823 |
ValidateEditCB.DecimalPlaces := 2;
|
1824 |
ValidateEditNDF.DecimalPlaces := 2;
|
1825 |
ValidateEditADF.DecimalPlaces := 2;
|
1826 |
ValidateEditADL.DecimalPlaces := 2;
|
1827 |
ValidateEditAmidon.DecimalPlaces := 2;
|
1828 |
ValidateEditSucres.DecimalPlaces := 2;
|
1829 |
end
|
1830 |
else // g/kg |
1831 |
begin
|
1832 |
ValidateEditMM.MaxValue := 1000;
|
1833 |
ValidateEditMAT.MaxValue := 1000;
|
1834 |
ValidateEditMG.MaxValue := 1000;
|
1835 |
ValidateEditCB.MaxValue := 1000;
|
1836 |
ValidateEditNDF.MaxValue := 1000;
|
1837 |
ValidateEditADF.MaxValue := 1000;
|
1838 |
ValidateEditADL.MaxValue := 1000;
|
1839 |
ValidateEditAmidon.MaxValue := 1000;
|
1840 |
ValidateEditSucres.MaxValue := 1000;
|
1841 |
end;
|
1842 |
with DataModuleDeclaration do |
1843 |
begin
|
1844 |
if CheckBoxMM.Checked
|
1845 |
then // Conversion |
1846 |
ValidateEditMM.AsFloat := OutputProximal(InputProximal(ValidateEditMM.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2), RapMS, ComboBoxProximal.ItemIndex div 2, ComboBoxProximal.ItemIndex mod 2); |
1847 |
if CheckBoxMAT.Checked
|
1848 |
then // Conversion |
1849 |
ValidateEditMAT.AsFloat := OutputProximal(InputProximal(ValidateEditMAT.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2), RapMS, ComboBoxProximal.ItemIndex div 2, ComboBoxProximal.ItemIndex mod 2); |
1850 |
if CheckBoxMG.Checked
|
1851 |
then // Conversion |
1852 |
ValidateEditMG.AsFloat := OutputProximal(InputProximal(ValidateEditMG.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2), RapMS, ComboBoxProximal.ItemIndex div 2, ComboBoxProximal.ItemIndex mod 2); |
1853 |
if CheckBoxCB.Checked
|
1854 |
then // Conversion |
1855 |
ValidateEditCB.AsFloat := OutputProximal(InputProximal(ValidateEditCB.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2), RapMS, ComboBoxProximal.ItemIndex div 2, ComboBoxProximal.ItemIndex mod 2); |
1856 |
if CheckBoxNDF.Checked
|
1857 |
then // Conversion |
1858 |
ValidateEditNDF.AsFloat := OutputProximal(InputProximal(ValidateEditNDF.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2), RapMS, ComboBoxProximal.ItemIndex div 2, ComboBoxProximal.ItemIndex mod 2); |
1859 |
if CheckBoxADF.Checked
|
1860 |
then // Conversion |
1861 |
ValidateEditADF.AsFloat := OutputProximal(InputProximal(ValidateEditADF.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2), RapMS, ComboBoxProximal.ItemIndex div 2, ComboBoxProximal.ItemIndex mod 2); |
1862 |
if CheckBoxADL.Checked
|
1863 |
then // Conversion |
1864 |
ValidateEditADL.AsFloat := OutputProximal(InputProximal(ValidateEditADL.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2), RapMS, ComboBoxProximal.ItemIndex div 2, ComboBoxProximal.ItemIndex mod 2); |
1865 |
if CheckBoxAmidon.Checked
|
1866 |
then // Conversion |
1867 |
ValidateEditAmidon.AsFloat := OutputProximal(InputProximal(ValidateEditAmidon.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2), RapMS, ComboBoxProximal.ItemIndex div 2, ComboBoxProximal.ItemIndex mod 2); |
1868 |
if CheckBoxSucres.Checked
|
1869 |
then // Conversion |
1870 |
ValidateEditSucres.AsFloat := OutputProximal(InputProximal(ValidateEditSucres.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2), RapMS, ComboBoxProximal.ItemIndex div 2, ComboBoxProximal.ItemIndex mod 2); |
1871 |
end;
|
1872 |
if ComboBoxProximal.ItemIndex mod 2 = 0 |
1873 |
then // % |
1874 |
begin
|
1875 |
ValidateEditMM.MaxValue := 100;
|
1876 |
ValidateEditMAT.MaxValue := 100;
|
1877 |
ValidateEditMG.MaxValue := 100;
|
1878 |
ValidateEditCB.MaxValue := 100;
|
1879 |
ValidateEditNDF.MaxValue := 100;
|
1880 |
ValidateEditADF.MaxValue := 100;
|
1881 |
ValidateEditADL.MaxValue := 100;
|
1882 |
ValidateEditAmidon.MaxValue := 100;
|
1883 |
ValidateEditSucres.MaxValue := 100;
|
1884 |
end
|
1885 |
else // g/kg |
1886 |
begin
|
1887 |
ValidateEditMM.DecimalPlaces := 1;
|
1888 |
ValidateEditMAT.DecimalPlaces := 1;
|
1889 |
ValidateEditMG.DecimalPlaces := 1;
|
1890 |
ValidateEditCB.DecimalPlaces := 1;
|
1891 |
ValidateEditNDF.DecimalPlaces := 1;
|
1892 |
ValidateEditADF.DecimalPlaces := 1;
|
1893 |
ValidateEditADL.DecimalPlaces := 1;
|
1894 |
ValidateEditAmidon.DecimalPlaces := 1;
|
1895 |
ValidateEditSucres.DecimalPlaces := 1;
|
1896 |
end;
|
1897 |
ProximalUnit := ComboBoxProximal.ItemIndex; |
1898 |
end;
|
1899 |
end;
|
1900 |
|
1901 |
procedure TFormIngredientEditionOriginal.DisableAA;
|
1902 |
begin
|
1903 |
CheckBoxLys.Checked := False; |
1904 |
CheckBoxThr.Checked := False; |
1905 |
CheckBoxMet.Checked := False; |
1906 |
CheckBoxCys.Checked := False; |
1907 |
CheckBoxMetCys.Checked := False; |
1908 |
CheckBoxTrp.Checked := False; |
1909 |
CheckBoxIle.Checked := False; |
1910 |
CheckBoxVal.Checked := False; |
1911 |
CheckBoxLeu.Checked := False; |
1912 |
CheckBoxPhe.Checked := False; |
1913 |
CheckBoxTyr.Checked := False; |
1914 |
CheckBoxPheTyr.Checked := False; |
1915 |
CheckBoxHis.Checked := False; |
1916 |
CheckBoxArg.Checked := False; |
1917 |
CheckBoxAla.Checked := False; |
1918 |
CheckBoxAsp.Checked := False; |
1919 |
CheckBoxGlu.Checked := False; |
1920 |
CheckBoxGly.Checked := False; |
1921 |
CheckBoxSer.Checked := False; |
1922 |
CheckBoxPro.Checked := False; |
1923 |
CheckBoxdLys.Checked := False; |
1924 |
CheckBoxdThr.Checked := False; |
1925 |
CheckBoxdMet.Checked := False; |
1926 |
CheckBoxdCys.Checked := False; |
1927 |
CheckBoxdMetCys.Checked := False; |
1928 |
CheckBoxdTrp.Checked := False; |
1929 |
CheckBoxdIle.Checked := False; |
1930 |
CheckBoxdVal.Checked := False; |
1931 |
CheckBoxdLeu.Checked := False; |
1932 |
CheckBoxdPhe.Checked := False; |
1933 |
CheckBoxdTyr.Checked := False; |
1934 |
CheckBoxdPheTyr.Checked := False; |
1935 |
CheckBoxdHis.Checked := False; |
1936 |
CheckBoxdArg.Checked := False; |
1937 |
CheckBoxdAla.Checked := False; |
1938 |
CheckBoxdAsp.Checked := False; |
1939 |
CheckBoxdGlu.Checked := False; |
1940 |
CheckBoxdGly.Checked := False; |
1941 |
CheckBoxdSer.Checked := False; |
1942 |
CheckBoxdPro.Checked := False; |
1943 |
// Verrouillage
|
1944 |
CheckBoxLys.Enabled := False; |
1945 |
CheckBoxThr.Enabled := False; |
1946 |
CheckBoxMet.Enabled := False; |
1947 |
CheckBoxCys.Enabled := False; |
1948 |
CheckBoxMetCys.Enabled := False; |
1949 |
CheckBoxTrp.Enabled := False; |
1950 |
CheckBoxIle.Enabled := False; |
1951 |
CheckBoxVal.Enabled := False; |
1952 |
CheckBoxLeu.Enabled := False; |
1953 |
CheckBoxPhe.Enabled := False; |
1954 |
CheckBoxTyr.Enabled := False; |
1955 |
CheckBoxPheTyr.Enabled := False; |
1956 |
CheckBoxHis.Enabled := False; |
1957 |
CheckBoxArg.Enabled := False; |
1958 |
CheckBoxAla.Enabled := False; |
1959 |
CheckBoxAsp.Enabled := False; |
1960 |
CheckBoxGlu.Enabled := False; |
1961 |
CheckBoxGly.Enabled := False; |
1962 |
CheckBoxSer.Enabled := False; |
1963 |
CheckBoxPro.Enabled := False; |
1964 |
CheckBoxdLys.Enabled := False; |
1965 |
CheckBoxdThr.Enabled := False; |
1966 |
CheckBoxdMet.Enabled := False; |
1967 |
CheckBoxdCys.Enabled := False; |
1968 |
CheckBoxdMetCys.Enabled := False; |
1969 |
CheckBoxdTrp.Enabled := False; |
1970 |
CheckBoxdIle.Enabled := False; |
1971 |
CheckBoxdVal.Enabled := False; |
1972 |
CheckBoxdLeu.Enabled := False; |
1973 |
CheckBoxdPhe.Enabled := False; |
1974 |
CheckBoxdTyr.Enabled := False; |
1975 |
CheckBoxdPheTyr.Enabled := False; |
1976 |
CheckBoxdHis.Enabled := False; |
1977 |
CheckBoxdArg.Enabled := False; |
1978 |
CheckBoxdAla.Enabled := False; |
1979 |
CheckBoxdAsp.Enabled := False; |
1980 |
CheckBoxdGlu.Enabled := False; |
1981 |
CheckBoxdGly.Enabled := False; |
1982 |
CheckBoxdSer.Enabled := False; |
1983 |
CheckBoxdPro.Enabled := False; |
1984 |
end;
|
1985 |
|
1986 |
procedure TFormIngredientEditionOriginal.DisabledP;
|
1987 |
begin
|
1988 |
if CheckBoxdPphy.Checked
|
1989 |
then
|
1990 |
CheckBoxdPphy.Checked := False |
1991 |
else
|
1992 |
CheckBoxdPphyClick(nil);
|
1993 |
if CheckBoxdP.Checked
|
1994 |
then
|
1995 |
CheckBoxdP.Checked := False |
1996 |
else
|
1997 |
CheckBoxdPClick(nil);
|
1998 |
// Verrouillage
|
1999 |
CheckBoxdPphy.Enabled := False; |
2000 |
CheckBoxdP.Enabled := False; |
2001 |
end;
|
2002 |
|
2003 |
procedure TFormIngredientEditionOriginal.EnableAA;
|
2004 |
begin
|
2005 |
CheckBoxLys.Enabled := True; |
2006 |
CheckBoxThr.Enabled := True; |
2007 |
CheckBoxMet.Enabled := True; |
2008 |
CheckBoxCys.Enabled := True; |
2009 |
CheckBoxMetCys.Enabled := True; |
2010 |
CheckBoxTrp.Enabled := True; |
2011 |
CheckBoxIle.Enabled := True; |
2012 |
CheckBoxVal.Enabled := True; |
2013 |
CheckBoxLeu.Enabled := True; |
2014 |
CheckBoxPhe.Enabled := True; |
2015 |
CheckBoxTyr.Enabled := True; |
2016 |
CheckBoxPheTyr.Enabled := True; |
2017 |
CheckBoxHis.Enabled := True; |
2018 |
CheckBoxArg.Enabled := True; |
2019 |
CheckBoxAla.Enabled := True; |
2020 |
CheckBoxAsp.Enabled := True; |
2021 |
CheckBoxGlu.Enabled := True; |
2022 |
CheckBoxGly.Enabled := True; |
2023 |
CheckBoxSer.Enabled := True; |
2024 |
CheckBoxPro.Enabled := True; |
2025 |
CheckBoxdLys.Enabled := True; |
2026 |
CheckBoxdThr.Enabled := True; |
2027 |
CheckBoxdMet.Enabled := True; |
2028 |
CheckBoxdCys.Enabled := True; |
2029 |
CheckBoxdMetCys.Enabled := True; |
2030 |
CheckBoxdTrp.Enabled := True; |
2031 |
CheckBoxdIle.Enabled := True; |
2032 |
CheckBoxdVal.Enabled := True; |
2033 |
CheckBoxdLeu.Enabled := True; |
2034 |
CheckBoxdPhe.Enabled := True; |
2035 |
CheckBoxdTyr.Enabled := True; |
2036 |
CheckBoxdPheTyr.Enabled := True; |
2037 |
CheckBoxdHis.Enabled := True; |
2038 |
CheckBoxdArg.Enabled := True; |
2039 |
CheckBoxdAla.Enabled := True; |
2040 |
CheckBoxdAsp.Enabled := True; |
2041 |
CheckBoxdGlu.Enabled := True; |
2042 |
CheckBoxdGly.Enabled := True; |
2043 |
CheckBoxdSer.Enabled := True; |
2044 |
CheckBoxdPro.Enabled := True; |
2045 |
end;
|
2046 |
|
2047 |
procedure TFormIngredientEditionOriginal.EnabledP;
|
2048 |
begin
|
2049 |
CheckBoxdPphy.Enabled := True; |
2050 |
CheckBoxdP.Enabled := True; |
2051 |
end;
|
2052 |
|
2053 |
procedure TFormIngredientEditionOriginal.EditActivate(Edit: TJvValidateEdit);
|
2054 |
begin
|
2055 |
Edit.DisplayFormat := dfFloat; |
2056 |
Edit.Enabled := True; |
2057 |
ActiveControl := Edit; |
2058 |
Edit.SelectAll; |
2059 |
end;
|
2060 |
|
2061 |
procedure TFormIngredientEditionOriginal.EditEmpty(Edit: TJvValidateEdit);
|
2062 |
begin
|
2063 |
Edit.DisplayFormat := dfNone; |
2064 |
Edit.Value := '';
|
2065 |
Edit.Enabled := False; |
2066 |
end;
|
2067 |
|
2068 |
procedure TFormIngredientEditionOriginal.EditShow(Edit: TJvValidateEdit; const Value: Double); |
2069 |
begin
|
2070 |
Edit.DisplayFormat := dfFloat; |
2071 |
Edit.AsFloat := Value; |
2072 |
Edit.Enabled := False; |
2073 |
end;
|
2074 |
|
2075 |
procedure TFormIngredientEditionOriginal.FormCreate(Sender: TObject);
|
2076 |
var
|
2077 |
i: Integer; |
2078 |
begin
|
2079 |
if Screen.Fonts.IndexOf('Arial Unicode MS') <> -1 |
2080 |
then
|
2081 |
Font.Name := 'Arial Unicode MS';
|
2082 |
// PanelButtons.Font.Size := PanelButtons.Font.Size + 2;
|
2083 |
PanelButtons.Font.Style := [fsBold]; |
2084 |
LabelName.Font.Style := [fsBold]; |
2085 |
DBEditName.Font.Style := [fsBold]; |
2086 |
LabelWarning.Font.Color := clRed; |
2087 |
TranslateComponent(Self); |
2088 |
with FormOptions do |
2089 |
LabelMS.Caption := Format('%s (%s)', [LabelMS.Caption, ComboBoxProximal.Items[Proximal]]);
|
2090 |
for i := 0 to FormOptions.ComboBoxProximal.Items.Count - 1 do |
2091 |
ComboBoxProximal.Items.Add(Format('%s %s', [FormOptions.ComboBoxProximal.Items[i], _('DM')])); |
2092 |
ProximalUnit := -1;
|
2093 |
ComboBoxProximal.ItemIndex := FormOptions.Proximal + 2 * FormOptions.Expression;
|
2094 |
ComboBoxProximalChange(nil);
|
2095 |
for i := 0 to FormOptions.ComboBoxEnergy.Items.Count - 1 do |
2096 |
ComboBoxEnergy.Items.Add(Format('%s %s', [FormOptions.ComboBoxEnergy.Items[i], _('DM')])); |
2097 |
EnergyUnit := -1;
|
2098 |
ComboBoxEnergy.ItemIndex := FormOptions.Energy + 2 * FormOptions.Expression;
|
2099 |
ComboBoxEnergyChange(nil);
|
2100 |
LabelBonus.Caption := LabelBonus.Caption + ' (%)';
|
2101 |
for i := 0 to FormOptions.ComboBoxAA.Items.Count - 1 do |
2102 |
ComboBoxAA.Items.Add(Format('%s %s', [FormOptions.ComboBoxAA.Items[i], _('DM')])); |
2103 |
AAUnit := -1;
|
2104 |
ComboBoxAA.ItemIndex := FormOptions.AA + 2 * FormOptions.Expression;
|
2105 |
ComboBoxAAChange(nil);
|
2106 |
LabeldAA.Caption := LabeldAA.Caption + ' (%)';
|
2107 |
for i := 0 to FormOptions.ComboBoxMinerals.Items.Count - 1 do |
2108 |
ComboBoxMinerals.Items.Add(Format('%s %s', [FormOptions.ComboBoxMinerals.Items[i], _('DM')])); |
2109 |
MineralsUnit := -1;
|
2110 |
ComboBoxMinerals.ItemIndex := FormOptions.Minerals + 2 * FormOptions.Expression;
|
2111 |
ComboBoxMineralsChange(nil);
|
2112 |
LabeldP.Caption := LabeldP.Caption + ' (%)';
|
2113 |
with DataModuleDeclaration do |
2114 |
begin
|
2115 |
TableIngredients := DBUser.GetTable('SELECT * FROM Ingredients '
|
2116 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
|
2117 |
// Analyse proximale
|
2118 |
RapMS := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MS']);
|
2119 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MM']) |
2120 |
then
|
2121 |
CheckBoxMMClick(nil)
|
2122 |
else
|
2123 |
begin
|
2124 |
CheckBoxMM.Checked := True; |
2125 |
ValidateEditMM.AsFloat := ClientDataSetIngredientsMM.Value; |
2126 |
end;
|
2127 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MAT']) |
2128 |
then
|
2129 |
CheckBoxMATClick(nil)
|
2130 |
else
|
2131 |
begin
|
2132 |
CheckBoxMAT.Checked := True; |
2133 |
RapMAT := TableIngredients.FieldAsDouble(TableIngredients.FieldIndex['MAT']);
|
2134 |
ValidateEditMAT.AsFloat := ClientDataSetIngredientsMAT.Value; |
2135 |
end;
|
2136 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MG']) |
2137 |
then
|
2138 |
CheckBoxMGClick(nil)
|
2139 |
else
|
2140 |
begin
|
2141 |
CheckBoxMG.Checked := True; |
2142 |
ValidateEditMG.AsFloat := ClientDataSetIngredientsMG.Value; |
2143 |
end;
|
2144 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['CB']) |
2145 |
then
|
2146 |
CheckBoxCBClick(nil)
|
2147 |
else
|
2148 |
begin
|
2149 |
CheckBoxCB.Checked := True; |
2150 |
ValidateEditCB.AsFloat := ClientDataSetIngredientsCB.Value; |
2151 |
end;
|
2152 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['NDF']) |
2153 |
then
|
2154 |
CheckBoxNDFClick(nil)
|
2155 |
else
|
2156 |
begin
|
2157 |
CheckBoxNDF.Checked := True; |
2158 |
ValidateEditNDF.AsFloat := ClientDataSetIngredientsNDF.Value; |
2159 |
end;
|
2160 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['ADF']) |
2161 |
then
|
2162 |
CheckBoxADFClick(nil)
|
2163 |
else
|
2164 |
begin
|
2165 |
CheckBoxADF.Checked := True; |
2166 |
ValidateEditADF.AsFloat := ClientDataSetIngredientsADF.Value; |
2167 |
end;
|
2168 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['ADL']) |
2169 |
then
|
2170 |
CheckBoxADLClick(nil)
|
2171 |
else
|
2172 |
begin
|
2173 |
CheckBoxADL.Checked := True; |
2174 |
ValidateEditADL.AsFloat := ClientDataSetIngredientsADL.Value; |
2175 |
end;
|
2176 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Amidon']) |
2177 |
then
|
2178 |
CheckBoxAmidonClick(nil)
|
2179 |
else
|
2180 |
begin
|
2181 |
CheckBoxAmidon.Checked := True; |
2182 |
ValidateEditAmidon.AsFloat := ClientDataSetIngredientsAmidon.Value; |
2183 |
end;
|
2184 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Sucres']) |
2185 |
then
|
2186 |
CheckBoxSucresClick(nil)
|
2187 |
else
|
2188 |
begin
|
2189 |
CheckBoxSucres.Checked := True; |
2190 |
ValidateEditSucres.AsFloat := ClientDataSetIngredientsSucres.Value; |
2191 |
end;
|
2192 |
// Energie
|
2193 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['EB']) |
2194 |
then
|
2195 |
CheckBoxEBClick(nil)
|
2196 |
else
|
2197 |
begin
|
2198 |
CheckBoxEB.Checked := True; |
2199 |
ValidateEditEB.AsFloat := ClientDataSetIngredientsEB.Value; |
2200 |
end;
|
2201 |
SpinEditBonus.Value := ClientDataSetIngredientsBonus.Value; |
2202 |
// Acides amin?s
|
2203 |
if RapMAT = 0 |
2204 |
then // D?sactiver la saisie des acides amin?s |
2205 |
DisableAA |
2206 |
else
|
2207 |
begin
|
2208 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Lys']) |
2209 |
then
|
2210 |
CheckBoxLysClick(nil)
|
2211 |
else
|
2212 |
begin
|
2213 |
CheckBoxLys.Checked := True; |
2214 |
ValidateEditLys.AsFloat := ClientDataSetIngredientsLys.Value; |
2215 |
end;
|
2216 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Thr']) |
2217 |
then
|
2218 |
CheckBoxThrClick(nil)
|
2219 |
else
|
2220 |
begin
|
2221 |
CheckBoxThr.Checked := True; |
2222 |
ValidateEditThr.AsFloat := ClientDataSetIngredientsThr.Value; |
2223 |
end;
|
2224 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Met']) |
2225 |
then
|
2226 |
CheckBoxMetClick(nil)
|
2227 |
else
|
2228 |
begin
|
2229 |
CheckBoxMet.Checked := True; |
2230 |
ValidateEditMet.AsFloat := ClientDataSetIngredientsMet.Value; |
2231 |
end;
|
2232 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Cys']) |
2233 |
then
|
2234 |
CheckBoxCysClick(nil)
|
2235 |
else
|
2236 |
begin
|
2237 |
CheckBoxCys.Checked := True; |
2238 |
ValidateEditCys.AsFloat := ClientDataSetIngredientsCys.Value; |
2239 |
end;
|
2240 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['MetCys']) |
2241 |
then
|
2242 |
CheckBoxMetCysClick(nil)
|
2243 |
else
|
2244 |
begin
|
2245 |
CheckBoxMetCys.Checked := True; |
2246 |
ValidateEditMetCys.AsFloat := ClientDataSetIngredientsMetCys.Value; |
2247 |
end;
|
2248 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Trp']) |
2249 |
then
|
2250 |
CheckBoxTrpClick(nil)
|
2251 |
else
|
2252 |
begin
|
2253 |
CheckBoxTrp.Checked := True; |
2254 |
ValidateEditTrp.AsFloat := ClientDataSetIngredientsTrp.Value; |
2255 |
end;
|
2256 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Ile']) |
2257 |
then
|
2258 |
CheckBoxIleClick(nil)
|
2259 |
else
|
2260 |
begin
|
2261 |
CheckBoxIle.Checked := True; |
2262 |
ValidateEditIle.AsFloat := ClientDataSetIngredientsIle.Value; |
2263 |
end;
|
2264 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Val']) |
2265 |
then
|
2266 |
CheckBoxValClick(nil)
|
2267 |
else
|
2268 |
begin
|
2269 |
CheckBoxVal.Checked := True; |
2270 |
ValidateEditVal.AsFloat := ClientDataSetIngredientsVal.Value; |
2271 |
end;
|
2272 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Leu']) |
2273 |
then
|
2274 |
CheckBoxLeuClick(nil)
|
2275 |
else
|
2276 |
begin
|
2277 |
CheckBoxLeu.Checked := True; |
2278 |
ValidateEditLeu.AsFloat := ClientDataSetIngredientsLeu.Value; |
2279 |
end;
|
2280 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Phe']) |
2281 |
then
|
2282 |
CheckBoxPheClick(nil)
|
2283 |
else
|
2284 |
begin
|
2285 |
CheckBoxPhe.Checked := True; |
2286 |
ValidateEditPhe.AsFloat := ClientDataSetIngredientsPhe.Value; |
2287 |
end;
|
2288 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Tyr']) |
2289 |
then
|
2290 |
CheckBoxTyrClick(nil)
|
2291 |
else
|
2292 |
begin
|
2293 |
CheckBoxTyr.Checked := True; |
2294 |
ValidateEditTyr.AsFloat := ClientDataSetIngredientsTyr.Value; |
2295 |
end;
|
2296 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['PheTyr']) |
2297 |
then
|
2298 |
CheckBoxPheTyrClick(nil)
|
2299 |
else
|
2300 |
begin
|
2301 |
CheckBoxPheTyr.Checked := True; |
2302 |
ValidateEditPheTyr.AsFloat := ClientDataSetIngredientsPheTyr.Value; |
2303 |
end;
|
2304 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['His']) |
2305 |
then
|
2306 |
CheckBoxHisClick(nil)
|
2307 |
else
|
2308 |
begin
|
2309 |
CheckBoxHis.Checked := True; |
2310 |
ValidateEditHis.AsFloat := ClientDataSetIngredientsHis.Value; |
2311 |
end;
|
2312 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Arg']) |
2313 |
then
|
2314 |
CheckBoxArgClick(nil)
|
2315 |
else
|
2316 |
begin
|
2317 |
CheckBoxArg.Checked := True; |
2318 |
ValidateEditArg.AsFloat := ClientDataSetIngredientsArg.Value; |
2319 |
end;
|
2320 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Ala']) |
2321 |
then
|
2322 |
CheckBoxAlaClick(nil)
|
2323 |
else
|
2324 |
begin
|
2325 |
CheckBoxAla.Checked := True; |
2326 |
ValidateEditAla.AsFloat := ClientDataSetIngredientsAla.Value; |
2327 |
end;
|
2328 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Asp']) |
2329 |
then
|
2330 |
CheckBoxAspClick(nil)
|
2331 |
else
|
2332 |
begin
|
2333 |
CheckBoxAsp.Checked := True; |
2334 |
ValidateEditAsp.AsFloat := ClientDataSetIngredientsAsp.Value; |
2335 |
end;
|
2336 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Glu']) |
2337 |
then
|
2338 |
CheckBoxGluClick(nil)
|
2339 |
else
|
2340 |
begin
|
2341 |
CheckBoxGlu.Checked := True; |
2342 |
ValidateEditGlu.AsFloat := ClientDataSetIngredientsGlu.Value; |
2343 |
end;
|
2344 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Gly']) |
2345 |
then
|
2346 |
CheckBoxGlyClick(nil)
|
2347 |
else
|
2348 |
begin
|
2349 |
CheckBoxGly.Checked := True; |
2350 |
ValidateEditGly.AsFloat := ClientDataSetIngredientsGly.Value; |
2351 |
end;
|
2352 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Ser']) |
2353 |
then
|
2354 |
CheckBoxSerClick(nil)
|
2355 |
else
|
2356 |
begin
|
2357 |
CheckBoxSer.Checked := True; |
2358 |
ValidateEditSer.AsFloat := ClientDataSetIngredientsSer.Value; |
2359 |
end;
|
2360 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Pro']) |
2361 |
then
|
2362 |
CheckBoxProClick(nil)
|
2363 |
else
|
2364 |
begin
|
2365 |
CheckBoxPro.Checked := True; |
2366 |
ValidateEditPro.AsFloat := ClientDataSetIngredientsPro.Value; |
2367 |
end;
|
2368 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dLys']) |
2369 |
then
|
2370 |
CheckBoxdLysClick(nil)
|
2371 |
else
|
2372 |
begin
|
2373 |
CheckBoxdLys.Checked := True; |
2374 |
ValidateEditdLys.AsFloat := ClientDataSetIngredientsdLys.Value; |
2375 |
end;
|
2376 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dThr']) |
2377 |
then
|
2378 |
CheckBoxdThrClick(nil)
|
2379 |
else
|
2380 |
begin
|
2381 |
CheckBoxdThr.Checked := True; |
2382 |
ValidateEditdThr.AsFloat := ClientDataSetIngredientsdThr.Value; |
2383 |
end;
|
2384 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dMet']) |
2385 |
then
|
2386 |
CheckBoxdMetClick(nil)
|
2387 |
else
|
2388 |
begin
|
2389 |
CheckBoxdMet.Checked := True; |
2390 |
ValidateEditdMet.AsFloat := ClientDataSetIngredientsdMet.Value; |
2391 |
end;
|
2392 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dCys']) |
2393 |
then
|
2394 |
CheckBoxdCysClick(nil)
|
2395 |
else
|
2396 |
begin
|
2397 |
CheckBoxdCys.Checked := True; |
2398 |
ValidateEditdCys.AsFloat := ClientDataSetIngredientsdCys.Value; |
2399 |
end;
|
2400 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dMetCys']) |
2401 |
then
|
2402 |
CheckBoxdMetCysClick(nil)
|
2403 |
else
|
2404 |
begin
|
2405 |
CheckBoxdMetCys.Checked := True; |
2406 |
ValidateEditdMetCys.AsFloat := ClientDataSetIngredientsdMetCys.Value; |
2407 |
end;
|
2408 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dTrp']) |
2409 |
then
|
2410 |
CheckBoxdTrpClick(nil)
|
2411 |
else
|
2412 |
begin
|
2413 |
CheckBoxdTrp.Checked := True; |
2414 |
ValidateEditdTrp.AsFloat := ClientDataSetIngredientsdTrp.Value; |
2415 |
end;
|
2416 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dIle']) |
2417 |
then
|
2418 |
CheckBoxdIleClick(nil)
|
2419 |
else
|
2420 |
begin
|
2421 |
CheckBoxdIle.Checked := True; |
2422 |
ValidateEditdIle.AsFloat := ClientDataSetIngredientsdIle.Value; |
2423 |
end;
|
2424 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dVal']) |
2425 |
then
|
2426 |
CheckBoxdValClick(nil)
|
2427 |
else
|
2428 |
begin
|
2429 |
CheckBoxdVal.Checked := True; |
2430 |
ValidateEditdVal.AsFloat := ClientDataSetIngredientsdVal.Value; |
2431 |
end;
|
2432 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dLeu']) |
2433 |
then
|
2434 |
CheckBoxdLeuClick(nil)
|
2435 |
else
|
2436 |
begin
|
2437 |
CheckBoxdLeu.Checked := True; |
2438 |
ValidateEditdLeu.AsFloat := ClientDataSetIngredientsdLeu.Value; |
2439 |
end;
|
2440 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dPhe']) |
2441 |
then
|
2442 |
CheckBoxdPheClick(nil)
|
2443 |
else
|
2444 |
begin
|
2445 |
CheckBoxdPhe.Checked := True; |
2446 |
ValidateEditdPhe.AsFloat := ClientDataSetIngredientsdPhe.Value; |
2447 |
end;
|
2448 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dTyr']) |
2449 |
then
|
2450 |
CheckBoxdTyrClick(nil)
|
2451 |
else
|
2452 |
begin
|
2453 |
CheckBoxdTyr.Checked := True; |
2454 |
ValidateEditdTyr.AsFloat := ClientDataSetIngredientsdTyr.Value; |
2455 |
end;
|
2456 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dPheTyr']) |
2457 |
then
|
2458 |
CheckBoxdPheTyrClick(nil)
|
2459 |
else
|
2460 |
begin
|
2461 |
CheckBoxdPheTyr.Checked := True; |
2462 |
ValidateEditdPheTyr.AsFloat := ClientDataSetIngredientsdPheTyr.Value; |
2463 |
end;
|
2464 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dHis']) |
2465 |
then
|
2466 |
CheckBoxdHisClick(nil)
|
2467 |
else
|
2468 |
begin
|
2469 |
CheckBoxdHis.Checked := True; |
2470 |
ValidateEditdHis.AsFloat := ClientDataSetIngredientsdHis.Value; |
2471 |
end;
|
2472 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dArg']) |
2473 |
then
|
2474 |
CheckBoxdArgClick(nil)
|
2475 |
else
|
2476 |
begin
|
2477 |
CheckBoxdArg.Checked := True; |
2478 |
ValidateEditdArg.AsFloat := ClientDataSetIngredientsdArg.Value; |
2479 |
end;
|
2480 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dAla']) |
2481 |
then
|
2482 |
CheckBoxdAlaClick(nil)
|
2483 |
else
|
2484 |
begin
|
2485 |
CheckBoxdAla.Checked := True; |
2486 |
ValidateEditdAla.AsFloat := ClientDataSetIngredientsdAla.Value; |
2487 |
end;
|
2488 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dAsp']) |
2489 |
then
|
2490 |
CheckBoxdAspClick(nil)
|
2491 |
else
|
2492 |
begin
|
2493 |
CheckBoxdAsp.Checked := True; |
2494 |
ValidateEditdAsp.AsFloat := ClientDataSetIngredientsdAsp.Value; |
2495 |
end;
|
2496 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dGlu']) |
2497 |
then
|
2498 |
CheckBoxdGluClick(nil)
|
2499 |
else
|
2500 |
begin
|
2501 |
CheckBoxdGlu.Checked := True; |
2502 |
ValidateEditdGlu.AsFloat := ClientDataSetIngredientsdGlu.Value; |
2503 |
end;
|
2504 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dGly']) |
2505 |
then
|
2506 |
CheckBoxdGlyClick(nil)
|
2507 |
else
|
2508 |
begin
|
2509 |
CheckBoxdGly.Checked := True; |
2510 |
ValidateEditdGly.AsFloat := ClientDataSetIngredientsdGly.Value; |
2511 |
end;
|
2512 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dSer']) |
2513 |
then
|
2514 |
CheckBoxdSerClick(nil)
|
2515 |
else
|
2516 |
begin
|
2517 |
CheckBoxdSer.Checked := True; |
2518 |
ValidateEditdSer.AsFloat := ClientDataSetIngredientsdSer.Value; |
2519 |
end;
|
2520 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dPro']) |
2521 |
then
|
2522 |
CheckBoxdProClick(nil)
|
2523 |
else
|
2524 |
begin
|
2525 |
CheckBoxdPro.Checked := True; |
2526 |
ValidateEditdPro.AsFloat := ClientDataSetIngredientsdPro.Value; |
2527 |
end;
|
2528 |
end;
|
2529 |
// Min?raux
|
2530 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Ca']) |
2531 |
then
|
2532 |
CheckBoxCaClick(nil)
|
2533 |
else
|
2534 |
begin
|
2535 |
CheckBoxCa.Checked := True; |
2536 |
ValidateEditCa.AsFloat := ClientDataSetIngredientsCa.Value; |
2537 |
end;
|
2538 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['P']) |
2539 |
then
|
2540 |
CheckBoxPClick(nil)
|
2541 |
else
|
2542 |
begin
|
2543 |
CheckBoxP.Checked := True; |
2544 |
ValidateEditP.AsFloat := ClientDataSetIngredientsP.Value; |
2545 |
end;
|
2546 |
if ValidateEditP.AsFloat = 0 |
2547 |
then // D?sactiver la saisie du phosphore digestible |
2548 |
DisabledP |
2549 |
else
|
2550 |
begin
|
2551 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dP']) |
2552 |
then
|
2553 |
CheckBoxdPClick(nil)
|
2554 |
else
|
2555 |
begin
|
2556 |
CheckBoxdP.Checked := True; |
2557 |
ValidateEditdP.AsFloat := ClientDataSetIngredientsdP.Value; |
2558 |
end;
|
2559 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['dPphy']) |
2560 |
then
|
2561 |
CheckBoxdPphyClick(nil)
|
2562 |
else
|
2563 |
begin
|
2564 |
CheckBoxdPphy.Checked := True; |
2565 |
ValidateEditdPphy.AsFloat := ClientDataSetIngredientsdPphy.Value; |
2566 |
end;
|
2567 |
end;
|
2568 |
TableIngredients.Free; |
2569 |
end;
|
2570 |
end;
|
2571 |
|
2572 |
procedure TFormIngredientEditionOriginal.ValidateEditMATChange(Sender: TObject);
|
2573 |
var
|
2574 |
OldMAT, NewMAT: Double; |
2575 |
begin
|
2576 |
with DataModuleDeclaration do |
2577 |
begin
|
2578 |
OldMAT := RapMAT; |
2579 |
NewMAT := InputProximal(ValidateEditMAT.AsFloat, RapMS, ProximalUnit div 2, ProximalUnit mod 2); |
2580 |
if NewMAT = 0 |
2581 |
then // D?sactiver la saisie des acides amin?s |
2582 |
DisableAA |
2583 |
else // Activer la saisie des acides amin?s |
2584 |
begin
|
2585 |
EnableAA; |
2586 |
// Recalculer les teneurs en acides amin?s
|
2587 |
if NewMAT <> OldMAT
|
2588 |
then
|
2589 |
begin
|
2590 |
if CheckBoxLys.Checked
|
2591 |
then
|
2592 |
ValidateEditLys.AsFloat := ValidateEditLys.AsFloat / OldMAT * NewMAT; |
2593 |
if CheckBoxThr.Checked
|
2594 |
then
|
2595 |
ValidateEditThr.AsFloat := ValidateEditThr.AsFloat / OldMAT * NewMAT; |
2596 |
if CheckBoxMet.Checked
|
2597 |
then
|
2598 |
ValidateEditMet.AsFloat := ValidateEditMet.AsFloat / OldMAT * NewMAT; |
2599 |
if CheckBoxCys.Checked
|
2600 |
then
|
2601 |
ValidateEditCys.AsFloat := ValidateEditCys.AsFloat / OldMAT * NewMAT; |
2602 |
if CheckBoxMetCys.Checked
|
2603 |
then
|
2604 |
ValidateEditMetCys.AsFloat := ValidateEditMetCys.AsFloat / OldMAT * NewMAT; |
2605 |
if CheckBoxTrp.Checked
|
2606 |
then
|
2607 |
ValidateEditTrp.AsFloat := ValidateEditTrp.AsFloat / OldMAT * NewMAT; |
2608 |
if CheckBoxIle.Checked
|
2609 |
then
|
2610 |
ValidateEditIle.AsFloat := ValidateEditIle.AsFloat / OldMAT * NewMAT; |
2611 |
if CheckBoxVal.Checked
|
2612 |
then
|
2613 |
ValidateEditVal.AsFloat := ValidateEditVal.AsFloat / OldMAT * NewMAT; |
2614 |
if CheckBoxLeu.Checked
|
2615 |
then
|
2616 |
ValidateEditLeu.AsFloat := ValidateEditLeu.AsFloat / OldMAT * NewMAT; |
2617 |
if CheckBoxPhe.Checked
|
2618 |
then
|
2619 |
ValidateEditPhe.AsFloat := ValidateEditPhe.AsFloat / OldMAT * NewMAT; |
2620 |
if CheckBoxTyr.Checked
|
2621 |
then
|
2622 |
ValidateEditTyr.AsFloat := ValidateEditTyr.AsFloat / OldMAT * NewMAT; |
2623 |
if CheckBoxPheTyr.Checked
|
2624 |
then
|
2625 |
ValidateEditPheTyr.AsFloat := ValidateEditPheTyr.AsFloat / OldMAT * NewMAT; |
2626 |
if CheckBoxHis.Checked
|
2627 |
then
|
2628 |
ValidateEditHis.AsFloat := ValidateEditHis.AsFloat / OldMAT * NewMAT; |
2629 |
if CheckBoxArg.Checked
|
2630 |
then
|
2631 |
ValidateEditArg.AsFloat := ValidateEditArg.AsFloat / OldMAT * NewMAT; |
2632 |
if CheckBoxAla.Checked
|
2633 |
then
|
2634 |
ValidateEditAla.AsFloat := ValidateEditAla.AsFloat / OldMAT * NewMAT; |
2635 |
if CheckBoxAsp.Checked
|
2636 |
then
|
2637 |
ValidateEditAsp.AsFloat := ValidateEditAsp.AsFloat / OldMAT * NewMAT; |
2638 |
if CheckBoxGlu.Checked
|
2639 |
then
|
2640 |
ValidateEditGlu.AsFloat := ValidateEditGlu.AsFloat / OldMAT * NewMAT; |
2641 |
if CheckBoxGly.Checked
|
2642 |
then
|
2643 |
ValidateEditGly.AsFloat := ValidateEditGly.AsFloat / OldMAT * NewMAT; |
2644 |
if CheckBoxSer.Checked
|
2645 |
then
|
2646 |
ValidateEditSer.AsFloat := ValidateEditSer.AsFloat / OldMAT * NewMAT; |
2647 |
if CheckBoxPro.Checked
|
2648 |
then
|
2649 |
ValidateEditPro.AsFloat := ValidateEditPro.AsFloat / OldMAT * NewMAT; |
2650 |
RapMAT := NewMAT; |
2651 |
end;
|
2652 |
end;
|
2653 |
end;
|
2654 |
end;
|
2655 |
|
2656 |
procedure TFormIngredientEditionOriginal.ValidateEditPChange(Sender: TObject);
|
2657 |
begin
|
2658 |
if ValidateEditP.AsFloat = 0 |
2659 |
then // D?sactiver la saisie du phosphore digestible |
2660 |
DisabledP |
2661 |
else // Activer la saisie du phosphore digestible |
2662 |
begin
|
2663 |
EnabledP; |
2664 |
if CheckBoxdP.Checked
|
2665 |
then // R?initialiser avec la valeur du mod?le |
2666 |
CheckBoxdP.Checked := False |
2667 |
else // R?afficher la valeur du mod?le |
2668 |
CheckBoxdPClick(nil);
|
2669 |
if CheckBoxdPphy.Checked
|
2670 |
then // R?initialiser avec la valeur du mod?le |
2671 |
CheckBoxdPphy.Checked := False |
2672 |
else // R?afficher la valeur du mod?le |
2673 |
CheckBoxdPphyClick(nil);
|
2674 |
end;
|
2675 |
end;
|
2676 |
|
2677 |
procedure TFormIngredientEditionOriginal.NumEditKeyDown(Sender: TObject;
|
2678 |
var Key: Word; Shift: TShiftState);
|
2679 |
begin
|
2680 |
// D?tection de l'appui sur le s?parateur d?cimal du pav? num?rique
|
2681 |
VK_Separator := (Key = VK_DECIMAL); |
2682 |
end;
|
2683 |
|
2684 |
procedure TFormIngredientEditionOriginal.NumEditKeyPress(Sender: TObject;
|
2685 |
var Key: Char);
|
2686 |
begin
|
2687 |
if VK_Separator then |
2688 |
// Renvoyer le s?parateur d?cimal des options r?gionales et linguistiques
|
2689 |
Key := DecimalSeparator; |
2690 |
end;
|
2691 |
|
2692 |
end.
|