1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
|
unit etudiant;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, DBCtrls, StdCtrls, Mask, DB, DBTables, ComCtrls,
ExtDlgs, ExtCtrls, Grids, DBGrids, TeEngine, Series, TeeProcs, Chart,
DbChart;
type
Tfiche_etudiant = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
Table1: TTable;
Table1Code_e: TIntegerField;
Table1Nom_e: TStringField;
Table1Prenom_e: TStringField;
Table1Date_naissance: TDateField;
Table1Lieu: TStringField;
Table1Adresse: TStringField;
Table1Doublant: TStringField;
Table1Photo: TGraphicField;
Table1Ref_classe: TIntegerField;
DataSource1: TDataSource;
DBEdit6: TDBEdit;
Label1: TLabel;
DBEdit1: TDBEdit;
Label2: TLabel;
DBEdit2: TDBEdit;
Label3: TLabel;
DBEdit3: TDBEdit;
Label4: TLabel;
DBEdit4: TDBEdit;
Label5: TLabel;
DBEdit5: TDBEdit;
Label6: TLabel;
DBEdit7: TDBEdit;
Label7: TLabel;
DBEdit8: TDBEdit;
Label8: TLabel;
DBImage1: TDBImage;
Label9: TLabel;
DBEdit9: TDBEdit;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
DBNavigator1: TDBNavigator;
OpenPictureDialog1: TOpenPictureDialog;
SpeedButton6: TSpeedButton;
Label10: TLabel;
ComboBox1: TComboBox;
DBGrid1: TDBGrid;
SpeedButton7: TSpeedButton;
SpeedButton8: TSpeedButton;
BitBtn1: TBitBtn;
Label11: TLabel;
Edit1: TEdit;
Query1: TQuery;
DBChart1: TDBChart;
Series1: TPieSeries;
procedure SpeedButton5Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
procedure Table1AfterInsert(DataSet: TDataSet);
procedure Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBEdit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBEdit2KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBEdit3KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBEdit4KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBEdit5KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBEdit6KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure ComboBox1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure SpeedButton7Click(Sender: TObject);
procedure SpeedButton8Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure DBGrid1TitleClick(Column: TColumn);
procedure Table1AfterPost(DataSet: TDataSet);
private
{ Private declarations }
public
{ Public declarations }
end;
var
fiche_etudiant: Tfiche_etudiant;
implementation
uses etat_etudiant;
{$R *.dfm}
procedure Tfiche_etudiant.SpeedButton5Click(Sender: TObject);
begin
table1.Append ; // table1.append = table1.last + table1.insert
dbedit1.SetFocus ;
end;
procedure Tfiche_etudiant.SpeedButton4Click(Sender: TObject);
begin
if messagedlg('voulez vous supprimer cet enregistrement' ,mtconfirmation,[mbyes,mbno],0)=mryes then
table1.Delete;
end;
procedure Tfiche_etudiant.SpeedButton1Click(Sender: TObject);
begin
table1.Edit;
dbedit1.SetFocus;
end;
procedure Tfiche_etudiant.SpeedButton3Click(Sender: TObject);
begin
table1.Edit;
table1.Post;
end;
procedure Tfiche_etudiant.SpeedButton2Click(Sender: TObject);
begin
table1.Edit;
table1.Cancel;
end;
procedure Tfiche_etudiant.SpeedButton6Click(Sender: TObject);
begin
OpenPictureDialog1.Execute;
dbimage1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
end;
procedure Tfiche_etudiant.Table1AfterInsert(DataSet: TDataSet);
begin
dbedit1.SetFocus;
end;
procedure Tfiche_etudiant.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
If key = vk_return then
Dbedit2.SetFocus;
end;
procedure Tfiche_etudiant.DBEdit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
Dbedit2.SetFocus;
end;
procedure Tfiche_etudiant.DBEdit2KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
If key = vk_return then
Dbedit3.SetFocus;
end;
procedure Tfiche_etudiant.DBEdit3KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
If key = vk_return then
Dbedit4.SetFocus;
end;
procedure Tfiche_etudiant.DBEdit4KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var age : integer;
begin
If key = vk_return then
Begin
Table1.Edit;
Table1.Post;
Age :=trunc((date-table1.fieldbyname('date_naissance').AsDateTime)/365);
Label9.Caption:=inttostr(age)+' ans';
If age <17 then
Showmessage('étudiant mineur');
If age >60 then
Showmessage('étudiant retraité');
Dbedit5.SetFocus;
End;
End;
procedure Tfiche_etudiant.DBEdit5KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
If key = vk_return then
Dbedit6.SetFocus;
end;
procedure Tfiche_etudiant.DBEdit6KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
If key = vk_return then
combobox1.setfocus;
end;
procedure Tfiche_etudiant.ComboBox1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
If key = vk_return then
Dbedit8.SetFocus;
end;
procedure Tfiche_etudiant.SpeedButton7Click(Sender: TObject);
begin
fiche_etat_etudiant.quickrep1.preview;
end;
procedure Tfiche_etudiant.SpeedButton8Click(Sender: TObject);
begin
fiche_etat_etudiant.quickrep1.print;
end;
procedure Tfiche_etudiant.Edit1Change(Sender: TObject);
begin
if edit1.Text <> '' then
begin
table1.Close ;
table1.filtred :=true;
table1.Filter :='[Nom_e]=' + #39 + edit1.Text + '*' + #39;
table1.Active := true;
end
else
begin
table1.Close;
table1.filtred := false;
table1.Active := true;
end;
end;
procedure Tfiche_etudiant.DBGrid1TitleClick(Column: TColumn);
begin
If column.Index = 0 then
Table1.IndexName :='c1';
If column.Index = 1 then
Table1.IndexName :='c2';
If column.Index = 2 then
Table1.IndexName :='c3';
If column.Index = 3 then
Table1.IndexName :='c4';
If column.Index = 4 then
Table1.IndexName :='c5';
If column.Index = 5 then
Table1.IndexName :='c6';
If column.Index = 6 then
Table1.IndexName :='c7';
If column.Index = 7 then
Table1.IndexName :='c8';
end;
procedure Tfiche_etudiant.Table1AfterPost(DataSet: TDataSet);
begin
Query1.Close;
Query1.Active := true;
end;
end. |