K
kazj
Unregistered / Unconfirmed
GUEST, unregistred user!
希望大哥大姐们能给我讲解一下每句话的意思,谢谢拉!!
unit yp;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids, ExtCtrls, DB, ADODB, cxStyles,
cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit,
cxDBData, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGrid,QDialogs,
DBTables,U_Function, ComCtrls;
type
TForm1 = class(TForm)
Panel2: TPanel;
scypButton: TButton;
dyButton: TButton;
bcButton: TButton;
Panel1: TPanel;
cxGrid1: TcxGrid;
cxGrid1DBTableView1: TcxGridDBTableView;
cxGrid1DBTableView1yp_bh: TcxGridDBColumn;
cxGrid1DBTableView1yp_bm: TcxGridDBColumn;
cxGrid1DBTableView1yp_name: TcxGridDBColumn;
cxGrid1DBTableView1yp_changjia: TcxGridDBColumn;
cxGrid1DBTableView1yp_xingzhi: TcxGridDBColumn;
cxGrid1DBTableView1yp_guige: TcxGridDBColumn;
cxGrid1DBTableView1yp_danwei: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
xgButton: TButton;
gjjeLabeledEdit: TLabeledEdit;
yfjeLabeledEdit: TLabeledEdit;
yhtjComboBox: TComboBox;
Label1: TLabel;
ssjeLabeledEdit: TLabeledEdit;
yzjeLabeledEdit: TLabeledEdit;
zlButton: TButton;
Label2: TLabel;
ADOCon_yd: TADOConnection;
DataSource1: TDataSource;
DataSource2: TDataSource;
Button1: TButton;
Label3: TLabel;
Label4: TLabel;
ADOQ_cx_bh: TADOQuery;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
ADOQ_cx_name: TADOQuery;
ADODataSet1: TADOQuery;
cxGrid1DBTableView1yp_ls: TcxGridDBColumn;
cxGrid1DBTableView1yp_pf: TcxGridDBColumn;
Edit3: TEdit;
UpDown1: TUpDown;
CheckBox1: TCheckBox;
Label5: TLabel;
Edit1: TEdit;
Edit2: TEdit;
cxGrid1DBTableView1yp_sysl: TcxGridDBColumn;
cxGrid1DBTableView1yp_bzq: TcxGridDBColumn;
cxGrid1DBTableView1yp_jhrq: TcxGridDBColumn;
cxGrid2: TcxGrid;
cxGridDBTableView1: TcxGridDBTableView;
cxGridDBColumn1: TcxGridDBColumn;
cxGridDBColumn2: TcxGridDBColumn;
cxGridDBColumn3: TcxGridDBColumn;
cxGridDBColumn4: TcxGridDBColumn;
cxGridDBColumn5: TcxGridDBColumn;
cxGridDBColumn6: TcxGridDBColumn;
cxGridDBColumn7: TcxGridDBColumn;
cxGridDBColumn8: TcxGridDBColumn;
cxGridDBColumn9: TcxGridDBColumn;
cxGridDBColumn10: TcxGridDBColumn;
cxGridDBColumn11: TcxGridDBColumn;
cxGridDBColumn12: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
ADODataSet2: TADOQuery;
cxGridDBTableView1DBColumn1: TcxGridDBColumn;
ADOQ_sc: TADOQuery;
procedure Edit3KeyPress(Sender: TObject
var Key: Char);
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ComboBox1KeyPress(Sender: TObject
var Key: Char);
procedure ComboBox1Click(Sender: TObject);
procedure cxGrid1DBTableView1CellClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo
AButton: TMouseButton;
AShift: TShiftState
var AHandled: Boolean);
procedure Edit3Exit(Sender: TObject);
procedure xgButtonClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
str,tj : string;
begin
if combobox1.ItemIndex= 1 then
begin
str := 'yp_bh';
tj := ' where '+str+'='+trim(combobox2.Text);
end
else if combobox1.ItemIndex= 2 then
begin
str := 'yp_name';
tj := ' where '+str+'='+''''+trim(combobox2.Text)+'''';
end;
if trim(COMBOBOx1.Text)<>'' then
liulan(ADODataSet1,'yp_xinxi',tj)
else liulan(ADODataSet1,'yp_xinxi','');
end;
procedure TForm1.Edit3KeyPress(Sender: TObject
var Key: Char);
begin
_int(panel1,key,sender);
end;
procedure TForm1.FormShow(Sender: TObject);
begin
ADODataSet1.Active :=false;
ADODataSet1.Active :=true;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
try
ADOCon_yd.Connected := true;
except
showmessage('请先配置yaodian.UDL!') ;
end;
end;
procedure TForm1.ComboBox1KeyPress(Sender: TObject
var Key: Char);
begin
key := #0;
end;
procedure TForm1.ComboBox1Click(Sender: TObject);
begin
if combobox1.ItemIndex=1 then
begin
ADOQ_cx_bh.Close;
ADOQ_cx_bh.Open;
klb_com(ADOQ_cx_bh,combobox2,0);
end
else if combobox1.ItemIndex=2 then
begin
ADOQ_cx_name.Close;
ADOQ_cx_name.Open;
klb_com(ADOQ_cx_name,combobox2,0);
end
else combobox2.Items.Clear;
end;
procedure TForm1.cxGrid1DBTableView1CellClick(
Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo
AButton: TMouseButton;
AShift: TShiftState
var AHandled: Boolean);
begin
if ADODataSet1.RecordCount<>0 then
begin
if checkbox1.Checked then
edit1.Text := ADODataSet1.Fields[8].AsString
else Edit1.Text := ADODataSet1.Fields[7].AsString;
end
end;
procedure TForm1.Edit3Exit(Sender: TObject);
begin
if trim(edit3.Text)='' then
edit3.Text := '0';
end;
procedure TForm1.xgButtonClick(Sender: TObject);
VAR
I,ljje : INTEGER;
je : string;
begin
je := '0';
ljje := 0;
ADOQ_sc.Close;
ADOQ_sc.SQL.Clear;
ADOQ_sc.SQL.Add('select * FROM yp_xiaoshou');
ADOQ_sc.Open;
ADOQ_sc.Insert;
for i := 0 to 6 do
ADOQ_sc.Fields.AsString := ADODataSet1.Fields.AsString;
if checkbox1.Checked then
begin
ADOQ_sc.Fields[7].AsBoolean := true;
je := ADODataSet1.Fields[8].AsString ;
ADOQ_sc.Fields[8].AsString := je;
end
else begin
ADOQ_sc.Fields[7].AsBoolean := false;
je := ADODataSet1.Fields[7].AsString ;
ADOQ_sc.Fields[8].AsString := je;
end;
ADOQ_sc.Fields[9].AsString := trim(EDIT1.Text) ;
ADOQ_sc.Fields[10].AsString := datetostr(now) ;
ADOQ_sc.Fields[11].AsString := ADODataSet1.Fields[11].AsString ;
ADOQ_sc.Fields[12].AsString := 'good';
ADOQ_sc.Fields[13].AsString := inttostr(strtoint(trim(EDIT1.Text))*(strtoint(je)));
ADOQ_sc.Post;
ADODataSet2.Close;
ADODataSet2.Open;
ADODataSet2.First;
for i := 0 to ADODataSet2.RecordCount-1 do
begin
ljje := ljje+ strtoint(trim(ADODataSet2.Fields[13].asstring));
ADODataSet2.Next;
end;
ADODataSet2.First;
gjjeLabeledEdit.Text := inttostr(ljje);
end;
end.
unit yp;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids, ExtCtrls, DB, ADODB, cxStyles,
cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit,
cxDBData, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGrid,QDialogs,
DBTables,U_Function, ComCtrls;
type
TForm1 = class(TForm)
Panel2: TPanel;
scypButton: TButton;
dyButton: TButton;
bcButton: TButton;
Panel1: TPanel;
cxGrid1: TcxGrid;
cxGrid1DBTableView1: TcxGridDBTableView;
cxGrid1DBTableView1yp_bh: TcxGridDBColumn;
cxGrid1DBTableView1yp_bm: TcxGridDBColumn;
cxGrid1DBTableView1yp_name: TcxGridDBColumn;
cxGrid1DBTableView1yp_changjia: TcxGridDBColumn;
cxGrid1DBTableView1yp_xingzhi: TcxGridDBColumn;
cxGrid1DBTableView1yp_guige: TcxGridDBColumn;
cxGrid1DBTableView1yp_danwei: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
xgButton: TButton;
gjjeLabeledEdit: TLabeledEdit;
yfjeLabeledEdit: TLabeledEdit;
yhtjComboBox: TComboBox;
Label1: TLabel;
ssjeLabeledEdit: TLabeledEdit;
yzjeLabeledEdit: TLabeledEdit;
zlButton: TButton;
Label2: TLabel;
ADOCon_yd: TADOConnection;
DataSource1: TDataSource;
DataSource2: TDataSource;
Button1: TButton;
Label3: TLabel;
Label4: TLabel;
ADOQ_cx_bh: TADOQuery;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
ADOQ_cx_name: TADOQuery;
ADODataSet1: TADOQuery;
cxGrid1DBTableView1yp_ls: TcxGridDBColumn;
cxGrid1DBTableView1yp_pf: TcxGridDBColumn;
Edit3: TEdit;
UpDown1: TUpDown;
CheckBox1: TCheckBox;
Label5: TLabel;
Edit1: TEdit;
Edit2: TEdit;
cxGrid1DBTableView1yp_sysl: TcxGridDBColumn;
cxGrid1DBTableView1yp_bzq: TcxGridDBColumn;
cxGrid1DBTableView1yp_jhrq: TcxGridDBColumn;
cxGrid2: TcxGrid;
cxGridDBTableView1: TcxGridDBTableView;
cxGridDBColumn1: TcxGridDBColumn;
cxGridDBColumn2: TcxGridDBColumn;
cxGridDBColumn3: TcxGridDBColumn;
cxGridDBColumn4: TcxGridDBColumn;
cxGridDBColumn5: TcxGridDBColumn;
cxGridDBColumn6: TcxGridDBColumn;
cxGridDBColumn7: TcxGridDBColumn;
cxGridDBColumn8: TcxGridDBColumn;
cxGridDBColumn9: TcxGridDBColumn;
cxGridDBColumn10: TcxGridDBColumn;
cxGridDBColumn11: TcxGridDBColumn;
cxGridDBColumn12: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
ADODataSet2: TADOQuery;
cxGridDBTableView1DBColumn1: TcxGridDBColumn;
ADOQ_sc: TADOQuery;
procedure Edit3KeyPress(Sender: TObject
var Key: Char);
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ComboBox1KeyPress(Sender: TObject
var Key: Char);
procedure ComboBox1Click(Sender: TObject);
procedure cxGrid1DBTableView1CellClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo
AButton: TMouseButton;
AShift: TShiftState
var AHandled: Boolean);
procedure Edit3Exit(Sender: TObject);
procedure xgButtonClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
str,tj : string;
begin
if combobox1.ItemIndex= 1 then
begin
str := 'yp_bh';
tj := ' where '+str+'='+trim(combobox2.Text);
end
else if combobox1.ItemIndex= 2 then
begin
str := 'yp_name';
tj := ' where '+str+'='+''''+trim(combobox2.Text)+'''';
end;
if trim(COMBOBOx1.Text)<>'' then
liulan(ADODataSet1,'yp_xinxi',tj)
else liulan(ADODataSet1,'yp_xinxi','');
end;
procedure TForm1.Edit3KeyPress(Sender: TObject
var Key: Char);
begin
_int(panel1,key,sender);
end;
procedure TForm1.FormShow(Sender: TObject);
begin
ADODataSet1.Active :=false;
ADODataSet1.Active :=true;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
try
ADOCon_yd.Connected := true;
except
showmessage('请先配置yaodian.UDL!') ;
end;
end;
procedure TForm1.ComboBox1KeyPress(Sender: TObject
var Key: Char);
begin
key := #0;
end;
procedure TForm1.ComboBox1Click(Sender: TObject);
begin
if combobox1.ItemIndex=1 then
begin
ADOQ_cx_bh.Close;
ADOQ_cx_bh.Open;
klb_com(ADOQ_cx_bh,combobox2,0);
end
else if combobox1.ItemIndex=2 then
begin
ADOQ_cx_name.Close;
ADOQ_cx_name.Open;
klb_com(ADOQ_cx_name,combobox2,0);
end
else combobox2.Items.Clear;
end;
procedure TForm1.cxGrid1DBTableView1CellClick(
Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo
AButton: TMouseButton;
AShift: TShiftState
var AHandled: Boolean);
begin
if ADODataSet1.RecordCount<>0 then
begin
if checkbox1.Checked then
edit1.Text := ADODataSet1.Fields[8].AsString
else Edit1.Text := ADODataSet1.Fields[7].AsString;
end
end;
procedure TForm1.Edit3Exit(Sender: TObject);
begin
if trim(edit3.Text)='' then
edit3.Text := '0';
end;
procedure TForm1.xgButtonClick(Sender: TObject);
VAR
I,ljje : INTEGER;
je : string;
begin
je := '0';
ljje := 0;
ADOQ_sc.Close;
ADOQ_sc.SQL.Clear;
ADOQ_sc.SQL.Add('select * FROM yp_xiaoshou');
ADOQ_sc.Open;
ADOQ_sc.Insert;
for i := 0 to 6 do
ADOQ_sc.Fields.AsString := ADODataSet1.Fields.AsString;
if checkbox1.Checked then
begin
ADOQ_sc.Fields[7].AsBoolean := true;
je := ADODataSet1.Fields[8].AsString ;
ADOQ_sc.Fields[8].AsString := je;
end
else begin
ADOQ_sc.Fields[7].AsBoolean := false;
je := ADODataSet1.Fields[7].AsString ;
ADOQ_sc.Fields[8].AsString := je;
end;
ADOQ_sc.Fields[9].AsString := trim(EDIT1.Text) ;
ADOQ_sc.Fields[10].AsString := datetostr(now) ;
ADOQ_sc.Fields[11].AsString := ADODataSet1.Fields[11].AsString ;
ADOQ_sc.Fields[12].AsString := 'good';
ADOQ_sc.Fields[13].AsString := inttostr(strtoint(trim(EDIT1.Text))*(strtoint(je)));
ADOQ_sc.Post;
ADODataSet2.Close;
ADODataSet2.Open;
ADODataSet2.First;
for i := 0 to ADODataSet2.RecordCount-1 do
begin
ljje := ljje+ strtoint(trim(ADODataSet2.Fields[13].asstring));
ADODataSet2.Next;
end;
ADODataSet2.First;
gjjeLabeledEdit.Text := inttostr(ljje);
end;
end.