Révision 3 UnitIngredientEditionOriginal.pas
UnitIngredientEditionOriginal.pas | ||
---|---|---|
188 | 188 |
JvImgBtnHelp: TJvImgBtn; |
189 | 189 |
JvImgBtnRename: TJvImgBtn; |
190 | 190 |
JvImgBtnComment: TJvImgBtn; |
191 |
LabelNa: TLabel; |
|
192 |
ValidateEditNa: TJvValidateEdit; |
|
193 |
CheckBoxNa: TCheckBox; |
|
194 |
LabelK: TLabel; |
|
195 |
ValidateEditK: TJvValidateEdit; |
|
196 |
CheckBoxK: TCheckBox; |
|
197 |
LabelCl: TLabel; |
|
198 |
ValidateEditCl: TJvValidateEdit; |
|
199 |
CheckBoxCl: TCheckBox; |
|
191 | 200 |
procedure FormCreate(Sender: TObject); |
192 | 201 |
procedure CheckBoxMATClick(Sender: TObject); |
193 | 202 |
procedure CheckBoxCBClick(Sender: TObject); |
... | ... | |
260 | 269 |
procedure NumEditKeyDown(Sender: TObject; var Key: Word; |
261 | 270 |
Shift: TShiftState); |
262 | 271 |
procedure NumEditKeyPress(Sender: TObject; var Key: Char); |
272 |
procedure CheckBoxNaClick(Sender: TObject); |
|
273 |
procedure CheckBoxKClick(Sender: TObject); |
|
274 |
procedure CheckBoxClClick(Sender: TObject); |
|
263 | 275 |
private |
264 | 276 |
{ D?clarations priv?es } |
265 | 277 |
ProximalUnit, EnergyUnit, MineralsUnit, AAUnit: Integer; |
... | ... | |
967 | 979 |
DBUser.ExecSQL('UPDATE Ingredients ' |
968 | 980 |
+ 'SET P = null ' |
969 | 981 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value])); |
982 |
if CheckBoxNa.Checked |
|
983 |
then |
|
984 |
DBUser.ExecSQL('UPDATE Ingredients ' |
|
985 |
+ Format('SET Na = %.15f ', [InputMinerals(ValidateEditNa.AsFloat, RapMS, MineralsUnit div 2, MineralsUnit mod 2)], USFormatSettings) |
|
986 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value])) |
|
987 |
else |
|
988 |
DBUser.ExecSQL('UPDATE Ingredients ' |
|
989 |
+ 'SET Ca = null ' |
|
990 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value])); |
|
991 |
if CheckBoxK.Checked |
|
992 |
then |
|
993 |
DBUser.ExecSQL('UPDATE Ingredients ' |
|
994 |
+ Format('SET K = %.15f ', [InputMinerals(ValidateEditK.AsFloat, RapMS, MineralsUnit div 2, MineralsUnit mod 2)], USFormatSettings) |
|
995 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value])) |
|
996 |
else |
|
997 |
DBUser.ExecSQL('UPDATE Ingredients ' |
|
998 |
+ 'SET Ca = null ' |
|
999 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value])); |
|
1000 |
if CheckBoxCl.Checked |
|
1001 |
then |
|
1002 |
DBUser.ExecSQL('UPDATE Ingredients ' |
|
1003 |
+ Format('SET Cl = %.15f ', [InputMinerals(ValidateEditCl.AsFloat, RapMS, MineralsUnit div 2, MineralsUnit mod 2)], USFormatSettings) |
|
1004 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value])) |
|
1005 |
else |
|
1006 |
DBUser.ExecSQL('UPDATE Ingredients ' |
|
1007 |
+ 'SET Ca = null ' |
|
1008 |
+ Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value])); |
|
970 | 1009 |
if CheckBoxdP.Checked |
971 | 1010 |
then |
972 | 1011 |
DBUser.ExecSQL('UPDATE Ingredients ' |
... | ... | |
1151 | 1190 |
EditEmpty(ValidateEditCB); |
1152 | 1191 |
end; |
1153 | 1192 |
|
1193 |
procedure TFormIngredientEditionOriginal.CheckBoxClClick(Sender: TObject); |
|
1194 |
begin |
|
1195 |
if CheckBoxCl.Checked |
|
1196 |
then // Activer la saisie |
|
1197 |
EditActivate(ValidateEditCl) |
|
1198 |
else // Valeur inconnue |
|
1199 |
EditEmpty(ValidateEditCl); |
|
1200 |
end; |
|
1201 |
|
|
1154 | 1202 |
procedure TFormIngredientEditionOriginal.CheckBoxCysClick(Sender: TObject); |
1155 | 1203 |
begin |
1156 | 1204 |
if CheckBoxCys.Checked |
... | ... | |
1411 | 1459 |
EditEmpty(ValidateEditIle); |
1412 | 1460 |
end; |
1413 | 1461 |
|
1462 |
procedure TFormIngredientEditionOriginal.CheckBoxKClick(Sender: TObject); |
|
1463 |
begin |
|
1464 |
if CheckBoxK.Checked |
|
1465 |
then // Activer la saisie |
|
1466 |
EditActivate(ValidateEditK) |
|
1467 |
else // Valeur inconnue |
|
1468 |
EditEmpty(ValidateEditK); |
|
1469 |
end; |
|
1470 |
|
|
1414 | 1471 |
procedure TFormIngredientEditionOriginal.CheckBoxLeuClick(Sender: TObject); |
1415 | 1472 |
begin |
1416 | 1473 |
if CheckBoxLeu.Checked |
... | ... | |
1479 | 1536 |
EditEmpty(ValidateEditMM); |
1480 | 1537 |
end; |
1481 | 1538 |
|
1539 |
procedure TFormIngredientEditionOriginal.CheckBoxNaClick(Sender: TObject); |
|
1540 |
begin |
|
1541 |
if CheckBoxNa.Checked |
|
1542 |
then // Activer la saisie |
|
1543 |
EditActivate(ValidateEditNa) |
|
1544 |
else // Valeur inconnue |
|
1545 |
EditEmpty(ValidateEditNa); |
|
1546 |
end; |
|
1547 |
|
|
1482 | 1548 |
procedure TFormIngredientEditionOriginal.CheckBoxNDFClick(Sender: TObject); |
1483 | 1549 |
begin |
1484 | 1550 |
if CheckBoxNDF.Checked |
... | ... | |
1779 | 1845 |
begin |
1780 | 1846 |
ValidateEditCa.DecimalPlaces := 2; |
1781 | 1847 |
ValidateEditP.DecimalPlaces := 2; |
1848 |
ValidateEditNa.DecimalPlaces := 2; |
|
1849 |
ValidateEditK.DecimalPlaces := 2; |
|
1850 |
ValidateEditCl.DecimalPlaces := 2; |
|
1782 | 1851 |
end |
1783 | 1852 |
else // g/kg |
1784 | 1853 |
begin |
1785 | 1854 |
ValidateEditCa.MaxValue := 1000; |
1786 | 1855 |
ValidateEditP.MaxValue := 1000; |
1856 |
ValidateEditNa.MaxValue := 1000; |
|
1857 |
ValidateEditK.MaxValue := 1000; |
|
1858 |
ValidateEditCl.MaxValue := 1000; |
|
1787 | 1859 |
end; |
1788 | 1860 |
with DataModuleDeclaration do |
1789 | 1861 |
begin |
... | ... | |
1793 | 1865 |
if CheckBoxP.Checked |
1794 | 1866 |
then // Conversion |
1795 | 1867 |
ValidateEditP.AsFloat := OutputMinerals(InputMinerals(ValidateEditP.AsFloat, RapMS, MineralsUnit div 2, MineralsUnit mod 2), RapMS, ComboBoxMinerals.ItemIndex div 2, ComboBoxMinerals.ItemIndex mod 2); |
1868 |
if CheckBoxNa.Checked |
|
1869 |
then // Conversion |
|
1870 |
ValidateEditNa.AsFloat := OutputMinerals(InputMinerals(ValidateEditNa.AsFloat, RapMS, MineralsUnit div 2, MineralsUnit mod 2), RapMS, ComboBoxMinerals.ItemIndex div 2, ComboBoxMinerals.ItemIndex mod 2); |
|
1871 |
if CheckBoxK.Checked |
|
1872 |
then // Conversion |
|
1873 |
ValidateEditK.AsFloat := OutputMinerals(InputMinerals(ValidateEditK.AsFloat, RapMS, MineralsUnit div 2, MineralsUnit mod 2), RapMS, ComboBoxMinerals.ItemIndex div 2, ComboBoxMinerals.ItemIndex mod 2); |
|
1874 |
if CheckBoxCl.Checked |
|
1875 |
then // Conversion |
|
1876 |
ValidateEditCl.AsFloat := OutputMinerals(InputMinerals(ValidateEditCl.AsFloat, RapMS, MineralsUnit div 2, MineralsUnit mod 2), RapMS, ComboBoxMinerals.ItemIndex div 2, ComboBoxMinerals.ItemIndex mod 2); |
|
1796 | 1877 |
end; |
1797 | 1878 |
if ComboBoxMinerals.ItemIndex mod 2 = 0 |
1798 | 1879 |
then // % |
1799 | 1880 |
begin |
1800 | 1881 |
ValidateEditCa.MaxValue := 100; |
1801 | 1882 |
ValidateEditP.MaxValue := 100; |
1883 |
ValidateEditNa.MaxValue := 100; |
|
1884 |
ValidateEditK.MaxValue := 100; |
|
1885 |
ValidateEditCl.MaxValue := 100; |
|
1802 | 1886 |
end |
1803 | 1887 |
else // g/kg |
1804 | 1888 |
begin |
1805 | 1889 |
ValidateEditCa.DecimalPlaces := 1; |
1806 | 1890 |
ValidateEditP.DecimalPlaces := 1; |
1891 |
ValidateEditNa.DecimalPlaces := 1; |
|
1892 |
ValidateEditK.DecimalPlaces := 1; |
|
1893 |
ValidateEditCl.DecimalPlaces := 1; |
|
1807 | 1894 |
end; |
1808 | 1895 |
MineralsUnit := ComboBoxMinerals.ItemIndex; |
1809 | 1896 |
end; |
... | ... | |
2543 | 2630 |
CheckBoxP.Checked := True; |
2544 | 2631 |
ValidateEditP.AsFloat := ClientDataSetIngredientsP.Value; |
2545 | 2632 |
end; |
2633 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Na']) |
|
2634 |
then |
|
2635 |
CheckBoxNaClick(nil) |
|
2636 |
else |
|
2637 |
begin |
|
2638 |
CheckBoxNa.Checked := True; |
|
2639 |
ValidateEditNa.AsFloat := ClientDataSetIngredientsNa.Value; |
|
2640 |
end; |
|
2641 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['K']) |
|
2642 |
then |
|
2643 |
CheckBoxKClick(nil) |
|
2644 |
else |
|
2645 |
begin |
|
2646 |
CheckBoxK.Checked := True; |
|
2647 |
ValidateEditK.AsFloat := ClientDataSetIngredientsK.Value; |
|
2648 |
end; |
|
2649 |
if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Cl']) |
|
2650 |
then |
|
2651 |
CheckBoxClClick(nil) |
|
2652 |
else |
|
2653 |
begin |
|
2654 |
CheckBoxCl.Checked := True; |
|
2655 |
ValidateEditCl.AsFloat := ClientDataSetIngredientsCl.Value; |
|
2656 |
end; |
|
2546 | 2657 |
if ValidateEditP.AsFloat = 0 |
2547 | 2658 |
then // D?sactiver la saisie du phosphore digestible |
2548 | 2659 |
DisabledP |
Formats disponibles : Unified diff