?? gld150_02.pas.svn-base
字號:
unit Gld150_02;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
BAS100_01, StdCtrls, ExtCtrls, DBCtrls, Buttons, Db, DBClient, ADODB,
Menus;
type
TGld150_02Form = class(TBas100_01Form)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
ComboBox1: TComboBox;
GroupBox1: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
GroupBox2: TGroupBox;
RadioButton3: TRadioButton;
RadioButton4: TRadioButton;
RadioButton5: TRadioButton;
ComboBox2: TComboBox;
DBNavigator1: TDBNavigator;
bbtnOk: TBitBtn;
bbtnExit: TBitBtn;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bbtnOkClick(Sender: TObject);
procedure bbtnExitClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure RadioButton3Click(Sender: TObject);
private
{ Private declarations }
public
MODE:string;
ACCNO:integer;
{ Public declarations }
end;
var
Gld150_02Form: TGld150_02Form;
implementation
uses SYSDATA, CommFun;
{$R *.DFM}
procedure TGld150_02Form.FormCreate(Sender: TObject);
begin
inherited;
ComboBox2.Items.Clear;
ComboBox2.Items.Add('');
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('select * from GLD110');
SYSDM.qryQuery.Open;
while not SYSDM.qryQuery.Eof do
begin
ComboBox2.Items.Add(SYSDM.qryQuery.FieldByName('G110_003').AsString);
SYSDM.qryQuery.Next;
end;
end;
procedure TGld150_02Form.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
//
end;
procedure TGld150_02Form.bbtnOkClick(Sender: TObject);
var
S:String;
Acount1,Acount2,Acount3,Acount4,Acount5,Acount6:Integer;
ActID:String;
// AParent:Integer;
begin
inherited;
//新增
if trim(Edit1.Text)='' then
begin
ShowMsg('UMS10000120'); //科目代碼不能為空
Abort;
end;
//取得科目結構代碼
S:=GetSysParams('GLD000');
Acount1:=StrToInt(trim(copy(S,1,2)));
Acount2:=StrToInt(trim(copy(S,3,2)));
Acount3:=StrToInt(trim(copy(S,5,2)));
Acount4:=StrToInt(trim(copy(S,7,2)));
Acount5:=StrToInt(trim(copy(S,9,2)));
Acount6:=StrToInt(trim(copy(S,11,2)));
//科目長度檢驗
Acount1:=Acount1;
Acount2:=Acount1+Acount2;
Acount3:=Acount2+Acount3;
Acount4:=Acount3+Acount4;
Acount5:=Acount4+Acount5;
Acount6:=Acount5+Acount6;
S:=trim(Edit1.Text);
if not (length(S) in [Acount1,Acount2,Acount3,Acount4,Acount5,Acount6]) then
begin
ShowMsg('UMS10000121'); //無效的科目編號長度
Abort;
end;
//取得上級科目
if length(S)=Acount1 then ActID:=S
else if length(S)=Acount2 then ActID:=copy(S,1,Acount1)
else if length(S)=Acount3 then ActID:=copy(S,1,Acount2)
else if length(S)=Acount4 then ActID:=copy(S,1,Acount3)
else if length(S)=Acount5 then ActID:=copy(S,1,Acount4)
else if length(S)=Acount6 then ActID:=copy(S,1,Acount5);
if ActID<>S then
begin
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('select G100_001 from GLD100 where G100_002='+''''+S+'''');
SYSDM.qryQuery.Open;
if SYSDM.qryQuery.IsEmpty then
begin
ShowMsg('UMS10000122'); //沒有對應的上級科目,無效的科目編號
Abort;
end;
// AParent:=SYSDM.qryQuery.Fields[0].Value;
end;
//保存數據
if MODE='ADD' then
begin
Edit1.Text:='';
Edit2.Text:='';
Edit1.SetFocus;
end else
if MODE='UPD' then
begin
Close;
end;
end;
procedure TGld150_02Form.bbtnExitClick(Sender: TObject);
begin
inherited;
//exit
Close;
end;
procedure TGld150_02Form.FormActivate(Sender: TObject);
begin
inherited;
if MODE='ADD' then bbtnOk.Caption:='新增(&A)'
else if MODE='UPD' then bbtnOk.Caption:='確定(&O)';
end;
procedure TGld150_02Form.RadioButton3Click(Sender: TObject);
begin
inherited;
ComboBox2.Enabled:=RadioButton5.Checked;
end;
initialization
RegisterClass(TGld150_02Form);
finalization
UnRegisterClass(TGld150_02Form);
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -