-- This file is part of the it-crafts software and is subject to copyright protection.
-- (C) 2023, All rights reserved by Steffen Anders, Elsteraue - Germany
-- Visit also https://www.it-crafts.de.
--

-- ---------------------------------------------------------------------------------------------------------------
-- alle Paketkoepfe auflisten, die zur Gruppe der Online-Auswahl (FS-9955) gehoeren
IF 0 < (SELECT count(*) from [sysobjects] where [xtype] = 'P'   and [name] = 'itcproc_StammPakete_Online_list')
  DROP PROCEDURE [dbo].[itcproc_StammPakete_Online_list]
GO
CREATE PROCEDURE [dbo].[itcproc_StammPakete_Online_list]
  @Param_Dummy varchar(100) = ''
AS
  select p.* from ut_Optionen o right join [dbo].[StammPakete] p on p.Gruppe = o.OptDataC
    where OptId = ' 9955' and LfdNr = '000' order by PktNr
GO

-- ---------------------------------------------------------------------------------------------------------------
-- alle Paketteile auflisten, die zu einem Paket gehoeren
IF 0 < (SELECT count(*) from [sysobjects] where [xtype] = 'P'   and [name] = 'itcproc_StammPakete_Parts_list')
  DROP PROCEDURE [dbo].[itcproc_StammPakete_Parts_list]
GO
CREATE PROCEDURE [dbo].[itcproc_StammPakete_Parts_list]
  @Param_PktNr varchar(17)
 ,@Param_Dummy varchar(100) = ''
AS
  select pp.*, me.[Name] as MeBez from [dbo].[StammPakete] pp
    left join [dbo].[ut_Mengeneinheiten] me WITH(INDEX = Ik_Primary) on me.Nr = STR(pp.Einheit,4)
    where PktNr = @Param_PktNr and LfdNr > '000' order by LfdNr
GO

--EXECUTE [dbo].[itcproc_StammPakete_Online_list]
--EXECUTE [dbo].[itcproc_StammPakete_Parts_list] 'PLOEL'




