📄 sys500_01.pas.svn-base
字号:
end;
//修改上级程序
ATreeNode:=TreeView1.Selected;
if (qrySys500BS500B_004.Value) or (qrySys500BS500B_005.Value) or
(qrySys500BS500B_006.Value) or (qrySys500BS500B_007.Value) or
(qrySys500BS500B_008.Value) or (qrySys500BS500B_009.Value) or
(qrySys500BS500B_010.Value) then
begin
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('update SYS500B set S500B_004='+GetBoolean(True)+' where S500B_001='+qrySys500AS500A_001.AsString+' and S500B_002='+qrySys500DS500D_011.AsString);
SYSDM.qryQuery.ExecSQL;
while ATreeNode.Parent<>nil do
begin
AParentNo:=GetValue('select top 1 S500D_011 from SYS500D where S500D_001='+''''+TreeView1.GetParentField.Value+'''');
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('update SYS500B set S500B_004='+GetBoolean(True)+' where S500B_001='+qrySys500AS500A_001.AsString+' and S500B_002='+IntToStr(AParentNo));
try
SYSDM.qryQuery.ExecSQL;
except
ShowMsg(SYSDM.ADOC.Errors[0].Description+#13+SYSDM.qryQuery.SQL.Text,1);
Abort;
end;
ATreeNode:=TreeView1.Selected.Parent;
end;
end else
begin
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('update SYS500B set S500B_004=0 where S500B_001='+qrySys500AS500A_001.AsString+' and S500B_002='+qrySys500DS500D_011.AsString);
SYSDM.qryQuery.ExecSQL;
while ATreeNode.Parent<>nil do
begin
AParentNo:=GetValue('select top 1 S500D_011 from SYS500D where S500D_001='+''''+TreeView1.GetParentField.Value+'''');
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('update SYS500B set S500B_004=0 where S500B_001='+qrySys500AS500A_001.AsString+' and S500B_002='+IntToStr(AParentNo));
try
SYSDM.qryQuery.ExecSQL;
except
ShowMsg(SYSDM.ADOC.Errors[0].Description+#13+SYSDM.qryQuery.SQL.Text,1);
Abort;
end;
ATreeNode:=TreeView1.Selected.Parent;
end;
end;
end;
//设置按钮状态
procedure TSys500_01Form.SetButtonState(AInsUpd:Boolean);
var
I:Integer;
begin
ActFirst.Enabled:=not AInsUpd;
ActPrior.Enabled:=not AInsUpd;
ActNext.Enabled:=not AInsUpd;
ActLast.Enabled:=not AInsUpd;
ActInsert.Enabled:=not AInsUpd;
ActUpdate.Enabled:=not AInsUpd;
ActDelete.Enabled:=not AInsUpd;
ActCopy.Enabled:=not AInsUpd;
ActRefresh.Enabled:=not AInsUpd;
ActLocate.Enabled:=not AInsUpd;
ActSearch.Enabled:=not AInsUpd;
ActExit.Enabled:=True;
for I:=0 to PageControl1.PageCount-1 do PageControl1.Pages[I].Enabled:=not AInsUpd;
Panel1.Enabled:=AInsUpd;
TreeView1.Enabled:=not AInsUpd;
end;
procedure TSys500_01Form.SetInterface;
begin
Font.Name:=AFontName;
Image1.Picture.Bitmap.LoadFromResourceName(AImgHandle,'TOPTITL');
Caption:=GetDBString('SYS50001001'); //用户权限管理
ActFirst.Caption:=GetDBString('COM00005001'); //最前
ActPrior.Caption:=GetDBString('COM00005002'); //上移
ActNext.Caption:=GetDBString('COM00005003'); //下移
ActLast.Caption:=GetDBString('COM00005004'); //最后
ActInsert.Caption:=GetDBString('COM00005005'); //新增
ActUpdate.Caption:=GetDBString('COM00005006'); //修改
ActDelete.Caption:=GetDBString('COM00005007'); //删除
ActRefresh.Caption:=GetDBString('COM00005010'); //刷新
ActLocate.Caption:=GetDBString('COM00005011'); //查找
ActSearch.Caption:=GetDBString('COM00005012'); //查询
ActExit.Caption:=GetDBString('COM00005015'); //退出
ActCopy.Caption:=GetDBString('SYS50001002'); //复制
lblUser.Caption:=GetDBString('SYS50001003'); //用户名称
tsProgram.Caption:=GetDBString('SYS50001007'); //程序权限
tsCsh.Caption:=GetDBString('SYS50001025'); //帐户权限
tsDept.Caption:=GetDBString('SYS50001008'); //部门权限
tsWhs.Caption:=GetDBString('SYS50001009'); //仓库权限
tsWht.Caption:=GetDBString('SYS50001011'); //库存操作
tsItem.Caption:=GetDBString('SYS50001010'); //物料权限
tsCust.Caption:=GetDBString('SYS50001012'); //客户权限
tsAccount.Caption:=GetDBString('SYS50001013'); //科目权限
qrySys500AS500A_002.DisplayLabel:=GetDBString('SYS50001003'); //用户名称
qrySys500BS500D_007.DisplayLabel:=GetDBString('SYS50001014'); //程序名称
qrySys500BS500B_004.DisplayLabel:=GetDBString('SYS50001015'); //查看权限
qrySys500BS500B_005.DisplayLabel:=GetDBString('SYS50001016'); //新增权限
qrySys500BS500B_006.DisplayLabel:=GetDBString('SYS50001017'); //修改权限
qrySys500BS500B_007.DisplayLabel:=GetDBString('SYS50001018'); //删除权限
qrySys500BS500B_008.DisplayLabel:=GetDBString('SYS50001019'); //打印权限
qrySys500BS500B_009.DisplayLabel:=GetDBString('SYS50001020'); //查看成本
qrySys500BS500B_010.DisplayLabel:=GetDBString('SYS50001021'); //审核权限
qryCsh550C550_002.DisplayLabel:=GetDBString('SYS50001026'); //帐户名称
qryCsh550S500C_004.DisplayLabel:=GetDBString('SYS50001023'); //操作权限
qryHrm100H100_002.DisplayLabel:=GetDBString('SYS50001022'); //部门名称
qryHrm100S500C_004.DisplayLabel:=GetDBString('SYS50001023'); //操作权限
qryInv100I100_002.DisplayLabel:=GetDBString('SYS50001027'); //仓库编号
qryInv100I100_003.DisplayLabel:=GetDBString('SYS50001028'); //仓库名称
qryInv100S500C_004.DisplayLabel:=GetDBString('SYS50001029'); //操作权限
qryInv550I550_002.DisplayLabel:=GetDBString('SYS50001030'); //类型编号
qryInv550I550_003.DisplayLabel:=GetDBString('SYS50001031'); //类型名称
qryInv550S500C_004.DisplayLabel:=GetDBString('SYS50001032'); //操作权限
qryInv120I120_002.DisplayLabel:=GetDBString('SYS50001033'); //分类编号
qryInv120I120_003.DisplayLabel:=GetDBString('SYS50001034'); //分类名称
qryInv120S500C_004.DisplayLabel:=GetDBString('SYS50001035'); //操作权限
qryOrd110O110_002.DisplayLabel:=GetDBString('SYS50001036'); //客户分类
qryOrd110S500C_004.DisplayLabel:=GetDBString('SYS50001037'); //操作权限
qryGld150G150_002.DisplayLabel:=GetDBString('SYS50001038'); //科目编号
qryGld150G150_004.DisplayLabel:=GetDBString('SYS50001039'); //科目名称
qryGld150S500C_004.DisplayLabel:=GetDBString('SYS50001040'); //操作权限
end;
//插入遗漏的权限数据到SYS500C
procedure InsertData;
begin
//帐户
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('insert into SYS500C(S500C_001,S500C_002,S500C_003,S500C_004)');
SYSDM.qryQuery.SQL.Add('select S500A_001,C550_001,''ACC'',0 from CSH550,SYS500A');
SYSDM.qryQuery.SQL.Add('where not exists(select 1 from SYS500C where S500C_001=S500A_001 and S500C_003=''ACC'' and S500C_002=C550_001)');
SYSDM.qryQuery.ExecSQL;
//部门
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('insert into SYS500C(S500C_001,S500C_002,S500C_003,S500C_004)');
SYSDM.qryQuery.SQL.Add('select S500A_001,H100_001,''DEP'',0 from HRM100,SYS500A');
SYSDM.qryQuery.SQL.Add('where not exists(select 1 from SYS500C where S500C_001=S500A_001 and S500C_003=''DEP'' and S500C_002=H100_001)');
SYSDM.qryQuery.ExecSQL;
//仓库
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('insert into SYS500C(S500C_001,S500C_002,S500C_003,S500C_004)');
SYSDM.qryQuery.SQL.Add('select S500A_001,I100_001,''WHS'',0 from SYS500A A,');
SYSDM.qryQuery.SQL.Add(' (select I100_001*-1 as I100_001,I100_002,I100_003,0 as FParent from INV100');
SYSDM.qryQuery.SQL.Add(' union');
SYSDM.qryQuery.SQL.Add(' select I110_001,I110_003,I110_004,I110_002*-1 from INV110) B');
SYSDM.qryQuery.SQL.Add('where not exists(select 1 from SYS500C where S500C_001=A.S500A_001 and S500C_003=''WHS'' and S500C_002=B.I100_001)');
SYSDM.qryQuery.ExecSQL;
//库存操作类型
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('insert into SYS500C(S500C_001,S500C_002,S500C_003,S500C_004)');
SYSDM.qryQuery.SQL.Add('select S500A_001,I550_001,''WHT'',0 from INV550,SYS500A');
SYSDM.qryQuery.SQL.Add('where not exists(select 1 from SYS500C where S500C_001=S500A_001 and S500C_003=''WHT'' and S500C_002=I550_001)');
SYSDM.qryQuery.ExecSQL;
//物料分类
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('insert into SYS500C(S500C_001,S500C_002,S500C_003,S500C_004)');
SYSDM.qryQuery.SQL.Add('select S500A_001,I120_001,''ICS'',0 from INV120,SYS500A');
SYSDM.qryQuery.SQL.Add('where not exists(select 1 from SYS500C where S500C_001=S500A_001 and S500C_003=''ICS'' and S500C_002=I120_001)');
SYSDM.qryQuery.ExecSQL;
//客户分类
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('insert into SYS500C(S500C_001,S500C_002,S500C_003,S500C_004)');
SYSDM.qryQuery.SQL.Add('select S500A_001,O110_001,''CUS'',0 from ORD110,SYS500A');
SYSDM.qryQuery.SQL.Add('where not exists(select 1 from SYS500C where S500C_001=S500A_001 and S500C_003=''CUS'' and S500C_002=O110_001)');
SYSDM.qryQuery.ExecSQL;
//会计科目
SYSDM.qryQuery.Close;
SYSDM.qryQuery.SQL.Clear;
SYSDM.qryQuery.SQL.Add('insert into SYS500C(S500C_001,S500C_002,S500C_003,S500C_004)');
SYSDM.qryQuery.SQL.Add('select S500A_001,G150_001,''GLD'',0 from GLD150,SYS500A');
SYSDM.qryQuery.SQL.Add('where not exists(select 1 from SYS500C where S500C_001=S500A_001 and S500C_003=''GLD'' and S500C_002=G150_001)');
SYSDM.qryQuery.ExecSQL;
end;
procedure TSys500_01Form.FormCreate(Sender: TObject);
begin
AProgramID:=copy(Name,1,6);
AReportName:=copy(Name,1,6)+'.frf';
PageControl1.ActivePageIndex:=0;
//插入遗漏的权限数据到SYS500C
InsertData;
qrySys500A.Open;
qrySys500D.Open;
if qrySys500D.RecordCount<=25 then TreeView1.FullExpand;
//设置界面信息
SetInterface;
SetButtonState(False);
qrySys500AAfterScroll(qrySys500A);
end;
procedure TSys500_01Form.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
qrySys500A.Close;
qrySys500D.Close;
qrySys500B.Close;
qryHrm100.Close;
qryInv100.Close;
Action:=caFree;
end;
procedure TSys500_01Form.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if ActiveControl is TdxDBGrid then Exit;
if ActiveControl is TDBMemo then Exit;
if Key in [vk_Return] then Perform(WM_NEXTDLGCTL, 0, 0);
if Key=VK_F1 then
HtmlHelp(Application.Handle, AHelpFile+'::/'+AProgramID+'.htm', $0000, nil);
end;
procedure TSys500_01Form.qrySys500DAfterScroll(DataSet: TDataSet);
begin
qrySys500B.Close;
qrySys500B.SQL.Clear;
qrySys500B.SQL.Add('select B.S500D_001, B.S500D_002, A.S500B_002, A.S500B_004, A.S500B_005, A.S500B_006, A.S500B_007, A.S500B_008, A.S500B_009, A.S500B_010');
qrySys500B.SQL.Add('from SYS500B A, SYS500D B');
qrySys500B.SQL.Add('where A.S500B_002=B.S500D_011 and B.S500D_006='+GetBoolean(True)+' and A.S500B_011<>''C'' and A.S500B_001='+qrySys500AS500A_001.AsString);
qrySys500B.SQL.Add(' and B.S500D_002='+''''+qrySys500DS500D_001.AsString+'''');
qrySys500B.SQL.Add('order by B.S500D_005,B.S500D_001');
qrySys500B.Open;
dbgProgram.Enabled:=not qrySys500B.IsEmpty;
end;
procedure TSys500_01Form.qrySys500AAfterScroll(DataSet: TDataSet);
begin
if qrySys500A.State in [dsInsert,dsEdit] then Exit;
if not qrySys500D.Active then qrySys500D.Open;
qrySys500DAfterScroll(qrySys500D);
//帐户权限
if tsCsh.TabVisible then
begin
qryCsh550.DisableControls;
qryCsh550.Close;
qryCsh550.Parameters[0].Value:=qrySys500AS500A_001.Value;
qryCsh550.Open;
qryCsh550.EnableControls;
dbgCsh.Enabled:=not qryCsh550.IsEmpty;
end;
//部门权限
if tsDept.TabVisible then
begin
qryHrm100.DisableControls;
qryHrm100.Close;
qryHrm100.Parameters[0].Value:=qrySys500AS500A_001.Value;
qryHrm100.Open;
qryHrm100.EnableControls;
dbgDept.Enabled:=not qryHrm100.IsEmpty;
end;
//仓库权限
if tsWhs.TabVisible then
begin
qryInv100.DisableControls;
qryInv100.Close;
qryInv100.Parameters[0].Value:=qrySys500AS500A_001.Value;
qryInv100.Open;
qryInv100.EnableControls;
dbgWhs.Enabled:=not qryInv100.IsEmpty;
end;
//库存操作权限
if tsWht.TabVisible then
begin
qryInv550.DisableControls;
qryInv550.Close;
qryInv550.Parameters[0].Value:=qrySys500AS500A_001.Value;
qryInv550.Open;
qryInv550.EnableControls;
dbgWht.Enabled:=not qryInv550.IsEmpty;
end;
//物料权限
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -