NexusSmallErp : CommandRuncreedit

CREATE PROCEDURE Command Run_cre_edit_
— Pan Shin
@p1 int, @p2 int, @p3 int
AS
--print 'CommandRun_cre_edit_'

declare
@No varchar(128),
@Name varchar(128),
@Pr Key varchar(255),
@str varchar(128),
@Num int,
@iRet int,
@special int

— Docs fields

select @Name = (select String Value from Detailed where u=@@spid and UDN=@p1 and Value Id='Name')
select @No = (select String Value from Detailed where u=@@spid and UDN=@p1 and Value Id='No')

exec @iRet=Get Doc Num_ Numerator @p2, @No output, @Num output
if @iRet != 0 select @No=

if @Name= or @Name is null
begin
select @str='Имя указателя отчета отсутствует!!!'
print @str
select @Name='Указ.отчета c N ' + @No
end

update Docs set Name=@Name, No=@No, Date=getdate() where UDN=@p2

select @Pr Key = (select String Value from Detailed where u=@@spid and UDN=@p1 and Value Id='PrKey')

— Здесь место для различных проверок
-->>>

— Заполнение основной таблицы и 

insert into TCT_CommandRun values( @Pr Key, 0, @p2)
GO