Am_wjbjs.pas
资源名称:挡案管理系统.rar [点击查看]
上传用户:szruida
上传日期:2007-06-01
资源大小:6518k
文件大小:11k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit Am_wjbjs;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, ExtCtrls, StdCtrls, Buttons, DB, Mask, DBCtrls, DBCtrlsEh,
- DBLookupEh, TFlatHintUnit, DBClient;
- type
- TAm_wjgl_bj = class(TForm)
- Panel1: TPanel;
- Panel2: TPanel;
- Quit: TBitBtn;
- Add: TBitBtn;
- Label1: TLabel;
- Label2: TLabel;
- Label4: TLabel;
- DBEdit4: TDBEdit;
- Label6: TLabel;
- Label7: TLabel;
- Label8: TLabel;
- DBEdit8: TDBEdit;
- Label9: TLabel;
- DBEdit9: TDBEdit;
- Label10: TLabel;
- Label11: TLabel;
- Label12: TLabel;
- Label13: TLabel;
- Label14: TLabel;
- DBEdit14: TDBEdit;
- Label15: TLabel;
- DBEdit15: TDBEdit;
- Label16: TLabel;
- Label17: TLabel;
- Label18: TLabel;
- Label19: TLabel;
- DBEdit19: TDBEdit;
- Label20: TLabel;
- DBEdit20: TDBEdit;
- Label3: TLabel;
- DBMemo1: TDBMemo;
- DBMemo2: TDBMemo;
- DBMemo3: TDBMemo;
- DBEditEh1: TDBEditEh;
- DBLookupComboboxEh1: TDBLookupComboboxEh;
- DBLookupComboboxEh2: TDBLookupComboboxEh;
- DBDateTimeEditEh1: TDBDateTimeEditEh;
- DBDateTimeEditEh2: TDBDateTimeEditEh;
- Label5: TLabel;
- DBLookupComboboxEh3: TDBLookupComboboxEh;
- SpeedButton1: TSpeedButton;
- SpeedButton2: TSpeedButton;
- DBNumberEditEh1: TDBNumberEditEh;
- Label21: TLabel;
- Label22: TLabel;
- Label23: TLabel;
- FlatHint1: TFlatHint;
- DBEditEh2: TDBEditEh;
- ClientDataSet1: TClientDataSet;
- DBEditEh3: TDBEditEh;
- DBEditEh4: TDBEditEh;
- ClientDataSet2: TClientDataSet;
- procedure QuitClick(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure AddClick(Sender: TObject);
- procedure FormShow(Sender: TObject);
- procedure DBEdit7Exit(Sender: TObject);
- procedure DBEdit20Exit(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure SpeedButton1Click(Sender: TObject);
- procedure SpeedButton2Click(Sender: TObject);
- procedure DBMemo1KeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- procedure DBMemo1KeyPress(Sender: TObject; var Key: Char);
- procedure DBMemo1MouseDown(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- procedure DBMemo2KeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- procedure DBMemo2KeyPress(Sender: TObject; var Key: Char);
- procedure DBMemo2MouseDown(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- procedure DBMemo3KeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- procedure DBMemo3MouseDown(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- procedure DBMemo3KeyPress(Sender: TObject; var Key: Char);
- procedure DBEdit20KeyPress(Sender: TObject; var Key: Char);
- procedure DBNumberEditEh1Exit(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Am_wjgl_bj: TAm_wjgl_bj;
- cpos,lpos,linelength:integer;
- N_yc:integer;//文件页次
- implementation
- uses DMs,am_yljs,mainfrms,u_public,ajgls, am_Sdqcs;
- {$R *.dfm}
- procedure TAm_wjgl_bj.QuitClick(Sender: TObject);
- begin
- Close;
- end;
- procedure TAm_wjgl_bj.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- am_wjgl_bj:=nil;
- action:=cafree;
- frm_name2:='';
- end;
- procedure TAm_wjgl_bj.AddClick(Sender: TObject);
- var i:integer;
- begin
- if DbLookUpComboboxeh3.Text='' then
- begin
- application.MessageBox('文件类别不能为空','提示',mb_ok+mb_iconinformation);
- DbLookUpComboboxeh3.SetFocus;
- exit;
- end;
- if DbLookUpComboboxeh1.Text='' then
- begin
- application.MessageBox('责任者不能为空','提示',mb_ok+mb_iconinformation);
- DbLookUpComboboxeh1.SetFocus;
- exit;
- end;
- if DbLookUpComboboxeh2.Text='' then
- begin
- application.MessageBox('载体类别不能为空','提示',mb_ok+mb_iconinformation);
- DbLookUpComboboxeh2.SetFocus;
- exit;
- end;
- //----------------------------------------------------------------
- dm.Am_wjgl.ApplyUpdates(0);
- i:=dm.Am_wjgl.ApplyUpdates(0);
- if i=0 then
- begin
- application.MessageBox('数据保存成功','提示',mb_ok+mb_iconinformation);
- dm.Am_wjgl.Close;
- dm.am_wjgl.CommandText:='select * from am_wjgl';
- dm.am_wjgl.Open;
- dm.V_Wjgl.Close;
- dm.V_Wjgl.CommandText:='select * from V_wjgl';
- dm.V_Wjgl.Open;//案卷管理对应的是v_wjgl
- dm.V_Wjgl2.Close;
- dm.V_Wjgl2.CommandText:='select * from v_wjgl2';
- dm.V_Wjgl2.Open;//案卷管理对应的是v_wjgl2
- close;
- end
- else
- begin
- application.MessageBox('数据保存失败','提示',mb_ok+mb_iconinformation);
- exit;
- end;
- end;
- procedure TAm_wjgl_bj.FormShow(Sender: TObject);
- var now1:Tdatetime;
- n:integer;
- begin
- if frm_name='am_ajgl' then
- begin
- n:=pos('-',am_ajgl.tree.selected.Text)-1;
- epos1:=copy(am_ajgl.tree.Selected.Text,1,n);//案卷代码
- Epos2:=copy(am_ajgl.tree.Selected.Text,n+2,length(am_ajgl.tree.Selected.Text));
- DBEdit4.Text:=Epos2;
- dbediteh1.Text:=YearNow();
- s_ajxh:=dm.V_ajgl.fieldbyname('aj_xh').AsString;
- Clientdataset1.Close;
- Clientdataset1.CommandText:='select * from v_wjgl where aj_xh='+''''+s_ajxh+''''+'';
- Clientdataset1.Open;
- Clientdataset2.Close;//查找最大的文件页次号
- clientdataset2.CommandText:='select max(wj_yc) as wj_yc from am_wjgl where aj_xh='+''''+s_ajxh+''''+'';
- Clientdataset2.Open;
- N_Yc:=Clientdataset2.fieldbyname('wj_yc').AsInteger;
- dbediteh2.Text:=inttostr(Clientdataset1.RecordCount+1);
- DBDatetimeEditeh1.Text:=formatdatetime('yyyy-mm-dd',now);
- dbedit14.Text:=am_ajgl.DBGridEh1.FieldColumns['bgqx_mc'].DisplayText;
- dbedit15.Text:=dm.V_ajgl.fieldbyname('mj_mc').AsString;
- dm.Am_wjgl.FieldByName('user_name').AsString:=user_name;
- dm.Am_wjgl.fieldbyname('aj_xh').AsString:=dm.V_ajgl.fieldbyname('aj_xh').AsString;
- end
- else if frm_name='am_ylj' then//预立卷
- begin
- n:=pos('-',am_ylj.tree.selected.Text)-1;
- epos1:=copy(am_ylj.tree.Selected.Text,1,n);//案卷代码
- Epos2:=copy(am_ylj.tree.Selected.Text,n+2,length(am_ylj.tree.Selected.Text));
- DBEdit4.Text:=Epos2;
- dbediteh1.Text:=YearNow();
- s_ajxh:=dm.V_ylj.fieldbyname('aj_xh').AsString;
- Clientdataset1.Close;
- Clientdataset1.CommandText:='select * from v_wjgl where aj_xh='+''''+s_ajxh+''''+'';
- Clientdataset1.Open;
- Clientdataset2.Close;//查找最大的文件页次号
- clientdataset2.CommandText:='select max(wj_yc) as wj_yc from am_wjgl where aj_xh='+''''+s_ajxh+''''+'';
- Clientdataset2.Open;
- N_Yc:=Clientdataset2.fieldbyname('wj_yc').AsInteger;
- dbediteh2.Text:=inttostr(Clientdataset1.RecordCount+1);
- DBDatetimeEditeh1.Text:=formatdatetime('yyyy-mm-dd',now);
- dbedit14.Text:=dm.V_ylj.fieldbyname('bgqx_mc').AsString;
- dbedit15.Text:=dm.V_ylj.fieldbyname('mj_mc').AsString;
- dm.Am_wjgl.FieldByName('user_name').AsString:=user_name;
- dm.Am_wjgl.fieldbyname('aj_xh').AsString:=dm.V_ylj.fieldbyname('aj_xh').AsString;
- end;
- end;
- procedure TAm_wjgl_bj.DBEdit7Exit(Sender: TObject);
- begin
- if frm_name='am_ylj' then
- dbedit9.Text:=ylj_s2+'-'+dbediteh1.Text+'-'+s_ajxh+'-'+dbedit20.Text;
- if frm_name='am_ajgl' then
- dbedit9.Text:=ajgl_s2+'-'+dbediteh1.Text+'-'+s_ajxh+'-'+dbedit20.Text;
- end;
- procedure TAm_wjgl_bj.DBEdit20Exit(Sender: TObject);
- begin
- if frm_name='am_ylj' then
- dbedit9.Text:=ylj_s2+'-'+dbediteh1.Text+'-'+s_ajxh+'-'+dbedit20.Text;
- if frm_name='am_ajgl' then
- dbedit9.Text:=ajgl_s2+'-'+dbediteh1.Text+'-'+s_ajxh+'-'+dbedit20.Text;
- end;
- procedure TAm_wjgl_bj.FormCreate(Sender: TObject);
- begin
- frm_name2:='am_Wjgl_bj';
- end;
- procedure TAm_wjgl_bj.SpeedButton1Click(Sender: TObject);
- begin
- DbEditeh3.Text:='';
- end;
- procedure TAm_wjgl_bj.SpeedButton2Click(Sender: TObject);
- begin
- if am_sdqc=NIl then
- begin
- am_sdqc:=Tam_sdqc.create(application);
- am_sdqc.showmodal;
- end;
- end;
- procedure TAm_wjgl_bj.DBMemo1KeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- begin
- Lpos:=sendmessage(dbmemo1.Handle,EM_linefromchar,dbmemo1.SelStart,0);
- Cpos:=sendmessage(dbmemo1.Handle,em_lineindex,lpos,0);
- linelength:=sendmessage(dbmemo1.Handle,em_linelength,cpos,0);
- Cpos:=dbmemo1.SelStart-cpos;
- end;
- procedure TAm_wjgl_bj.DBMemo1KeyPress(Sender: TObject; var Key: Char);
- begin
- if (Cpos>76)or(linelength>76)then
- begin
- key:=#13;
- lpos:=lpos+1;
- cpos:=1;
- linelength:=1;
- end;
- end;
- procedure TAm_wjgl_bj.DBMemo1MouseDown(Sender: TObject;
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- begin
- Lpos:=sendmessage(dbmemo1.Handle,EM_linefromchar,dbmemo1.SelStart,0);
- Cpos:=sendmessage(dbmemo1.Handle,em_lineindex,lpos,0);
- linelength:=sendmessage(dbmemo1.Handle,em_linelength,cpos,0);
- Cpos:=dbmemo1.SelStart-cpos;
- end;
- procedure TAm_wjgl_bj.DBMemo2KeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- begin
- Lpos:=sendmessage(dbmemo2.Handle,EM_linefromchar,dbmemo2.SelStart,0);
- Cpos:=sendmessage(dbmemo2.Handle,em_lineindex,lpos,0);
- linelength:=sendmessage(dbmemo2.Handle,em_linelength,cpos,0);
- Cpos:=dbmemo2.SelStart-cpos;
- end;
- procedure TAm_wjgl_bj.DBMemo2KeyPress(Sender: TObject; var Key: Char);
- begin
- if (Cpos>76)or(linelength>76)then
- begin
- key:=#13;
- lpos:=lpos+1;
- cpos:=1;
- linelength:=1;
- end;
- end;
- procedure TAm_wjgl_bj.DBMemo2MouseDown(Sender: TObject;
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- begin
- Lpos:=sendmessage(dbmemo2.Handle,EM_linefromchar,dbmemo2.SelStart,0);
- Cpos:=sendmessage(dbmemo2.Handle,em_lineindex,lpos,0);
- linelength:=sendmessage(dbmemo2.Handle,em_linelength,cpos,0);
- Cpos:=dbmemo2.SelStart-cpos;
- end;
- procedure TAm_wjgl_bj.DBMemo3KeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- begin
- Lpos:=sendmessage(dbmemo3.Handle,EM_linefromchar,dbmemo3.SelStart,0);
- Cpos:=sendmessage(dbmemo3.Handle,em_lineindex,lpos,0);
- linelength:=sendmessage(dbmemo3.Handle,em_linelength,cpos,0);
- Cpos:=dbmemo3.SelStart-cpos;
- end;
- procedure TAm_wjgl_bj.DBMemo3MouseDown(Sender: TObject;
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- begin
- Lpos:=sendmessage(dbmemo3.Handle,EM_linefromchar,dbmemo3.SelStart,0);
- Cpos:=sendmessage(dbmemo3.Handle,em_lineindex,lpos,0);
- linelength:=sendmessage(dbmemo3.Handle,em_linelength,cpos,0);
- Cpos:=dbmemo3.SelStart-cpos;
- end;
- procedure TAm_wjgl_bj.DBMemo3KeyPress(Sender: TObject; var Key: Char);
- begin
- if (Cpos>76)or(linelength>76)then
- begin
- key:=#13;
- lpos:=lpos+1;
- cpos:=1;
- linelength:=1;
- end;
- end;
- procedure TAm_wjgl_bj.DBEdit20KeyPress(Sender: TObject; var Key: Char);
- begin
- if not(key in['0'..'9',#13,#8]) then
- key:=#0;
- end;
- procedure TAm_wjgl_bj.DBNumberEditEh1Exit(Sender: TObject);
- var s:string;
- begin//怎样实现?
- DbEditeh4.Text:=IntToStr(strToInt(DBNumberEditEh1.Text)+N_yc);
- //s:=dm.V_ylj.fieldbyname('aj_xh').AsString;
- end;
- end.