📄 gl_enter_accountsubject_d.pas
字号:
end;
if Cmb_PageType.ItemIndex <= 0 then
begin
DispInfo('账页格式选择错误!',3);
Cmb_PageType.SetFocus;
Abort;
end;
if Trim(edt_Fcurrecy.Text)='' then
begin
DispInfo('货币不能为空!',3);
Edt_Fcurrecy.SetFocus;
Abort;
end;
inherited;
end;
procedure TFrm_Gl_Enter_AccountSubject_D.SaveGl_AccountSubjectHistoryHistory(
AdoConnection: TAdoConnection; KmCode, UserCode: string;
HisType: integer);
var AdoQry:TAdoQuery;
AdoQrytmp:TAdoQuery;
sqltext:string;
chgType:string;
begin
case hisType of
1: chgType:='新增';
2: chgType:='修改';
3: chgType:='删除';
end;
AdoQry:=TAdoQuery.Create(Application);
AdoQry.EnableBCD:=False;
AdoQry.Connection:=AdoConnection;
AdoQrytmp:=TAdoQuery.Create(Application);
AdoQrytmp.EnableBCD:=False;
AdoQrytmp.Connection:=AdoConnection;
with AdoQry do
begin
Close;
sql.clear;
sql.Text:='Select * from Gl_AccountSubject where KmCode='+Quotedstr(KmCode);
Prepared;
open;
if recordCount=0 then exit;
end;
sqltext := ' Insert into Gl_AccountSubjectHistory'
+' (endKm,KmId,KmLevel,KmCode,KmHelpCode,KmName, '
+' FCurrecy,UomCode,KmType,KmProperty,'
+' PageType,'
+' AmountCalculate,KmFreeze,CashControl,'
+' PersonCalculate,DepArtCalculate,VendorCalculate,'
+' CustomerCalculate,ProjectCalculate,ChgEmployeeCode,ChgTime,ChgType ) '
+' Values('
+' '''+AdoQry.fieldbyname('endKm').AsString+''','
+' '''+AdoQry.fieldbyname('KmID').AsString+''','
+' '''+AdoQry.fieldbyname('KmLevel').AsString+''','
+' '''+AdoQry.fieldbyname('KmCode').AsString+''','
+' '''+AdoQry.fieldbyname('KmHelpCode').AsString+''','
+' '''+AdoQry.fieldbyname('KmName').AsString+''','
// +' '''+AdoQry.fieldbyname('TotalKmCode').AsString +''','
+' '''+AdoQry.fieldbyname('FCurrecy').AsString +''','
+' '''+AdoQry.fieldbyname('UomCode').AsString +''','
+''''+AdoQry.fieldbyname('KmType').AsString +''','
+''''+AdoQry.fieldbyname('KmProperty').AsString +''','
+''''+AdoQry.fieldbyname('PageType').AsString +''','
// +''''+AdoQry.fieldbyname('FCurrecyCalculate').AsString +''','
+''''+AdoQry.fieldbyname('AmountCalculate').AsString +''','
+''''+AdoQry.fieldbyname('KmFreeze').AsString +''','
+''''+AdoQry.fieldbyname('CashControl').AsString +''','
+''''+AdoQry.fieldbyname('PersonCalculate').AsString +''','
+''''+AdoQry.fieldbyname('DepArtCalculate').AsString +''','
+''''+AdoQry.fieldbyname('VendorCalculate').AsString +''','
+''''+AdoQry.fieldbyname('CustomerCalculate').AsString +''','
+''''+AdoQry.fieldbyname('ProjectCalculate').AsString +''','
+quotedstr(userCode)+','
+'getdate(),'
+quotedstr(chgType)+')';
with AdoQrytmp do
begin
Close;
sql.clear;
sql.Text:=sqltext;
try
execsql;
except
end;
end;
try
AdoQry.Free;
AdoQrytmp.Free;
except
end;
end;
function TFrm_Gl_Enter_AccountSubject_D.KmCodeCheck(
var_KmCode: String): Integer;
var
SqlText,Tmp_KmCode:String;
KmLength1,KmLength2,KmLength3,KmLength4,KmLength5,KmLength6:Integer;
begin
if var_KmCode <> '' then
begin
If (status='Add') Then
begin
SQlText:='Select KmCode From Gl_AccountSubject Where KmCode='''+var_KmCode+''' ';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := SqlText;
AdoQry_Tmp.Open;
if not AdoQry_Tmp.Eof then
begin
DispInfo('科目代码不能重复!',1);
Edt_KmCode.SetFocus;
Abort;
end
else
begin
SQlText:=' Select * From Gl_AccountParam ';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := SqlText;
AdoQry_Tmp.Open;
KmLength1 := AdoQry_Tmp.fieldbyname('KmLength1').AsInteger;
KmLength2 := AdoQry_Tmp.fieldbyname('KmLength1').AsInteger+AdoQry_Tmp.fieldbyname('KmLength2').AsInteger;
KmLength3 := KmLength2+AdoQry_Tmp.fieldbyname('KmLength3').AsInteger;
KmLength4 := KmLength3+AdoQry_Tmp.fieldbyname('KmLength4').AsInteger;
KmLength5 := KmLength4+AdoQry_Tmp.fieldbyname('KmLength5').AsInteger;
KmLength6 := KmLength5+AdoQry_Tmp.fieldbyname('KmLength6').AsInteger;
if Length(var_KmCode)=KmLength1 then
Result:=1
else
if Length(var_KmCode)=KmLength2 then
begin
Tmp_KmCode := Copy(var_KmCode,1,KmLength1);
SQlText:='Select KmCode From Gl_AccountSubject Where KmCode='''+Tmp_KmCode+''' ';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := SqlText;
AdoQry_Tmp.Open;
if AdoQry_Tmp.Eof then
begin
DispInfo('请输入一级会计科目!',1);
Edt_KmCode.SetFocus;
Abort;
end
else
Result := 2;
end
else
if Length(var_KmCode)=KmLength3 then
begin
Tmp_KmCode := Copy(var_KmCode,1,KmLength2);
SQlText:='Select KmCode From Gl_AccountSubject Where KmCode='''+Tmp_KmCode+''' ';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := SqlText;
AdoQry_Tmp.Open;
if AdoQry_Tmp.Eof then
begin
DispInfo('请输入二级会计科目!',1);
Edt_KmCode.SetFocus;
Abort;
end
else
Result := 3;
end
else
if Length(var_KmCode)=KmLength4 then
begin
Tmp_KmCode := Copy(var_KmCode,1,KmLength3);
SQlText:='Select KmCode From Gl_AccountSubject Where KmCode='''+Tmp_KmCode+''' ';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := SqlText;
AdoQry_Tmp.Open;
if AdoQry_Tmp.Eof then
begin
DispInfo('请输入三级会计科目!',1);
Edt_KmCode.SetFocus;
Abort;
end
else
Result := 4;
end
else
if Length(var_KmCode)=KmLength5 then
begin
Tmp_KmCode := Copy(var_KmCode,1,KmLength4);
SQlText:='Select KmCode From Gl_AccountSubject Where KmCode='''+Tmp_KmCode+''' ';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := SqlText;
AdoQry_Tmp.Open;
if AdoQry_Tmp.Eof then
begin
DispInfo('请输入四级会计科目!',1);
Edt_KmCode.SetFocus;
Abort;
end
else
Result := 5;
end
else
if Length(var_KmCode)=KmLength6 then
begin
Tmp_KmCode := Copy(var_KmCode,1,KmLength5);
SQlText:='Select KmCode From Gl_AccountSubject Where KmCode='''+Tmp_KmCode+''' ';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := SqlText;
AdoQry_Tmp.Open;
if AdoQry_Tmp.Eof then
begin
DispInfo('请输入五级会计科目!',1);
Edt_KmCode.SetFocus;
Abort;
end
else
Result := 6;
end
else
begin
DispInfo('科目长度输入错误!',1);
Edt_KmCode.SetFocus;
Abort;
end ;
end;
end;
end
else
begin
DispInfo('科目代码不能为空!',1);
Edt_KmCode.SetFocus;
Abort;
end;
end;
function TFrm_Gl_Enter_AccountSubject_D.ModifyendKm(var_KmCode: String):Boolean;
var
SqlText,Tmp_KmCode:String;
KmLength1,KmLength2,KmLength3,KmLength4,KmLength5,KmLength6,endKm:Integer;
begin
SQlText:=' Select * From Gl_AccountParam ';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := SqlText;
AdoQry_Tmp.Open;
KmLength1 := AdoQry_Tmp.fieldbyname('KmLength1').AsInteger;
KmLength2 := AdoQry_Tmp.fieldbyname('KmLength1').AsInteger+AdoQry_Tmp.fieldbyname('KmLength2').AsInteger;
KmLength3 := KmLength2+AdoQry_Tmp.fieldbyname('KmLength3').AsInteger;
KmLength4 := KmLength3+AdoQry_Tmp.fieldbyname('KmLength4').AsInteger;
KmLength5 := KmLength4+AdoQry_Tmp.fieldbyname('KmLength5').AsInteger;
KmLength6 := KmLength5+AdoQry_Tmp.fieldbyname('KmLength6').AsInteger;
if Length(var_KmCode)=KmLength1 then
begin
{try
SQlText:='UpDate Gl_AccountSubject Set endKm=0 Where KmCode='''+var_KmCode+''' ';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := SqlText;
AdoQry_Tmp.ExecSQL ;}
Result:=True;
{ except
Result:=False;
end;}
end
else
if Length(var_KmCode)=KmLength2 then
begin
try
Tmp_KmCode := Copy(var_KmCode,1,3);
SQlText:='UpDate Gl_AccountSubject Set endKm=0 Where KmCode='''+Tmp_KmCode+''' ';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := SqlText;
AdoQry_Tmp.ExecSQL ;
Result:=True;
except
Result:=False;
end;
end
else
if Length(var_KmCode)=KmLength3 then
begin
Try
Tmp_KmCode := Copy(var_KmCode,1,KmLength2);
SQlText:='UpDate Gl_AccountSubject Set endKm=0 Where KmCode='''+Tmp_KmCode+''' ';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := SqlText;
AdoQry_Tmp.ExecSQL;
Result:=True;
except
Result:=False;
end;
end
else
if Length(var_KmCode)=KmLength4 then
begin
Try
Tmp_KmCode := Copy(var_KmCode,1,KmLength3);
SQlText:='UpDate Gl_AccountSubject Set endKm=0 Where KmCode='''+Tmp_KmCode+''' ';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := SqlText;
AdoQry_Tmp.ExecSQL;
Result:=True;
except
Result:=False;
end;
end
else
if Length(var_KmCode)=KmLength5 then
begin
try
Tmp_KmCode := Copy(var_KmCode,1,KmLength4);
SQlText:='UpDate Gl_AccountSubject Set endKm=0 Where KmCode='''+Tmp_KmCode+''' ';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := SqlText;
AdoQry_Tmp.ExecSQL;
Result:=True;
except
Result:=False;
end;
end
else
if Length(var_KmCode)=KmLength6 then
begin
try
Tmp_KmCode := Copy(var_KmCode,1,KmLength5);
SQlText:='UpDate Gl_AccountSubject Set endKm=0 Where KmCode='''+Tmp_KmCode+''' ';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := SqlText;
AdoQry_Tmp.ExecSQL;
Result:=True;
except
Result:=False;
end;
end;
end;
procedure TFrm_Gl_Enter_AccountSubject_D.Edt_KmCodeExit(Sender: TObject);
begin
inherited;
if(ActiveControl.Name='btn_Cancel')then
Abort;
try
StrToInt64(TCustomEdit(Sender).Text);
except
DispInfo(' 数值非法! ',1);
TWinControl(Sender).SetFocus;
Abort;
end;
end;
procedure TFrm_Gl_Enter_AccountSubject_D.Cmb_KmTypeExit(Sender: TObject);
begin
inherited;
{ case Cmb_KmType.ItemIndex of
1:
Cmb_KmProperty.ItemIndex:=1;
2:
Cmb_KmProperty.ItemIndex:=2;
3:
Cmb_KmProperty.ItemIndex:=2;
4:
Cmb_KmProperty.ItemIndex:=1;
5:
Cmb_KmProperty.ItemIndex:=1;
end; }
end;
procedure TFrm_Gl_Enter_AccountSubject_D.SetParentKm(km: string;
Level: integer);
var
i,l:integer;
s: string;
begin
l:=length(km);
ExecuteSql(AdoQry_tmp,'select * from Gl_AccountParam', 0);
i:=AdoQry_tmp.fieldbyname('kmlength'+inttostr(Level)).asinteger;
s:='update Gl_AccountSubject set endkm=0 where kmCode='+QuotedStr(copy(km,1,l-i));
ExecuteSql(AdoQry_tmp,s, 1);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -