📄 unit18.pas
字号:
unit Unit18;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, Spin, Db, DBTables, Grids, DBGrids, DBCtrls;
type
TForm18 = class(TForm)
Panel1: TPanel;
Label8: TLabel;
Image1: TImage;
Table1: TTable;
Panel5: TPanel;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
Panel4: TPanel;
Label1: TLabel;
Label2: TLabel;
Label6: TLabel;
Label7: TLabel;
SpinEdit1: TSpinEdit;
Button1: TButton;
Button3: TButton;
Button2: TButton;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
Table2: TTable;
Table3: TTable;
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure SpinEdit1Change(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form18: TForm18;
implementation
uses Unit24;
var
value:real;
{$R *.DFM}
procedure TForm18.Button2Click(Sender: TObject);
begin
close;
end;
procedure TForm18.Button3Click(Sender: TObject);
var
s:string;
begin
button1.click;
s:=inputbox('只对客房用户服务!','请输入房间号:','');
if s<>'' then
begin
table3.First;
while not table3.Eof do
begin
if s=table3.FieldByName('fh').asstring then
break;
table3.Next;
end;
if table3.Eof then
begin
showmessage('房间号错误。');
exit;
end;
table3.Edit;
table3.FieldByName('bz').asstring:=table3.FieldByName('bz').asstring+datetimetostr(now)+'购卡:'+floattostr(value);
table3.FieldByName('fw').asfloat:=table3.FieldByName('fw').asfloat+value;
table3.Post;
end;
end;
procedure TForm18.SpinEdit1Change(Sender: TObject);
begin
table1.First;
while not table1.Eof do
begin
if (combobox1.Text=table1.FieldByName('lb').asstring)
and (strtoint(combobox2.Text)=table1.FieldByName('mz').asinteger)
then break;
table1.Next;
end;
{if}
spinedit1.MaxValue:=table1.fieldbyname('sl').asinteger;
end;
procedure TForm18.Button1Click(Sender: TObject);
begin
table1.First;
while not table1.Eof do
begin
if (combobox1.Text=table1.FieldByName('lb').asstring)
and (strtoint(combobox2.Text)=table1.FieldByName('mz').asinteger)
then break;
table1.Next;
end;
table1.Edit;
table1.FieldByName('sl').asfloat:=spinedit1.MaxValue-spinedit1.value;
table1.Post;
table2.insert;
table2.Edit;
table2.FieldByName('lb').asstring:='售卡';
table2.FieldByName('rq').asdatetime:=now;
value:=strtofloat(combobox2.Text)*spinedit1.Value;
table2.FieldByName('sr').asfloat:=value;
table2.Post;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -