unit u_info_custom; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, bsSkinCtrls, dxCntner, dxTL, dxDBCtrl, dxDBGrid, DB, ADODB, StdCtrls; type Tfrm_info_custom = class(TForm) dxDBGrid1: TdxDBGrid; t_info_custom: TADOQuery; t_info_custom1: TDataSource; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridMaskColumn; dxDBGrid1Column6: TdxDBGridMaskColumn; dxDBGrid1Column7: TdxDBGridMaskColumn; dxDBGrid1Column8: TdxDBGridMaskColumn; bsSkinGroupBox1: TbsSkinGroupBox; Label1: TLabel; Label2: TLabel; Edit1: TEdit; Edit2: TEdit; bsSkinButton3: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton7: TbsSkinButton; bsSkinButton1: TbsSkinButton; dxDBGrid1Column9: TdxDBGridColumn; procedure FormShow(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure bsSkinButton7Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_info_custom: Tfrm_info_custom; implementation uses u_main, my_sys_function; {$R *.dfm} procedure Tfrm_info_custom.FormShow(Sender: TObject); begin t_info_custom.open; loadreggrid(dxdbgrid1,false,caption); end; procedure Tfrm_info_custom.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); frm_info_custom.Hide; frm_info_custom.ManualFloat(frm_info_custom.BoundsRect ); frm_main.freeTabs('frm_info_custom'); action:=cafree; frm_info_custom:=nil; end; procedure Tfrm_info_custom.bsSkinButton2Click(Sender: TObject); begin close; end; procedure Tfrm_info_custom.bsSkinButton4Click(Sender: TObject); begin t_info_custom.insert; end; procedure Tfrm_info_custom.bsSkinButton5Click(Sender: TObject); begin table_post(t_info_custom); end; procedure Tfrm_info_custom.bsSkinButton6Click(Sender: TObject); begin table_delete(t_info_custom); end; procedure Tfrm_info_custom.bsSkinButton7Click(Sender: TObject); begin table_cancel(t_info_custom); end; procedure Tfrm_info_custom.bsSkinButton3Click(Sender: TObject); var str:widestring; begin if Edit1.text<>'' then str:='where 商品编码 like '+''''+'%'+Edit1.text+'%'+''''; if Edit2.text<>'' then begin if str=''then str:='where 商品名称 like '+''''+'%'+Edit2.text+'%'+'''' else str:=str+' and 商品名称 like '+''''+'%'+Edit2.text+'%'+''''; end; t_info_custom.close; t_info_custom.sql.clear; t_info_custom.sql.add('select * from t_info_custom '+str+' order by 商品编码'); t_info_custom.open; end; procedure Tfrm_info_custom.bsSkinButton1Click(Sender: TObject); begin if not if_open('199') then begin showmessage('对不起你没有此模块的操作权限!'); exit; end; if bsSkinButton1.Caption='编 辑' then begin bsSkinButton1.Caption:='只 读'; dxDBGrid1Column1.ReadOnly:=false; dxDBGrid1Column2.ReadOnly:=false; dxDBGrid1Column3.ReadOnly:=false; dxDBGrid1Column4.ReadOnly:=false; dxDBGrid1Column5.ReadOnly:=false; dxDBGrid1Column6.ReadOnly:=false; dxDBGrid1Column7.ReadOnly:=false; dxDBGrid1Column8.ReadOnly:=false; dxDBGrid1Column9.ReadOnly:=false; bsSkinButton4.Enabled:=true; bsSkinButton5.Enabled:=true; bsSkinButton6.Enabled:=true; bsSkinButton7.Enabled:=true; end else begin dxDBGrid1Column1.ReadOnly:=true; dxDBGrid1Column2.ReadOnly:=true; dxDBGrid1Column3.ReadOnly:=true; dxDBGrid1Column4.ReadOnly:=true; dxDBGrid1Column5.ReadOnly:=true; dxDBGrid1Column6.ReadOnly:=true; dxDBGrid1Column7.ReadOnly:=true; dxDBGrid1Column8.ReadOnly:=true; dxDBGrid1Column9.ReadOnly:=true; bsSkinButton1.Caption:='编 辑'; bsSkinButton4.Enabled:=false; bsSkinButton5.Enabled:=false; bsSkinButton6.Enabled:=false; bsSkinButton7.Enabled:=false; end; end; end.