【问题描述】
在T1飞跃专业版软件中,
操作添加现金银行信息时提示:该父类账户信息有财务数据,不能分级。
【解决方法】
该问题是原因是因为T1和U+通用财务联用。
Ps:留一下软件版本【飞跃19.5+财务15.0.2.5】
针对账套库执行下属语句:
--检查基本信息删除的时候当前ID是否已经使用了
IF EXISTS (SELECT * FROM DBO.SYSOBJECTS WHERE ID = OBJECT_ID(N'[DBO].[F_CMB_CheckHasUseBaseInfo]') AND XTYPE IN (N'FN', N'IF', N'TF'))
BEGIN
drop function [dbo].[F_CMB_CheckHasUseBaseInfo]
END
GO
CREATE FUNCTION [dbo].[F_CMB_CheckHasUseBaseInfo] ( @TableName nvarchar(100),@s_ID int)
RETURNS int
AS
BEGIN
declare @HaseUse int
set @HaseUse=-1
if @s_ID>0
begin
--往来单位 部门 职员 商品 基本单位
if Upper(@TableName)=Upper('Units')
begin
if exists(select Top 1 1 from T_Accounts_AssinTotal where C_ID=@s_ID or S_ID=@s_ID)
begin
set @HaseUse=1
RETURN @HaseUse
end
if exists(select Top 1 1 from T_Voucher_TallyVoucherDetail where AccountingSupplierID=@s_ID or AccountingClientID=@s_ID)
begin
set @HaseUse=1
RETURN @HaseUse
end
if exists(select Top 1 1 from T_PPE_CardTable where isnull(Unit_ID,0)=@s_ID or isnull(SCUnit_ID,0)=@s_ID)
begin
set @HaseUse=1
RETURN @HaseUse
end
if exists(select Top 1 1 from T_Asstes_DealWithDetail where isnull(DFUnitID,0)=@s_ID)
begin
set @HaseUse=1
RETURN @HaseUse
end
if exists(select Top 1 1 from T_CN_CashBankDayAccounting where isnull(DFUnitID,0)=@s_ID)
begin
set @HaseUse=1
RETURN @HaseUse
end
if exists(select Top 1 1 from T_CN_BankStatement where isnull(DFUnitID,0)=@s_ID )
begin
set @HaseUse=1
RETURN @HaseUse
end
end
else if Upper(@TableName)=Upper('Employee')
begin
if exists(select Top 1 1 from T_Accounts_AssinTotal where E_ID=@s_ID )
begin
set @HaseUse=2
RETURN @HaseUse
end
if exists(select Top 1 1 from T_Voucher_TallyVoucherDetail where AccountingEmployeeID=@s_ID)
begin
set @HaseUse=2
RETURN @HaseUse
end
if exists(select Top 1 1 from T_Voucher_TallyVoucher where Tally_ID=@s_ID or Audit_ID=@s_ID or CNEmpID=@s_ID)
begin
set @HaseUse=2
RETURN @HaseUse
end
if exists(select Top 1 1 from T_PPE_CardTable where UseEmpID=@s_ID)
begin
set @HaseUse=2
RETURN @HaseUse
end
if exists(select Top 1 1 from T_CMBUsers where Emp_ID=@s_ID and s_Syb>=0)
begin
set @HaseUse=2
RETURN @HaseUse
end
if exists(select Top 1 1 from T_Asstes_ChangeDetail where isnull(oldUseEmpID,0)=@s_ID or isnull(NewUseEmpID,0)=@s_ID )
begin
set @HaseUse=2
RETURN @HaseUse
end
if exists(select Top 1 1 from T_Asstes_MakeAnInventoryOfUIDetail where isnull(UseEmpID,0)=@s_ID)
begin
set @HaseUse=2
RETURN @HaseUse
end
if exists(select Top 1 1 from T_CN_CashBankDayAccounting where isnull(EmpID,0)=@s_ID)
begin
set @HaseUse=2
RETURN @HaseUse
end
if exists(select Top 1 1 from T_CN_BankAccessBill where isnull(Oper_ID,0)=@s_ID or isnull(EmpID,0)=@s_ID or isnull(Audit_ID,0)=@s_ID)
begin
set @HaseUse=2
RETURN @HaseUse
end
if exists(select Top 1 1 from T_CN_CashInventoryBill where isnull(PDEmp_ID,0)=@s_ID or isnull(Audit_ID,0)=@s_ID)
begin
set @HaseUse=2
RETURN @HaseUse
end
if exists(select Top 1 1 from T_CN_ChequeBook where isnull(purchaseEmpID,0)=@s_ID or isnull(CreateEmpID,0)=@s_ID)
begin
set @HaseUse=2
RETURN @HaseUse
end
end
else if Upper(@TableName)=Upper('Department')
begin
if exists(select Top 1 1 from T_Accounts_AssinTotal where D_ID=@s_ID )
begin
set @HaseUse=3
RETURN @HaseUse
end
if exists(select Top 1 1 from T_Voucher_TallyVoucherDetail where AccountingDepartmentID=@s_ID)
begin
set @HaseUse=3
RETURN @HaseUse
end
if exists(select Top 1 1 from T_PPE_CardTable where UseDeptID=@s_ID)
begin
set @HaseUse=3
RETURN @HaseUse
end
if exists(select Top 1 1 from T_PPE_CardMultDept where DeptID=@s_ID)
begin
set @HaseUse=3
RETURN @HaseUse
end
if exists(select Top 1 1 from T_Asstes_ChangeMultipleDept where DeptID=@s_ID)
begin
set @HaseUse=3
RETURN @HaseUse
end
if exists(select Top 1 1 from T_Asstes_ChangeDetail where isnull(OldUseDeptiD,0)=@s_ID or isnull(NewUseDeptID,0)=@s_ID or isnull(NewManageDeptID,0)=@s_ID or isnull(OldManageDeptID,0)=@s_ID)
begin
set @HaseUse=3
RETURN @HaseUse
end
if exists(select Top 1 1 from T_Asstes_MakeAnInventoryOfUIDetail where isnull(UseDeptID,0)=@s_ID or isnull(MangeDeptID,0)=@s_ID)
begin
set @HaseUse=3
RETURN @HaseUse
end
if exists(select Top 1 1 from T_CN_CashBankDayAccounting where isnull(DeptID,0)=@s_ID or isnull(DFDeptID,0)=@s_ID)
begin
set @HaseUse=3
RETURN @HaseUse
end
if exists(select Top 1 1 from T_CN_BankAccessBill where isnull(InDeptID,0)=@s_ID or isnull(outDeptID,0)=@s_ID)
begin
set @HaseUse=3
RETURN @HaseUse
end
if exists(select Top 1 1 from T_CN_ChequeBook where isnull(purchaseDeptID,0)=@s_ID)
begin
set @HaseUse=3
RETURN @HaseUse
end
if exists(select Top 1 1 from MoneyAccount where isnull(CNuseDeptID,0)=@s_ID)
begin
set @HaseUse=3
RETURN @HaseUse
end
end
else if Upper(@TableName)=Upper('Product')
begin
if exists(select Top 1 1 from T_Accounts_AssinTotal where Goods_ID=@s_ID )
begin
set @HaseUse=4
RETURN @HaseUse
end
if exists(select Top 1 1 from T_Voucher_TallyVoucherDetail where AccountingGoodsID=@s_ID)
begin
set @HaseUse=4
RETURN @HaseUse
end
end
else if Upper(@TableName)=Upper('CommonInfo') or Upper(@TableName)=Upper('T_ProductUnit')
begin
if exists(select Top 1 1 from T_Accounts_Use where ProdDWID=@s_ID and isnull(ProdDWID,0)>0)
begin
set @HaseUse=5
RETURN @HaseUse
end
if exists(select Top 1 1 from T_PPE_CardTable where JLDWID=@s_ID and isnull(JLDWID,0)>0)
begin
set @HaseUse=5
RETURN @HaseUse
end
end
else if Upper(@TableName)=Upper('MoneyAccount')
begin
if exists(select Top 1 1 from T_CN_CashBankDayAccounting where isnull(Act_ID,0)=@s_ID or isnull(DFActID,0)=@s_ID or isnull(InComActID,0)=@s_ID or isnull(CostActID,0)=@s_ID)
begin
set @HaseUse=6
RETURN @HaseUse
end
if exists(select Top 1 1 from T_CN_IniCashBankBalance where isnull(Act_ID,0)=@s_ID )
begin
set @HaseUse=6
RETURN @HaseUse
end
if exists(select Top 1 1 from T_CN_BankStatement where isnull(Act_ID,0)=@s_ID )
begin
set @HaseUse=6
RETURN @HaseUse
end
if exists(select Top 1 1 from T_CN_BankAccessBill where isnull(OutActID,0)=@s_ID or isnull(InActID,0)=@s_ID)
begin
set @HaseUse=6
RETURN @HaseUse
end
if exists(select Top 1 1 from T_CN_CashInventoryBill where isnull(ActID,0)=@s_ID)
begin
set @HaseUse=6
RETURN @HaseUse
end
if exists(select Top 1 1 from T_CN_ChequeBook where isnull(Act_ID,0)=@s_ID)
begin
set @HaseUse=6
RETURN @HaseUse
END
--IF exists(SELECT 1 FROM T_Account_VoucherID WHERE AccID = @s_ID AND isnull(AccID_Account,0)>0)
IF Exists(SELECT 1 FROM T_Account_VoucherID v
INNER JOIN dbo.MoneyAccount m ON v.AccID=m.s_ID
WHERE v.AccID = @s_ID and ISNULL(v.AccID_Account,0)>0 AND m.s_SonCount=0)
BEGIN
set @HaseUse=6
RETURN @HaseUse
END
end
else if Upper(@TableName)=Upper('T_CN_CurrencyType')
begin
if exists(select Top 1 1 from MoneyAccount where s_Syb>=0 and isnull(CNCurrencyTypeID,0)=@s_ID)
begin
set @HaseUse=7
RETURN @HaseUse
end
if exists(select Top 1 1 from T_Accounts_AssinTotal where isnull(CurrencyTypeID,0)=@s_ID)
begin
set @HaseUse=7
RETURN @HaseUse
end
if exists(select Top 1 1 from T_VOucher_TallyVoucherDetail where isnull(CurrencyTypeID,0)=@s_ID)
begin
set @HaseUse=7
RETURN @HaseUse
end
end
end
RETURN @HaseUse
END
GO