-- dbo.ef_Kmen_VratPocetKsVKartonu
CREATE FUNCTION dbo.ef_Kmen_VratPocetKsVKartonu (@IDKmenZbozi INT)
RETURNS NUMERIC(19,6)
AS
BEGIN
 DECLARE @retVal NUMERIC(19,6)
 SET @retVal = ISNULL( (SELECT PocetOdvozene FROM dbo.TabMJZbozi WHERE IDKmenZbozi=@IDKmenZbozi AND KodMJ1=N'KA' AND KodMJ2=N'ks'), 0)
 RETURN @retVal
END
