📄 unit_jycx.pas
字号:
unit Unit_jycx;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, Grids, DBGrids, StdCtrls, ExtCtrls, ComCtrls;
type
Tjycx = class(TForm)
GroupBox1: TGroupBox;
LabeledEdit1: TLabeledEdit;
LabeledEdit2: TLabeledEdit;
LabeledEdit3: TLabeledEdit;
LabeledEdit4: TLabeledEdit;
LabeledEdit5: TLabeledEdit;
LabeledEdit6: TLabeledEdit;
LabeledEdit7: TLabeledEdit;
LabeledEdit8: TLabeledEdit;
LabeledEdit9: TLabeledEdit;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
Memo1: TMemo;
GroupBox2: TGroupBox;
Button1: TButton;
DateTimePicker1: TDateTimePicker;
DateTimePicker2: TDateTimePicker;
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Button2: TButton;
procedure DBGrid1CellClick(Column: TColumn);
procedure Button1Click(Sender: TObject);
//function timetra(data1:tdate):string;
function space(st:string):string;
procedure Button2Click(Sender: TObject);
//function timetra(date1:tdatetime):string;
private
{ Private declarations }
public
{ Public declarations }
end;
var
jycx: Tjycx;
implementation
function Tjycx.space(st:string):string;
var i:integer;
st1:string;
begin
for i:=1 to length(st) do
begin
if st[i]<>'' then
st1:=st1+st[i];
end;
space:=st1;
end;
{$R *.dfm}
//---自定义函数
{//////////////////////////////////
function Tjycx.timetra(data1:tdate):string;
var a:string;
begin
a:=datetimetostr(data1);
if copy(a,7,1)='-' then
begin
insert('0',a,6);
if copy(a,10,1)='' then
begin
insert('0',a,9);
showmessage(a);
end
else
showmessage(a);
end
else
begin
if copy(a,10,1)='' then
begin
insert('0',a,9);
showmessage(a);
end
else
showmessage(a);
end;
delete(a,5,1);
delete(a,7,1);
result:=a;
end;
}///////////////////// ////////////////////
//---自定义函数 完毕
procedure Tjycx.DBGrid1CellClick(Column: TColumn);
begin
labelededit1.text:=adoquery1.Fields[0].AsString;
labelededit2.text:=adoquery1.Fields[1].AsString;
labelededit3.text:=adoquery1.Fields[2].AsString;
labelededit4.text:=adoquery1.Fields[3].AsString;
labelededit5.text:=adoquery1.Fields[4].AsString;
labelededit6.text:=adoquery1.Fields[5].AsString;
labelededit7.text:=adoquery1.Fields[6].AsString;
labelededit8.text:=adoquery1.Fields[7].AsString;
labelededit9.text:=adoquery1.Fields[8].AsString;
end;
procedure Tjycx.Button1Click(Sender: TObject);
var sql:string;
com1,com2:string;
begin
sql:='select count(hno) from zhanghu ';
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add(sql);
adoquery1.Open;
memo1.lines.clear;
memo1.Lines.add(' 房屋交易数和交易金额统计结果');
memo1.Lines.Add('');
memo1.lines.add( ' 房屋交易总套数:'+' '+ adoquery1.fields[0].asstring+' 套');
sql:='select count(hno) from zhanghu where (yingfu<>yifu)';
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add(sql);
adoquery1.Open;
memo1.lines.add( ' 未付清房屋套数:'+' '+ adoquery1.fields[0].asstring+' 套');
sql:='select count(hno) from zhanghu where (yingfu=yifu)';
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add(sql);
adoquery1.Open;
memo1.lines.add( ' 已付清房屋套数:'+' '+ adoquery1.fields[0].asstring+' 套');
sql:='select sum(yingfu),sum(yifu),sum(weifu) from zhanghu ';
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add(sql);
adoquery1.Open;
memo1.Lines.Add('');
memo1.lines.add( ' 销售总金额:'+' '+ adoquery1.fields[0].asstring+' 万元');
memo1.lines.add( ' 已付清总金额:'+' '+ adoquery1.fields[1].asstring+' 万元');
memo1.lines.add( ' 未付清总金额:'+' '+ adoquery1.fields[2].asstring+' 万元');
if trim(combobox1.text)='' then
begin
com1:=datetostr(datetimepicker1.date);
com2:=datetostr(datetimepicker2.date);
sql:='select * from zhanghu where (data1 >= '''+space(com1)+''') AND (data1 <= '''+space(com2)+''')';
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add(sql);
adoquery1.Open;
end
else if trim(combobox1.text)=combobox1.items[0] then
begin
com1:=datetostr(datetimepicker1.date);
com2:=datetostr(datetimepicker2.date);
sql:='select * from zhanghu where (data1 >= '''+space(com1)+''') AND (data1 <= '''+space(com2)+''') and (yingfu<>yifu)';
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add(sql);
adoquery1.Open;
end
else
begin
if trim(combobox1.text)=combobox1.items[1] then
begin
com1:=datetostr(datetimepicker1.date);
com2:=datetostr(datetimepicker2.date);
sql:='select * from zhanghu where (data1 >= '''+space(com1)+''') AND (data1 <= '''+space(com2)+''') and (yingfu=yifu)';
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add(sql);
adoquery1.Open;
end
else
showmessage('请选择准确判断或不选');
end;
end;
procedure Tjycx.Button2Click(Sender: TObject);
begin
if messagedlg('你确定要关闭窗口吗?',mtconfirmation,[mbyes,mbno],0)=mryes then
close
else
exit;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -