Révision 3 UnitIngredientEditionCopy.pas

Voir les différences:

UnitIngredientEditionCopy.pas
144 144
    JvImgBtnHelp: TJvImgBtn;
145 145
    JvImgBtnRename: TJvImgBtn;
146 146
    JvImgBtnComment: TJvImgBtn;
147
    ValidateEditNa: TJvValidateEdit;
148
    CheckBoxCl: TCheckBox;
149
    ValidateEditCl: TJvValidateEdit;
150
    LabelCl: TLabel;
151
    CheckBoxK: TCheckBox;
152
    ValidateEditK: TJvValidateEdit;
153
    LabelK: TLabel;
154
    CheckBoxNa: TCheckBox;
155
    LabelNa: TLabel;
147 156
    procedure FormCreate(Sender: TObject);
148 157
    procedure CheckBoxMATClick(Sender: TObject);
149 158
    procedure CheckBoxCBClick(Sender: TObject);
......
194 203
    procedure NumEditKeyDown(Sender: TObject; var Key: Word;
195 204
      Shift: TShiftState);
196 205
    procedure NumEditKeyPress(Sender: TObject; var Key: Char);
206
    procedure CheckBoxNaClick(Sender: TObject);
207
    procedure CheckBoxKClick(Sender: TObject);
208
    procedure CheckBoxClClick(Sender: TObject);
197 209
  private
198 210
    { D?clarations priv?es }
199 211
    ProximalUnit, MineralsUnit, AAUnit: Integer;
......
733 745
        DBUser.ExecSQL('UPDATE Ingredients '
734 746
          + 'SET P = null '
735 747
          + Format('WHERE Id = %d', [ClientDataSetIngredientsId.Value]));
748
      // TODO: Na, K and Cl
736 749
      if CheckBoxdP.Checked
737 750
      then
738 751
        DBUser.ExecSQL('UPDATE Ingredients '
......
957 970
        EditShow(ValidateEditCB, OutputProximal(ClientDataSetInraAfzCB.Value, RapMS, ComboBoxProximal.ItemIndex div 2, ComboBoxProximal.ItemIndex mod 2));
958 971
end;
959 972

  
973
procedure TFormIngredientEditionCopy.CheckBoxClClick(Sender: TObject);
974
begin
975
  if CheckBoxCl.Checked
976
  then // Activer la saisie
977
    EditActivate(ValidateEditCl)
978
  else // Afficher la valeur par d?faut
979
    with DataModuleDeclaration do
980
      if ClientDataSetInraAfzCl.IsNull
981
      then // Null
982
        EditEmpty(ValidateEditCl)
983
      else // Valeur du mod?le
984
        EditShow(ValidateEditCl, OutputMinerals(ClientDataSetInraAfzCl.Value, RapMS, ComboBoxMinerals.ItemIndex div 2, ComboBoxMinerals.ItemIndex mod 2));
985
end;
986

  
960 987
procedure TFormIngredientEditionCopy.CheckBoxCysClick(Sender: TObject);
961 988
begin
962 989
  if CheckBoxCys.Checked
......
1063 1090
        EditShow(ValidateEditIle, OutputAA(ClientDataSetInraAfzIle.Value, RapMAT, RapMS, ComboBoxAA.ItemIndex div 2, ComboBoxAA.ItemIndex mod 2));
1064 1091
end;
1065 1092

  
1093
procedure TFormIngredientEditionCopy.CheckBoxKClick(Sender: TObject);
1094
begin
1095
  if CheckBoxK.Checked
1096
  then // Activer la saisie
1097
    EditActivate(ValidateEditK)
1098
  else // Afficher la valeur par d?faut
1099
    with DataModuleDeclaration do
1100
      if ClientDataSetInraAfzK.IsNull
1101
      then // Null
1102
        EditEmpty(ValidateEditK)
1103
      else // Valeur du mod?le
1104
        EditShow(ValidateEditK, OutputMinerals(ClientDataSetInraAfzK.Value, RapMS, ComboBoxMinerals.ItemIndex div 2, ComboBoxMinerals.ItemIndex mod 2));
1105
end;
1106

  
1066 1107
procedure TFormIngredientEditionCopy.CheckBoxLeuClick(Sender: TObject);
1067 1108
begin
1068 1109
  if CheckBoxLeu.Checked
......
1167 1208
        EditShow(ValidateEditMM, OutputProximal(ClientDataSetInraAfzMM.Value, RapMS, ComboBoxProximal.ItemIndex div 2, ComboBoxProximal.ItemIndex mod 2));
1168 1209
end;
1169 1210

  
1211
procedure TFormIngredientEditionCopy.CheckBoxNaClick(Sender: TObject);
1212
begin
1213
  if CheckBoxNa.Checked
1214
  then // Activer la saisie
1215
    EditActivate(ValidateEditNa)
1216
  else // Afficher la valeur par d?faut
1217
    with DataModuleDeclaration do
1218
      if ClientDataSetInraAfzNa.IsNull
1219
      then // Null
1220
        EditEmpty(ValidateEditNa)
1221
      else // Valeur du mod?le
1222
        EditShow(ValidateEditNa, OutputMinerals(ClientDataSetInraAfzNa.Value, RapMS, ComboBoxMinerals.ItemIndex div 2, ComboBoxMinerals.ItemIndex mod 2));
1223
end;
1224

  
1170 1225
procedure TFormIngredientEditionCopy.CheckBoxNDFClick(Sender: TObject);
1171 1226
begin
1172 1227
  if CheckBoxNDF.Checked
......
1543 1598
    begin
1544 1599
      ValidateEditCa.DecimalPlaces := 2;
1545 1600
      ValidateEditP.DecimalPlaces := 2;
1601
      ValidateEditNa.DecimalPlaces := 2;
1602
      ValidateEditK.DecimalPlaces := 2;
1603
      ValidateEditCl.DecimalPlaces := 2;
1546 1604
    end
1547 1605
    else // g/kg
1548 1606
    begin
1549 1607
      ValidateEditCa.MaxValue := 1000;
1550 1608
      ValidateEditP.MaxValue := 1000;
1609
      ValidateEditNa.MaxValue := 1000;
1610
      ValidateEditK.MaxValue := 1000;
1611
      ValidateEditCl.MaxValue := 1000;
1551 1612
    end;
1552 1613
    with DataModuleDeclaration do
1553 1614
    begin
......
1562 1623
      else
1563 1624
        CheckBoxPClick(nil);
1564 1625
    end;
1626

  
1565 1627
    if ComboBoxMinerals.ItemIndex mod 2 = 0
1566 1628
    then // %
1567 1629
    begin
1568 1630
      ValidateEditCa.MaxValue := 100;
1569 1631
      ValidateEditP.MaxValue := 100;
1632
      ValidateEditNa.MaxValue := 100;
1633
      ValidateEditK.MaxValue := 100;
1634
      ValidateEditCl.MaxValue := 100;
1570 1635
    end
1571 1636
    else // g/kg
1572 1637
    begin
1573 1638
      ValidateEditCa.DecimalPlaces := 1;
1574 1639
      ValidateEditP.DecimalPlaces := 1;
1640
      ValidateEditNa.DecimalPlaces := 1;
1641
      ValidateEditK.DecimalPlaces := 1;
1642
      ValidateEditCl.DecimalPlaces := 1;
1575 1643
    end;
1576 1644
    MineralsUnit := ComboBoxMinerals.ItemIndex;
1577 1645
  end;
......
2182 2250
      CheckBoxP.Checked := True;
2183 2251
      ValidateEditP.AsFloat := ClientDataSetIngredientsP.Value;
2184 2252
    end;
2253
    if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Na'])
2254
    then
2255
      CheckBoxNaClick(nil)
2256
    else
2257
    begin
2258
      CheckBoxNa.Checked := True;
2259
      ValidateEditNa.AsFloat := ClientDataSetIngredientsNa.Value;
2260
    end;
2261
    if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['K'])
2262
    then
2263
      CheckBoxKClick(nil)
2264
    else
2265
    begin
2266
      CheckBoxK.Checked := True;
2267
      ValidateEditK.AsFloat := ClientDataSetIngredientsK.Value;
2268
    end;
2269
    if TableIngredients.FieldIsNull(TableIngredients.FieldIndex['Cl'])
2270
    then
2271
      CheckBoxClClick(nil)
2272
    else
2273
    begin
2274
      CheckBoxCl.Checked := True;
2275
      ValidateEditCl.AsFloat := ClientDataSetIngredientsCl.Value;
2276
    end;
2185 2277
    if ValidateEditP.AsFloat = 0
2186 2278
    then // D?sactiver la saisie du phosphore digestible
2187 2279
      DisabledP

Formats disponibles : Unified diff