-- 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.
--

----------------------------------------------------------------------------------------------
--
IF 0 < (SELECT count(*) from [sysobjects] where [xtype] = 'V' and [name] = 'itcview_LohnartenAuswahl')
  DROP VIEW [dbo].[itcview_LohnartenAuswahl]
GO
CREATE VIEW [dbo].[itcview_LohnartenAuswahl] AS
  SELECT RecId, lohnart, lohnarttxt, bsoll, stdloa FROM ut_Lohnarten
GO

--------------------------------------------------------------------------------------------------------
-- LohnartenAuswahl abrufen
IF 0 < (SELECT count(*) from [sysobjects] where [xtype] = 'P' and [name] = 'itcproc_LohnartenAuswahl_get')
  DROP PROCEDURE [dbo].[itcproc_LohnartenAuswahl_get]
GO
CREATE PROCEDURE [dbo].[itcproc_LohnartenAuswahl_get]
  @Parm_Knr varchar(20)  
 ,@Parm_Uid varchar(30)  -- fuer spaetere Verwendung als Filter
 ,@Parm_Filter  varchar(40) = '%'
 ,@Parm_Sorting varchar(20) = 'lohnart'
AS
  If @Parm_Sorting = 'lohnarttxt'
    SELECT * FROM [dbo].[itcview_LohnartenAuswahl] WHERE lohnarttxt LIKE @Parm_Filter ORDER BY lohnarttxt
  ELSE
    SELECT * FROM [dbo].[itcview_LohnartenAuswahl] WHERE lohnart LIKE @Parm_Filter ORDER BY lohnart
GO

