You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
215 lines
6.4 KiB
215 lines
6.4 KiB
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_edkb12]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
|
|
drop procedure [dbo].[sp_edkb12]
|
|
GO
|
|
|
|
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_edkb12_check]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
|
|
drop procedure [dbo].[sp_edkb12_check]
|
|
GO
|
|
|
|
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_edkb12_meldung]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
|
|
drop procedure [dbo].[sp_edkb12_meldung]
|
|
GO
|
|
|
|
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_edkb12_profil]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
|
|
drop procedure [dbo].[sp_edkb12_profil]
|
|
GO
|
|
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------------------------------
|
|
-- Name: sp_edkb12
|
|
-- Desc: Funktion abhängig vom Funktionscode:
|
|
-- 1: Lesen des ersten zu bearbeitenden Datensatzes aus EDK_Data
|
|
-- 2: Update des Status in EDK_Data
|
|
-- Status 1: In Bearbeitung
|
|
-- 2: Fehlerhaft
|
|
-- 3: Erfolgreich
|
|
--
|
|
-- Autor Stefan Hutter
|
|
--
|
|
-- Remarks: EDOKA Rel. 4.02
|
|
-- Version : 1.0 / 17.08.2008
|
|
---------------------------------------------------------------------------------------------------------
|
|
|
|
CREATE PROCEDURE [dbo].sp_edkb12
|
|
@fnkt int,
|
|
@rowid int=0,
|
|
@status int=0
|
|
AS
|
|
|
|
-- Status 0: EDK-Verarbeitung pendent
|
|
-- Status 1: Verarbeitung gestartet
|
|
-- Status 2: Verarbeitung fehlerhaft beendet
|
|
-- Status 3: Verarbeitung erfolgreich beendet
|
|
|
|
|
|
-- fnkt 1: Alle pendenten EDK-Dateien auslesen
|
|
-- fnkt 2: Statusmutation
|
|
|
|
if @fnkt=1 begin
|
|
select top 1 * from edk_data where status=0 order by insert_timestamp
|
|
return
|
|
end
|
|
|
|
if @fnkt=2 begin
|
|
update edk_data set status=@status, status_timestamp=getdate() where rowid=@rowid
|
|
return
|
|
end
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------------------------------
|
|
-- Name: sp_edkb12_check
|
|
-- Desc: Prüft in EDOKA, ob der Dokumenttyp für die Dokumenterstellung über EDKB12 gesetzt ist
|
|
--
|
|
-- Autor Stefan Hutter
|
|
--
|
|
-- Remarks: EDOKA Rel. 4.02
|
|
-- Version : 1.0 / 17.08.2008
|
|
---------------------------------------------------------------------------------------------------------
|
|
|
|
CREATE PROCEDURE [dbo].[sp_edkb12_check]
|
|
@idokumenttypnr int,
|
|
@odokumenttypnr int output
|
|
AS
|
|
declare @counter int
|
|
select @counter=count(*) from edk_data_doktype where dokumenttypnr=@idokumenttypnr - 900000000
|
|
set @odokumenttypnr=@counter
|
|
return
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------------------------------
|
|
-- Name: sp_edkb12_meldung
|
|
-- Desc: Meldungsversand aus EDKB12
|
|
-- Bei OK oder im Fehlerfall wird ein Mail an den Besteller und an den Sysadmin geschickt
|
|
--
|
|
-- !!!Meldung an den Sysadmin unten mit fixer Sysadmin-Nr konfigurieren!!!
|
|
-- set @sysadmin=... (Mitarbeiternr des Systemadministrators)
|
|
--
|
|
-- Status-Beschreibung:
|
|
-- 2 = Fehlermeldung
|
|
-- 3 = OK-Meldung
|
|
-- -1 = Fehlermeldung fü Sysadmin
|
|
--
|
|
-- Autor Stefan Hutter
|
|
--
|
|
-- Remarks: EDOKA Rel. 4.02
|
|
-- Version : 1.0 / 17.08.2008
|
|
---------------------------------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[sp_edkb12_meldung]
|
|
@status int,
|
|
@mitarbeiter int=0,
|
|
@betreff varchar(256),
|
|
@meldung varchar(1024),
|
|
@dokumentid varchar(22)
|
|
AS
|
|
---- Sysadmin setzen: Mitarbeiternummer des Systemadministrators
|
|
declare @sysadmin int
|
|
set @sysadmin=1
|
|
---
|
|
|
|
declare @mailempfang int
|
|
declare @mailadresse varchar(255)
|
|
declare @sendmail1 int
|
|
declare @sendmail2 int
|
|
declare @edkmail int
|
|
declare @empfaenger int
|
|
|
|
select @sendmail2=MailDokumentrueckgang, @sendmail1=edokamesasge,
|
|
@mailempfang=mailempfang, @mailadresse=email, @edkmail=edoka_mail
|
|
from mitarbeiter where mitarbeiternr=@mitarbeiter
|
|
|
|
-- Meldung ueber Dokumenterstellung (OK, NOK)
|
|
if @status = 3 or @status = 2 begin
|
|
if @edkmail=1 begin
|
|
insert message (titel, meldung, absender, empfaenger, erstellt_am, mutiert_am, mutierer, aktiv, dokumentid)
|
|
values (@betreff, @meldung, 9999, @mitarbeiter, getdate(), getdate(), 9999, 1,@dokumentid)
|
|
end
|
|
if @mailempfang=1 begin
|
|
EXEC sp_sendmail @mailadresse,@betreff,@meldung
|
|
end
|
|
end
|
|
|
|
-- Meldung ueber Dokumenterstellung (OK, NOK) fuer Sysadmin
|
|
if @status = 3 or @status = 2 begin
|
|
select @sendmail2=MailDokumentrueckgang, @sendmail1=edokamesasge,
|
|
@mailempfang=mailempfang, @mailadresse=email, @edkmail=edoka_mail
|
|
from mitarbeiter where mitarbeiternr=@sysadmin
|
|
|
|
if @edkmail=1 begin
|
|
insert message (titel, meldung, absender, empfaenger, erstellt_am, mutiert_am, mutierer, aktiv, dokumentid)
|
|
values (@betreff, @meldung, 9999, @mitarbeiter, getdate(), getdate(), 9999, 1,@dokumentid)
|
|
end
|
|
if @mailempfang=1 begin
|
|
EXEC sp_sendmail @mailadresse,@betreff,@meldung
|
|
end
|
|
end
|
|
|
|
-- Fehlermeldung
|
|
if @status = -1 begin
|
|
select @sendmail2=MailDokumentrueckgang, @sendmail1=edokamesasge,
|
|
@mailempfang=mailempfang, @mailadresse=email, @edkmail=edoka_mail
|
|
from mitarbeiter where mitarbeiternr=@sysadmin
|
|
|
|
if @edkmail=1 begin
|
|
insert message (titel, meldung, absender, empfaenger, erstellt_am, mutiert_am, mutierer, aktiv, dokumentid)
|
|
values (@betreff, @meldung, 9999, @mitarbeiter, getdate(), getdate(), 9999, 1,@dokumentid)
|
|
end
|
|
if @mailempfang=1 begin
|
|
EXEC sp_sendmail @mailadresse,@betreff,@meldung
|
|
end
|
|
end
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------------------------------
|
|
-- Name: sp_sp_edkb12_profil
|
|
-- Desc: Liest das erste (Standard-) Profil des verantwortlichen Mitarbeiters aus
|
|
--
|
|
-- Autor Stefan Hutter
|
|
--
|
|
-- Remarks: EDOKA Rel. 4.02
|
|
-- Version : 1.0 / 17.08.2008
|
|
---------------------------------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[sp_edkb12_profil]
|
|
@mitarbeiternr int
|
|
AS
|
|
SELECT TOP 100 PERCENT profilnr, standard, aktiv, mitarbeiternr, unterschriftlinks, unterschriftrechts
|
|
FROM dbo.profil
|
|
WHERE (mitarbeiternr = @mitarbeiternr) and aktiv=1
|
|
ORDER BY standard DESC
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
|