📄 gl_enter_accountparam.pas
字号:
unit Gl_Enter_AccountParam;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Condition, Db, AdODB, StdCtrls, linkedit, ComCtrls, Mask, Grids,
DBGridEh;
Type
TFrm_Gl_Enter_AccountParam = Class(TFrm_Base_Condition)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
Edt_KmLength6: TEdit;
Label9: TLabel;
Label7: TLabel;
Edt_KmLength4: TEdit;
Edt_KmLength2: TEdit;
Label10: TLabel;
Label4: TLabel;
Edt_AccountKmLength: TEdit;
Edt_AccountUseYear: TEdit;
Label3: TLabel;
Label2: TLabel;
Edt_AccountYearStArMonth: TEdit;
Label13: TLabel;
Edt_AccountYearStArDate: TEdit;
Edt_AccountUseMonth: TEdit;
Label12: TLabel;
Label14: TLabel;
Label11: TLabel;
Label5: TLabel;
Label6: TLabel;
Label8: TLabel;
Edt_KmLength5: TEdit;
Edt_KmLength3: TEdit;
Edt_KmLength1: TEdit;
Label1: TLabel;
Edt_AccountCurrecyCode: TLinkEdit;
Edt_AccountCurrecyName: TEdit;
Label16: TLabel;
Label15: TLabel;
Cmb_EnterpriseType: TComboBox;
Cmb_CredenceType: TComboBox;
TabSheet2: TTabSheet;
Label17: TLabel;
medt_PeriodCounts: TMaskEdit;
DBGridEh1: TDBGridEh;
AdoQry_tmp2: TAdoQuery;
AdoQry_tmp2AccountPeriodYear: TIntegerField;
AdoQry_tmp2AccountPeriodMonth: TIntegerField;
AdoQry_tmp2CurrentPeriod: TIntegerField;
AdoQry_tmp2FreezeMonth: TIntegerField;
DataSource1: TDataSource;
Label18: TLabel;
Cmb_ProduceCrendentNoWay: TComboBox;
Label19: TLabel;
Cmb_SysProduceCrendentNoWay: TComboBox;
procedure btn_okClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure btn_CancelClick(Sender: TObject);
procedure Edt_AccountCurrecyCodeExit(Sender: TObject);
procedure Edt_AccountCurrecyCodeChange(Sender: TObject);
procedure Cmb_CredenceTypeChange(Sender: TObject);
procedure Cmb_EnterpriseTypeChange(Sender: TObject);
procedure medt_PeriodCountSChange(Sender: TObject);
private
FReadOnly:Boolean;
DbConnect: TAdoConnection;
{ Private declarations }
public
procedure InitForm(AdoConnection:TAdoConnection;ReadOnly:Boolean);
{ Public declarations }
end;
var
Frm_Gl_Enter_AccountParam: TFrm_Gl_Enter_AccountParam;
implementation
uses Sys_Global;
{$R *.DFM}
{ TFrm_Gl_Enter_AccountParam }
procedure TFrm_Gl_Enter_AccountParam.InitForm(AdoConnection: TAdoConnection;
ReadOnly: Boolean);
var
CurrencyCode,currencyName:String;
i:integer;
begin
FReadOnly := ReadOnly;
Btn_OK.enabled:=False;
if FReadOnly = False then
Frm_Gl_Enter_AccountParam.Caption := '帐套参数-[修改]'
else
Frm_Gl_Enter_AccountParam.Caption := '帐套参数-[查询]';
AdoQry_Tmp.Connection := AdoConnection;
DbConnect := AdoConnection;
AdoQry_tmp2.Connection:=dbconnect;
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := ' Select * From Gl_AccountParam ';
AdoQry_Tmp.Open;
if AdoQry_Tmp.recordCount=0 then
begin
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := ' Select Top 1 CurrencyCode,currencyName From Currency where IsMaster=1';
AdoQry_Tmp.Open;
if AdoQry_Tmp.Eof then
begin
DispInfo('请先设定主控货币!',1);
Abort;
end
else
begin
CurrencyCode := AdoQry_tmp.fieldbyname('CurrencyCode').AsString;
currencyName := AdoQry_tmp.fieldbyname('currencyName').asstring;
end;
Cmb_EnterpriseType.ItemIndex :=1;
Cmb_CredenceType.ItemIndex := 2;
Edt_AccountCurrecyCode.Text := currencyCode;
Edt_AccountCurrecyName.Text := currencyName;
Edt_AccountKmLength.Text := '6';
Edt_KmLength1.Text := '3';
Edt_KmLength2.Text := '2';
Edt_KmLength3.Text := '2';
Edt_KmLength4.Text := '2';
Edt_KmLength5.Text := '2';
Edt_KmLength6.Text := '2';
Edt_AccountYearStArDate.Text := '1';
Edt_AccountYearStArMonth.Text := '1';
Edt_AccountUseYear.Text := formatdatetime('yyyy',now);
Edt_AccountUseMonth.Text := formatdatetime('mm',now);
medt_PeriodCounts.Text:='12';
AdoQry_tmp2.Close;
AdoQry_tmp2.Open;
Cmb_EnterpriseType.SetFocus ;
exit;
{ AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := ' insert Gl_AccountParam (AccountCurrecyCode) Values('''+CurrencyCode+''') ';
AdoQry_Tmp.ExecSQL; }
end;
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := ' Select Top 1 CurrencyCode,currencyName From Currency where IsMaster=1';
AdoQry_Tmp.Open;
Edt_AccountCurrecyCode.Text := AdoQry_Tmp.fieldbyname('CurrencyCode').AsString;
Edt_AccountCurrecyName.Text := AdoQry_Tmp.fieldbyname('CurrencyName').AsString;
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := ' Select Gl_AccountParam.* From Gl_AccountParam ';
AdoQry_Tmp.Open;
With AdoQry_Tmp do
begin
Cmb_EnterpriseType.ItemIndex := fieldbyname('EnterpriseType').AsInteger;
Cmb_CredenceType.ItemIndex := fieldbyname('CredenceType').AsInteger;
Cmb_ProduceCrendentNoWay.ItemIndex := fieldbyname('ProduceCrendentNoWay').AsInteger;
Cmb_SysProduceCrendentNoWay.ItemIndex := fieldbyname('SysProduceCrendentNoWay').AsInteger;
Edt_AccountKmLength.Text := fieldbyname('AccountKmLength').AsString;
Edt_KmLength1.Text := fieldbyname('KmLength1').AsString;
Edt_KmLength2.Text := fieldbyname('KmLength2').AsString;
Edt_KmLength3.Text := fieldbyname('KmLength3').AsString;
Edt_KmLength4.Text := fieldbyname('KmLength4').AsString;
Edt_KmLength5.Text := fieldbyname('KmLength5').AsString;
Edt_KmLength6.Text := fieldbyname('KmLength6').AsString;
Edt_AccountYearStArDate.Text := fieldbyname('AccountYearStArDate').AsString;
Edt_AccountYearStArMonth.Text := fieldbyname('AccountYearStArMonth').AsString;
Edt_AccountUseYear.Text := fieldbyname('AccountUseYear').AsString;
Edt_AccountUseMonth.Text := fieldbyname('AccountUseMonth').AsString;
medt_PeriodCounts.Text:=inttostr(fieldbyname('AccountperiodAmount').asinteger);
end;
AdoQry_tmp2.Close;
AdoQry_tmp2.Open;
Cmb_EnterpriseType.SetFocus ;
for i:=0 to tabSheet1.ControlCount-1 do
begin
if not (tabSheet1.Controls[i] is Tlabel) then
tabSheet1.Controls[i].Enabled:=False;
end;
for i:=0 to tabSheet2.ControlCount-1 do
begin
if not ((tabSheet2.Controls[i] is Tlabel ) or(tabSheet2.Controls[i] is Tdbgrideh )) then
tabSheet2.Controls[i].Enabled:=False;
end;
btn_ok.Enabled:=False;
end;
procedure TFrm_Gl_Enter_AccountParam.btn_okClick(Sender: TObject);
var
SqlText:String;
periodCount,i:integer;
begin
if Cmb_EnterpriseType.ItemIndex < 1 then
begin
DispInfo('企业所属行业错误,请重新选择!',1);
Cmb_EnterpriseType.SetFocus ;
Abort;
end;
if Cmb_CredenceType.ItemIndex < 1 then
begin
DispInfo('凭证类型错误,请重新选择!',1);
Cmb_CredenceType.SetFocus ;
Abort;
end;
case Cmb_EnterpriseType.ItemIndex of
1:begin
if StrToInt(Edt_KmLength1.Text) < 4 then
begin
DispInfo('''企业所属行业''为 ''工业企业'' 一级科目长度应大于3!',1);
Edt_KmLength1.SetFocus ;
Abort;
end;
end ;
2:begin
if StrToInt(Edt_KmLength1.Text) <> 4 then
begin
DispInfo('''企业所属行业''为 ''股份有限公司'' 一级科目长度应为4!',1);
Edt_KmLength1.SetFocus ;
Abort;
end;
end ;
3:begin
if StrToInt(Edt_KmLength1.Text) <> 4 then
begin
DispInfo('''企业所属行业''为 ''外商投资企业'' 一级科目长度应为4!',1);
Edt_KmLength1.SetFocus ;
Abort;
end;
end ;
4:begin
if StrToInt(Edt_KmLength1.Text) < 4 then
begin
DispInfo('''企业所属行业''为 ''对外经济合作企业'' 一级科目长度应大于3!',1);
Edt_KmLength1.SetFocus ;
Abort;
end;
end ;
end;
if (StrToInt(Edt_AccountKmLength.Text)>6) or (StrToInt(Edt_AccountKmLength.Text)<2) then
begin
DispInfo('会计科目级数应大于等于2小于等于6',1);
Edt_AccountKmLength.SetFocus;
Abort;
end;
if not ((StrToInt(Edt_KmLength1.text)=3) or (StrToInt(Edt_KmLength1.text)=4)) then
begin
DispInfo('一级会计科目长度应为3或4',1);
Edt_KmLength1.SetFocus;
Abort;
end;
case StrToInt(Edt_AccountKmLength.Text) of
2:begin
if StrToInt(Edt_KmLength2.text)<=0 then
begin
DispInfo('二级会计科目长度应大于零!',1);
Edt_KmLength2.SetFocus;
Abort;
end;
if StrToInt(Edt_KmLength3.text)<>0 then
begin
DispInfo('三级会计科目长度应等于零!',1);
Edt_KmLength3.SetFocus;
Abort;
end;
if StrToInt(Edt_KmLength4.text)<>0 then
begin
DispInfo('四级会计科目长度应等于零!',1);
Edt_KmLength4.SetFocus;
Abort;
end;
if StrToInt(Edt_KmLength5.text)<>0 then
begin
DispInfo('五级会计科目长度应等于零!',1);
Edt_KmLength5.SetFocus;
Abort;
end;
if StrToInt(Edt_KmLength6.text)<>0 then
begin
DispInfo('六级会计科目长度应等于零!',1);
Edt_KmLength6.SetFocus;
Abort;
end;
end;
3:begin
if StrToInt(Edt_KmLength2.text)<=0 then
begin
DispInfo('二级会计科目长度应大于零!',1);
Edt_KmLength2.SetFocus;
Abort;
end;
if StrToInt(Edt_KmLength3.text)<=0 then
begin
DispInfo('三级会计科目长度应大于零!',1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -