?? classroom.~pas
字號:
unit classroom;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, XPMenu;
type
TPSForm = class(TForm)
GroupBox1: TGroupBox;
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
ComboBox2: TComboBox;
GroupBox2: TGroupBox;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
Button1: TButton;
Button2: TButton;
Label3: TLabel;
Edit1: TEdit;
Button3: TButton;
Label4: TLabel;
ComboBox3: TComboBox;
XPMenu1: TXPMenu;
procedure FormCreate(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
PSForm: TPSForm;
implementation
uses input,md;
{$R *.dfm}
procedure TPSForm.FormCreate(Sender: TObject);
begin
with datamd.ADOhouse do
begin
close;
sql.Clear;
sql.Add('select 樓房號 from house group by 樓房號');
open;
while not eof do
begin
combobox3.Items.Add(fieldbyname('樓房號').AsString);
next;
end;
end;
combobox1.ItemIndex:=0;
end;
procedure TPSForm.Button3Click(Sender: TObject);
begin
//以下是自動獲得寢室號
with datamd.ADOBTPd do
begin
close;
sql.Clear; //根據選擇執行不同的查詢
if checkbox1.Checked or checkbox2.Checked then
sql.Add('select tborder.專業,tborder.班級,tborder.寢室號,tbpd.* from tborder,tbpd where tborder.寢室號=tbpd.寢室號 and 價格='+trim(combobox2.Text)+' and 專業='''+combobox1.Text+''''+' and 居住性別='+inputform.XPComboBox.Text+'''')
else
sql.Add('select * from tbpd where left(寢室號,'+inttostr(pos('棟',combobox3.Text)-1)+')='''+copy(combobox3.Text,1,pos('棟',combobox3.Text)-1)+''''+' and 價格='+trim(combobox2.Text)+'and 居住性別='''+inputform.XPComboBox.Text+'''');
open;
if eof then //查詢所選擇的幾棟是否公配完
begin
showmessage('該棟公寓已公配完或者沒有此價格的房間,請重新選擇');
exit;
end;
while not Eof do //查詢某一間房間是否已住滿
begin
if ((fieldbyname('應住人數').AsInteger-fieldbyname('實住人數').AsInteger)>0) then
begin
edit1.Text:=fieldbyname('寢室號').AsString;
button1.Enabled:=true;
exit;
end
else
next;
if eof then showmessage('該棟公寓已公配完,請安排下一棟');
end;
end;
end;
procedure TPSForm.Button1Click(Sender: TObject);
begin
inputform.PSEdit.Text:=edit1.Text;
close;
end;
procedure TPSForm.Button2Click(Sender: TObject);
begin
close;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -