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.

38 lines
1.7 KiB

Formulare: Prüfung Dentotar auf Tarif-Nr. anstelle von 222
DB:
Neue Tabelle: Dentotar_223
Tabelle SQL-Statements: Nr. 39 Select *,leistungnrneu+' '+leistungd as nr_bez from dentotar_223
Tabelle Tarife: Neuer Eintrag:Zahntechnik (VZLS) ( Nr. 7)
Update leistung set nrtarif=5 where nrtarif=0 and nrtarifgruppe=0
USE [DPM2018_1]
GO
/****** Object: View [dbo].[View_Leistungen_Dentotar] Script Date: 03.09.2019 21:15:28 ******/
DROP VIEW [dbo].[View_Leistungen_Dentotar]
GO
/****** Object: View [dbo].[View_Leistungen_Dentotar] Script Date: 03.09.2019 21:15:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[View_Leistungen_Dentotar]
AS
SELECT dbo.LEISTUNG.Datum, CASE WHEN leistung.nrtarif = 5 THEN 222 WHEN leistung.nrtarif = 7 THEN 223 ELSE 0 END AS Tarif, CASE WHEN len(dbo.LEISTUNG.SSO_Nummer)
< 5 THEN 'P.' + dbo.leistung.sso_nummer ELSE dbo.leistung.sso_nummer END AS Tarifziffer, dbo.LEISTUNG.Bezd AS Tarifziffer_Beschreibung, 0 AS Bezugsziffer, 1 AS SI, 0 AS St, dbo.LEISTUNG.Menge AS Anzahl,
CASE WHEN absolut = 1 THEN frankenprotaxpunkt ELSE dbo.LEISTUNG.Taxpunkte END AS TPAL_Preis, dbo.Behandlu.Nrbehandlung, 1 AS TPW_AL, '' AS TP_TL, '' AS f_TL, '' AS TPW_TL, 1 AS A, 1 AS V, 1 AS P,
CASE WHEN len(leistungnrneu) > 6 OR
len(dbo.leistung.sso_nummer) < 5 THEN 1 ELSE 0 END AS M, dbo.LEISTUNG.Total AS Betrag
FROM dbo.Behandlu INNER JOIN
dbo.LEISTUNG ON dbo.Behandlu.Nrbehandlung = dbo.LEISTUNG.Nrbehandlung LEFT OUTER JOIN
dbo.DentoTar ON dbo.LEISTUNG.SSO_Nummer = dbo.DentoTar.LeistungNrNeu
WHERE (dbo.LEISTUNG.aktiv = 1)
GO